ss-component-new 1.1.321 → 1.1.323
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{array-B7a7NPJU.cjs → array-BLy6dTxS.cjs} +1 -1
- package/dist/{array-C-FBt-w6.js → array-IX9IUh9m.js} +2 -2
- package/dist/{cloneDeep-BCBo2P7c.js → cloneDeep-BqdcURUT.js} +1 -1
- package/dist/{cloneDeep-Dfe27GGP.cjs → cloneDeep-D0K80DHL.cjs} +1 -1
- package/dist/{index-9GphTnn3.js → index-36oaAwsU.js} +3 -3
- package/dist/{index-BhRm0szn.cjs → index-5sRlP80t.cjs} +1 -1
- package/dist/{index-CO1MoNNj.cjs → index-B6ATOi47.cjs} +1 -1
- package/dist/{index-DGQdhDlx.cjs → index-B8KbB-8X.cjs} +1 -1
- package/dist/{index-CXJxkaVz.cjs → index-BBKV22D3.cjs} +1 -1
- package/dist/{index-gv4Kx45I.cjs → index-BE1hUO7e.cjs} +1 -1
- package/dist/{index-C_ALukSb.js → index-BaKyIyFu.js} +5 -5
- package/dist/{index-DSmYcj7E.cjs → index-BcG_v5yb.cjs} +1 -1
- package/dist/{index-GQAcezLl.cjs → index-BfuuBne1.cjs} +1 -1
- package/dist/{index-B9ylWbtH.cjs → index-BiVixJw_.cjs} +1 -1
- package/dist/{index-B1pGYX6g.js → index-BmiiAmhb.js} +3 -3
- package/dist/{index-DtKo1EwI.cjs → index-C36zJQzt.cjs} +1 -1
- package/dist/index-C7Vg0k3i.cjs +11 -0
- package/dist/{index-CnyOW-3P.js → index-C8yOFDtt.js} +4 -4
- package/dist/{index-Ca2rHt6C.js → index-C9-zuyZw.js} +1 -1
- package/dist/{index-B2enzaE2.js → index-CAxDd3ri.js} +3 -3
- package/dist/{index-6JoL18KU.js → index-CC91JpVJ.js} +6 -6
- package/dist/{index-C9giOxZg.js → index-CE4Ldlt4.js} +6 -6
- package/dist/{index-CksMAtZu.cjs → index-CKxM9pon.cjs} +161 -161
- package/dist/{index-DFnqEKzJ.cjs → index-CLKLfkQ-.cjs} +1 -1
- package/dist/{index-CymFMSAS.js → index-CUIMPhPc.js} +9 -9
- package/dist/{index-CvyP7SN4.cjs → index-CZYblYFD.cjs} +1 -1
- package/dist/{index-BQg0VVq4.cjs → index-CZdLtZcH.cjs} +1 -1
- package/dist/{index-ZC9w1ZOi.cjs → index-C_ZX-bzU.cjs} +1 -1
- package/dist/{index-ETZte82B.js → index-CaPN8dJT.js} +5 -5
- package/dist/{index-DWRuDpPB.js → index-CarfPd9p.js} +1 -1
- package/dist/{index-BW8fHFr3.cjs → index-CblYOFsr.cjs} +1 -1
- package/dist/{index-BeJ-4T1d.js → index-Ch8uioxd.js} +135 -135
- package/dist/{index-B8R_1YcJ.cjs → index-CmTmex4y.cjs} +1 -1
- package/dist/{index-IynRqxzh.js → index-CnTxqSXI.js} +9 -9
- package/dist/{index-DH_8-yVF.cjs → index-D1ukr28O.cjs} +1 -1
- package/dist/{index-BYj7719b.js → index-D2nAMrAc.js} +4 -4
- package/dist/{index-DJCo-V_0.js → index-D6RFjfH4.js} +3 -3
- package/dist/{index-DzbEZsq7.cjs → index-DI9uku5W.cjs} +1 -1
- package/dist/{index-Cum9FmiL.js → index-DJlER4fN.js} +7 -7
- package/dist/{index-41WzW0HQ.js → index-DJqrnO55.js} +8 -8
- package/dist/{index-BK4WawKM.cjs → index-DN44r1Lc.cjs} +1 -1
- package/dist/{index-Bgho40P2.cjs → index-DQbr9JoZ.cjs} +1 -1
- package/dist/index-DVeQfmPl.cjs +1 -0
- package/dist/{index-56_km5fJ.cjs → index-DYMPqnBp.cjs} +1 -1
- package/dist/{index-DYKwo9dQ.cjs → index-DZGYp4gi.cjs} +1 -1
- package/dist/{index-bag5UhkN.js → index-DhvBU8l8.js} +6 -6
- package/dist/{index-Yb-y-7vb.js → index-Dmsd8tta.js} +5 -5
- package/dist/{index-rsQ55kHW.cjs → index-KZSHfIo1.cjs} +1 -1
- package/dist/{index-CLaDIaSW.cjs → index-YidUO3nq.cjs} +1 -1
- package/dist/{index-zKJ_fhRb.js → index-f1XZVXrB.js} +1 -1
- package/dist/{index-yAPzGZyB.js → index-iUwOBT-E.js} +3 -3
- package/dist/{index-BCoI86GW.js → index-iu88OSnV.js} +8 -8
- package/dist/index-j85Wo6ug.js +5632 -0
- package/dist/{index-a2ldY1f-.js → index-nK0G37Ty.js} +188 -175
- package/dist/{index-XAfW8sqN.js → index-sSXW5KEi.js} +8 -8
- package/dist/{index-B31X029_.js → index-uJYgijzI.js} +1 -1
- package/dist/{index.vue_vue_type_script_setup_true_lang-Dhlx6gOT.cjs → index.vue_vue_type_script_setup_true_lang-CSDPievE.cjs} +1 -1
- package/dist/{index.vue_vue_type_script_setup_true_lang-CI6HPiSn.js → index.vue_vue_type_script_setup_true_lang-DNlJJ5Is.js} +1 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_62633fa4_lang-CrPULfrx.js +1178 -0
- package/dist/index.vue_vue_type_style_index_0_scoped_62633fa4_lang-DBaHLZoH.cjs +1 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_d9b749a8_lang-CUJRJXLZ.js → index.vue_vue_type_style_index_0_scoped_d9b749a8_lang-B0-II5N_.js} +8 -8
- package/dist/{index.vue_vue_type_style_index_0_scoped_d9b749a8_lang-BRb9nIeN.cjs → index.vue_vue_type_style_index_0_scoped_d9b749a8_lang-WPM2Y7Cd.cjs} +1 -1
- package/dist/{login-DFyLmZjC.js → login-CgdIhuaW.js} +2 -2
- package/dist/{login-DI3Yef8J.cjs → login-DRDRlC29.cjs} +1 -1
- package/dist/{main-KRl16v8X.js → main-B5beLiR4.js} +7 -7
- package/dist/{main-MMs-Ocq5.cjs → main-DzXLZgrk.cjs} +1 -1
- package/dist/{menu-9axm5sPU.js → menu-BH9Zn1jp.js} +1 -1
- package/dist/{menu-ClaTWnGZ.cjs → menu-Dj4S8GRz.cjs} +1 -1
- package/dist/model/final.pcd +19333 -0
- package/dist/model/target.pcd +29276 -0
- package/dist/obj/model.mtl +42 -0
- package/dist/obj/model.obj +26110 -0
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +7 -7
- package/dist/ss-component3.cjs +1 -1
- package/dist/ss-component3.js +1 -1
- package/package.json +1 -1
- package/public/model/final.pcd +19333 -0
- package/public/model/target.pcd +29276 -0
- package/public/obj/model.mtl +42 -0
- package/public/obj/model.obj +26110 -0
- package/dist/index-Bs0aQvhY.cjs +0 -1
- package/dist/index-Coyk-8_r.js +0 -5421
- package/dist/index-aBU24Yq6.cjs +0 -9
- package/dist/index.vue_vue_type_style_index_0_scoped_63a4bd9d_lang-BRkLNqo1.js +0 -1091
- package/dist/index.vue_vue_type_style_index_0_scoped_63a4bd9d_lang-C-PKZjBI.cjs +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";const Y=require("vue"),pr=require("./index-
|
|
1
|
+
"use strict";const Y=require("vue"),pr=require("./index-CLKLfkQ-.cjs"),st=require("./menu-Dj4S8GRz.cjs"),Nn=require("./index-CZdLtZcH.cjs"),Ht=require("./index-C_ZX-bzU.cjs"),Do=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),me=require("./cloneDeep-D0K80DHL.cjs");var Ku="__lodash_hash_undefined__";function ju(i){return this.__data__.set(i,Ku),this}function $u(i){return this.__data__.has(i)}function Cs(i){var e=-1,t=i==null?0:i.length;for(this.__data__=new Nn.MapCache;++e<t;)this.add(i[e])}Cs.prototype.add=Cs.prototype.push=ju;Cs.prototype.has=$u;function Ju(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 Zu(i,e){return i.has(e)}var Qu=1,eh=2;function Gc(i,e,t,n,r,s){var a=t&Qu,o=i.length,l=e.length;if(o!=l&&!(a&&l>o))return!1;var c=s.get(i),u=s.get(e);if(c&&u)return c==e&&u==i;var h=-1,f=!0,p=t&eh?new Cs:void 0;for(s.set(i,e),s.set(e,i);++h<o;){var g=i[h],_=e[h];if(n)var m=a?n(_,g,h,e,i,s):n(g,_,h,i,e,s);if(m!==void 0){if(m)continue;f=!1;break}if(p){if(!Ju(e,function(d,E){if(!Zu(p,E)&&(g===d||r(g,d,t,n,s)))return p.push(E)})){f=!1;break}}else if(!(g===_||r(g,_,t,n,s))){f=!1;break}}return s.delete(i),s.delete(e),f}function th(i){var e=-1,t=Array(i.size);return i.forEach(function(n,r){t[++e]=[r,n]}),t}function nh(i){var e=-1,t=Array(i.size);return i.forEach(function(n){t[++e]=n}),t}var ih=1,rh=2,sh="[object Boolean]",ah="[object Date]",oh="[object Error]",lh="[object Map]",ch="[object Number]",uh="[object RegExp]",hh="[object Set]",fh="[object String]",dh="[object Symbol]",ph="[object ArrayBuffer]",mh="[object DataView]",Qo=Nn.Symbol?Nn.Symbol.prototype:void 0,qs=Qo?Qo.valueOf:void 0;function gh(i,e,t,n,r,s,a){switch(t){case mh:if(i.byteLength!=e.byteLength||i.byteOffset!=e.byteOffset)return!1;i=i.buffer,e=e.buffer;case ph:return!(i.byteLength!=e.byteLength||!s(new me.Uint8Array(i),new me.Uint8Array(e)));case sh:case ah:case ch:return Nn.eq(+i,+e);case oh:return i.name==e.name&&i.message==e.message;case uh:case fh:return i==e+"";case lh:var o=th;case hh:var l=n&ih;if(o||(o=nh),i.size!=e.size&&!l)return!1;var c=a.get(i);if(c)return c==e;n|=rh,a.set(i,e);var u=Gc(o(i),o(e),n,r,s,a);return a.delete(i),u;case dh:if(qs)return qs.call(i)==qs.call(e)}return!1}var _h=1,vh=Object.prototype,xh=vh.hasOwnProperty;function yh(i,e,t,n,r,s){var a=t&_h,o=me.getAllKeys(i),l=o.length,c=me.getAllKeys(e),u=c.length;if(l!=u&&!a)return!1;for(var h=l;h--;){var f=o[h];if(!(a?f in e:xh.call(e,f)))return!1}var p=s.get(i),g=s.get(e);if(p&&g)return p==e&&g==i;var _=!0;s.set(i,e),s.set(e,i);for(var m=a;++h<l;){f=o[h];var d=i[f],E=e[f];if(n)var T=a?n(E,d,f,e,i,s):n(d,E,f,i,e,s);if(!(T===void 0?d===E||r(d,E,t,n,s):T)){_=!1;break}m||(m=f=="constructor")}if(_&&!m){var y=i.constructor,D=e.constructor;y!=D&&"constructor"in i&&"constructor"in e&&!(typeof y=="function"&&y instanceof y&&typeof D=="function"&&D instanceof D)&&(_=!1)}return s.delete(i),s.delete(e),_}var Sh=1,el="[object Arguments]",tl="[object Array]",Nr="[object Object]",Mh=Object.prototype,nl=Mh.hasOwnProperty;function Eh(i,e,t,n,r,s){var a=Nn.isArray(i),o=Nn.isArray(e),l=a?tl:me.getTag(i),c=o?tl:me.getTag(e);l=l==el?Nr:l,c=c==el?Nr:c;var u=l==Nr,h=c==Nr,f=l==c;if(f&&me.isBuffer(i)){if(!me.isBuffer(e))return!1;a=!0,u=!1}if(f&&!u)return s||(s=new me.Stack),a||me.isTypedArray(i)?Gc(i,e,t,n,r,s):gh(i,e,l,t,n,r,s);if(!(t&Sh)){var p=u&&nl.call(i,"__wrapped__"),g=h&&nl.call(e,"__wrapped__");if(p||g){var _=p?i.value():i,m=g?e.value():e;return s||(s=new me.Stack),r(_,m,t,n,s)}}return f?(s||(s=new me.Stack),yh(i,e,t,n,r,s)):!1}function Wc(i,e,t,n,r){return i===e?!0:i==null||e==null||!Nn.isObjectLike(i)&&!Nn.isObjectLike(e)?i!==i&&e!==e:Eh(i,e,t,n,Wc,r)}function bh(i,e){return Wc(i,e)}const Xc=st.defineStore("modelComp",{state:()=>({itemData:[],originalData:[],extraContents:[],nodeDev:"",isEdit:"view",isRefreshCurStructure:!1,isSubmitCurStructure:!1,curStructureCompIds:[]}),actions:{setItemData(i){this.itemData=i},setSubmitCurStructure(i){this.isSubmitCurStructure=i},setCurStructureCompIds(i){this.curStructureCompIds=i},setRefreshCurStructure(i){this.isRefreshCurStructure=i},setOriginalData(i){this.originalData=i},setExtraContents(i){this.extraContents=i},setNodeDev(i){this.nodeDev=i},setIsEdit(i){this.isEdit=i}}}),Th={__name:"index",props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:""},width:{type:Number,default:200}},setup(i){const e=i,t=Y.ref(null),n=Y.ref(!1),r=Y.ref(null);return Y.watch(()=>e==null?void 0:e.isVisible,()=>{n.value=e==null?void 0:e.isVisible},{deep:!0,immediate:!0}),Y.watch(()=>r.value,()=>{Y.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=Y.resolveComponent("el-popover");return Y.openBlock(),Y.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:Y.withCtx(()=>[Y.createElementVNode("div",null,[Y.renderSlot(s.$slots,"reference",{ref_key:"referenceRef",ref:r})])]),default:Y.withCtx(()=>[Y.createElementVNode("div",null,[Y.renderSlot(s.$slots,"content")])]),_:3},8,["visible","title","width"])}}},Ah={class:"extra-button-content"},wh={class:"table-name-wrap"},Rh={class:"table-operator-wrap"},Ch={key:0,class:"extra-header"},Dh=["onClick"],Ph={class:"extra-button-filter"},Lh={class:"form-content-value"},Uh={__name:"header",props:{compName:{type:String,default:"表格名称",required:!1},buttons:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]}},emits:["buttonClick","filter"],setup(i,{emit:e}){const t=e,n=i,r=Y.ref(!1),s=Y.ref([]),a=Y.ref([{label:"取消"},{label:"确认"}]),o=u=>{t("buttonClick",u)},l=u=>{var h,f;s.value=(f=(h=Ht.getColumnChild(me.cloneDeep(u)))==null?void 0:h.filter(p=>(p==null?void 0:p.label)!==""&&(p==null?void 0:p.label)!=="操作"))==null?void 0:f.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=u=>{(u==null?void 0:u.buttonName)==="确认"&&t("filter",u==null?void 0:u.content),r.value=!1};return Y.onMounted(()=>{l(n.columns)}),Y.watch(()=>n.columns,()=>{l(n.columns)},{deep:!0,immediate:!0}),(u,h)=>{var p;const f=Y.resolveComponent("el-tooltip");return Y.openBlock(),Y.createElementBlock("div",Ah,[Y.createElementVNode("div",wh,Y.toDisplayString(i.compName),1),Y.createElementVNode("div",Rh,[n!=null&&n.buttons&&((p=n==null?void 0:n.buttons)==null?void 0:p.length)>0?(Y.openBlock(),Y.createElementBlock("div",Ch,[(Y.openBlock(!0),Y.createElementBlock(Y.Fragment,null,Y.renderList(n==null?void 0:n.buttons,(g,_)=>(Y.openBlock(),Y.createElementBlock("div",{class:"extra-contents",key:_},[Y.createElementVNode("div",{class:"extra-content",style:Y.normalizeStyle({background:(g==null?void 0:g.background)??"var(--ssbutton-theme-bg)",color:"var(--ssbutton-theme-color)"}),onClick:m=>o(g==null?void 0:g.label)},Y.toDisplayString(g==null?void 0:g.label),13,Dh)]))),128))])):Y.createCommentVNode("",!0),Y.createElementVNode("div",Ph,[Y.createVNode(Th,{title:"筛选数据",width:500,isVisible:r.value},{reference:Y.withCtx(()=>[Y.createVNode(f,{content:"筛选",placement:"top-start"},{default:Y.withCtx(()=>[Y.createElementVNode("div",{class:"button-style",onClick:h[0]||(h[0]=g=>r.value=!r.value)},[Y.createVNode(Y.unref(Nn.filter_default),{color:"var(--ssComponent-black)"})])]),_:1})]),content:Y.withCtx(()=>[Y.createElementVNode("div",Lh,[(Y.openBlock(),Y.createBlock(Ht.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"])])])])}}},Ih=Do._export_sfc(Uh,[["__scopeId","data-v-332fd0fe"]]);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2010-2025 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/const Po="177",Nh={ROTATE:0,DOLLY:1,PAN:2},Fh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Oh=0,il=1,Bh=2,qc=1,Yc=2,Pn=3,Fn=0,kt=1,_n=2,Kn=0,Bi=1,rl=2,sl=3,al=4,zh=5,ci=100,kh=101,Vh=102,Hh=103,Gh=104,Wh=200,Xh=201,qh=202,Yh=203,Ua=204,Ia=205,Kh=206,jh=207,$h=208,Jh=209,Zh=210,Qh=211,ef=212,tf=213,nf=214,Na=0,Fa=1,Oa=2,Vi=3,Ba=4,za=5,ka=6,Va=7,Os=0,rf=1,sf=2,jn=0,af=1,of=2,lf=3,Kc=4,cf=5,uf=6,hf=7,ol="attached",ff="detached",jc=300,Hi=301,Gi=302,Ha=303,Ga=304,Bs=306,Wi=1e3,xn=1001,Wa=1002,$t=1003,df=1004,Fr=1005,jt=1006,Ys=1007,Ln=1008,Mn=1009,$c=1010,Jc=1011,Sr=1012,Lo=1013,di=1014,yn=1015,Rr=1016,Uo=1017,Io=1018,Mr=1020,Zc=35902,Qc=1021,eu=1022,rn=1023,Er=1026,br=1027,tu=1028,No=1029,nu=1030,Fo=1031,Oo=1033,ys=33776,Ss=33777,Ms=33778,Es=33779,Xa=35840,qa=35841,Ya=35842,Ka=35843,ja=36196,$a=37492,Ja=37496,Za=37808,Qa=37809,eo=37810,to=37811,no=37812,io=37813,ro=37814,so=37815,ao=37816,oo=37817,lo=37818,co=37819,uo=37820,ho=37821,bs=36492,fo=36494,po=36495,iu=36283,mo=36284,go=36285,_o=36286,Ds=2300,vo=2301,Ks=2302,ll=2400,cl=2401,ul=2402,pf=2500,mf=3200,gf=3201,Bo=0,_f=1,Yn="",Gt="srgb",Xi="srgb-linear",Ps="linear",ut="srgb",vi=7680,hl=519,vf=512,xf=513,yf=514,ru=515,Sf=516,Mf=517,Ef=518,bf=519,xo=35044,fl="300 es",Un=2e3,Ls=2001;class mi{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 Lt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let dl=1234567;const vr=Math.PI/180,qi=180/Math.PI;function hn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Lt[i&255]+Lt[i>>8&255]+Lt[i>>16&255]+Lt[i>>24&255]+"-"+Lt[e&255]+Lt[e>>8&255]+"-"+Lt[e>>16&15|64]+Lt[e>>24&255]+"-"+Lt[t&63|128]+Lt[t>>8&255]+"-"+Lt[t>>16&255]+Lt[t>>24&255]+Lt[n&255]+Lt[n>>8&255]+Lt[n>>16&255]+Lt[n>>24&255]).toLowerCase()}function Ze(i,e,t){return Math.max(e,Math.min(t,i))}function zo(i,e){return(i%e+e)%e}function Tf(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Af(i,e,t){return i!==e?(t-i)/(e-i):0}function xr(i,e,t){return(1-t)*i+t*e}function wf(i,e,t,n){return xr(i,e,1-Math.exp(-t*n))}function Rf(i,e=1){return e-Math.abs(zo(i,e*2)-e)}function Cf(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Df(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Pf(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Lf(i,e){return i+Math.random()*(e-i)}function Uf(i){return i*(.5-Math.random())}function If(i){i!==void 0&&(dl=i);let e=dl+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Nf(i){return i*vr}function Ff(i){return i*qi}function Of(i){return(i&i-1)===0&&i!==0}function Bf(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function zf(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function kf(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),f=a((e-n)/2),p=s((n-e)/2),g=a((n-e)/2);switch(r){case"XYX":i.set(o*u,l*h,l*f,o*c);break;case"YZY":i.set(l*f,o*u,l*h,o*c);break;case"ZXZ":i.set(l*h,l*f,o*u,o*c);break;case"XZX":i.set(o*u,l*g,l*p,o*c);break;case"YXY":i.set(l*p,o*u,l*g,o*c);break;case"ZYZ":i.set(l*g,l*p,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function un(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 ct(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 su={DEG2RAD:vr,RAD2DEG:qi,generateUUID:hn,clamp:Ze,euclideanModulo:zo,mapLinear:Tf,inverseLerp:Af,lerp:xr,damp:wf,pingpong:Rf,smoothstep:Cf,smootherstep:Df,randInt:Pf,randFloat:Lf,randFloatSpread:Uf,seededRandom:If,degToRad:Nf,radToDeg:Ff,isPowerOfTwo:Of,ceilPowerOfTwo:Bf,floorPowerOfTwo:zf,setQuaternionFromProperEuler:kf,normalize:ct,denormalize:un};class We{constructor(e=0,t=0){We.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=Ze(this.x,e.x,t.x),this.y=Ze(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ze(this.x,e,t),this.y=Ze(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ze(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(Ze(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 fn{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],u=n[r+2],h=n[r+3];const f=s[a+0],p=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=f,e[t+1]=p,e[t+2]=g,e[t+3]=_;return}if(h!==_||l!==f||c!==p||u!==g){let m=1-o;const d=l*f+c*p+u*g+h*_,E=d>=0?1:-1,T=1-d*d;if(T>Number.EPSILON){const D=Math.sqrt(T),C=Math.atan2(D,d*E);m=Math.sin(m*C)/D,o=Math.sin(o*C)/D}const y=o*E;if(l=l*m+f*y,c=c*m+p*y,u=u*m+g*y,h=h*m+_*y,m===1-o){const D=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=D,c*=D,u*=D,h*=D}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],u=n[r+3],h=s[a],f=s[a+1],p=s[a+2],g=s[a+3];return e[t]=o*g+u*h+l*p-c*f,e[t+1]=l*g+u*f+c*h-o*p,e[t+2]=c*g+u*p+o*f-l*h,e[t+3]=u*g-o*h-l*f-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),u=o(r/2),h=o(s/2),f=l(n/2),p=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=f*u*h+c*p*g,this._y=c*p*h-f*u*g,this._z=c*u*g+f*p*h,this._w=c*u*h-f*p*g;break;case"YXZ":this._x=f*u*h+c*p*g,this._y=c*p*h-f*u*g,this._z=c*u*g-f*p*h,this._w=c*u*h+f*p*g;break;case"ZXY":this._x=f*u*h-c*p*g,this._y=c*p*h+f*u*g,this._z=c*u*g+f*p*h,this._w=c*u*h-f*p*g;break;case"ZYX":this._x=f*u*h-c*p*g,this._y=c*p*h+f*u*g,this._z=c*u*g-f*p*h,this._w=c*u*h+f*p*g;break;case"YZX":this._x=f*u*h+c*p*g,this._y=c*p*h+f*u*g,this._z=c*u*g-f*p*h,this._w=c*u*h-f*p*g;break;case"XZY":this._x=f*u*h-c*p*g,this._y=c*p*h-f*u*g,this._z=c*u*g+f*p*h,this._w=c*u*h+f*p*g;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],u=t[6],h=t[10],f=n+o+h;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>h){const p=2*Math.sqrt(1+n-o-h);this._w=(u-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>h){const p=2*Math.sqrt(1+o-n-h);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+u)/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(Ze(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,u=t._w;return this._x=n*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-r*o,this._w=a*u-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),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=a*h+this._w*f,this._x=n*h+this._x*f,this._y=r*h+this._y*f,this._z=s*h+this._z*f,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 L{constructor(e=0,t=0,n=0){L.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(pl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(pl.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),u=2*(o*t-s*r),h=2*(s*n-a*t);return this.x=t+l*c+a*h-o*u,this.y=n+l*u+o*c-s*h,this.z=r+l*h+s*u-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=Ze(this.x,e.x,t.x),this.y=Ze(this.y,e.y,t.y),this.z=Ze(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ze(this.x,e,t),this.y=Ze(this.y,e,t),this.z=Ze(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ze(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 js.copy(this).projectOnVector(e),this.sub(js)}reflect(e){return this.sub(js.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(Ze(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 js=new L,pl=new fn;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 u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[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],u=n[4],h=n[7],f=n[2],p=n[5],g=n[8],_=r[0],m=r[3],d=r[6],E=r[1],T=r[4],y=r[7],D=r[2],C=r[5],w=r[8];return s[0]=a*_+o*E+l*D,s[3]=a*m+o*T+l*C,s[6]=a*d+o*y+l*w,s[1]=c*_+u*E+h*D,s[4]=c*m+u*T+h*C,s[7]=c*d+u*y+h*w,s[2]=f*_+p*E+g*D,s[5]=f*m+p*T+g*C,s[8]=f*d+p*y+g*w,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],u=e[8];return t*a*u-t*o*c-n*s*u+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],u=e[8],h=u*a-o*c,f=o*l-u*s,p=c*s-a*l,g=t*h+n*f+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=h*_,e[1]=(r*c-u*n)*_,e[2]=(o*n-r*a)*_,e[3]=f*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=p*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,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($s.makeScale(e,t)),this}rotate(e){return this.premultiply($s.makeRotation(-e)),this}translate(e,t){return this.premultiply($s.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 $s=new qe;function au(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Tr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Vf(){const i=Tr("canvas");return i.style.display="block",i}const ml={};function zi(i){i in ml||(ml[i]=!0,console.warn(i))}function Hf(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 Gf(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 Wf(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 gl=new qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),_l=new qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Xf(){const i={enabled:!0,workingColorSpace:Xi,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ut&&(r.r=In(r.r),r.g=In(r.g),r.b=In(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===ut&&(r.r=ki(r.r),r.g=ki(r.g),r.b=ki(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===Yn?Ps: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 zi("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return zi("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({[Xi]:{primaries:e,whitePoint:n,transfer:Ps,toXYZ:gl,fromXYZ:_l,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Gt},outputColorSpaceConfig:{drawingBufferColorSpace:Gt}},[Gt]:{primaries:e,whitePoint:n,transfer:ut,toXYZ:gl,fromXYZ:_l,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Gt}}}),i}const it=Xf();function In(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ki(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let xi;class qf{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{xi===void 0&&(xi=Tr("canvas")),xi.width=e.width,xi.height=e.height;const r=xi.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=xi}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=Tr("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]=In(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(In(t[n]/255)*255):t[n]=In(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 Yf=0;class ko{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Yf++}),this.uuid=hn(),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(Js(r[a].image)):s.push(Js(r[a]))}else s=Js(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Js(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?qf.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 Kf=0;const Zs=new L;class Ct extends mi{constructor(e=Ct.DEFAULT_IMAGE,t=Ct.DEFAULT_MAPPING,n=xn,r=xn,s=jt,a=Ln,o=rn,l=Mn,c=Ct.DEFAULT_ANISOTROPY,u=Yn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Kf++}),this.uuid=hn(),this.name="",this.source=new ko(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 We(0,0),this.repeat=new We(1,1),this.center=new We(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=u,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(Zs).x}get height(){return this.source.getSize(Zs).y}get depth(){return this.source.getSize(Zs).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!==jc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Wi:e.x=e.x-Math.floor(e.x);break;case xn:e.x=e.x<0?0:1;break;case Wa: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 Wi:e.y=e.y-Math.floor(e.y);break;case xn:e.y=e.y<0?0:1;break;case Wa: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++}}Ct.DEFAULT_IMAGE=null;Ct.DEFAULT_MAPPING=jc;Ct.DEFAULT_ANISOTROPY=1;class et{constructor(e=0,t=0,n=0,r=1){et.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],u=l[4],h=l[8],f=l[1],p=l[5],g=l[9],_=l[2],m=l[6],d=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(c+1)/2,y=(p+1)/2,D=(d+1)/2,C=(u+f)/4,w=(h+_)/4,P=(g+m)/4;return T>y&&T>D?T<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(T),r=C/n,s=w/n):y>D?y<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),n=C/r,s=P/r):D<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(D),n=w/s,r=P/s),this.set(n,r,s,t),this}let E=Math.sqrt((m-g)*(m-g)+(h-_)*(h-_)+(f-u)*(f-u));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(h-_)/E,this.z=(f-u)/E,this.w=Math.acos((c+p+d-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=Ze(this.x,e.x,t.x),this.y=Ze(this.y,e.y,t.y),this.z=Ze(this.z,e.z,t.z),this.w=Ze(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ze(this.x,e,t),this.y=Ze(this.y,e,t),this.z=Ze(this.z,e,t),this.w=Ze(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ze(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 jf extends mi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:jt,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 et(0,0,e,t),this.scissorTest=!1,this.viewport=new et(0,0,e,t);const r={width:e,height:t,depth:n.depth},s=new Ct(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:jt,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 ko(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 pi extends jf{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ou extends Ct{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=$t,this.minFilter=$t,this.wrapR=xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $f extends Ct{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=$t,this.minFilter=$t,this.wrapR=xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class En{constructor(e=new L(1/0,1/0,1/0),t=new L(-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(on.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(on.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=on.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,on):on.fromBufferAttribute(s,a),on.applyMatrix4(e.matrixWorld),this.expandByPoint(on);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Or.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Or.copy(n.boundingBox)),Or.applyMatrix4(e.matrixWorld),this.union(Or)}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,on),on.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(rr),Br.subVectors(this.max,rr),yi.subVectors(e.a,rr),Si.subVectors(e.b,rr),Mi.subVectors(e.c,rr),zn.subVectors(Si,yi),kn.subVectors(Mi,Si),ei.subVectors(yi,Mi);let t=[0,-zn.z,zn.y,0,-kn.z,kn.y,0,-ei.z,ei.y,zn.z,0,-zn.x,kn.z,0,-kn.x,ei.z,0,-ei.x,-zn.y,zn.x,0,-kn.y,kn.x,0,-ei.y,ei.x,0];return!Qs(t,yi,Si,Mi,Br)||(t=[1,0,0,0,1,0,0,0,1],!Qs(t,yi,Si,Mi,Br))?!1:(zr.crossVectors(zn,kn),t=[zr.x,zr.y,zr.z],Qs(t,yi,Si,Mi,Br))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,on).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(on).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:(Tn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Tn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Tn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Tn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Tn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Tn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Tn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Tn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Tn),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 Tn=[new L,new L,new L,new L,new L,new L,new L,new L],on=new L,Or=new En,yi=new L,Si=new L,Mi=new L,zn=new L,kn=new L,ei=new L,rr=new L,Br=new L,zr=new L,ti=new L;function Qs(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){ti.fromArray(i,s);const o=r.x*Math.abs(ti.x)+r.y*Math.abs(ti.y)+r.z*Math.abs(ti.z),l=e.dot(ti),c=t.dot(ti),u=n.dot(ti);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const Jf=new En,sr=new L,ea=new L;class Bn{constructor(e=new L,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):Jf.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;sr.subVectors(e,this.center);const t=sr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(sr,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):(ea.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(sr.copy(e.center).add(ea)),this.expandByPoint(sr.copy(e.center).sub(ea))),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 An=new L,ta=new L,kr=new L,Vn=new L,na=new L,Vr=new L,ia=new L;class Ki{constructor(e=new L,t=new L(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,An)),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=An.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(An.copy(this.origin).addScaledVector(this.direction,t),An.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ta.copy(e).add(t).multiplyScalar(.5),kr.copy(t).sub(e).normalize(),Vn.copy(this.origin).sub(ta);const s=e.distanceTo(t)*.5,a=-this.direction.dot(kr),o=Vn.dot(this.direction),l=-Vn.dot(kr),c=Vn.lengthSq(),u=Math.abs(1-a*a);let h,f,p,g;if(u>0)if(h=a*l-o,f=a*o-l,g=s*u,h>=0)if(f>=-g)if(f<=g){const _=1/u;h*=_,f*=_,p=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f<=-g?(h=Math.max(0,-(-a*s+o)),f=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c):f<=g?(h=0,f=Math.min(Math.max(-s,-l),s),p=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c);else f=a>0?-s:s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ta).addScaledVector(kr,f),p}intersectSphere(e,t){An.subVectors(e.center,this.origin);const n=An.dot(this.direction),r=An.dot(An)-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,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),h>=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),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,An)!==null}intersectTriangle(e,t,n,r,s){na.subVectors(t,e),Vr.subVectors(n,e),ia.crossVectors(na,Vr);let a=this.direction.dot(ia),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Vn.subVectors(this.origin,e);const l=o*this.direction.dot(Vr.crossVectors(Vn,Vr));if(l<0)return null;const c=o*this.direction.dot(na.cross(Vn));if(c<0||l+c>a)return null;const u=-o*Vn.dot(ia);return u<0?null:this.at(u/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 Ke{constructor(e,t,n,r,s,a,o,l,c,u,h,f,p,g,_,m){Ke.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,u,h,f,p,g,_,m)}set(e,t,n,r,s,a,o,l,c,u,h,f,p,g,_,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=n,d[12]=r,d[1]=s,d[5]=a,d[9]=o,d[13]=l,d[2]=c,d[6]=u,d[10]=h,d[14]=f,d[3]=p,d[7]=g,d[11]=_,d[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 Ke().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/Ei.setFromMatrixColumn(e,0).length(),s=1/Ei.setFromMatrixColumn(e,1).length(),a=1/Ei.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),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*u,p=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+g*c,t[5]=f-_*c,t[9]=-o*l,t[2]=_-f*c,t[6]=g+p*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,p=l*h,g=c*u,_=c*h;t[0]=f+_*o,t[4]=g*o-p,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=p*o-g,t[6]=_+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,p=l*h,g=c*u,_=c*h;t[0]=f-_*o,t[4]=-a*h,t[8]=g+p*o,t[1]=p+g*o,t[5]=a*u,t[9]=_-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,p=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=g*c-p,t[8]=f*c+_,t[1]=l*h,t[5]=_*c+f,t[9]=p*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,p=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-f*h,t[8]=g*h+p,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=p*h+g,t[10]=f-_*h}else if(e.order==="XZY"){const f=a*l,p=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+_,t[5]=a*u,t[9]=p*h-g,t[2]=g*h-p,t[6]=o*u,t[10]=_*h+f}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(Zf,e,Qf)}lookAt(e,t,n){const r=this.elements;return Yt.subVectors(e,t),Yt.lengthSq()===0&&(Yt.z=1),Yt.normalize(),Hn.crossVectors(n,Yt),Hn.lengthSq()===0&&(Math.abs(n.z)===1?Yt.x+=1e-4:Yt.z+=1e-4,Yt.normalize(),Hn.crossVectors(n,Yt)),Hn.normalize(),Hr.crossVectors(Yt,Hn),r[0]=Hn.x,r[4]=Hr.x,r[8]=Yt.x,r[1]=Hn.y,r[5]=Hr.y,r[9]=Yt.y,r[2]=Hn.z,r[6]=Hr.z,r[10]=Yt.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],u=n[1],h=n[5],f=n[9],p=n[13],g=n[2],_=n[6],m=n[10],d=n[14],E=n[3],T=n[7],y=n[11],D=n[15],C=r[0],w=r[4],P=r[8],M=r[12],x=r[1],b=r[5],O=r[9],F=r[13],k=r[2],W=r[6],B=r[10],J=r[14],V=r[3],le=r[7],ge=r[11],se=r[15];return s[0]=a*C+o*x+l*k+c*V,s[4]=a*w+o*b+l*W+c*le,s[8]=a*P+o*O+l*B+c*ge,s[12]=a*M+o*F+l*J+c*se,s[1]=u*C+h*x+f*k+p*V,s[5]=u*w+h*b+f*W+p*le,s[9]=u*P+h*O+f*B+p*ge,s[13]=u*M+h*F+f*J+p*se,s[2]=g*C+_*x+m*k+d*V,s[6]=g*w+_*b+m*W+d*le,s[10]=g*P+_*O+m*B+d*ge,s[14]=g*M+_*F+m*J+d*se,s[3]=E*C+T*x+y*k+D*V,s[7]=E*w+T*b+y*W+D*le,s[11]=E*P+T*O+y*B+D*ge,s[15]=E*M+T*F+y*J+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],u=e[2],h=e[6],f=e[10],p=e[14],g=e[3],_=e[7],m=e[11],d=e[15];return g*(+s*l*h-r*c*h-s*o*f+n*c*f+r*o*p-n*l*p)+_*(+t*l*p-t*c*f+s*a*f-r*a*p+r*c*u-s*l*u)+m*(+t*c*h-t*o*p-s*a*h+n*a*p+s*o*u-n*c*u)+d*(-r*o*u-t*l*h+t*o*f+r*a*h-n*a*f+n*l*u)}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],u=e[8],h=e[9],f=e[10],p=e[11],g=e[12],_=e[13],m=e[14],d=e[15],E=h*m*c-_*f*c+_*l*p-o*m*p-h*l*d+o*f*d,T=g*f*c-u*m*c-g*l*p+a*m*p+u*l*d-a*f*d,y=u*_*c-g*h*c+g*o*p-a*_*p-u*o*d+a*h*d,D=g*h*l-u*_*l-g*o*f+a*_*f+u*o*m-a*h*m,C=t*E+n*T+r*y+s*D;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/C;return e[0]=E*w,e[1]=(_*f*s-h*m*s-_*r*p+n*m*p+h*r*d-n*f*d)*w,e[2]=(o*m*s-_*l*s+_*r*c-n*m*c-o*r*d+n*l*d)*w,e[3]=(h*l*s-o*f*s-h*r*c+n*f*c+o*r*p-n*l*p)*w,e[4]=T*w,e[5]=(u*m*s-g*f*s+g*r*p-t*m*p-u*r*d+t*f*d)*w,e[6]=(g*l*s-a*m*s-g*r*c+t*m*c+a*r*d-t*l*d)*w,e[7]=(a*f*s-u*l*s+u*r*c-t*f*c-a*r*p+t*l*p)*w,e[8]=y*w,e[9]=(g*h*s-u*_*s-g*n*p+t*_*p+u*n*d-t*h*d)*w,e[10]=(a*_*s-g*o*s+g*n*c-t*_*c-a*n*d+t*o*d)*w,e[11]=(u*o*s-a*h*s-u*n*c+t*h*c+a*n*p-t*o*p)*w,e[12]=D*w,e[13]=(u*_*r-g*h*r+g*n*f-t*_*f-u*n*m+t*h*m)*w,e[14]=(g*o*r-a*_*r-g*n*l+t*_*l+a*n*m-t*o*m)*w,e[15]=(a*h*r-u*o*r+u*n*l-t*h*l-a*n*f+t*o*f)*w,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,u=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+n,u*l-r*a,0,c*l-r*o,u*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,u=a+a,h=o+o,f=s*c,p=s*u,g=s*h,_=a*u,m=a*h,d=o*h,E=l*c,T=l*u,y=l*h,D=n.x,C=n.y,w=n.z;return r[0]=(1-(_+d))*D,r[1]=(p+y)*D,r[2]=(g-T)*D,r[3]=0,r[4]=(p-y)*C,r[5]=(1-(f+d))*C,r[6]=(m+E)*C,r[7]=0,r[8]=(g+T)*w,r[9]=(m-E)*w,r[10]=(1-(f+_))*w,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=Ei.set(r[0],r[1],r[2]).length();const a=Ei.set(r[4],r[5],r[6]).length(),o=Ei.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],ln.copy(this);const c=1/s,u=1/a,h=1/o;return ln.elements[0]*=c,ln.elements[1]*=c,ln.elements[2]*=c,ln.elements[4]*=u,ln.elements[5]*=u,ln.elements[6]*=u,ln.elements[8]*=h,ln.elements[9]*=h,ln.elements[10]*=h,t.setFromRotationMatrix(ln),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Un){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),h=(t+e)/(t-e),f=(n+r)/(n-r);let p,g;if(o===Un)p=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Ls)p=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Un){const l=this.elements,c=1/(t-e),u=1/(n-r),h=1/(a-s),f=(t+e)*c,p=(n+r)*u;let g,_;if(o===Un)g=(a+s)*h,_=-2*h;else if(o===Ls)g=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,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 Ei=new L,ln=new Ke,Zf=new L(0,0,0),Qf=new L(1,1,1),Hn=new L,Hr=new L,Yt=new L,vl=new Ke,xl=new fn;class Jt{constructor(e=0,t=0,n=0,r=Jt.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],u=r[9],h=r[2],f=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Ze(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ze(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ze(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ze(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Ze(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Ze(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,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 vl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(vl,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return xl.setFromEuler(this),this.setFromQuaternion(xl,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}}Jt.DEFAULT_ORDER="XYZ";class Vo{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 ed=0;const yl=new L,bi=new fn,wn=new Ke,Gr=new L,ar=new L,td=new L,nd=new fn,Sl=new L(1,0,0),Ml=new L(0,1,0),El=new L(0,0,1),bl={type:"added"},id={type:"removed"},Ti={type:"childadded",child:null},ra={type:"childremoved",child:null};class ht extends mi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ed++}),this.uuid=hn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ht.DEFAULT_UP.clone();const e=new L,t=new Jt,n=new fn,r=new L(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 Ke},normalMatrix:{value:new qe}}),this.matrix=new Ke,this.matrixWorld=new Ke,this.matrixAutoUpdate=ht.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ht.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Vo,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 bi.setFromAxisAngle(e,t),this.quaternion.multiply(bi),this}rotateOnWorldAxis(e,t){return bi.setFromAxisAngle(e,t),this.quaternion.premultiply(bi),this}rotateX(e){return this.rotateOnAxis(Sl,e)}rotateY(e){return this.rotateOnAxis(Ml,e)}rotateZ(e){return this.rotateOnAxis(El,e)}translateOnAxis(e,t){return yl.copy(e).applyQuaternion(this.quaternion),this.position.add(yl.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Sl,e)}translateY(e){return this.translateOnAxis(Ml,e)}translateZ(e){return this.translateOnAxis(El,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(wn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Gr.copy(e):Gr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ar.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?wn.lookAt(ar,Gr,this.up):wn.lookAt(Gr,ar,this.up),this.quaternion.setFromRotationMatrix(wn),r&&(wn.extractRotation(r.matrixWorld),bi.setFromRotationMatrix(wn),this.quaternion.premultiply(bi.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(bl),Ti.child=e,this.dispatchEvent(Ti),Ti.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(id),ra.child=e,this.dispatchEvent(ra),ra.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),wn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),wn.multiply(e.parent.matrixWorld)),e.applyMatrix4(wn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(bl),Ti.child=e,this.dispatchEvent(Ti),Ti.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(ar,e,td),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ar,nd,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,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}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),u=a(e.images),h=a(e.shapes),f=a(e.skeletons),p=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}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}}ht.DEFAULT_UP=new L(0,1,0);ht.DEFAULT_MATRIX_AUTO_UPDATE=!0;ht.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const cn=new L,Rn=new L,sa=new L,Cn=new L,Ai=new L,wi=new L,Tl=new L,aa=new L,oa=new L,la=new L,ca=new et,ua=new et,ha=new et;class nn{constructor(e=new L,t=new L,n=new L){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),cn.subVectors(e,t),r.cross(cn);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){cn.subVectors(r,t),Rn.subVectors(n,t),sa.subVectors(e,t);const a=cn.dot(cn),o=cn.dot(Rn),l=cn.dot(sa),c=Rn.dot(Rn),u=Rn.dot(sa),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const f=1/h,p=(c*l-o*u)*f,g=(a*u-o*l)*f;return s.set(1-p-g,g,p)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Cn)===null?!1:Cn.x>=0&&Cn.y>=0&&Cn.x+Cn.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Cn)===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,Cn.x),l.addScaledVector(a,Cn.y),l.addScaledVector(o,Cn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return ca.setScalar(0),ua.setScalar(0),ha.setScalar(0),ca.fromBufferAttribute(e,t),ua.fromBufferAttribute(e,n),ha.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(ca,s.x),a.addScaledVector(ua,s.y),a.addScaledVector(ha,s.z),a}static isFrontFacing(e,t,n,r){return cn.subVectors(n,t),Rn.subVectors(e,t),cn.cross(Rn).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 cn.subVectors(this.c,this.b),Rn.subVectors(this.a,this.b),cn.cross(Rn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return nn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return nn.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return nn.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;Ai.subVectors(r,n),wi.subVectors(s,n),aa.subVectors(e,n);const l=Ai.dot(aa),c=wi.dot(aa);if(l<=0&&c<=0)return t.copy(n);oa.subVectors(e,r);const u=Ai.dot(oa),h=wi.dot(oa);if(u>=0&&h<=u)return t.copy(r);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Ai,a);la.subVectors(e,s);const p=Ai.dot(la),g=wi.dot(la);if(g>=0&&p<=g)return t.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(wi,o);const m=u*g-p*h;if(m<=0&&h-u>=0&&p-g>=0)return Tl.subVectors(s,r),o=(h-u)/(h-u+(p-g)),t.copy(r).addScaledVector(Tl,o);const d=1/(m+_+f);return a=_*d,o=f*d,t.copy(n).addScaledVector(Ai,a).addScaledVector(wi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const lu={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},Gn={h:0,s:0,l:0},Wr={h:0,s:0,l:0};function fa(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 Ye{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=Gt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,it.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=it.workingColorSpace){return this.r=e,this.g=t,this.b=n,it.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=it.workingColorSpace){if(e=zo(e,1),t=Ze(t,0,1),n=Ze(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=fa(a,s,e+1/3),this.g=fa(a,s,e),this.b=fa(a,s,e-1/3)}return it.colorSpaceToWorking(this,r),this}setStyle(e,t=Gt){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=Gt){const n=lu[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=In(e.r),this.g=In(e.g),this.b=In(e.b),this}copyLinearToSRGB(e){return this.r=ki(e.r),this.g=ki(e.g),this.b=ki(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Gt){return it.workingToColorSpace(Ut.copy(this),e),Math.round(Ze(Ut.r*255,0,255))*65536+Math.round(Ze(Ut.g*255,0,255))*256+Math.round(Ze(Ut.b*255,0,255))}getHexString(e=Gt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=it.workingColorSpace){it.workingToColorSpace(Ut.copy(this),t);const n=Ut.r,r=Ut.g,s=Ut.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case n:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-n)/h+2;break;case s:l=(n-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=it.workingColorSpace){return it.workingToColorSpace(Ut.copy(this),t),e.r=Ut.r,e.g=Ut.g,e.b=Ut.b,e}getStyle(e=Gt){it.workingToColorSpace(Ut.copy(this),e);const t=Ut.r,n=Ut.g,r=Ut.b;return e!==Gt?`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(Gn),this.setHSL(Gn.h+e,Gn.s+t,Gn.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(Gn),e.getHSL(Wr);const n=xr(Gn.h,Wr.h,t),r=xr(Gn.s,Wr.s,t),s=xr(Gn.l,Wr.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 Ut=new Ye;Ye.NAMES=lu;let rd=0;class bn extends mi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rd++}),this.uuid=hn(),this.name="",this.type="Material",this.blending=Bi,this.side=Fn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ua,this.blendDst=Ia,this.blendEquation=ci,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ye(0,0,0),this.blendAlpha=0,this.depthFunc=Vi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=hl,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vi,this.stencilZFail=vi,this.stencilZPass=vi,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!==Bi&&(n.blending=this.blending),this.side!==Fn&&(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!==Ua&&(n.blendSrc=this.blendSrc),this.blendDst!==Ia&&(n.blendDst=this.blendDst),this.blendEquation!==ci&&(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!==Vi&&(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!==hl&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==vi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==vi&&(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 gi extends bn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ye(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 Jt,this.combine=Os,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 gt=new L,Xr=new We;let sd=0;class Nt{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:sd++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=xo,this.updateRanges=[],this.gpuType=yn,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++)Xr.fromBufferAttribute(this,t),Xr.applyMatrix3(e),this.setXY(t,Xr.x,Xr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyMatrix3(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyMatrix4(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyNormalMatrix(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.transformDirection(e),this.setXYZ(t,gt.x,gt.y,gt.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=un(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ct(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=ct(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=ct(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=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ct(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=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=ct(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ct(t,this.array),n=ct(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=ct(t,this.array),n=ct(n,this.array),r=ct(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=ct(t,this.array),n=ct(n,this.array),r=ct(r,this.array),s=ct(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!==xo&&(e.usage=this.usage),e}}class cu extends Nt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class uu extends Nt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class xt extends Nt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ad=0;const tn=new Ke,da=new ht,Ri=new L,Kt=new En,or=new En,Et=new L;class Dt extends mi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ad++}),this.uuid=hn(),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(au(e)?uu:cu)(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 tn.makeRotationFromQuaternion(e),this.applyMatrix4(tn),this}rotateX(e){return tn.makeRotationX(e),this.applyMatrix4(tn),this}rotateY(e){return tn.makeRotationY(e),this.applyMatrix4(tn),this}rotateZ(e){return tn.makeRotationZ(e),this.applyMatrix4(tn),this}translate(e,t,n){return tn.makeTranslation(e,t,n),this.applyMatrix4(tn),this}scale(e,t,n){return tn.makeScale(e,t,n),this.applyMatrix4(tn),this}lookAt(e){return da.lookAt(e),da.updateMatrix(),this.applyMatrix4(da.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ri).negate(),this.translate(Ri.x,Ri.y,Ri.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 xt(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 En);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 L(-1/0,-1/0,-1/0),new L(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];Kt.setFromBufferAttribute(s),this.morphTargetsRelative?(Et.addVectors(this.boundingBox.min,Kt.min),this.boundingBox.expandByPoint(Et),Et.addVectors(this.boundingBox.max,Kt.max),this.boundingBox.expandByPoint(Et)):(this.boundingBox.expandByPoint(Kt.min),this.boundingBox.expandByPoint(Kt.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 Bn);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 L,1/0);return}if(e){const n=this.boundingSphere.center;if(Kt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];or.setFromBufferAttribute(o),this.morphTargetsRelative?(Et.addVectors(Kt.min,or.min),Kt.expandByPoint(Et),Et.addVectors(Kt.max,or.max),Kt.expandByPoint(Et)):(Kt.expandByPoint(or.min),Kt.expandByPoint(or.max))}Kt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Et.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Et));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)Et.fromBufferAttribute(o,c),l&&(Ri.fromBufferAttribute(e,c),Et.add(Ri)),r=Math.max(r,n.distanceToSquared(Et))}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 Nt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<n.count;P++)o[P]=new L,l[P]=new L;const c=new L,u=new L,h=new L,f=new We,p=new We,g=new We,_=new L,m=new L;function d(P,M,x){c.fromBufferAttribute(n,P),u.fromBufferAttribute(n,M),h.fromBufferAttribute(n,x),f.fromBufferAttribute(s,P),p.fromBufferAttribute(s,M),g.fromBufferAttribute(s,x),u.sub(c),h.sub(c),p.sub(f),g.sub(f);const b=1/(p.x*g.y-g.x*p.y);isFinite(b)&&(_.copy(u).multiplyScalar(g.y).addScaledVector(h,-p.y).multiplyScalar(b),m.copy(h).multiplyScalar(p.x).addScaledVector(u,-g.x).multiplyScalar(b),o[P].add(_),o[M].add(_),o[x].add(_),l[P].add(m),l[M].add(m),l[x].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let P=0,M=E.length;P<M;++P){const x=E[P],b=x.start,O=x.count;for(let F=b,k=b+O;F<k;F+=3)d(e.getX(F+0),e.getX(F+1),e.getX(F+2))}const T=new L,y=new L,D=new L,C=new L;function w(P){D.fromBufferAttribute(r,P),C.copy(D);const M=o[P];T.copy(M),T.sub(D.multiplyScalar(D.dot(M))).normalize(),y.crossVectors(C,M);const b=y.dot(l[P])<0?-1:1;a.setXYZW(P,T.x,T.y,T.z,b)}for(let P=0,M=E.length;P<M;++P){const x=E[P],b=x.start,O=x.count;for(let F=b,k=b+O;F<k;F+=3)w(e.getX(F+0)),w(e.getX(F+1)),w(e.getX(F+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 Nt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,p=n.count;f<p;f++)n.setXYZ(f,0,0,0);const r=new L,s=new L,a=new L,o=new L,l=new L,c=new L,u=new L,h=new L;if(e)for(let f=0,p=e.count;f<p;f+=3){const g=e.getX(f+0),_=e.getX(f+1),m=e.getX(f+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),u.subVectors(a,s),h.subVectors(r,s),u.cross(h),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,m),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let f=0,p=t.count;f<p;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),u.subVectors(a,s),h.subVectors(r,s),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Et.fromBufferAttribute(e,t),Et.normalize(),e.setXYZ(t,Et.x,Et.y,Et.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,h=o.normalized,f=new c.constructor(l.length*u);let p=0,g=0;for(let _=0,m=l.length;_<m;_++){o.isInterleavedBufferAttribute?p=l[_]*o.data.stride+o.offset:p=l[_]*u;for(let d=0;d<u;d++)f[g++]=c[p++]}return new Nt(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Dt,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 u=0,h=c.length;u<h;u++){const f=c[u],p=e(f,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],u=[];for(let h=0,f=c.length;h<f;h++){const p=c[h];u.push(p.toJSON(e.data))}u.length>0&&(r[l]=u,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 u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,p=h.length;f<p;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];this.addGroup(h.start,h.count,h.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 Al=new Ke,ni=new Ki,qr=new Bn,wl=new L,Yr=new L,Kr=new L,jr=new L,pa=new L,$r=new L,Rl=new L,Jr=new L;class Rt extends ht{constructor(e=new Dt,t=new gi){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){$r.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],h=s[l];u!==0&&(pa.fromBufferAttribute(h,e),a?$r.addScaledVector(pa,u):$r.addScaledVector(pa.sub(t),u))}t.add($r)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),qr.copy(n.boundingSphere),qr.applyMatrix4(s),ni.copy(e.ray).recast(e.near),!(qr.containsPoint(ni.origin)===!1&&(ni.intersectSphere(qr,wl)===null||ni.origin.distanceToSquared(wl)>(e.far-e.near)**2))&&(Al.copy(s).invert(),ni.copy(e.ray).applyMatrix4(Al),!(n.boundingBox!==null&&ni.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ni)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const m=f[g],d=a[m.materialIndex],E=Math.max(m.start,p.start),T=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let y=E,D=T;y<D;y+=3){const C=o.getX(y),w=o.getX(y+1),P=o.getX(y+2);r=Zr(this,d,e,n,c,u,h,C,w,P),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,p.start),_=Math.min(o.count,p.start+p.count);for(let m=g,d=_;m<d;m+=3){const E=o.getX(m),T=o.getX(m+1),y=o.getX(m+2);r=Zr(this,a,e,n,c,u,h,E,T,y),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const m=f[g],d=a[m.materialIndex],E=Math.max(m.start,p.start),T=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let y=E,D=T;y<D;y+=3){const C=y,w=y+1,P=y+2;r=Zr(this,d,e,n,c,u,h,C,w,P),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,p.start),_=Math.min(l.count,p.start+p.count);for(let m=g,d=_;m<d;m+=3){const E=m,T=m+1,y=m+2;r=Zr(this,a,e,n,c,u,h,E,T,y),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function od(i,e,t,n,r,s,a,o){let l;if(e.side===kt?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===Fn,o),l===null)return null;Jr.copy(o),Jr.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(Jr);return c<t.near||c>t.far?null:{distance:c,point:Jr.clone(),object:i}}function Zr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,Yr),i.getVertexPosition(l,Kr),i.getVertexPosition(c,jr);const u=od(i,e,t,n,Yr,Kr,jr,Rl);if(u){const h=new L;nn.getBarycoord(Rl,Yr,Kr,jr,h),r&&(u.uv=nn.getInterpolatedAttribute(r,o,l,c,h,new We)),s&&(u.uv1=nn.getInterpolatedAttribute(s,o,l,c,h,new We)),a&&(u.normal=nn.getInterpolatedAttribute(a,o,l,c,h,new L),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new L,materialIndex:0};nn.getNormal(Yr,Kr,jr,f.normal),u.face=f,u.barycoord=h}return u}class ji extends Dt{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=[],u=[],h=[];let f=0,p=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,r,a,2),g("x","z","y",1,-1,e,n,-t,r,a,3),g("x","y","z",1,-1,e,t,n,r,s,4),g("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new xt(c,3)),this.setAttribute("normal",new xt(u,3)),this.setAttribute("uv",new xt(h,2));function g(_,m,d,E,T,y,D,C,w,P,M){const x=y/w,b=D/P,O=y/2,F=D/2,k=C/2,W=w+1,B=P+1;let J=0,V=0;const le=new L;for(let ge=0;ge<B;ge++){const se=ge*b-F;for(let ke=0;ke<W;ke++){const je=ke*x-O;le[_]=je*E,le[m]=se*T,le[d]=k,c.push(le.x,le.y,le.z),le[_]=0,le[m]=0,le[d]=C>0?1:-1,u.push(le.x,le.y,le.z),h.push(ke/w),h.push(1-ge/P),J+=1}}for(let ge=0;ge<P;ge++)for(let se=0;se<w;se++){const ke=f+se+W*ge,je=f+se+W*(ge+1),$=f+(se+1)+W*(ge+1),ue=f+(se+1)+W*ge;l.push(ke,je,ue),l.push(je,$,ue),V+=6}o.addGroup(p,V,M),p+=V,f+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ji(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Yi(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 Bt(i){const e={};for(let t=0;t<i.length;t++){const n=Yi(i[t]);for(const r in n)e[r]=n[r]}return e}function ld(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function hu(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:it.workingColorSpace}const Ho={clone:Yi,merge:Bt};var cd=`void main() {
|
|
5
|
+
*/const Po="177",Nh={ROTATE:0,DOLLY:1,PAN:2},Fh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Oh=0,il=1,Bh=2,qc=1,Yc=2,Pn=3,Fn=0,kt=1,_n=2,Kn=0,Bi=1,rl=2,sl=3,al=4,zh=5,ci=100,kh=101,Vh=102,Hh=103,Gh=104,Wh=200,Xh=201,qh=202,Yh=203,Ua=204,Ia=205,Kh=206,jh=207,$h=208,Jh=209,Zh=210,Qh=211,ef=212,tf=213,nf=214,Na=0,Fa=1,Oa=2,Vi=3,Ba=4,za=5,ka=6,Va=7,Os=0,rf=1,sf=2,jn=0,af=1,of=2,lf=3,Kc=4,cf=5,uf=6,hf=7,ol="attached",ff="detached",jc=300,Hi=301,Gi=302,Ha=303,Ga=304,Bs=306,Wi=1e3,xn=1001,Wa=1002,$t=1003,df=1004,Fr=1005,jt=1006,Ys=1007,Ln=1008,Mn=1009,$c=1010,Jc=1011,Sr=1012,Lo=1013,di=1014,yn=1015,Rr=1016,Uo=1017,Io=1018,Mr=1020,Zc=35902,Qc=1021,eu=1022,rn=1023,Er=1026,br=1027,tu=1028,No=1029,nu=1030,Fo=1031,Oo=1033,ys=33776,Ss=33777,Ms=33778,Es=33779,Xa=35840,qa=35841,Ya=35842,Ka=35843,ja=36196,$a=37492,Ja=37496,Za=37808,Qa=37809,eo=37810,to=37811,no=37812,io=37813,ro=37814,so=37815,ao=37816,oo=37817,lo=37818,co=37819,uo=37820,ho=37821,bs=36492,fo=36494,po=36495,iu=36283,mo=36284,go=36285,_o=36286,Ds=2300,vo=2301,Ks=2302,ll=2400,cl=2401,ul=2402,pf=2500,mf=3200,gf=3201,Bo=0,_f=1,Yn="",Gt="srgb",Xi="srgb-linear",Ps="linear",ut="srgb",vi=7680,hl=519,vf=512,xf=513,yf=514,ru=515,Sf=516,Mf=517,Ef=518,bf=519,xo=35044,fl="300 es",Un=2e3,Ls=2001;class mi{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 Ut=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let dl=1234567;const vr=Math.PI/180,qi=180/Math.PI;function hn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ut[i&255]+Ut[i>>8&255]+Ut[i>>16&255]+Ut[i>>24&255]+"-"+Ut[e&255]+Ut[e>>8&255]+"-"+Ut[e>>16&15|64]+Ut[e>>24&255]+"-"+Ut[t&63|128]+Ut[t>>8&255]+"-"+Ut[t>>16&255]+Ut[t>>24&255]+Ut[n&255]+Ut[n>>8&255]+Ut[n>>16&255]+Ut[n>>24&255]).toLowerCase()}function Ze(i,e,t){return Math.max(e,Math.min(t,i))}function zo(i,e){return(i%e+e)%e}function Tf(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Af(i,e,t){return i!==e?(t-i)/(e-i):0}function xr(i,e,t){return(1-t)*i+t*e}function wf(i,e,t,n){return xr(i,e,1-Math.exp(-t*n))}function Rf(i,e=1){return e-Math.abs(zo(i,e*2)-e)}function Cf(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Df(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Pf(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Lf(i,e){return i+Math.random()*(e-i)}function Uf(i){return i*(.5-Math.random())}function If(i){i!==void 0&&(dl=i);let e=dl+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Nf(i){return i*vr}function Ff(i){return i*qi}function Of(i){return(i&i-1)===0&&i!==0}function Bf(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function zf(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function kf(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),f=a((e-n)/2),p=s((n-e)/2),g=a((n-e)/2);switch(r){case"XYX":i.set(o*u,l*h,l*f,o*c);break;case"YZY":i.set(l*f,o*u,l*h,o*c);break;case"ZXZ":i.set(l*h,l*f,o*u,o*c);break;case"XZX":i.set(o*u,l*g,l*p,o*c);break;case"YXY":i.set(l*p,o*u,l*g,o*c);break;case"ZYZ":i.set(l*g,l*p,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function un(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 ct(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 su={DEG2RAD:vr,RAD2DEG:qi,generateUUID:hn,clamp:Ze,euclideanModulo:zo,mapLinear:Tf,inverseLerp:Af,lerp:xr,damp:wf,pingpong:Rf,smoothstep:Cf,smootherstep:Df,randInt:Pf,randFloat:Lf,randFloatSpread:Uf,seededRandom:If,degToRad:Nf,radToDeg:Ff,isPowerOfTwo:Of,ceilPowerOfTwo:Bf,floorPowerOfTwo:zf,setQuaternionFromProperEuler:kf,normalize:ct,denormalize:un};class We{constructor(e=0,t=0){We.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=Ze(this.x,e.x,t.x),this.y=Ze(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ze(this.x,e,t),this.y=Ze(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ze(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(Ze(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 fn{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],u=n[r+2],h=n[r+3];const f=s[a+0],p=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=f,e[t+1]=p,e[t+2]=g,e[t+3]=_;return}if(h!==_||l!==f||c!==p||u!==g){let m=1-o;const d=l*f+c*p+u*g+h*_,E=d>=0?1:-1,T=1-d*d;if(T>Number.EPSILON){const D=Math.sqrt(T),C=Math.atan2(D,d*E);m=Math.sin(m*C)/D,o=Math.sin(o*C)/D}const y=o*E;if(l=l*m+f*y,c=c*m+p*y,u=u*m+g*y,h=h*m+_*y,m===1-o){const D=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=D,c*=D,u*=D,h*=D}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],u=n[r+3],h=s[a],f=s[a+1],p=s[a+2],g=s[a+3];return e[t]=o*g+u*h+l*p-c*f,e[t+1]=l*g+u*f+c*h-o*p,e[t+2]=c*g+u*p+o*f-l*h,e[t+3]=u*g-o*h-l*f-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),u=o(r/2),h=o(s/2),f=l(n/2),p=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=f*u*h+c*p*g,this._y=c*p*h-f*u*g,this._z=c*u*g+f*p*h,this._w=c*u*h-f*p*g;break;case"YXZ":this._x=f*u*h+c*p*g,this._y=c*p*h-f*u*g,this._z=c*u*g-f*p*h,this._w=c*u*h+f*p*g;break;case"ZXY":this._x=f*u*h-c*p*g,this._y=c*p*h+f*u*g,this._z=c*u*g+f*p*h,this._w=c*u*h-f*p*g;break;case"ZYX":this._x=f*u*h-c*p*g,this._y=c*p*h+f*u*g,this._z=c*u*g-f*p*h,this._w=c*u*h+f*p*g;break;case"YZX":this._x=f*u*h+c*p*g,this._y=c*p*h+f*u*g,this._z=c*u*g-f*p*h,this._w=c*u*h-f*p*g;break;case"XZY":this._x=f*u*h-c*p*g,this._y=c*p*h-f*u*g,this._z=c*u*g+f*p*h,this._w=c*u*h+f*p*g;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],u=t[6],h=t[10],f=n+o+h;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>h){const p=2*Math.sqrt(1+n-o-h);this._w=(u-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>h){const p=2*Math.sqrt(1+o-n-h);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+u)/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(Ze(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,u=t._w;return this._x=n*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-r*o,this._w=a*u-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),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=a*h+this._w*f,this._x=n*h+this._x*f,this._y=r*h+this._y*f,this._z=s*h+this._z*f,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 L{constructor(e=0,t=0,n=0){L.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(pl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(pl.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),u=2*(o*t-s*r),h=2*(s*n-a*t);return this.x=t+l*c+a*h-o*u,this.y=n+l*u+o*c-s*h,this.z=r+l*h+s*u-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=Ze(this.x,e.x,t.x),this.y=Ze(this.y,e.y,t.y),this.z=Ze(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ze(this.x,e,t),this.y=Ze(this.y,e,t),this.z=Ze(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ze(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 js.copy(this).projectOnVector(e),this.sub(js)}reflect(e){return this.sub(js.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(Ze(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 js=new L,pl=new fn;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 u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[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],u=n[4],h=n[7],f=n[2],p=n[5],g=n[8],_=r[0],m=r[3],d=r[6],E=r[1],T=r[4],y=r[7],D=r[2],C=r[5],w=r[8];return s[0]=a*_+o*E+l*D,s[3]=a*m+o*T+l*C,s[6]=a*d+o*y+l*w,s[1]=c*_+u*E+h*D,s[4]=c*m+u*T+h*C,s[7]=c*d+u*y+h*w,s[2]=f*_+p*E+g*D,s[5]=f*m+p*T+g*C,s[8]=f*d+p*y+g*w,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],u=e[8];return t*a*u-t*o*c-n*s*u+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],u=e[8],h=u*a-o*c,f=o*l-u*s,p=c*s-a*l,g=t*h+n*f+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=h*_,e[1]=(r*c-u*n)*_,e[2]=(o*n-r*a)*_,e[3]=f*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=p*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,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($s.makeScale(e,t)),this}rotate(e){return this.premultiply($s.makeRotation(-e)),this}translate(e,t){return this.premultiply($s.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 $s=new qe;function au(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Tr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Vf(){const i=Tr("canvas");return i.style.display="block",i}const ml={};function zi(i){i in ml||(ml[i]=!0,console.warn(i))}function Hf(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 Gf(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 Wf(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 gl=new qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),_l=new qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Xf(){const i={enabled:!0,workingColorSpace:Xi,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ut&&(r.r=In(r.r),r.g=In(r.g),r.b=In(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===ut&&(r.r=ki(r.r),r.g=ki(r.g),r.b=ki(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===Yn?Ps: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 zi("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return zi("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({[Xi]:{primaries:e,whitePoint:n,transfer:Ps,toXYZ:gl,fromXYZ:_l,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Gt},outputColorSpaceConfig:{drawingBufferColorSpace:Gt}},[Gt]:{primaries:e,whitePoint:n,transfer:ut,toXYZ:gl,fromXYZ:_l,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Gt}}}),i}const it=Xf();function In(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ki(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let xi;class qf{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{xi===void 0&&(xi=Tr("canvas")),xi.width=e.width,xi.height=e.height;const r=xi.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=xi}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=Tr("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]=In(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(In(t[n]/255)*255):t[n]=In(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 Yf=0;class ko{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Yf++}),this.uuid=hn(),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(Js(r[a].image)):s.push(Js(r[a]))}else s=Js(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Js(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?qf.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 Kf=0;const Zs=new L;class Ct extends mi{constructor(e=Ct.DEFAULT_IMAGE,t=Ct.DEFAULT_MAPPING,n=xn,r=xn,s=jt,a=Ln,o=rn,l=Mn,c=Ct.DEFAULT_ANISOTROPY,u=Yn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Kf++}),this.uuid=hn(),this.name="",this.source=new ko(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 We(0,0),this.repeat=new We(1,1),this.center=new We(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=u,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(Zs).x}get height(){return this.source.getSize(Zs).y}get depth(){return this.source.getSize(Zs).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!==jc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Wi:e.x=e.x-Math.floor(e.x);break;case xn:e.x=e.x<0?0:1;break;case Wa: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 Wi:e.y=e.y-Math.floor(e.y);break;case xn:e.y=e.y<0?0:1;break;case Wa: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++}}Ct.DEFAULT_IMAGE=null;Ct.DEFAULT_MAPPING=jc;Ct.DEFAULT_ANISOTROPY=1;class et{constructor(e=0,t=0,n=0,r=1){et.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],u=l[4],h=l[8],f=l[1],p=l[5],g=l[9],_=l[2],m=l[6],d=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(c+1)/2,y=(p+1)/2,D=(d+1)/2,C=(u+f)/4,w=(h+_)/4,P=(g+m)/4;return T>y&&T>D?T<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(T),r=C/n,s=w/n):y>D?y<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),n=C/r,s=P/r):D<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(D),n=w/s,r=P/s),this.set(n,r,s,t),this}let E=Math.sqrt((m-g)*(m-g)+(h-_)*(h-_)+(f-u)*(f-u));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(h-_)/E,this.z=(f-u)/E,this.w=Math.acos((c+p+d-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=Ze(this.x,e.x,t.x),this.y=Ze(this.y,e.y,t.y),this.z=Ze(this.z,e.z,t.z),this.w=Ze(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ze(this.x,e,t),this.y=Ze(this.y,e,t),this.z=Ze(this.z,e,t),this.w=Ze(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ze(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 jf extends mi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:jt,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 et(0,0,e,t),this.scissorTest=!1,this.viewport=new et(0,0,e,t);const r={width:e,height:t,depth:n.depth},s=new Ct(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:jt,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 ko(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 pi extends jf{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ou extends Ct{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=$t,this.minFilter=$t,this.wrapR=xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $f extends Ct{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=$t,this.minFilter=$t,this.wrapR=xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class En{constructor(e=new L(1/0,1/0,1/0),t=new L(-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(on.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(on.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=on.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,on):on.fromBufferAttribute(s,a),on.applyMatrix4(e.matrixWorld),this.expandByPoint(on);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Or.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Or.copy(n.boundingBox)),Or.applyMatrix4(e.matrixWorld),this.union(Or)}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,on),on.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(rr),Br.subVectors(this.max,rr),yi.subVectors(e.a,rr),Si.subVectors(e.b,rr),Mi.subVectors(e.c,rr),zn.subVectors(Si,yi),kn.subVectors(Mi,Si),ei.subVectors(yi,Mi);let t=[0,-zn.z,zn.y,0,-kn.z,kn.y,0,-ei.z,ei.y,zn.z,0,-zn.x,kn.z,0,-kn.x,ei.z,0,-ei.x,-zn.y,zn.x,0,-kn.y,kn.x,0,-ei.y,ei.x,0];return!Qs(t,yi,Si,Mi,Br)||(t=[1,0,0,0,1,0,0,0,1],!Qs(t,yi,Si,Mi,Br))?!1:(zr.crossVectors(zn,kn),t=[zr.x,zr.y,zr.z],Qs(t,yi,Si,Mi,Br))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,on).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(on).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:(Tn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Tn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Tn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Tn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Tn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Tn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Tn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Tn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Tn),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 Tn=[new L,new L,new L,new L,new L,new L,new L,new L],on=new L,Or=new En,yi=new L,Si=new L,Mi=new L,zn=new L,kn=new L,ei=new L,rr=new L,Br=new L,zr=new L,ti=new L;function Qs(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){ti.fromArray(i,s);const o=r.x*Math.abs(ti.x)+r.y*Math.abs(ti.y)+r.z*Math.abs(ti.z),l=e.dot(ti),c=t.dot(ti),u=n.dot(ti);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const Jf=new En,sr=new L,ea=new L;class Bn{constructor(e=new L,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):Jf.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;sr.subVectors(e,this.center);const t=sr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(sr,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):(ea.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(sr.copy(e.center).add(ea)),this.expandByPoint(sr.copy(e.center).sub(ea))),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 An=new L,ta=new L,kr=new L,Vn=new L,na=new L,Vr=new L,ia=new L;class Ki{constructor(e=new L,t=new L(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,An)),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=An.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(An.copy(this.origin).addScaledVector(this.direction,t),An.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ta.copy(e).add(t).multiplyScalar(.5),kr.copy(t).sub(e).normalize(),Vn.copy(this.origin).sub(ta);const s=e.distanceTo(t)*.5,a=-this.direction.dot(kr),o=Vn.dot(this.direction),l=-Vn.dot(kr),c=Vn.lengthSq(),u=Math.abs(1-a*a);let h,f,p,g;if(u>0)if(h=a*l-o,f=a*o-l,g=s*u,h>=0)if(f>=-g)if(f<=g){const _=1/u;h*=_,f*=_,p=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f<=-g?(h=Math.max(0,-(-a*s+o)),f=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c):f<=g?(h=0,f=Math.min(Math.max(-s,-l),s),p=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c);else f=a>0?-s:s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ta).addScaledVector(kr,f),p}intersectSphere(e,t){An.subVectors(e.center,this.origin);const n=An.dot(this.direction),r=An.dot(An)-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,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),h>=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),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,An)!==null}intersectTriangle(e,t,n,r,s){na.subVectors(t,e),Vr.subVectors(n,e),ia.crossVectors(na,Vr);let a=this.direction.dot(ia),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Vn.subVectors(this.origin,e);const l=o*this.direction.dot(Vr.crossVectors(Vn,Vr));if(l<0)return null;const c=o*this.direction.dot(na.cross(Vn));if(c<0||l+c>a)return null;const u=-o*Vn.dot(ia);return u<0?null:this.at(u/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 Ke{constructor(e,t,n,r,s,a,o,l,c,u,h,f,p,g,_,m){Ke.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,u,h,f,p,g,_,m)}set(e,t,n,r,s,a,o,l,c,u,h,f,p,g,_,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=n,d[12]=r,d[1]=s,d[5]=a,d[9]=o,d[13]=l,d[2]=c,d[6]=u,d[10]=h,d[14]=f,d[3]=p,d[7]=g,d[11]=_,d[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 Ke().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/Ei.setFromMatrixColumn(e,0).length(),s=1/Ei.setFromMatrixColumn(e,1).length(),a=1/Ei.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),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*u,p=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+g*c,t[5]=f-_*c,t[9]=-o*l,t[2]=_-f*c,t[6]=g+p*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,p=l*h,g=c*u,_=c*h;t[0]=f+_*o,t[4]=g*o-p,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=p*o-g,t[6]=_+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,p=l*h,g=c*u,_=c*h;t[0]=f-_*o,t[4]=-a*h,t[8]=g+p*o,t[1]=p+g*o,t[5]=a*u,t[9]=_-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,p=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=g*c-p,t[8]=f*c+_,t[1]=l*h,t[5]=_*c+f,t[9]=p*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,p=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-f*h,t[8]=g*h+p,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=p*h+g,t[10]=f-_*h}else if(e.order==="XZY"){const f=a*l,p=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+_,t[5]=a*u,t[9]=p*h-g,t[2]=g*h-p,t[6]=o*u,t[10]=_*h+f}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(Zf,e,Qf)}lookAt(e,t,n){const r=this.elements;return Yt.subVectors(e,t),Yt.lengthSq()===0&&(Yt.z=1),Yt.normalize(),Hn.crossVectors(n,Yt),Hn.lengthSq()===0&&(Math.abs(n.z)===1?Yt.x+=1e-4:Yt.z+=1e-4,Yt.normalize(),Hn.crossVectors(n,Yt)),Hn.normalize(),Hr.crossVectors(Yt,Hn),r[0]=Hn.x,r[4]=Hr.x,r[8]=Yt.x,r[1]=Hn.y,r[5]=Hr.y,r[9]=Yt.y,r[2]=Hn.z,r[6]=Hr.z,r[10]=Yt.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],u=n[1],h=n[5],f=n[9],p=n[13],g=n[2],_=n[6],m=n[10],d=n[14],E=n[3],T=n[7],y=n[11],D=n[15],C=r[0],w=r[4],P=r[8],M=r[12],x=r[1],b=r[5],O=r[9],F=r[13],k=r[2],W=r[6],B=r[10],J=r[14],V=r[3],le=r[7],ge=r[11],se=r[15];return s[0]=a*C+o*x+l*k+c*V,s[4]=a*w+o*b+l*W+c*le,s[8]=a*P+o*O+l*B+c*ge,s[12]=a*M+o*F+l*J+c*se,s[1]=u*C+h*x+f*k+p*V,s[5]=u*w+h*b+f*W+p*le,s[9]=u*P+h*O+f*B+p*ge,s[13]=u*M+h*F+f*J+p*se,s[2]=g*C+_*x+m*k+d*V,s[6]=g*w+_*b+m*W+d*le,s[10]=g*P+_*O+m*B+d*ge,s[14]=g*M+_*F+m*J+d*se,s[3]=E*C+T*x+y*k+D*V,s[7]=E*w+T*b+y*W+D*le,s[11]=E*P+T*O+y*B+D*ge,s[15]=E*M+T*F+y*J+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],u=e[2],h=e[6],f=e[10],p=e[14],g=e[3],_=e[7],m=e[11],d=e[15];return g*(+s*l*h-r*c*h-s*o*f+n*c*f+r*o*p-n*l*p)+_*(+t*l*p-t*c*f+s*a*f-r*a*p+r*c*u-s*l*u)+m*(+t*c*h-t*o*p-s*a*h+n*a*p+s*o*u-n*c*u)+d*(-r*o*u-t*l*h+t*o*f+r*a*h-n*a*f+n*l*u)}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],u=e[8],h=e[9],f=e[10],p=e[11],g=e[12],_=e[13],m=e[14],d=e[15],E=h*m*c-_*f*c+_*l*p-o*m*p-h*l*d+o*f*d,T=g*f*c-u*m*c-g*l*p+a*m*p+u*l*d-a*f*d,y=u*_*c-g*h*c+g*o*p-a*_*p-u*o*d+a*h*d,D=g*h*l-u*_*l-g*o*f+a*_*f+u*o*m-a*h*m,C=t*E+n*T+r*y+s*D;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/C;return e[0]=E*w,e[1]=(_*f*s-h*m*s-_*r*p+n*m*p+h*r*d-n*f*d)*w,e[2]=(o*m*s-_*l*s+_*r*c-n*m*c-o*r*d+n*l*d)*w,e[3]=(h*l*s-o*f*s-h*r*c+n*f*c+o*r*p-n*l*p)*w,e[4]=T*w,e[5]=(u*m*s-g*f*s+g*r*p-t*m*p-u*r*d+t*f*d)*w,e[6]=(g*l*s-a*m*s-g*r*c+t*m*c+a*r*d-t*l*d)*w,e[7]=(a*f*s-u*l*s+u*r*c-t*f*c-a*r*p+t*l*p)*w,e[8]=y*w,e[9]=(g*h*s-u*_*s-g*n*p+t*_*p+u*n*d-t*h*d)*w,e[10]=(a*_*s-g*o*s+g*n*c-t*_*c-a*n*d+t*o*d)*w,e[11]=(u*o*s-a*h*s-u*n*c+t*h*c+a*n*p-t*o*p)*w,e[12]=D*w,e[13]=(u*_*r-g*h*r+g*n*f-t*_*f-u*n*m+t*h*m)*w,e[14]=(g*o*r-a*_*r-g*n*l+t*_*l+a*n*m-t*o*m)*w,e[15]=(a*h*r-u*o*r+u*n*l-t*h*l-a*n*f+t*o*f)*w,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,u=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+n,u*l-r*a,0,c*l-r*o,u*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,u=a+a,h=o+o,f=s*c,p=s*u,g=s*h,_=a*u,m=a*h,d=o*h,E=l*c,T=l*u,y=l*h,D=n.x,C=n.y,w=n.z;return r[0]=(1-(_+d))*D,r[1]=(p+y)*D,r[2]=(g-T)*D,r[3]=0,r[4]=(p-y)*C,r[5]=(1-(f+d))*C,r[6]=(m+E)*C,r[7]=0,r[8]=(g+T)*w,r[9]=(m-E)*w,r[10]=(1-(f+_))*w,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=Ei.set(r[0],r[1],r[2]).length();const a=Ei.set(r[4],r[5],r[6]).length(),o=Ei.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],ln.copy(this);const c=1/s,u=1/a,h=1/o;return ln.elements[0]*=c,ln.elements[1]*=c,ln.elements[2]*=c,ln.elements[4]*=u,ln.elements[5]*=u,ln.elements[6]*=u,ln.elements[8]*=h,ln.elements[9]*=h,ln.elements[10]*=h,t.setFromRotationMatrix(ln),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Un){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),h=(t+e)/(t-e),f=(n+r)/(n-r);let p,g;if(o===Un)p=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Ls)p=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Un){const l=this.elements,c=1/(t-e),u=1/(n-r),h=1/(a-s),f=(t+e)*c,p=(n+r)*u;let g,_;if(o===Un)g=(a+s)*h,_=-2*h;else if(o===Ls)g=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,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 Ei=new L,ln=new Ke,Zf=new L(0,0,0),Qf=new L(1,1,1),Hn=new L,Hr=new L,Yt=new L,vl=new Ke,xl=new fn;class Jt{constructor(e=0,t=0,n=0,r=Jt.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],u=r[9],h=r[2],f=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Ze(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ze(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ze(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ze(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Ze(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Ze(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,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 vl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(vl,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return xl.setFromEuler(this),this.setFromQuaternion(xl,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}}Jt.DEFAULT_ORDER="XYZ";class Vo{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 ed=0;const yl=new L,bi=new fn,wn=new Ke,Gr=new L,ar=new L,td=new L,nd=new fn,Sl=new L(1,0,0),Ml=new L(0,1,0),El=new L(0,0,1),bl={type:"added"},id={type:"removed"},Ti={type:"childadded",child:null},ra={type:"childremoved",child:null};class ht extends mi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ed++}),this.uuid=hn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ht.DEFAULT_UP.clone();const e=new L,t=new Jt,n=new fn,r=new L(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 Ke},normalMatrix:{value:new qe}}),this.matrix=new Ke,this.matrixWorld=new Ke,this.matrixAutoUpdate=ht.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ht.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Vo,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 bi.setFromAxisAngle(e,t),this.quaternion.multiply(bi),this}rotateOnWorldAxis(e,t){return bi.setFromAxisAngle(e,t),this.quaternion.premultiply(bi),this}rotateX(e){return this.rotateOnAxis(Sl,e)}rotateY(e){return this.rotateOnAxis(Ml,e)}rotateZ(e){return this.rotateOnAxis(El,e)}translateOnAxis(e,t){return yl.copy(e).applyQuaternion(this.quaternion),this.position.add(yl.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Sl,e)}translateY(e){return this.translateOnAxis(Ml,e)}translateZ(e){return this.translateOnAxis(El,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(wn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Gr.copy(e):Gr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ar.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?wn.lookAt(ar,Gr,this.up):wn.lookAt(Gr,ar,this.up),this.quaternion.setFromRotationMatrix(wn),r&&(wn.extractRotation(r.matrixWorld),bi.setFromRotationMatrix(wn),this.quaternion.premultiply(bi.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(bl),Ti.child=e,this.dispatchEvent(Ti),Ti.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(id),ra.child=e,this.dispatchEvent(ra),ra.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),wn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),wn.multiply(e.parent.matrixWorld)),e.applyMatrix4(wn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(bl),Ti.child=e,this.dispatchEvent(Ti),Ti.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(ar,e,td),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ar,nd,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,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}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),u=a(e.images),h=a(e.shapes),f=a(e.skeletons),p=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}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}}ht.DEFAULT_UP=new L(0,1,0);ht.DEFAULT_MATRIX_AUTO_UPDATE=!0;ht.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const cn=new L,Rn=new L,sa=new L,Cn=new L,Ai=new L,wi=new L,Tl=new L,aa=new L,oa=new L,la=new L,ca=new et,ua=new et,ha=new et;class nn{constructor(e=new L,t=new L,n=new L){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),cn.subVectors(e,t),r.cross(cn);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){cn.subVectors(r,t),Rn.subVectors(n,t),sa.subVectors(e,t);const a=cn.dot(cn),o=cn.dot(Rn),l=cn.dot(sa),c=Rn.dot(Rn),u=Rn.dot(sa),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const f=1/h,p=(c*l-o*u)*f,g=(a*u-o*l)*f;return s.set(1-p-g,g,p)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Cn)===null?!1:Cn.x>=0&&Cn.y>=0&&Cn.x+Cn.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Cn)===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,Cn.x),l.addScaledVector(a,Cn.y),l.addScaledVector(o,Cn.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return ca.setScalar(0),ua.setScalar(0),ha.setScalar(0),ca.fromBufferAttribute(e,t),ua.fromBufferAttribute(e,n),ha.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(ca,s.x),a.addScaledVector(ua,s.y),a.addScaledVector(ha,s.z),a}static isFrontFacing(e,t,n,r){return cn.subVectors(n,t),Rn.subVectors(e,t),cn.cross(Rn).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 cn.subVectors(this.c,this.b),Rn.subVectors(this.a,this.b),cn.cross(Rn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return nn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return nn.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return nn.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;Ai.subVectors(r,n),wi.subVectors(s,n),aa.subVectors(e,n);const l=Ai.dot(aa),c=wi.dot(aa);if(l<=0&&c<=0)return t.copy(n);oa.subVectors(e,r);const u=Ai.dot(oa),h=wi.dot(oa);if(u>=0&&h<=u)return t.copy(r);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Ai,a);la.subVectors(e,s);const p=Ai.dot(la),g=wi.dot(la);if(g>=0&&p<=g)return t.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(wi,o);const m=u*g-p*h;if(m<=0&&h-u>=0&&p-g>=0)return Tl.subVectors(s,r),o=(h-u)/(h-u+(p-g)),t.copy(r).addScaledVector(Tl,o);const d=1/(m+_+f);return a=_*d,o=f*d,t.copy(n).addScaledVector(Ai,a).addScaledVector(wi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const lu={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},Gn={h:0,s:0,l:0},Wr={h:0,s:0,l:0};function fa(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 Ye{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=Gt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,it.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=it.workingColorSpace){return this.r=e,this.g=t,this.b=n,it.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=it.workingColorSpace){if(e=zo(e,1),t=Ze(t,0,1),n=Ze(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=fa(a,s,e+1/3),this.g=fa(a,s,e),this.b=fa(a,s,e-1/3)}return it.colorSpaceToWorking(this,r),this}setStyle(e,t=Gt){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=Gt){const n=lu[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=In(e.r),this.g=In(e.g),this.b=In(e.b),this}copyLinearToSRGB(e){return this.r=ki(e.r),this.g=ki(e.g),this.b=ki(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Gt){return it.workingToColorSpace(It.copy(this),e),Math.round(Ze(It.r*255,0,255))*65536+Math.round(Ze(It.g*255,0,255))*256+Math.round(Ze(It.b*255,0,255))}getHexString(e=Gt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=it.workingColorSpace){it.workingToColorSpace(It.copy(this),t);const n=It.r,r=It.g,s=It.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case n:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-n)/h+2;break;case s:l=(n-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=it.workingColorSpace){return it.workingToColorSpace(It.copy(this),t),e.r=It.r,e.g=It.g,e.b=It.b,e}getStyle(e=Gt){it.workingToColorSpace(It.copy(this),e);const t=It.r,n=It.g,r=It.b;return e!==Gt?`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(Gn),this.setHSL(Gn.h+e,Gn.s+t,Gn.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(Gn),e.getHSL(Wr);const n=xr(Gn.h,Wr.h,t),r=xr(Gn.s,Wr.s,t),s=xr(Gn.l,Wr.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 It=new Ye;Ye.NAMES=lu;let rd=0;class bn extends mi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rd++}),this.uuid=hn(),this.name="",this.type="Material",this.blending=Bi,this.side=Fn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ua,this.blendDst=Ia,this.blendEquation=ci,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ye(0,0,0),this.blendAlpha=0,this.depthFunc=Vi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=hl,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vi,this.stencilZFail=vi,this.stencilZPass=vi,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!==Bi&&(n.blending=this.blending),this.side!==Fn&&(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!==Ua&&(n.blendSrc=this.blendSrc),this.blendDst!==Ia&&(n.blendDst=this.blendDst),this.blendEquation!==ci&&(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!==Vi&&(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!==hl&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==vi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==vi&&(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 gi extends bn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ye(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 Jt,this.combine=Os,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 gt=new L,Xr=new We;let sd=0;class Dt{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:sd++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=xo,this.updateRanges=[],this.gpuType=yn,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++)Xr.fromBufferAttribute(this,t),Xr.applyMatrix3(e),this.setXY(t,Xr.x,Xr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyMatrix3(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyMatrix4(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.applyNormalMatrix(e),this.setXYZ(t,gt.x,gt.y,gt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)gt.fromBufferAttribute(this,t),gt.transformDirection(e),this.setXYZ(t,gt.x,gt.y,gt.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=un(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ct(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=un(t,this.array)),t}setX(e,t){return this.normalized&&(t=ct(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=un(t,this.array)),t}setY(e,t){return this.normalized&&(t=ct(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=un(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ct(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=un(t,this.array)),t}setW(e,t){return this.normalized&&(t=ct(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ct(t,this.array),n=ct(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=ct(t,this.array),n=ct(n,this.array),r=ct(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=ct(t,this.array),n=ct(n,this.array),r=ct(r,this.array),s=ct(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!==xo&&(e.usage=this.usage),e}}class cu extends Dt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ad extends Dt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class uu extends Dt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class xt extends Dt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let od=0;const tn=new Ke,da=new ht,Ri=new L,Kt=new En,or=new En,Et=new L;class Pt extends mi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:od++}),this.uuid=hn(),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(au(e)?uu:cu)(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 tn.makeRotationFromQuaternion(e),this.applyMatrix4(tn),this}rotateX(e){return tn.makeRotationX(e),this.applyMatrix4(tn),this}rotateY(e){return tn.makeRotationY(e),this.applyMatrix4(tn),this}rotateZ(e){return tn.makeRotationZ(e),this.applyMatrix4(tn),this}translate(e,t,n){return tn.makeTranslation(e,t,n),this.applyMatrix4(tn),this}scale(e,t,n){return tn.makeScale(e,t,n),this.applyMatrix4(tn),this}lookAt(e){return da.lookAt(e),da.updateMatrix(),this.applyMatrix4(da.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ri).negate(),this.translate(Ri.x,Ri.y,Ri.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 xt(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 En);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 L(-1/0,-1/0,-1/0),new L(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];Kt.setFromBufferAttribute(s),this.morphTargetsRelative?(Et.addVectors(this.boundingBox.min,Kt.min),this.boundingBox.expandByPoint(Et),Et.addVectors(this.boundingBox.max,Kt.max),this.boundingBox.expandByPoint(Et)):(this.boundingBox.expandByPoint(Kt.min),this.boundingBox.expandByPoint(Kt.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 Bn);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 L,1/0);return}if(e){const n=this.boundingSphere.center;if(Kt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];or.setFromBufferAttribute(o),this.morphTargetsRelative?(Et.addVectors(Kt.min,or.min),Kt.expandByPoint(Et),Et.addVectors(Kt.max,or.max),Kt.expandByPoint(Et)):(Kt.expandByPoint(or.min),Kt.expandByPoint(or.max))}Kt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Et.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Et));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)Et.fromBufferAttribute(o,c),l&&(Ri.fromBufferAttribute(e,c),Et.add(Ri)),r=Math.max(r,n.distanceToSquared(Et))}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 Dt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<n.count;P++)o[P]=new L,l[P]=new L;const c=new L,u=new L,h=new L,f=new We,p=new We,g=new We,_=new L,m=new L;function d(P,M,x){c.fromBufferAttribute(n,P),u.fromBufferAttribute(n,M),h.fromBufferAttribute(n,x),f.fromBufferAttribute(s,P),p.fromBufferAttribute(s,M),g.fromBufferAttribute(s,x),u.sub(c),h.sub(c),p.sub(f),g.sub(f);const b=1/(p.x*g.y-g.x*p.y);isFinite(b)&&(_.copy(u).multiplyScalar(g.y).addScaledVector(h,-p.y).multiplyScalar(b),m.copy(h).multiplyScalar(p.x).addScaledVector(u,-g.x).multiplyScalar(b),o[P].add(_),o[M].add(_),o[x].add(_),l[P].add(m),l[M].add(m),l[x].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let P=0,M=E.length;P<M;++P){const x=E[P],b=x.start,O=x.count;for(let F=b,k=b+O;F<k;F+=3)d(e.getX(F+0),e.getX(F+1),e.getX(F+2))}const T=new L,y=new L,D=new L,C=new L;function w(P){D.fromBufferAttribute(r,P),C.copy(D);const M=o[P];T.copy(M),T.sub(D.multiplyScalar(D.dot(M))).normalize(),y.crossVectors(C,M);const b=y.dot(l[P])<0?-1:1;a.setXYZW(P,T.x,T.y,T.z,b)}for(let P=0,M=E.length;P<M;++P){const x=E[P],b=x.start,O=x.count;for(let F=b,k=b+O;F<k;F+=3)w(e.getX(F+0)),w(e.getX(F+1)),w(e.getX(F+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 Dt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,p=n.count;f<p;f++)n.setXYZ(f,0,0,0);const r=new L,s=new L,a=new L,o=new L,l=new L,c=new L,u=new L,h=new L;if(e)for(let f=0,p=e.count;f<p;f+=3){const g=e.getX(f+0),_=e.getX(f+1),m=e.getX(f+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),u.subVectors(a,s),h.subVectors(r,s),u.cross(h),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,m),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let f=0,p=t.count;f<p;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),u.subVectors(a,s),h.subVectors(r,s),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Et.fromBufferAttribute(e,t),Et.normalize(),e.setXYZ(t,Et.x,Et.y,Et.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,h=o.normalized,f=new c.constructor(l.length*u);let p=0,g=0;for(let _=0,m=l.length;_<m;_++){o.isInterleavedBufferAttribute?p=l[_]*o.data.stride+o.offset:p=l[_]*u;for(let d=0;d<u;d++)f[g++]=c[p++]}return new Dt(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Pt,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 u=0,h=c.length;u<h;u++){const f=c[u],p=e(f,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],u=[];for(let h=0,f=c.length;h<f;h++){const p=c[h];u.push(p.toJSON(e.data))}u.length>0&&(r[l]=u,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 u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,p=h.length;f<p;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];this.addGroup(h.start,h.count,h.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 Al=new Ke,ni=new Ki,qr=new Bn,wl=new L,Yr=new L,Kr=new L,jr=new L,pa=new L,$r=new L,Rl=new L,Jr=new L;class Rt extends ht{constructor(e=new Pt,t=new gi){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){$r.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],h=s[l];u!==0&&(pa.fromBufferAttribute(h,e),a?$r.addScaledVector(pa,u):$r.addScaledVector(pa.sub(t),u))}t.add($r)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),qr.copy(n.boundingSphere),qr.applyMatrix4(s),ni.copy(e.ray).recast(e.near),!(qr.containsPoint(ni.origin)===!1&&(ni.intersectSphere(qr,wl)===null||ni.origin.distanceToSquared(wl)>(e.far-e.near)**2))&&(Al.copy(s).invert(),ni.copy(e.ray).applyMatrix4(Al),!(n.boundingBox!==null&&ni.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ni)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const m=f[g],d=a[m.materialIndex],E=Math.max(m.start,p.start),T=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let y=E,D=T;y<D;y+=3){const C=o.getX(y),w=o.getX(y+1),P=o.getX(y+2);r=Zr(this,d,e,n,c,u,h,C,w,P),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,p.start),_=Math.min(o.count,p.start+p.count);for(let m=g,d=_;m<d;m+=3){const E=o.getX(m),T=o.getX(m+1),y=o.getX(m+2);r=Zr(this,a,e,n,c,u,h,E,T,y),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const m=f[g],d=a[m.materialIndex],E=Math.max(m.start,p.start),T=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let y=E,D=T;y<D;y+=3){const C=y,w=y+1,P=y+2;r=Zr(this,d,e,n,c,u,h,C,w,P),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,p.start),_=Math.min(l.count,p.start+p.count);for(let m=g,d=_;m<d;m+=3){const E=m,T=m+1,y=m+2;r=Zr(this,a,e,n,c,u,h,E,T,y),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function ld(i,e,t,n,r,s,a,o){let l;if(e.side===kt?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===Fn,o),l===null)return null;Jr.copy(o),Jr.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(Jr);return c<t.near||c>t.far?null:{distance:c,point:Jr.clone(),object:i}}function Zr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,Yr),i.getVertexPosition(l,Kr),i.getVertexPosition(c,jr);const u=ld(i,e,t,n,Yr,Kr,jr,Rl);if(u){const h=new L;nn.getBarycoord(Rl,Yr,Kr,jr,h),r&&(u.uv=nn.getInterpolatedAttribute(r,o,l,c,h,new We)),s&&(u.uv1=nn.getInterpolatedAttribute(s,o,l,c,h,new We)),a&&(u.normal=nn.getInterpolatedAttribute(a,o,l,c,h,new L),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new L,materialIndex:0};nn.getNormal(Yr,Kr,jr,f.normal),u.face=f,u.barycoord=h}return u}class ji extends Pt{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=[],u=[],h=[];let f=0,p=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,r,a,2),g("x","z","y",1,-1,e,n,-t,r,a,3),g("x","y","z",1,-1,e,t,n,r,s,4),g("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new xt(c,3)),this.setAttribute("normal",new xt(u,3)),this.setAttribute("uv",new xt(h,2));function g(_,m,d,E,T,y,D,C,w,P,M){const x=y/w,b=D/P,O=y/2,F=D/2,k=C/2,W=w+1,B=P+1;let J=0,V=0;const le=new L;for(let ge=0;ge<B;ge++){const se=ge*b-F;for(let ke=0;ke<W;ke++){const je=ke*x-O;le[_]=je*E,le[m]=se*T,le[d]=k,c.push(le.x,le.y,le.z),le[_]=0,le[m]=0,le[d]=C>0?1:-1,u.push(le.x,le.y,le.z),h.push(ke/w),h.push(1-ge/P),J+=1}}for(let ge=0;ge<P;ge++)for(let se=0;se<w;se++){const ke=f+se+W*ge,je=f+se+W*(ge+1),$=f+(se+1)+W*(ge+1),ue=f+(se+1)+W*ge;l.push(ke,je,ue),l.push(je,$,ue),V+=6}o.addGroup(p,V,M),p+=V,f+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ji(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Yi(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 Bt(i){const e={};for(let t=0;t<i.length;t++){const n=Yi(i[t]);for(const r in n)e[r]=n[r]}return e}function cd(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function hu(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:it.workingColorSpace}const Ho={clone:Yi,merge:Bt};var ud=`void main() {
|
|
6
6
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
-
}`,
|
|
7
|
+
}`,hd=`void main() {
|
|
8
8
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
-
}`;class On extends bn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=
|
|
9
|
+
}`;class On extends bn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ud,this.fragmentShader=hd,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=Yi(e.uniforms),this.uniformsGroups=cd(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 fu extends ht{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ke,this.projectionMatrix=new Ke,this.projectionMatrixInverse=new Ke,this.coordinateSystem=Un}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 Wn=new L,Cl=new We,Dl=new We;class zt extends fu{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=qi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(vr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return qi*2*Math.atan(Math.tan(vr*.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){Wn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Wn.x,Wn.y).multiplyScalar(-e/Wn.z),Wn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Wn.x,Wn.y).multiplyScalar(-e/Wn.z)}getViewSize(e,t){return this.getViewBounds(e,Cl,Dl),t.subVectors(Dl,Cl)}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(vr*.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 Ci=-90,Di=1;class fd extends ht{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new zt(Ci,Di,e,t);r.layers=this.layers,this.add(r);const s=new zt(Ci,Di,e,t);s.layers=this.layers,this.add(s);const a=new zt(Ci,Di,e,t);a.layers=this.layers,this.add(a);const o=new zt(Ci,Di,e,t);o.layers=this.layers,this.add(o);const l=new zt(Ci,Di,e,t);l.layers=this.layers,this.add(l);const c=new zt(Ci,Di,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===Un)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===Ls)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,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=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=_,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(h,f,p),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class du extends Ct{constructor(e=[],t=Hi,n,r,s,a,o,l,c,u){super(e,t,n,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class dd extends pi{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 du(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 ji(5,5,5),s=new On({name:"CubemapFromEquirect",uniforms:Yi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:kt,blending:Kn});s.uniforms.tEquirect.value=t;const a=new Rt(r,s),o=t.minFilter;return t.minFilter===Ln&&(t.minFilter=jt),new hd(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 mr extends ht{constructor(){super(),this.isGroup=!0,this.type="Group"}}const dd={type:"move"};class ma{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new mr,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 mr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new mr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),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 _ of e.hand.values()){const m=t.getJointPose(_,n),d=this._getHandJoint(c,_);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=m.radius),d.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),p=.02,g=.005;c.inputState.pinching&&f>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-g&&(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(dd)))}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 mr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class pu extends ht{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 Jt,this.environmentIntensity=1,this.environmentRotation=new Jt,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}}class mu{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=xo,this.updateRanges=[],this.version=0,this.uuid=hn()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=hn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=hn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ot=new L;class Sn{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ot.fromBufferAttribute(this,t),Ot.applyMatrix4(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ot.fromBufferAttribute(this,t),Ot.applyNormalMatrix(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ot.fromBufferAttribute(this,t),Ot.transformDirection(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=un(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ct(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=ct(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ct(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ct(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ct(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=un(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=un(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=un(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=un(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ct(t,this.array),n=ct(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ct(t,this.array),n=ct(n,this.array),r=ct(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=ct(t,this.array),n=ct(n,this.array),r=ct(r,this.array),s=ct(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Nt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Sn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class zs extends bn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!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.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Pi;const lr=new L,Li=new L,Ui=new L,Ii=new We,cr=new We,gu=new Ke,Qr=new L,ur=new L,es=new L,Pl=new We,ga=new We,Ll=new We;class Go extends ht{constructor(e=new zs){if(super(),this.isSprite=!0,this.type="Sprite",Pi===void 0){Pi=new Dt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new mu(t,5);Pi.setIndex([0,1,2,0,2,3]),Pi.setAttribute("position",new Sn(n,3,0,!1)),Pi.setAttribute("uv",new Sn(n,2,3,!1))}this.geometry=Pi,this.material=e,this.center=new We(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Li.setFromMatrixScale(this.matrixWorld),gu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ui.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Li.multiplyScalar(-Ui.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;ts(Qr.set(-.5,-.5,0),Ui,a,Li,r,s),ts(ur.set(.5,-.5,0),Ui,a,Li,r,s),ts(es.set(.5,.5,0),Ui,a,Li,r,s),Pl.set(0,0),ga.set(1,0),Ll.set(1,1);let o=e.ray.intersectTriangle(Qr,ur,es,!1,lr);if(o===null&&(ts(ur.set(-.5,.5,0),Ui,a,Li,r,s),ga.set(0,1),o=e.ray.intersectTriangle(Qr,es,ur,!1,lr),o===null))return;const l=e.ray.origin.distanceTo(lr);l<e.near||l>e.far||t.push({distance:l,point:lr.clone(),uv:nn.getInterpolation(lr,Qr,ur,es,Pl,ga,Ll,new We),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function ts(i,e,t,n,r,s){Ii.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(cr.x=s*Ii.x-r*Ii.y,cr.y=r*Ii.x+s*Ii.y):cr.copy(Ii),i.copy(e),i.x+=cr.x,i.y+=cr.y,i.applyMatrix4(gu)}const Ul=new L,Il=new et,Nl=new et,pd=new L,Fl=new Ke,ns=new L,_a=new Bn,Ol=new Ke,va=new Ki;class md extends Rt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ol,this.bindMatrix=new Ke,this.bindMatrixInverse=new Ke,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new En),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ns),this.boundingBox.expandByPoint(ns)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Bn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ns),this.boundingSphere.expandByPoint(ns)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_a.copy(this.boundingSphere),_a.applyMatrix4(r),e.ray.intersectsSphere(_a)!==!1&&(Ol.copy(r).invert(),va.copy(e.ray).applyMatrix4(Ol),!(this.boundingBox!==null&&va.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,va)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new et,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===ol?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ff?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;Il.fromBufferAttribute(r.attributes.skinIndex,e),Nl.fromBufferAttribute(r.attributes.skinWeight,e),Ul.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Nl.getComponent(s);if(a!==0){const o=Il.getComponent(s);Fl.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(pd.copy(Ul).applyMatrix4(Fl),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class _u extends ht{constructor(){super(),this.isBone=!0,this.type="Bone"}}class vu extends Ct{constructor(e=null,t=1,n=1,r,s,a,o,l,c=$t,u=$t,h,f){super(null,a,o,l,c,u,r,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Bl=new Ke,gd=new Ke;class Wo{constructor(e=[],t=[]){this.uuid=hn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Ke)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Ke;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:gd;Bl.multiplyMatrices(o,t[s]),Bl.toArray(n,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Wo(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new vu(t,e,e,rn,yn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new _u),this.bones.push(a),this.boneInverses.push(new Ke().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}const xa=new L,_d=new L,vd=new qe;class qn{constructor(e=new L(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=xa.subVectors(n,t).cross(_d.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(xa),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||vd.getNormalMatrix(e),r=this.coplanarPoint(xa).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 ii=new Bn,is=new L;class Xo{constructor(e=new qn,t=new qn,n=new qn,r=new qn,s=new qn,a=new qn){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=Un){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],h=r[6],f=r[7],p=r[8],g=r[9],_=r[10],m=r[11],d=r[12],E=r[13],T=r[14],y=r[15];if(n[0].setComponents(l-s,f-c,m-p,y-d).normalize(),n[1].setComponents(l+s,f+c,m+p,y+d).normalize(),n[2].setComponents(l+a,f+u,m+g,y+E).normalize(),n[3].setComponents(l-a,f-u,m-g,y-E).normalize(),n[4].setComponents(l-o,f-h,m-_,y-T).normalize(),t===Un)n[5].setComponents(l+o,f+h,m+_,y+T).normalize();else if(t===Ls)n[5].setComponents(o,h,_,T).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(),ii.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ii.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ii)}intersectsSprite(e){return ii.center.set(0,0,0),ii.radius=.7071067811865476,ii.applyMatrix4(e.matrixWorld),this.intersectsSphere(ii)}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(is.x=r.normal.x>0?e.max.x:e.min.x,is.y=r.normal.y>0?e.max.y:e.min.y,is.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(is)<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 xu extends bn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ye(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 Us=new L,Is=new L,zl=new Ke,hr=new Ki,rs=new Bn,ya=new L,kl=new L;class yu extends ht{constructor(e=new Dt,t=new xu){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++)Us.fromBufferAttribute(t,r-1),Is.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Us.distanceTo(Is);e.setAttribute("lineDistance",new xt(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(),rs.copy(n.boundingSphere),rs.applyMatrix4(r),rs.radius+=s,e.ray.intersectsSphere(rs)===!1)return;zl.copy(r).invert(),hr.copy(e.ray).applyMatrix4(zl);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,u=n.index,f=n.attributes.position;if(u!==null){const p=Math.max(0,a.start),g=Math.min(u.count,a.start+a.count);for(let _=p,m=g-1;_<m;_+=c){const d=u.getX(_),E=u.getX(_+1),T=ss(this,e,hr,l,d,E,_);T&&t.push(T)}if(this.isLineLoop){const _=u.getX(g-1),m=u.getX(p),d=ss(this,e,hr,l,_,m,g-1);d&&t.push(d)}}else{const p=Math.max(0,a.start),g=Math.min(f.count,a.start+a.count);for(let _=p,m=g-1;_<m;_+=c){const d=ss(this,e,hr,l,_,_+1,_);d&&t.push(d)}if(this.isLineLoop){const _=ss(this,e,hr,l,g-1,p,g-1);_&&t.push(_)}}}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 ss(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(Us.fromBufferAttribute(o,r),Is.fromBufferAttribute(o,s),t.distanceSqToSegment(Us,Is,ya,kl)>n)return;ya.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(ya);if(!(c<e.near||c>e.far))return{distance:c,point:kl.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const Vl=new L,Hl=new L;class xd extends yu{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)Vl.fromBufferAttribute(t,r),Hl.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Vl.distanceTo(Hl);e.setAttribute("lineDistance",new xt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Su extends bn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ye(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 Gl=new Ke,yo=new Ki,as=new Bn,os=new L;class yd extends ht{constructor(e=new Dt,t=new Su){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(),as.copy(n.boundingSphere),as.applyMatrix4(r),as.radius+=s,e.ray.intersectsSphere(as)===!1)return;Gl.copy(r).invert(),yo.copy(e.ray).applyMatrix4(Gl);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let g=f,_=p;g<_;g++){const m=c.getX(g);os.fromBufferAttribute(h,m),Wl(os,m,l,r,e,t,this)}}else{const f=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let g=f,_=p;g<_;g++)os.fromBufferAttribute(h,g),Wl(os,g,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 Wl(i,e,t,n,r,s,a){const o=yo.distanceSqToPoint(i);if(o<t){const l=new L;yo.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 Sd extends Ct{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Mu extends Ct{constructor(e,t,n=di,r,s,a,o=$t,l=$t,c,u=Er,h=1){if(u!==Er&&u!==br)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:h};super(f,r,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ko(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 qo extends Dt{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],f=[],p=[];let g=0;const _=[],m=n/2;let d=0;E(),a===!1&&(e>0&&T(!0),t>0&&T(!1)),this.setIndex(u),this.setAttribute("position",new xt(h,3)),this.setAttribute("normal",new xt(f,3)),this.setAttribute("uv",new xt(p,2));function E(){const y=new L,D=new L;let C=0;const w=(t-e)/n;for(let P=0;P<=s;P++){const M=[],x=P/s,b=x*(t-e)+e;for(let O=0;O<=r;O++){const F=O/r,k=F*l+o,W=Math.sin(k),B=Math.cos(k);D.x=b*W,D.y=-x*n+m,D.z=b*B,h.push(D.x,D.y,D.z),y.set(W,w,B).normalize(),f.push(y.x,y.y,y.z),p.push(F,1-x),M.push(g++)}_.push(M)}for(let P=0;P<r;P++)for(let M=0;M<s;M++){const x=_[M][P],b=_[M+1][P],O=_[M+1][P+1],F=_[M][P+1];(e>0||M!==0)&&(u.push(x,b,F),C+=3),(t>0||M!==s-1)&&(u.push(b,O,F),C+=3)}c.addGroup(d,C,0),d+=C}function T(y){const D=g,C=new We,w=new L;let P=0;const M=y===!0?e:t,x=y===!0?1:-1;for(let O=1;O<=r;O++)h.push(0,m*x,0),f.push(0,x,0),p.push(.5,.5),g++;const b=g;for(let O=0;O<=r;O++){const k=O/r*l+o,W=Math.cos(k),B=Math.sin(k);w.x=M*B,w.y=m*x,w.z=M*W,h.push(w.x,w.y,w.z),f.push(0,x,0),C.x=W*.5+.5,C.y=B*.5*x+.5,p.push(C.x,C.y),g++}for(let O=0;O<r;O++){const F=D+O,k=b+O;y===!0?u.push(k,k+1,F):u.push(k+1,k,F),P+=3}c.addGroup(d,P,y===!0?1:2),d+=P}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Cr extends Dt{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,u=l+1,h=e/o,f=t/l,p=[],g=[],_=[],m=[];for(let d=0;d<u;d++){const E=d*f-a;for(let T=0;T<c;T++){const y=T*h-s;g.push(y,-E,0),_.push(0,0,1),m.push(T/o),m.push(1-d/l)}}for(let d=0;d<l;d++)for(let E=0;E<o;E++){const T=E+c*d,y=E+c*(d+1),D=E+1+c*(d+1),C=E+1+c*d;p.push(T,y,C),p.push(y,D,C)}this.setIndex(p),this.setAttribute("position",new xt(g,3)),this.setAttribute("normal",new xt(_,3)),this.setAttribute("uv",new xt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cr(e.width,e.height,e.widthSegments,e.heightSegments)}}class ks extends Dt{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const u=[],h=new L,f=new L,p=[],g=[],_=[],m=[];for(let d=0;d<=n;d++){const E=[],T=d/n;let y=0;d===0&&a===0?y=.5/t:d===n&&l===Math.PI&&(y=-.5/t);for(let D=0;D<=t;D++){const C=D/t;h.x=-e*Math.cos(r+C*s)*Math.sin(a+T*o),h.y=e*Math.cos(a+T*o),h.z=e*Math.sin(r+C*s)*Math.sin(a+T*o),g.push(h.x,h.y,h.z),f.copy(h).normalize(),_.push(f.x,f.y,f.z),m.push(C+y,1-T),E.push(c++)}u.push(E)}for(let d=0;d<n;d++)for(let E=0;E<t;E++){const T=u[d][E+1],y=u[d][E],D=u[d+1][E],C=u[d+1][E+1];(d!==0||a>0)&&p.push(T,y,C),(d!==n-1||l<Math.PI)&&p.push(y,D,C)}this.setIndex(p),this.setAttribute("position",new xt(g,3)),this.setAttribute("normal",new xt(_,3)),this.setAttribute("uv",new xt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ks(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Md extends Dt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,r=new L,s=new L;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,p=h.count;for(let g=f,_=f+p;g<_;g+=3)for(let m=0;m<3;m++){const d=o.getX(g+m),E=o.getX(g+(m+1)%3);r.fromBufferAttribute(a,d),s.fromBufferAttribute(a,E),Xl(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const u=3*o+c,h=3*o+(c+1)%3;r.fromBufferAttribute(a,u),s.fromBufferAttribute(a,h),Xl(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new xt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Xl(i,e,t){const n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}class Ed extends bn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ye(16777215),this.specular=new Ye(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Bo,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jt,this.combine=Os,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 bd extends bn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Bo,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jt,this.combine=Os,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.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 Td extends bn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mf,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 Ad extends bn{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}}function ls(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function wd(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Rd(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function ql(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=i[o+l]}return r}function Eu(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=i[r++];while(s!==void 0)}class Vs{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],s=t[n-1];n:{e:{let a;t:{i:if(!(e<r)){for(let o=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=t[++n],e<r)break e}a=t.length;break t}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break e}a=n,n=0;break t}break n}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Cd extends Vs{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ll,endingEnd:ll}}intervalChanged_(e,t,n){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case cl:s=e,o=2*t-n;break;case ul:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case cl:a=e,l=2*n-t;break;case ul:a=1,l=n+r[1]-r[0];break;default:a=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,p=this._weightNext,g=(n-t)/(r-t),_=g*g,m=_*g,d=-f*m+2*f*_-f*g,E=(1+f)*m+(-1.5-2*f)*_+(-.5+f)*g+1,T=(-1-p)*m+(1.5+p)*_+.5*g,y=p*m-p*_;for(let D=0;D!==o;++D)s[D]=d*a[u+D]+E*a[c+D]+T*a[l+D]+y*a[h+D];return s}}class Dd extends Vs{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(n-t)/(r-t),h=1-u;for(let f=0;f!==o;++f)s[f]=a[c+f]*h+a[l+f]*u;return s}}class Pd extends Vs{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class dn{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ls(t,this.TimeBufferType),this.values=ls(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ls(e.times,Array),values:ls(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Pd(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Dd(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Cd(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ds:t=this.InterpolantFactoryMethodDiscrete;break;case vo:t=this.InterpolantFactoryMethodLinear;break;case Ks:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ds;case this.InterpolantFactoryMethodLinear:return vo;case this.InterpolantFactoryMethodSmooth:return Ks}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let s=0,a=r-1;for(;s!==r&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&wd(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Ks,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(r)l=!0;else{const h=o*n,f=h-n,p=h+n;for(let g=0;g!==n;++g){const _=t[h+g];if(_!==t[f+g]||_!==t[p+g]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const h=o*n,f=a*n;for(let p=0;p!==n;++p)t[f+p]=t[h+p]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}dn.prototype.ValueTypeName="";dn.prototype.TimeBufferType=Float32Array;dn.prototype.ValueBufferType=Float32Array;dn.prototype.DefaultInterpolation=vo;class $i extends dn{constructor(e,t,n){super(e,t,n)}}$i.prototype.ValueTypeName="bool";$i.prototype.ValueBufferType=Array;$i.prototype.DefaultInterpolation=Ds;$i.prototype.InterpolantFactoryMethodLinear=void 0;$i.prototype.InterpolantFactoryMethodSmooth=void 0;class bu extends dn{constructor(e,t,n,r){super(e,t,n,r)}}bu.prototype.ValueTypeName="color";class Ns extends dn{constructor(e,t,n,r){super(e,t,n,r)}}Ns.prototype.ValueTypeName="number";class Ld extends Vs{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(r-t);let c=e*o;for(let u=c+o;c!==u;c+=4)fn.slerpFlat(s,0,a,c-o,a,c,l);return s}}class Dr extends dn{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new Ld(this.times,this.values,this.getValueSize(),e)}}Dr.prototype.ValueTypeName="quaternion";Dr.prototype.InterpolantFactoryMethodSmooth=void 0;class Ji extends dn{constructor(e,t,n){super(e,t,n)}}Ji.prototype.ValueTypeName="string";Ji.prototype.ValueBufferType=Array;Ji.prototype.DefaultInterpolation=Ds;Ji.prototype.InterpolantFactoryMethodLinear=void 0;Ji.prototype.InterpolantFactoryMethodSmooth=void 0;class Ar extends dn{constructor(e,t,n,r){super(e,t,n,r)}}Ar.prototype.ValueTypeName="vector";class Ud{constructor(e="",t=-1,n=[],r=pf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=hn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Nd(n[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(dn.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=Rd(l);l=ql(l,1,u),c=ql(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new Ns(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=r[h];f||(r[h]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,p,g,_){if(p.length!==0){const m=[],d=[];Eu(p,m,d,g),m.length!==0&&_.push(new h(f,m,d))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const p={};let g;for(g=0;g<f.length;g++)if(f[g].morphTargets)for(let _=0;_<f[g].morphTargets.length;_++)p[f[g].morphTargets[_]]=-1;for(const _ in p){const m=[],d=[];for(let E=0;E!==f[g].morphTargets.length;++E){const T=f[g];m.push(T.time),d.push(T.morphTarget===_?1:0)}r.push(new Ns(".morphTargetInfluence["+_+"]",m,d))}l=p.length*a}else{const p=".bones["+t[h].name+"]";n(Ar,p+".position",f,"pos",r),n(Dr,p+".quaternion",f,"rot",r),n(Ar,p+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Id(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ns;case"vector":case"vector2":case"vector3":case"vector4":return Ar;case"color":return bu;case"quaternion":return Dr;case"bool":case"boolean":return $i;case"string":return Ji}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function Nd(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Id(i.type);if(i.times===void 0){const t=[],n=[];Eu(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const Fs={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 Fd{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(u){o++,s===!1&&r.onStart!==void 0&&r.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,r.onProgress!==void 0&&r.onProgress(u,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const p=c[h],g=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return g}return null}}}const Tu=new Fd;class Zi{constructor(e){this.manager=e!==void 0?e:Tu,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}}Zi.DEFAULT_MATERIAL_NAME="__DEFAULT";const Dn={};class Od extends Error{constructor(e,t){super(e),this.response=t}}class Au extends Zi{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=Fs.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 u=Dn[e],h=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=f?parseInt(f):0,g=p!==0;let _=0;const m=new ReadableStream({start(d){E();function E(){h.read().then(({done:T,value:y})=>{if(T)d.close();else{_+=y.byteLength;const D=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:p});for(let C=0,w=u.length;C<w;C++){const P=u[C];P.onProgress&&P.onProgress(D)}d.enqueue(y),E()}},T=>{d.error(T)})}}});return new Response(m)}else throw new Od(`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(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o==="")return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),f=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(f);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{Fs.add(e,c);const u=Dn[e];delete Dn[e];for(let h=0,f=u.length;h<f;h++){const p=u[h];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=Dn[e];if(u===void 0)throw this.manager.itemError(e),c;delete Dn[e];for(let h=0,f=u.length;h<f;h++){const p=u[h];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 Bd extends Zi{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=Fs.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=Tr("img");function l(){u(),Fs.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){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 zd extends Zi{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new vu,o=new Au(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(r!==void 0)r(u);else{console.error(u);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:xn,a.wrapT=c.wrapT!==void 0?c.wrapT:xn,a.magFilter=c.magFilter!==void 0?c.magFilter:jt,a.minFilter=c.minFilter!==void 0?c.minFilter:jt,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Ln),c.mipmapCount===1&&(a.minFilter=jt),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,r),a}}class kd extends Zi{constructor(e){super(e)}load(e,t,n,r){const s=new Ct,a=new Bd(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 Pr extends ht{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ye(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}}class Vd extends Pr{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ht.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ye(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Sa=new Ke,Yl=new L,Kl=new L;class Yo{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new We(512,512),this.mapType=Mn,this.map=null,this.mapPass=null,this.matrix=new Ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Xo,this._frameExtents=new We(1,1),this._viewportCount=1,this._viewports=[new et(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Yl.setFromMatrixPosition(e.matrixWorld),t.position.copy(Yl),Kl.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Kl),t.updateMatrixWorld(),Sa.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sa),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Sa)}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 Hd extends Yo{constructor(){super(new zt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=qi*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Gd extends Pr{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ht.DEFAULT_UP),this.updateMatrix(),this.target=new ht,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Hd}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const jl=new Ke,fr=new L,Ma=new L;class Wd extends Yo{constructor(){super(new zt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new We(4,2),this._viewportCount=6,this._viewports=[new et(2,1,1,1),new et(0,1,1,1),new et(3,1,1,1),new et(1,1,1,1),new et(3,0,1,1),new et(1,0,1,1)],this._cubeDirections=[new L(1,0,0),new L(-1,0,0),new L(0,0,1),new L(0,0,-1),new L(0,1,0),new L(0,-1,0)],this._cubeUps=[new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,0,1),new L(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),fr.setFromMatrixPosition(e.matrixWorld),n.position.copy(fr),Ma.copy(n.position),Ma.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ma),n.updateMatrixWorld(),r.makeTranslation(-fr.x,-fr.y,-fr.z),jl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jl)}}class Xd extends Pr{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Wd}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Hs extends fu{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,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*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 qd extends Yo{constructor(){super(new Hs(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Yd extends Pr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ht.DEFAULT_UP),this.updateMatrix(),this.target=new ht,this.shadow=new qd}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Kd extends Pr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class jd{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 $d extends Dt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Jd extends zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Zd{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=$l(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=$l();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function $l(){return performance.now()}class So extends mu{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}const Jl=new Ke;class Qd{constructor(e,t,n=0,r=1/0){this.ray=new Ki(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Vo,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Jl.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Jl),this}intersectObject(e,t=!0,n=[]){return Mo(e,this,n,t),n.sort(Zl),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)Mo(e[r],this,n,t);return n.sort(Zl),n}}function Zl(i,e){return i.distance-e.distance}function Mo(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,o=s.length;a<o;a++)Mo(s[a],e,t,!0)}}class wu{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=Ze(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(Ze(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Ql=new L,cs=new L;class ep{constructor(e=new L,t=new L){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Ql.subVectors(e,this.start),cs.subVectors(this.end,this.start);const n=cs.dot(cs);let s=cs.dot(Ql)/n;return t&&(s=Ze(s,0,1)),s}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class tp extends mi{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 ec(i,e,t,n){const r=np(n);switch(t){case Qc:return i*e;case tu:return i*e/r.components*r.byteLength;case No:return i*e/r.components*r.byteLength;case nu:return i*e*2/r.components*r.byteLength;case Fo:return i*e*2/r.components*r.byteLength;case eu:return i*e*3/r.components*r.byteLength;case rn:return i*e*4/r.components*r.byteLength;case Oo:return i*e*4/r.components*r.byteLength;case ys:case Ss:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ms:case Es:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case qa:case Ka:return Math.max(i,16)*Math.max(e,8)/4;case Xa:case Ya:return Math.max(i,8)*Math.max(e,8)/2;case ja:case $a:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ja:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Za:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Qa:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case eo:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case to:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case no:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case io:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case ro:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case so:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case ao:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case oo:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case lo:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case co:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case uo:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case ho:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case bs:case fo:case po:return Math.ceil(i/4)*Math.ceil(e/4)*16;case iu:case mo:return Math.ceil(i/4)*Math.ceil(e/4)*8;case go:case _o:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function np(i){switch(i){case Mn:case $c:return{byteLength:1,components:1};case Sr:case Jc:case Rr:return{byteLength:2,components:1};case Uo:case Io:return{byteLength:2,components:4};case di:case Lo:case yn:return{byteLength:4,components:1};case Zc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Po}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Po);/**
|
|
44
|
+
`},r=new ji(5,5,5),s=new On({name:"CubemapFromEquirect",uniforms:Yi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:kt,blending:Kn});s.uniforms.tEquirect.value=t;const a=new Rt(r,s),o=t.minFilter;return t.minFilter===Ln&&(t.minFilter=jt),new fd(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 mr extends ht{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pd={type:"move"};class ma{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new mr,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 mr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new mr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),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 _ of e.hand.values()){const m=t.getJointPose(_,n),d=this._getHandJoint(c,_);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=m.radius),d.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),p=.02,g=.005;c.inputState.pinching&&f>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-g&&(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(pd)))}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 mr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class pu extends ht{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 Jt,this.environmentIntensity=1,this.environmentRotation=new Jt,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}}class mu{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=xo,this.updateRanges=[],this.version=0,this.uuid=hn()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=hn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=hn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ot=new L;class Sn{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ot.fromBufferAttribute(this,t),Ot.applyMatrix4(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ot.fromBufferAttribute(this,t),Ot.applyNormalMatrix(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ot.fromBufferAttribute(this,t),Ot.transformDirection(e),this.setXYZ(t,Ot.x,Ot.y,Ot.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=un(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ct(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=ct(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ct(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ct(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ct(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=un(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=un(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=un(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=un(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ct(t,this.array),n=ct(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ct(t,this.array),n=ct(n,this.array),r=ct(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=ct(t,this.array),n=ct(n,this.array),r=ct(r,this.array),s=ct(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Dt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Sn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class zs extends bn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ye(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!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.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Pi;const lr=new L,Li=new L,Ui=new L,Ii=new We,cr=new We,gu=new Ke,Qr=new L,ur=new L,es=new L,Pl=new We,ga=new We,Ll=new We;class Go extends ht{constructor(e=new zs){if(super(),this.isSprite=!0,this.type="Sprite",Pi===void 0){Pi=new Pt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new mu(t,5);Pi.setIndex([0,1,2,0,2,3]),Pi.setAttribute("position",new Sn(n,3,0,!1)),Pi.setAttribute("uv",new Sn(n,2,3,!1))}this.geometry=Pi,this.material=e,this.center=new We(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Li.setFromMatrixScale(this.matrixWorld),gu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ui.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Li.multiplyScalar(-Ui.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;ts(Qr.set(-.5,-.5,0),Ui,a,Li,r,s),ts(ur.set(.5,-.5,0),Ui,a,Li,r,s),ts(es.set(.5,.5,0),Ui,a,Li,r,s),Pl.set(0,0),ga.set(1,0),Ll.set(1,1);let o=e.ray.intersectTriangle(Qr,ur,es,!1,lr);if(o===null&&(ts(ur.set(-.5,.5,0),Ui,a,Li,r,s),ga.set(0,1),o=e.ray.intersectTriangle(Qr,es,ur,!1,lr),o===null))return;const l=e.ray.origin.distanceTo(lr);l<e.near||l>e.far||t.push({distance:l,point:lr.clone(),uv:nn.getInterpolation(lr,Qr,ur,es,Pl,ga,Ll,new We),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function ts(i,e,t,n,r,s){Ii.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(cr.x=s*Ii.x-r*Ii.y,cr.y=r*Ii.x+s*Ii.y):cr.copy(Ii),i.copy(e),i.x+=cr.x,i.y+=cr.y,i.applyMatrix4(gu)}const Ul=new L,Il=new et,Nl=new et,md=new L,Fl=new Ke,ns=new L,_a=new Bn,Ol=new Ke,va=new Ki;class gd extends Rt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ol,this.bindMatrix=new Ke,this.bindMatrixInverse=new Ke,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new En),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ns),this.boundingBox.expandByPoint(ns)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Bn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,ns),this.boundingSphere.expandByPoint(ns)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_a.copy(this.boundingSphere),_a.applyMatrix4(r),e.ray.intersectsSphere(_a)!==!1&&(Ol.copy(r).invert(),va.copy(e.ray).applyMatrix4(Ol),!(this.boundingBox!==null&&va.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,va)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new et,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===ol?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ff?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;Il.fromBufferAttribute(r.attributes.skinIndex,e),Nl.fromBufferAttribute(r.attributes.skinWeight,e),Ul.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Nl.getComponent(s);if(a!==0){const o=Il.getComponent(s);Fl.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(md.copy(Ul).applyMatrix4(Fl),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class _u extends ht{constructor(){super(),this.isBone=!0,this.type="Bone"}}class vu extends Ct{constructor(e=null,t=1,n=1,r,s,a,o,l,c=$t,u=$t,h,f){super(null,a,o,l,c,u,r,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Bl=new Ke,_d=new Ke;class Wo{constructor(e=[],t=[]){this.uuid=hn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Ke)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Ke;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:_d;Bl.multiplyMatrices(o,t[s]),Bl.toArray(n,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Wo(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new vu(t,e,e,rn,yn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new _u),this.bones.push(a),this.boneInverses.push(new Ke().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const a=t[r];e.bones.push(a.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}const xa=new L,vd=new L,xd=new qe;class qn{constructor(e=new L(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=xa.subVectors(n,t).cross(vd.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(xa),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||xd.getNormalMatrix(e),r=this.coplanarPoint(xa).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 ii=new Bn,is=new L;class Xo{constructor(e=new qn,t=new qn,n=new qn,r=new qn,s=new qn,a=new qn){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=Un){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],h=r[6],f=r[7],p=r[8],g=r[9],_=r[10],m=r[11],d=r[12],E=r[13],T=r[14],y=r[15];if(n[0].setComponents(l-s,f-c,m-p,y-d).normalize(),n[1].setComponents(l+s,f+c,m+p,y+d).normalize(),n[2].setComponents(l+a,f+u,m+g,y+E).normalize(),n[3].setComponents(l-a,f-u,m-g,y-E).normalize(),n[4].setComponents(l-o,f-h,m-_,y-T).normalize(),t===Un)n[5].setComponents(l+o,f+h,m+_,y+T).normalize();else if(t===Ls)n[5].setComponents(o,h,_,T).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(),ii.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ii.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ii)}intersectsSprite(e){return ii.center.set(0,0,0),ii.radius=.7071067811865476,ii.applyMatrix4(e.matrixWorld),this.intersectsSphere(ii)}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(is.x=r.normal.x>0?e.max.x:e.min.x,is.y=r.normal.y>0?e.max.y:e.min.y,is.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(is)<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 xu extends bn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ye(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 Us=new L,Is=new L,zl=new Ke,hr=new Ki,rs=new Bn,ya=new L,kl=new L;class yu extends ht{constructor(e=new Pt,t=new xu){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++)Us.fromBufferAttribute(t,r-1),Is.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Us.distanceTo(Is);e.setAttribute("lineDistance",new xt(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(),rs.copy(n.boundingSphere),rs.applyMatrix4(r),rs.radius+=s,e.ray.intersectsSphere(rs)===!1)return;zl.copy(r).invert(),hr.copy(e.ray).applyMatrix4(zl);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,u=n.index,f=n.attributes.position;if(u!==null){const p=Math.max(0,a.start),g=Math.min(u.count,a.start+a.count);for(let _=p,m=g-1;_<m;_+=c){const d=u.getX(_),E=u.getX(_+1),T=ss(this,e,hr,l,d,E,_);T&&t.push(T)}if(this.isLineLoop){const _=u.getX(g-1),m=u.getX(p),d=ss(this,e,hr,l,_,m,g-1);d&&t.push(d)}}else{const p=Math.max(0,a.start),g=Math.min(f.count,a.start+a.count);for(let _=p,m=g-1;_<m;_+=c){const d=ss(this,e,hr,l,_,_+1,_);d&&t.push(d)}if(this.isLineLoop){const _=ss(this,e,hr,l,g-1,p,g-1);_&&t.push(_)}}}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 ss(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(Us.fromBufferAttribute(o,r),Is.fromBufferAttribute(o,s),t.distanceSqToSegment(Us,Is,ya,kl)>n)return;ya.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(ya);if(!(c<e.near||c>e.far))return{distance:c,point:kl.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const Vl=new L,Hl=new L;class yd extends yu{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)Vl.fromBufferAttribute(t,r),Hl.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Vl.distanceTo(Hl);e.setAttribute("lineDistance",new xt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Su extends bn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ye(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 Gl=new Ke,yo=new Ki,as=new Bn,os=new L;class Sd extends ht{constructor(e=new Pt,t=new Su){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(),as.copy(n.boundingSphere),as.applyMatrix4(r),as.radius+=s,e.ray.intersectsSphere(as)===!1)return;Gl.copy(r).invert(),yo.copy(e.ray).applyMatrix4(Gl);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let g=f,_=p;g<_;g++){const m=c.getX(g);os.fromBufferAttribute(h,m),Wl(os,m,l,r,e,t,this)}}else{const f=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let g=f,_=p;g<_;g++)os.fromBufferAttribute(h,g),Wl(os,g,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 Wl(i,e,t,n,r,s,a){const o=yo.distanceSqToPoint(i);if(o<t){const l=new L;yo.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 Md extends Ct{constructor(e,t,n,r,s,a,o,l,c){super(e,t,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Mu extends Ct{constructor(e,t,n=di,r,s,a,o=$t,l=$t,c,u=Er,h=1){if(u!==Er&&u!==br)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:h};super(f,r,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ko(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 qo extends Pt{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],f=[],p=[];let g=0;const _=[],m=n/2;let d=0;E(),a===!1&&(e>0&&T(!0),t>0&&T(!1)),this.setIndex(u),this.setAttribute("position",new xt(h,3)),this.setAttribute("normal",new xt(f,3)),this.setAttribute("uv",new xt(p,2));function E(){const y=new L,D=new L;let C=0;const w=(t-e)/n;for(let P=0;P<=s;P++){const M=[],x=P/s,b=x*(t-e)+e;for(let O=0;O<=r;O++){const F=O/r,k=F*l+o,W=Math.sin(k),B=Math.cos(k);D.x=b*W,D.y=-x*n+m,D.z=b*B,h.push(D.x,D.y,D.z),y.set(W,w,B).normalize(),f.push(y.x,y.y,y.z),p.push(F,1-x),M.push(g++)}_.push(M)}for(let P=0;P<r;P++)for(let M=0;M<s;M++){const x=_[M][P],b=_[M+1][P],O=_[M+1][P+1],F=_[M][P+1];(e>0||M!==0)&&(u.push(x,b,F),C+=3),(t>0||M!==s-1)&&(u.push(b,O,F),C+=3)}c.addGroup(d,C,0),d+=C}function T(y){const D=g,C=new We,w=new L;let P=0;const M=y===!0?e:t,x=y===!0?1:-1;for(let O=1;O<=r;O++)h.push(0,m*x,0),f.push(0,x,0),p.push(.5,.5),g++;const b=g;for(let O=0;O<=r;O++){const k=O/r*l+o,W=Math.cos(k),B=Math.sin(k);w.x=M*B,w.y=m*x,w.z=M*W,h.push(w.x,w.y,w.z),f.push(0,x,0),C.x=W*.5+.5,C.y=B*.5*x+.5,p.push(C.x,C.y),g++}for(let O=0;O<r;O++){const F=D+O,k=b+O;y===!0?u.push(k,k+1,F):u.push(k+1,k,F),P+=3}c.addGroup(d,P,y===!0?1:2),d+=P}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Cr extends Pt{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,u=l+1,h=e/o,f=t/l,p=[],g=[],_=[],m=[];for(let d=0;d<u;d++){const E=d*f-a;for(let T=0;T<c;T++){const y=T*h-s;g.push(y,-E,0),_.push(0,0,1),m.push(T/o),m.push(1-d/l)}}for(let d=0;d<l;d++)for(let E=0;E<o;E++){const T=E+c*d,y=E+c*(d+1),D=E+1+c*(d+1),C=E+1+c*d;p.push(T,y,C),p.push(y,D,C)}this.setIndex(p),this.setAttribute("position",new xt(g,3)),this.setAttribute("normal",new xt(_,3)),this.setAttribute("uv",new xt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cr(e.width,e.height,e.widthSegments,e.heightSegments)}}class ks extends Pt{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const u=[],h=new L,f=new L,p=[],g=[],_=[],m=[];for(let d=0;d<=n;d++){const E=[],T=d/n;let y=0;d===0&&a===0?y=.5/t:d===n&&l===Math.PI&&(y=-.5/t);for(let D=0;D<=t;D++){const C=D/t;h.x=-e*Math.cos(r+C*s)*Math.sin(a+T*o),h.y=e*Math.cos(a+T*o),h.z=e*Math.sin(r+C*s)*Math.sin(a+T*o),g.push(h.x,h.y,h.z),f.copy(h).normalize(),_.push(f.x,f.y,f.z),m.push(C+y,1-T),E.push(c++)}u.push(E)}for(let d=0;d<n;d++)for(let E=0;E<t;E++){const T=u[d][E+1],y=u[d][E],D=u[d+1][E],C=u[d+1][E+1];(d!==0||a>0)&&p.push(T,y,C),(d!==n-1||l<Math.PI)&&p.push(y,D,C)}this.setIndex(p),this.setAttribute("position",new xt(g,3)),this.setAttribute("normal",new xt(_,3)),this.setAttribute("uv",new xt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ks(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Ed extends Pt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,r=new L,s=new L;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,p=h.count;for(let g=f,_=f+p;g<_;g+=3)for(let m=0;m<3;m++){const d=o.getX(g+m),E=o.getX(g+(m+1)%3);r.fromBufferAttribute(a,d),s.fromBufferAttribute(a,E),Xl(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const u=3*o+c,h=3*o+(c+1)%3;r.fromBufferAttribute(a,u),s.fromBufferAttribute(a,h),Xl(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new xt(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Xl(i,e,t){const n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}class bd extends bn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ye(16777215),this.specular=new Ye(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Bo,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jt,this.combine=Os,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 Td extends bn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Bo,this.normalScale=new We(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jt,this.combine=Os,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.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 Ad extends bn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mf,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 wd extends bn{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}}function ls(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function Rd(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Cd(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function ql(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=i[o+l]}return r}function Eu(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=i[r++];while(s!==void 0)}class Vs{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],s=t[n-1];n:{e:{let a;t:{i:if(!(e<r)){for(let o=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=t[++n],e<r)break e}a=t.length;break t}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break e}a=n,n=0;break t}break n}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Dd extends Vs{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ll,endingEnd:ll}}intervalChanged_(e,t,n){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case cl:s=e,o=2*t-n;break;case ul:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case cl:a=e,l=2*n-t;break;case ul:a=1,l=n+r[1]-r[0];break;default:a=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,p=this._weightNext,g=(n-t)/(r-t),_=g*g,m=_*g,d=-f*m+2*f*_-f*g,E=(1+f)*m+(-1.5-2*f)*_+(-.5+f)*g+1,T=(-1-p)*m+(1.5+p)*_+.5*g,y=p*m-p*_;for(let D=0;D!==o;++D)s[D]=d*a[u+D]+E*a[c+D]+T*a[l+D]+y*a[h+D];return s}}class Pd extends Vs{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(n-t)/(r-t),h=1-u;for(let f=0;f!==o;++f)s[f]=a[c+f]*h+a[l+f]*u;return s}}class Ld extends Vs{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class dn{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ls(t,this.TimeBufferType),this.values=ls(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ls(e.times,Array),values:ls(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Ld(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Pd(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Dd(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ds:t=this.InterpolantFactoryMethodDiscrete;break;case vo:t=this.InterpolantFactoryMethodLinear;break;case Ks:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ds;case this.InterpolantFactoryMethodLinear:return vo;case this.InterpolantFactoryMethodSmooth:return Ks}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let s=0,a=r-1;for(;s!==r&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&Rd(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Ks,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(r)l=!0;else{const h=o*n,f=h-n,p=h+n;for(let g=0;g!==n;++g){const _=t[h+g];if(_!==t[f+g]||_!==t[p+g]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const h=o*n,f=a*n;for(let p=0;p!==n;++p)t[f+p]=t[h+p]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}dn.prototype.ValueTypeName="";dn.prototype.TimeBufferType=Float32Array;dn.prototype.ValueBufferType=Float32Array;dn.prototype.DefaultInterpolation=vo;class $i extends dn{constructor(e,t,n){super(e,t,n)}}$i.prototype.ValueTypeName="bool";$i.prototype.ValueBufferType=Array;$i.prototype.DefaultInterpolation=Ds;$i.prototype.InterpolantFactoryMethodLinear=void 0;$i.prototype.InterpolantFactoryMethodSmooth=void 0;class bu extends dn{constructor(e,t,n,r){super(e,t,n,r)}}bu.prototype.ValueTypeName="color";class Ns extends dn{constructor(e,t,n,r){super(e,t,n,r)}}Ns.prototype.ValueTypeName="number";class Ud extends Vs{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(r-t);let c=e*o;for(let u=c+o;c!==u;c+=4)fn.slerpFlat(s,0,a,c-o,a,c,l);return s}}class Dr extends dn{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new Ud(this.times,this.values,this.getValueSize(),e)}}Dr.prototype.ValueTypeName="quaternion";Dr.prototype.InterpolantFactoryMethodSmooth=void 0;class Ji extends dn{constructor(e,t,n){super(e,t,n)}}Ji.prototype.ValueTypeName="string";Ji.prototype.ValueBufferType=Array;Ji.prototype.DefaultInterpolation=Ds;Ji.prototype.InterpolantFactoryMethodLinear=void 0;Ji.prototype.InterpolantFactoryMethodSmooth=void 0;class Ar extends dn{constructor(e,t,n,r){super(e,t,n,r)}}Ar.prototype.ValueTypeName="vector";class Id{constructor(e="",t=-1,n=[],r=pf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=hn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Fd(n[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(dn.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=Cd(l);l=ql(l,1,u),c=ql(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new Ns(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=r[h];f||(r[h]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,p,g,_){if(p.length!==0){const m=[],d=[];Eu(p,m,d,g),m.length!==0&&_.push(new h(f,m,d))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const p={};let g;for(g=0;g<f.length;g++)if(f[g].morphTargets)for(let _=0;_<f[g].morphTargets.length;_++)p[f[g].morphTargets[_]]=-1;for(const _ in p){const m=[],d=[];for(let E=0;E!==f[g].morphTargets.length;++E){const T=f[g];m.push(T.time),d.push(T.morphTarget===_?1:0)}r.push(new Ns(".morphTargetInfluence["+_+"]",m,d))}l=p.length*a}else{const p=".bones["+t[h].name+"]";n(Ar,p+".position",f,"pos",r),n(Dr,p+".quaternion",f,"rot",r),n(Ar,p+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Nd(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ns;case"vector":case"vector2":case"vector3":case"vector4":return Ar;case"color":return bu;case"quaternion":return Dr;case"bool":case"boolean":return $i;case"string":return Ji}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function Fd(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Nd(i.type);if(i.times===void 0){const t=[],n=[];Eu(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const Fs={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 Od{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(u){o++,s===!1&&r.onStart!==void 0&&r.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,r.onProgress!==void 0&&r.onProgress(u,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const p=c[h],g=c[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return g}return null}}}const Tu=new Od;class Zi{constructor(e){this.manager=e!==void 0?e:Tu,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}}Zi.DEFAULT_MATERIAL_NAME="__DEFAULT";const Dn={};class Bd extends Error{constructor(e,t){super(e),this.response=t}}class Au extends Zi{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=Fs.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 u=Dn[e],h=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=f?parseInt(f):0,g=p!==0;let _=0;const m=new ReadableStream({start(d){E();function E(){h.read().then(({done:T,value:y})=>{if(T)d.close();else{_+=y.byteLength;const D=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:p});for(let C=0,w=u.length;C<w;C++){const P=u[C];P.onProgress&&P.onProgress(D)}d.enqueue(y),E()}},T=>{d.error(T)})}}});return new Response(m)}else throw new Bd(`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(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o==="")return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),f=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(f);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{Fs.add(e,c);const u=Dn[e];delete Dn[e];for(let h=0,f=u.length;h<f;h++){const p=u[h];p.onLoad&&p.onLoad(c)}}).catch(c=>{const u=Dn[e];if(u===void 0)throw this.manager.itemError(e),c;delete Dn[e];for(let h=0,f=u.length;h<f;h++){const p=u[h];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 zd extends Zi{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=Fs.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=Tr("img");function l(){u(),Fs.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){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 kd extends Zi{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new vu,o=new Au(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(r!==void 0)r(u);else{console.error(u);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:xn,a.wrapT=c.wrapT!==void 0?c.wrapT:xn,a.magFilter=c.magFilter!==void 0?c.magFilter:jt,a.minFilter=c.minFilter!==void 0?c.minFilter:jt,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Ln),c.mipmapCount===1&&(a.minFilter=jt),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,r),a}}class Vd extends Zi{constructor(e){super(e)}load(e,t,n,r){const s=new Ct,a=new zd(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 Pr extends ht{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ye(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}}class Hd extends Pr{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ht.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ye(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Sa=new Ke,Yl=new L,Kl=new L;class Yo{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new We(512,512),this.mapType=Mn,this.map=null,this.mapPass=null,this.matrix=new Ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Xo,this._frameExtents=new We(1,1),this._viewportCount=1,this._viewports=[new et(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Yl.setFromMatrixPosition(e.matrixWorld),t.position.copy(Yl),Kl.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Kl),t.updateMatrixWorld(),Sa.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sa),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Sa)}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 Gd extends Yo{constructor(){super(new zt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=qi*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Wd extends Pr{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ht.DEFAULT_UP),this.updateMatrix(),this.target=new ht,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Gd}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const jl=new Ke,fr=new L,Ma=new L;class Xd extends Yo{constructor(){super(new zt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new We(4,2),this._viewportCount=6,this._viewports=[new et(2,1,1,1),new et(0,1,1,1),new et(3,1,1,1),new et(1,1,1,1),new et(3,0,1,1),new et(1,0,1,1)],this._cubeDirections=[new L(1,0,0),new L(-1,0,0),new L(0,0,1),new L(0,0,-1),new L(0,1,0),new L(0,-1,0)],this._cubeUps=[new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,0,1),new L(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),fr.setFromMatrixPosition(e.matrixWorld),n.position.copy(fr),Ma.copy(n.position),Ma.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ma),n.updateMatrixWorld(),r.makeTranslation(-fr.x,-fr.y,-fr.z),jl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jl)}}class qd extends Pr{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Xd}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Hs extends fu{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,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*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 Yd extends Yo{constructor(){super(new Hs(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Kd extends Pr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ht.DEFAULT_UP),this.updateMatrix(),this.target=new ht,this.shadow=new Yd}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class jd extends Pr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class $d{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 Jd extends Pt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Zd extends zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Qd{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=$l(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=$l();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function $l(){return performance.now()}class So extends mu{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}const Jl=new Ke;class ep{constructor(e,t,n=0,r=1/0){this.ray=new Ki(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Vo,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Jl.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Jl),this}intersectObject(e,t=!0,n=[]){return Mo(e,this,n,t),n.sort(Zl),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)Mo(e[r],this,n,t);return n.sort(Zl),n}}function Zl(i,e){return i.distance-e.distance}function Mo(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,o=s.length;a<o;a++)Mo(s[a],e,t,!0)}}class wu{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=Ze(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(Ze(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Ql=new L,cs=new L;class tp{constructor(e=new L,t=new L){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Ql.subVectors(e,this.start),cs.subVectors(this.end,this.start);const n=cs.dot(cs);let s=cs.dot(Ql)/n;return t&&(s=Ze(s,0,1)),s}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class np extends mi{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 ec(i,e,t,n){const r=ip(n);switch(t){case Qc:return i*e;case tu:return i*e/r.components*r.byteLength;case No:return i*e/r.components*r.byteLength;case nu:return i*e*2/r.components*r.byteLength;case Fo:return i*e*2/r.components*r.byteLength;case eu:return i*e*3/r.components*r.byteLength;case rn:return i*e*4/r.components*r.byteLength;case Oo:return i*e*4/r.components*r.byteLength;case ys:case Ss:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ms:case Es:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case qa:case Ka:return Math.max(i,16)*Math.max(e,8)/4;case Xa:case Ya:return Math.max(i,8)*Math.max(e,8)/2;case ja:case $a:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ja:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Za:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Qa:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case eo:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case to:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case no:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case io:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case ro:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case so:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case ao:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case oo:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case lo:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case co:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case uo:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case ho:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case bs:case fo:case po:return Math.ceil(i/4)*Math.ceil(e/4)*16;case iu:case mo:return Math.ceil(i/4)*Math.ceil(e/4)*8;case go:case _o:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function ip(i){switch(i){case Mn:case $c:return{byteLength:1,components:1};case Sr:case Jc:case Rr:return{byteLength:2,components:1};case Uo:case Io:return{byteLength:2,components:4};case di:case Lo:case yn:return{byteLength:4,components:1};case Zc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Po}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Po);/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2010-2025 Three.js Authors
|
|
47
47
|
* SPDX-License-Identifier: MIT
|
|
48
|
-
*/function Ru(){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
|
|
48
|
+
*/function Ru(){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 rp(i){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,h=c.byteLength,f=i.createBuffer();i.bindBuffer(l,f),i.bufferData(l,c,u),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:f,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function n(o,l,c){const u=l.array,h=l.updateRanges;if(i.bindBuffer(c,o),h.length===0)i.bufferSubData(c,0,u);else{h.sort((p,g)=>p.start-g.start);let f=0;for(let p=1;p<h.length;p++){const g=h[f],_=h[p];_.start<=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++f,h[f]=_)}h.length=f+1;for(let p=0,g=h.length;p<g;p++){const _=h[p];i.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.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 u=e.get(o);(!u||u.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 sp=`#ifdef USE_ALPHAHASH
|
|
49
49
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
50
|
-
#endif`,
|
|
50
|
+
#endif`,ap=`#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`,ap=`#ifdef USE_ALPHAMAP
|
|
86
|
-
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
87
85
|
#endif`,op=`#ifdef USE_ALPHAMAP
|
|
86
|
+
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
87
|
+
#endif`,lp=`#ifdef USE_ALPHAMAP
|
|
88
88
|
uniform sampler2D alphaMap;
|
|
89
|
-
#endif`,
|
|
89
|
+
#endif`,cp=`#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`,
|
|
96
|
+
#endif`,up=`#ifdef USE_ALPHATEST
|
|
97
97
|
uniform float alphaTest;
|
|
98
|
-
#endif`,
|
|
98
|
+
#endif`,hp=`#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`,
|
|
111
|
+
#endif`,fp=`#ifdef USE_AOMAP
|
|
112
112
|
uniform sampler2D aoMap;
|
|
113
113
|
uniform float aoMapIntensity;
|
|
114
|
-
#endif`,
|
|
114
|
+
#endif`,dp=`#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`,
|
|
148
|
+
#endif`,pp=`#ifdef USE_BATCHING
|
|
149
149
|
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
150
|
-
#endif`,
|
|
150
|
+
#endif`,mp=`vec3 transformed = vec3( position );
|
|
151
151
|
#ifdef USE_ALPHAHASH
|
|
152
152
|
vPosition = vec3( position );
|
|
153
|
-
#endif`,
|
|
153
|
+
#endif`,gp=`vec3 objectNormal = vec3( normal );
|
|
154
154
|
#ifdef USE_TANGENT
|
|
155
155
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
156
|
-
#endif`,
|
|
156
|
+
#endif`,_p=`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`,
|
|
170
|
+
} // validated`,vp=`#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`,
|
|
233
|
+
#endif`,xp=`#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`,
|
|
254
|
+
#endif`,yp=`#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`,yp=`#if NUM_CLIPPING_PLANES > 0
|
|
301
|
-
varying vec3 vClipPosition;
|
|
302
|
-
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
303
300
|
#endif`,Sp=`#if NUM_CLIPPING_PLANES > 0
|
|
304
301
|
varying vec3 vClipPosition;
|
|
302
|
+
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
305
303
|
#endif`,Mp=`#if NUM_CLIPPING_PLANES > 0
|
|
304
|
+
varying vec3 vClipPosition;
|
|
305
|
+
#endif`,Ep=`#if NUM_CLIPPING_PLANES > 0
|
|
306
306
|
vClipPosition = - mvPosition.xyz;
|
|
307
|
-
#endif`,
|
|
307
|
+
#endif`,bp=`#if defined( USE_COLOR_ALPHA )
|
|
308
308
|
diffuseColor *= vColor;
|
|
309
309
|
#elif defined( USE_COLOR )
|
|
310
310
|
diffuseColor.rgb *= vColor;
|
|
311
|
-
#endif`,
|
|
311
|
+
#endif`,Tp=`#if defined( USE_COLOR_ALPHA )
|
|
312
312
|
varying vec4 vColor;
|
|
313
313
|
#elif defined( USE_COLOR )
|
|
314
314
|
varying vec3 vColor;
|
|
315
|
-
#endif`,
|
|
315
|
+
#endif`,Ap=`#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`,
|
|
319
|
+
#endif`,wp=`#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`,
|
|
333
|
+
#endif`,Rp=`#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`,
|
|
407
|
+
} // validated`,Cp=`#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`,
|
|
500
|
+
#endif`,Dp=`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`,
|
|
529
|
+
#endif`,Pp=`#ifdef USE_DISPLACEMENTMAP
|
|
530
530
|
uniform sampler2D displacementMap;
|
|
531
531
|
uniform float displacementScale;
|
|
532
532
|
uniform float displacementBias;
|
|
533
|
-
#endif`,
|
|
533
|
+
#endif`,Lp=`#ifdef USE_DISPLACEMENTMAP
|
|
534
534
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
535
|
-
#endif`,
|
|
535
|
+
#endif`,Up=`#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`,
|
|
541
|
+
#endif`,Ip=`#ifdef USE_EMISSIVEMAP
|
|
542
542
|
uniform sampler2D emissiveMap;
|
|
543
|
-
#endif`,
|
|
543
|
+
#endif`,Np="gl_FragColor = linearToOutputTexel( gl_FragColor );",Fp=`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
|
-
}`,
|
|
551
|
+
}`,Op=`#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`,
|
|
580
|
+
#endif`,Bp=`#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`,
|
|
590
|
+
#endif`,zp=`#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`,
|
|
601
|
+
#endif`,kp=`#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`,
|
|
612
|
+
#endif`,Vp=`#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`,Vp=`#ifdef USE_FOG
|
|
630
|
-
vFogDepth = - mvPosition.z;
|
|
631
629
|
#endif`,Hp=`#ifdef USE_FOG
|
|
632
|
-
|
|
630
|
+
vFogDepth = - mvPosition.z;
|
|
633
631
|
#endif`,Gp=`#ifdef USE_FOG
|
|
632
|
+
varying float vFogDepth;
|
|
633
|
+
#endif`,Wp=`#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`,
|
|
640
|
+
#endif`,Xp=`#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`,
|
|
649
|
+
#endif`,qp=`#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
|
-
}`,
|
|
661
|
+
}`,Yp=`#ifdef USE_LIGHTMAP
|
|
662
662
|
uniform sampler2D lightMap;
|
|
663
663
|
uniform float lightMapIntensity;
|
|
664
|
-
#endif`,
|
|
664
|
+
#endif`,Kp=`LambertMaterial material;
|
|
665
665
|
material.diffuseColor = diffuseColor.rgb;
|
|
666
|
-
material.specularStrength = specularStrength;`,
|
|
666
|
+
material.specularStrength = specularStrength;`,jp=`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
|
|
680
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,$p=`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
|
|
796
|
+
#endif`,Jp=`#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`,
|
|
830
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
829
|
+
#endif`,Zp=`ToonMaterial material;
|
|
830
|
+
material.diffuseColor = diffuseColor.rgb;`,Qp=`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`,
|
|
842
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,em=`BlinnPhongMaterial material;
|
|
843
843
|
material.diffuseColor = diffuseColor.rgb;
|
|
844
844
|
material.specularColor = specular;
|
|
845
845
|
material.specularShininess = shininess;
|
|
846
|
-
material.specularStrength = specularStrength;`,
|
|
846
|
+
material.specularStrength = specularStrength;`,tm=`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`,
|
|
863
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,nm=`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`,
|
|
949
|
+
#endif`,im=`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
|
-
}`,
|
|
1250
|
+
}`,rm=`
|
|
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`,
|
|
1365
|
+
#endif`,sm=`#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`,
|
|
1384
|
+
#endif`,am=`#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`,am=`#if defined( USE_LOGDEPTHBUF )
|
|
1390
|
-
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1391
1389
|
#endif`,om=`#if defined( USE_LOGDEPTHBUF )
|
|
1390
|
+
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1391
|
+
#endif`,lm=`#if defined( USE_LOGDEPTHBUF )
|
|
1392
1392
|
uniform float logDepthBufFC;
|
|
1393
1393
|
varying float vFragDepth;
|
|
1394
1394
|
varying float vIsPerspective;
|
|
1395
|
-
#endif`,
|
|
1395
|
+
#endif`,cm=`#ifdef USE_LOGDEPTHBUF
|
|
1396
1396
|
varying float vFragDepth;
|
|
1397
1397
|
varying float vIsPerspective;
|
|
1398
|
-
#endif`,
|
|
1398
|
+
#endif`,um=`#ifdef USE_LOGDEPTHBUF
|
|
1399
1399
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1400
1400
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1401
|
-
#endif`,
|
|
1401
|
+
#endif`,hm=`#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`,
|
|
1407
|
+
#endif`,fm=`#ifdef USE_MAP
|
|
1408
1408
|
uniform sampler2D map;
|
|
1409
|
-
#endif`,
|
|
1409
|
+
#endif`,dm=`#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`,
|
|
1421
|
+
#endif`,pm=`#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`,
|
|
1433
|
+
#endif`,mm=`float metalnessFactor = metalness;
|
|
1434
1434
|
#ifdef USE_METALNESSMAP
|
|
1435
1435
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1436
1436
|
metalnessFactor *= texelMetalness.b;
|
|
1437
|
-
#endif`,
|
|
1437
|
+
#endif`,gm=`#ifdef USE_METALNESSMAP
|
|
1438
1438
|
uniform sampler2D metalnessMap;
|
|
1439
|
-
#endif`,
|
|
1439
|
+
#endif`,_m=`#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`,
|
|
1445
|
+
#endif`,vm=`#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`,
|
|
1454
|
+
#endif`,xm=`#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`,
|
|
1459
|
+
#endif`,ym=`#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`,
|
|
1473
|
+
#endif`,Sm=`#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`,
|
|
1478
|
+
#endif`,Mm=`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;`,
|
|
1519
|
+
vec3 nonPerturbedNormal = normal;`,Em=`#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;`,Mm=`#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`,
|
|
1534
|
+
#endif`,bm=`#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`,
|
|
1540
|
+
#endif`,Tm=`#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`,
|
|
1546
|
+
#endif`,Am=`#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`,
|
|
1552
|
+
#endif`,wm=`#ifdef USE_NORMALMAP
|
|
1553
1553
|
uniform sampler2D normalMap;
|
|
1554
1554
|
uniform vec2 normalScale;
|
|
1555
1555
|
#endif
|
|
@@ -1571,13 +1571,13 @@ vec3 nonPerturbedNormal = normal;`,Mm=`#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`,
|
|
1574
|
+
#endif`,Rm=`#ifdef USE_CLEARCOAT
|
|
1575
1575
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1576
|
-
#endif`,
|
|
1576
|
+
#endif`,Cm=`#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`,
|
|
1580
|
+
#endif`,Dm=`#ifdef USE_CLEARCOATMAP
|
|
1581
1581
|
uniform sampler2D clearcoatMap;
|
|
1582
1582
|
#endif
|
|
1583
1583
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1586,18 +1586,18 @@ vec3 nonPerturbedNormal = normal;`,Mm=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1586
1586
|
#endif
|
|
1587
1587
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1588
1588
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1589
|
-
#endif`,
|
|
1589
|
+
#endif`,Pm=`#ifdef USE_IRIDESCENCEMAP
|
|
1590
1590
|
uniform sampler2D iridescenceMap;
|
|
1591
1591
|
#endif
|
|
1592
1592
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1593
1593
|
uniform sampler2D iridescenceThicknessMap;
|
|
1594
|
-
#endif`,
|
|
1594
|
+
#endif`,Lm=`#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 );`,
|
|
1600
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Um=`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
|
-
}`,
|
|
1669
|
+
}`,Im=`#ifdef PREMULTIPLIED_ALPHA
|
|
1670
1670
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1671
|
-
#endif`,
|
|
1671
|
+
#endif`,Nm=`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;`,
|
|
1679
|
+
gl_Position = projectionMatrix * mvPosition;`,Fm=`#ifdef DITHERING
|
|
1680
1680
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1681
|
-
#endif`,
|
|
1681
|
+
#endif`,Om=`#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`,
|
|
1688
|
+
#endif`,Bm=`float roughnessFactor = roughness;
|
|
1689
1689
|
#ifdef USE_ROUGHNESSMAP
|
|
1690
1690
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1691
1691
|
roughnessFactor *= texelRoughness.g;
|
|
1692
|
-
#endif`,
|
|
1692
|
+
#endif`,zm=`#ifdef USE_ROUGHNESSMAP
|
|
1693
1693
|
uniform sampler2D roughnessMap;
|
|
1694
|
-
#endif`,
|
|
1694
|
+
#endif`,km=`#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;`,Nm=`#ifdef DITHERING
|
|
|
1877
1877
|
}
|
|
1878
1878
|
return mix( 1.0, shadow, shadowIntensity );
|
|
1879
1879
|
}
|
|
1880
|
-
#endif`,
|
|
1880
|
+
#endif`,Vm=`#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;`,Nm=`#ifdef DITHERING
|
|
|
1918
1918
|
};
|
|
1919
1919
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1920
1920
|
#endif
|
|
1921
|
-
#endif`,
|
|
1921
|
+
#endif`,Hm=`#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;`,Nm=`#ifdef DITHERING
|
|
|
1950
1950
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1951
1951
|
}
|
|
1952
1952
|
#pragma unroll_loop_end
|
|
1953
|
-
#endif`,
|
|
1953
|
+
#endif`,Gm=`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;`,Nm=`#ifdef DITHERING
|
|
|
1982
1982
|
#endif
|
|
1983
1983
|
#endif
|
|
1984
1984
|
return shadow;
|
|
1985
|
-
}`,
|
|
1985
|
+
}`,Wm=`#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`,
|
|
1990
|
+
#endif`,Xm=`#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;`,Nm=`#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`,
|
|
2005
|
+
#endif`,qm=`#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;`,Nm=`#ifdef DITHERING
|
|
|
2010
2010
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2011
2011
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2012
2012
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2013
|
-
#endif`,
|
|
2013
|
+
#endif`,Ym=`#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;`,Nm=`#ifdef DITHERING
|
|
|
2021
2021
|
#ifdef USE_TANGENT
|
|
2022
2022
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2023
2023
|
#endif
|
|
2024
|
-
#endif`,
|
|
2024
|
+
#endif`,Km=`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`,
|
|
2030
|
+
#endif`,jm=`#ifdef USE_SPECULARMAP
|
|
2031
2031
|
uniform sampler2D specularMap;
|
|
2032
|
-
#endif
|
|
2032
|
+
#endif`,$m=`#if defined( TONE_MAPPING )
|
|
2033
2033
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2034
|
-
#endif
|
|
2034
|
+
#endif`,Jm=`#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; }`,
|
|
2131
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,Zm=`#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; }`,Jm=`#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`,
|
|
2152
|
+
#endif`,Qm=`#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; }`,Jm=`#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`,
|
|
2278
|
+
#endif`,eg=`#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; }`,Jm=`#ifdef USE_TRANSMISS
|
|
|
2345
2345
|
#ifdef USE_THICKNESSMAP
|
|
2346
2346
|
uniform mat3 thicknessMapTransform;
|
|
2347
2347
|
varying vec2 vThicknessMapUv;
|
|
2348
|
-
#endif`,
|
|
2348
|
+
#endif`,tg=`#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; }`,Jm=`#ifdef USE_TRANSMISS
|
|
|
2439
2439
|
#ifdef USE_THICKNESSMAP
|
|
2440
2440
|
uniform mat3 thicknessMapTransform;
|
|
2441
2441
|
varying vec2 vThicknessMapUv;
|
|
2442
|
-
#endif`,
|
|
2442
|
+
#endif`,ng=`#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; }`,Jm=`#ifdef USE_TRANSMISS
|
|
|
2510
2510
|
#endif
|
|
2511
2511
|
#ifdef USE_THICKNESSMAP
|
|
2512
2512
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2513
|
-
#endif`,
|
|
2513
|
+
#endif`,ig=`#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; }`,Jm=`#ifdef USE_TRANSMISS
|
|
|
2519
2519
|
worldPosition = instanceMatrix * worldPosition;
|
|
2520
2520
|
#endif
|
|
2521
2521
|
worldPosition = modelMatrix * worldPosition;
|
|
2522
|
-
#endif`;const
|
|
2522
|
+
#endif`;const rg=`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
|
-
}`,
|
|
2527
|
+
}`,sg=`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
|
-
}`,
|
|
2539
|
+
}`,ag=`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
|
-
}`,
|
|
2546
|
+
}`,og=`#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
|
-
}`,
|
|
2569
|
+
}`,lg=`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
|
-
}`,
|
|
2576
|
+
}`,cg=`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
|
-
}`,
|
|
2586
|
+
}`,ug=`#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
|
-
}`,
|
|
2613
|
+
}`,hg=`#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
|
-
}`,
|
|
2647
|
+
}`,fg=`#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
|
-
}`,
|
|
2674
|
+
}`,dg=`#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
|
-
}`,
|
|
2698
|
+
}`,pg=`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
|
-
}`,
|
|
2704
|
+
}`,mg=`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
|
-
}`,
|
|
2713
|
+
}`,gg=`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
|
-
}`,
|
|
2735
|
+
}`,_g=`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
|
-
}`,
|
|
2763
|
+
}`,vg=`#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
|
-
}`,
|
|
2795
|
+
}`,xg=`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
|
-
}`,
|
|
2843
|
+
}`,yg=`#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
|
-
}`,
|
|
2882
|
+
}`,Sg=`#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
|
-
}`,
|
|
2939
|
+
}`,Mg=`#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
|
-
}`,
|
|
2973
|
+
}`,Eg=`#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
|
-
}`,
|
|
3019
|
+
}`,bg=`#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
|
-
}`,
|
|
3052
|
+
}`,Tg=`#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
|
-
}`,
|
|
3074
|
+
}`,Ag=`#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
|
-
}`,
|
|
3113
|
+
}`,wg=`#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
|
-
}`,
|
|
3172
|
+
}`,Rg=`#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
|
-
}`,
|
|
3215
|
+
}`,Cg=`#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
|
-
}`,
|
|
3340
|
+
}`,Dg=`#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
|
-
}`,
|
|
3377
|
+
}`,Pg=`#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
|
-
}`,
|
|
3430
|
+
}`,Lg=`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
|
-
}`,
|
|
3461
|
+
}`,Ug=`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
|
-
}`,
|
|
3486
|
+
}`,Ig=`#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
|
-
}`,
|
|
3509
|
+
}`,Ng=`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
|
-
}`,
|
|
3525
|
+
}`,Fg=`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
|
-
}`,
|
|
3549
|
+
}`,Og=`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
|
-
}`,$e={alphahash_fragment:rp,alphahash_pars_fragment:sp,alphamap_fragment:ap,alphamap_pars_fragment:op,alphatest_fragment:lp,alphatest_pars_fragment:cp,aomap_fragment:up,aomap_pars_fragment:hp,batching_pars_vertex:fp,batching_vertex:dp,begin_vertex:pp,beginnormal_vertex:mp,bsdfs:gp,iridescence_fragment:_p,bumpmap_pars_fragment:vp,clipping_planes_fragment:xp,clipping_planes_pars_fragment:yp,clipping_planes_pars_vertex:Sp,clipping_planes_vertex:Mp,color_fragment:Ep,color_pars_fragment:bp,color_pars_vertex:Tp,color_vertex:Ap,common:wp,cube_uv_reflection_fragment:Rp,defaultnormal_vertex:Cp,displacementmap_pars_vertex:Dp,displacementmap_vertex:Pp,emissivemap_fragment:Lp,emissivemap_pars_fragment:Up,colorspace_fragment:Ip,colorspace_pars_fragment:Np,envmap_fragment:Fp,envmap_common_pars_fragment:Op,envmap_pars_fragment:Bp,envmap_pars_vertex:zp,envmap_physical_pars_fragment:$p,envmap_vertex:kp,fog_vertex:Vp,fog_pars_vertex:Hp,fog_fragment:Gp,fog_pars_fragment:Wp,gradientmap_pars_fragment:Xp,lightmap_pars_fragment:qp,lights_lambert_fragment:Yp,lights_lambert_pars_fragment:Kp,lights_pars_begin:jp,lights_toon_fragment:Jp,lights_toon_pars_fragment:Zp,lights_phong_fragment:Qp,lights_phong_pars_fragment:em,lights_physical_fragment:tm,lights_physical_pars_fragment:nm,lights_fragment_begin:im,lights_fragment_maps:rm,lights_fragment_end:sm,logdepthbuf_fragment:am,logdepthbuf_pars_fragment:om,logdepthbuf_pars_vertex:lm,logdepthbuf_vertex:cm,map_fragment:um,map_pars_fragment:hm,map_particle_fragment:fm,map_particle_pars_fragment:dm,metalnessmap_fragment:pm,metalnessmap_pars_fragment:mm,morphinstance_vertex:gm,morphcolor_vertex:_m,morphnormal_vertex:vm,morphtarget_pars_vertex:xm,morphtarget_vertex:ym,normal_fragment_begin:Sm,normal_fragment_maps:Mm,normal_pars_fragment:Em,normal_pars_vertex:bm,normal_vertex:Tm,normalmap_pars_fragment:Am,clearcoat_normal_fragment_begin:wm,clearcoat_normal_fragment_maps:Rm,clearcoat_pars_fragment:Cm,iridescence_pars_fragment:Dm,opaque_fragment:Pm,packing:Lm,premultiplied_alpha_fragment:Um,project_vertex:Im,dithering_fragment:Nm,dithering_pars_fragment:Fm,roughnessmap_fragment:Om,roughnessmap_pars_fragment:Bm,shadowmap_pars_fragment:zm,shadowmap_pars_vertex:km,shadowmap_vertex:Vm,shadowmask_pars_fragment:Hm,skinbase_vertex:Gm,skinning_pars_vertex:Wm,skinning_vertex:Xm,skinnormal_vertex:qm,specularmap_fragment:Ym,specularmap_pars_fragment:Km,tonemapping_fragment:jm,tonemapping_pars_fragment:$m,transmission_fragment:Jm,transmission_pars_fragment:Zm,uv_pars_fragment:Qm,uv_pars_vertex:eg,uv_vertex:tg,worldpos_vertex:ng,background_vert:ig,background_frag:rg,backgroundCube_vert:sg,backgroundCube_frag:ag,cube_vert:og,cube_frag:lg,depth_vert:cg,depth_frag:ug,distanceRGBA_vert:hg,distanceRGBA_frag:fg,equirect_vert:dg,equirect_frag:pg,linedashed_vert:mg,linedashed_frag:gg,meshbasic_vert:_g,meshbasic_frag:vg,meshlambert_vert:xg,meshlambert_frag:yg,meshmatcap_vert:Sg,meshmatcap_frag:Mg,meshnormal_vert:Eg,meshnormal_frag:bg,meshphong_vert:Tg,meshphong_frag:Ag,meshphysical_vert:wg,meshphysical_frag:Rg,meshtoon_vert:Cg,meshtoon_frag:Dg,points_vert:Pg,points_frag:Lg,shadow_vert:Ug,shadow_frag:Ig,sprite_vert:Ng,sprite_frag:Fg},he={common:{diffuse:{value:new Ye(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 We(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 Ye(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 Ye(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 Ye(16777215)},opacity:{value:1},center:{value:new We(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}}},Wt={basic:{uniforms:Bt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:Bt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Ye(0)}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:Bt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Ye(0)},specular:{value:new Ye(1118481)},shininess:{value:30}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:Bt([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new Ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},toon:{uniforms:Bt([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new Ye(0)}}]),vertexShader:$e.meshtoon_vert,fragmentShader:$e.meshtoon_frag},matcap:{uniforms:Bt([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matcap:{value:null}}]),vertexShader:$e.meshmatcap_vert,fragmentShader:$e.meshmatcap_frag},points:{uniforms:Bt([he.points,he.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:Bt([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:Bt([he.common,he.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:Bt([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:$e.meshnormal_vert,fragmentShader:$e.meshnormal_frag},sprite:{uniforms:Bt([he.sprite,he.fog]),vertexShader:$e.sprite_vert,fragmentShader:$e.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:$e.background_vert,fragmentShader:$e.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qe}},vertexShader:$e.backgroundCube_vert,fragmentShader:$e.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distanceRGBA:{uniforms:Bt([he.common,he.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$e.distanceRGBA_vert,fragmentShader:$e.distanceRGBA_frag},shadow:{uniforms:Bt([he.lights,he.fog,{color:{value:new Ye(0)},opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}};Wt.physical={uniforms:Bt([Wt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new We(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 Ye(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 We},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new Ye(0)},specularColor:{value:new Ye(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe},anisotropyVector:{value:new We},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qe}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag};const us={r:0,b:0,g:0},ri=new Jt,Og=new Ke;function Bg(i,e,t,n,r,s,a){const o=new Ye(0);let l=s===!0?0:1,c,u,h=null,f=0,p=null;function g(T){let y=T.isScene===!0?T.background:null;return y&&y.isTexture&&(y=(T.backgroundBlurriness>0?t:e).get(y)),y}function _(T){let y=!1;const D=g(T);D===null?d(o,l):D&&D.isColor&&(d(D,1),y=!0);const C=i.xr.getEnvironmentBlendMode();C==="additive"?n.buffers.color.setClear(0,0,0,1,a):C==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||y)&&(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(T,y){const D=g(y);D&&(D.isCubeTexture||D.mapping===Bs)?(u===void 0&&(u=new Rt(new ji(1,1,1),new On({name:"BackgroundCubeMaterial",uniforms:Yi(Wt.backgroundCube.uniforms),vertexShader:Wt.backgroundCube.vertexShader,fragmentShader:Wt.backgroundCube.fragmentShader,side:kt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(C,w,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),ri.copy(y.backgroundRotation),ri.x*=-1,ri.y*=-1,ri.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(ri.y*=-1,ri.z*=-1),u.material.uniforms.envMap.value=D,u.material.uniforms.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Og.makeRotationFromEuler(ri)),u.material.toneMapped=it.getTransfer(D.colorSpace)!==ut,(h!==D||f!==D.version||p!==i.toneMapping)&&(u.material.needsUpdate=!0,h=D,f=D.version,p=i.toneMapping),u.layers.enableAll(),T.unshift(u,u.geometry,u.material,0,0,null)):D&&D.isTexture&&(c===void 0&&(c=new Rt(new Cr(2,2),new On({name:"BackgroundMaterial",uniforms:Yi(Wt.background.uniforms),vertexShader:Wt.background.vertexShader,fragmentShader:Wt.background.fragmentShader,side:Fn,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=y.backgroundIntensity,c.material.toneMapped=it.getTransfer(D.colorSpace)!==ut,D.matrixAutoUpdate===!0&&D.updateMatrix(),c.material.uniforms.uvTransform.value.copy(D.matrix),(h!==D||f!==D.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,h=D,f=D.version,p=i.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null))}function d(T,y){T.getRGB(us,hu(i)),n.buffers.color.setClear(us.r,us.g,us.b,y,a)}function E(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(T,y=1){o.set(T),l=y,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(T){l=T,d(o,l)},render:_,addToRenderList:m,dispose:E}}function zg(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null);let s=r,a=!1;function o(x,b,O,F,k){let W=!1;const B=h(F,O,b);s!==B&&(s=B,c(s.object)),W=p(x,F,O,k),W&&g(x,F,O,k),k!==null&&e.update(k,i.ELEMENT_ARRAY_BUFFER),(W||a)&&(a=!1,y(x,b,O,F),k!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(k).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function u(x){return i.deleteVertexArray(x)}function h(x,b,O){const F=O.wireframe===!0;let k=n[x.id];k===void 0&&(k={},n[x.id]=k);let W=k[b.id];W===void 0&&(W={},k[b.id]=W);let B=W[F];return B===void 0&&(B=f(l()),W[F]=B),B}function f(x){const b=[],O=[],F=[];for(let k=0;k<t;k++)b[k]=0,O[k]=0,F[k]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:b,enabledAttributes:O,attributeDivisors:F,object:x,attributes:{},index:null}}function p(x,b,O,F){const k=s.attributes,W=b.attributes;let B=0;const J=O.getAttributes();for(const V in J)if(J[V].location>=0){const ge=k[V];let se=W[V];if(se===void 0&&(V==="instanceMatrix"&&x.instanceMatrix&&(se=x.instanceMatrix),V==="instanceColor"&&x.instanceColor&&(se=x.instanceColor)),ge===void 0||ge.attribute!==se||se&&ge.data!==se.data)return!0;B++}return s.attributesNum!==B||s.index!==F}function g(x,b,O,F){const k={},W=b.attributes;let B=0;const J=O.getAttributes();for(const V in J)if(J[V].location>=0){let ge=W[V];ge===void 0&&(V==="instanceMatrix"&&x.instanceMatrix&&(ge=x.instanceMatrix),V==="instanceColor"&&x.instanceColor&&(ge=x.instanceColor));const se={};se.attribute=ge,ge&&ge.data&&(se.data=ge.data),k[V]=se,B++}s.attributes=k,s.attributesNum=B,s.index=F}function _(){const x=s.newAttributes;for(let b=0,O=x.length;b<O;b++)x[b]=0}function m(x){d(x,0)}function d(x,b){const O=s.newAttributes,F=s.enabledAttributes,k=s.attributeDivisors;O[x]=1,F[x]===0&&(i.enableVertexAttribArray(x),F[x]=1),k[x]!==b&&(i.vertexAttribDivisor(x,b),k[x]=b)}function E(){const x=s.newAttributes,b=s.enabledAttributes;for(let O=0,F=b.length;O<F;O++)b[O]!==x[O]&&(i.disableVertexAttribArray(O),b[O]=0)}function T(x,b,O,F,k,W,B){B===!0?i.vertexAttribIPointer(x,b,O,k,W):i.vertexAttribPointer(x,b,O,F,k,W)}function y(x,b,O,F){_();const k=F.attributes,W=O.getAttributes(),B=b.defaultAttributeValues;for(const J in W){const V=W[J];if(V.location>=0){let le=k[J];if(le===void 0&&(J==="instanceMatrix"&&x.instanceMatrix&&(le=x.instanceMatrix),J==="instanceColor"&&x.instanceColor&&(le=x.instanceColor)),le!==void 0){const ge=le.normalized,se=le.itemSize,ke=e.get(le);if(ke===void 0)continue;const je=ke.buffer,$=ke.type,ue=ke.bytesPerElement,Le=$===i.INT||$===i.UNSIGNED_INT||le.gpuType===Lo;if(le.isInterleavedBufferAttribute){const ye=le.data,Ue=ye.stride,tt=le.offset;if(ye.isInstancedInterleavedBuffer){for(let ze=0;ze<V.locationSize;ze++)d(V.location+ze,ye.meshPerAttribute);x.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=ye.meshPerAttribute*ye.count)}else for(let ze=0;ze<V.locationSize;ze++)m(V.location+ze);i.bindBuffer(i.ARRAY_BUFFER,je);for(let ze=0;ze<V.locationSize;ze++)T(V.location+ze,se/V.locationSize,$,ge,Ue*ue,(tt+se/V.locationSize*ze)*ue,Le)}else{if(le.isInstancedBufferAttribute){for(let ye=0;ye<V.locationSize;ye++)d(V.location+ye,le.meshPerAttribute);x.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let ye=0;ye<V.locationSize;ye++)m(V.location+ye);i.bindBuffer(i.ARRAY_BUFFER,je);for(let ye=0;ye<V.locationSize;ye++)T(V.location+ye,se/V.locationSize,$,ge,se*ue,se/V.locationSize*ye*ue,Le)}}else if(B!==void 0){const ge=B[J];if(ge!==void 0)switch(ge.length){case 2:i.vertexAttrib2fv(V.location,ge);break;case 3:i.vertexAttrib3fv(V.location,ge);break;case 4:i.vertexAttrib4fv(V.location,ge);break;default:i.vertexAttrib1fv(V.location,ge)}}}}E()}function D(){P();for(const x in n){const b=n[x];for(const O in b){const F=b[O];for(const k in F)u(F[k].object),delete F[k];delete b[O]}delete n[x]}}function C(x){if(n[x.id]===void 0)return;const b=n[x.id];for(const O in b){const F=b[O];for(const k in F)u(F[k].object),delete F[k];delete b[O]}delete n[x.id]}function w(x){for(const b in n){const O=n[b];if(O[x.id]===void 0)continue;const F=O[x.id];for(const k in F)u(F[k].object),delete F[k];delete O[x.id]}}function P(){M(),a=!0,s!==r&&(s=r,c(s.object))}function M(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:P,resetDefaultState:M,dispose:D,releaseStatesOfGeometry:C,releaseStatesOfProgram:w,initAttributes:_,enableAttribute:m,disableUnusedAttributes:E}}function kg(i,e,t){let n;function r(c){n=c}function s(c,u){i.drawArrays(n,c,u),t.update(u,n,1)}function a(c,u,h){h!==0&&(i.drawArraysInstanced(n,c,u,h),t.update(u,n,h))}function o(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,u,0,h);let p=0;for(let g=0;g<h;g++)p+=u[g];t.update(p,n,1)}function l(c,u,h,f){if(h===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let g=0;g<c.length;g++)a(c[g],u[g],f[g]);else{p.multiDrawArraysInstancedWEBGL(n,c,0,u,0,f,0,h);let g=0;for(let _=0;_<h;_++)g+=u[_]*f[_];t.update(g,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Vg(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(w){return!(w!==rn&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(w){const P=w===Rr&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==Mn&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==yn&&!P)}function l(w){if(w==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="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 u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),d=i.getParameter(i.MAX_VERTEX_ATTRIBS),E=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),y=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),D=g>0,C=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:d,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:y,vertexTextures:D,maxSamples:C}}function Hg(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new qn,o=new qe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const p=h.length!==0||f||n!==0||r;return r=f,n=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,p){const g=h.clippingPlanes,_=h.clipIntersection,m=h.clipShadows,d=i.get(h);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const E=s?0:n,T=E*4;let y=d.clippingState||null;l.value=y,y=u(g,f,T,p);for(let D=0;D!==T;++D)y[D]=t[D];d.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,p,g){const _=h!==null?h.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const d=p+_*4,E=f.matrixWorldInverse;o.getNormalMatrix(E),(m===null||m.length<d)&&(m=new Float32Array(d));for(let T=0,y=p;T!==_;++T,y+=4)a.copy(h[T]).applyMatrix4(E,o),a.normal.toArray(m,y),m[y+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function Gg(i){let e=new WeakMap;function t(a,o){return o===Ha?a.mapping=Hi:o===Ga&&(a.mapping=Gi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Ha||o===Ga)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 fd(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 Oi=4,tc=[.125,.215,.35,.446,.526,.582],ui=20,Ea=new Hs,nc=new Ye;let ba=null,Ta=0,Aa=0,wa=!1;const li=(1+Math.sqrt(5))/2,Ni=1/li,ic=[new L(-li,Ni,0),new L(li,Ni,0),new L(-Ni,0,li),new L(Ni,0,li),new L(0,li,-Ni),new L(0,li,Ni),new L(-1,1,-1),new L(1,1,-1),new L(-1,1,1),new L(1,1,1)],Wg=new L;class rc{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=Wg}=s;ba=this._renderer.getRenderTarget(),Ta=this._renderer.getActiveCubeFace(),Aa=this._renderer.getActiveMipmapLevel(),wa=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=oc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ac(),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(ba,Ta,Aa),this._renderer.xr.enabled=wa,e.scissorTest=!1,hs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Hi||e.mapping===Gi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ba=this._renderer.getRenderTarget(),Ta=this._renderer.getActiveCubeFace(),Aa=this._renderer.getActiveMipmapLevel(),wa=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:jt,minFilter:jt,generateMipmaps:!1,type:Rr,format:rn,colorSpace:Xi,depthBuffer:!1},r=sc(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=sc(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Xg(s)),this._blurMaterial=qg(s,e,t)}return r}_compileMaterial(e){const t=new Rt(this._lodPlanes[0],e);this._renderer.compile(t,Ea)}_sceneToCubeUV(e,t,n,r,s){const l=new zt(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,f=h.autoClear,p=h.toneMapping;h.getClearColor(nc),h.toneMapping=jn,h.autoClear=!1;const g=new gi({name:"PMREM.Background",side:kt,depthWrite:!1,depthTest:!1}),_=new Rt(new ji,g);let m=!1;const d=e.background;d?d.isColor&&(g.color.copy(d),e.background=null,m=!0):(g.color.copy(nc),m=!0);for(let E=0;E<6;E++){const T=E%3;T===0?(l.up.set(0,c[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[E],s.y,s.z)):T===1?(l.up.set(0,0,c[E]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[E],s.z)):(l.up.set(0,c[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[E]));const y=this._cubeSize;hs(r,T*y,E>2?y:0,y,y),h.setRenderTarget(r),m&&h.render(_,l),h.render(e,l)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=p,h.autoClear=f,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Hi||e.mapping===Gi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=oc()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ac());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Rt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;hs(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Ea)}_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=ic[(r-s-1)%ic.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 u=3,h=new Rt(this._lodPlanes[r],c),f=c.uniforms,p=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*ui-1),_=s/g,m=isFinite(s)?1+Math.floor(u*_):ui;m>ui&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${ui}`);const d=[];let E=0;for(let w=0;w<ui;++w){const P=w/_,M=Math.exp(-P*P/2);d.push(M),w===0?E+=M:w<m&&(E+=2*M)}for(let w=0;w<d.length;w++)d[w]=d[w]/E;f.envMap.value=e.texture,f.samples.value=m,f.weights.value=d,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:T}=this;f.dTheta.value=g,f.mipInt.value=T-n;const y=this._sizeLods[r],D=3*y*(r>T-Oi?r-T+Oi:0),C=4*(this._cubeSize-y);hs(t,D,C,3*y,2*y),l.setRenderTarget(t),l.render(h,Ea)}}function Xg(i){const e=[],t=[],n=[];let r=i;const s=i-Oi+1+tc.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-Oi?l=tc[a-i+Oi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,g=6,_=3,m=2,d=1,E=new Float32Array(_*g*p),T=new Float32Array(m*g*p),y=new Float32Array(d*g*p);for(let C=0;C<p;C++){const w=C%3*2/3-1,P=C>2?0:-1,M=[w,P,0,w+2/3,P,0,w+2/3,P+1,0,w,P,0,w+2/3,P+1,0,w,P+1,0];E.set(M,_*g*C),T.set(f,m*g*C);const x=[C,C,C,C,C,C];y.set(x,d*g*C)}const D=new Dt;D.setAttribute("position",new Nt(E,_)),D.setAttribute("uv",new Nt(T,m)),D.setAttribute("faceIndex",new Nt(y,d)),e.push(D),r>Oi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function sc(i,e,t){const n=new pi(i,e,t);return n.texture.mapping=Bs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function hs(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function qg(i,e,t){const n=new Float32Array(ui),r=new L(0,1,0);return new On({name:"SphericalGaussianBlur",defines:{n:ui,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:Ko(),fragmentShader:`
|
|
3574
|
+
}`,$e={alphahash_fragment:sp,alphahash_pars_fragment:ap,alphamap_fragment:op,alphamap_pars_fragment:lp,alphatest_fragment:cp,alphatest_pars_fragment:up,aomap_fragment:hp,aomap_pars_fragment:fp,batching_pars_vertex:dp,batching_vertex:pp,begin_vertex:mp,beginnormal_vertex:gp,bsdfs:_p,iridescence_fragment:vp,bumpmap_pars_fragment:xp,clipping_planes_fragment:yp,clipping_planes_pars_fragment:Sp,clipping_planes_pars_vertex:Mp,clipping_planes_vertex:Ep,color_fragment:bp,color_pars_fragment:Tp,color_pars_vertex:Ap,color_vertex:wp,common:Rp,cube_uv_reflection_fragment:Cp,defaultnormal_vertex:Dp,displacementmap_pars_vertex:Pp,displacementmap_vertex:Lp,emissivemap_fragment:Up,emissivemap_pars_fragment:Ip,colorspace_fragment:Np,colorspace_pars_fragment:Fp,envmap_fragment:Op,envmap_common_pars_fragment:Bp,envmap_pars_fragment:zp,envmap_pars_vertex:kp,envmap_physical_pars_fragment:Jp,envmap_vertex:Vp,fog_vertex:Hp,fog_pars_vertex:Gp,fog_fragment:Wp,fog_pars_fragment:Xp,gradientmap_pars_fragment:qp,lightmap_pars_fragment:Yp,lights_lambert_fragment:Kp,lights_lambert_pars_fragment:jp,lights_pars_begin:$p,lights_toon_fragment:Zp,lights_toon_pars_fragment:Qp,lights_phong_fragment:em,lights_phong_pars_fragment:tm,lights_physical_fragment:nm,lights_physical_pars_fragment:im,lights_fragment_begin:rm,lights_fragment_maps:sm,lights_fragment_end:am,logdepthbuf_fragment:om,logdepthbuf_pars_fragment:lm,logdepthbuf_pars_vertex:cm,logdepthbuf_vertex:um,map_fragment:hm,map_pars_fragment:fm,map_particle_fragment:dm,map_particle_pars_fragment:pm,metalnessmap_fragment:mm,metalnessmap_pars_fragment:gm,morphinstance_vertex:_m,morphcolor_vertex:vm,morphnormal_vertex:xm,morphtarget_pars_vertex:ym,morphtarget_vertex:Sm,normal_fragment_begin:Mm,normal_fragment_maps:Em,normal_pars_fragment:bm,normal_pars_vertex:Tm,normal_vertex:Am,normalmap_pars_fragment:wm,clearcoat_normal_fragment_begin:Rm,clearcoat_normal_fragment_maps:Cm,clearcoat_pars_fragment:Dm,iridescence_pars_fragment:Pm,opaque_fragment:Lm,packing:Um,premultiplied_alpha_fragment:Im,project_vertex:Nm,dithering_fragment:Fm,dithering_pars_fragment:Om,roughnessmap_fragment:Bm,roughnessmap_pars_fragment:zm,shadowmap_pars_fragment:km,shadowmap_pars_vertex:Vm,shadowmap_vertex:Hm,shadowmask_pars_fragment:Gm,skinbase_vertex:Wm,skinning_pars_vertex:Xm,skinning_vertex:qm,skinnormal_vertex:Ym,specularmap_fragment:Km,specularmap_pars_fragment:jm,tonemapping_fragment:$m,tonemapping_pars_fragment:Jm,transmission_fragment:Zm,transmission_pars_fragment:Qm,uv_pars_fragment:eg,uv_pars_vertex:tg,uv_vertex:ng,worldpos_vertex:ig,background_vert:rg,background_frag:sg,backgroundCube_vert:ag,backgroundCube_frag:og,cube_vert:lg,cube_frag:cg,depth_vert:ug,depth_frag:hg,distanceRGBA_vert:fg,distanceRGBA_frag:dg,equirect_vert:pg,equirect_frag:mg,linedashed_vert:gg,linedashed_frag:_g,meshbasic_vert:vg,meshbasic_frag:xg,meshlambert_vert:yg,meshlambert_frag:Sg,meshmatcap_vert:Mg,meshmatcap_frag:Eg,meshnormal_vert:bg,meshnormal_frag:Tg,meshphong_vert:Ag,meshphong_frag:wg,meshphysical_vert:Rg,meshphysical_frag:Cg,meshtoon_vert:Dg,meshtoon_frag:Pg,points_vert:Lg,points_frag:Ug,shadow_vert:Ig,shadow_frag:Ng,sprite_vert:Fg,sprite_frag:Og},he={common:{diffuse:{value:new Ye(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 We(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 Ye(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 Ye(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 Ye(16777215)},opacity:{value:1},center:{value:new We(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}}},Wt={basic:{uniforms:Bt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:Bt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Ye(0)}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:Bt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Ye(0)},specular:{value:new Ye(1118481)},shininess:{value:30}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:Bt([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new Ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},toon:{uniforms:Bt([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new Ye(0)}}]),vertexShader:$e.meshtoon_vert,fragmentShader:$e.meshtoon_frag},matcap:{uniforms:Bt([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matcap:{value:null}}]),vertexShader:$e.meshmatcap_vert,fragmentShader:$e.meshmatcap_frag},points:{uniforms:Bt([he.points,he.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:Bt([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:Bt([he.common,he.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:Bt([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:$e.meshnormal_vert,fragmentShader:$e.meshnormal_frag},sprite:{uniforms:Bt([he.sprite,he.fog]),vertexShader:$e.sprite_vert,fragmentShader:$e.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:$e.background_vert,fragmentShader:$e.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qe}},vertexShader:$e.backgroundCube_vert,fragmentShader:$e.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distanceRGBA:{uniforms:Bt([he.common,he.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$e.distanceRGBA_vert,fragmentShader:$e.distanceRGBA_frag},shadow:{uniforms:Bt([he.lights,he.fog,{color:{value:new Ye(0)},opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}};Wt.physical={uniforms:Bt([Wt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new We(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 Ye(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 We},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new Ye(0)},specularColor:{value:new Ye(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe},anisotropyVector:{value:new We},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qe}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag};const us={r:0,b:0,g:0},ri=new Jt,Bg=new Ke;function zg(i,e,t,n,r,s,a){const o=new Ye(0);let l=s===!0?0:1,c,u,h=null,f=0,p=null;function g(T){let y=T.isScene===!0?T.background:null;return y&&y.isTexture&&(y=(T.backgroundBlurriness>0?t:e).get(y)),y}function _(T){let y=!1;const D=g(T);D===null?d(o,l):D&&D.isColor&&(d(D,1),y=!0);const C=i.xr.getEnvironmentBlendMode();C==="additive"?n.buffers.color.setClear(0,0,0,1,a):C==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||y)&&(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(T,y){const D=g(y);D&&(D.isCubeTexture||D.mapping===Bs)?(u===void 0&&(u=new Rt(new ji(1,1,1),new On({name:"BackgroundCubeMaterial",uniforms:Yi(Wt.backgroundCube.uniforms),vertexShader:Wt.backgroundCube.vertexShader,fragmentShader:Wt.backgroundCube.fragmentShader,side:kt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(C,w,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),ri.copy(y.backgroundRotation),ri.x*=-1,ri.y*=-1,ri.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(ri.y*=-1,ri.z*=-1),u.material.uniforms.envMap.value=D,u.material.uniforms.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Bg.makeRotationFromEuler(ri)),u.material.toneMapped=it.getTransfer(D.colorSpace)!==ut,(h!==D||f!==D.version||p!==i.toneMapping)&&(u.material.needsUpdate=!0,h=D,f=D.version,p=i.toneMapping),u.layers.enableAll(),T.unshift(u,u.geometry,u.material,0,0,null)):D&&D.isTexture&&(c===void 0&&(c=new Rt(new Cr(2,2),new On({name:"BackgroundMaterial",uniforms:Yi(Wt.background.uniforms),vertexShader:Wt.background.vertexShader,fragmentShader:Wt.background.fragmentShader,side:Fn,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=y.backgroundIntensity,c.material.toneMapped=it.getTransfer(D.colorSpace)!==ut,D.matrixAutoUpdate===!0&&D.updateMatrix(),c.material.uniforms.uvTransform.value.copy(D.matrix),(h!==D||f!==D.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,h=D,f=D.version,p=i.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null))}function d(T,y){T.getRGB(us,hu(i)),n.buffers.color.setClear(us.r,us.g,us.b,y,a)}function E(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(T,y=1){o.set(T),l=y,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(T){l=T,d(o,l)},render:_,addToRenderList:m,dispose:E}}function kg(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null);let s=r,a=!1;function o(x,b,O,F,k){let W=!1;const B=h(F,O,b);s!==B&&(s=B,c(s.object)),W=p(x,F,O,k),W&&g(x,F,O,k),k!==null&&e.update(k,i.ELEMENT_ARRAY_BUFFER),(W||a)&&(a=!1,y(x,b,O,F),k!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(k).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function u(x){return i.deleteVertexArray(x)}function h(x,b,O){const F=O.wireframe===!0;let k=n[x.id];k===void 0&&(k={},n[x.id]=k);let W=k[b.id];W===void 0&&(W={},k[b.id]=W);let B=W[F];return B===void 0&&(B=f(l()),W[F]=B),B}function f(x){const b=[],O=[],F=[];for(let k=0;k<t;k++)b[k]=0,O[k]=0,F[k]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:b,enabledAttributes:O,attributeDivisors:F,object:x,attributes:{},index:null}}function p(x,b,O,F){const k=s.attributes,W=b.attributes;let B=0;const J=O.getAttributes();for(const V in J)if(J[V].location>=0){const ge=k[V];let se=W[V];if(se===void 0&&(V==="instanceMatrix"&&x.instanceMatrix&&(se=x.instanceMatrix),V==="instanceColor"&&x.instanceColor&&(se=x.instanceColor)),ge===void 0||ge.attribute!==se||se&&ge.data!==se.data)return!0;B++}return s.attributesNum!==B||s.index!==F}function g(x,b,O,F){const k={},W=b.attributes;let B=0;const J=O.getAttributes();for(const V in J)if(J[V].location>=0){let ge=W[V];ge===void 0&&(V==="instanceMatrix"&&x.instanceMatrix&&(ge=x.instanceMatrix),V==="instanceColor"&&x.instanceColor&&(ge=x.instanceColor));const se={};se.attribute=ge,ge&&ge.data&&(se.data=ge.data),k[V]=se,B++}s.attributes=k,s.attributesNum=B,s.index=F}function _(){const x=s.newAttributes;for(let b=0,O=x.length;b<O;b++)x[b]=0}function m(x){d(x,0)}function d(x,b){const O=s.newAttributes,F=s.enabledAttributes,k=s.attributeDivisors;O[x]=1,F[x]===0&&(i.enableVertexAttribArray(x),F[x]=1),k[x]!==b&&(i.vertexAttribDivisor(x,b),k[x]=b)}function E(){const x=s.newAttributes,b=s.enabledAttributes;for(let O=0,F=b.length;O<F;O++)b[O]!==x[O]&&(i.disableVertexAttribArray(O),b[O]=0)}function T(x,b,O,F,k,W,B){B===!0?i.vertexAttribIPointer(x,b,O,k,W):i.vertexAttribPointer(x,b,O,F,k,W)}function y(x,b,O,F){_();const k=F.attributes,W=O.getAttributes(),B=b.defaultAttributeValues;for(const J in W){const V=W[J];if(V.location>=0){let le=k[J];if(le===void 0&&(J==="instanceMatrix"&&x.instanceMatrix&&(le=x.instanceMatrix),J==="instanceColor"&&x.instanceColor&&(le=x.instanceColor)),le!==void 0){const ge=le.normalized,se=le.itemSize,ke=e.get(le);if(ke===void 0)continue;const je=ke.buffer,$=ke.type,ue=ke.bytesPerElement,Le=$===i.INT||$===i.UNSIGNED_INT||le.gpuType===Lo;if(le.isInterleavedBufferAttribute){const ye=le.data,Ue=ye.stride,tt=le.offset;if(ye.isInstancedInterleavedBuffer){for(let ze=0;ze<V.locationSize;ze++)d(V.location+ze,ye.meshPerAttribute);x.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=ye.meshPerAttribute*ye.count)}else for(let ze=0;ze<V.locationSize;ze++)m(V.location+ze);i.bindBuffer(i.ARRAY_BUFFER,je);for(let ze=0;ze<V.locationSize;ze++)T(V.location+ze,se/V.locationSize,$,ge,Ue*ue,(tt+se/V.locationSize*ze)*ue,Le)}else{if(le.isInstancedBufferAttribute){for(let ye=0;ye<V.locationSize;ye++)d(V.location+ye,le.meshPerAttribute);x.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let ye=0;ye<V.locationSize;ye++)m(V.location+ye);i.bindBuffer(i.ARRAY_BUFFER,je);for(let ye=0;ye<V.locationSize;ye++)T(V.location+ye,se/V.locationSize,$,ge,se*ue,se/V.locationSize*ye*ue,Le)}}else if(B!==void 0){const ge=B[J];if(ge!==void 0)switch(ge.length){case 2:i.vertexAttrib2fv(V.location,ge);break;case 3:i.vertexAttrib3fv(V.location,ge);break;case 4:i.vertexAttrib4fv(V.location,ge);break;default:i.vertexAttrib1fv(V.location,ge)}}}}E()}function D(){P();for(const x in n){const b=n[x];for(const O in b){const F=b[O];for(const k in F)u(F[k].object),delete F[k];delete b[O]}delete n[x]}}function C(x){if(n[x.id]===void 0)return;const b=n[x.id];for(const O in b){const F=b[O];for(const k in F)u(F[k].object),delete F[k];delete b[O]}delete n[x.id]}function w(x){for(const b in n){const O=n[b];if(O[x.id]===void 0)continue;const F=O[x.id];for(const k in F)u(F[k].object),delete F[k];delete O[x.id]}}function P(){M(),a=!0,s!==r&&(s=r,c(s.object))}function M(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:P,resetDefaultState:M,dispose:D,releaseStatesOfGeometry:C,releaseStatesOfProgram:w,initAttributes:_,enableAttribute:m,disableUnusedAttributes:E}}function Vg(i,e,t){let n;function r(c){n=c}function s(c,u){i.drawArrays(n,c,u),t.update(u,n,1)}function a(c,u,h){h!==0&&(i.drawArraysInstanced(n,c,u,h),t.update(u,n,h))}function o(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,u,0,h);let p=0;for(let g=0;g<h;g++)p+=u[g];t.update(p,n,1)}function l(c,u,h,f){if(h===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let g=0;g<c.length;g++)a(c[g],u[g],f[g]);else{p.multiDrawArraysInstancedWEBGL(n,c,0,u,0,f,0,h);let g=0;for(let _=0;_<h;_++)g+=u[_]*f[_];t.update(g,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Hg(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(w){return!(w!==rn&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(w){const P=w===Rr&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==Mn&&n.convert(w)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==yn&&!P)}function l(w){if(w==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="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 u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),d=i.getParameter(i.MAX_VERTEX_ATTRIBS),E=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),y=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),D=g>0,C=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:d,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:y,vertexTextures:D,maxSamples:C}}function Gg(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new qn,o=new qe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const p=h.length!==0||f||n!==0||r;return r=f,n=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,p){const g=h.clippingPlanes,_=h.clipIntersection,m=h.clipShadows,d=i.get(h);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const E=s?0:n,T=E*4;let y=d.clippingState||null;l.value=y,y=u(g,f,T,p);for(let D=0;D!==T;++D)y[D]=t[D];d.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,p,g){const _=h!==null?h.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const d=p+_*4,E=f.matrixWorldInverse;o.getNormalMatrix(E),(m===null||m.length<d)&&(m=new Float32Array(d));for(let T=0,y=p;T!==_;++T,y+=4)a.copy(h[T]).applyMatrix4(E,o),a.normal.toArray(m,y),m[y+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function Wg(i){let e=new WeakMap;function t(a,o){return o===Ha?a.mapping=Hi:o===Ga&&(a.mapping=Gi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Ha||o===Ga)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 dd(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 Oi=4,tc=[.125,.215,.35,.446,.526,.582],ui=20,Ea=new Hs,nc=new Ye;let ba=null,Ta=0,Aa=0,wa=!1;const li=(1+Math.sqrt(5))/2,Ni=1/li,ic=[new L(-li,Ni,0),new L(li,Ni,0),new L(-Ni,0,li),new L(Ni,0,li),new L(0,li,-Ni),new L(0,li,Ni),new L(-1,1,-1),new L(1,1,-1),new L(-1,1,1),new L(1,1,1)],Xg=new L;class rc{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=Xg}=s;ba=this._renderer.getRenderTarget(),Ta=this._renderer.getActiveCubeFace(),Aa=this._renderer.getActiveMipmapLevel(),wa=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=oc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ac(),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(ba,Ta,Aa),this._renderer.xr.enabled=wa,e.scissorTest=!1,hs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Hi||e.mapping===Gi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ba=this._renderer.getRenderTarget(),Ta=this._renderer.getActiveCubeFace(),Aa=this._renderer.getActiveMipmapLevel(),wa=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:jt,minFilter:jt,generateMipmaps:!1,type:Rr,format:rn,colorSpace:Xi,depthBuffer:!1},r=sc(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=sc(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=qg(s)),this._blurMaterial=Yg(s,e,t)}return r}_compileMaterial(e){const t=new Rt(this._lodPlanes[0],e);this._renderer.compile(t,Ea)}_sceneToCubeUV(e,t,n,r,s){const l=new zt(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,f=h.autoClear,p=h.toneMapping;h.getClearColor(nc),h.toneMapping=jn,h.autoClear=!1;const g=new gi({name:"PMREM.Background",side:kt,depthWrite:!1,depthTest:!1}),_=new Rt(new ji,g);let m=!1;const d=e.background;d?d.isColor&&(g.color.copy(d),e.background=null,m=!0):(g.color.copy(nc),m=!0);for(let E=0;E<6;E++){const T=E%3;T===0?(l.up.set(0,c[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[E],s.y,s.z)):T===1?(l.up.set(0,0,c[E]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[E],s.z)):(l.up.set(0,c[E],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[E]));const y=this._cubeSize;hs(r,T*y,E>2?y:0,y,y),h.setRenderTarget(r),m&&h.render(_,l),h.render(e,l)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=p,h.autoClear=f,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Hi||e.mapping===Gi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=oc()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ac());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Rt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;hs(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Ea)}_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=ic[(r-s-1)%ic.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 u=3,h=new Rt(this._lodPlanes[r],c),f=c.uniforms,p=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*ui-1),_=s/g,m=isFinite(s)?1+Math.floor(u*_):ui;m>ui&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${ui}`);const d=[];let E=0;for(let w=0;w<ui;++w){const P=w/_,M=Math.exp(-P*P/2);d.push(M),w===0?E+=M:w<m&&(E+=2*M)}for(let w=0;w<d.length;w++)d[w]=d[w]/E;f.envMap.value=e.texture,f.samples.value=m,f.weights.value=d,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:T}=this;f.dTheta.value=g,f.mipInt.value=T-n;const y=this._sizeLods[r],D=3*y*(r>T-Oi?r-T+Oi:0),C=4*(this._cubeSize-y);hs(t,D,C,3*y,2*y),l.setRenderTarget(t),l.render(h,Ea)}}function qg(i){const e=[],t=[],n=[];let r=i;const s=i-Oi+1+tc.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-Oi?l=tc[a-i+Oi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,g=6,_=3,m=2,d=1,E=new Float32Array(_*g*p),T=new Float32Array(m*g*p),y=new Float32Array(d*g*p);for(let C=0;C<p;C++){const w=C%3*2/3-1,P=C>2?0:-1,M=[w,P,0,w+2/3,P,0,w+2/3,P+1,0,w,P,0,w+2/3,P+1,0,w,P+1,0];E.set(M,_*g*C),T.set(f,m*g*C);const x=[C,C,C,C,C,C];y.set(x,d*g*C)}const D=new Pt;D.setAttribute("position",new Dt(E,_)),D.setAttribute("uv",new Dt(T,m)),D.setAttribute("faceIndex",new Dt(y,d)),e.push(D),r>Oi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function sc(i,e,t){const n=new pi(i,e,t);return n.texture.mapping=Bs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function hs(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Yg(i,e,t){const n=new Float32Array(ui),r=new L(0,1,0);return new On({name:"SphericalGaussianBlur",defines:{n:ui,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:Ko(),fragmentShader:`
|
|
3575
3575
|
|
|
3576
3576
|
precision mediump float;
|
|
3577
3577
|
precision mediump int;
|
|
@@ -3721,17 +3721,17 @@ void main() {
|
|
|
3721
3721
|
gl_Position = vec4( position, 1.0 );
|
|
3722
3722
|
|
|
3723
3723
|
}
|
|
3724
|
-
`}function Yg(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ha||l===Ga,u=l===Hi||l===Gi;if(c||u){let h=e.get(o);const f=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return t===null&&(t=new rc(i)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{const p=o.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new rc(i)),h=c?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function r(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==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 Kg(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&&zi("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function jg(i,e,t,n){const r={},s=new WeakMap;function a(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const g in f.attributes)e.remove(f.attributes[g]);f.removeEventListener("dispose",a),delete r[f.id];const p=s.get(f);p&&(e.remove(p),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(h,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const p in f)e.update(f[p],i.ARRAY_BUFFER)}function c(h){const f=[],p=h.index,g=h.attributes.position;let _=0;if(p!==null){const E=p.array;_=p.version;for(let T=0,y=E.length;T<y;T+=3){const D=E[T+0],C=E[T+1],w=E[T+2];f.push(D,C,C,w,w,D)}}else if(g!==void 0){const E=g.array;_=g.version;for(let T=0,y=E.length/3-1;T<y;T+=3){const D=T+0,C=T+1,w=T+2;f.push(D,C,C,w,w,D)}}else return;const m=new(au(f)?uu:cu)(f,1);m.version=_;const d=s.get(h);d&&e.remove(d),s.set(h,m)}function u(h){const f=s.get(h);if(f){const p=h.index;p!==null&&f.version<p.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function $g(i,e,t){let n;function r(f){n=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,p){i.drawElements(n,p,s,f*a),t.update(p,n,1)}function c(f,p,g){g!==0&&(i.drawElementsInstanced(n,p,s,f*a,g),t.update(p,n,g))}function u(f,p,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,f,0,g);let m=0;for(let d=0;d<g;d++)m+=p[d];t.update(m,n,1)}function h(f,p,g,_){if(g===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let d=0;d<f.length;d++)c(f[d]/a,p[d],_[d]);else{m.multiDrawElementsInstancedWEBGL(n,p,0,s,f,0,_,0,g);let d=0;for(let E=0;E<g;E++)d+=p[E]*_[E];t.update(d,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function Jg(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 Zg(i,e,t){const n=new WeakMap,r=new et;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0;let f=n.get(o);if(f===void 0||f.count!==h){let M=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",M)};f!==void 0&&f.texture.dispose();const p=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],d=o.morphAttributes.normal||[],E=o.morphAttributes.color||[];let T=0;p===!0&&(T=1),g===!0&&(T=2),_===!0&&(T=3);let y=o.attributes.position.count*T,D=1;y>e.maxTextureSize&&(D=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const C=new Float32Array(y*D*4*h),w=new ou(C,y,D,h);w.type=yn,w.needsUpdate=!0;const P=T*4;for(let x=0;x<h;x++){const b=m[x],O=d[x],F=E[x],k=y*D*4*x;for(let W=0;W<b.count;W++){const B=W*P;p===!0&&(r.fromBufferAttribute(b,W),C[k+B+0]=r.x,C[k+B+1]=r.y,C[k+B+2]=r.z,C[k+B+3]=0),g===!0&&(r.fromBufferAttribute(O,W),C[k+B+4]=r.x,C[k+B+5]=r.y,C[k+B+6]=r.z,C[k+B+7]=0),_===!0&&(r.fromBufferAttribute(F,W),C[k+B+8]=r.x,C[k+B+9]=r.y,C[k+B+10]=r.z,C[k+B+11]=F.itemSize===4?r.w:1)}}f={count:h,texture:w,size:new We(y,D)},n.set(o,f),o.addEventListener("dispose",M)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let p=0;for(let _=0;_<c.length;_++)p+=c[_];const g=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",f.size)}return{update:s}}function Qg(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&&(e.update(h),r.set(h,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 f=l.skeleton;r.get(f)!==c&&(f.update(),r.set(f,c))}return h}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 Cu=new Ct,lc=new Mu(1,1),Du=new ou,Pu=new $f,Lu=new du,cc=[],uc=[],hc=new Float32Array(16),fc=new Float32Array(9),dc=new Float32Array(4);function Qi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=cc[r];if(s===void 0&&(s=new Float32Array(r),cc[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 yt(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 St(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Gs(i,e){let t=uc[e];t===void 0&&(t=new Int32Array(e),uc[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function e_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function t_(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(yt(t,e))return;i.uniform2fv(this.addr,e),St(t,e)}}function n_(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(yt(t,e))return;i.uniform3fv(this.addr,e),St(t,e)}}function i_(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(yt(t,e))return;i.uniform4fv(this.addr,e),St(t,e)}}function r_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),St(t,e)}else{if(yt(t,n))return;dc.set(n),i.uniformMatrix2fv(this.addr,!1,dc),St(t,n)}}function s_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),St(t,e)}else{if(yt(t,n))return;fc.set(n),i.uniformMatrix3fv(this.addr,!1,fc),St(t,n)}}function a_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),St(t,e)}else{if(yt(t,n))return;hc.set(n),i.uniformMatrix4fv(this.addr,!1,hc),St(t,n)}}function o_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function l_(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(yt(t,e))return;i.uniform2iv(this.addr,e),St(t,e)}}function c_(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(yt(t,e))return;i.uniform3iv(this.addr,e),St(t,e)}}function u_(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(yt(t,e))return;i.uniform4iv(this.addr,e),St(t,e)}}function h_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function f_(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(yt(t,e))return;i.uniform2uiv(this.addr,e),St(t,e)}}function d_(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(yt(t,e))return;i.uniform3uiv(this.addr,e),St(t,e)}}function p_(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(yt(t,e))return;i.uniform4uiv(this.addr,e),St(t,e)}}function m_(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?(lc.compareFunction=ru,s=lc):s=Cu,t.setTexture2D(e||s,r)}function g_(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Pu,r)}function __(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Lu,r)}function v_(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Du,r)}function x_(i){switch(i){case 5126:return e_;case 35664:return t_;case 35665:return n_;case 35666:return i_;case 35674:return r_;case 35675:return s_;case 35676:return a_;case 5124:case 35670:return o_;case 35667:case 35671:return l_;case 35668:case 35672:return c_;case 35669:case 35673:return u_;case 5125:return h_;case 36294:return f_;case 36295:return d_;case 36296:return p_;case 35678:case 36198:case 36298:case 36306:case 35682:return m_;case 35679:case 36299:case 36307:return g_;case 35680:case 36300:case 36308:case 36293:return __;case 36289:case 36303:case 36311:case 36292:return v_}}function y_(i,e){i.uniform1fv(this.addr,e)}function S_(i,e){const t=Qi(e,this.size,2);i.uniform2fv(this.addr,t)}function M_(i,e){const t=Qi(e,this.size,3);i.uniform3fv(this.addr,t)}function E_(i,e){const t=Qi(e,this.size,4);i.uniform4fv(this.addr,t)}function b_(i,e){const t=Qi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function T_(i,e){const t=Qi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function A_(i,e){const t=Qi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function w_(i,e){i.uniform1iv(this.addr,e)}function R_(i,e){i.uniform2iv(this.addr,e)}function C_(i,e){i.uniform3iv(this.addr,e)}function D_(i,e){i.uniform4iv(this.addr,e)}function P_(i,e){i.uniform1uiv(this.addr,e)}function L_(i,e){i.uniform2uiv(this.addr,e)}function U_(i,e){i.uniform3uiv(this.addr,e)}function I_(i,e){i.uniform4uiv(this.addr,e)}function N_(i,e,t){const n=this.cache,r=e.length,s=Gs(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),St(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Cu,s[a])}function F_(i,e,t){const n=this.cache,r=e.length,s=Gs(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),St(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Pu,s[a])}function O_(i,e,t){const n=this.cache,r=e.length,s=Gs(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),St(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Lu,s[a])}function B_(i,e,t){const n=this.cache,r=e.length,s=Gs(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),St(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Du,s[a])}function z_(i){switch(i){case 5126:return y_;case 35664:return S_;case 35665:return M_;case 35666:return E_;case 35674:return b_;case 35675:return T_;case 35676:return A_;case 5124:case 35670:return w_;case 35667:case 35671:return R_;case 35668:case 35672:return C_;case 35669:case 35673:return D_;case 5125:return P_;case 36294:return L_;case 36295:return U_;case 36296:return I_;case 35678:case 36198:case 36298:case 36306:case 35682:return N_;case 35679:case 36299:case 36307:return F_;case 35680:case 36300:case 36308:case 36293:return O_;case 36289:case 36303:case 36311:case 36292:return B_}}class k_{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=x_(t.type)}}class V_{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=z_(t.type)}}class H_{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 Ra=/(\w+)(\])?(\[|\.)?/g;function pc(i,e){i.seq.push(e),i.map[e.id]=e}function G_(i,e,t){const n=i.name,r=n.length;for(Ra.lastIndex=0;;){const s=Ra.exec(n),a=Ra.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){pc(t,c===void 0?new k_(o,i,e):new V_(o,i,e));break}else{let h=t.map[o];h===void 0&&(h=new H_(o),pc(t,h)),t=h}}}class Ts{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);G_(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 mc(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const W_=37297;let X_=0;function q_(i,e){const t=i.split(`
|
|
3724
|
+
`}function Kg(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ha||l===Ga,u=l===Hi||l===Gi;if(c||u){let h=e.get(o);const f=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return t===null&&(t=new rc(i)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{const p=o.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new rc(i)),h=c?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function r(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==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 jg(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&&zi("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function $g(i,e,t,n){const r={},s=new WeakMap;function a(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const g in f.attributes)e.remove(f.attributes[g]);f.removeEventListener("dispose",a),delete r[f.id];const p=s.get(f);p&&(e.remove(p),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(h,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const p in f)e.update(f[p],i.ARRAY_BUFFER)}function c(h){const f=[],p=h.index,g=h.attributes.position;let _=0;if(p!==null){const E=p.array;_=p.version;for(let T=0,y=E.length;T<y;T+=3){const D=E[T+0],C=E[T+1],w=E[T+2];f.push(D,C,C,w,w,D)}}else if(g!==void 0){const E=g.array;_=g.version;for(let T=0,y=E.length/3-1;T<y;T+=3){const D=T+0,C=T+1,w=T+2;f.push(D,C,C,w,w,D)}}else return;const m=new(au(f)?uu:cu)(f,1);m.version=_;const d=s.get(h);d&&e.remove(d),s.set(h,m)}function u(h){const f=s.get(h);if(f){const p=h.index;p!==null&&f.version<p.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function Jg(i,e,t){let n;function r(f){n=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,p){i.drawElements(n,p,s,f*a),t.update(p,n,1)}function c(f,p,g){g!==0&&(i.drawElementsInstanced(n,p,s,f*a,g),t.update(p,n,g))}function u(f,p,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,f,0,g);let m=0;for(let d=0;d<g;d++)m+=p[d];t.update(m,n,1)}function h(f,p,g,_){if(g===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let d=0;d<f.length;d++)c(f[d]/a,p[d],_[d]);else{m.multiDrawElementsInstancedWEBGL(n,p,0,s,f,0,_,0,g);let d=0;for(let E=0;E<g;E++)d+=p[E]*_[E];t.update(d,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function Zg(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 Qg(i,e,t){const n=new WeakMap,r=new et;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0;let f=n.get(o);if(f===void 0||f.count!==h){let M=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",M)};f!==void 0&&f.texture.dispose();const p=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],d=o.morphAttributes.normal||[],E=o.morphAttributes.color||[];let T=0;p===!0&&(T=1),g===!0&&(T=2),_===!0&&(T=3);let y=o.attributes.position.count*T,D=1;y>e.maxTextureSize&&(D=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const C=new Float32Array(y*D*4*h),w=new ou(C,y,D,h);w.type=yn,w.needsUpdate=!0;const P=T*4;for(let x=0;x<h;x++){const b=m[x],O=d[x],F=E[x],k=y*D*4*x;for(let W=0;W<b.count;W++){const B=W*P;p===!0&&(r.fromBufferAttribute(b,W),C[k+B+0]=r.x,C[k+B+1]=r.y,C[k+B+2]=r.z,C[k+B+3]=0),g===!0&&(r.fromBufferAttribute(O,W),C[k+B+4]=r.x,C[k+B+5]=r.y,C[k+B+6]=r.z,C[k+B+7]=0),_===!0&&(r.fromBufferAttribute(F,W),C[k+B+8]=r.x,C[k+B+9]=r.y,C[k+B+10]=r.z,C[k+B+11]=F.itemSize===4?r.w:1)}}f={count:h,texture:w,size:new We(y,D)},n.set(o,f),o.addEventListener("dispose",M)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let p=0;for(let _=0;_<c.length;_++)p+=c[_];const g=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",f.size)}return{update:s}}function e_(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&&(e.update(h),r.set(h,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 f=l.skeleton;r.get(f)!==c&&(f.update(),r.set(f,c))}return h}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 Cu=new Ct,lc=new Mu(1,1),Du=new ou,Pu=new $f,Lu=new du,cc=[],uc=[],hc=new Float32Array(16),fc=new Float32Array(9),dc=new Float32Array(4);function Qi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=cc[r];if(s===void 0&&(s=new Float32Array(r),cc[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 yt(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 St(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Gs(i,e){let t=uc[e];t===void 0&&(t=new Int32Array(e),uc[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function t_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function n_(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(yt(t,e))return;i.uniform2fv(this.addr,e),St(t,e)}}function i_(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(yt(t,e))return;i.uniform3fv(this.addr,e),St(t,e)}}function r_(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(yt(t,e))return;i.uniform4fv(this.addr,e),St(t,e)}}function s_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),St(t,e)}else{if(yt(t,n))return;dc.set(n),i.uniformMatrix2fv(this.addr,!1,dc),St(t,n)}}function a_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),St(t,e)}else{if(yt(t,n))return;fc.set(n),i.uniformMatrix3fv(this.addr,!1,fc),St(t,n)}}function o_(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(yt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),St(t,e)}else{if(yt(t,n))return;hc.set(n),i.uniformMatrix4fv(this.addr,!1,hc),St(t,n)}}function l_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function c_(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(yt(t,e))return;i.uniform2iv(this.addr,e),St(t,e)}}function u_(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(yt(t,e))return;i.uniform3iv(this.addr,e),St(t,e)}}function h_(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(yt(t,e))return;i.uniform4iv(this.addr,e),St(t,e)}}function f_(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function d_(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(yt(t,e))return;i.uniform2uiv(this.addr,e),St(t,e)}}function p_(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(yt(t,e))return;i.uniform3uiv(this.addr,e),St(t,e)}}function m_(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(yt(t,e))return;i.uniform4uiv(this.addr,e),St(t,e)}}function g_(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?(lc.compareFunction=ru,s=lc):s=Cu,t.setTexture2D(e||s,r)}function __(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Pu,r)}function v_(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Lu,r)}function x_(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Du,r)}function y_(i){switch(i){case 5126:return t_;case 35664:return n_;case 35665:return i_;case 35666:return r_;case 35674:return s_;case 35675:return a_;case 35676:return o_;case 5124:case 35670:return l_;case 35667:case 35671:return c_;case 35668:case 35672:return u_;case 35669:case 35673:return h_;case 5125:return f_;case 36294:return d_;case 36295:return p_;case 36296:return m_;case 35678:case 36198:case 36298:case 36306:case 35682:return g_;case 35679:case 36299:case 36307:return __;case 35680:case 36300:case 36308:case 36293:return v_;case 36289:case 36303:case 36311:case 36292:return x_}}function S_(i,e){i.uniform1fv(this.addr,e)}function M_(i,e){const t=Qi(e,this.size,2);i.uniform2fv(this.addr,t)}function E_(i,e){const t=Qi(e,this.size,3);i.uniform3fv(this.addr,t)}function b_(i,e){const t=Qi(e,this.size,4);i.uniform4fv(this.addr,t)}function T_(i,e){const t=Qi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function A_(i,e){const t=Qi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function w_(i,e){const t=Qi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function R_(i,e){i.uniform1iv(this.addr,e)}function C_(i,e){i.uniform2iv(this.addr,e)}function D_(i,e){i.uniform3iv(this.addr,e)}function P_(i,e){i.uniform4iv(this.addr,e)}function L_(i,e){i.uniform1uiv(this.addr,e)}function U_(i,e){i.uniform2uiv(this.addr,e)}function I_(i,e){i.uniform3uiv(this.addr,e)}function N_(i,e){i.uniform4uiv(this.addr,e)}function F_(i,e,t){const n=this.cache,r=e.length,s=Gs(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),St(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Cu,s[a])}function O_(i,e,t){const n=this.cache,r=e.length,s=Gs(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),St(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Pu,s[a])}function B_(i,e,t){const n=this.cache,r=e.length,s=Gs(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),St(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Lu,s[a])}function z_(i,e,t){const n=this.cache,r=e.length,s=Gs(t,r);yt(n,s)||(i.uniform1iv(this.addr,s),St(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Du,s[a])}function k_(i){switch(i){case 5126:return S_;case 35664:return M_;case 35665:return E_;case 35666:return b_;case 35674:return T_;case 35675:return A_;case 35676:return w_;case 5124:case 35670:return R_;case 35667:case 35671:return C_;case 35668:case 35672:return D_;case 35669:case 35673:return P_;case 5125:return L_;case 36294:return U_;case 36295:return I_;case 36296:return N_;case 35678:case 36198:case 36298:case 36306:case 35682:return F_;case 35679:case 36299:case 36307:return O_;case 35680:case 36300:case 36308:case 36293:return B_;case 36289:case 36303:case 36311:case 36292:return z_}}class V_{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=y_(t.type)}}class H_{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=k_(t.type)}}class G_{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 Ra=/(\w+)(\])?(\[|\.)?/g;function pc(i,e){i.seq.push(e),i.map[e.id]=e}function W_(i,e,t){const n=i.name,r=n.length;for(Ra.lastIndex=0;;){const s=Ra.exec(n),a=Ra.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){pc(t,c===void 0?new V_(o,i,e):new H_(o,i,e));break}else{let h=t.map[o];h===void 0&&(h=new G_(o),pc(t,h)),t=h}}}class Ts{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);W_(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 mc(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const X_=37297;let q_=0;function Y_(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 gc=new qe;function
|
|
3726
|
+
`)}const gc=new qe;function K_(i){it._getMatrix(gc,it.workingColorSpace,i);const e=`mat3( ${gc.elements.map(t=>t.toFixed(4))} )`;switch(it.getTransfer(i)){case Ps:return[e,"LinearTransferOETF"];case ut:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function _c(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
|
-
`+
|
|
3731
|
-
`)}function
|
|
3732
|
-
`)}function
|
|
3733
|
-
`)}function
|
|
3734
|
-
`)}function
|
|
3730
|
+
`+Y_(i.getShaderSource(e),a)}else return r}function j_(i,e){const t=K_(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
|
3731
|
+
`)}function $_(i,e){let t;switch(e){case af:t="Linear";break;case of:t="Reinhard";break;case lf:t="Cineon";break;case Kc:t="ACESFilmic";break;case uf:t="AgX";break;case hf:t="Neutral";break;case cf:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const fs=new L;function J_(){it.getLuminanceCoefficients(fs);const i=fs.x.toFixed(4),e=fs.y.toFixed(4),t=fs.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
|
3732
|
+
`)}function Z_(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gr).join(`
|
|
3733
|
+
`)}function Q_(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
3734
|
+
`)}function ev(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 gr(i){return i!==""}function vc(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 xc(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const tv=/^[ \t]*#include +<([\w\d./]+)>/gm;function Eo(i){return i.replace(tv,iv)}const nv=new Map;function iv(i,e){let t=$e[e];if(t===void 0){const n=nv.get(e);if(n!==void 0)t=$e[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 Eo(t)}const rv=/#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 yc(i){return i.replace(rv,sv)}function sv(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 Sc(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,14 +3751,14 @@ 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
|
|
3754
|
+
#define LOW_PRECISION`),e}function av(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===qc?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Yc?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Pn&&(e="SHADOWMAP_TYPE_VSM"),e}function ov(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Hi:case Gi:e="ENVMAP_TYPE_CUBE";break;case Bs:e="ENVMAP_TYPE_CUBE_UV";break}return e}function lv(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Gi:e="ENVMAP_MODE_REFRACTION";break}return e}function cv(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Os:e="ENVMAP_BLENDING_MULTIPLY";break;case rf:e="ENVMAP_BLENDING_MIX";break;case sf:e="ENVMAP_BLENDING_ADD";break}return e}function uv(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 hv(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=av(t),c=ov(t),u=lv(t),h=cv(t),f=uv(t),p=Z_(t),g=Q_(s),_=r.createProgram();let m,d,E=t.glslVersion?"#version "+t.glslVersion+`
|
|
3755
3755
|
`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(gr).join(`
|
|
3756
3756
|
`),m.length>0&&(m+=`
|
|
3757
3757
|
`),d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(gr).join(`
|
|
3758
3758
|
`),d.length>0&&(d+=`
|
|
3759
3759
|
`)):(m=[Sc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+u:"",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
3760
|
`].filter(gr).join(`
|
|
3761
|
-
`),d=[Sc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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!==jn?"#define TONE_MAPPING":"",t.toneMapping!==jn?$e.tonemapping_pars_fragment:"",t.toneMapping!==jn
|
|
3761
|
+
`),d=[Sc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,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 "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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!==jn?"#define TONE_MAPPING":"",t.toneMapping!==jn?$e.tonemapping_pars_fragment:"",t.toneMapping!==jn?$_("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",$e.colorspace_pars_fragment,j_("linearToOutputTexel",t.outputColorSpace),J_(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
3762
3762
|
`].filter(gr).join(`
|
|
3763
3763
|
`)),a=Eo(a),a=vc(a,t),a=xc(a,t),o=Eo(o),o=vc(o,t),o=xc(o,t),a=yc(a),o=yc(o),t.isRawShaderMaterial!==!0&&(E=`#version 300 es
|
|
3764
3764
|
`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
@@ -3772,9 +3772,9 @@ Material Type: `+b.type+`
|
|
|
3772
3772
|
|
|
3773
3773
|
Program Info Log: `+O+`
|
|
3774
3774
|
`+J+`
|
|
3775
|
-
`+V)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(F===""||k==="")&&(B=!1);B&&(b.diagnostics={runnable:W,programLog:O,vertexShader:{log:F,prefix:m},fragmentShader:{log:k,prefix:d}})}r.deleteShader(D),r.deleteShader(C),P=new Ts(r,_),M=Q_(r,_)}let P;this.getUniforms=function(){return P===void 0&&w(this),P};let M;this.getAttributes=function(){return M===void 0&&w(this),M};let x=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(_,W_)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=X_++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=D,this.fragmentShader=C,this}let hv=0;class fv{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 dv(e),t.set(e,n)),n}}class dv{constructor(e){this.id=hv++,this.code=e,this.usedTimes=0}}function pv(i,e,t,n,r,s,a){const o=new Vo,l=new fv,c=new Set,u=[],h=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.precision;const g={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 _(M){return c.add(M),M===0?"uv":`uv${M}`}function m(M,x,b,O,F){const k=O.fog,W=F.geometry,B=M.isMeshStandardMaterial?O.environment:null,J=(M.isMeshStandardMaterial?t:e).get(M.envMap||B),V=J&&J.mapping===Bs?J.image.height:null,le=g[M.type];M.precision!==null&&(p=r.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const ge=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,se=ge!==void 0?ge.length:0;let ke=0;W.morphAttributes.position!==void 0&&(ke=1),W.morphAttributes.normal!==void 0&&(ke=2),W.morphAttributes.color!==void 0&&(ke=3);let je,$,ue,Le;if(le){const Xe=Wt[le];je=Xe.vertexShader,$=Xe.fragmentShader}else je=M.vertexShader,$=M.fragmentShader,l.update(M),ue=l.getVertexShaderID(M),Le=l.getFragmentShaderID(M);const ye=i.getRenderTarget(),Ue=i.state.buffers.depth.getReversed(),tt=F.isInstancedMesh===!0,ze=F.isBatchedMesh===!0,ft=!!M.map,K=!!M.matcap,re=!!J,A=!!M.aoMap,De=!!M.lightMap,ce=!!M.bumpMap,de=!!M.normalMap,X=!!M.displacementMap,be=!!M.emissiveMap,Se=!!M.metalnessMap,pe=!!M.roughnessMap,Qe=M.anisotropy>0,R=M.clearcoat>0,v=M.dispersion>0,z=M.iridescence>0,j=M.sheen>0,Q=M.transmission>0,q=Qe&&!!M.anisotropyMap,Re=R&&!!M.clearcoatMap,oe=R&&!!M.clearcoatNormalMap,Me=R&&!!M.clearcoatRoughnessMap,Pe=z&&!!M.iridescenceMap,ee=z&&!!M.iridescenceThicknessMap,Ee=j&&!!M.sheenColorMap,Fe=j&&!!M.sheenRoughnessMap,Ne=!!M.specularMap,fe=!!M.specularColorMap,Ve=!!M.specularIntensityMap,U=Q&&!!M.transmissionMap,_e=Q&&!!M.thicknessMap,te=!!M.gradientMap,Te=!!M.alphaMap,ie=M.alphaTest>0,Z=!!M.alphaHash,we=!!M.extensions;let ne=jn;M.toneMapped&&(ye===null||ye.isXRRenderTarget===!0)&&(ne=i.toneMapping);const Je={shaderID:le,shaderType:M.type,shaderName:M.name,vertexShader:je,fragmentShader:$,defines:M.defines,customVertexShaderID:ue,customFragmentShaderID:Le,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:ze,batchingColor:ze&&F._colorsTexture!==null,instancing:tt,instancingColor:tt&&F.instanceColor!==null,instancingMorph:tt&&F.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:ye===null?i.outputColorSpace:ye.isXRRenderTarget===!0?ye.texture.colorSpace:Xi,alphaToCoverage:!!M.alphaToCoverage,map:ft,matcap:K,envMap:re,envMapMode:re&&J.mapping,envMapCubeUVHeight:V,aoMap:A,lightMap:De,bumpMap:ce,normalMap:de,displacementMap:f&&X,emissiveMap:be,normalMapObjectSpace:de&&M.normalMapType===_f,normalMapTangentSpace:de&&M.normalMapType===Bo,metalnessMap:Se,roughnessMap:pe,anisotropy:Qe,anisotropyMap:q,clearcoat:R,clearcoatMap:Re,clearcoatNormalMap:oe,clearcoatRoughnessMap:Me,dispersion:v,iridescence:z,iridescenceMap:Pe,iridescenceThicknessMap:ee,sheen:j,sheenColorMap:Ee,sheenRoughnessMap:Fe,specularMap:Ne,specularColorMap:fe,specularIntensityMap:Ve,transmission:Q,transmissionMap:U,thicknessMap:_e,gradientMap:te,opaque:M.transparent===!1&&M.blending===Bi&&M.alphaToCoverage===!1,alphaMap:Te,alphaTest:ie,alphaHash:Z,combine:M.combine,mapUv:ft&&_(M.map.channel),aoMapUv:A&&_(M.aoMap.channel),lightMapUv:De&&_(M.lightMap.channel),bumpMapUv:ce&&_(M.bumpMap.channel),normalMapUv:de&&_(M.normalMap.channel),displacementMapUv:X&&_(M.displacementMap.channel),emissiveMapUv:be&&_(M.emissiveMap.channel),metalnessMapUv:Se&&_(M.metalnessMap.channel),roughnessMapUv:pe&&_(M.roughnessMap.channel),anisotropyMapUv:q&&_(M.anisotropyMap.channel),clearcoatMapUv:Re&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:oe&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Me&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Pe&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:ee&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:Ee&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:Fe&&_(M.sheenRoughnessMap.channel),specularMapUv:Ne&&_(M.specularMap.channel),specularColorMapUv:fe&&_(M.specularColorMap.channel),specularIntensityMapUv:Ve&&_(M.specularIntensityMap.channel),transmissionMapUv:U&&_(M.transmissionMap.channel),thicknessMapUv:_e&&_(M.thicknessMap.channel),alphaMapUv:Te&&_(M.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(de||Qe),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!W.attributes.uv&&(ft||Te),fog:!!k,useFog:M.fog===!0,fogExp2:!!k&&k.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:Ue,skinning:F.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:ke,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:M.dithering,shadowMapEnabled:i.shadowMap.enabled&&b.length>0,shadowMapType:i.shadowMap.type,toneMapping:ne,decodeVideoTexture:ft&&M.map.isVideoTexture===!0&&it.getTransfer(M.map.colorSpace)===ut,decodeVideoTextureEmissive:be&&M.emissiveMap.isVideoTexture===!0&&it.getTransfer(M.emissiveMap.colorSpace)===ut,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===_n,flipSided:M.side===kt,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:we&&M.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&M.extensions.multiDraw===!0||ze)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return Je.vertexUv1s=c.has(1),Je.vertexUv2s=c.has(2),Je.vertexUv3s=c.has(3),c.clear(),Je}function d(M){const x=[];if(M.shaderID?x.push(M.shaderID):(x.push(M.customVertexShaderID),x.push(M.customFragmentShaderID)),M.defines!==void 0)for(const b in M.defines)x.push(b),x.push(M.defines[b]);return M.isRawShaderMaterial===!1&&(E(x,M),T(x,M),x.push(i.outputColorSpace)),x.push(M.customProgramCacheKey),x.join()}function E(M,x){M.push(x.precision),M.push(x.outputColorSpace),M.push(x.envMapMode),M.push(x.envMapCubeUVHeight),M.push(x.mapUv),M.push(x.alphaMapUv),M.push(x.lightMapUv),M.push(x.aoMapUv),M.push(x.bumpMapUv),M.push(x.normalMapUv),M.push(x.displacementMapUv),M.push(x.emissiveMapUv),M.push(x.metalnessMapUv),M.push(x.roughnessMapUv),M.push(x.anisotropyMapUv),M.push(x.clearcoatMapUv),M.push(x.clearcoatNormalMapUv),M.push(x.clearcoatRoughnessMapUv),M.push(x.iridescenceMapUv),M.push(x.iridescenceThicknessMapUv),M.push(x.sheenColorMapUv),M.push(x.sheenRoughnessMapUv),M.push(x.specularMapUv),M.push(x.specularColorMapUv),M.push(x.specularIntensityMapUv),M.push(x.transmissionMapUv),M.push(x.thicknessMapUv),M.push(x.combine),M.push(x.fogExp2),M.push(x.sizeAttenuation),M.push(x.morphTargetsCount),M.push(x.morphAttributeCount),M.push(x.numDirLights),M.push(x.numPointLights),M.push(x.numSpotLights),M.push(x.numSpotLightMaps),M.push(x.numHemiLights),M.push(x.numRectAreaLights),M.push(x.numDirLightShadows),M.push(x.numPointLightShadows),M.push(x.numSpotLightShadows),M.push(x.numSpotLightShadowsWithMaps),M.push(x.numLightProbes),M.push(x.shadowMapType),M.push(x.toneMapping),M.push(x.numClippingPlanes),M.push(x.numClipIntersection),M.push(x.depthPacking)}function T(M,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),M.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),M.push(o.mask)}function y(M){const x=g[M.type];let b;if(x){const O=Wt[x];b=Ho.clone(O.uniforms)}else b=M.uniforms;return b}function D(M,x){let b;for(let O=0,F=u.length;O<F;O++){const k=u[O];if(k.cacheKey===x){b=k,++b.usedTimes;break}}return b===void 0&&(b=new uv(i,x,M,s),u.push(b)),b}function C(M){if(--M.usedTimes===0){const x=u.indexOf(M);u[x]=u[u.length-1],u.pop(),M.destroy()}}function w(M){l.remove(M)}function P(){l.dispose()}return{getParameters:m,getProgramCacheKey:d,getUniforms:y,acquireProgram:D,releaseProgram:C,releaseShaderCache:w,programs:u,dispose:P}}function mv(){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 gv(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 Mc(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 Ec(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(h,f,p,g,_,m){let d=i[e];return d===void 0?(d={id:h.id,object:h,geometry:f,material:p,groupOrder:g,renderOrder:h.renderOrder,z:_,group:m},i[e]=d):(d.id=h.id,d.object=h,d.geometry=f,d.material=p,d.groupOrder=g,d.renderOrder=h.renderOrder,d.z=_,d.group=m),e++,d}function o(h,f,p,g,_,m){const d=a(h,f,p,g,_,m);p.transmission>0?n.push(d):p.transparent===!0?r.push(d):t.push(d)}function l(h,f,p,g,_,m){const d=a(h,f,p,g,_,m);p.transmission>0?n.unshift(d):p.transparent===!0?r.unshift(d):t.unshift(d)}function c(h,f){t.length>1&&t.sort(h||gv),n.length>1&&n.sort(f||Mc),r.length>1&&r.sort(f||Mc)}function u(){for(let h=e,f=i.length;h<f;h++){const p=i[h];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:u,sort:c}}function _v(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Ec,i.set(n,[a])):r>=s.length?(a=new Ec,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function vv(){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 L,color:new Ye};break;case"SpotLight":t={position:new L,direction:new L,color:new Ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new Ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new Ye,groundColor:new Ye};break;case"RectAreaLight":t={color:new Ye,position:new L,halfWidth:new L,halfHeight:new L};break}return i[e.id]=t,t}}}function xv(){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 We};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let yv=0;function Sv(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Mv(i){const e=new vv,t=xv(),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 L);const r=new L,s=new Ke,a=new Ke;function o(c){let u=0,h=0,f=0;for(let M=0;M<9;M++)n.probe[M].set(0,0,0);let p=0,g=0,_=0,m=0,d=0,E=0,T=0,y=0,D=0,C=0,w=0;c.sort(Sv);for(let M=0,x=c.length;M<x;M++){const b=c[M],O=b.color,F=b.intensity,k=b.distance,W=b.shadow&&b.shadow.map?b.shadow.map.texture:null;if(b.isAmbientLight)u+=O.r*F,h+=O.g*F,f+=O.b*F;else if(b.isLightProbe){for(let B=0;B<9;B++)n.probe[B].addScaledVector(b.sh.coefficients[B],F);w++}else if(b.isDirectionalLight){const B=e.get(b);if(B.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){const J=b.shadow,V=t.get(b);V.shadowIntensity=J.intensity,V.shadowBias=J.bias,V.shadowNormalBias=J.normalBias,V.shadowRadius=J.radius,V.shadowMapSize=J.mapSize,n.directionalShadow[p]=V,n.directionalShadowMap[p]=W,n.directionalShadowMatrix[p]=b.shadow.matrix,E++}n.directional[p]=B,p++}else if(b.isSpotLight){const B=e.get(b);B.position.setFromMatrixPosition(b.matrixWorld),B.color.copy(O).multiplyScalar(F),B.distance=k,B.coneCos=Math.cos(b.angle),B.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),B.decay=b.decay,n.spot[_]=B;const J=b.shadow;if(b.map&&(n.spotLightMap[D]=b.map,D++,J.updateMatrices(b),b.castShadow&&C++),n.spotLightMatrix[_]=J.matrix,b.castShadow){const V=t.get(b);V.shadowIntensity=J.intensity,V.shadowBias=J.bias,V.shadowNormalBias=J.normalBias,V.shadowRadius=J.radius,V.shadowMapSize=J.mapSize,n.spotShadow[_]=V,n.spotShadowMap[_]=W,y++}_++}else if(b.isRectAreaLight){const B=e.get(b);B.color.copy(O).multiplyScalar(F),B.halfWidth.set(b.width*.5,0,0),B.halfHeight.set(0,b.height*.5,0),n.rectArea[m]=B,m++}else if(b.isPointLight){const B=e.get(b);if(B.color.copy(b.color).multiplyScalar(b.intensity),B.distance=b.distance,B.decay=b.decay,b.castShadow){const J=b.shadow,V=t.get(b);V.shadowIntensity=J.intensity,V.shadowBias=J.bias,V.shadowNormalBias=J.normalBias,V.shadowRadius=J.radius,V.shadowMapSize=J.mapSize,V.shadowCameraNear=J.camera.near,V.shadowCameraFar=J.camera.far,n.pointShadow[g]=V,n.pointShadowMap[g]=W,n.pointShadowMatrix[g]=b.shadow.matrix,T++}n.point[g]=B,g++}else if(b.isHemisphereLight){const B=e.get(b);B.skyColor.copy(b.color).multiplyScalar(F),B.groundColor.copy(b.groundColor).multiplyScalar(F),n.hemi[d]=B,d++}}m>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=he.LTC_FLOAT_1,n.rectAreaLTC2=he.LTC_FLOAT_2):(n.rectAreaLTC1=he.LTC_HALF_1,n.rectAreaLTC2=he.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=f;const P=n.hash;(P.directionalLength!==p||P.pointLength!==g||P.spotLength!==_||P.rectAreaLength!==m||P.hemiLength!==d||P.numDirectionalShadows!==E||P.numPointShadows!==T||P.numSpotShadows!==y||P.numSpotMaps!==D||P.numLightProbes!==w)&&(n.directional.length=p,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=d,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=E,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=y+D-C,n.spotLightMap.length=D,n.numSpotLightShadowsWithMaps=C,n.numLightProbes=w,P.directionalLength=p,P.pointLength=g,P.spotLength=_,P.rectAreaLength=m,P.hemiLength=d,P.numDirectionalShadows=E,P.numPointShadows=T,P.numSpotShadows=y,P.numSpotMaps=D,P.numLightProbes=w,n.version=yv++)}function l(c,u){let h=0,f=0,p=0,g=0,_=0;const m=u.matrixWorldInverse;for(let d=0,E=c.length;d<E;d++){const T=c[d];if(T.isDirectionalLight){const y=n.directional[h];y.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(m),h++}else if(T.isSpotLight){const y=n.spot[p];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),y.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(m),p++}else if(T.isRectAreaLight){const y=n.rectArea[g];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),a.identity(),s.copy(T.matrixWorld),s.premultiply(m),a.extractRotation(s),y.halfWidth.set(T.width*.5,0,0),y.halfHeight.set(0,T.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),g++}else if(T.isPointLight){const y=n.point[f];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),f++}else if(T.isHemisphereLight){const y=n.hemi[_];y.direction.setFromMatrixPosition(T.matrixWorld),y.direction.transformDirection(m),_++}}}return{setup:o,setupView:l,state:n}}function bc(i){const e=new Mv(i),t=[],n=[];function r(u){c.camera=u,t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(){e.setup(t)}function l(u){e.setupView(t,u)}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 Ev(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new bc(i),e.set(r,[o])):s>=a.length?(o=new bc(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const bv=`void main() {
|
|
3775
|
+
`+V)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(F===""||k==="")&&(B=!1);B&&(b.diagnostics={runnable:W,programLog:O,vertexShader:{log:F,prefix:m},fragmentShader:{log:k,prefix:d}})}r.deleteShader(D),r.deleteShader(C),P=new Ts(r,_),M=ev(r,_)}let P;this.getUniforms=function(){return P===void 0&&w(this),P};let M;this.getAttributes=function(){return M===void 0&&w(this),M};let x=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(_,X_)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=q_++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=D,this.fragmentShader=C,this}let fv=0;class dv{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 pv(e),t.set(e,n)),n}}class pv{constructor(e){this.id=fv++,this.code=e,this.usedTimes=0}}function mv(i,e,t,n,r,s,a){const o=new Vo,l=new dv,c=new Set,u=[],h=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.precision;const g={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 _(M){return c.add(M),M===0?"uv":`uv${M}`}function m(M,x,b,O,F){const k=O.fog,W=F.geometry,B=M.isMeshStandardMaterial?O.environment:null,J=(M.isMeshStandardMaterial?t:e).get(M.envMap||B),V=J&&J.mapping===Bs?J.image.height:null,le=g[M.type];M.precision!==null&&(p=r.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const ge=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,se=ge!==void 0?ge.length:0;let ke=0;W.morphAttributes.position!==void 0&&(ke=1),W.morphAttributes.normal!==void 0&&(ke=2),W.morphAttributes.color!==void 0&&(ke=3);let je,$,ue,Le;if(le){const Xe=Wt[le];je=Xe.vertexShader,$=Xe.fragmentShader}else je=M.vertexShader,$=M.fragmentShader,l.update(M),ue=l.getVertexShaderID(M),Le=l.getFragmentShaderID(M);const ye=i.getRenderTarget(),Ue=i.state.buffers.depth.getReversed(),tt=F.isInstancedMesh===!0,ze=F.isBatchedMesh===!0,ft=!!M.map,K=!!M.matcap,re=!!J,A=!!M.aoMap,De=!!M.lightMap,ce=!!M.bumpMap,de=!!M.normalMap,X=!!M.displacementMap,be=!!M.emissiveMap,Se=!!M.metalnessMap,pe=!!M.roughnessMap,Qe=M.anisotropy>0,R=M.clearcoat>0,v=M.dispersion>0,z=M.iridescence>0,j=M.sheen>0,Q=M.transmission>0,q=Qe&&!!M.anisotropyMap,Re=R&&!!M.clearcoatMap,oe=R&&!!M.clearcoatNormalMap,Me=R&&!!M.clearcoatRoughnessMap,Pe=z&&!!M.iridescenceMap,ee=z&&!!M.iridescenceThicknessMap,Ee=j&&!!M.sheenColorMap,Fe=j&&!!M.sheenRoughnessMap,Ne=!!M.specularMap,fe=!!M.specularColorMap,Ve=!!M.specularIntensityMap,U=Q&&!!M.transmissionMap,_e=Q&&!!M.thicknessMap,te=!!M.gradientMap,Te=!!M.alphaMap,ie=M.alphaTest>0,Z=!!M.alphaHash,we=!!M.extensions;let ne=jn;M.toneMapped&&(ye===null||ye.isXRRenderTarget===!0)&&(ne=i.toneMapping);const Je={shaderID:le,shaderType:M.type,shaderName:M.name,vertexShader:je,fragmentShader:$,defines:M.defines,customVertexShaderID:ue,customFragmentShaderID:Le,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:ze,batchingColor:ze&&F._colorsTexture!==null,instancing:tt,instancingColor:tt&&F.instanceColor!==null,instancingMorph:tt&&F.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:ye===null?i.outputColorSpace:ye.isXRRenderTarget===!0?ye.texture.colorSpace:Xi,alphaToCoverage:!!M.alphaToCoverage,map:ft,matcap:K,envMap:re,envMapMode:re&&J.mapping,envMapCubeUVHeight:V,aoMap:A,lightMap:De,bumpMap:ce,normalMap:de,displacementMap:f&&X,emissiveMap:be,normalMapObjectSpace:de&&M.normalMapType===_f,normalMapTangentSpace:de&&M.normalMapType===Bo,metalnessMap:Se,roughnessMap:pe,anisotropy:Qe,anisotropyMap:q,clearcoat:R,clearcoatMap:Re,clearcoatNormalMap:oe,clearcoatRoughnessMap:Me,dispersion:v,iridescence:z,iridescenceMap:Pe,iridescenceThicknessMap:ee,sheen:j,sheenColorMap:Ee,sheenRoughnessMap:Fe,specularMap:Ne,specularColorMap:fe,specularIntensityMap:Ve,transmission:Q,transmissionMap:U,thicknessMap:_e,gradientMap:te,opaque:M.transparent===!1&&M.blending===Bi&&M.alphaToCoverage===!1,alphaMap:Te,alphaTest:ie,alphaHash:Z,combine:M.combine,mapUv:ft&&_(M.map.channel),aoMapUv:A&&_(M.aoMap.channel),lightMapUv:De&&_(M.lightMap.channel),bumpMapUv:ce&&_(M.bumpMap.channel),normalMapUv:de&&_(M.normalMap.channel),displacementMapUv:X&&_(M.displacementMap.channel),emissiveMapUv:be&&_(M.emissiveMap.channel),metalnessMapUv:Se&&_(M.metalnessMap.channel),roughnessMapUv:pe&&_(M.roughnessMap.channel),anisotropyMapUv:q&&_(M.anisotropyMap.channel),clearcoatMapUv:Re&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:oe&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Me&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Pe&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:ee&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:Ee&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:Fe&&_(M.sheenRoughnessMap.channel),specularMapUv:Ne&&_(M.specularMap.channel),specularColorMapUv:fe&&_(M.specularColorMap.channel),specularIntensityMapUv:Ve&&_(M.specularIntensityMap.channel),transmissionMapUv:U&&_(M.transmissionMap.channel),thicknessMapUv:_e&&_(M.thicknessMap.channel),alphaMapUv:Te&&_(M.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(de||Qe),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!W.attributes.uv&&(ft||Te),fog:!!k,useFog:M.fog===!0,fogExp2:!!k&&k.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:Ue,skinning:F.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:ke,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:M.dithering,shadowMapEnabled:i.shadowMap.enabled&&b.length>0,shadowMapType:i.shadowMap.type,toneMapping:ne,decodeVideoTexture:ft&&M.map.isVideoTexture===!0&&it.getTransfer(M.map.colorSpace)===ut,decodeVideoTextureEmissive:be&&M.emissiveMap.isVideoTexture===!0&&it.getTransfer(M.emissiveMap.colorSpace)===ut,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===_n,flipSided:M.side===kt,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:we&&M.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&M.extensions.multiDraw===!0||ze)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return Je.vertexUv1s=c.has(1),Je.vertexUv2s=c.has(2),Je.vertexUv3s=c.has(3),c.clear(),Je}function d(M){const x=[];if(M.shaderID?x.push(M.shaderID):(x.push(M.customVertexShaderID),x.push(M.customFragmentShaderID)),M.defines!==void 0)for(const b in M.defines)x.push(b),x.push(M.defines[b]);return M.isRawShaderMaterial===!1&&(E(x,M),T(x,M),x.push(i.outputColorSpace)),x.push(M.customProgramCacheKey),x.join()}function E(M,x){M.push(x.precision),M.push(x.outputColorSpace),M.push(x.envMapMode),M.push(x.envMapCubeUVHeight),M.push(x.mapUv),M.push(x.alphaMapUv),M.push(x.lightMapUv),M.push(x.aoMapUv),M.push(x.bumpMapUv),M.push(x.normalMapUv),M.push(x.displacementMapUv),M.push(x.emissiveMapUv),M.push(x.metalnessMapUv),M.push(x.roughnessMapUv),M.push(x.anisotropyMapUv),M.push(x.clearcoatMapUv),M.push(x.clearcoatNormalMapUv),M.push(x.clearcoatRoughnessMapUv),M.push(x.iridescenceMapUv),M.push(x.iridescenceThicknessMapUv),M.push(x.sheenColorMapUv),M.push(x.sheenRoughnessMapUv),M.push(x.specularMapUv),M.push(x.specularColorMapUv),M.push(x.specularIntensityMapUv),M.push(x.transmissionMapUv),M.push(x.thicknessMapUv),M.push(x.combine),M.push(x.fogExp2),M.push(x.sizeAttenuation),M.push(x.morphTargetsCount),M.push(x.morphAttributeCount),M.push(x.numDirLights),M.push(x.numPointLights),M.push(x.numSpotLights),M.push(x.numSpotLightMaps),M.push(x.numHemiLights),M.push(x.numRectAreaLights),M.push(x.numDirLightShadows),M.push(x.numPointLightShadows),M.push(x.numSpotLightShadows),M.push(x.numSpotLightShadowsWithMaps),M.push(x.numLightProbes),M.push(x.shadowMapType),M.push(x.toneMapping),M.push(x.numClippingPlanes),M.push(x.numClipIntersection),M.push(x.depthPacking)}function T(M,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),M.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),M.push(o.mask)}function y(M){const x=g[M.type];let b;if(x){const O=Wt[x];b=Ho.clone(O.uniforms)}else b=M.uniforms;return b}function D(M,x){let b;for(let O=0,F=u.length;O<F;O++){const k=u[O];if(k.cacheKey===x){b=k,++b.usedTimes;break}}return b===void 0&&(b=new hv(i,x,M,s),u.push(b)),b}function C(M){if(--M.usedTimes===0){const x=u.indexOf(M);u[x]=u[u.length-1],u.pop(),M.destroy()}}function w(M){l.remove(M)}function P(){l.dispose()}return{getParameters:m,getProgramCacheKey:d,getUniforms:y,acquireProgram:D,releaseProgram:C,releaseShaderCache:w,programs:u,dispose:P}}function gv(){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 _v(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 Mc(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 Ec(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(h,f,p,g,_,m){let d=i[e];return d===void 0?(d={id:h.id,object:h,geometry:f,material:p,groupOrder:g,renderOrder:h.renderOrder,z:_,group:m},i[e]=d):(d.id=h.id,d.object=h,d.geometry=f,d.material=p,d.groupOrder=g,d.renderOrder=h.renderOrder,d.z=_,d.group=m),e++,d}function o(h,f,p,g,_,m){const d=a(h,f,p,g,_,m);p.transmission>0?n.push(d):p.transparent===!0?r.push(d):t.push(d)}function l(h,f,p,g,_,m){const d=a(h,f,p,g,_,m);p.transmission>0?n.unshift(d):p.transparent===!0?r.unshift(d):t.unshift(d)}function c(h,f){t.length>1&&t.sort(h||_v),n.length>1&&n.sort(f||Mc),r.length>1&&r.sort(f||Mc)}function u(){for(let h=e,f=i.length;h<f;h++){const p=i[h];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:u,sort:c}}function vv(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Ec,i.set(n,[a])):r>=s.length?(a=new Ec,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function xv(){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 L,color:new Ye};break;case"SpotLight":t={position:new L,direction:new L,color:new Ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new Ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new Ye,groundColor:new Ye};break;case"RectAreaLight":t={color:new Ye,position:new L,halfWidth:new L,halfHeight:new L};break}return i[e.id]=t,t}}}function yv(){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 We};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Sv=0;function Mv(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Ev(i){const e=new xv,t=yv(),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 L);const r=new L,s=new Ke,a=new Ke;function o(c){let u=0,h=0,f=0;for(let M=0;M<9;M++)n.probe[M].set(0,0,0);let p=0,g=0,_=0,m=0,d=0,E=0,T=0,y=0,D=0,C=0,w=0;c.sort(Mv);for(let M=0,x=c.length;M<x;M++){const b=c[M],O=b.color,F=b.intensity,k=b.distance,W=b.shadow&&b.shadow.map?b.shadow.map.texture:null;if(b.isAmbientLight)u+=O.r*F,h+=O.g*F,f+=O.b*F;else if(b.isLightProbe){for(let B=0;B<9;B++)n.probe[B].addScaledVector(b.sh.coefficients[B],F);w++}else if(b.isDirectionalLight){const B=e.get(b);if(B.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){const J=b.shadow,V=t.get(b);V.shadowIntensity=J.intensity,V.shadowBias=J.bias,V.shadowNormalBias=J.normalBias,V.shadowRadius=J.radius,V.shadowMapSize=J.mapSize,n.directionalShadow[p]=V,n.directionalShadowMap[p]=W,n.directionalShadowMatrix[p]=b.shadow.matrix,E++}n.directional[p]=B,p++}else if(b.isSpotLight){const B=e.get(b);B.position.setFromMatrixPosition(b.matrixWorld),B.color.copy(O).multiplyScalar(F),B.distance=k,B.coneCos=Math.cos(b.angle),B.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),B.decay=b.decay,n.spot[_]=B;const J=b.shadow;if(b.map&&(n.spotLightMap[D]=b.map,D++,J.updateMatrices(b),b.castShadow&&C++),n.spotLightMatrix[_]=J.matrix,b.castShadow){const V=t.get(b);V.shadowIntensity=J.intensity,V.shadowBias=J.bias,V.shadowNormalBias=J.normalBias,V.shadowRadius=J.radius,V.shadowMapSize=J.mapSize,n.spotShadow[_]=V,n.spotShadowMap[_]=W,y++}_++}else if(b.isRectAreaLight){const B=e.get(b);B.color.copy(O).multiplyScalar(F),B.halfWidth.set(b.width*.5,0,0),B.halfHeight.set(0,b.height*.5,0),n.rectArea[m]=B,m++}else if(b.isPointLight){const B=e.get(b);if(B.color.copy(b.color).multiplyScalar(b.intensity),B.distance=b.distance,B.decay=b.decay,b.castShadow){const J=b.shadow,V=t.get(b);V.shadowIntensity=J.intensity,V.shadowBias=J.bias,V.shadowNormalBias=J.normalBias,V.shadowRadius=J.radius,V.shadowMapSize=J.mapSize,V.shadowCameraNear=J.camera.near,V.shadowCameraFar=J.camera.far,n.pointShadow[g]=V,n.pointShadowMap[g]=W,n.pointShadowMatrix[g]=b.shadow.matrix,T++}n.point[g]=B,g++}else if(b.isHemisphereLight){const B=e.get(b);B.skyColor.copy(b.color).multiplyScalar(F),B.groundColor.copy(b.groundColor).multiplyScalar(F),n.hemi[d]=B,d++}}m>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=he.LTC_FLOAT_1,n.rectAreaLTC2=he.LTC_FLOAT_2):(n.rectAreaLTC1=he.LTC_HALF_1,n.rectAreaLTC2=he.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=f;const P=n.hash;(P.directionalLength!==p||P.pointLength!==g||P.spotLength!==_||P.rectAreaLength!==m||P.hemiLength!==d||P.numDirectionalShadows!==E||P.numPointShadows!==T||P.numSpotShadows!==y||P.numSpotMaps!==D||P.numLightProbes!==w)&&(n.directional.length=p,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=d,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.pointShadow.length=T,n.pointShadowMap.length=T,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=E,n.pointShadowMatrix.length=T,n.spotLightMatrix.length=y+D-C,n.spotLightMap.length=D,n.numSpotLightShadowsWithMaps=C,n.numLightProbes=w,P.directionalLength=p,P.pointLength=g,P.spotLength=_,P.rectAreaLength=m,P.hemiLength=d,P.numDirectionalShadows=E,P.numPointShadows=T,P.numSpotShadows=y,P.numSpotMaps=D,P.numLightProbes=w,n.version=Sv++)}function l(c,u){let h=0,f=0,p=0,g=0,_=0;const m=u.matrixWorldInverse;for(let d=0,E=c.length;d<E;d++){const T=c[d];if(T.isDirectionalLight){const y=n.directional[h];y.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(m),h++}else if(T.isSpotLight){const y=n.spot[p];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),y.direction.setFromMatrixPosition(T.matrixWorld),r.setFromMatrixPosition(T.target.matrixWorld),y.direction.sub(r),y.direction.transformDirection(m),p++}else if(T.isRectAreaLight){const y=n.rectArea[g];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),a.identity(),s.copy(T.matrixWorld),s.premultiply(m),a.extractRotation(s),y.halfWidth.set(T.width*.5,0,0),y.halfHeight.set(0,T.height*.5,0),y.halfWidth.applyMatrix4(a),y.halfHeight.applyMatrix4(a),g++}else if(T.isPointLight){const y=n.point[f];y.position.setFromMatrixPosition(T.matrixWorld),y.position.applyMatrix4(m),f++}else if(T.isHemisphereLight){const y=n.hemi[_];y.direction.setFromMatrixPosition(T.matrixWorld),y.direction.transformDirection(m),_++}}}return{setup:o,setupView:l,state:n}}function bc(i){const e=new Ev(i),t=[],n=[];function r(u){c.camera=u,t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(){e.setup(t)}function l(u){e.setupView(t,u)}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 bv(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new bc(i),e.set(r,[o])):s>=a.length?(o=new bc(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Tv=`void main() {
|
|
3776
3776
|
gl_Position = vec4( position, 1.0 );
|
|
3777
|
-
}`,
|
|
3777
|
+
}`,Av=`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 Av(i,e,t){let n=new Xo;const r=new We,s=new We,a=new et,o=new Td({depthPacking:gf}),l=new Ad,c={},u=t.maxTextureSize,h={[Fn]:kt,[kt]:Fn,[_n]:_n},f=new On({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new We},radius:{value:4}},vertexShader:bv,fragmentShader:Tv}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const g=new Dt;g.setAttribute("position",new Nt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Rt(g,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=qc;let d=this.type;this.render=function(C,w,P){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||C.length===0)return;const M=i.getRenderTarget(),x=i.getActiveCubeFace(),b=i.getActiveMipmapLevel(),O=i.state;O.setBlending(Kn),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const F=d!==Pn&&this.type===Pn,k=d===Pn&&this.type!==Pn;for(let W=0,B=C.length;W<B;W++){const J=C[W],V=J.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;r.copy(V.mapSize);const le=V.getFrameExtents();if(r.multiply(le),s.copy(V.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/le.x),r.x=s.x*le.x,V.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/le.y),r.y=s.y*le.y,V.mapSize.y=s.y)),V.map===null||F===!0||k===!0){const se=this.type!==Pn?{minFilter:$t,magFilter:$t}:{};V.map!==null&&V.map.dispose(),V.map=new pi(r.x,r.y,se),V.map.texture.name=J.name+".shadowMap",V.camera.updateProjectionMatrix()}i.setRenderTarget(V.map),i.clear();const ge=V.getViewportCount();for(let se=0;se<ge;se++){const ke=V.getViewport(se);a.set(s.x*ke.x,s.y*ke.y,s.x*ke.z,s.y*ke.w),O.viewport(a),V.updateMatrices(J,se),n=V.getFrustum(),y(w,P,V.camera,J,this.type)}V.isPointLightShadow!==!0&&this.type===Pn&&E(V,P),V.needsUpdate=!1}d=this.type,m.needsUpdate=!1,i.setRenderTarget(M,x,b)};function E(C,w){const P=e.update(_);f.defines.VSM_SAMPLES!==C.blurSamples&&(f.defines.VSM_SAMPLES=C.blurSamples,p.defines.VSM_SAMPLES=C.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new pi(r.x,r.y)),f.uniforms.shadow_pass.value=C.map.texture,f.uniforms.resolution.value=C.mapSize,f.uniforms.radius.value=C.radius,i.setRenderTarget(C.mapPass),i.clear(),i.renderBufferDirect(w,null,P,f,_,null),p.uniforms.shadow_pass.value=C.mapPass.texture,p.uniforms.resolution.value=C.mapSize,p.uniforms.radius.value=C.radius,i.setRenderTarget(C.map),i.clear(),i.renderBufferDirect(w,null,P,p,_,null)}function T(C,w,P,M){let x=null;const b=P.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(b!==void 0)x=b;else if(x=P.isPointLight===!0?l:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0||w.alphaToCoverage===!0){const O=x.uuid,F=w.uuid;let k=c[O];k===void 0&&(k={},c[O]=k);let W=k[F];W===void 0&&(W=x.clone(),k[F]=W,w.addEventListener("dispose",D)),x=W}if(x.visible=w.visible,x.wireframe=w.wireframe,M===Pn?x.side=w.shadowSide!==null?w.shadowSide:w.side:x.side=w.shadowSide!==null?w.shadowSide:h[w.side],x.alphaMap=w.alphaMap,x.alphaTest=w.alphaToCoverage===!0?.5:w.alphaTest,x.map=w.map,x.clipShadows=w.clipShadows,x.clippingPlanes=w.clippingPlanes,x.clipIntersection=w.clipIntersection,x.displacementMap=w.displacementMap,x.displacementScale=w.displacementScale,x.displacementBias=w.displacementBias,x.wireframeLinewidth=w.wireframeLinewidth,x.linewidth=w.linewidth,P.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const O=i.properties.get(x);O.light=P}return x}function y(C,w,P,M,x){if(C.visible===!1)return;if(C.layers.test(w.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&x===Pn)&&(!C.frustumCulled||n.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,C.matrixWorld);const F=e.update(C),k=C.material;if(Array.isArray(k)){const W=F.groups;for(let B=0,J=W.length;B<J;B++){const V=W[B],le=k[V.materialIndex];if(le&&le.visible){const ge=T(C,le,M,x);C.onBeforeShadow(i,C,w,P,F,ge,V),i.renderBufferDirect(P,null,F,ge,C,V),C.onAfterShadow(i,C,w,P,F,ge,V)}}}else if(k.visible){const W=T(C,k,M,x);C.onBeforeShadow(i,C,w,P,F,W,null),i.renderBufferDirect(P,null,F,W,C,null),C.onAfterShadow(i,C,w,P,F,W,null)}}const O=C.children;for(let F=0,k=O.length;F<k;F++)y(O[F],w,P,M,x)}function D(C){C.target.removeEventListener("dispose",D);for(const P in c){const M=c[P],x=C.target.uuid;x in M&&(M[x].dispose(),delete M[x])}}}const wv={[Na]:Fa,[Oa]:ka,[Ba]:Va,[Vi]:za,[Fa]:Na,[ka]:Oa,[Va]:Ba,[za]:Vi};function Rv(i,e){function t(){let U=!1;const _e=new et;let te=null;const Te=new et(0,0,0,0);return{setMask:function(ie){te!==ie&&!U&&(i.colorMask(ie,ie,ie,ie),te=ie)},setLocked:function(ie){U=ie},setClear:function(ie,Z,we,ne,Je){Je===!0&&(ie*=ne,Z*=ne,we*=ne),_e.set(ie,Z,we,ne),Te.equals(_e)===!1&&(i.clearColor(ie,Z,we,ne),Te.copy(_e))},reset:function(){U=!1,te=null,Te.set(-1,0,0,0)}}}function n(){let U=!1,_e=!1,te=null,Te=null,ie=null;return{setReversed:function(Z){if(_e!==Z){const we=e.get("EXT_clip_control");Z?we.clipControlEXT(we.LOWER_LEFT_EXT,we.ZERO_TO_ONE_EXT):we.clipControlEXT(we.LOWER_LEFT_EXT,we.NEGATIVE_ONE_TO_ONE_EXT),_e=Z;const ne=ie;ie=null,this.setClear(ne)}},getReversed:function(){return _e},setTest:function(Z){Z?ye(i.DEPTH_TEST):Ue(i.DEPTH_TEST)},setMask:function(Z){te!==Z&&!U&&(i.depthMask(Z),te=Z)},setFunc:function(Z){if(_e&&(Z=wv[Z]),Te!==Z){switch(Z){case Na:i.depthFunc(i.NEVER);break;case Fa:i.depthFunc(i.ALWAYS);break;case Oa:i.depthFunc(i.LESS);break;case Vi:i.depthFunc(i.LEQUAL);break;case Ba:i.depthFunc(i.EQUAL);break;case za:i.depthFunc(i.GEQUAL);break;case ka:i.depthFunc(i.GREATER);break;case Va:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Te=Z}},setLocked:function(Z){U=Z},setClear:function(Z){ie!==Z&&(_e&&(Z=1-Z),i.clearDepth(Z),ie=Z)},reset:function(){U=!1,te=null,Te=null,ie=null,_e=!1}}}function r(){let U=!1,_e=null,te=null,Te=null,ie=null,Z=null,we=null,ne=null,Je=null;return{setTest:function(Xe){U||(Xe?ye(i.STENCIL_TEST):Ue(i.STENCIL_TEST))},setMask:function(Xe){_e!==Xe&&!U&&(i.stencilMask(Xe),_e=Xe)},setFunc:function(Xe,_t,sn){(te!==Xe||Te!==_t||ie!==sn)&&(i.stencilFunc(Xe,_t,sn),te=Xe,Te=_t,ie=sn)},setOp:function(Xe,_t,sn){(Z!==Xe||we!==_t||ne!==sn)&&(i.stencilOp(Xe,_t,sn),Z=Xe,we=_t,ne=sn)},setLocked:function(Xe){U=Xe},setClear:function(Xe){Je!==Xe&&(i.clearStencil(Xe),Je=Xe)},reset:function(){U=!1,_e=null,te=null,Te=null,ie=null,Z=null,we=null,ne=null,Je=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let u={},h={},f=new WeakMap,p=[],g=null,_=!1,m=null,d=null,E=null,T=null,y=null,D=null,C=null,w=new Ye(0,0,0),P=0,M=!1,x=null,b=null,O=null,F=null,k=null;const W=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let B=!1,J=0;const V=i.getParameter(i.VERSION);V.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(V)[1]),B=J>=1):V.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),B=J>=2);let le=null,ge={};const se=i.getParameter(i.SCISSOR_BOX),ke=i.getParameter(i.VIEWPORT),je=new et().fromArray(se),$=new et().fromArray(ke);function ue(U,_e,te,Te){const ie=new Uint8Array(4),Z=i.createTexture();i.bindTexture(U,Z),i.texParameteri(U,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(U,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let we=0;we<te;we++)U===i.TEXTURE_3D||U===i.TEXTURE_2D_ARRAY?i.texImage3D(_e,0,i.RGBA,1,1,Te,0,i.RGBA,i.UNSIGNED_BYTE,ie):i.texImage2D(_e+we,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,ie);return Z}const Le={};Le[i.TEXTURE_2D]=ue(i.TEXTURE_2D,i.TEXTURE_2D,1),Le[i.TEXTURE_CUBE_MAP]=ue(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Le[i.TEXTURE_2D_ARRAY]=ue(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Le[i.TEXTURE_3D]=ue(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ye(i.DEPTH_TEST),a.setFunc(Vi),ce(!1),de(il),ye(i.CULL_FACE),A(Kn);function ye(U){u[U]!==!0&&(i.enable(U),u[U]=!0)}function Ue(U){u[U]!==!1&&(i.disable(U),u[U]=!1)}function tt(U,_e){return h[U]!==_e?(i.bindFramebuffer(U,_e),h[U]=_e,U===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=_e),U===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=_e),!0):!1}function ze(U,_e){let te=p,Te=!1;if(U){te=f.get(_e),te===void 0&&(te=[],f.set(_e,te));const ie=U.textures;if(te.length!==ie.length||te[0]!==i.COLOR_ATTACHMENT0){for(let Z=0,we=ie.length;Z<we;Z++)te[Z]=i.COLOR_ATTACHMENT0+Z;te.length=ie.length,Te=!0}}else te[0]!==i.BACK&&(te[0]=i.BACK,Te=!0);Te&&i.drawBuffers(te)}function ft(U){return g!==U?(i.useProgram(U),g=U,!0):!1}const K={[ci]:i.FUNC_ADD,[kh]:i.FUNC_SUBTRACT,[Vh]:i.FUNC_REVERSE_SUBTRACT};K[Hh]=i.MIN,K[Gh]=i.MAX;const re={[Wh]:i.ZERO,[Xh]:i.ONE,[qh]:i.SRC_COLOR,[Ua]:i.SRC_ALPHA,[Zh]:i.SRC_ALPHA_SATURATE,[$h]:i.DST_COLOR,[Kh]:i.DST_ALPHA,[Yh]:i.ONE_MINUS_SRC_COLOR,[Ia]:i.ONE_MINUS_SRC_ALPHA,[Jh]:i.ONE_MINUS_DST_COLOR,[jh]:i.ONE_MINUS_DST_ALPHA,[Qh]:i.CONSTANT_COLOR,[ef]:i.ONE_MINUS_CONSTANT_COLOR,[tf]:i.CONSTANT_ALPHA,[nf]:i.ONE_MINUS_CONSTANT_ALPHA};function A(U,_e,te,Te,ie,Z,we,ne,Je,Xe){if(U===Kn){_===!0&&(Ue(i.BLEND),_=!1);return}if(_===!1&&(ye(i.BLEND),_=!0),U!==zh){if(U!==m||Xe!==M){if((d!==ci||y!==ci)&&(i.blendEquation(i.FUNC_ADD),d=ci,y=ci),Xe)switch(U){case Bi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case rl:i.blendFunc(i.ONE,i.ONE);break;case sl:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case al:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}else switch(U){case Bi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case rl:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case sl:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case al:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}E=null,T=null,D=null,C=null,w.set(0,0,0),P=0,m=U,M=Xe}return}ie=ie||_e,Z=Z||te,we=we||Te,(_e!==d||ie!==y)&&(i.blendEquationSeparate(K[_e],K[ie]),d=_e,y=ie),(te!==E||Te!==T||Z!==D||we!==C)&&(i.blendFuncSeparate(re[te],re[Te],re[Z],re[we]),E=te,T=Te,D=Z,C=we),(ne.equals(w)===!1||Je!==P)&&(i.blendColor(ne.r,ne.g,ne.b,Je),w.copy(ne),P=Je),m=U,M=!1}function De(U,_e){U.side===_n?Ue(i.CULL_FACE):ye(i.CULL_FACE);let te=U.side===kt;_e&&(te=!te),ce(te),U.blending===Bi&&U.transparent===!1?A(Kn):A(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.blendColor,U.blendAlpha,U.premultipliedAlpha),a.setFunc(U.depthFunc),a.setTest(U.depthTest),a.setMask(U.depthWrite),s.setMask(U.colorWrite);const Te=U.stencilWrite;o.setTest(Te),Te&&(o.setMask(U.stencilWriteMask),o.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),o.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),be(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?ye(i.SAMPLE_ALPHA_TO_COVERAGE):Ue(i.SAMPLE_ALPHA_TO_COVERAGE)}function ce(U){x!==U&&(U?i.frontFace(i.CW):i.frontFace(i.CCW),x=U)}function de(U){U!==Oh?(ye(i.CULL_FACE),U!==b&&(U===il?i.cullFace(i.BACK):U===Bh?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Ue(i.CULL_FACE),b=U}function X(U){U!==O&&(B&&i.lineWidth(U),O=U)}function be(U,_e,te){U?(ye(i.POLYGON_OFFSET_FILL),(F!==_e||k!==te)&&(i.polygonOffset(_e,te),F=_e,k=te)):Ue(i.POLYGON_OFFSET_FILL)}function Se(U){U?ye(i.SCISSOR_TEST):Ue(i.SCISSOR_TEST)}function pe(U){U===void 0&&(U=i.TEXTURE0+W-1),le!==U&&(i.activeTexture(U),le=U)}function Qe(U,_e,te){te===void 0&&(le===null?te=i.TEXTURE0+W-1:te=le);let Te=ge[te];Te===void 0&&(Te={type:void 0,texture:void 0},ge[te]=Te),(Te.type!==U||Te.texture!==_e)&&(le!==te&&(i.activeTexture(te),le=te),i.bindTexture(U,_e||Le[U]),Te.type=U,Te.texture=_e)}function R(){const U=ge[le];U!==void 0&&U.type!==void 0&&(i.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function v(){try{i.compressedTexImage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function z(){try{i.compressedTexImage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function j(){try{i.texSubImage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Q(){try{i.texSubImage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function q(){try{i.compressedTexSubImage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Re(){try{i.compressedTexSubImage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function oe(){try{i.texStorage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Me(){try{i.texStorage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Pe(){try{i.texImage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function ee(){try{i.texImage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Ee(U){je.equals(U)===!1&&(i.scissor(U.x,U.y,U.z,U.w),je.copy(U))}function Fe(U){$.equals(U)===!1&&(i.viewport(U.x,U.y,U.z,U.w),$.copy(U))}function Ne(U,_e){let te=c.get(_e);te===void 0&&(te=new WeakMap,c.set(_e,te));let Te=te.get(U);Te===void 0&&(Te=i.getUniformBlockIndex(_e,U.name),te.set(U,Te))}function fe(U,_e){const Te=c.get(_e).get(U);l.get(_e)!==Te&&(i.uniformBlockBinding(_e,Te,U.__bindingPointIndex),l.set(_e,Te))}function Ve(){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),u={},le=null,ge={},h={},f=new WeakMap,p=[],g=null,_=!1,m=null,d=null,E=null,T=null,y=null,D=null,C=null,w=new Ye(0,0,0),P=0,M=!1,x=null,b=null,O=null,F=null,k=null,je.set(0,0,i.canvas.width,i.canvas.height),$.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ye,disable:Ue,bindFramebuffer:tt,drawBuffers:ze,useProgram:ft,setBlending:A,setMaterial:De,setFlipSided:ce,setCullFace:de,setLineWidth:X,setPolygonOffset:be,setScissorTest:Se,activeTexture:pe,bindTexture:Qe,unbindTexture:R,compressedTexImage2D:v,compressedTexImage3D:z,texImage2D:Pe,texImage3D:ee,updateUBOMapping:Ne,uniformBlockBinding:fe,texStorage2D:oe,texStorage3D:Me,texSubImage2D:j,texSubImage3D:Q,compressedTexSubImage2D:q,compressedTexSubImage3D:Re,scissor:Ee,viewport:Fe,reset:Ve}}function Cv(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 We,u=new WeakMap;let h;const f=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(R,v){return p?new OffscreenCanvas(R,v):Tr("canvas")}function _(R,v,z){let j=1;const Q=Qe(R);if((Q.width>z||Q.height>z)&&(j=z/Math.max(Q.width,Q.height)),j<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const q=Math.floor(j*Q.width),Re=Math.floor(j*Q.height);h===void 0&&(h=g(q,Re));const oe=v?g(q,Re):h;return oe.width=q,oe.height=Re,oe.getContext("2d").drawImage(R,0,0,q,Re),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Q.width+"x"+Q.height+") to ("+q+"x"+Re+")."),oe}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Q.width+"x"+Q.height+")."),R;return R}function m(R){return R.generateMipmaps}function d(R){i.generateMipmap(R)}function E(R){return R.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?i.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function T(R,v,z,j,Q=!1){if(R!==null){if(i[R]!==void 0)return i[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let q=v;if(v===i.RED&&(z===i.FLOAT&&(q=i.R32F),z===i.HALF_FLOAT&&(q=i.R16F),z===i.UNSIGNED_BYTE&&(q=i.R8)),v===i.RED_INTEGER&&(z===i.UNSIGNED_BYTE&&(q=i.R8UI),z===i.UNSIGNED_SHORT&&(q=i.R16UI),z===i.UNSIGNED_INT&&(q=i.R32UI),z===i.BYTE&&(q=i.R8I),z===i.SHORT&&(q=i.R16I),z===i.INT&&(q=i.R32I)),v===i.RG&&(z===i.FLOAT&&(q=i.RG32F),z===i.HALF_FLOAT&&(q=i.RG16F),z===i.UNSIGNED_BYTE&&(q=i.RG8)),v===i.RG_INTEGER&&(z===i.UNSIGNED_BYTE&&(q=i.RG8UI),z===i.UNSIGNED_SHORT&&(q=i.RG16UI),z===i.UNSIGNED_INT&&(q=i.RG32UI),z===i.BYTE&&(q=i.RG8I),z===i.SHORT&&(q=i.RG16I),z===i.INT&&(q=i.RG32I)),v===i.RGB_INTEGER&&(z===i.UNSIGNED_BYTE&&(q=i.RGB8UI),z===i.UNSIGNED_SHORT&&(q=i.RGB16UI),z===i.UNSIGNED_INT&&(q=i.RGB32UI),z===i.BYTE&&(q=i.RGB8I),z===i.SHORT&&(q=i.RGB16I),z===i.INT&&(q=i.RGB32I)),v===i.RGBA_INTEGER&&(z===i.UNSIGNED_BYTE&&(q=i.RGBA8UI),z===i.UNSIGNED_SHORT&&(q=i.RGBA16UI),z===i.UNSIGNED_INT&&(q=i.RGBA32UI),z===i.BYTE&&(q=i.RGBA8I),z===i.SHORT&&(q=i.RGBA16I),z===i.INT&&(q=i.RGBA32I)),v===i.RGB&&z===i.UNSIGNED_INT_5_9_9_9_REV&&(q=i.RGB9_E5),v===i.RGBA){const Re=Q?Ps:it.getTransfer(j);z===i.FLOAT&&(q=i.RGBA32F),z===i.HALF_FLOAT&&(q=i.RGBA16F),z===i.UNSIGNED_BYTE&&(q=Re===ut?i.SRGB8_ALPHA8:i.RGBA8),z===i.UNSIGNED_SHORT_4_4_4_4&&(q=i.RGBA4),z===i.UNSIGNED_SHORT_5_5_5_1&&(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function y(R,v){let z;return R?v===null||v===di||v===Mr?z=i.DEPTH24_STENCIL8:v===yn?z=i.DEPTH32F_STENCIL8:v===Sr&&(z=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===di||v===Mr?z=i.DEPTH_COMPONENT24:v===yn?z=i.DEPTH_COMPONENT32F:v===Sr&&(z=i.DEPTH_COMPONENT16),z}function D(R,v){return m(R)===!0||R.isFramebufferTexture&&R.minFilter!==$t&&R.minFilter!==jt?Math.log2(Math.max(v.width,v.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?v.mipmaps.length:1}function C(R){const v=R.target;v.removeEventListener("dispose",C),P(v),v.isVideoTexture&&u.delete(v)}function w(R){const v=R.target;v.removeEventListener("dispose",w),x(v)}function P(R){const v=n.get(R);if(v.__webglInit===void 0)return;const z=R.source,j=f.get(z);if(j){const Q=j[v.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&M(R),Object.keys(j).length===0&&f.delete(z)}n.remove(R)}function M(R){const v=n.get(R);i.deleteTexture(v.__webglTexture);const z=R.source,j=f.get(z);delete j[v.__cacheKey],a.memory.textures--}function x(R){const v=n.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),n.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let j=0;j<6;j++){if(Array.isArray(v.__webglFramebuffer[j]))for(let Q=0;Q<v.__webglFramebuffer[j].length;Q++)i.deleteFramebuffer(v.__webglFramebuffer[j][Q]);else i.deleteFramebuffer(v.__webglFramebuffer[j]);v.__webglDepthbuffer&&i.deleteRenderbuffer(v.__webglDepthbuffer[j])}else{if(Array.isArray(v.__webglFramebuffer))for(let j=0;j<v.__webglFramebuffer.length;j++)i.deleteFramebuffer(v.__webglFramebuffer[j]);else i.deleteFramebuffer(v.__webglFramebuffer);if(v.__webglDepthbuffer&&i.deleteRenderbuffer(v.__webglDepthbuffer),v.__webglMultisampledFramebuffer&&i.deleteFramebuffer(v.__webglMultisampledFramebuffer),v.__webglColorRenderbuffer)for(let j=0;j<v.__webglColorRenderbuffer.length;j++)v.__webglColorRenderbuffer[j]&&i.deleteRenderbuffer(v.__webglColorRenderbuffer[j]);v.__webglDepthRenderbuffer&&i.deleteRenderbuffer(v.__webglDepthRenderbuffer)}const z=R.textures;for(let j=0,Q=z.length;j<Q;j++){const q=n.get(z[j]);q.__webglTexture&&(i.deleteTexture(q.__webglTexture),a.memory.textures--),n.remove(z[j])}n.remove(R)}let b=0;function O(){b=0}function F(){const R=b;return R>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+r.maxTextures),b+=1,R}function k(R){const v=[];return v.push(R.wrapS),v.push(R.wrapT),v.push(R.wrapR||0),v.push(R.magFilter),v.push(R.minFilter),v.push(R.anisotropy),v.push(R.internalFormat),v.push(R.format),v.push(R.type),v.push(R.generateMipmaps),v.push(R.premultiplyAlpha),v.push(R.flipY),v.push(R.unpackAlignment),v.push(R.colorSpace),v.join()}function W(R,v){const z=n.get(R);if(R.isVideoTexture&&Se(R),R.isRenderTargetTexture===!1&&R.version>0&&z.__version!==R.version){const j=R.image;if(j===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(j.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Le(z,R,v);return}}t.bindTexture(i.TEXTURE_2D,z.__webglTexture,i.TEXTURE0+v)}function B(R,v){const z=n.get(R);if(R.version>0&&z.__version!==R.version){Le(z,R,v);return}t.bindTexture(i.TEXTURE_2D_ARRAY,z.__webglTexture,i.TEXTURE0+v)}function J(R,v){const z=n.get(R);if(R.version>0&&z.__version!==R.version){Le(z,R,v);return}t.bindTexture(i.TEXTURE_3D,z.__webglTexture,i.TEXTURE0+v)}function V(R,v){const z=n.get(R);if(R.version>0&&z.__version!==R.version){ye(z,R,v);return}t.bindTexture(i.TEXTURE_CUBE_MAP,z.__webglTexture,i.TEXTURE0+v)}const le={[Wi]:i.REPEAT,[xn]:i.CLAMP_TO_EDGE,[Wa]:i.MIRRORED_REPEAT},ge={[$t]:i.NEAREST,[df]:i.NEAREST_MIPMAP_NEAREST,[Fr]:i.NEAREST_MIPMAP_LINEAR,[jt]:i.LINEAR,[Ys]:i.LINEAR_MIPMAP_NEAREST,[Ln]:i.LINEAR_MIPMAP_LINEAR},se={[vf]:i.NEVER,[bf]:i.ALWAYS,[xf]:i.LESS,[ru]:i.LEQUAL,[yf]:i.EQUAL,[Ef]:i.GEQUAL,[Sf]:i.GREATER,[Mf]:i.NOTEQUAL};function ke(R,v){if(v.type===yn&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===jt||v.magFilter===Ys||v.magFilter===Fr||v.magFilter===Ln||v.minFilter===jt||v.minFilter===Ys||v.minFilter===Fr||v.minFilter===Ln)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(R,i.TEXTURE_WRAP_S,le[v.wrapS]),i.texParameteri(R,i.TEXTURE_WRAP_T,le[v.wrapT]),(R===i.TEXTURE_3D||R===i.TEXTURE_2D_ARRAY)&&i.texParameteri(R,i.TEXTURE_WRAP_R,le[v.wrapR]),i.texParameteri(R,i.TEXTURE_MAG_FILTER,ge[v.magFilter]),i.texParameteri(R,i.TEXTURE_MIN_FILTER,ge[v.minFilter]),v.compareFunction&&(i.texParameteri(R,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(R,i.TEXTURE_COMPARE_FUNC,se[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===$t||v.minFilter!==Fr&&v.minFilter!==Ln||v.type===yn&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const z=e.get("EXT_texture_filter_anisotropic");i.texParameterf(R,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function je(R,v){let z=!1;R.__webglInit===void 0&&(R.__webglInit=!0,v.addEventListener("dispose",C));const j=v.source;let Q=f.get(j);Q===void 0&&(Q={},f.set(j,Q));const q=k(v);if(q!==R.__cacheKey){Q[q]===void 0&&(Q[q]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,z=!0),Q[q].usedTimes++;const Re=Q[R.__cacheKey];Re!==void 0&&(Q[R.__cacheKey].usedTimes--,Re.usedTimes===0&&M(v)),R.__cacheKey=q,R.__webglTexture=Q[q].texture}return z}function $(R,v,z){return Math.floor(Math.floor(R/z)/v)}function ue(R,v,z,j){const q=R.updateRanges;if(q.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,v.width,v.height,z,j,v.data);else{q.sort((ee,Ee)=>ee.start-Ee.start);let Re=0;for(let ee=1;ee<q.length;ee++){const Ee=q[Re],Fe=q[ee],Ne=Ee.start+Ee.count,fe=$(Fe.start,v.width,4),Ve=$(Ee.start,v.width,4);Fe.start<=Ne+1&&fe===Ve&&$(Fe.start+Fe.count-1,v.width,4)===fe?Ee.count=Math.max(Ee.count,Fe.start+Fe.count-Ee.start):(++Re,q[Re]=Fe)}q.length=Re+1;const oe=i.getParameter(i.UNPACK_ROW_LENGTH),Me=i.getParameter(i.UNPACK_SKIP_PIXELS),Pe=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,v.width);for(let ee=0,Ee=q.length;ee<Ee;ee++){const Fe=q[ee],Ne=Math.floor(Fe.start/4),fe=Math.ceil(Fe.count/4),Ve=Ne%v.width,U=Math.floor(Ne/v.width),_e=fe,te=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,Ve),i.pixelStorei(i.UNPACK_SKIP_ROWS,U),t.texSubImage2D(i.TEXTURE_2D,0,Ve,U,_e,te,z,j,v.data)}R.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,oe),i.pixelStorei(i.UNPACK_SKIP_PIXELS,Me),i.pixelStorei(i.UNPACK_SKIP_ROWS,Pe)}}function Le(R,v,z){let j=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(j=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(j=i.TEXTURE_3D);const Q=je(R,v),q=v.source;t.bindTexture(j,R.__webglTexture,i.TEXTURE0+z);const Re=n.get(q);if(q.version!==Re.__version||Q===!0){t.activeTexture(i.TEXTURE0+z);const oe=it.getPrimaries(it.workingColorSpace),Me=v.colorSpace===Yn?null:it.getPrimaries(v.colorSpace),Pe=v.colorSpace===Yn||oe===Me?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Pe);let ee=_(v.image,!1,r.maxTextureSize);ee=pe(v,ee);const Ee=s.convert(v.format,v.colorSpace),Fe=s.convert(v.type);let Ne=T(v.internalFormat,Ee,Fe,v.colorSpace,v.isVideoTexture);ke(j,v);let fe;const Ve=v.mipmaps,U=v.isVideoTexture!==!0,_e=Re.__version===void 0||Q===!0,te=q.dataReady,Te=D(v,ee);if(v.isDepthTexture)Ne=y(v.format===br,v.type),_e&&(U?t.texStorage2D(i.TEXTURE_2D,1,Ne,ee.width,ee.height):t.texImage2D(i.TEXTURE_2D,0,Ne,ee.width,ee.height,0,Ee,Fe,null));else if(v.isDataTexture)if(Ve.length>0){U&&_e&&t.texStorage2D(i.TEXTURE_2D,Te,Ne,Ve[0].width,Ve[0].height);for(let ie=0,Z=Ve.length;ie<Z;ie++)fe=Ve[ie],U?te&&t.texSubImage2D(i.TEXTURE_2D,ie,0,0,fe.width,fe.height,Ee,Fe,fe.data):t.texImage2D(i.TEXTURE_2D,ie,Ne,fe.width,fe.height,0,Ee,Fe,fe.data);v.generateMipmaps=!1}else U?(_e&&t.texStorage2D(i.TEXTURE_2D,Te,Ne,ee.width,ee.height),te&&ue(v,ee,Ee,Fe)):t.texImage2D(i.TEXTURE_2D,0,Ne,ee.width,ee.height,0,Ee,Fe,ee.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){U&&_e&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Te,Ne,Ve[0].width,Ve[0].height,ee.depth);for(let ie=0,Z=Ve.length;ie<Z;ie++)if(fe=Ve[ie],v.format!==rn)if(Ee!==null)if(U){if(te)if(v.layerUpdates.size>0){const we=ec(fe.width,fe.height,v.format,v.type);for(const ne of v.layerUpdates){const Je=fe.data.subarray(ne*we/fe.data.BYTES_PER_ELEMENT,(ne+1)*we/fe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ie,0,0,ne,fe.width,fe.height,1,Ee,Je)}v.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ie,0,0,0,fe.width,fe.height,ee.depth,Ee,fe.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,ie,Ne,fe.width,fe.height,ee.depth,0,fe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else U?te&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,ie,0,0,0,fe.width,fe.height,ee.depth,Ee,Fe,fe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,ie,Ne,fe.width,fe.height,ee.depth,0,Ee,Fe,fe.data)}else{U&&_e&&t.texStorage2D(i.TEXTURE_2D,Te,Ne,Ve[0].width,Ve[0].height);for(let ie=0,Z=Ve.length;ie<Z;ie++)fe=Ve[ie],v.format!==rn?Ee!==null?U?te&&t.compressedTexSubImage2D(i.TEXTURE_2D,ie,0,0,fe.width,fe.height,Ee,fe.data):t.compressedTexImage2D(i.TEXTURE_2D,ie,Ne,fe.width,fe.height,0,fe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):U?te&&t.texSubImage2D(i.TEXTURE_2D,ie,0,0,fe.width,fe.height,Ee,Fe,fe.data):t.texImage2D(i.TEXTURE_2D,ie,Ne,fe.width,fe.height,0,Ee,Fe,fe.data)}else if(v.isDataArrayTexture)if(U){if(_e&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Te,Ne,ee.width,ee.height,ee.depth),te)if(v.layerUpdates.size>0){const ie=ec(ee.width,ee.height,v.format,v.type);for(const Z of v.layerUpdates){const we=ee.data.subarray(Z*ie/ee.data.BYTES_PER_ELEMENT,(Z+1)*ie/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Z,ee.width,ee.height,1,Ee,Fe,we)}v.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,Ee,Fe,ee.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ne,ee.width,ee.height,ee.depth,0,Ee,Fe,ee.data);else if(v.isData3DTexture)U?(_e&&t.texStorage3D(i.TEXTURE_3D,Te,Ne,ee.width,ee.height,ee.depth),te&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,Ee,Fe,ee.data)):t.texImage3D(i.TEXTURE_3D,0,Ne,ee.width,ee.height,ee.depth,0,Ee,Fe,ee.data);else if(v.isFramebufferTexture){if(_e)if(U)t.texStorage2D(i.TEXTURE_2D,Te,Ne,ee.width,ee.height);else{let ie=ee.width,Z=ee.height;for(let we=0;we<Te;we++)t.texImage2D(i.TEXTURE_2D,we,Ne,ie,Z,0,Ee,Fe,null),ie>>=1,Z>>=1}}else if(Ve.length>0){if(U&&_e){const ie=Qe(Ve[0]);t.texStorage2D(i.TEXTURE_2D,Te,Ne,ie.width,ie.height)}for(let ie=0,Z=Ve.length;ie<Z;ie++)fe=Ve[ie],U?te&&t.texSubImage2D(i.TEXTURE_2D,ie,0,0,Ee,Fe,fe):t.texImage2D(i.TEXTURE_2D,ie,Ne,Ee,Fe,fe);v.generateMipmaps=!1}else if(U){if(_e){const ie=Qe(ee);t.texStorage2D(i.TEXTURE_2D,Te,Ne,ie.width,ie.height)}te&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Ee,Fe,ee)}else t.texImage2D(i.TEXTURE_2D,0,Ne,Ee,Fe,ee);m(v)&&d(j),Re.__version=q.version,v.onUpdate&&v.onUpdate(v)}R.__version=v.version}function ye(R,v,z){if(v.image.length!==6)return;const j=je(R,v),Q=v.source;t.bindTexture(i.TEXTURE_CUBE_MAP,R.__webglTexture,i.TEXTURE0+z);const q=n.get(Q);if(Q.version!==q.__version||j===!0){t.activeTexture(i.TEXTURE0+z);const Re=it.getPrimaries(it.workingColorSpace),oe=v.colorSpace===Yn?null:it.getPrimaries(v.colorSpace),Me=v.colorSpace===Yn||Re===oe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);const Pe=v.isCompressedTexture||v.image[0].isCompressedTexture,ee=v.image[0]&&v.image[0].isDataTexture,Ee=[];for(let Z=0;Z<6;Z++)!Pe&&!ee?Ee[Z]=_(v.image[Z],!0,r.maxCubemapSize):Ee[Z]=ee?v.image[Z].image:v.image[Z],Ee[Z]=pe(v,Ee[Z]);const Fe=Ee[0],Ne=s.convert(v.format,v.colorSpace),fe=s.convert(v.type),Ve=T(v.internalFormat,Ne,fe,v.colorSpace),U=v.isVideoTexture!==!0,_e=q.__version===void 0||j===!0,te=Q.dataReady;let Te=D(v,Fe);ke(i.TEXTURE_CUBE_MAP,v);let ie;if(Pe){U&&_e&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Te,Ve,Fe.width,Fe.height);for(let Z=0;Z<6;Z++){ie=Ee[Z].mipmaps;for(let we=0;we<ie.length;we++){const ne=ie[we];v.format!==rn?Ne!==null?U?te&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we,0,0,ne.width,ne.height,Ne,ne.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we,Ve,ne.width,ne.height,0,ne.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we,0,0,ne.width,ne.height,Ne,fe,ne.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we,Ve,ne.width,ne.height,0,Ne,fe,ne.data)}}}else{if(ie=v.mipmaps,U&&_e){ie.length>0&&Te++;const Z=Qe(Ee[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Te,Ve,Z.width,Z.height)}for(let Z=0;Z<6;Z++)if(ee){U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,Ee[Z].width,Ee[Z].height,Ne,fe,Ee[Z].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,Ve,Ee[Z].width,Ee[Z].height,0,Ne,fe,Ee[Z].data);for(let we=0;we<ie.length;we++){const Je=ie[we].image[Z].image;U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we+1,0,0,Je.width,Je.height,Ne,fe,Je.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we+1,Ve,Je.width,Je.height,0,Ne,fe,Je.data)}}else{U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,Ne,fe,Ee[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,Ve,Ne,fe,Ee[Z]);for(let we=0;we<ie.length;we++){const ne=ie[we];U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we+1,0,0,Ne,fe,ne.image[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we+1,Ve,Ne,fe,ne.image[Z])}}}m(v)&&d(i.TEXTURE_CUBE_MAP),q.__version=Q.version,v.onUpdate&&v.onUpdate(v)}R.__version=v.version}function Ue(R,v,z,j,Q,q){const Re=s.convert(z.format,z.colorSpace),oe=s.convert(z.type),Me=T(z.internalFormat,Re,oe,z.colorSpace),Pe=n.get(v),ee=n.get(z);if(ee.__renderTarget=v,!Pe.__hasExternalTextures){const Ee=Math.max(1,v.width>>q),Fe=Math.max(1,v.height>>q);Q===i.TEXTURE_3D||Q===i.TEXTURE_2D_ARRAY?t.texImage3D(Q,q,Me,Ee,Fe,v.depth,0,Re,oe,null):t.texImage2D(Q,q,Me,Ee,Fe,0,Re,oe,null)}t.bindFramebuffer(i.FRAMEBUFFER,R),be(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,j,Q,ee.__webglTexture,0,X(v)):(Q===i.TEXTURE_2D||Q>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,j,Q,ee.__webglTexture,q),t.bindFramebuffer(i.FRAMEBUFFER,null)}function tt(R,v,z){if(i.bindRenderbuffer(i.RENDERBUFFER,R),v.depthBuffer){const j=v.depthTexture,Q=j&&j.isDepthTexture?j.type:null,q=y(v.stencilBuffer,Q),Re=v.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=X(v);be(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,oe,q,v.width,v.height):z?i.renderbufferStorageMultisample(i.RENDERBUFFER,oe,q,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,q,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Re,i.RENDERBUFFER,R)}else{const j=v.textures;for(let Q=0;Q<j.length;Q++){const q=j[Q],Re=s.convert(q.format,q.colorSpace),oe=s.convert(q.type),Me=T(q.internalFormat,Re,oe,q.colorSpace),Pe=X(v);z&&be(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Pe,Me,v.width,v.height):be(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Pe,Me,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,Me,v.width,v.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ze(R,v){if(v&&v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,R),!(v.depthTexture&&v.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const j=n.get(v.depthTexture);j.__renderTarget=v,(!j.__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)&&(v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0),W(v.depthTexture,0);const Q=j.__webglTexture,q=X(v);if(v.depthTexture.format===Er)be(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Q,0,q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Q,0);else if(v.depthTexture.format===br)be(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Q,0,q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Q,0);else throw new Error("Unknown depthTexture format")}function ft(R){const v=n.get(R),z=R.isWebGLCubeRenderTarget===!0;if(v.__boundDepthTexture!==R.depthTexture){const j=R.depthTexture;if(v.__depthDisposeCallback&&v.__depthDisposeCallback(),j){const Q=()=>{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,j.removeEventListener("dispose",Q)};j.addEventListener("dispose",Q),v.__depthDisposeCallback=Q}v.__boundDepthTexture=j}if(R.depthTexture&&!v.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");const j=R.texture.mipmaps;j&&j.length>0?ze(v.__webglFramebuffer[0],R):ze(v.__webglFramebuffer,R)}else if(z){v.__webglDepthbuffer=[];for(let j=0;j<6;j++)if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[j]),v.__webglDepthbuffer[j]===void 0)v.__webglDepthbuffer[j]=i.createRenderbuffer(),tt(v.__webglDepthbuffer[j],R,!1);else{const Q=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=v.__webglDepthbuffer[j];i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,Q,i.RENDERBUFFER,q)}}else{const j=R.texture.mipmaps;if(j&&j.length>0?t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=i.createRenderbuffer(),tt(v.__webglDepthbuffer,R,!1);else{const Q=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=v.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,Q,i.RENDERBUFFER,q)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function K(R,v,z){const j=n.get(R);v!==void 0&&Ue(j.__webglFramebuffer,R,R.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),z!==void 0&&ft(R)}function re(R){const v=R.texture,z=n.get(R),j=n.get(v);R.addEventListener("dispose",w);const Q=R.textures,q=R.isWebGLCubeRenderTarget===!0,Re=Q.length>1;if(Re||(j.__webglTexture===void 0&&(j.__webglTexture=i.createTexture()),j.__version=v.version,a.memory.textures++),q){z.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(v.mipmaps&&v.mipmaps.length>0){z.__webglFramebuffer[oe]=[];for(let Me=0;Me<v.mipmaps.length;Me++)z.__webglFramebuffer[oe][Me]=i.createFramebuffer()}else z.__webglFramebuffer[oe]=i.createFramebuffer()}else{if(v.mipmaps&&v.mipmaps.length>0){z.__webglFramebuffer=[];for(let oe=0;oe<v.mipmaps.length;oe++)z.__webglFramebuffer[oe]=i.createFramebuffer()}else z.__webglFramebuffer=i.createFramebuffer();if(Re)for(let oe=0,Me=Q.length;oe<Me;oe++){const Pe=n.get(Q[oe]);Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture(),a.memory.textures++)}if(R.samples>0&&be(R)===!1){z.__webglMultisampledFramebuffer=i.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let oe=0;oe<Q.length;oe++){const Me=Q[oe];z.__webglColorRenderbuffer[oe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,z.__webglColorRenderbuffer[oe]);const Pe=s.convert(Me.format,Me.colorSpace),ee=s.convert(Me.type),Ee=T(Me.internalFormat,Pe,ee,Me.colorSpace,R.isXRRenderTarget===!0),Fe=X(R);i.renderbufferStorageMultisample(i.RENDERBUFFER,Fe,Ee,R.width,R.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+oe,i.RENDERBUFFER,z.__webglColorRenderbuffer[oe])}i.bindRenderbuffer(i.RENDERBUFFER,null),R.depthBuffer&&(z.__webglDepthRenderbuffer=i.createRenderbuffer(),tt(z.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(q){t.bindTexture(i.TEXTURE_CUBE_MAP,j.__webglTexture),ke(i.TEXTURE_CUBE_MAP,v);for(let oe=0;oe<6;oe++)if(v.mipmaps&&v.mipmaps.length>0)for(let Me=0;Me<v.mipmaps.length;Me++)Ue(z.__webglFramebuffer[oe][Me],R,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+oe,Me);else Ue(z.__webglFramebuffer[oe],R,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0);m(v)&&d(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Re){for(let oe=0,Me=Q.length;oe<Me;oe++){const Pe=Q[oe],ee=n.get(Pe);t.bindTexture(i.TEXTURE_2D,ee.__webglTexture),ke(i.TEXTURE_2D,Pe),Ue(z.__webglFramebuffer,R,Pe,i.COLOR_ATTACHMENT0+oe,i.TEXTURE_2D,0),m(Pe)&&d(i.TEXTURE_2D)}t.unbindTexture()}else{let oe=i.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(oe=R.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(oe,j.__webglTexture),ke(oe,v),v.mipmaps&&v.mipmaps.length>0)for(let Me=0;Me<v.mipmaps.length;Me++)Ue(z.__webglFramebuffer[Me],R,v,i.COLOR_ATTACHMENT0,oe,Me);else Ue(z.__webglFramebuffer,R,v,i.COLOR_ATTACHMENT0,oe,0);m(v)&&d(oe),t.unbindTexture()}R.depthBuffer&&ft(R)}function A(R){const v=R.textures;for(let z=0,j=v.length;z<j;z++){const Q=v[z];if(m(Q)){const q=E(R),Re=n.get(Q).__webglTexture;t.bindTexture(q,Re),d(q),t.unbindTexture()}}}const De=[],ce=[];function de(R){if(R.samples>0){if(be(R)===!1){const v=R.textures,z=R.width,j=R.height;let Q=i.COLOR_BUFFER_BIT;const q=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Re=n.get(R),oe=v.length>1;if(oe)for(let Pe=0;Pe<v.length;Pe++)t.bindFramebuffer(i.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pe,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pe,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer);const Me=R.texture.mipmaps;Me&&Me.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Re.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let Pe=0;Pe<v.length;Pe++){if(R.resolveDepthBuffer&&(R.depthBuffer&&(Q|=i.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&(Q|=i.STENCIL_BUFFER_BIT)),oe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Re.__webglColorRenderbuffer[Pe]);const ee=n.get(v[Pe]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,ee,0)}i.blitFramebuffer(0,0,z,j,0,0,z,j,Q,i.NEAREST),l===!0&&(De.length=0,ce.length=0,De.push(i.COLOR_ATTACHMENT0+Pe),R.depthBuffer&&R.resolveDepthBuffer===!1&&(De.push(q),ce.push(q),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ce)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,De))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),oe)for(let Pe=0;Pe<v.length;Pe++){t.bindFramebuffer(i.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pe,i.RENDERBUFFER,Re.__webglColorRenderbuffer[Pe]);const ee=n.get(v[Pe]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pe,i.TEXTURE_2D,ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.resolveDepthBuffer===!1&&l){const v=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[v])}}}function X(R){return Math.min(r.maxSamples,R.samples)}function be(R){const v=n.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Se(R){const v=a.render.frame;u.get(R)!==v&&(u.set(R,v),R.update())}function pe(R,v){const z=R.colorSpace,j=R.format,Q=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||z!==Xi&&z!==Yn&&(it.getTransfer(z)===ut?(j!==rn||Q!==Mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),v}function Qe(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=F,this.resetTextureUnits=O,this.setTexture2D=W,this.setTexture2DArray=B,this.setTexture3D=J,this.setTextureCube=V,this.rebindTextures=K,this.setupRenderTarget=re,this.updateRenderTargetMipmap=A,this.updateMultisampleRenderTarget=de,this.setupDepthRenderbuffer=ft,this.setupFrameBufferTexture=Ue,this.useMultisampledRTT=be}function Dv(i,e){function t(n,r=Yn){let s;const a=it.getTransfer(r);if(n===Mn)return i.UNSIGNED_BYTE;if(n===Uo)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Io)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Zc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===$c)return i.BYTE;if(n===Jc)return i.SHORT;if(n===Sr)return i.UNSIGNED_SHORT;if(n===Lo)return i.INT;if(n===di)return i.UNSIGNED_INT;if(n===yn)return i.FLOAT;if(n===Rr)return i.HALF_FLOAT;if(n===Qc)return i.ALPHA;if(n===eu)return i.RGB;if(n===rn)return i.RGBA;if(n===Er)return i.DEPTH_COMPONENT;if(n===br)return i.DEPTH_STENCIL;if(n===tu)return i.RED;if(n===No)return i.RED_INTEGER;if(n===nu)return i.RG;if(n===Fo)return i.RG_INTEGER;if(n===Oo)return i.RGBA_INTEGER;if(n===ys||n===Ss||n===Ms||n===Es)if(a===ut)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===ys)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ss)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ms)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Es)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===ys)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ss)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ms)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Es)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Xa||n===qa||n===Ya||n===Ka)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Xa)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===qa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ya)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ka)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ja||n===$a||n===Ja)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===ja||n===$a)return a===ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ja)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Za||n===Qa||n===eo||n===to||n===no||n===io||n===ro||n===so||n===ao||n===oo||n===lo||n===co||n===uo||n===ho)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Za)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Qa)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===eo)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===to)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===no)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===io)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ro)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===so)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ao)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===oo)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===lo)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===co)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===uo)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ho)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===bs||n===fo||n===po)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===bs)return a===ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===fo)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===po)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===iu||n===mo||n===go||n===_o)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===bs)return s.COMPRESSED_RED_RGTC1_EXT;if(n===mo)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===go)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===_o)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Mr?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Pv=`
|
|
3803
|
+
}`;function wv(i,e,t){let n=new Xo;const r=new We,s=new We,a=new et,o=new Ad({depthPacking:gf}),l=new wd,c={},u=t.maxTextureSize,h={[Fn]:kt,[kt]:Fn,[_n]:_n},f=new On({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new We},radius:{value:4}},vertexShader:Tv,fragmentShader:Av}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const g=new Pt;g.setAttribute("position",new Dt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Rt(g,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=qc;let d=this.type;this.render=function(C,w,P){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||C.length===0)return;const M=i.getRenderTarget(),x=i.getActiveCubeFace(),b=i.getActiveMipmapLevel(),O=i.state;O.setBlending(Kn),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const F=d!==Pn&&this.type===Pn,k=d===Pn&&this.type!==Pn;for(let W=0,B=C.length;W<B;W++){const J=C[W],V=J.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;r.copy(V.mapSize);const le=V.getFrameExtents();if(r.multiply(le),s.copy(V.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/le.x),r.x=s.x*le.x,V.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/le.y),r.y=s.y*le.y,V.mapSize.y=s.y)),V.map===null||F===!0||k===!0){const se=this.type!==Pn?{minFilter:$t,magFilter:$t}:{};V.map!==null&&V.map.dispose(),V.map=new pi(r.x,r.y,se),V.map.texture.name=J.name+".shadowMap",V.camera.updateProjectionMatrix()}i.setRenderTarget(V.map),i.clear();const ge=V.getViewportCount();for(let se=0;se<ge;se++){const ke=V.getViewport(se);a.set(s.x*ke.x,s.y*ke.y,s.x*ke.z,s.y*ke.w),O.viewport(a),V.updateMatrices(J,se),n=V.getFrustum(),y(w,P,V.camera,J,this.type)}V.isPointLightShadow!==!0&&this.type===Pn&&E(V,P),V.needsUpdate=!1}d=this.type,m.needsUpdate=!1,i.setRenderTarget(M,x,b)};function E(C,w){const P=e.update(_);f.defines.VSM_SAMPLES!==C.blurSamples&&(f.defines.VSM_SAMPLES=C.blurSamples,p.defines.VSM_SAMPLES=C.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new pi(r.x,r.y)),f.uniforms.shadow_pass.value=C.map.texture,f.uniforms.resolution.value=C.mapSize,f.uniforms.radius.value=C.radius,i.setRenderTarget(C.mapPass),i.clear(),i.renderBufferDirect(w,null,P,f,_,null),p.uniforms.shadow_pass.value=C.mapPass.texture,p.uniforms.resolution.value=C.mapSize,p.uniforms.radius.value=C.radius,i.setRenderTarget(C.map),i.clear(),i.renderBufferDirect(w,null,P,p,_,null)}function T(C,w,P,M){let x=null;const b=P.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(b!==void 0)x=b;else if(x=P.isPointLight===!0?l:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0||w.alphaToCoverage===!0){const O=x.uuid,F=w.uuid;let k=c[O];k===void 0&&(k={},c[O]=k);let W=k[F];W===void 0&&(W=x.clone(),k[F]=W,w.addEventListener("dispose",D)),x=W}if(x.visible=w.visible,x.wireframe=w.wireframe,M===Pn?x.side=w.shadowSide!==null?w.shadowSide:w.side:x.side=w.shadowSide!==null?w.shadowSide:h[w.side],x.alphaMap=w.alphaMap,x.alphaTest=w.alphaToCoverage===!0?.5:w.alphaTest,x.map=w.map,x.clipShadows=w.clipShadows,x.clippingPlanes=w.clippingPlanes,x.clipIntersection=w.clipIntersection,x.displacementMap=w.displacementMap,x.displacementScale=w.displacementScale,x.displacementBias=w.displacementBias,x.wireframeLinewidth=w.wireframeLinewidth,x.linewidth=w.linewidth,P.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const O=i.properties.get(x);O.light=P}return x}function y(C,w,P,M,x){if(C.visible===!1)return;if(C.layers.test(w.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&x===Pn)&&(!C.frustumCulled||n.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,C.matrixWorld);const F=e.update(C),k=C.material;if(Array.isArray(k)){const W=F.groups;for(let B=0,J=W.length;B<J;B++){const V=W[B],le=k[V.materialIndex];if(le&&le.visible){const ge=T(C,le,M,x);C.onBeforeShadow(i,C,w,P,F,ge,V),i.renderBufferDirect(P,null,F,ge,C,V),C.onAfterShadow(i,C,w,P,F,ge,V)}}}else if(k.visible){const W=T(C,k,M,x);C.onBeforeShadow(i,C,w,P,F,W,null),i.renderBufferDirect(P,null,F,W,C,null),C.onAfterShadow(i,C,w,P,F,W,null)}}const O=C.children;for(let F=0,k=O.length;F<k;F++)y(O[F],w,P,M,x)}function D(C){C.target.removeEventListener("dispose",D);for(const P in c){const M=c[P],x=C.target.uuid;x in M&&(M[x].dispose(),delete M[x])}}}const Rv={[Na]:Fa,[Oa]:ka,[Ba]:Va,[Vi]:za,[Fa]:Na,[ka]:Oa,[Va]:Ba,[za]:Vi};function Cv(i,e){function t(){let U=!1;const _e=new et;let te=null;const Te=new et(0,0,0,0);return{setMask:function(ie){te!==ie&&!U&&(i.colorMask(ie,ie,ie,ie),te=ie)},setLocked:function(ie){U=ie},setClear:function(ie,Z,we,ne,Je){Je===!0&&(ie*=ne,Z*=ne,we*=ne),_e.set(ie,Z,we,ne),Te.equals(_e)===!1&&(i.clearColor(ie,Z,we,ne),Te.copy(_e))},reset:function(){U=!1,te=null,Te.set(-1,0,0,0)}}}function n(){let U=!1,_e=!1,te=null,Te=null,ie=null;return{setReversed:function(Z){if(_e!==Z){const we=e.get("EXT_clip_control");Z?we.clipControlEXT(we.LOWER_LEFT_EXT,we.ZERO_TO_ONE_EXT):we.clipControlEXT(we.LOWER_LEFT_EXT,we.NEGATIVE_ONE_TO_ONE_EXT),_e=Z;const ne=ie;ie=null,this.setClear(ne)}},getReversed:function(){return _e},setTest:function(Z){Z?ye(i.DEPTH_TEST):Ue(i.DEPTH_TEST)},setMask:function(Z){te!==Z&&!U&&(i.depthMask(Z),te=Z)},setFunc:function(Z){if(_e&&(Z=Rv[Z]),Te!==Z){switch(Z){case Na:i.depthFunc(i.NEVER);break;case Fa:i.depthFunc(i.ALWAYS);break;case Oa:i.depthFunc(i.LESS);break;case Vi:i.depthFunc(i.LEQUAL);break;case Ba:i.depthFunc(i.EQUAL);break;case za:i.depthFunc(i.GEQUAL);break;case ka:i.depthFunc(i.GREATER);break;case Va:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Te=Z}},setLocked:function(Z){U=Z},setClear:function(Z){ie!==Z&&(_e&&(Z=1-Z),i.clearDepth(Z),ie=Z)},reset:function(){U=!1,te=null,Te=null,ie=null,_e=!1}}}function r(){let U=!1,_e=null,te=null,Te=null,ie=null,Z=null,we=null,ne=null,Je=null;return{setTest:function(Xe){U||(Xe?ye(i.STENCIL_TEST):Ue(i.STENCIL_TEST))},setMask:function(Xe){_e!==Xe&&!U&&(i.stencilMask(Xe),_e=Xe)},setFunc:function(Xe,_t,sn){(te!==Xe||Te!==_t||ie!==sn)&&(i.stencilFunc(Xe,_t,sn),te=Xe,Te=_t,ie=sn)},setOp:function(Xe,_t,sn){(Z!==Xe||we!==_t||ne!==sn)&&(i.stencilOp(Xe,_t,sn),Z=Xe,we=_t,ne=sn)},setLocked:function(Xe){U=Xe},setClear:function(Xe){Je!==Xe&&(i.clearStencil(Xe),Je=Xe)},reset:function(){U=!1,_e=null,te=null,Te=null,ie=null,Z=null,we=null,ne=null,Je=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let u={},h={},f=new WeakMap,p=[],g=null,_=!1,m=null,d=null,E=null,T=null,y=null,D=null,C=null,w=new Ye(0,0,0),P=0,M=!1,x=null,b=null,O=null,F=null,k=null;const W=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let B=!1,J=0;const V=i.getParameter(i.VERSION);V.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(V)[1]),B=J>=1):V.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),B=J>=2);let le=null,ge={};const se=i.getParameter(i.SCISSOR_BOX),ke=i.getParameter(i.VIEWPORT),je=new et().fromArray(se),$=new et().fromArray(ke);function ue(U,_e,te,Te){const ie=new Uint8Array(4),Z=i.createTexture();i.bindTexture(U,Z),i.texParameteri(U,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(U,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let we=0;we<te;we++)U===i.TEXTURE_3D||U===i.TEXTURE_2D_ARRAY?i.texImage3D(_e,0,i.RGBA,1,1,Te,0,i.RGBA,i.UNSIGNED_BYTE,ie):i.texImage2D(_e+we,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,ie);return Z}const Le={};Le[i.TEXTURE_2D]=ue(i.TEXTURE_2D,i.TEXTURE_2D,1),Le[i.TEXTURE_CUBE_MAP]=ue(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Le[i.TEXTURE_2D_ARRAY]=ue(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Le[i.TEXTURE_3D]=ue(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ye(i.DEPTH_TEST),a.setFunc(Vi),ce(!1),de(il),ye(i.CULL_FACE),A(Kn);function ye(U){u[U]!==!0&&(i.enable(U),u[U]=!0)}function Ue(U){u[U]!==!1&&(i.disable(U),u[U]=!1)}function tt(U,_e){return h[U]!==_e?(i.bindFramebuffer(U,_e),h[U]=_e,U===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=_e),U===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=_e),!0):!1}function ze(U,_e){let te=p,Te=!1;if(U){te=f.get(_e),te===void 0&&(te=[],f.set(_e,te));const ie=U.textures;if(te.length!==ie.length||te[0]!==i.COLOR_ATTACHMENT0){for(let Z=0,we=ie.length;Z<we;Z++)te[Z]=i.COLOR_ATTACHMENT0+Z;te.length=ie.length,Te=!0}}else te[0]!==i.BACK&&(te[0]=i.BACK,Te=!0);Te&&i.drawBuffers(te)}function ft(U){return g!==U?(i.useProgram(U),g=U,!0):!1}const K={[ci]:i.FUNC_ADD,[kh]:i.FUNC_SUBTRACT,[Vh]:i.FUNC_REVERSE_SUBTRACT};K[Hh]=i.MIN,K[Gh]=i.MAX;const re={[Wh]:i.ZERO,[Xh]:i.ONE,[qh]:i.SRC_COLOR,[Ua]:i.SRC_ALPHA,[Zh]:i.SRC_ALPHA_SATURATE,[$h]:i.DST_COLOR,[Kh]:i.DST_ALPHA,[Yh]:i.ONE_MINUS_SRC_COLOR,[Ia]:i.ONE_MINUS_SRC_ALPHA,[Jh]:i.ONE_MINUS_DST_COLOR,[jh]:i.ONE_MINUS_DST_ALPHA,[Qh]:i.CONSTANT_COLOR,[ef]:i.ONE_MINUS_CONSTANT_COLOR,[tf]:i.CONSTANT_ALPHA,[nf]:i.ONE_MINUS_CONSTANT_ALPHA};function A(U,_e,te,Te,ie,Z,we,ne,Je,Xe){if(U===Kn){_===!0&&(Ue(i.BLEND),_=!1);return}if(_===!1&&(ye(i.BLEND),_=!0),U!==zh){if(U!==m||Xe!==M){if((d!==ci||y!==ci)&&(i.blendEquation(i.FUNC_ADD),d=ci,y=ci),Xe)switch(U){case Bi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case rl:i.blendFunc(i.ONE,i.ONE);break;case sl:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case al:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}else switch(U){case Bi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case rl:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case sl:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case al:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",U);break}E=null,T=null,D=null,C=null,w.set(0,0,0),P=0,m=U,M=Xe}return}ie=ie||_e,Z=Z||te,we=we||Te,(_e!==d||ie!==y)&&(i.blendEquationSeparate(K[_e],K[ie]),d=_e,y=ie),(te!==E||Te!==T||Z!==D||we!==C)&&(i.blendFuncSeparate(re[te],re[Te],re[Z],re[we]),E=te,T=Te,D=Z,C=we),(ne.equals(w)===!1||Je!==P)&&(i.blendColor(ne.r,ne.g,ne.b,Je),w.copy(ne),P=Je),m=U,M=!1}function De(U,_e){U.side===_n?Ue(i.CULL_FACE):ye(i.CULL_FACE);let te=U.side===kt;_e&&(te=!te),ce(te),U.blending===Bi&&U.transparent===!1?A(Kn):A(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.blendColor,U.blendAlpha,U.premultipliedAlpha),a.setFunc(U.depthFunc),a.setTest(U.depthTest),a.setMask(U.depthWrite),s.setMask(U.colorWrite);const Te=U.stencilWrite;o.setTest(Te),Te&&(o.setMask(U.stencilWriteMask),o.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),o.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),be(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?ye(i.SAMPLE_ALPHA_TO_COVERAGE):Ue(i.SAMPLE_ALPHA_TO_COVERAGE)}function ce(U){x!==U&&(U?i.frontFace(i.CW):i.frontFace(i.CCW),x=U)}function de(U){U!==Oh?(ye(i.CULL_FACE),U!==b&&(U===il?i.cullFace(i.BACK):U===Bh?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Ue(i.CULL_FACE),b=U}function X(U){U!==O&&(B&&i.lineWidth(U),O=U)}function be(U,_e,te){U?(ye(i.POLYGON_OFFSET_FILL),(F!==_e||k!==te)&&(i.polygonOffset(_e,te),F=_e,k=te)):Ue(i.POLYGON_OFFSET_FILL)}function Se(U){U?ye(i.SCISSOR_TEST):Ue(i.SCISSOR_TEST)}function pe(U){U===void 0&&(U=i.TEXTURE0+W-1),le!==U&&(i.activeTexture(U),le=U)}function Qe(U,_e,te){te===void 0&&(le===null?te=i.TEXTURE0+W-1:te=le);let Te=ge[te];Te===void 0&&(Te={type:void 0,texture:void 0},ge[te]=Te),(Te.type!==U||Te.texture!==_e)&&(le!==te&&(i.activeTexture(te),le=te),i.bindTexture(U,_e||Le[U]),Te.type=U,Te.texture=_e)}function R(){const U=ge[le];U!==void 0&&U.type!==void 0&&(i.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function v(){try{i.compressedTexImage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function z(){try{i.compressedTexImage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function j(){try{i.texSubImage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Q(){try{i.texSubImage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function q(){try{i.compressedTexSubImage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Re(){try{i.compressedTexSubImage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function oe(){try{i.texStorage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Me(){try{i.texStorage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Pe(){try{i.texImage2D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function ee(){try{i.texImage3D(...arguments)}catch(U){console.error("THREE.WebGLState:",U)}}function Ee(U){je.equals(U)===!1&&(i.scissor(U.x,U.y,U.z,U.w),je.copy(U))}function Fe(U){$.equals(U)===!1&&(i.viewport(U.x,U.y,U.z,U.w),$.copy(U))}function Ne(U,_e){let te=c.get(_e);te===void 0&&(te=new WeakMap,c.set(_e,te));let Te=te.get(U);Te===void 0&&(Te=i.getUniformBlockIndex(_e,U.name),te.set(U,Te))}function fe(U,_e){const Te=c.get(_e).get(U);l.get(_e)!==Te&&(i.uniformBlockBinding(_e,Te,U.__bindingPointIndex),l.set(_e,Te))}function Ve(){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),u={},le=null,ge={},h={},f=new WeakMap,p=[],g=null,_=!1,m=null,d=null,E=null,T=null,y=null,D=null,C=null,w=new Ye(0,0,0),P=0,M=!1,x=null,b=null,O=null,F=null,k=null,je.set(0,0,i.canvas.width,i.canvas.height),$.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ye,disable:Ue,bindFramebuffer:tt,drawBuffers:ze,useProgram:ft,setBlending:A,setMaterial:De,setFlipSided:ce,setCullFace:de,setLineWidth:X,setPolygonOffset:be,setScissorTest:Se,activeTexture:pe,bindTexture:Qe,unbindTexture:R,compressedTexImage2D:v,compressedTexImage3D:z,texImage2D:Pe,texImage3D:ee,updateUBOMapping:Ne,uniformBlockBinding:fe,texStorage2D:oe,texStorage3D:Me,texSubImage2D:j,texSubImage3D:Q,compressedTexSubImage2D:q,compressedTexSubImage3D:Re,scissor:Ee,viewport:Fe,reset:Ve}}function Dv(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 We,u=new WeakMap;let h;const f=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(R,v){return p?new OffscreenCanvas(R,v):Tr("canvas")}function _(R,v,z){let j=1;const Q=Qe(R);if((Q.width>z||Q.height>z)&&(j=z/Math.max(Q.width,Q.height)),j<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const q=Math.floor(j*Q.width),Re=Math.floor(j*Q.height);h===void 0&&(h=g(q,Re));const oe=v?g(q,Re):h;return oe.width=q,oe.height=Re,oe.getContext("2d").drawImage(R,0,0,q,Re),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Q.width+"x"+Q.height+") to ("+q+"x"+Re+")."),oe}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Q.width+"x"+Q.height+")."),R;return R}function m(R){return R.generateMipmaps}function d(R){i.generateMipmap(R)}function E(R){return R.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?i.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function T(R,v,z,j,Q=!1){if(R!==null){if(i[R]!==void 0)return i[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let q=v;if(v===i.RED&&(z===i.FLOAT&&(q=i.R32F),z===i.HALF_FLOAT&&(q=i.R16F),z===i.UNSIGNED_BYTE&&(q=i.R8)),v===i.RED_INTEGER&&(z===i.UNSIGNED_BYTE&&(q=i.R8UI),z===i.UNSIGNED_SHORT&&(q=i.R16UI),z===i.UNSIGNED_INT&&(q=i.R32UI),z===i.BYTE&&(q=i.R8I),z===i.SHORT&&(q=i.R16I),z===i.INT&&(q=i.R32I)),v===i.RG&&(z===i.FLOAT&&(q=i.RG32F),z===i.HALF_FLOAT&&(q=i.RG16F),z===i.UNSIGNED_BYTE&&(q=i.RG8)),v===i.RG_INTEGER&&(z===i.UNSIGNED_BYTE&&(q=i.RG8UI),z===i.UNSIGNED_SHORT&&(q=i.RG16UI),z===i.UNSIGNED_INT&&(q=i.RG32UI),z===i.BYTE&&(q=i.RG8I),z===i.SHORT&&(q=i.RG16I),z===i.INT&&(q=i.RG32I)),v===i.RGB_INTEGER&&(z===i.UNSIGNED_BYTE&&(q=i.RGB8UI),z===i.UNSIGNED_SHORT&&(q=i.RGB16UI),z===i.UNSIGNED_INT&&(q=i.RGB32UI),z===i.BYTE&&(q=i.RGB8I),z===i.SHORT&&(q=i.RGB16I),z===i.INT&&(q=i.RGB32I)),v===i.RGBA_INTEGER&&(z===i.UNSIGNED_BYTE&&(q=i.RGBA8UI),z===i.UNSIGNED_SHORT&&(q=i.RGBA16UI),z===i.UNSIGNED_INT&&(q=i.RGBA32UI),z===i.BYTE&&(q=i.RGBA8I),z===i.SHORT&&(q=i.RGBA16I),z===i.INT&&(q=i.RGBA32I)),v===i.RGB&&z===i.UNSIGNED_INT_5_9_9_9_REV&&(q=i.RGB9_E5),v===i.RGBA){const Re=Q?Ps:it.getTransfer(j);z===i.FLOAT&&(q=i.RGBA32F),z===i.HALF_FLOAT&&(q=i.RGBA16F),z===i.UNSIGNED_BYTE&&(q=Re===ut?i.SRGB8_ALPHA8:i.RGBA8),z===i.UNSIGNED_SHORT_4_4_4_4&&(q=i.RGBA4),z===i.UNSIGNED_SHORT_5_5_5_1&&(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function y(R,v){let z;return R?v===null||v===di||v===Mr?z=i.DEPTH24_STENCIL8:v===yn?z=i.DEPTH32F_STENCIL8:v===Sr&&(z=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===di||v===Mr?z=i.DEPTH_COMPONENT24:v===yn?z=i.DEPTH_COMPONENT32F:v===Sr&&(z=i.DEPTH_COMPONENT16),z}function D(R,v){return m(R)===!0||R.isFramebufferTexture&&R.minFilter!==$t&&R.minFilter!==jt?Math.log2(Math.max(v.width,v.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?v.mipmaps.length:1}function C(R){const v=R.target;v.removeEventListener("dispose",C),P(v),v.isVideoTexture&&u.delete(v)}function w(R){const v=R.target;v.removeEventListener("dispose",w),x(v)}function P(R){const v=n.get(R);if(v.__webglInit===void 0)return;const z=R.source,j=f.get(z);if(j){const Q=j[v.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&M(R),Object.keys(j).length===0&&f.delete(z)}n.remove(R)}function M(R){const v=n.get(R);i.deleteTexture(v.__webglTexture);const z=R.source,j=f.get(z);delete j[v.__cacheKey],a.memory.textures--}function x(R){const v=n.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),n.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let j=0;j<6;j++){if(Array.isArray(v.__webglFramebuffer[j]))for(let Q=0;Q<v.__webglFramebuffer[j].length;Q++)i.deleteFramebuffer(v.__webglFramebuffer[j][Q]);else i.deleteFramebuffer(v.__webglFramebuffer[j]);v.__webglDepthbuffer&&i.deleteRenderbuffer(v.__webglDepthbuffer[j])}else{if(Array.isArray(v.__webglFramebuffer))for(let j=0;j<v.__webglFramebuffer.length;j++)i.deleteFramebuffer(v.__webglFramebuffer[j]);else i.deleteFramebuffer(v.__webglFramebuffer);if(v.__webglDepthbuffer&&i.deleteRenderbuffer(v.__webglDepthbuffer),v.__webglMultisampledFramebuffer&&i.deleteFramebuffer(v.__webglMultisampledFramebuffer),v.__webglColorRenderbuffer)for(let j=0;j<v.__webglColorRenderbuffer.length;j++)v.__webglColorRenderbuffer[j]&&i.deleteRenderbuffer(v.__webglColorRenderbuffer[j]);v.__webglDepthRenderbuffer&&i.deleteRenderbuffer(v.__webglDepthRenderbuffer)}const z=R.textures;for(let j=0,Q=z.length;j<Q;j++){const q=n.get(z[j]);q.__webglTexture&&(i.deleteTexture(q.__webglTexture),a.memory.textures--),n.remove(z[j])}n.remove(R)}let b=0;function O(){b=0}function F(){const R=b;return R>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+r.maxTextures),b+=1,R}function k(R){const v=[];return v.push(R.wrapS),v.push(R.wrapT),v.push(R.wrapR||0),v.push(R.magFilter),v.push(R.minFilter),v.push(R.anisotropy),v.push(R.internalFormat),v.push(R.format),v.push(R.type),v.push(R.generateMipmaps),v.push(R.premultiplyAlpha),v.push(R.flipY),v.push(R.unpackAlignment),v.push(R.colorSpace),v.join()}function W(R,v){const z=n.get(R);if(R.isVideoTexture&&Se(R),R.isRenderTargetTexture===!1&&R.version>0&&z.__version!==R.version){const j=R.image;if(j===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(j.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Le(z,R,v);return}}t.bindTexture(i.TEXTURE_2D,z.__webglTexture,i.TEXTURE0+v)}function B(R,v){const z=n.get(R);if(R.version>0&&z.__version!==R.version){Le(z,R,v);return}t.bindTexture(i.TEXTURE_2D_ARRAY,z.__webglTexture,i.TEXTURE0+v)}function J(R,v){const z=n.get(R);if(R.version>0&&z.__version!==R.version){Le(z,R,v);return}t.bindTexture(i.TEXTURE_3D,z.__webglTexture,i.TEXTURE0+v)}function V(R,v){const z=n.get(R);if(R.version>0&&z.__version!==R.version){ye(z,R,v);return}t.bindTexture(i.TEXTURE_CUBE_MAP,z.__webglTexture,i.TEXTURE0+v)}const le={[Wi]:i.REPEAT,[xn]:i.CLAMP_TO_EDGE,[Wa]:i.MIRRORED_REPEAT},ge={[$t]:i.NEAREST,[df]:i.NEAREST_MIPMAP_NEAREST,[Fr]:i.NEAREST_MIPMAP_LINEAR,[jt]:i.LINEAR,[Ys]:i.LINEAR_MIPMAP_NEAREST,[Ln]:i.LINEAR_MIPMAP_LINEAR},se={[vf]:i.NEVER,[bf]:i.ALWAYS,[xf]:i.LESS,[ru]:i.LEQUAL,[yf]:i.EQUAL,[Ef]:i.GEQUAL,[Sf]:i.GREATER,[Mf]:i.NOTEQUAL};function ke(R,v){if(v.type===yn&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===jt||v.magFilter===Ys||v.magFilter===Fr||v.magFilter===Ln||v.minFilter===jt||v.minFilter===Ys||v.minFilter===Fr||v.minFilter===Ln)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(R,i.TEXTURE_WRAP_S,le[v.wrapS]),i.texParameteri(R,i.TEXTURE_WRAP_T,le[v.wrapT]),(R===i.TEXTURE_3D||R===i.TEXTURE_2D_ARRAY)&&i.texParameteri(R,i.TEXTURE_WRAP_R,le[v.wrapR]),i.texParameteri(R,i.TEXTURE_MAG_FILTER,ge[v.magFilter]),i.texParameteri(R,i.TEXTURE_MIN_FILTER,ge[v.minFilter]),v.compareFunction&&(i.texParameteri(R,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(R,i.TEXTURE_COMPARE_FUNC,se[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===$t||v.minFilter!==Fr&&v.minFilter!==Ln||v.type===yn&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const z=e.get("EXT_texture_filter_anisotropic");i.texParameterf(R,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function je(R,v){let z=!1;R.__webglInit===void 0&&(R.__webglInit=!0,v.addEventListener("dispose",C));const j=v.source;let Q=f.get(j);Q===void 0&&(Q={},f.set(j,Q));const q=k(v);if(q!==R.__cacheKey){Q[q]===void 0&&(Q[q]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,z=!0),Q[q].usedTimes++;const Re=Q[R.__cacheKey];Re!==void 0&&(Q[R.__cacheKey].usedTimes--,Re.usedTimes===0&&M(v)),R.__cacheKey=q,R.__webglTexture=Q[q].texture}return z}function $(R,v,z){return Math.floor(Math.floor(R/z)/v)}function ue(R,v,z,j){const q=R.updateRanges;if(q.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,v.width,v.height,z,j,v.data);else{q.sort((ee,Ee)=>ee.start-Ee.start);let Re=0;for(let ee=1;ee<q.length;ee++){const Ee=q[Re],Fe=q[ee],Ne=Ee.start+Ee.count,fe=$(Fe.start,v.width,4),Ve=$(Ee.start,v.width,4);Fe.start<=Ne+1&&fe===Ve&&$(Fe.start+Fe.count-1,v.width,4)===fe?Ee.count=Math.max(Ee.count,Fe.start+Fe.count-Ee.start):(++Re,q[Re]=Fe)}q.length=Re+1;const oe=i.getParameter(i.UNPACK_ROW_LENGTH),Me=i.getParameter(i.UNPACK_SKIP_PIXELS),Pe=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,v.width);for(let ee=0,Ee=q.length;ee<Ee;ee++){const Fe=q[ee],Ne=Math.floor(Fe.start/4),fe=Math.ceil(Fe.count/4),Ve=Ne%v.width,U=Math.floor(Ne/v.width),_e=fe,te=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,Ve),i.pixelStorei(i.UNPACK_SKIP_ROWS,U),t.texSubImage2D(i.TEXTURE_2D,0,Ve,U,_e,te,z,j,v.data)}R.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,oe),i.pixelStorei(i.UNPACK_SKIP_PIXELS,Me),i.pixelStorei(i.UNPACK_SKIP_ROWS,Pe)}}function Le(R,v,z){let j=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(j=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(j=i.TEXTURE_3D);const Q=je(R,v),q=v.source;t.bindTexture(j,R.__webglTexture,i.TEXTURE0+z);const Re=n.get(q);if(q.version!==Re.__version||Q===!0){t.activeTexture(i.TEXTURE0+z);const oe=it.getPrimaries(it.workingColorSpace),Me=v.colorSpace===Yn?null:it.getPrimaries(v.colorSpace),Pe=v.colorSpace===Yn||oe===Me?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Pe);let ee=_(v.image,!1,r.maxTextureSize);ee=pe(v,ee);const Ee=s.convert(v.format,v.colorSpace),Fe=s.convert(v.type);let Ne=T(v.internalFormat,Ee,Fe,v.colorSpace,v.isVideoTexture);ke(j,v);let fe;const Ve=v.mipmaps,U=v.isVideoTexture!==!0,_e=Re.__version===void 0||Q===!0,te=q.dataReady,Te=D(v,ee);if(v.isDepthTexture)Ne=y(v.format===br,v.type),_e&&(U?t.texStorage2D(i.TEXTURE_2D,1,Ne,ee.width,ee.height):t.texImage2D(i.TEXTURE_2D,0,Ne,ee.width,ee.height,0,Ee,Fe,null));else if(v.isDataTexture)if(Ve.length>0){U&&_e&&t.texStorage2D(i.TEXTURE_2D,Te,Ne,Ve[0].width,Ve[0].height);for(let ie=0,Z=Ve.length;ie<Z;ie++)fe=Ve[ie],U?te&&t.texSubImage2D(i.TEXTURE_2D,ie,0,0,fe.width,fe.height,Ee,Fe,fe.data):t.texImage2D(i.TEXTURE_2D,ie,Ne,fe.width,fe.height,0,Ee,Fe,fe.data);v.generateMipmaps=!1}else U?(_e&&t.texStorage2D(i.TEXTURE_2D,Te,Ne,ee.width,ee.height),te&&ue(v,ee,Ee,Fe)):t.texImage2D(i.TEXTURE_2D,0,Ne,ee.width,ee.height,0,Ee,Fe,ee.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){U&&_e&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Te,Ne,Ve[0].width,Ve[0].height,ee.depth);for(let ie=0,Z=Ve.length;ie<Z;ie++)if(fe=Ve[ie],v.format!==rn)if(Ee!==null)if(U){if(te)if(v.layerUpdates.size>0){const we=ec(fe.width,fe.height,v.format,v.type);for(const ne of v.layerUpdates){const Je=fe.data.subarray(ne*we/fe.data.BYTES_PER_ELEMENT,(ne+1)*we/fe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ie,0,0,ne,fe.width,fe.height,1,Ee,Je)}v.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ie,0,0,0,fe.width,fe.height,ee.depth,Ee,fe.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,ie,Ne,fe.width,fe.height,ee.depth,0,fe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else U?te&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,ie,0,0,0,fe.width,fe.height,ee.depth,Ee,Fe,fe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,ie,Ne,fe.width,fe.height,ee.depth,0,Ee,Fe,fe.data)}else{U&&_e&&t.texStorage2D(i.TEXTURE_2D,Te,Ne,Ve[0].width,Ve[0].height);for(let ie=0,Z=Ve.length;ie<Z;ie++)fe=Ve[ie],v.format!==rn?Ee!==null?U?te&&t.compressedTexSubImage2D(i.TEXTURE_2D,ie,0,0,fe.width,fe.height,Ee,fe.data):t.compressedTexImage2D(i.TEXTURE_2D,ie,Ne,fe.width,fe.height,0,fe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):U?te&&t.texSubImage2D(i.TEXTURE_2D,ie,0,0,fe.width,fe.height,Ee,Fe,fe.data):t.texImage2D(i.TEXTURE_2D,ie,Ne,fe.width,fe.height,0,Ee,Fe,fe.data)}else if(v.isDataArrayTexture)if(U){if(_e&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Te,Ne,ee.width,ee.height,ee.depth),te)if(v.layerUpdates.size>0){const ie=ec(ee.width,ee.height,v.format,v.type);for(const Z of v.layerUpdates){const we=ee.data.subarray(Z*ie/ee.data.BYTES_PER_ELEMENT,(Z+1)*ie/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Z,ee.width,ee.height,1,Ee,Fe,we)}v.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,Ee,Fe,ee.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ne,ee.width,ee.height,ee.depth,0,Ee,Fe,ee.data);else if(v.isData3DTexture)U?(_e&&t.texStorage3D(i.TEXTURE_3D,Te,Ne,ee.width,ee.height,ee.depth),te&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,Ee,Fe,ee.data)):t.texImage3D(i.TEXTURE_3D,0,Ne,ee.width,ee.height,ee.depth,0,Ee,Fe,ee.data);else if(v.isFramebufferTexture){if(_e)if(U)t.texStorage2D(i.TEXTURE_2D,Te,Ne,ee.width,ee.height);else{let ie=ee.width,Z=ee.height;for(let we=0;we<Te;we++)t.texImage2D(i.TEXTURE_2D,we,Ne,ie,Z,0,Ee,Fe,null),ie>>=1,Z>>=1}}else if(Ve.length>0){if(U&&_e){const ie=Qe(Ve[0]);t.texStorage2D(i.TEXTURE_2D,Te,Ne,ie.width,ie.height)}for(let ie=0,Z=Ve.length;ie<Z;ie++)fe=Ve[ie],U?te&&t.texSubImage2D(i.TEXTURE_2D,ie,0,0,Ee,Fe,fe):t.texImage2D(i.TEXTURE_2D,ie,Ne,Ee,Fe,fe);v.generateMipmaps=!1}else if(U){if(_e){const ie=Qe(ee);t.texStorage2D(i.TEXTURE_2D,Te,Ne,ie.width,ie.height)}te&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Ee,Fe,ee)}else t.texImage2D(i.TEXTURE_2D,0,Ne,Ee,Fe,ee);m(v)&&d(j),Re.__version=q.version,v.onUpdate&&v.onUpdate(v)}R.__version=v.version}function ye(R,v,z){if(v.image.length!==6)return;const j=je(R,v),Q=v.source;t.bindTexture(i.TEXTURE_CUBE_MAP,R.__webglTexture,i.TEXTURE0+z);const q=n.get(Q);if(Q.version!==q.__version||j===!0){t.activeTexture(i.TEXTURE0+z);const Re=it.getPrimaries(it.workingColorSpace),oe=v.colorSpace===Yn?null:it.getPrimaries(v.colorSpace),Me=v.colorSpace===Yn||Re===oe?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);const Pe=v.isCompressedTexture||v.image[0].isCompressedTexture,ee=v.image[0]&&v.image[0].isDataTexture,Ee=[];for(let Z=0;Z<6;Z++)!Pe&&!ee?Ee[Z]=_(v.image[Z],!0,r.maxCubemapSize):Ee[Z]=ee?v.image[Z].image:v.image[Z],Ee[Z]=pe(v,Ee[Z]);const Fe=Ee[0],Ne=s.convert(v.format,v.colorSpace),fe=s.convert(v.type),Ve=T(v.internalFormat,Ne,fe,v.colorSpace),U=v.isVideoTexture!==!0,_e=q.__version===void 0||j===!0,te=Q.dataReady;let Te=D(v,Fe);ke(i.TEXTURE_CUBE_MAP,v);let ie;if(Pe){U&&_e&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Te,Ve,Fe.width,Fe.height);for(let Z=0;Z<6;Z++){ie=Ee[Z].mipmaps;for(let we=0;we<ie.length;we++){const ne=ie[we];v.format!==rn?Ne!==null?U?te&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we,0,0,ne.width,ne.height,Ne,ne.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we,Ve,ne.width,ne.height,0,ne.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we,0,0,ne.width,ne.height,Ne,fe,ne.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we,Ve,ne.width,ne.height,0,Ne,fe,ne.data)}}}else{if(ie=v.mipmaps,U&&_e){ie.length>0&&Te++;const Z=Qe(Ee[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Te,Ve,Z.width,Z.height)}for(let Z=0;Z<6;Z++)if(ee){U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,Ee[Z].width,Ee[Z].height,Ne,fe,Ee[Z].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,Ve,Ee[Z].width,Ee[Z].height,0,Ne,fe,Ee[Z].data);for(let we=0;we<ie.length;we++){const Je=ie[we].image[Z].image;U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we+1,0,0,Je.width,Je.height,Ne,fe,Je.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we+1,Ve,Je.width,Je.height,0,Ne,fe,Je.data)}}else{U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,Ne,fe,Ee[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,Ve,Ne,fe,Ee[Z]);for(let we=0;we<ie.length;we++){const ne=ie[we];U?te&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we+1,0,0,Ne,fe,ne.image[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,we+1,Ve,Ne,fe,ne.image[Z])}}}m(v)&&d(i.TEXTURE_CUBE_MAP),q.__version=Q.version,v.onUpdate&&v.onUpdate(v)}R.__version=v.version}function Ue(R,v,z,j,Q,q){const Re=s.convert(z.format,z.colorSpace),oe=s.convert(z.type),Me=T(z.internalFormat,Re,oe,z.colorSpace),Pe=n.get(v),ee=n.get(z);if(ee.__renderTarget=v,!Pe.__hasExternalTextures){const Ee=Math.max(1,v.width>>q),Fe=Math.max(1,v.height>>q);Q===i.TEXTURE_3D||Q===i.TEXTURE_2D_ARRAY?t.texImage3D(Q,q,Me,Ee,Fe,v.depth,0,Re,oe,null):t.texImage2D(Q,q,Me,Ee,Fe,0,Re,oe,null)}t.bindFramebuffer(i.FRAMEBUFFER,R),be(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,j,Q,ee.__webglTexture,0,X(v)):(Q===i.TEXTURE_2D||Q>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Q<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,j,Q,ee.__webglTexture,q),t.bindFramebuffer(i.FRAMEBUFFER,null)}function tt(R,v,z){if(i.bindRenderbuffer(i.RENDERBUFFER,R),v.depthBuffer){const j=v.depthTexture,Q=j&&j.isDepthTexture?j.type:null,q=y(v.stencilBuffer,Q),Re=v.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=X(v);be(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,oe,q,v.width,v.height):z?i.renderbufferStorageMultisample(i.RENDERBUFFER,oe,q,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,q,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Re,i.RENDERBUFFER,R)}else{const j=v.textures;for(let Q=0;Q<j.length;Q++){const q=j[Q],Re=s.convert(q.format,q.colorSpace),oe=s.convert(q.type),Me=T(q.internalFormat,Re,oe,q.colorSpace),Pe=X(v);z&&be(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Pe,Me,v.width,v.height):be(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Pe,Me,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,Me,v.width,v.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ze(R,v){if(v&&v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,R),!(v.depthTexture&&v.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const j=n.get(v.depthTexture);j.__renderTarget=v,(!j.__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)&&(v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0),W(v.depthTexture,0);const Q=j.__webglTexture,q=X(v);if(v.depthTexture.format===Er)be(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Q,0,q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Q,0);else if(v.depthTexture.format===br)be(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Q,0,q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Q,0);else throw new Error("Unknown depthTexture format")}function ft(R){const v=n.get(R),z=R.isWebGLCubeRenderTarget===!0;if(v.__boundDepthTexture!==R.depthTexture){const j=R.depthTexture;if(v.__depthDisposeCallback&&v.__depthDisposeCallback(),j){const Q=()=>{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,j.removeEventListener("dispose",Q)};j.addEventListener("dispose",Q),v.__depthDisposeCallback=Q}v.__boundDepthTexture=j}if(R.depthTexture&&!v.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");const j=R.texture.mipmaps;j&&j.length>0?ze(v.__webglFramebuffer[0],R):ze(v.__webglFramebuffer,R)}else if(z){v.__webglDepthbuffer=[];for(let j=0;j<6;j++)if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[j]),v.__webglDepthbuffer[j]===void 0)v.__webglDepthbuffer[j]=i.createRenderbuffer(),tt(v.__webglDepthbuffer[j],R,!1);else{const Q=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=v.__webglDepthbuffer[j];i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,Q,i.RENDERBUFFER,q)}}else{const j=R.texture.mipmaps;if(j&&j.length>0?t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=i.createRenderbuffer(),tt(v.__webglDepthbuffer,R,!1);else{const Q=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=v.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,Q,i.RENDERBUFFER,q)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function K(R,v,z){const j=n.get(R);v!==void 0&&Ue(j.__webglFramebuffer,R,R.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),z!==void 0&&ft(R)}function re(R){const v=R.texture,z=n.get(R),j=n.get(v);R.addEventListener("dispose",w);const Q=R.textures,q=R.isWebGLCubeRenderTarget===!0,Re=Q.length>1;if(Re||(j.__webglTexture===void 0&&(j.__webglTexture=i.createTexture()),j.__version=v.version,a.memory.textures++),q){z.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(v.mipmaps&&v.mipmaps.length>0){z.__webglFramebuffer[oe]=[];for(let Me=0;Me<v.mipmaps.length;Me++)z.__webglFramebuffer[oe][Me]=i.createFramebuffer()}else z.__webglFramebuffer[oe]=i.createFramebuffer()}else{if(v.mipmaps&&v.mipmaps.length>0){z.__webglFramebuffer=[];for(let oe=0;oe<v.mipmaps.length;oe++)z.__webglFramebuffer[oe]=i.createFramebuffer()}else z.__webglFramebuffer=i.createFramebuffer();if(Re)for(let oe=0,Me=Q.length;oe<Me;oe++){const Pe=n.get(Q[oe]);Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture(),a.memory.textures++)}if(R.samples>0&&be(R)===!1){z.__webglMultisampledFramebuffer=i.createFramebuffer(),z.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let oe=0;oe<Q.length;oe++){const Me=Q[oe];z.__webglColorRenderbuffer[oe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,z.__webglColorRenderbuffer[oe]);const Pe=s.convert(Me.format,Me.colorSpace),ee=s.convert(Me.type),Ee=T(Me.internalFormat,Pe,ee,Me.colorSpace,R.isXRRenderTarget===!0),Fe=X(R);i.renderbufferStorageMultisample(i.RENDERBUFFER,Fe,Ee,R.width,R.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+oe,i.RENDERBUFFER,z.__webglColorRenderbuffer[oe])}i.bindRenderbuffer(i.RENDERBUFFER,null),R.depthBuffer&&(z.__webglDepthRenderbuffer=i.createRenderbuffer(),tt(z.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(q){t.bindTexture(i.TEXTURE_CUBE_MAP,j.__webglTexture),ke(i.TEXTURE_CUBE_MAP,v);for(let oe=0;oe<6;oe++)if(v.mipmaps&&v.mipmaps.length>0)for(let Me=0;Me<v.mipmaps.length;Me++)Ue(z.__webglFramebuffer[oe][Me],R,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+oe,Me);else Ue(z.__webglFramebuffer[oe],R,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0);m(v)&&d(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Re){for(let oe=0,Me=Q.length;oe<Me;oe++){const Pe=Q[oe],ee=n.get(Pe);t.bindTexture(i.TEXTURE_2D,ee.__webglTexture),ke(i.TEXTURE_2D,Pe),Ue(z.__webglFramebuffer,R,Pe,i.COLOR_ATTACHMENT0+oe,i.TEXTURE_2D,0),m(Pe)&&d(i.TEXTURE_2D)}t.unbindTexture()}else{let oe=i.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(oe=R.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(oe,j.__webglTexture),ke(oe,v),v.mipmaps&&v.mipmaps.length>0)for(let Me=0;Me<v.mipmaps.length;Me++)Ue(z.__webglFramebuffer[Me],R,v,i.COLOR_ATTACHMENT0,oe,Me);else Ue(z.__webglFramebuffer,R,v,i.COLOR_ATTACHMENT0,oe,0);m(v)&&d(oe),t.unbindTexture()}R.depthBuffer&&ft(R)}function A(R){const v=R.textures;for(let z=0,j=v.length;z<j;z++){const Q=v[z];if(m(Q)){const q=E(R),Re=n.get(Q).__webglTexture;t.bindTexture(q,Re),d(q),t.unbindTexture()}}}const De=[],ce=[];function de(R){if(R.samples>0){if(be(R)===!1){const v=R.textures,z=R.width,j=R.height;let Q=i.COLOR_BUFFER_BIT;const q=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Re=n.get(R),oe=v.length>1;if(oe)for(let Pe=0;Pe<v.length;Pe++)t.bindFramebuffer(i.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pe,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pe,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer);const Me=R.texture.mipmaps;Me&&Me.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Re.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let Pe=0;Pe<v.length;Pe++){if(R.resolveDepthBuffer&&(R.depthBuffer&&(Q|=i.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&(Q|=i.STENCIL_BUFFER_BIT)),oe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Re.__webglColorRenderbuffer[Pe]);const ee=n.get(v[Pe]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,ee,0)}i.blitFramebuffer(0,0,z,j,0,0,z,j,Q,i.NEAREST),l===!0&&(De.length=0,ce.length=0,De.push(i.COLOR_ATTACHMENT0+Pe),R.depthBuffer&&R.resolveDepthBuffer===!1&&(De.push(q),ce.push(q),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ce)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,De))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),oe)for(let Pe=0;Pe<v.length;Pe++){t.bindFramebuffer(i.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pe,i.RENDERBUFFER,Re.__webglColorRenderbuffer[Pe]);const ee=n.get(v[Pe]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pe,i.TEXTURE_2D,ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.resolveDepthBuffer===!1&&l){const v=R.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[v])}}}function X(R){return Math.min(r.maxSamples,R.samples)}function be(R){const v=n.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Se(R){const v=a.render.frame;u.get(R)!==v&&(u.set(R,v),R.update())}function pe(R,v){const z=R.colorSpace,j=R.format,Q=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||z!==Xi&&z!==Yn&&(it.getTransfer(z)===ut?(j!==rn||Q!==Mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),v}function Qe(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=F,this.resetTextureUnits=O,this.setTexture2D=W,this.setTexture2DArray=B,this.setTexture3D=J,this.setTextureCube=V,this.rebindTextures=K,this.setupRenderTarget=re,this.updateRenderTargetMipmap=A,this.updateMultisampleRenderTarget=de,this.setupDepthRenderbuffer=ft,this.setupFrameBufferTexture=Ue,this.useMultisampledRTT=be}function Pv(i,e){function t(n,r=Yn){let s;const a=it.getTransfer(r);if(n===Mn)return i.UNSIGNED_BYTE;if(n===Uo)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Io)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Zc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===$c)return i.BYTE;if(n===Jc)return i.SHORT;if(n===Sr)return i.UNSIGNED_SHORT;if(n===Lo)return i.INT;if(n===di)return i.UNSIGNED_INT;if(n===yn)return i.FLOAT;if(n===Rr)return i.HALF_FLOAT;if(n===Qc)return i.ALPHA;if(n===eu)return i.RGB;if(n===rn)return i.RGBA;if(n===Er)return i.DEPTH_COMPONENT;if(n===br)return i.DEPTH_STENCIL;if(n===tu)return i.RED;if(n===No)return i.RED_INTEGER;if(n===nu)return i.RG;if(n===Fo)return i.RG_INTEGER;if(n===Oo)return i.RGBA_INTEGER;if(n===ys||n===Ss||n===Ms||n===Es)if(a===ut)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===ys)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ss)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ms)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Es)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===ys)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ss)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ms)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Es)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Xa||n===qa||n===Ya||n===Ka)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Xa)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===qa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ya)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ka)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ja||n===$a||n===Ja)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===ja||n===$a)return a===ut?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ja)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Za||n===Qa||n===eo||n===to||n===no||n===io||n===ro||n===so||n===ao||n===oo||n===lo||n===co||n===uo||n===ho)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Za)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Qa)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===eo)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===to)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===no)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===io)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ro)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===so)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ao)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===oo)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===lo)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===co)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===uo)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ho)return a===ut?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===bs||n===fo||n===po)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===bs)return a===ut?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===fo)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===po)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===iu||n===mo||n===go||n===_o)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===bs)return s.COMPRESSED_RED_RGTC1_EXT;if(n===mo)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===go)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===_o)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Mr?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Lv=`
|
|
3804
3804
|
void main() {
|
|
3805
3805
|
|
|
3806
3806
|
gl_Position = vec4( position, 1.0 );
|
|
3807
3807
|
|
|
3808
|
-
}`,
|
|
3808
|
+
}`,Uv=`
|
|
3809
3809
|
uniform sampler2DArray depthColor;
|
|
3810
3810
|
uniform float depthWidth;
|
|
3811
3811
|
uniform float depthHeight;
|
|
@@ -3824,7 +3824,7 @@ void main() {
|
|
|
3824
3824
|
|
|
3825
3825
|
}
|
|
3826
3826
|
|
|
3827
|
-
}`;class Uv{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Ct,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 On({vertexShader:Pv,fragmentShader:Lv,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Rt(new Cr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Iv extends mi{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,f=null,p=null,g=null;const _=new Uv,m=t.getContextAttributes();let d=null,E=null;const T=[],y=[],D=new We;let C=null;const w=new zt;w.viewport=new et;const P=new zt;P.viewport=new et;const M=[w,P],x=new Jd;let b=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function($){let ue=T[$];return ue===void 0&&(ue=new ma,T[$]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function($){let ue=T[$];return ue===void 0&&(ue=new ma,T[$]=ue),ue.getGripSpace()},this.getHand=function($){let ue=T[$];return ue===void 0&&(ue=new ma,T[$]=ue),ue.getHandSpace()};function F($){const ue=y.indexOf($.inputSource);if(ue===-1)return;const Le=T[ue];Le!==void 0&&(Le.update($.inputSource,$.frame,c||a),Le.dispatchEvent({type:$.type,data:$.inputSource}))}function k(){r.removeEventListener("select",F),r.removeEventListener("selectstart",F),r.removeEventListener("selectend",F),r.removeEventListener("squeeze",F),r.removeEventListener("squeezestart",F),r.removeEventListener("squeezeend",F),r.removeEventListener("end",k),r.removeEventListener("inputsourceschange",W);for(let $=0;$<T.length;$++){const ue=y[$];ue!==null&&(y[$]=null,T[$].disconnect(ue))}b=null,O=null,_.reset(),e.setRenderTarget(d),p=null,f=null,h=null,r=null,E=null,je.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(D.width,D.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function($){s=$,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function($){o=$,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function($){c=$},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function($){if(r=$,r!==null){if(d=e.getRenderTarget(),r.addEventListener("select",F),r.addEventListener("selectstart",F),r.addEventListener("selectend",F),r.addEventListener("squeeze",F),r.addEventListener("squeezestart",F),r.addEventListener("squeezeend",F),r.addEventListener("end",k),r.addEventListener("inputsourceschange",W),m.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(D),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Le=null,ye=null,Ue=null;m.depth&&(Ue=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Le=m.stencil?br:Er,ye=m.stencil?Mr:di);const tt={colorFormat:t.RGBA8,depthFormat:Ue,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(tt),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),E=new pi(f.textureWidth,f.textureHeight,{format:rn,type:Mn,depthTexture:new Mu(f.textureWidth,f.textureHeight,ye,void 0,void 0,void 0,void 0,void 0,void 0,Le),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const Le={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,Le),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),E=new pi(p.framebufferWidth,p.framebufferHeight,{format:rn,type:Mn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),je.setContext(r),je.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function W($){for(let ue=0;ue<$.removed.length;ue++){const Le=$.removed[ue],ye=y.indexOf(Le);ye>=0&&(y[ye]=null,T[ye].disconnect(Le))}for(let ue=0;ue<$.added.length;ue++){const Le=$.added[ue];let ye=y.indexOf(Le);if(ye===-1){for(let tt=0;tt<T.length;tt++)if(tt>=y.length){y.push(Le),ye=tt;break}else if(y[tt]===null){y[tt]=Le,ye=tt;break}if(ye===-1)break}const Ue=T[ye];Ue&&Ue.connect(Le)}}const B=new L,J=new L;function V($,ue,Le){B.setFromMatrixPosition(ue.matrixWorld),J.setFromMatrixPosition(Le.matrixWorld);const ye=B.distanceTo(J),Ue=ue.projectionMatrix.elements,tt=Le.projectionMatrix.elements,ze=Ue[14]/(Ue[10]-1),ft=Ue[14]/(Ue[10]+1),K=(Ue[9]+1)/Ue[5],re=(Ue[9]-1)/Ue[5],A=(Ue[8]-1)/Ue[0],De=(tt[8]+1)/tt[0],ce=ze*A,de=ze*De,X=ye/(-A+De),be=X*-A;if(ue.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(be),$.translateZ(X),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),Ue[10]===-1)$.projectionMatrix.copy(ue.projectionMatrix),$.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const Se=ze+X,pe=ft+X,Qe=ce-be,R=de+(ye-be),v=K*ft/pe*Se,z=re*ft/pe*Se;$.projectionMatrix.makePerspective(Qe,R,v,z,Se,pe),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function le($,ue){ue===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(ue.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(r===null)return;let ue=$.near,Le=$.far;_.texture!==null&&(_.depthNear>0&&(ue=_.depthNear),_.depthFar>0&&(Le=_.depthFar)),x.near=P.near=w.near=ue,x.far=P.far=w.far=Le,(b!==x.near||O!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),b=x.near,O=x.far),w.layers.mask=$.layers.mask|2,P.layers.mask=$.layers.mask|4,x.layers.mask=w.layers.mask|P.layers.mask;const ye=$.parent,Ue=x.cameras;le(x,ye);for(let tt=0;tt<Ue.length;tt++)le(Ue[tt],ye);Ue.length===2?V(x,w,P):x.projectionMatrix.copy(w.projectionMatrix),ge($,x,ye)};function ge($,ue,Le){Le===null?$.matrix.copy(ue.matrixWorld):($.matrix.copy(Le.matrixWorld),$.matrix.invert(),$.matrix.multiply(ue.matrixWorld)),$.matrix.decompose($.position,$.quaternion,$.scale),$.updateMatrixWorld(!0),$.projectionMatrix.copy(ue.projectionMatrix),$.projectionMatrixInverse.copy(ue.projectionMatrixInverse),$.isPerspectiveCamera&&($.fov=qi*2*Math.atan(1/$.projectionMatrix.elements[5]),$.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(f===null&&p===null))return l},this.setFoveation=function($){l=$,f!==null&&(f.fixedFoveation=$),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=$)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(x)};let se=null;function ke($,ue){if(u=ue.getViewerPose(c||a),g=ue,u!==null){const Le=u.views;p!==null&&(e.setRenderTargetFramebuffer(E,p.framebuffer),e.setRenderTarget(E));let ye=!1;Le.length!==x.cameras.length&&(x.cameras.length=0,ye=!0);for(let ze=0;ze<Le.length;ze++){const ft=Le[ze];let K=null;if(p!==null)K=p.getViewport(ft);else{const A=h.getViewSubImage(f,ft);K=A.viewport,ze===0&&(e.setRenderTargetTextures(E,A.colorTexture,A.depthStencilTexture),e.setRenderTarget(E))}let re=M[ze];re===void 0&&(re=new zt,re.layers.enable(ze),re.viewport=new et,M[ze]=re),re.matrix.fromArray(ft.transform.matrix),re.matrix.decompose(re.position,re.quaternion,re.scale),re.projectionMatrix.fromArray(ft.projectionMatrix),re.projectionMatrixInverse.copy(re.projectionMatrix).invert(),re.viewport.set(K.x,K.y,K.width,K.height),ze===0&&(x.matrix.copy(re.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),ye===!0&&x.cameras.push(re)}const Ue=r.enabledFeatures;if(Ue&&Ue.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&h){const ze=h.getDepthInformation(Le[0]);ze&&ze.isValid&&ze.texture&&_.init(e,ze,r.renderState)}}for(let Le=0;Le<T.length;Le++){const ye=y[Le],Ue=T[Le];ye!==null&&Ue!==void 0&&Ue.update(ye,ue,c||a)}se&&se($,ue),ue.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ue}),g=null}const je=new Ru;je.setAnimationLoop(ke),this.setAnimationLoop=function($){se=$},this.dispose=function(){}}}const si=new Jt,Nv=new Ke;function Fv(i,e){function t(m,d){m.matrixAutoUpdate===!0&&m.updateMatrix(),d.value.copy(m.matrix)}function n(m,d){d.color.getRGB(m.fogColor.value,hu(i)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function r(m,d,E,T,y){d.isMeshBasicMaterial||d.isMeshLambertMaterial?s(m,d):d.isMeshToonMaterial?(s(m,d),h(m,d)):d.isMeshPhongMaterial?(s(m,d),u(m,d)):d.isMeshStandardMaterial?(s(m,d),f(m,d),d.isMeshPhysicalMaterial&&p(m,d,y)):d.isMeshMatcapMaterial?(s(m,d),g(m,d)):d.isMeshDepthMaterial?s(m,d):d.isMeshDistanceMaterial?(s(m,d),_(m,d)):d.isMeshNormalMaterial?s(m,d):d.isLineBasicMaterial?(a(m,d),d.isLineDashedMaterial&&o(m,d)):d.isPointsMaterial?l(m,d,E,T):d.isSpriteMaterial?c(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function s(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.bumpMap&&(m.bumpMap.value=d.bumpMap,t(d.bumpMap,m.bumpMapTransform),m.bumpScale.value=d.bumpScale,d.side===kt&&(m.bumpScale.value*=-1)),d.normalMap&&(m.normalMap.value=d.normalMap,t(d.normalMap,m.normalMapTransform),m.normalScale.value.copy(d.normalScale),d.side===kt&&m.normalScale.value.negate()),d.displacementMap&&(m.displacementMap.value=d.displacementMap,t(d.displacementMap,m.displacementMapTransform),m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap,t(d.emissiveMap,m.emissiveMapTransform)),d.specularMap&&(m.specularMap.value=d.specularMap,t(d.specularMap,m.specularMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);const E=e.get(d),T=E.envMap,y=E.envMapRotation;T&&(m.envMap.value=T,si.copy(y),si.x*=-1,si.y*=-1,si.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(si.y*=-1,si.z*=-1),m.envMapRotation.value.setFromMatrix4(Nv.makeRotationFromEuler(si)),m.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap&&(m.lightMap.value=d.lightMap,m.lightMapIntensity.value=d.lightMapIntensity,t(d.lightMap,m.lightMapTransform)),d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,m.aoMapTransform))}function a(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform))}function o(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,E,T){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*E,m.scale.value=T*.5,d.map&&(m.map.value=d.map,t(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function h(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function f(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,m.roughnessMapTransform)),d.envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function p(m,d,E){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===kt&&m.clearcoatNormalScale.value.negate())),d.dispersion>0&&(m.dispersion.value=d.dispersion),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(m.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(m.anisotropyMap.value=d.anisotropyMap,t(d.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,d){d.matcap&&(m.matcap.value=d.matcap)}function _(m,d){const E=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Ov(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const y=T.program;n.uniformBlockBinding(E,y)}function c(E,T){let y=r[E.id];y===void 0&&(g(E),y=u(E),r[E.id]=y,E.addEventListener("dispose",m));const D=T.program;n.updateUBOMapping(E,D);const C=e.render.frame;s[E.id]!==C&&(f(E),s[E.id]=C)}function u(E){const T=h();E.__bindingPointIndex=T;const y=i.createBuffer(),D=E.__size,C=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,D,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,T,y),y}function h(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(E){const T=r[E.id],y=E.uniforms,D=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,T);for(let C=0,w=y.length;C<w;C++){const P=Array.isArray(y[C])?y[C]:[y[C]];for(let M=0,x=P.length;M<x;M++){const b=P[M];if(p(b,C,M,D)===!0){const O=b.__offset,F=Array.isArray(b.value)?b.value:[b.value];let k=0;for(let W=0;W<F.length;W++){const B=F[W],J=_(B);typeof B=="number"||typeof B=="boolean"?(b.__data[0]=B,i.bufferSubData(i.UNIFORM_BUFFER,O+k,b.__data)):B.isMatrix3?(b.__data[0]=B.elements[0],b.__data[1]=B.elements[1],b.__data[2]=B.elements[2],b.__data[3]=0,b.__data[4]=B.elements[3],b.__data[5]=B.elements[4],b.__data[6]=B.elements[5],b.__data[7]=0,b.__data[8]=B.elements[6],b.__data[9]=B.elements[7],b.__data[10]=B.elements[8],b.__data[11]=0):(B.toArray(b.__data,k),k+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,O,b.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(E,T,y,D){const C=E.value,w=T+"_"+y;if(D[w]===void 0)return typeof C=="number"||typeof C=="boolean"?D[w]=C:D[w]=C.clone(),!0;{const P=D[w];if(typeof C=="number"||typeof C=="boolean"){if(P!==C)return D[w]=C,!0}else if(P.equals(C)===!1)return P.copy(C),!0}return!1}function g(E){const T=E.uniforms;let y=0;const D=16;for(let w=0,P=T.length;w<P;w++){const M=Array.isArray(T[w])?T[w]:[T[w]];for(let x=0,b=M.length;x<b;x++){const O=M[x],F=Array.isArray(O.value)?O.value:[O.value];for(let k=0,W=F.length;k<W;k++){const B=F[k],J=_(B),V=y%D,le=V%J.boundary,ge=V+le;y+=le,ge!==0&&D-ge<J.storage&&(y+=D-ge),O.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=y,y+=J.storage}}}const C=y%D;return C>0&&(y+=D-C),E.__size=y,E.__cache={},this}function _(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function m(E){const T=E.target;T.removeEventListener("dispose",m);const y=a.indexOf(T.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[T.id]),delete r[T.id],delete s[T.id]}function d(){for(const E in r)i.deleteBuffer(r[E]);a=[],r={},s={}}return{bind:l,update:c,dispose:d}}class Bv{constructor(e={}){const{canvas:t=Vf(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:f=!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 g=new Uint32Array(4),_=new Int32Array(4);let m=null,d=null;const E=[],T=[];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=jn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let D=!1;this._outputColorSpace=Gt;let C=0,w=0,P=null,M=-1,x=null;const b=new et,O=new et;let F=null;const k=new Ye(0);let W=0,B=t.width,J=t.height,V=1,le=null,ge=null;const se=new et(0,0,B,J),ke=new et(0,0,B,J);let je=!1;const $=new Xo;let ue=!1,Le=!1;const ye=new Ke,Ue=new Ke,tt=new L,ze=new et,ft={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let K=!1;function re(){return P===null?V:1}let A=n;function De(S,I){return t.getContext(S,I)}try{const S={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Po}`),t.addEventListener("webglcontextlost",Te,!1),t.addEventListener("webglcontextrestored",ie,!1),t.addEventListener("webglcontextcreationerror",Z,!1),A===null){const I="webgl2";if(A=De(I,S),A===null)throw De(I)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let ce,de,X,be,Se,pe,Qe,R,v,z,j,Q,q,Re,oe,Me,Pe,ee,Ee,Fe,Ne,fe,Ve,U;function _e(){ce=new Kg(A),ce.init(),fe=new Dv(A,ce),de=new Vg(A,ce,e,fe),X=new Rv(A,ce),de.reverseDepthBuffer&&f&&X.buffers.depth.setReversed(!0),be=new Jg(A),Se=new mv,pe=new Cv(A,ce,X,Se,de,fe,be),Qe=new Gg(y),R=new Yg(y),v=new ip(A),Ve=new zg(A,v),z=new jg(A,v,be,Ve),j=new Qg(A,z,v,be),Ee=new Zg(A,de,pe),Me=new Hg(Se),Q=new pv(y,Qe,R,ce,de,Ve,Me),q=new Fv(y,Se),Re=new _v,oe=new Ev(ce),ee=new Bg(y,Qe,R,X,j,p,l),Pe=new Av(y,j,de),U=new Ov(A,be,de,X),Fe=new kg(A,ce,be),Ne=new $g(A,ce,be),be.programs=Q.programs,y.capabilities=de,y.extensions=ce,y.properties=Se,y.renderLists=Re,y.shadowMap=Pe,y.state=X,y.info=be}_e();const te=new Iv(y,A);this.xr=te,this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){const S=ce.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=ce.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(S){S!==void 0&&(V=S,this.setSize(B,J,!1))},this.getSize=function(S){return S.set(B,J)},this.setSize=function(S,I,H=!0){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}B=S,J=I,t.width=Math.floor(S*V),t.height=Math.floor(I*V),H===!0&&(t.style.width=S+"px",t.style.height=I+"px"),this.setViewport(0,0,S,I)},this.getDrawingBufferSize=function(S){return S.set(B*V,J*V).floor()},this.setDrawingBufferSize=function(S,I,H){B=S,J=I,V=H,t.width=Math.floor(S*H),t.height=Math.floor(I*H),this.setViewport(0,0,S,I)},this.getCurrentViewport=function(S){return S.copy(b)},this.getViewport=function(S){return S.copy(se)},this.setViewport=function(S,I,H,G){S.isVector4?se.set(S.x,S.y,S.z,S.w):se.set(S,I,H,G),X.viewport(b.copy(se).multiplyScalar(V).round())},this.getScissor=function(S){return S.copy(ke)},this.setScissor=function(S,I,H,G){S.isVector4?ke.set(S.x,S.y,S.z,S.w):ke.set(S,I,H,G),X.scissor(O.copy(ke).multiplyScalar(V).round())},this.getScissorTest=function(){return je},this.setScissorTest=function(S){X.setScissorTest(je=S)},this.setOpaqueSort=function(S){le=S},this.setTransparentSort=function(S){ge=S},this.getClearColor=function(S){return S.copy(ee.getClearColor())},this.setClearColor=function(){ee.setClearColor(...arguments)},this.getClearAlpha=function(){return ee.getClearAlpha()},this.setClearAlpha=function(){ee.setClearAlpha(...arguments)},this.clear=function(S=!0,I=!0,H=!0){let G=0;if(S){let N=!1;if(P!==null){const ae=P.texture.format;N=ae===Oo||ae===Fo||ae===No}if(N){const ae=P.texture.type,xe=ae===Mn||ae===di||ae===Sr||ae===Mr||ae===Uo||ae===Io,Ce=ee.getClearColor(),Ae=ee.getClearAlpha(),He=Ce.r,Ge=Ce.g,Ie=Ce.b;xe?(g[0]=He,g[1]=Ge,g[2]=Ie,g[3]=Ae,A.clearBufferuiv(A.COLOR,0,g)):(_[0]=He,_[1]=Ge,_[2]=Ie,_[3]=Ae,A.clearBufferiv(A.COLOR,0,_))}else G|=A.COLOR_BUFFER_BIT}I&&(G|=A.DEPTH_BUFFER_BIT),H&&(G|=A.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),A.clear(G)},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",Te,!1),t.removeEventListener("webglcontextrestored",ie,!1),t.removeEventListener("webglcontextcreationerror",Z,!1),ee.dispose(),Re.dispose(),oe.dispose(),Se.dispose(),Qe.dispose(),R.dispose(),j.dispose(),Ve.dispose(),U.dispose(),Q.dispose(),te.dispose(),te.removeEventListener("sessionstart",$n),te.removeEventListener("sessionend",Oe),ve.stop()};function Te(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function ie(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const S=be.autoReset,I=Pe.enabled,H=Pe.autoUpdate,G=Pe.needsUpdate,N=Pe.type;_e(),be.autoReset=S,Pe.enabled=I,Pe.autoUpdate=H,Pe.needsUpdate=G,Pe.type=N}function Z(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function we(S){const I=S.target;I.removeEventListener("dispose",we),ne(I)}function ne(S){Je(S),Se.remove(S)}function Je(S){const I=Se.get(S).programs;I!==void 0&&(I.forEach(function(H){Q.releaseProgram(H)}),S.isShaderMaterial&&Q.releaseShaderCache(S))}this.renderBufferDirect=function(S,I,H,G,N,ae){I===null&&(I=ft);const xe=N.isMesh&&N.matrixWorld.determinant()<0,Ce=Lr(S,I,H,G,N);X.setMaterial(G,xe);let Ae=H.index,He=1;if(G.wireframe===!0){if(Ae=z.getWireframeAttribute(H),Ae===void 0)return;He=2}const Ge=H.drawRange,Ie=H.attributes.position;let nt=Ge.start*He,lt=(Ge.start+Ge.count)*He;ae!==null&&(nt=Math.max(nt,ae.start*He),lt=Math.min(lt,(ae.start+ae.count)*He)),Ae!==null?(nt=Math.max(nt,0),lt=Math.min(lt,Ae.count)):Ie!=null&&(nt=Math.max(nt,0),lt=Math.min(lt,Ie.count));const pt=lt-nt;if(pt<0||pt===1/0)return;Ve.setup(N,G,Ce,H,Ae);let mt,rt=Fe;if(Ae!==null&&(mt=v.get(Ae),rt=Ne,rt.setIndex(mt)),N.isMesh)G.wireframe===!0?(X.setLineWidth(G.wireframeLinewidth*re()),rt.setMode(A.LINES)):rt.setMode(A.TRIANGLES);else if(N.isLine){let Be=G.linewidth;Be===void 0&&(Be=1),X.setLineWidth(Be*re()),N.isLineSegments?rt.setMode(A.LINES):N.isLineLoop?rt.setMode(A.LINE_LOOP):rt.setMode(A.LINE_STRIP)}else N.isPoints?rt.setMode(A.POINTS):N.isSprite&&rt.setMode(A.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)zi("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),rt.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if(ce.get("WEBGL_multi_draw"))rt.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Be=N._multiDrawStarts,bt=N._multiDrawCounts,at=N._multiDrawCount,an=Ae?v.get(Ae).bytesPerElement:1,_i=Se.get(G).currentProgram.getUniforms();for(let qt=0;qt<at;qt++)_i.setValue(A,"_gl_DrawID",qt),rt.render(Be[qt]/an,bt[qt])}else if(N.isInstancedMesh)rt.renderInstances(nt,pt,N.count);else if(H.isInstancedBufferGeometry){const Be=H._maxInstanceCount!==void 0?H._maxInstanceCount:1/0,bt=Math.min(H.instanceCount,Be);rt.renderInstances(nt,pt,bt)}else rt.render(nt,pt)};function Xe(S,I,H){S.transparent===!0&&S.side===_n&&S.forceSinglePass===!1?(S.side=kt,S.needsUpdate=!0,Jn(S,I,H),S.side=Fn,S.needsUpdate=!0,Jn(S,I,H),S.side=_n):Jn(S,I,H)}this.compile=function(S,I,H=null){H===null&&(H=S),d=oe.get(H),d.init(I),T.push(d),H.traverseVisible(function(N){N.isLight&&N.layers.test(I.layers)&&(d.pushLight(N),N.castShadow&&d.pushShadow(N))}),S!==H&&S.traverseVisible(function(N){N.isLight&&N.layers.test(I.layers)&&(d.pushLight(N),N.castShadow&&d.pushShadow(N))}),d.setupLights();const G=new Set;return S.traverse(function(N){if(!(N.isMesh||N.isPoints||N.isLine||N.isSprite))return;const ae=N.material;if(ae)if(Array.isArray(ae))for(let xe=0;xe<ae.length;xe++){const Ce=ae[xe];Xe(Ce,H,N),G.add(Ce)}else Xe(ae,H,N),G.add(ae)}),d=T.pop(),G},this.compileAsync=function(S,I,H=null){const G=this.compile(S,I,H);return new Promise(N=>{function ae(){if(G.forEach(function(xe){Se.get(xe).currentProgram.isReady()&&G.delete(xe)}),G.size===0){N(S);return}setTimeout(ae,10)}ce.get("KHR_parallel_shader_compile")!==null?ae():setTimeout(ae,10)})};let _t=null;function sn(S){_t&&_t(S)}function $n(){ve.stop()}function Oe(){ve.start()}const ve=new Ru;ve.setAnimationLoop(sn),typeof self<"u"&&ve.setContext(self),this.setAnimationLoop=function(S){_t=S,te.setAnimationLoop(S),S===null?ve.stop():ve.start()},te.addEventListener("sessionstart",$n),te.addEventListener("sessionend",Oe),this.render=function(S,I){if(I!==void 0&&I.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),I.parent===null&&I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(I),I=te.getCamera()),S.isScene===!0&&S.onBeforeRender(y,S,I,P),d=oe.get(S,T.length),d.init(I),T.push(d),Ue.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),$.setFromProjectionMatrix(Ue),Le=this.localClippingEnabled,ue=Me.init(this.clippingPlanes,Le),m=Re.get(S,E.length),m.init(),E.push(m),te.enabled===!0&&te.isPresenting===!0){const ae=y.xr.getDepthSensingMesh();ae!==null&&vt(ae,I,-1/0,y.sortObjects)}vt(S,I,0,y.sortObjects),m.finish(),y.sortObjects===!0&&m.sort(le,ge),K=te.enabled===!1||te.isPresenting===!1||te.hasDepthSensing()===!1,K&&ee.addToRenderList(m,S),this.info.render.frame++,ue===!0&&Me.beginShadows();const H=d.state.shadowsArray;Pe.render(H,S,I),ue===!0&&Me.endShadows(),this.info.autoReset===!0&&this.info.reset();const G=m.opaque,N=m.transmissive;if(d.setupLights(),I.isArrayCamera){const ae=I.cameras;if(N.length>0)for(let xe=0,Ce=ae.length;xe<Ce;xe++){const Ae=ae[xe];Mt(G,N,S,Ae)}K&&ee.render(S);for(let xe=0,Ce=ae.length;xe<Ce;xe++){const Ae=ae[xe];pn(m,S,Ae,Ae.viewport)}}else N.length>0&&Mt(G,N,S,I),K&&ee.render(S),pn(m,S,I);P!==null&&w===0&&(pe.updateMultisampleRenderTarget(P),pe.updateRenderTargetMipmap(P)),S.isScene===!0&&S.onAfterRender(y,S,I),Ve.resetDefaultState(),M=-1,x=null,T.pop(),T.length>0?(d=T[T.length-1],ue===!0&&Me.setGlobalState(y.clippingPlanes,d.state.camera)):d=null,E.pop(),E.length>0?m=E[E.length-1]:m=null};function vt(S,I,H,G){if(S.visible===!1)return;if(S.layers.test(I.layers)){if(S.isGroup)H=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(I);else if(S.isLight)d.pushLight(S),S.castShadow&&d.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||$.intersectsSprite(S)){G&&ze.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Ue);const xe=j.update(S),Ce=S.material;Ce.visible&&m.push(S,xe,Ce,H,ze.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||$.intersectsObject(S))){const xe=j.update(S),Ce=S.material;if(G&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),ze.copy(S.boundingSphere.center)):(xe.boundingSphere===null&&xe.computeBoundingSphere(),ze.copy(xe.boundingSphere.center)),ze.applyMatrix4(S.matrixWorld).applyMatrix4(Ue)),Array.isArray(Ce)){const Ae=xe.groups;for(let He=0,Ge=Ae.length;He<Ge;He++){const Ie=Ae[He],nt=Ce[Ie.materialIndex];nt&&nt.visible&&m.push(S,xe,nt,H,ze.z,Ie)}}else Ce.visible&&m.push(S,xe,Ce,H,ze.z,null)}}const ae=S.children;for(let xe=0,Ce=ae.length;xe<Ce;xe++)vt(ae[xe],I,H,G)}function pn(S,I,H,G){const N=S.opaque,ae=S.transmissive,xe=S.transparent;d.setupLightsView(H),ue===!0&&Me.setGlobalState(y.clippingPlanes,H),G&&X.viewport(b.copy(G)),N.length>0&&Pt(N,I,H),ae.length>0&&Pt(ae,I,H),xe.length>0&&Pt(xe,I,H),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function Mt(S,I,H,G){if((H.isScene===!0?H.overrideMaterial:null)!==null)return;d.state.transmissionRenderTarget[G.id]===void 0&&(d.state.transmissionRenderTarget[G.id]=new pi(1,1,{generateMipmaps:!0,type:ce.has("EXT_color_buffer_half_float")||ce.has("EXT_color_buffer_float")?Rr:Mn,minFilter:Ln,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:it.workingColorSpace}));const ae=d.state.transmissionRenderTarget[G.id],xe=G.viewport||b;ae.setSize(xe.z*y.transmissionResolutionScale,xe.w*y.transmissionResolutionScale);const Ce=y.getRenderTarget();y.setRenderTarget(ae),y.getClearColor(k),W=y.getClearAlpha(),W<1&&y.setClearColor(16777215,.5),y.clear(),K&&ee.render(H);const Ae=y.toneMapping;y.toneMapping=jn;const He=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),d.setupLightsView(G),ue===!0&&Me.setGlobalState(y.clippingPlanes,G),Pt(S,H,G),pe.updateMultisampleRenderTarget(ae),pe.updateRenderTargetMipmap(ae),ce.has("WEBGL_multisampled_render_to_texture")===!1){let Ge=!1;for(let Ie=0,nt=I.length;Ie<nt;Ie++){const lt=I[Ie],pt=lt.object,mt=lt.geometry,rt=lt.material,Be=lt.group;if(rt.side===_n&&pt.layers.test(G.layers)){const bt=rt.side;rt.side=kt,rt.needsUpdate=!0,Zt(pt,H,G,mt,rt,Be),rt.side=bt,rt.needsUpdate=!0,Ge=!0}}Ge===!0&&(pe.updateMultisampleRenderTarget(ae),pe.updateRenderTargetMipmap(ae))}y.setRenderTarget(Ce),y.setClearColor(k,W),He!==void 0&&(G.viewport=He),y.toneMapping=Ae}function Pt(S,I,H){const G=I.isScene===!0?I.overrideMaterial:null;for(let N=0,ae=S.length;N<ae;N++){const xe=S[N],Ce=xe.object,Ae=xe.geometry,He=xe.group;let Ge=xe.material;Ge.allowOverride===!0&&G!==null&&(Ge=G),Ce.layers.test(H.layers)&&Zt(Ce,I,H,Ae,Ge,He)}}function Zt(S,I,H,G,N,ae){S.onBeforeRender(y,I,H,G,N,ae),S.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,S.matrixWorld),S.normalMatrix.getNormalMatrix(S.modelViewMatrix),N.onBeforeRender(y,I,H,G,S,ae),N.transparent===!0&&N.side===_n&&N.forceSinglePass===!1?(N.side=kt,N.needsUpdate=!0,y.renderBufferDirect(H,I,G,N,S,ae),N.side=Fn,N.needsUpdate=!0,y.renderBufferDirect(H,I,G,N,S,ae),N.side=_n):y.renderBufferDirect(H,I,G,N,S,ae),S.onAfterRender(y,I,H,G,N,ae)}function Jn(S,I,H){I.isScene!==!0&&(I=ft);const G=Se.get(S),N=d.state.lights,ae=d.state.shadowsArray,xe=N.state.version,Ce=Q.getParameters(S,N.state,ae,I,H),Ae=Q.getProgramCacheKey(Ce);let He=G.programs;G.environment=S.isMeshStandardMaterial?I.environment:null,G.fog=I.fog,G.envMap=(S.isMeshStandardMaterial?R:Qe).get(S.envMap||G.environment),G.envMapRotation=G.environment!==null&&S.envMap===null?I.environmentRotation:S.envMapRotation,He===void 0&&(S.addEventListener("dispose",we),He=new Map,G.programs=He);let Ge=He.get(Ae);if(Ge!==void 0){if(G.currentProgram===Ge&&G.lightsStateVersion===xe)return tr(S,Ce),Ge}else Ce.uniforms=Q.getUniforms(S),S.onBeforeCompile(Ce,y),Ge=Q.acquireProgram(Ce,Ae),He.set(Ae,Ge),G.uniforms=Ce.uniforms;const Ie=G.uniforms;return(!S.isShaderMaterial&&!S.isRawShaderMaterial||S.clipping===!0)&&(Ie.clippingPlanes=Me.uniform),tr(S,Ce),G.needsLights=Ir(S),G.lightsStateVersion=xe,G.needsLights&&(Ie.ambientLightColor.value=N.state.ambient,Ie.lightProbe.value=N.state.probe,Ie.directionalLights.value=N.state.directional,Ie.directionalLightShadows.value=N.state.directionalShadow,Ie.spotLights.value=N.state.spot,Ie.spotLightShadows.value=N.state.spotShadow,Ie.rectAreaLights.value=N.state.rectArea,Ie.ltc_1.value=N.state.rectAreaLTC1,Ie.ltc_2.value=N.state.rectAreaLTC2,Ie.pointLights.value=N.state.point,Ie.pointLightShadows.value=N.state.pointShadow,Ie.hemisphereLights.value=N.state.hemi,Ie.directionalShadowMap.value=N.state.directionalShadowMap,Ie.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Ie.spotShadowMap.value=N.state.spotShadowMap,Ie.spotLightMatrix.value=N.state.spotLightMatrix,Ie.spotLightMap.value=N.state.spotLightMap,Ie.pointShadowMap.value=N.state.pointShadowMap,Ie.pointShadowMatrix.value=N.state.pointShadowMatrix),G.currentProgram=Ge,G.uniformsList=null,Ge}function er(S){if(S.uniformsList===null){const I=S.currentProgram.getUniforms();S.uniformsList=Ts.seqWithValue(I.seq,S.uniforms)}return S.uniformsList}function tr(S,I){const H=Se.get(S);H.outputColorSpace=I.outputColorSpace,H.batching=I.batching,H.batchingColor=I.batchingColor,H.instancing=I.instancing,H.instancingColor=I.instancingColor,H.instancingMorph=I.instancingMorph,H.skinning=I.skinning,H.morphTargets=I.morphTargets,H.morphNormals=I.morphNormals,H.morphColors=I.morphColors,H.morphTargetsCount=I.morphTargetsCount,H.numClippingPlanes=I.numClippingPlanes,H.numIntersection=I.numClipIntersection,H.vertexAlphas=I.vertexAlphas,H.vertexTangents=I.vertexTangents,H.toneMapping=I.toneMapping}function Lr(S,I,H,G,N){I.isScene!==!0&&(I=ft),pe.resetTextureUnits();const ae=I.fog,xe=G.isMeshStandardMaterial?I.environment:null,Ce=P===null?y.outputColorSpace:P.isXRRenderTarget===!0?P.texture.colorSpace:Xi,Ae=(G.isMeshStandardMaterial?R:Qe).get(G.envMap||xe),He=G.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Ge=!!H.attributes.tangent&&(!!G.normalMap||G.anisotropy>0),Ie=!!H.morphAttributes.position,nt=!!H.morphAttributes.normal,lt=!!H.morphAttributes.color;let pt=jn;G.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(pt=y.toneMapping);const mt=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,rt=mt!==void 0?mt.length:0,Be=Se.get(G),bt=d.state.lights;if(ue===!0&&(Le===!0||S!==x)){const Ft=S===x&&G.id===M;Me.setState(G,S,Ft)}let at=!1;G.version===Be.__version?(Be.needsLights&&Be.lightsStateVersion!==bt.state.version||Be.outputColorSpace!==Ce||N.isBatchedMesh&&Be.batching===!1||!N.isBatchedMesh&&Be.batching===!0||N.isBatchedMesh&&Be.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Be.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Be.instancing===!1||!N.isInstancedMesh&&Be.instancing===!0||N.isSkinnedMesh&&Be.skinning===!1||!N.isSkinnedMesh&&Be.skinning===!0||N.isInstancedMesh&&Be.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Be.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Be.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Be.instancingMorph===!1&&N.morphTexture!==null||Be.envMap!==Ae||G.fog===!0&&Be.fog!==ae||Be.numClippingPlanes!==void 0&&(Be.numClippingPlanes!==Me.numPlanes||Be.numIntersection!==Me.numIntersection)||Be.vertexAlphas!==He||Be.vertexTangents!==Ge||Be.morphTargets!==Ie||Be.morphNormals!==nt||Be.morphColors!==lt||Be.toneMapping!==pt||Be.morphTargetsCount!==rt)&&(at=!0):(at=!0,Be.__version=G.version);let an=Be.currentProgram;at===!0&&(an=Jn(G,I,N));let _i=!1,qt=!1,ir=!1;const dt=an.getUniforms(),Qt=Be.uniforms;if(X.useProgram(an.program)&&(_i=!0,qt=!0,ir=!0),G.id!==M&&(M=G.id,qt=!0),_i||x!==S){X.buffers.depth.getReversed()?(ye.copy(S.projectionMatrix),Gf(ye),Wf(ye),dt.setValue(A,"projectionMatrix",ye)):dt.setValue(A,"projectionMatrix",S.projectionMatrix),dt.setValue(A,"viewMatrix",S.matrixWorldInverse);const Vt=dt.map.cameraPosition;Vt!==void 0&&Vt.setValue(A,tt.setFromMatrixPosition(S.matrixWorld)),de.logarithmicDepthBuffer&&dt.setValue(A,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&dt.setValue(A,"isOrthographic",S.isOrthographicCamera===!0),x!==S&&(x=S,qt=!0,ir=!0)}if(N.isSkinnedMesh){dt.setOptional(A,N,"bindMatrix"),dt.setOptional(A,N,"bindMatrixInverse");const Ft=N.skeleton;Ft&&(Ft.boneTexture===null&&Ft.computeBoneTexture(),dt.setValue(A,"boneTexture",Ft.boneTexture,pe))}N.isBatchedMesh&&(dt.setOptional(A,N,"batchingTexture"),dt.setValue(A,"batchingTexture",N._matricesTexture,pe),dt.setOptional(A,N,"batchingIdTexture"),dt.setValue(A,"batchingIdTexture",N._indirectTexture,pe),dt.setOptional(A,N,"batchingColorTexture"),N._colorsTexture!==null&&dt.setValue(A,"batchingColorTexture",N._colorsTexture,pe));const en=H.morphAttributes;if((en.position!==void 0||en.normal!==void 0||en.color!==void 0)&&Ee.update(N,H,an),(qt||Be.receiveShadow!==N.receiveShadow)&&(Be.receiveShadow=N.receiveShadow,dt.setValue(A,"receiveShadow",N.receiveShadow)),G.isMeshGouraudMaterial&&G.envMap!==null&&(Qt.envMap.value=Ae,Qt.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),G.isMeshStandardMaterial&&G.envMap===null&&I.environment!==null&&(Qt.envMapIntensity.value=I.environmentIntensity),qt&&(dt.setValue(A,"toneMappingExposure",y.toneMappingExposure),Be.needsLights&&Ur(Qt,ir),ae&&G.fog===!0&&q.refreshFogUniforms(Qt,ae),q.refreshMaterialUniforms(Qt,G,V,J,d.state.transmissionRenderTarget[S.id]),Ts.upload(A,er(Be),Qt,pe)),G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(Ts.upload(A,er(Be),Qt,pe),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&dt.setValue(A,"center",N.center),dt.setValue(A,"modelViewMatrix",N.modelViewMatrix),dt.setValue(A,"normalMatrix",N.normalMatrix),dt.setValue(A,"modelMatrix",N.matrixWorld),G.isShaderMaterial||G.isRawShaderMaterial){const Ft=G.uniformsGroups;for(let Vt=0,Xs=Ft.length;Vt<Xs;Vt++){const Qn=Ft[Vt];U.update(Qn,an),U.bind(Qn,an)}}return an}function Ur(S,I){S.ambientLightColor.needsUpdate=I,S.lightProbe.needsUpdate=I,S.directionalLights.needsUpdate=I,S.directionalLightShadows.needsUpdate=I,S.pointLights.needsUpdate=I,S.pointLightShadows.needsUpdate=I,S.spotLights.needsUpdate=I,S.spotLightShadows.needsUpdate=I,S.rectAreaLights.needsUpdate=I,S.hemisphereLights.needsUpdate=I}function Ir(S){return S.isMeshLambertMaterial||S.isMeshToonMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isShadowMaterial||S.isShaderMaterial&&S.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return P},this.setRenderTargetTextures=function(S,I,H){const G=Se.get(S);G.__autoAllocateDepthBuffer=S.resolveDepthBuffer===!1,G.__autoAllocateDepthBuffer===!1&&(G.__useRenderToTexture=!1),Se.get(S.texture).__webglTexture=I,Se.get(S.depthTexture).__webglTexture=G.__autoAllocateDepthBuffer?void 0:H,G.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(S,I){const H=Se.get(S);H.__webglFramebuffer=I,H.__useDefaultFramebuffer=I===void 0};const nr=A.createFramebuffer();this.setRenderTarget=function(S,I=0,H=0){P=S,C=I,w=H;let G=!0,N=null,ae=!1,xe=!1;if(S){const Ae=Se.get(S);if(Ae.__useDefaultFramebuffer!==void 0)X.bindFramebuffer(A.FRAMEBUFFER,null),G=!1;else if(Ae.__webglFramebuffer===void 0)pe.setupRenderTarget(S);else if(Ae.__hasExternalTextures)pe.rebindTextures(S,Se.get(S.texture).__webglTexture,Se.get(S.depthTexture).__webglTexture);else if(S.depthBuffer){const Ie=S.depthTexture;if(Ae.__boundDepthTexture!==Ie){if(Ie!==null&&Se.has(Ie)&&(S.width!==Ie.image.width||S.height!==Ie.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");pe.setupDepthRenderbuffer(S)}}const He=S.texture;(He.isData3DTexture||He.isDataArrayTexture||He.isCompressedArrayTexture)&&(xe=!0);const Ge=Se.get(S).__webglFramebuffer;S.isWebGLCubeRenderTarget?(Array.isArray(Ge[I])?N=Ge[I][H]:N=Ge[I],ae=!0):S.samples>0&&pe.useMultisampledRTT(S)===!1?N=Se.get(S).__webglMultisampledFramebuffer:Array.isArray(Ge)?N=Ge[H]:N=Ge,b.copy(S.viewport),O.copy(S.scissor),F=S.scissorTest}else b.copy(se).multiplyScalar(V).floor(),O.copy(ke).multiplyScalar(V).floor(),F=je;if(H!==0&&(N=nr),X.bindFramebuffer(A.FRAMEBUFFER,N)&&G&&X.drawBuffers(S,N),X.viewport(b),X.scissor(O),X.setScissorTest(F),ae){const Ae=Se.get(S.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+I,Ae.__webglTexture,H)}else if(xe){const Ae=Se.get(S.texture),He=I;A.framebufferTextureLayer(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ae.__webglTexture,H,He)}else if(S!==null&&H!==0){const Ae=Se.get(S.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Ae.__webglTexture,H)}M=-1},this.readRenderTargetPixels=function(S,I,H,G,N,ae,xe,Ce=0){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ae=Se.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&xe!==void 0&&(Ae=Ae[xe]),Ae){X.bindFramebuffer(A.FRAMEBUFFER,Ae);try{const He=S.textures[Ce],Ge=He.format,Ie=He.type;if(!de.textureFormatReadable(Ge)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!de.textureTypeReadable(Ie)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}I>=0&&I<=S.width-G&&H>=0&&H<=S.height-N&&(S.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+Ce),A.readPixels(I,H,G,N,fe.convert(Ge),fe.convert(Ie),ae))}finally{const He=P!==null?Se.get(P).__webglFramebuffer:null;X.bindFramebuffer(A.FRAMEBUFFER,He)}}},this.readRenderTargetPixelsAsync=async function(S,I,H,G,N,ae,xe,Ce=0){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ae=Se.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&xe!==void 0&&(Ae=Ae[xe]),Ae)if(I>=0&&I<=S.width-G&&H>=0&&H<=S.height-N){X.bindFramebuffer(A.FRAMEBUFFER,Ae);const He=S.textures[Ce],Ge=He.format,Ie=He.type;if(!de.textureFormatReadable(Ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!de.textureTypeReadable(Ie))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const nt=A.createBuffer();A.bindBuffer(A.PIXEL_PACK_BUFFER,nt),A.bufferData(A.PIXEL_PACK_BUFFER,ae.byteLength,A.STREAM_READ),S.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+Ce),A.readPixels(I,H,G,N,fe.convert(Ge),fe.convert(Ie),0);const lt=P!==null?Se.get(P).__webglFramebuffer:null;X.bindFramebuffer(A.FRAMEBUFFER,lt);const pt=A.fenceSync(A.SYNC_GPU_COMMANDS_COMPLETE,0);return A.flush(),await Hf(A,pt,4),A.bindBuffer(A.PIXEL_PACK_BUFFER,nt),A.getBufferSubData(A.PIXEL_PACK_BUFFER,0,ae),A.deleteBuffer(nt),A.deleteSync(pt),ae}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(S,I=null,H=0){const G=Math.pow(2,-H),N=Math.floor(S.image.width*G),ae=Math.floor(S.image.height*G),xe=I!==null?I.x:0,Ce=I!==null?I.y:0;pe.setTexture2D(S,0),A.copyTexSubImage2D(A.TEXTURE_2D,H,0,0,xe,Ce,N,ae),X.unbindTexture()};const Xt=A.createFramebuffer(),Zn=A.createFramebuffer();this.copyTextureToTexture=function(S,I,H=null,G=null,N=0,ae=null){ae===null&&(N!==0?(zi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ae=N,N=0):ae=0);let xe,Ce,Ae,He,Ge,Ie,nt,lt,pt;const mt=S.isCompressedTexture?S.mipmaps[ae]:S.image;if(H!==null)xe=H.max.x-H.min.x,Ce=H.max.y-H.min.y,Ae=H.isBox3?H.max.z-H.min.z:1,He=H.min.x,Ge=H.min.y,Ie=H.isBox3?H.min.z:0;else{const en=Math.pow(2,-N);xe=Math.floor(mt.width*en),Ce=Math.floor(mt.height*en),S.isDataArrayTexture?Ae=mt.depth:S.isData3DTexture?Ae=Math.floor(mt.depth*en):Ae=1,He=0,Ge=0,Ie=0}G!==null?(nt=G.x,lt=G.y,pt=G.z):(nt=0,lt=0,pt=0);const rt=fe.convert(I.format),Be=fe.convert(I.type);let bt;I.isData3DTexture?(pe.setTexture3D(I,0),bt=A.TEXTURE_3D):I.isDataArrayTexture||I.isCompressedArrayTexture?(pe.setTexture2DArray(I,0),bt=A.TEXTURE_2D_ARRAY):(pe.setTexture2D(I,0),bt=A.TEXTURE_2D),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,I.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,I.unpackAlignment);const at=A.getParameter(A.UNPACK_ROW_LENGTH),an=A.getParameter(A.UNPACK_IMAGE_HEIGHT),_i=A.getParameter(A.UNPACK_SKIP_PIXELS),qt=A.getParameter(A.UNPACK_SKIP_ROWS),ir=A.getParameter(A.UNPACK_SKIP_IMAGES);A.pixelStorei(A.UNPACK_ROW_LENGTH,mt.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,mt.height),A.pixelStorei(A.UNPACK_SKIP_PIXELS,He),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ge),A.pixelStorei(A.UNPACK_SKIP_IMAGES,Ie);const dt=S.isDataArrayTexture||S.isData3DTexture,Qt=I.isDataArrayTexture||I.isData3DTexture;if(S.isDepthTexture){const en=Se.get(S),Ft=Se.get(I),Vt=Se.get(en.__renderTarget),Xs=Se.get(Ft.__renderTarget);X.bindFramebuffer(A.READ_FRAMEBUFFER,Vt.__webglFramebuffer),X.bindFramebuffer(A.DRAW_FRAMEBUFFER,Xs.__webglFramebuffer);for(let Qn=0;Qn<Ae;Qn++)dt&&(A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Se.get(S).__webglTexture,N,Ie+Qn),A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Se.get(I).__webglTexture,ae,pt+Qn)),A.blitFramebuffer(He,Ge,xe,Ce,nt,lt,xe,Ce,A.DEPTH_BUFFER_BIT,A.NEAREST);X.bindFramebuffer(A.READ_FRAMEBUFFER,null),X.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else if(N!==0||S.isRenderTargetTexture||Se.has(S)){const en=Se.get(S),Ft=Se.get(I);X.bindFramebuffer(A.READ_FRAMEBUFFER,Xt),X.bindFramebuffer(A.DRAW_FRAMEBUFFER,Zn);for(let Vt=0;Vt<Ae;Vt++)dt?A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,en.__webglTexture,N,Ie+Vt):A.framebufferTexture2D(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,en.__webglTexture,N),Qt?A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ft.__webglTexture,ae,pt+Vt):A.framebufferTexture2D(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Ft.__webglTexture,ae),N!==0?A.blitFramebuffer(He,Ge,xe,Ce,nt,lt,xe,Ce,A.COLOR_BUFFER_BIT,A.NEAREST):Qt?A.copyTexSubImage3D(bt,ae,nt,lt,pt+Vt,He,Ge,xe,Ce):A.copyTexSubImage2D(bt,ae,nt,lt,He,Ge,xe,Ce);X.bindFramebuffer(A.READ_FRAMEBUFFER,null),X.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else Qt?S.isDataTexture||S.isData3DTexture?A.texSubImage3D(bt,ae,nt,lt,pt,xe,Ce,Ae,rt,Be,mt.data):I.isCompressedArrayTexture?A.compressedTexSubImage3D(bt,ae,nt,lt,pt,xe,Ce,Ae,rt,mt.data):A.texSubImage3D(bt,ae,nt,lt,pt,xe,Ce,Ae,rt,Be,mt):S.isDataTexture?A.texSubImage2D(A.TEXTURE_2D,ae,nt,lt,xe,Ce,rt,Be,mt.data):S.isCompressedTexture?A.compressedTexSubImage2D(A.TEXTURE_2D,ae,nt,lt,mt.width,mt.height,rt,mt.data):A.texSubImage2D(A.TEXTURE_2D,ae,nt,lt,xe,Ce,rt,Be,mt);A.pixelStorei(A.UNPACK_ROW_LENGTH,at),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,an),A.pixelStorei(A.UNPACK_SKIP_PIXELS,_i),A.pixelStorei(A.UNPACK_SKIP_ROWS,qt),A.pixelStorei(A.UNPACK_SKIP_IMAGES,ir),ae===0&&I.generateMipmaps&&A.generateMipmap(bt),X.unbindTexture()},this.copyTextureToTexture3D=function(S,I,H=null,G=null,N=0){return zi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(S,I,H,G,N)},this.initRenderTarget=function(S){Se.get(S).__webglFramebuffer===void 0&&pe.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?pe.setTextureCube(S,0):S.isData3DTexture?pe.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?pe.setTexture2DArray(S,0):pe.setTexture2D(S,0),X.unbindTexture()},this.resetState=function(){C=0,w=0,P=null,X.reset(),Ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Un}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=it._getDrawingBufferColorSpace(e),t.unpackColorSpace=it._getUnpackColorSpace()}}var zv=Object.defineProperty,kv=(i,e,t)=>e in i?zv(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ot=(i,e,t)=>kv(i,typeof e!="symbol"?e+"":e,t);const Uu=(i,e)=>{const[t,n]=e.split("-");return Object.assign(i.style,{left:n==="left"?"0":n==="center"?"50%":"",right:n==="right"?"0":"",top:t==="top"?"0":t==="bottom"?"":"50%",bottom:t==="bottom"?"0":"",transform:`${n==="center"?"translateX(-50%)":""} ${t==="center"?"translateY(-50%)":""}`}),e},Vv=({placement:i,size:e,offset:t,id:n,className:r})=>{const s=document.createElement("div"),{top:a,left:o,right:l,bottom:c}=t;return Object.assign(s.style,{id:n,position:"absolute",zIndex:"1000",height:`${e}px`,width:`${e}px`,margin:`${a}px ${l}px ${c}px ${o}px`,borderRadius:"100%"}),Uu(s,i),n&&(s.id=n),r&&(s.className=r),s},Hv=i=>{const e=typeof i=="string"?document.querySelector(i):i;if(!e)throw Error("Invalid DOM element");return e};function bo(i,e,t){return Math.max(e,Math.min(t,i))}const Gv=[["x",0,3],["y",1,4],["z",2,5]],Tc=new L;function Ac({isSphere:i},e,t){i&&(Tc.set(0,0,1).applyQuaternion(t.quaternion),Gv.forEach(([n,r,s])=>{const a=Tc[n];let o=e[r],l=o.userData.opacity;o.material.opacity=bo(a>=0?l:l/2,0,1),o=e[s],l=o.userData.opacity,o.material.opacity=bo(a>=0?l/2:l,0,1)}))}const Wv=(i,e,t=10)=>Math.abs(i.clientX-e.x)<t&&Math.abs(i.clientY-e.y)<t,wc=new Qd,Rc=new We,Cc=(i,e,t,n)=>{Rc.set((i.clientX-e.left)/e.width*2-1,-((i.clientY-e.top)/e.height)*2+1),wc.setFromCamera(Rc,t);const r=wc.intersectObjects(n,!1),s=r.length?r[0]:null;return!s||!s.object.visible?null:s},Ca=1e-6,Xv=2*Math.PI,Iu=["x","y","z"],wr=[...Iu,"nx","ny","nz"],qv=["x","z","y","nx","nz","ny"],Yv=["z","x","y","nz","nx","ny"],To="Right",As="Top",Ao="Front",wo="Left",ws="Bottom",Ro="Back",Kv=[To,As,Ao,wo,ws,Ro].map(i=>i.toLocaleLowerCase()),Nu=1.3,Dc=(i,e=!0)=>{const{material:t,userData:n}=i,{color:r,opacity:s}=e?n.hover:n;t.color.set(r),t.opacity=s},ai=i=>JSON.parse(JSON.stringify(i)),jv=i=>{const e=i.type||"sphere",t=e==="sphere",n=i.resolution||t?64:128,r=ht.DEFAULT_UP,s=r.z===1,a=r.x===1,{container:o}=i;i.container=void 0,i=JSON.parse(JSON.stringify(i)),i.container=o;const l=s?qv:a?Yv:wr;Kv.forEach((f,p)=>{i[f]&&(i[l[p]]=i[f])});const c={enabled:!0,color:16777215,opacity:1,scale:.7,labelColor:2236962,line:!1,border:{size:0,color:14540253},hover:{color:t?16777215:9688043,labelColor:2236962,opacity:1,scale:.7,border:{size:0,color:14540253}}},u={line:!1,scale:t?.45:.7,hover:{scale:t?.5:.7}},h={type:e,container:document.body,size:128,placement:"top-right",resolution:n,lineWidth:4,radius:t?1:.2,smoothness:18,animated:!0,speed:1,background:{enabled:!0,color:t?16777215:14739180,opacity:t?0:1,hover:{color:t?16777215:14739180,opacity:t?.2:1}},font:{family:"sans-serif",weight:900},offset:{top:10,left:10,bottom:10,right:10},corners:{enabled:!t,color:t?15915362:16777215,opacity:1,scale:t?.15:.2,radius:1,smoothness:18,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:.225}},edges:{enabled:!t,color:t?15915362:16777215,opacity:t?1:0,radius:t?1:.125,smoothness:18,scale:t?.15:1,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:1}},x:{...ai(c),...t?{label:"X",color:16725587,line:!0}:{label:a?As:To}},y:{...ai(c),...t?{label:"Y",color:9100032,line:!0}:{label:s||a?Ao:As}},z:{...ai(c),...t?{label:"Z",color:2920447,line:!0}:{label:s?As:a?To:Ao}},nx:{...ai(u),label:t?"":a?ws:wo},ny:{...ai(u),label:t?"":s||a?Ro:ws},nz:{...ai(u),label:t?"":s?ws:a?wo:Ro}};return Co(i,h),Iu.forEach(f=>Co(i[`n${f}`],ai(i[f]))),{...i,isSphere:t}};function Co(i,...e){if(i instanceof HTMLElement||typeof i!="object"||i===null)return i;for(const t of e)for(const n in t)n!=="container"&&n in t&&(i[n]===void 0?i[n]=t[n]:typeof t[n]=="object"&&!Array.isArray(t[n])&&(i[n]=Co(i[n]||{},t[n])));return i}const $v=(i,e=2)=>{const t=new Ye,n=e*2,{isSphere:r,resolution:s,radius:a,font:o,corners:l,edges:c}=i,u=wr.map(w=>({...i[w],radius:a}));r&&l.enabled&&u.push(l),r&&c.enabled&&u.push(c);const h=document.createElement("canvas"),f=h.getContext("2d");h.width=s*2+n*2,h.height=s*u.length+n*u.length;const[p,g]=D(u,s,o);u.forEach(({radius:w,label:P,color:M,labelColor:x,border:b,hover:{color:O,labelColor:F,border:k}},W)=>{const B=s*W+W*n+e;y(e,B,e,s,w,P,b,M,x),y(s+e*3,B,e,s,w,P,k??b,O??M,F??x)});const _=u.length,m=e/(s*2),d=e/(s*6),E=1/_,T=new Sd(h);return T.repeat.set(.5-2*m,E-2*d),T.offset.set(m,1-d),Object.assign(T,{colorSpace:Gt,wrapS:Wi,wrapT:Wi,userData:{offsetX:m,offsetY:d,cellHeight:E}}),T;function y(w,P,M,x,b,O,F,k,W){if(b=b*(x/2),k!=null&&k!==""&&(B(),f.fillStyle=t.set(k).getStyle(),f.fill()),F&&F.size){const J=F.size*x/2;w+=J,P+=J,x-=F.size*x,b=Math.max(0,b-J),B(),f.strokeStyle=t.set(F.color).getStyle(),f.lineWidth=F.size*x,f.stroke()}O&&C(f,w+x/2,P+(x+M)/2,O,t.set(W).getStyle());function B(){f.beginPath(),f.moveTo(w+b,P),f.lineTo(w+x-b,P),f.arcTo(w+x,P,w+x,P+b,b),f.lineTo(w+x,P+x-b),f.arcTo(w+x,P+x,w+x-b,P+x,b),f.lineTo(w+b,P+x),f.arcTo(w,P+x,w,P+x-b,b),f.lineTo(w,P+b),f.arcTo(w,P,w+b,P,b),f.closePath()}}function D(w,P,M){const x=[...w].sort((ge,se)=>{var ke,je;return(((ke=ge.label)==null?void 0:ke.length)||0)-(((je=se.label)==null?void 0:je.length)||0)}).pop().label,{family:b,weight:O}=M,F=r?Math.sqrt(Math.pow(P*.7,2)/2):P;let k=F,W=0,B=0;do{f.font=`${O} ${k}px ${b}`;const ge=f.measureText(x);W=ge.width,B=ge.fontBoundingBoxDescent,k--}while(W>F&&k>0);const J=F/B,V=Math.min(F/W,J),le=Math.floor(k*V);return[`${O} ${le}px ${b}`,J]}function C(w,P,M,x,b){w.font=p,w.textAlign="center",w.textBaseline="middle",w.fillStyle=b,w.fillText(x,P,M+(r?g:0))}},Jv=(i,e)=>i.offset.x=(e?.5:0)+i.userData.offsetX,jo=(i,e)=>{const{offset:t,userData:{offsetY:n,cellHeight:r}}=i;t.y=1-(e+1)*r+n};function $o(i,e,t=2,n=2){const r=t/2-i,s=n/2-i,a=i/t,o=(t-i)/t,l=i/n,c=(n-i)/n,u=[r,s,0,-r,s,0,-r,-s,0,r,-s,0],h=[o,c,a,c,a,l,o,l],f=[3*(e+1)+3,3*(e+1)+4,e+4,e+5,2*(e+1)+4,2,1,2*(e+1)+3,3,4*(e+1)+3,4,0],p=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11].map(C=>f[C]);let g,_,m,d,E,T,y,D;for(let C=0;C<4;C++){d=C<1||C>2?r:-r,E=C<2?s:-s,T=C<1||C>2?o:a,y=C<2?c:l;for(let w=0;w<=e;w++)g=Math.PI/2*(C+w/e),_=Math.cos(g),m=Math.sin(g),u.push(d+i*_,E+i*m,0),h.push(T+a*_,y+l*m),w<e&&(D=(e+1)*C+w+4,p.push(C,D,D+1))}return new Dt().setIndex(new Nt(new Uint32Array(p),1)).setAttribute("position",new Nt(new Float32Array(u),3)).setAttribute("uv",new Nt(new Float32Array(h),2))}const Zv=(i,e)=>{const t=new L,{isSphere:n,radius:r,smoothness:s}=i,a=$o(r,s);return wr.map((o,l)=>{const c=l<3,u=wr[l],h=l?e.clone():e;jo(h,l);const{enabled:f,scale:p,opacity:g,hover:_}=i[u],m={map:h,opacity:g,transparent:!0},d=n?new Go(new zs(m)):new Rt(a,new gi(m)),E=c?u:u[1];return d.position[E]=(c?1:-1)*(n?Nu:1),n||d.lookAt(t.copy(d.position).multiplyScalar(1.7)),d.scale.setScalar(p),d.renderOrder=1,d.visible=f,d.userData={scale:p,opacity:g,hover:_},d})},Qv=(i,e)=>{const{isSphere:t,corners:n}=i;if(!n.enabled)return[];const{color:r,opacity:s,scale:a,radius:o,smoothness:l,hover:c}=n,u=t?null:$o(o,l),h={transparent:!0,opacity:s},f=[1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1].map(g=>g*.85),p=new L;return Array(f.length/3).fill(0).map((g,_)=>{if(t){const E=e.clone();jo(E,6),h.map=E}else h.color=r;const m=t?new Go(new zs(h)):new Rt(u,new gi(h)),d=_*3;return m.position.set(f[d],f[d+1],f[d+2]),t&&m.position.normalize().multiplyScalar(1.7),m.scale.setScalar(a),m.lookAt(p.copy(m.position).multiplyScalar(2)),m.renderOrder=1,m.userData={color:r,opacity:s,scale:a,hover:c},m})},e0=(i,e,t)=>{const{isSphere:n,edges:r}=i;if(!r.enabled)return[];const{color:s,opacity:a,scale:o,hover:l,radius:c,smoothness:u}=r,h=n?null:$o(c,u,1.2,.25),f={transparent:!0,opacity:a},p=[0,1,1,0,-1,1,1,0,1,-1,0,1,0,1,-1,0,-1,-1,1,0,-1,-1,0,-1,1,1,0,1,-1,0,-1,1,0,-1,-1,0].map(m=>m*.925),g=new L,_=new L(0,1,0);return Array(p.length/3).fill(0).map((m,d)=>{if(n){const y=e.clone();jo(y,t),f.map=y}else f.color=s;const E=n?new Go(new zs(f)):new Rt(h,new gi(f)),T=d*3;return E.position.set(p[T],p[T+1],p[T+2]),n&&E.position.normalize().multiplyScalar(1.7),E.scale.setScalar(o),E.up.copy(_),E.lookAt(g.copy(E.position).multiplyScalar(2)),!n&&!E.position.y&&(E.rotation.z=Math.PI/2),E.renderOrder=1,E.userData={color:s,opacity:a,scale:o,hover:l},E})};function t0(i,e=!1){const t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},a={},o=i[0].morphTargetsRelative,l=new Dt;let c=0;for(let u=0;u<i.length;++u){const h=i[u];let f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const p in h.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(h.attributes[p]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(o!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const p in h.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(h.morphAttributes[p])}if(e){let p;if(t)p=h.index.count;else if(h.attributes.position!==void 0)p=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(t){let u=0;const h=[];for(let f=0;f<i.length;++f){const p=i[f].index;for(let g=0;g<p.count;++g)h.push(p.getX(g)+u);u+=i[f].attributes.position.count}l.setIndex(h)}for(const u in s){const h=Pc(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(const u in a){const h=a[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){const p=[];for(let _=0;_<a[u].length;++_)p.push(a[u][_][f]);const g=Pc(p);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(g)}}return l}function Pc(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){const u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}const a=new e(s),o=new Nt(a,t,n);let l=0;for(let c=0;c<i.length;++c){const u=i[c];if(u.isInterleavedBufferAttribute){const h=l/t;for(let f=0,p=u.count;f<p;f++)for(let g=0;g<t;g++){const _=u.getComponent(f,g);o.setComponent(f+h,g,_)}}else a.set(u.array,l);l+=u.count*t}return r!==void 0&&(o.gpuType=r),o}const n0=(i,e)=>{const{isSphere:t,background:{enabled:n,color:r,opacity:s,hover:a}}=e;let o;const l=new gi({color:r,side:kt,opacity:s,transparent:!0,depthWrite:!1});if(!n)return null;if(t)o=new Rt(new ks(1.8,64,64),l);else{let c;i.forEach(u=>{const h=u.scale.x;u.scale.setScalar(.9),u.updateMatrix();const f=u.geometry.clone();f.applyMatrix4(u.matrix),c=c?t0([c,f]):f,u.scale.setScalar(h)}),o=new Rt(c,l)}return o.userData={color:r,opacity:s,hover:a},o},Lc=new En,ds=new L;class Fu extends $d{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new xt(e,3)),this.setAttribute("uv",new xt(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new So(t,6,1);return this.setAttribute("instanceStart",new Sn(n,3,0)),this.setAttribute("instanceEnd",new Sn(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new So(t,6,1);return this.setAttribute("instanceColorStart",new Sn(n,3,0)),this.setAttribute("instanceColorEnd",new Sn(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Md(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new En);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Lc.setFromBufferAttribute(t),this.boundingBox.union(Lc))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Bn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ds.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ds)),ds.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(ds));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}he.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new We(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Wt.line={uniforms:Ho.merge([he.common,he.fog,he.line]),vertexShader:`
|
|
3827
|
+
}`;class Iv{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Ct,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 On({vertexShader:Lv,fragmentShader:Uv,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Rt(new Cr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Nv extends mi{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,f=null,p=null,g=null;const _=new Iv,m=t.getContextAttributes();let d=null,E=null;const T=[],y=[],D=new We;let C=null;const w=new zt;w.viewport=new et;const P=new zt;P.viewport=new et;const M=[w,P],x=new Zd;let b=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function($){let ue=T[$];return ue===void 0&&(ue=new ma,T[$]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function($){let ue=T[$];return ue===void 0&&(ue=new ma,T[$]=ue),ue.getGripSpace()},this.getHand=function($){let ue=T[$];return ue===void 0&&(ue=new ma,T[$]=ue),ue.getHandSpace()};function F($){const ue=y.indexOf($.inputSource);if(ue===-1)return;const Le=T[ue];Le!==void 0&&(Le.update($.inputSource,$.frame,c||a),Le.dispatchEvent({type:$.type,data:$.inputSource}))}function k(){r.removeEventListener("select",F),r.removeEventListener("selectstart",F),r.removeEventListener("selectend",F),r.removeEventListener("squeeze",F),r.removeEventListener("squeezestart",F),r.removeEventListener("squeezeend",F),r.removeEventListener("end",k),r.removeEventListener("inputsourceschange",W);for(let $=0;$<T.length;$++){const ue=y[$];ue!==null&&(y[$]=null,T[$].disconnect(ue))}b=null,O=null,_.reset(),e.setRenderTarget(d),p=null,f=null,h=null,r=null,E=null,je.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(D.width,D.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function($){s=$,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function($){o=$,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function($){c=$},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function($){if(r=$,r!==null){if(d=e.getRenderTarget(),r.addEventListener("select",F),r.addEventListener("selectstart",F),r.addEventListener("selectend",F),r.addEventListener("squeeze",F),r.addEventListener("squeezestart",F),r.addEventListener("squeezeend",F),r.addEventListener("end",k),r.addEventListener("inputsourceschange",W),m.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(D),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Le=null,ye=null,Ue=null;m.depth&&(Ue=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Le=m.stencil?br:Er,ye=m.stencil?Mr:di);const tt={colorFormat:t.RGBA8,depthFormat:Ue,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(tt),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),E=new pi(f.textureWidth,f.textureHeight,{format:rn,type:Mn,depthTexture:new Mu(f.textureWidth,f.textureHeight,ye,void 0,void 0,void 0,void 0,void 0,void 0,Le),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const Le={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,Le),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),E=new pi(p.framebufferWidth,p.framebufferHeight,{format:rn,type:Mn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),je.setContext(r),je.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function W($){for(let ue=0;ue<$.removed.length;ue++){const Le=$.removed[ue],ye=y.indexOf(Le);ye>=0&&(y[ye]=null,T[ye].disconnect(Le))}for(let ue=0;ue<$.added.length;ue++){const Le=$.added[ue];let ye=y.indexOf(Le);if(ye===-1){for(let tt=0;tt<T.length;tt++)if(tt>=y.length){y.push(Le),ye=tt;break}else if(y[tt]===null){y[tt]=Le,ye=tt;break}if(ye===-1)break}const Ue=T[ye];Ue&&Ue.connect(Le)}}const B=new L,J=new L;function V($,ue,Le){B.setFromMatrixPosition(ue.matrixWorld),J.setFromMatrixPosition(Le.matrixWorld);const ye=B.distanceTo(J),Ue=ue.projectionMatrix.elements,tt=Le.projectionMatrix.elements,ze=Ue[14]/(Ue[10]-1),ft=Ue[14]/(Ue[10]+1),K=(Ue[9]+1)/Ue[5],re=(Ue[9]-1)/Ue[5],A=(Ue[8]-1)/Ue[0],De=(tt[8]+1)/tt[0],ce=ze*A,de=ze*De,X=ye/(-A+De),be=X*-A;if(ue.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(be),$.translateZ(X),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),Ue[10]===-1)$.projectionMatrix.copy(ue.projectionMatrix),$.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const Se=ze+X,pe=ft+X,Qe=ce-be,R=de+(ye-be),v=K*ft/pe*Se,z=re*ft/pe*Se;$.projectionMatrix.makePerspective(Qe,R,v,z,Se,pe),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function le($,ue){ue===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(ue.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(r===null)return;let ue=$.near,Le=$.far;_.texture!==null&&(_.depthNear>0&&(ue=_.depthNear),_.depthFar>0&&(Le=_.depthFar)),x.near=P.near=w.near=ue,x.far=P.far=w.far=Le,(b!==x.near||O!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),b=x.near,O=x.far),w.layers.mask=$.layers.mask|2,P.layers.mask=$.layers.mask|4,x.layers.mask=w.layers.mask|P.layers.mask;const ye=$.parent,Ue=x.cameras;le(x,ye);for(let tt=0;tt<Ue.length;tt++)le(Ue[tt],ye);Ue.length===2?V(x,w,P):x.projectionMatrix.copy(w.projectionMatrix),ge($,x,ye)};function ge($,ue,Le){Le===null?$.matrix.copy(ue.matrixWorld):($.matrix.copy(Le.matrixWorld),$.matrix.invert(),$.matrix.multiply(ue.matrixWorld)),$.matrix.decompose($.position,$.quaternion,$.scale),$.updateMatrixWorld(!0),$.projectionMatrix.copy(ue.projectionMatrix),$.projectionMatrixInverse.copy(ue.projectionMatrixInverse),$.isPerspectiveCamera&&($.fov=qi*2*Math.atan(1/$.projectionMatrix.elements[5]),$.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(f===null&&p===null))return l},this.setFoveation=function($){l=$,f!==null&&(f.fixedFoveation=$),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=$)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(x)};let se=null;function ke($,ue){if(u=ue.getViewerPose(c||a),g=ue,u!==null){const Le=u.views;p!==null&&(e.setRenderTargetFramebuffer(E,p.framebuffer),e.setRenderTarget(E));let ye=!1;Le.length!==x.cameras.length&&(x.cameras.length=0,ye=!0);for(let ze=0;ze<Le.length;ze++){const ft=Le[ze];let K=null;if(p!==null)K=p.getViewport(ft);else{const A=h.getViewSubImage(f,ft);K=A.viewport,ze===0&&(e.setRenderTargetTextures(E,A.colorTexture,A.depthStencilTexture),e.setRenderTarget(E))}let re=M[ze];re===void 0&&(re=new zt,re.layers.enable(ze),re.viewport=new et,M[ze]=re),re.matrix.fromArray(ft.transform.matrix),re.matrix.decompose(re.position,re.quaternion,re.scale),re.projectionMatrix.fromArray(ft.projectionMatrix),re.projectionMatrixInverse.copy(re.projectionMatrix).invert(),re.viewport.set(K.x,K.y,K.width,K.height),ze===0&&(x.matrix.copy(re.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),ye===!0&&x.cameras.push(re)}const Ue=r.enabledFeatures;if(Ue&&Ue.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&h){const ze=h.getDepthInformation(Le[0]);ze&&ze.isValid&&ze.texture&&_.init(e,ze,r.renderState)}}for(let Le=0;Le<T.length;Le++){const ye=y[Le],Ue=T[Le];ye!==null&&Ue!==void 0&&Ue.update(ye,ue,c||a)}se&&se($,ue),ue.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ue}),g=null}const je=new Ru;je.setAnimationLoop(ke),this.setAnimationLoop=function($){se=$},this.dispose=function(){}}}const si=new Jt,Fv=new Ke;function Ov(i,e){function t(m,d){m.matrixAutoUpdate===!0&&m.updateMatrix(),d.value.copy(m.matrix)}function n(m,d){d.color.getRGB(m.fogColor.value,hu(i)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function r(m,d,E,T,y){d.isMeshBasicMaterial||d.isMeshLambertMaterial?s(m,d):d.isMeshToonMaterial?(s(m,d),h(m,d)):d.isMeshPhongMaterial?(s(m,d),u(m,d)):d.isMeshStandardMaterial?(s(m,d),f(m,d),d.isMeshPhysicalMaterial&&p(m,d,y)):d.isMeshMatcapMaterial?(s(m,d),g(m,d)):d.isMeshDepthMaterial?s(m,d):d.isMeshDistanceMaterial?(s(m,d),_(m,d)):d.isMeshNormalMaterial?s(m,d):d.isLineBasicMaterial?(a(m,d),d.isLineDashedMaterial&&o(m,d)):d.isPointsMaterial?l(m,d,E,T):d.isSpriteMaterial?c(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function s(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.bumpMap&&(m.bumpMap.value=d.bumpMap,t(d.bumpMap,m.bumpMapTransform),m.bumpScale.value=d.bumpScale,d.side===kt&&(m.bumpScale.value*=-1)),d.normalMap&&(m.normalMap.value=d.normalMap,t(d.normalMap,m.normalMapTransform),m.normalScale.value.copy(d.normalScale),d.side===kt&&m.normalScale.value.negate()),d.displacementMap&&(m.displacementMap.value=d.displacementMap,t(d.displacementMap,m.displacementMapTransform),m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap,t(d.emissiveMap,m.emissiveMapTransform)),d.specularMap&&(m.specularMap.value=d.specularMap,t(d.specularMap,m.specularMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);const E=e.get(d),T=E.envMap,y=E.envMapRotation;T&&(m.envMap.value=T,si.copy(y),si.x*=-1,si.y*=-1,si.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(si.y*=-1,si.z*=-1),m.envMapRotation.value.setFromMatrix4(Fv.makeRotationFromEuler(si)),m.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap&&(m.lightMap.value=d.lightMap,m.lightMapIntensity.value=d.lightMapIntensity,t(d.lightMap,m.lightMapTransform)),d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,m.aoMapTransform))}function a(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform))}function o(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,E,T){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*E,m.scale.value=T*.5,d.map&&(m.map.value=d.map,t(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function h(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function f(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,m.roughnessMapTransform)),d.envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function p(m,d,E){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===kt&&m.clearcoatNormalScale.value.negate())),d.dispersion>0&&(m.dispersion.value=d.dispersion),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(m.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(m.anisotropyMap.value=d.anisotropyMap,t(d.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,d){d.matcap&&(m.matcap.value=d.matcap)}function _(m,d){const E=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Bv(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const y=T.program;n.uniformBlockBinding(E,y)}function c(E,T){let y=r[E.id];y===void 0&&(g(E),y=u(E),r[E.id]=y,E.addEventListener("dispose",m));const D=T.program;n.updateUBOMapping(E,D);const C=e.render.frame;s[E.id]!==C&&(f(E),s[E.id]=C)}function u(E){const T=h();E.__bindingPointIndex=T;const y=i.createBuffer(),D=E.__size,C=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,D,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,T,y),y}function h(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(E){const T=r[E.id],y=E.uniforms,D=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,T);for(let C=0,w=y.length;C<w;C++){const P=Array.isArray(y[C])?y[C]:[y[C]];for(let M=0,x=P.length;M<x;M++){const b=P[M];if(p(b,C,M,D)===!0){const O=b.__offset,F=Array.isArray(b.value)?b.value:[b.value];let k=0;for(let W=0;W<F.length;W++){const B=F[W],J=_(B);typeof B=="number"||typeof B=="boolean"?(b.__data[0]=B,i.bufferSubData(i.UNIFORM_BUFFER,O+k,b.__data)):B.isMatrix3?(b.__data[0]=B.elements[0],b.__data[1]=B.elements[1],b.__data[2]=B.elements[2],b.__data[3]=0,b.__data[4]=B.elements[3],b.__data[5]=B.elements[4],b.__data[6]=B.elements[5],b.__data[7]=0,b.__data[8]=B.elements[6],b.__data[9]=B.elements[7],b.__data[10]=B.elements[8],b.__data[11]=0):(B.toArray(b.__data,k),k+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,O,b.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(E,T,y,D){const C=E.value,w=T+"_"+y;if(D[w]===void 0)return typeof C=="number"||typeof C=="boolean"?D[w]=C:D[w]=C.clone(),!0;{const P=D[w];if(typeof C=="number"||typeof C=="boolean"){if(P!==C)return D[w]=C,!0}else if(P.equals(C)===!1)return P.copy(C),!0}return!1}function g(E){const T=E.uniforms;let y=0;const D=16;for(let w=0,P=T.length;w<P;w++){const M=Array.isArray(T[w])?T[w]:[T[w]];for(let x=0,b=M.length;x<b;x++){const O=M[x],F=Array.isArray(O.value)?O.value:[O.value];for(let k=0,W=F.length;k<W;k++){const B=F[k],J=_(B),V=y%D,le=V%J.boundary,ge=V+le;y+=le,ge!==0&&D-ge<J.storage&&(y+=D-ge),O.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=y,y+=J.storage}}}const C=y%D;return C>0&&(y+=D-C),E.__size=y,E.__cache={},this}function _(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function m(E){const T=E.target;T.removeEventListener("dispose",m);const y=a.indexOf(T.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(r[T.id]),delete r[T.id],delete s[T.id]}function d(){for(const E in r)i.deleteBuffer(r[E]);a=[],r={},s={}}return{bind:l,update:c,dispose:d}}class zv{constructor(e={}){const{canvas:t=Vf(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:f=!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 g=new Uint32Array(4),_=new Int32Array(4);let m=null,d=null;const E=[],T=[];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=jn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let D=!1;this._outputColorSpace=Gt;let C=0,w=0,P=null,M=-1,x=null;const b=new et,O=new et;let F=null;const k=new Ye(0);let W=0,B=t.width,J=t.height,V=1,le=null,ge=null;const se=new et(0,0,B,J),ke=new et(0,0,B,J);let je=!1;const $=new Xo;let ue=!1,Le=!1;const ye=new Ke,Ue=new Ke,tt=new L,ze=new et,ft={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let K=!1;function re(){return P===null?V:1}let A=n;function De(S,I){return t.getContext(S,I)}try{const S={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Po}`),t.addEventListener("webglcontextlost",Te,!1),t.addEventListener("webglcontextrestored",ie,!1),t.addEventListener("webglcontextcreationerror",Z,!1),A===null){const I="webgl2";if(A=De(I,S),A===null)throw De(I)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let ce,de,X,be,Se,pe,Qe,R,v,z,j,Q,q,Re,oe,Me,Pe,ee,Ee,Fe,Ne,fe,Ve,U;function _e(){ce=new jg(A),ce.init(),fe=new Pv(A,ce),de=new Hg(A,ce,e,fe),X=new Cv(A,ce),de.reverseDepthBuffer&&f&&X.buffers.depth.setReversed(!0),be=new Zg(A),Se=new gv,pe=new Dv(A,ce,X,Se,de,fe,be),Qe=new Wg(y),R=new Kg(y),v=new rp(A),Ve=new kg(A,v),z=new $g(A,v,be,Ve),j=new e_(A,z,v,be),Ee=new Qg(A,de,pe),Me=new Gg(Se),Q=new mv(y,Qe,R,ce,de,Ve,Me),q=new Ov(y,Se),Re=new vv,oe=new bv(ce),ee=new zg(y,Qe,R,X,j,p,l),Pe=new wv(y,j,de),U=new Bv(A,be,de,X),Fe=new Vg(A,ce,be),Ne=new Jg(A,ce,be),be.programs=Q.programs,y.capabilities=de,y.extensions=ce,y.properties=Se,y.renderLists=Re,y.shadowMap=Pe,y.state=X,y.info=be}_e();const te=new Nv(y,A);this.xr=te,this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){const S=ce.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=ce.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(S){S!==void 0&&(V=S,this.setSize(B,J,!1))},this.getSize=function(S){return S.set(B,J)},this.setSize=function(S,I,H=!0){if(te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}B=S,J=I,t.width=Math.floor(S*V),t.height=Math.floor(I*V),H===!0&&(t.style.width=S+"px",t.style.height=I+"px"),this.setViewport(0,0,S,I)},this.getDrawingBufferSize=function(S){return S.set(B*V,J*V).floor()},this.setDrawingBufferSize=function(S,I,H){B=S,J=I,V=H,t.width=Math.floor(S*H),t.height=Math.floor(I*H),this.setViewport(0,0,S,I)},this.getCurrentViewport=function(S){return S.copy(b)},this.getViewport=function(S){return S.copy(se)},this.setViewport=function(S,I,H,G){S.isVector4?se.set(S.x,S.y,S.z,S.w):se.set(S,I,H,G),X.viewport(b.copy(se).multiplyScalar(V).round())},this.getScissor=function(S){return S.copy(ke)},this.setScissor=function(S,I,H,G){S.isVector4?ke.set(S.x,S.y,S.z,S.w):ke.set(S,I,H,G),X.scissor(O.copy(ke).multiplyScalar(V).round())},this.getScissorTest=function(){return je},this.setScissorTest=function(S){X.setScissorTest(je=S)},this.setOpaqueSort=function(S){le=S},this.setTransparentSort=function(S){ge=S},this.getClearColor=function(S){return S.copy(ee.getClearColor())},this.setClearColor=function(){ee.setClearColor(...arguments)},this.getClearAlpha=function(){return ee.getClearAlpha()},this.setClearAlpha=function(){ee.setClearAlpha(...arguments)},this.clear=function(S=!0,I=!0,H=!0){let G=0;if(S){let N=!1;if(P!==null){const ae=P.texture.format;N=ae===Oo||ae===Fo||ae===No}if(N){const ae=P.texture.type,xe=ae===Mn||ae===di||ae===Sr||ae===Mr||ae===Uo||ae===Io,Ce=ee.getClearColor(),Ae=ee.getClearAlpha(),He=Ce.r,Ge=Ce.g,Ie=Ce.b;xe?(g[0]=He,g[1]=Ge,g[2]=Ie,g[3]=Ae,A.clearBufferuiv(A.COLOR,0,g)):(_[0]=He,_[1]=Ge,_[2]=Ie,_[3]=Ae,A.clearBufferiv(A.COLOR,0,_))}else G|=A.COLOR_BUFFER_BIT}I&&(G|=A.DEPTH_BUFFER_BIT),H&&(G|=A.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),A.clear(G)},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",Te,!1),t.removeEventListener("webglcontextrestored",ie,!1),t.removeEventListener("webglcontextcreationerror",Z,!1),ee.dispose(),Re.dispose(),oe.dispose(),Se.dispose(),Qe.dispose(),R.dispose(),j.dispose(),Ve.dispose(),U.dispose(),Q.dispose(),te.dispose(),te.removeEventListener("sessionstart",$n),te.removeEventListener("sessionend",Oe),ve.stop()};function Te(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function ie(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const S=be.autoReset,I=Pe.enabled,H=Pe.autoUpdate,G=Pe.needsUpdate,N=Pe.type;_e(),be.autoReset=S,Pe.enabled=I,Pe.autoUpdate=H,Pe.needsUpdate=G,Pe.type=N}function Z(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function we(S){const I=S.target;I.removeEventListener("dispose",we),ne(I)}function ne(S){Je(S),Se.remove(S)}function Je(S){const I=Se.get(S).programs;I!==void 0&&(I.forEach(function(H){Q.releaseProgram(H)}),S.isShaderMaterial&&Q.releaseShaderCache(S))}this.renderBufferDirect=function(S,I,H,G,N,ae){I===null&&(I=ft);const xe=N.isMesh&&N.matrixWorld.determinant()<0,Ce=Lr(S,I,H,G,N);X.setMaterial(G,xe);let Ae=H.index,He=1;if(G.wireframe===!0){if(Ae=z.getWireframeAttribute(H),Ae===void 0)return;He=2}const Ge=H.drawRange,Ie=H.attributes.position;let nt=Ge.start*He,lt=(Ge.start+Ge.count)*He;ae!==null&&(nt=Math.max(nt,ae.start*He),lt=Math.min(lt,(ae.start+ae.count)*He)),Ae!==null?(nt=Math.max(nt,0),lt=Math.min(lt,Ae.count)):Ie!=null&&(nt=Math.max(nt,0),lt=Math.min(lt,Ie.count));const pt=lt-nt;if(pt<0||pt===1/0)return;Ve.setup(N,G,Ce,H,Ae);let mt,rt=Fe;if(Ae!==null&&(mt=v.get(Ae),rt=Ne,rt.setIndex(mt)),N.isMesh)G.wireframe===!0?(X.setLineWidth(G.wireframeLinewidth*re()),rt.setMode(A.LINES)):rt.setMode(A.TRIANGLES);else if(N.isLine){let Be=G.linewidth;Be===void 0&&(Be=1),X.setLineWidth(Be*re()),N.isLineSegments?rt.setMode(A.LINES):N.isLineLoop?rt.setMode(A.LINE_LOOP):rt.setMode(A.LINE_STRIP)}else N.isPoints?rt.setMode(A.POINTS):N.isSprite&&rt.setMode(A.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)zi("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),rt.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if(ce.get("WEBGL_multi_draw"))rt.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Be=N._multiDrawStarts,bt=N._multiDrawCounts,at=N._multiDrawCount,an=Ae?v.get(Ae).bytesPerElement:1,_i=Se.get(G).currentProgram.getUniforms();for(let qt=0;qt<at;qt++)_i.setValue(A,"_gl_DrawID",qt),rt.render(Be[qt]/an,bt[qt])}else if(N.isInstancedMesh)rt.renderInstances(nt,pt,N.count);else if(H.isInstancedBufferGeometry){const Be=H._maxInstanceCount!==void 0?H._maxInstanceCount:1/0,bt=Math.min(H.instanceCount,Be);rt.renderInstances(nt,pt,bt)}else rt.render(nt,pt)};function Xe(S,I,H){S.transparent===!0&&S.side===_n&&S.forceSinglePass===!1?(S.side=kt,S.needsUpdate=!0,Jn(S,I,H),S.side=Fn,S.needsUpdate=!0,Jn(S,I,H),S.side=_n):Jn(S,I,H)}this.compile=function(S,I,H=null){H===null&&(H=S),d=oe.get(H),d.init(I),T.push(d),H.traverseVisible(function(N){N.isLight&&N.layers.test(I.layers)&&(d.pushLight(N),N.castShadow&&d.pushShadow(N))}),S!==H&&S.traverseVisible(function(N){N.isLight&&N.layers.test(I.layers)&&(d.pushLight(N),N.castShadow&&d.pushShadow(N))}),d.setupLights();const G=new Set;return S.traverse(function(N){if(!(N.isMesh||N.isPoints||N.isLine||N.isSprite))return;const ae=N.material;if(ae)if(Array.isArray(ae))for(let xe=0;xe<ae.length;xe++){const Ce=ae[xe];Xe(Ce,H,N),G.add(Ce)}else Xe(ae,H,N),G.add(ae)}),d=T.pop(),G},this.compileAsync=function(S,I,H=null){const G=this.compile(S,I,H);return new Promise(N=>{function ae(){if(G.forEach(function(xe){Se.get(xe).currentProgram.isReady()&&G.delete(xe)}),G.size===0){N(S);return}setTimeout(ae,10)}ce.get("KHR_parallel_shader_compile")!==null?ae():setTimeout(ae,10)})};let _t=null;function sn(S){_t&&_t(S)}function $n(){ve.stop()}function Oe(){ve.start()}const ve=new Ru;ve.setAnimationLoop(sn),typeof self<"u"&&ve.setContext(self),this.setAnimationLoop=function(S){_t=S,te.setAnimationLoop(S),S===null?ve.stop():ve.start()},te.addEventListener("sessionstart",$n),te.addEventListener("sessionend",Oe),this.render=function(S,I){if(I!==void 0&&I.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),I.parent===null&&I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),te.enabled===!0&&te.isPresenting===!0&&(te.cameraAutoUpdate===!0&&te.updateCamera(I),I=te.getCamera()),S.isScene===!0&&S.onBeforeRender(y,S,I,P),d=oe.get(S,T.length),d.init(I),T.push(d),Ue.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),$.setFromProjectionMatrix(Ue),Le=this.localClippingEnabled,ue=Me.init(this.clippingPlanes,Le),m=Re.get(S,E.length),m.init(),E.push(m),te.enabled===!0&&te.isPresenting===!0){const ae=y.xr.getDepthSensingMesh();ae!==null&&vt(ae,I,-1/0,y.sortObjects)}vt(S,I,0,y.sortObjects),m.finish(),y.sortObjects===!0&&m.sort(le,ge),K=te.enabled===!1||te.isPresenting===!1||te.hasDepthSensing()===!1,K&&ee.addToRenderList(m,S),this.info.render.frame++,ue===!0&&Me.beginShadows();const H=d.state.shadowsArray;Pe.render(H,S,I),ue===!0&&Me.endShadows(),this.info.autoReset===!0&&this.info.reset();const G=m.opaque,N=m.transmissive;if(d.setupLights(),I.isArrayCamera){const ae=I.cameras;if(N.length>0)for(let xe=0,Ce=ae.length;xe<Ce;xe++){const Ae=ae[xe];Mt(G,N,S,Ae)}K&&ee.render(S);for(let xe=0,Ce=ae.length;xe<Ce;xe++){const Ae=ae[xe];pn(m,S,Ae,Ae.viewport)}}else N.length>0&&Mt(G,N,S,I),K&&ee.render(S),pn(m,S,I);P!==null&&w===0&&(pe.updateMultisampleRenderTarget(P),pe.updateRenderTargetMipmap(P)),S.isScene===!0&&S.onAfterRender(y,S,I),Ve.resetDefaultState(),M=-1,x=null,T.pop(),T.length>0?(d=T[T.length-1],ue===!0&&Me.setGlobalState(y.clippingPlanes,d.state.camera)):d=null,E.pop(),E.length>0?m=E[E.length-1]:m=null};function vt(S,I,H,G){if(S.visible===!1)return;if(S.layers.test(I.layers)){if(S.isGroup)H=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(I);else if(S.isLight)d.pushLight(S),S.castShadow&&d.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||$.intersectsSprite(S)){G&&ze.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Ue);const xe=j.update(S),Ce=S.material;Ce.visible&&m.push(S,xe,Ce,H,ze.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||$.intersectsObject(S))){const xe=j.update(S),Ce=S.material;if(G&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),ze.copy(S.boundingSphere.center)):(xe.boundingSphere===null&&xe.computeBoundingSphere(),ze.copy(xe.boundingSphere.center)),ze.applyMatrix4(S.matrixWorld).applyMatrix4(Ue)),Array.isArray(Ce)){const Ae=xe.groups;for(let He=0,Ge=Ae.length;He<Ge;He++){const Ie=Ae[He],nt=Ce[Ie.materialIndex];nt&&nt.visible&&m.push(S,xe,nt,H,ze.z,Ie)}}else Ce.visible&&m.push(S,xe,Ce,H,ze.z,null)}}const ae=S.children;for(let xe=0,Ce=ae.length;xe<Ce;xe++)vt(ae[xe],I,H,G)}function pn(S,I,H,G){const N=S.opaque,ae=S.transmissive,xe=S.transparent;d.setupLightsView(H),ue===!0&&Me.setGlobalState(y.clippingPlanes,H),G&&X.viewport(b.copy(G)),N.length>0&&Lt(N,I,H),ae.length>0&&Lt(ae,I,H),xe.length>0&&Lt(xe,I,H),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function Mt(S,I,H,G){if((H.isScene===!0?H.overrideMaterial:null)!==null)return;d.state.transmissionRenderTarget[G.id]===void 0&&(d.state.transmissionRenderTarget[G.id]=new pi(1,1,{generateMipmaps:!0,type:ce.has("EXT_color_buffer_half_float")||ce.has("EXT_color_buffer_float")?Rr:Mn,minFilter:Ln,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:it.workingColorSpace}));const ae=d.state.transmissionRenderTarget[G.id],xe=G.viewport||b;ae.setSize(xe.z*y.transmissionResolutionScale,xe.w*y.transmissionResolutionScale);const Ce=y.getRenderTarget();y.setRenderTarget(ae),y.getClearColor(k),W=y.getClearAlpha(),W<1&&y.setClearColor(16777215,.5),y.clear(),K&&ee.render(H);const Ae=y.toneMapping;y.toneMapping=jn;const He=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),d.setupLightsView(G),ue===!0&&Me.setGlobalState(y.clippingPlanes,G),Lt(S,H,G),pe.updateMultisampleRenderTarget(ae),pe.updateRenderTargetMipmap(ae),ce.has("WEBGL_multisampled_render_to_texture")===!1){let Ge=!1;for(let Ie=0,nt=I.length;Ie<nt;Ie++){const lt=I[Ie],pt=lt.object,mt=lt.geometry,rt=lt.material,Be=lt.group;if(rt.side===_n&&pt.layers.test(G.layers)){const bt=rt.side;rt.side=kt,rt.needsUpdate=!0,Zt(pt,H,G,mt,rt,Be),rt.side=bt,rt.needsUpdate=!0,Ge=!0}}Ge===!0&&(pe.updateMultisampleRenderTarget(ae),pe.updateRenderTargetMipmap(ae))}y.setRenderTarget(Ce),y.setClearColor(k,W),He!==void 0&&(G.viewport=He),y.toneMapping=Ae}function Lt(S,I,H){const G=I.isScene===!0?I.overrideMaterial:null;for(let N=0,ae=S.length;N<ae;N++){const xe=S[N],Ce=xe.object,Ae=xe.geometry,He=xe.group;let Ge=xe.material;Ge.allowOverride===!0&&G!==null&&(Ge=G),Ce.layers.test(H.layers)&&Zt(Ce,I,H,Ae,Ge,He)}}function Zt(S,I,H,G,N,ae){S.onBeforeRender(y,I,H,G,N,ae),S.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,S.matrixWorld),S.normalMatrix.getNormalMatrix(S.modelViewMatrix),N.onBeforeRender(y,I,H,G,S,ae),N.transparent===!0&&N.side===_n&&N.forceSinglePass===!1?(N.side=kt,N.needsUpdate=!0,y.renderBufferDirect(H,I,G,N,S,ae),N.side=Fn,N.needsUpdate=!0,y.renderBufferDirect(H,I,G,N,S,ae),N.side=_n):y.renderBufferDirect(H,I,G,N,S,ae),S.onAfterRender(y,I,H,G,N,ae)}function Jn(S,I,H){I.isScene!==!0&&(I=ft);const G=Se.get(S),N=d.state.lights,ae=d.state.shadowsArray,xe=N.state.version,Ce=Q.getParameters(S,N.state,ae,I,H),Ae=Q.getProgramCacheKey(Ce);let He=G.programs;G.environment=S.isMeshStandardMaterial?I.environment:null,G.fog=I.fog,G.envMap=(S.isMeshStandardMaterial?R:Qe).get(S.envMap||G.environment),G.envMapRotation=G.environment!==null&&S.envMap===null?I.environmentRotation:S.envMapRotation,He===void 0&&(S.addEventListener("dispose",we),He=new Map,G.programs=He);let Ge=He.get(Ae);if(Ge!==void 0){if(G.currentProgram===Ge&&G.lightsStateVersion===xe)return tr(S,Ce),Ge}else Ce.uniforms=Q.getUniforms(S),S.onBeforeCompile(Ce,y),Ge=Q.acquireProgram(Ce,Ae),He.set(Ae,Ge),G.uniforms=Ce.uniforms;const Ie=G.uniforms;return(!S.isShaderMaterial&&!S.isRawShaderMaterial||S.clipping===!0)&&(Ie.clippingPlanes=Me.uniform),tr(S,Ce),G.needsLights=Ir(S),G.lightsStateVersion=xe,G.needsLights&&(Ie.ambientLightColor.value=N.state.ambient,Ie.lightProbe.value=N.state.probe,Ie.directionalLights.value=N.state.directional,Ie.directionalLightShadows.value=N.state.directionalShadow,Ie.spotLights.value=N.state.spot,Ie.spotLightShadows.value=N.state.spotShadow,Ie.rectAreaLights.value=N.state.rectArea,Ie.ltc_1.value=N.state.rectAreaLTC1,Ie.ltc_2.value=N.state.rectAreaLTC2,Ie.pointLights.value=N.state.point,Ie.pointLightShadows.value=N.state.pointShadow,Ie.hemisphereLights.value=N.state.hemi,Ie.directionalShadowMap.value=N.state.directionalShadowMap,Ie.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Ie.spotShadowMap.value=N.state.spotShadowMap,Ie.spotLightMatrix.value=N.state.spotLightMatrix,Ie.spotLightMap.value=N.state.spotLightMap,Ie.pointShadowMap.value=N.state.pointShadowMap,Ie.pointShadowMatrix.value=N.state.pointShadowMatrix),G.currentProgram=Ge,G.uniformsList=null,Ge}function er(S){if(S.uniformsList===null){const I=S.currentProgram.getUniforms();S.uniformsList=Ts.seqWithValue(I.seq,S.uniforms)}return S.uniformsList}function tr(S,I){const H=Se.get(S);H.outputColorSpace=I.outputColorSpace,H.batching=I.batching,H.batchingColor=I.batchingColor,H.instancing=I.instancing,H.instancingColor=I.instancingColor,H.instancingMorph=I.instancingMorph,H.skinning=I.skinning,H.morphTargets=I.morphTargets,H.morphNormals=I.morphNormals,H.morphColors=I.morphColors,H.morphTargetsCount=I.morphTargetsCount,H.numClippingPlanes=I.numClippingPlanes,H.numIntersection=I.numClipIntersection,H.vertexAlphas=I.vertexAlphas,H.vertexTangents=I.vertexTangents,H.toneMapping=I.toneMapping}function Lr(S,I,H,G,N){I.isScene!==!0&&(I=ft),pe.resetTextureUnits();const ae=I.fog,xe=G.isMeshStandardMaterial?I.environment:null,Ce=P===null?y.outputColorSpace:P.isXRRenderTarget===!0?P.texture.colorSpace:Xi,Ae=(G.isMeshStandardMaterial?R:Qe).get(G.envMap||xe),He=G.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Ge=!!H.attributes.tangent&&(!!G.normalMap||G.anisotropy>0),Ie=!!H.morphAttributes.position,nt=!!H.morphAttributes.normal,lt=!!H.morphAttributes.color;let pt=jn;G.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(pt=y.toneMapping);const mt=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,rt=mt!==void 0?mt.length:0,Be=Se.get(G),bt=d.state.lights;if(ue===!0&&(Le===!0||S!==x)){const Ft=S===x&&G.id===M;Me.setState(G,S,Ft)}let at=!1;G.version===Be.__version?(Be.needsLights&&Be.lightsStateVersion!==bt.state.version||Be.outputColorSpace!==Ce||N.isBatchedMesh&&Be.batching===!1||!N.isBatchedMesh&&Be.batching===!0||N.isBatchedMesh&&Be.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Be.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Be.instancing===!1||!N.isInstancedMesh&&Be.instancing===!0||N.isSkinnedMesh&&Be.skinning===!1||!N.isSkinnedMesh&&Be.skinning===!0||N.isInstancedMesh&&Be.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Be.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Be.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Be.instancingMorph===!1&&N.morphTexture!==null||Be.envMap!==Ae||G.fog===!0&&Be.fog!==ae||Be.numClippingPlanes!==void 0&&(Be.numClippingPlanes!==Me.numPlanes||Be.numIntersection!==Me.numIntersection)||Be.vertexAlphas!==He||Be.vertexTangents!==Ge||Be.morphTargets!==Ie||Be.morphNormals!==nt||Be.morphColors!==lt||Be.toneMapping!==pt||Be.morphTargetsCount!==rt)&&(at=!0):(at=!0,Be.__version=G.version);let an=Be.currentProgram;at===!0&&(an=Jn(G,I,N));let _i=!1,qt=!1,ir=!1;const dt=an.getUniforms(),Qt=Be.uniforms;if(X.useProgram(an.program)&&(_i=!0,qt=!0,ir=!0),G.id!==M&&(M=G.id,qt=!0),_i||x!==S){X.buffers.depth.getReversed()?(ye.copy(S.projectionMatrix),Gf(ye),Wf(ye),dt.setValue(A,"projectionMatrix",ye)):dt.setValue(A,"projectionMatrix",S.projectionMatrix),dt.setValue(A,"viewMatrix",S.matrixWorldInverse);const Vt=dt.map.cameraPosition;Vt!==void 0&&Vt.setValue(A,tt.setFromMatrixPosition(S.matrixWorld)),de.logarithmicDepthBuffer&&dt.setValue(A,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&dt.setValue(A,"isOrthographic",S.isOrthographicCamera===!0),x!==S&&(x=S,qt=!0,ir=!0)}if(N.isSkinnedMesh){dt.setOptional(A,N,"bindMatrix"),dt.setOptional(A,N,"bindMatrixInverse");const Ft=N.skeleton;Ft&&(Ft.boneTexture===null&&Ft.computeBoneTexture(),dt.setValue(A,"boneTexture",Ft.boneTexture,pe))}N.isBatchedMesh&&(dt.setOptional(A,N,"batchingTexture"),dt.setValue(A,"batchingTexture",N._matricesTexture,pe),dt.setOptional(A,N,"batchingIdTexture"),dt.setValue(A,"batchingIdTexture",N._indirectTexture,pe),dt.setOptional(A,N,"batchingColorTexture"),N._colorsTexture!==null&&dt.setValue(A,"batchingColorTexture",N._colorsTexture,pe));const en=H.morphAttributes;if((en.position!==void 0||en.normal!==void 0||en.color!==void 0)&&Ee.update(N,H,an),(qt||Be.receiveShadow!==N.receiveShadow)&&(Be.receiveShadow=N.receiveShadow,dt.setValue(A,"receiveShadow",N.receiveShadow)),G.isMeshGouraudMaterial&&G.envMap!==null&&(Qt.envMap.value=Ae,Qt.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),G.isMeshStandardMaterial&&G.envMap===null&&I.environment!==null&&(Qt.envMapIntensity.value=I.environmentIntensity),qt&&(dt.setValue(A,"toneMappingExposure",y.toneMappingExposure),Be.needsLights&&Ur(Qt,ir),ae&&G.fog===!0&&q.refreshFogUniforms(Qt,ae),q.refreshMaterialUniforms(Qt,G,V,J,d.state.transmissionRenderTarget[S.id]),Ts.upload(A,er(Be),Qt,pe)),G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(Ts.upload(A,er(Be),Qt,pe),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&dt.setValue(A,"center",N.center),dt.setValue(A,"modelViewMatrix",N.modelViewMatrix),dt.setValue(A,"normalMatrix",N.normalMatrix),dt.setValue(A,"modelMatrix",N.matrixWorld),G.isShaderMaterial||G.isRawShaderMaterial){const Ft=G.uniformsGroups;for(let Vt=0,Xs=Ft.length;Vt<Xs;Vt++){const Qn=Ft[Vt];U.update(Qn,an),U.bind(Qn,an)}}return an}function Ur(S,I){S.ambientLightColor.needsUpdate=I,S.lightProbe.needsUpdate=I,S.directionalLights.needsUpdate=I,S.directionalLightShadows.needsUpdate=I,S.pointLights.needsUpdate=I,S.pointLightShadows.needsUpdate=I,S.spotLights.needsUpdate=I,S.spotLightShadows.needsUpdate=I,S.rectAreaLights.needsUpdate=I,S.hemisphereLights.needsUpdate=I}function Ir(S){return S.isMeshLambertMaterial||S.isMeshToonMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isShadowMaterial||S.isShaderMaterial&&S.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return P},this.setRenderTargetTextures=function(S,I,H){const G=Se.get(S);G.__autoAllocateDepthBuffer=S.resolveDepthBuffer===!1,G.__autoAllocateDepthBuffer===!1&&(G.__useRenderToTexture=!1),Se.get(S.texture).__webglTexture=I,Se.get(S.depthTexture).__webglTexture=G.__autoAllocateDepthBuffer?void 0:H,G.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(S,I){const H=Se.get(S);H.__webglFramebuffer=I,H.__useDefaultFramebuffer=I===void 0};const nr=A.createFramebuffer();this.setRenderTarget=function(S,I=0,H=0){P=S,C=I,w=H;let G=!0,N=null,ae=!1,xe=!1;if(S){const Ae=Se.get(S);if(Ae.__useDefaultFramebuffer!==void 0)X.bindFramebuffer(A.FRAMEBUFFER,null),G=!1;else if(Ae.__webglFramebuffer===void 0)pe.setupRenderTarget(S);else if(Ae.__hasExternalTextures)pe.rebindTextures(S,Se.get(S.texture).__webglTexture,Se.get(S.depthTexture).__webglTexture);else if(S.depthBuffer){const Ie=S.depthTexture;if(Ae.__boundDepthTexture!==Ie){if(Ie!==null&&Se.has(Ie)&&(S.width!==Ie.image.width||S.height!==Ie.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");pe.setupDepthRenderbuffer(S)}}const He=S.texture;(He.isData3DTexture||He.isDataArrayTexture||He.isCompressedArrayTexture)&&(xe=!0);const Ge=Se.get(S).__webglFramebuffer;S.isWebGLCubeRenderTarget?(Array.isArray(Ge[I])?N=Ge[I][H]:N=Ge[I],ae=!0):S.samples>0&&pe.useMultisampledRTT(S)===!1?N=Se.get(S).__webglMultisampledFramebuffer:Array.isArray(Ge)?N=Ge[H]:N=Ge,b.copy(S.viewport),O.copy(S.scissor),F=S.scissorTest}else b.copy(se).multiplyScalar(V).floor(),O.copy(ke).multiplyScalar(V).floor(),F=je;if(H!==0&&(N=nr),X.bindFramebuffer(A.FRAMEBUFFER,N)&&G&&X.drawBuffers(S,N),X.viewport(b),X.scissor(O),X.setScissorTest(F),ae){const Ae=Se.get(S.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+I,Ae.__webglTexture,H)}else if(xe){const Ae=Se.get(S.texture),He=I;A.framebufferTextureLayer(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ae.__webglTexture,H,He)}else if(S!==null&&H!==0){const Ae=Se.get(S.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Ae.__webglTexture,H)}M=-1},this.readRenderTargetPixels=function(S,I,H,G,N,ae,xe,Ce=0){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ae=Se.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&xe!==void 0&&(Ae=Ae[xe]),Ae){X.bindFramebuffer(A.FRAMEBUFFER,Ae);try{const He=S.textures[Ce],Ge=He.format,Ie=He.type;if(!de.textureFormatReadable(Ge)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!de.textureTypeReadable(Ie)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}I>=0&&I<=S.width-G&&H>=0&&H<=S.height-N&&(S.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+Ce),A.readPixels(I,H,G,N,fe.convert(Ge),fe.convert(Ie),ae))}finally{const He=P!==null?Se.get(P).__webglFramebuffer:null;X.bindFramebuffer(A.FRAMEBUFFER,He)}}},this.readRenderTargetPixelsAsync=async function(S,I,H,G,N,ae,xe,Ce=0){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ae=Se.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&xe!==void 0&&(Ae=Ae[xe]),Ae)if(I>=0&&I<=S.width-G&&H>=0&&H<=S.height-N){X.bindFramebuffer(A.FRAMEBUFFER,Ae);const He=S.textures[Ce],Ge=He.format,Ie=He.type;if(!de.textureFormatReadable(Ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!de.textureTypeReadable(Ie))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const nt=A.createBuffer();A.bindBuffer(A.PIXEL_PACK_BUFFER,nt),A.bufferData(A.PIXEL_PACK_BUFFER,ae.byteLength,A.STREAM_READ),S.textures.length>1&&A.readBuffer(A.COLOR_ATTACHMENT0+Ce),A.readPixels(I,H,G,N,fe.convert(Ge),fe.convert(Ie),0);const lt=P!==null?Se.get(P).__webglFramebuffer:null;X.bindFramebuffer(A.FRAMEBUFFER,lt);const pt=A.fenceSync(A.SYNC_GPU_COMMANDS_COMPLETE,0);return A.flush(),await Hf(A,pt,4),A.bindBuffer(A.PIXEL_PACK_BUFFER,nt),A.getBufferSubData(A.PIXEL_PACK_BUFFER,0,ae),A.deleteBuffer(nt),A.deleteSync(pt),ae}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(S,I=null,H=0){const G=Math.pow(2,-H),N=Math.floor(S.image.width*G),ae=Math.floor(S.image.height*G),xe=I!==null?I.x:0,Ce=I!==null?I.y:0;pe.setTexture2D(S,0),A.copyTexSubImage2D(A.TEXTURE_2D,H,0,0,xe,Ce,N,ae),X.unbindTexture()};const Xt=A.createFramebuffer(),Zn=A.createFramebuffer();this.copyTextureToTexture=function(S,I,H=null,G=null,N=0,ae=null){ae===null&&(N!==0?(zi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ae=N,N=0):ae=0);let xe,Ce,Ae,He,Ge,Ie,nt,lt,pt;const mt=S.isCompressedTexture?S.mipmaps[ae]:S.image;if(H!==null)xe=H.max.x-H.min.x,Ce=H.max.y-H.min.y,Ae=H.isBox3?H.max.z-H.min.z:1,He=H.min.x,Ge=H.min.y,Ie=H.isBox3?H.min.z:0;else{const en=Math.pow(2,-N);xe=Math.floor(mt.width*en),Ce=Math.floor(mt.height*en),S.isDataArrayTexture?Ae=mt.depth:S.isData3DTexture?Ae=Math.floor(mt.depth*en):Ae=1,He=0,Ge=0,Ie=0}G!==null?(nt=G.x,lt=G.y,pt=G.z):(nt=0,lt=0,pt=0);const rt=fe.convert(I.format),Be=fe.convert(I.type);let bt;I.isData3DTexture?(pe.setTexture3D(I,0),bt=A.TEXTURE_3D):I.isDataArrayTexture||I.isCompressedArrayTexture?(pe.setTexture2DArray(I,0),bt=A.TEXTURE_2D_ARRAY):(pe.setTexture2D(I,0),bt=A.TEXTURE_2D),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,I.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,I.unpackAlignment);const at=A.getParameter(A.UNPACK_ROW_LENGTH),an=A.getParameter(A.UNPACK_IMAGE_HEIGHT),_i=A.getParameter(A.UNPACK_SKIP_PIXELS),qt=A.getParameter(A.UNPACK_SKIP_ROWS),ir=A.getParameter(A.UNPACK_SKIP_IMAGES);A.pixelStorei(A.UNPACK_ROW_LENGTH,mt.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,mt.height),A.pixelStorei(A.UNPACK_SKIP_PIXELS,He),A.pixelStorei(A.UNPACK_SKIP_ROWS,Ge),A.pixelStorei(A.UNPACK_SKIP_IMAGES,Ie);const dt=S.isDataArrayTexture||S.isData3DTexture,Qt=I.isDataArrayTexture||I.isData3DTexture;if(S.isDepthTexture){const en=Se.get(S),Ft=Se.get(I),Vt=Se.get(en.__renderTarget),Xs=Se.get(Ft.__renderTarget);X.bindFramebuffer(A.READ_FRAMEBUFFER,Vt.__webglFramebuffer),X.bindFramebuffer(A.DRAW_FRAMEBUFFER,Xs.__webglFramebuffer);for(let Qn=0;Qn<Ae;Qn++)dt&&(A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Se.get(S).__webglTexture,N,Ie+Qn),A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Se.get(I).__webglTexture,ae,pt+Qn)),A.blitFramebuffer(He,Ge,xe,Ce,nt,lt,xe,Ce,A.DEPTH_BUFFER_BIT,A.NEAREST);X.bindFramebuffer(A.READ_FRAMEBUFFER,null),X.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else if(N!==0||S.isRenderTargetTexture||Se.has(S)){const en=Se.get(S),Ft=Se.get(I);X.bindFramebuffer(A.READ_FRAMEBUFFER,Xt),X.bindFramebuffer(A.DRAW_FRAMEBUFFER,Zn);for(let Vt=0;Vt<Ae;Vt++)dt?A.framebufferTextureLayer(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,en.__webglTexture,N,Ie+Vt):A.framebufferTexture2D(A.READ_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,en.__webglTexture,N),Qt?A.framebufferTextureLayer(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,Ft.__webglTexture,ae,pt+Vt):A.framebufferTexture2D(A.DRAW_FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_2D,Ft.__webglTexture,ae),N!==0?A.blitFramebuffer(He,Ge,xe,Ce,nt,lt,xe,Ce,A.COLOR_BUFFER_BIT,A.NEAREST):Qt?A.copyTexSubImage3D(bt,ae,nt,lt,pt+Vt,He,Ge,xe,Ce):A.copyTexSubImage2D(bt,ae,nt,lt,He,Ge,xe,Ce);X.bindFramebuffer(A.READ_FRAMEBUFFER,null),X.bindFramebuffer(A.DRAW_FRAMEBUFFER,null)}else Qt?S.isDataTexture||S.isData3DTexture?A.texSubImage3D(bt,ae,nt,lt,pt,xe,Ce,Ae,rt,Be,mt.data):I.isCompressedArrayTexture?A.compressedTexSubImage3D(bt,ae,nt,lt,pt,xe,Ce,Ae,rt,mt.data):A.texSubImage3D(bt,ae,nt,lt,pt,xe,Ce,Ae,rt,Be,mt):S.isDataTexture?A.texSubImage2D(A.TEXTURE_2D,ae,nt,lt,xe,Ce,rt,Be,mt.data):S.isCompressedTexture?A.compressedTexSubImage2D(A.TEXTURE_2D,ae,nt,lt,mt.width,mt.height,rt,mt.data):A.texSubImage2D(A.TEXTURE_2D,ae,nt,lt,xe,Ce,rt,Be,mt);A.pixelStorei(A.UNPACK_ROW_LENGTH,at),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,an),A.pixelStorei(A.UNPACK_SKIP_PIXELS,_i),A.pixelStorei(A.UNPACK_SKIP_ROWS,qt),A.pixelStorei(A.UNPACK_SKIP_IMAGES,ir),ae===0&&I.generateMipmaps&&A.generateMipmap(bt),X.unbindTexture()},this.copyTextureToTexture3D=function(S,I,H=null,G=null,N=0){return zi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(S,I,H,G,N)},this.initRenderTarget=function(S){Se.get(S).__webglFramebuffer===void 0&&pe.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?pe.setTextureCube(S,0):S.isData3DTexture?pe.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?pe.setTexture2DArray(S,0):pe.setTexture2D(S,0),X.unbindTexture()},this.resetState=function(){C=0,w=0,P=null,X.reset(),Ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Un}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=it._getDrawingBufferColorSpace(e),t.unpackColorSpace=it._getUnpackColorSpace()}}var kv=Object.defineProperty,Vv=(i,e,t)=>e in i?kv(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ot=(i,e,t)=>Vv(i,typeof e!="symbol"?e+"":e,t);const Uu=(i,e)=>{const[t,n]=e.split("-");return Object.assign(i.style,{left:n==="left"?"0":n==="center"?"50%":"",right:n==="right"?"0":"",top:t==="top"?"0":t==="bottom"?"":"50%",bottom:t==="bottom"?"0":"",transform:`${n==="center"?"translateX(-50%)":""} ${t==="center"?"translateY(-50%)":""}`}),e},Hv=({placement:i,size:e,offset:t,id:n,className:r})=>{const s=document.createElement("div"),{top:a,left:o,right:l,bottom:c}=t;return Object.assign(s.style,{id:n,position:"absolute",zIndex:"1000",height:`${e}px`,width:`${e}px`,margin:`${a}px ${l}px ${c}px ${o}px`,borderRadius:"100%"}),Uu(s,i),n&&(s.id=n),r&&(s.className=r),s},Gv=i=>{const e=typeof i=="string"?document.querySelector(i):i;if(!e)throw Error("Invalid DOM element");return e};function bo(i,e,t){return Math.max(e,Math.min(t,i))}const Wv=[["x",0,3],["y",1,4],["z",2,5]],Tc=new L;function Ac({isSphere:i},e,t){i&&(Tc.set(0,0,1).applyQuaternion(t.quaternion),Wv.forEach(([n,r,s])=>{const a=Tc[n];let o=e[r],l=o.userData.opacity;o.material.opacity=bo(a>=0?l:l/2,0,1),o=e[s],l=o.userData.opacity,o.material.opacity=bo(a>=0?l/2:l,0,1)}))}const Xv=(i,e,t=10)=>Math.abs(i.clientX-e.x)<t&&Math.abs(i.clientY-e.y)<t,wc=new ep,Rc=new We,Cc=(i,e,t,n)=>{Rc.set((i.clientX-e.left)/e.width*2-1,-((i.clientY-e.top)/e.height)*2+1),wc.setFromCamera(Rc,t);const r=wc.intersectObjects(n,!1),s=r.length?r[0]:null;return!s||!s.object.visible?null:s},Ca=1e-6,qv=2*Math.PI,Iu=["x","y","z"],wr=[...Iu,"nx","ny","nz"],Yv=["x","z","y","nx","nz","ny"],Kv=["z","x","y","nz","nx","ny"],To="Right",As="Top",Ao="Front",wo="Left",ws="Bottom",Ro="Back",jv=[To,As,Ao,wo,ws,Ro].map(i=>i.toLocaleLowerCase()),Nu=1.3,Dc=(i,e=!0)=>{const{material:t,userData:n}=i,{color:r,opacity:s}=e?n.hover:n;t.color.set(r),t.opacity=s},ai=i=>JSON.parse(JSON.stringify(i)),$v=i=>{const e=i.type||"sphere",t=e==="sphere",n=i.resolution||t?64:128,r=ht.DEFAULT_UP,s=r.z===1,a=r.x===1,{container:o}=i;i.container=void 0,i=JSON.parse(JSON.stringify(i)),i.container=o;const l=s?Yv:a?Kv:wr;jv.forEach((f,p)=>{i[f]&&(i[l[p]]=i[f])});const c={enabled:!0,color:16777215,opacity:1,scale:.7,labelColor:2236962,line:!1,border:{size:0,color:14540253},hover:{color:t?16777215:9688043,labelColor:2236962,opacity:1,scale:.7,border:{size:0,color:14540253}}},u={line:!1,scale:t?.45:.7,hover:{scale:t?.5:.7}},h={type:e,container:document.body,size:128,placement:"top-right",resolution:n,lineWidth:4,radius:t?1:.2,smoothness:18,animated:!0,speed:1,background:{enabled:!0,color:t?16777215:14739180,opacity:t?0:1,hover:{color:t?16777215:14739180,opacity:t?.2:1}},font:{family:"sans-serif",weight:900},offset:{top:10,left:10,bottom:10,right:10},corners:{enabled:!t,color:t?15915362:16777215,opacity:1,scale:t?.15:.2,radius:1,smoothness:18,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:.225}},edges:{enabled:!t,color:t?15915362:16777215,opacity:t?1:0,radius:t?1:.125,smoothness:18,scale:t?.15:1,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:1}},x:{...ai(c),...t?{label:"X",color:16725587,line:!0}:{label:a?As:To}},y:{...ai(c),...t?{label:"Y",color:9100032,line:!0}:{label:s||a?Ao:As}},z:{...ai(c),...t?{label:"Z",color:2920447,line:!0}:{label:s?As:a?To:Ao}},nx:{...ai(u),label:t?"":a?ws:wo},ny:{...ai(u),label:t?"":s||a?Ro:ws},nz:{...ai(u),label:t?"":s?ws:a?wo:Ro}};return Co(i,h),Iu.forEach(f=>Co(i[`n${f}`],ai(i[f]))),{...i,isSphere:t}};function Co(i,...e){if(i instanceof HTMLElement||typeof i!="object"||i===null)return i;for(const t of e)for(const n in t)n!=="container"&&n in t&&(i[n]===void 0?i[n]=t[n]:typeof t[n]=="object"&&!Array.isArray(t[n])&&(i[n]=Co(i[n]||{},t[n])));return i}const Jv=(i,e=2)=>{const t=new Ye,n=e*2,{isSphere:r,resolution:s,radius:a,font:o,corners:l,edges:c}=i,u=wr.map(w=>({...i[w],radius:a}));r&&l.enabled&&u.push(l),r&&c.enabled&&u.push(c);const h=document.createElement("canvas"),f=h.getContext("2d");h.width=s*2+n*2,h.height=s*u.length+n*u.length;const[p,g]=D(u,s,o);u.forEach(({radius:w,label:P,color:M,labelColor:x,border:b,hover:{color:O,labelColor:F,border:k}},W)=>{const B=s*W+W*n+e;y(e,B,e,s,w,P,b,M,x),y(s+e*3,B,e,s,w,P,k??b,O??M,F??x)});const _=u.length,m=e/(s*2),d=e/(s*6),E=1/_,T=new Md(h);return T.repeat.set(.5-2*m,E-2*d),T.offset.set(m,1-d),Object.assign(T,{colorSpace:Gt,wrapS:Wi,wrapT:Wi,userData:{offsetX:m,offsetY:d,cellHeight:E}}),T;function y(w,P,M,x,b,O,F,k,W){if(b=b*(x/2),k!=null&&k!==""&&(B(),f.fillStyle=t.set(k).getStyle(),f.fill()),F&&F.size){const J=F.size*x/2;w+=J,P+=J,x-=F.size*x,b=Math.max(0,b-J),B(),f.strokeStyle=t.set(F.color).getStyle(),f.lineWidth=F.size*x,f.stroke()}O&&C(f,w+x/2,P+(x+M)/2,O,t.set(W).getStyle());function B(){f.beginPath(),f.moveTo(w+b,P),f.lineTo(w+x-b,P),f.arcTo(w+x,P,w+x,P+b,b),f.lineTo(w+x,P+x-b),f.arcTo(w+x,P+x,w+x-b,P+x,b),f.lineTo(w+b,P+x),f.arcTo(w,P+x,w,P+x-b,b),f.lineTo(w,P+b),f.arcTo(w,P,w+b,P,b),f.closePath()}}function D(w,P,M){const x=[...w].sort((ge,se)=>{var ke,je;return(((ke=ge.label)==null?void 0:ke.length)||0)-(((je=se.label)==null?void 0:je.length)||0)}).pop().label,{family:b,weight:O}=M,F=r?Math.sqrt(Math.pow(P*.7,2)/2):P;let k=F,W=0,B=0;do{f.font=`${O} ${k}px ${b}`;const ge=f.measureText(x);W=ge.width,B=ge.fontBoundingBoxDescent,k--}while(W>F&&k>0);const J=F/B,V=Math.min(F/W,J),le=Math.floor(k*V);return[`${O} ${le}px ${b}`,J]}function C(w,P,M,x,b){w.font=p,w.textAlign="center",w.textBaseline="middle",w.fillStyle=b,w.fillText(x,P,M+(r?g:0))}},Zv=(i,e)=>i.offset.x=(e?.5:0)+i.userData.offsetX,jo=(i,e)=>{const{offset:t,userData:{offsetY:n,cellHeight:r}}=i;t.y=1-(e+1)*r+n};function $o(i,e,t=2,n=2){const r=t/2-i,s=n/2-i,a=i/t,o=(t-i)/t,l=i/n,c=(n-i)/n,u=[r,s,0,-r,s,0,-r,-s,0,r,-s,0],h=[o,c,a,c,a,l,o,l],f=[3*(e+1)+3,3*(e+1)+4,e+4,e+5,2*(e+1)+4,2,1,2*(e+1)+3,3,4*(e+1)+3,4,0],p=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11].map(C=>f[C]);let g,_,m,d,E,T,y,D;for(let C=0;C<4;C++){d=C<1||C>2?r:-r,E=C<2?s:-s,T=C<1||C>2?o:a,y=C<2?c:l;for(let w=0;w<=e;w++)g=Math.PI/2*(C+w/e),_=Math.cos(g),m=Math.sin(g),u.push(d+i*_,E+i*m,0),h.push(T+a*_,y+l*m),w<e&&(D=(e+1)*C+w+4,p.push(C,D,D+1))}return new Pt().setIndex(new Dt(new Uint32Array(p),1)).setAttribute("position",new Dt(new Float32Array(u),3)).setAttribute("uv",new Dt(new Float32Array(h),2))}const Qv=(i,e)=>{const t=new L,{isSphere:n,radius:r,smoothness:s}=i,a=$o(r,s);return wr.map((o,l)=>{const c=l<3,u=wr[l],h=l?e.clone():e;jo(h,l);const{enabled:f,scale:p,opacity:g,hover:_}=i[u],m={map:h,opacity:g,transparent:!0},d=n?new Go(new zs(m)):new Rt(a,new gi(m)),E=c?u:u[1];return d.position[E]=(c?1:-1)*(n?Nu:1),n||d.lookAt(t.copy(d.position).multiplyScalar(1.7)),d.scale.setScalar(p),d.renderOrder=1,d.visible=f,d.userData={scale:p,opacity:g,hover:_},d})},e0=(i,e)=>{const{isSphere:t,corners:n}=i;if(!n.enabled)return[];const{color:r,opacity:s,scale:a,radius:o,smoothness:l,hover:c}=n,u=t?null:$o(o,l),h={transparent:!0,opacity:s},f=[1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1].map(g=>g*.85),p=new L;return Array(f.length/3).fill(0).map((g,_)=>{if(t){const E=e.clone();jo(E,6),h.map=E}else h.color=r;const m=t?new Go(new zs(h)):new Rt(u,new gi(h)),d=_*3;return m.position.set(f[d],f[d+1],f[d+2]),t&&m.position.normalize().multiplyScalar(1.7),m.scale.setScalar(a),m.lookAt(p.copy(m.position).multiplyScalar(2)),m.renderOrder=1,m.userData={color:r,opacity:s,scale:a,hover:c},m})},t0=(i,e,t)=>{const{isSphere:n,edges:r}=i;if(!r.enabled)return[];const{color:s,opacity:a,scale:o,hover:l,radius:c,smoothness:u}=r,h=n?null:$o(c,u,1.2,.25),f={transparent:!0,opacity:a},p=[0,1,1,0,-1,1,1,0,1,-1,0,1,0,1,-1,0,-1,-1,1,0,-1,-1,0,-1,1,1,0,1,-1,0,-1,1,0,-1,-1,0].map(m=>m*.925),g=new L,_=new L(0,1,0);return Array(p.length/3).fill(0).map((m,d)=>{if(n){const y=e.clone();jo(y,t),f.map=y}else f.color=s;const E=n?new Go(new zs(f)):new Rt(h,new gi(f)),T=d*3;return E.position.set(p[T],p[T+1],p[T+2]),n&&E.position.normalize().multiplyScalar(1.7),E.scale.setScalar(o),E.up.copy(_),E.lookAt(g.copy(E.position).multiplyScalar(2)),!n&&!E.position.y&&(E.rotation.z=Math.PI/2),E.renderOrder=1,E.userData={color:s,opacity:a,scale:o,hover:l},E})};function n0(i,e=!1){const t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},a={},o=i[0].morphTargetsRelative,l=new Pt;let c=0;for(let u=0;u<i.length;++u){const h=i[u];let f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const p in h.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(h.attributes[p]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(o!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const p in h.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(h.morphAttributes[p])}if(e){let p;if(t)p=h.index.count;else if(h.attributes.position!==void 0)p=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(t){let u=0;const h=[];for(let f=0;f<i.length;++f){const p=i[f].index;for(let g=0;g<p.count;++g)h.push(p.getX(g)+u);u+=i[f].attributes.position.count}l.setIndex(h)}for(const u in s){const h=Pc(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(const u in a){const h=a[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){const p=[];for(let _=0;_<a[u].length;++_)p.push(a[u][_][f]);const g=Pc(p);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(g)}}return l}function Pc(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){const u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}const a=new e(s),o=new Dt(a,t,n);let l=0;for(let c=0;c<i.length;++c){const u=i[c];if(u.isInterleavedBufferAttribute){const h=l/t;for(let f=0,p=u.count;f<p;f++)for(let g=0;g<t;g++){const _=u.getComponent(f,g);o.setComponent(f+h,g,_)}}else a.set(u.array,l);l+=u.count*t}return r!==void 0&&(o.gpuType=r),o}const i0=(i,e)=>{const{isSphere:t,background:{enabled:n,color:r,opacity:s,hover:a}}=e;let o;const l=new gi({color:r,side:kt,opacity:s,transparent:!0,depthWrite:!1});if(!n)return null;if(t)o=new Rt(new ks(1.8,64,64),l);else{let c;i.forEach(u=>{const h=u.scale.x;u.scale.setScalar(.9),u.updateMatrix();const f=u.geometry.clone();f.applyMatrix4(u.matrix),c=c?n0([c,f]):f,u.scale.setScalar(h)}),o=new Rt(c,l)}return o.userData={color:r,opacity:s,hover:a},o},Lc=new En,ds=new L;class Fu extends Jd{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new xt(e,3)),this.setAttribute("uv",new xt(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new So(t,6,1);return this.setAttribute("instanceStart",new Sn(n,3,0)),this.setAttribute("instanceEnd",new Sn(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new So(t,6,1);return this.setAttribute("instanceColorStart",new Sn(n,3,0)),this.setAttribute("instanceColorEnd",new Sn(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Ed(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new En);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Lc.setFromBufferAttribute(t),this.boundingBox.union(Lc))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Bn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ds.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ds)),ds.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(ds));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}he.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new We(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Wt.line={uniforms:Ho.merge([he.common,he.fog,he.line]),vertexShader:`
|
|
3828
3828
|
#include <common>
|
|
3829
3829
|
#include <color_pars_vertex>
|
|
3830
3830
|
#include <fog_pars_vertex>
|
|
@@ -4194,4 +4194,4 @@ void main() {
|
|
|
4194
4194
|
#include <premultiplied_alpha_fragment>
|
|
4195
4195
|
|
|
4196
4196
|
}
|
|
4197
|
-
`};class Jo extends On{constructor(e){super({type:"LineMaterial",uniforms:Ho.clone(Wt.line.uniforms),vertexShader:Wt.line.vertexShader,fragmentShader:Wt.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Da=new et,Uc=new L,Ic=new L,Tt=new et,At=new et,mn=new et,Pa=new L,La=new Ke,wt=new ep,Nc=new L,ps=new En,ms=new Bn,gn=new et;let vn,hi;function Fc(i,e,t){return gn.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),gn.multiplyScalar(1/gn.w),gn.x=hi/t.width,gn.y=hi/t.height,gn.applyMatrix4(i.projectionMatrixInverse),gn.multiplyScalar(1/gn.w),Math.abs(Math.max(gn.x,gn.y))}function i0(i,e){const t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,r.count);for(let o=0,l=a;o<l;o++){wt.start.fromBufferAttribute(r,o),wt.end.fromBufferAttribute(s,o),wt.applyMatrix4(t);const c=new L,u=new L;vn.distanceSqToSegment(wt.start,wt.end,u,c),u.distanceTo(c)<hi*.5&&e.push({point:u,pointOnLine:c,distance:vn.origin.distanceTo(u),object:i,face:null,faceIndex:o,uv:null,uv1:null})}}function r0(i,e,t){const n=e.projectionMatrix,r=i.material.resolution,s=i.matrixWorld,a=i.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),u=-e.near;vn.at(1,mn),mn.w=1,mn.applyMatrix4(e.matrixWorldInverse),mn.applyMatrix4(n),mn.multiplyScalar(1/mn.w),mn.x*=r.x/2,mn.y*=r.y/2,mn.z=0,Pa.copy(mn),La.multiplyMatrices(e.matrixWorldInverse,s);for(let h=0,f=c;h<f;h++){if(Tt.fromBufferAttribute(o,h),At.fromBufferAttribute(l,h),Tt.w=1,At.w=1,Tt.applyMatrix4(La),At.applyMatrix4(La),Tt.z>u&&At.z>u)continue;if(Tt.z>u){const d=Tt.z-At.z,E=(Tt.z-u)/d;Tt.lerp(At,E)}else if(At.z>u){const d=At.z-Tt.z,E=(At.z-u)/d;At.lerp(Tt,E)}Tt.applyMatrix4(n),At.applyMatrix4(n),Tt.multiplyScalar(1/Tt.w),At.multiplyScalar(1/At.w),Tt.x*=r.x/2,Tt.y*=r.y/2,At.x*=r.x/2,At.y*=r.y/2,wt.start.copy(Tt),wt.start.z=0,wt.end.copy(At),wt.end.z=0;const p=wt.closestPointToPointParameter(Pa,!0);wt.at(p,Nc);const g=su.lerp(Tt.z,At.z,p),_=g>=-1&&g<=1,m=Pa.distanceTo(Nc)<hi*.5;if(_&&m){wt.start.fromBufferAttribute(o,h),wt.end.fromBufferAttribute(l,h),wt.start.applyMatrix4(s),wt.end.applyMatrix4(s);const d=new L,E=new L;vn.distanceSqToSegment(wt.start,wt.end,E,d),t.push({point:E,pointOnLine:d,distance:vn.origin.distanceTo(E),object:i,face:null,faceIndex:h,uv:null,uv1:null})}}}class s0 extends Rt{constructor(e=new Fu,t=new Jo({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let a=0,o=0,l=t.count;a<l;a++,o+=2)Uc.fromBufferAttribute(t,a),Ic.fromBufferAttribute(n,a),r[o]=o===0?0:r[o-1],r[o+1]=r[o]+Uc.distanceTo(Ic);const s=new So(r,2,1);return e.setAttribute("instanceDistanceStart",new Sn(s,1,0)),e.setAttribute("instanceDistanceEnd",new Sn(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,r=e.camera;r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;vn=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;hi=l.linewidth+s,o.boundingSphere===null&&o.computeBoundingSphere(),ms.copy(o.boundingSphere).applyMatrix4(a);let c;if(n)c=hi*.5;else{const h=Math.max(r.near,ms.distanceToPoint(vn.origin));c=Fc(r,h,l.resolution)}if(ms.radius+=c,vn.intersectsSphere(ms)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),ps.copy(o.boundingBox).applyMatrix4(a);let u;if(n)u=hi*.5;else{const h=Math.max(r.near,ps.distanceToPoint(vn.origin));u=Fc(r,h,l.resolution)}ps.expandByScalar(u),vn.intersectsBox(ps)!==!1&&(n?i0(this,t):r0(this,r,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Da),this.material.uniforms.resolution.value.set(Da.z,Da.w))}}class Ou extends Fu{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){const t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class a0 extends s0{constructor(e=new Ou,t=new Jo({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const o0=i=>{const e=new Ye,t=[],n=[],{isSphere:r}=i;if(wr.forEach((o,l)=>{const{enabled:c,line:u,scale:h,color:f}=i[o];if(!c||!u)return;const p=l<3?1:-1,g=(r?Nu-h/2:.975)*p;t.push(o.includes("x")?g:0,o.includes("y")?g:0,o.includes("z")?g:0,0,0,0);const _=e.set(f).toArray();n.push(..._,..._)}),!t.length)return null;const s=new Ou().setPositions(t).setColors(n),a=new Jo({linewidth:i.lineWidth,vertexColors:!0,resolution:new We(window.innerWidth,window.innerHeight)});return new a0(s,a).computeLineDistances()},l0=i=>{const{corners:e,edges:t}=i,n=[],r=$v(i),s=Zv(i,r);n.push(...s),e.enabled&&n.push(...Qv(i,r)),t.enabled&&n.push(...e0(i,r,e.enabled?7:6));const a=n0(s,i),o=o0(i);return[n,a,o]},dr=(i,e=!0)=>{const{material:t,userData:n}=i,{opacity:r,color:s,scale:a}=e?n.hover:n;i.scale.setScalar(a),t.opacity=r,t.map?Jv(t.map,e):t.color.set(s)},Fi=new Ke,Oc=new wu,c0=new We,oi=new L,Bc=new et;class u0 extends ht{constructor(e,t,n={}){super(),ot(this,"enabled",!0),ot(this,"camera"),ot(this,"renderer"),ot(this,"options"),ot(this,"target",new L),ot(this,"animated",!0),ot(this,"speed",1),ot(this,"animating",!1),ot(this,"_options"),ot(this,"_intersections"),ot(this,"_background",null),ot(this,"_viewport",[0,0,0,0]),ot(this,"_originalViewport",[0,0,0,0]),ot(this,"_originalScissor",[0,0,0,0]),ot(this,"_scene"),ot(this,"_camera"),ot(this,"_container"),ot(this,"_domElement"),ot(this,"_domRect"),ot(this,"_dragging",!1),ot(this,"_distance",0),ot(this,"_clock",new Zd),ot(this,"_targetQuaternion",new fn),ot(this,"_quaternionStart",new fn),ot(this,"_quaternionEnd",new fn),ot(this,"_pointerStart",new We),ot(this,"_focus",null),ot(this,"_placement"),ot(this,"_controls"),ot(this,"_controlsListeners"),this.camera=e,this.renderer=t,this._scene=new pu().add(this),this.set(n)}get placement(){return this._placement}set placement(e){this._placement=Uu(this._domElement,e),this.domUpdate()}set(e={}){this.dispose(),this.options=e,this._options=jv(e),this._camera=this._options.isSphere?new Hs(-1.8,1.8,1.8,-1.8,5,10):new zt(26,1,5,10),this._camera.position.set(0,0,7);const[t,n,r]=l0(this._options);n&&this.add(n),r&&this.add(r),this.add(...t),this._background=n,this._intersections=t;const{container:s,animated:a,speed:o}=this._options;return this.animated=a,this.speed=o,this._container=s?Hv(s):document.body,this._domElement=Vv(this._options),this._domElement.onpointerdown=l=>this._onPointerDown(l),this._domElement.onpointermove=l=>this._onPointerMove(l),this._domElement.onpointerleave=()=>this._onPointerLeave(),this._container.appendChild(this._domElement),this._controls&&this.attachControls(this._controls),this.update(),this._updateOrientation(!0),this}render(){this.animating&&this._animate();const{renderer:e,_viewport:t}=this,n=e.getScissorTest(),r=e.autoClear;return e.autoClear=!1,e.setViewport(...t),n&&e.setScissor(...t),e.clear(!1,!0,!1),e.render(this._scene,this._camera),e.setViewport(...this._originalViewport),n&&e.setScissor(...this._originalScissor),e.autoClear=r,this}domUpdate(){this._domRect=this._domElement.getBoundingClientRect();const e=this.renderer,t=this._domRect,n=e.domElement.getBoundingClientRect();return this._viewport.splice(0,4,t.left-n.left,e.domElement.clientHeight-(t.top-n.top+t.height),t.width,t.height),e.getViewport(Bc).toArray(this._originalViewport),e.getScissorTest()&&e.getScissor(Bc).toArray(this._originalScissor),this}cameraUpdate(){return this._updateOrientation(),this}update(e=!0){return e&&this._controls&&this._controls.update(),this.domUpdate().cameraUpdate()}attachControls(e){return this.detachControls(),this.target=e.target,this._controlsListeners={start:()=>e.enabled=!1,end:()=>e.enabled=!0,change:()=>this.update(!1)},this.addEventListener("start",this._controlsListeners.start),this.addEventListener("end",this._controlsListeners.end),e.addEventListener("change",this._controlsListeners.change),this._controls=e,this}detachControls(){if(!(!this._controlsListeners||!this._controls))return this.target=new L().copy(this._controls.target),this.removeEventListener("start",this._controlsListeners.start),this.removeEventListener("end",this._controlsListeners.end),this._controls.removeEventListener("change",this._controlsListeners.change),this._controlsListeners=void 0,this._controls=void 0,this}dispose(){var e;this.detachControls(),this.children.forEach(t=>{var n,r,s,a;this.remove(t);const o=t;(n=o.material)==null||n.dispose(),(s=(r=o.material)==null?void 0:r.map)==null||s.dispose(),(a=o.geometry)==null||a.dispose()}),(e=this._domElement)==null||e.remove()}_updateOrientation(e=!0){e&&(this.quaternion.copy(this.camera.quaternion).invert(),this.updateMatrixWorld()),Ac(this._options,this._intersections,this.camera)}_animate(){const{position:e,quaternion:t}=this.camera;if(e.set(0,0,1),!this.animated){e.applyQuaternion(this._quaternionEnd).multiplyScalar(this._distance).add(this.target),t.copy(this._targetQuaternion),this._updateOrientation(),this.animating=!1,this.dispatchEvent({type:"change"}),this.dispatchEvent({type:"end"});return}this._controls&&(this._controls.enabled=!1);const n=this._clock.getDelta()*Xv*this.speed;this._quaternionStart.rotateTowards(this._quaternionEnd,n),e.applyQuaternion(this._quaternionStart).multiplyScalar(this._distance).add(this.target),t.rotateTowards(this._targetQuaternion,n),this._updateOrientation(),requestAnimationFrame(()=>this.dispatchEvent({type:"change"})),this._quaternionStart.angleTo(this._quaternionEnd)<Ca&&(this._controls&&(this._controls.enabled=!0),this.animating=!1,this.dispatchEvent({type:"end"}))}_setOrientation(e){const t=this.camera,n=this.target;oi.copy(e).multiplyScalar(this._distance),Fi.setPosition(oi).lookAt(oi,this.position,this.up),this._targetQuaternion.setFromRotationMatrix(Fi),oi.add(n),Fi.lookAt(oi,n,this.up),this._quaternionEnd.setFromRotationMatrix(Fi),Fi.setPosition(t.position).lookAt(t.position,n,this.up),this._quaternionStart.setFromRotationMatrix(Fi),this.animating=!0,this._clock.start(),this.dispatchEvent({type:"start"})}_onPointerDown(e){if(!this.enabled)return;const t=l=>{if(!this._dragging){if(Wv(l,this._pointerStart))return;this._dragging=!0}const c=c0.set(l.clientX,l.clientY).sub(this._pointerStart).multiplyScalar(1/this._domRect.width*Math.PI),u=this.coordinateConversion(oi.subVectors(this.camera.position,this.target)),h=Oc.setFromVector3(u);h.theta=a-c.x,h.phi=bo(o-c.y,Ca,Math.PI-Ca),this.coordinateConversion(this.camera.position.setFromSpherical(h),!0).add(this.target),this.camera.lookAt(this.target),this.quaternion.copy(this.camera.quaternion).invert(),this._updateOrientation(!1),this.dispatchEvent({type:"change"})},n=()=>{if(document.removeEventListener("pointermove",t,!1),document.removeEventListener("pointerup",n,!1),!this._dragging)return this._handleClick(e);this._focus&&(dr(this._focus,!1),this._focus=null),this._dragging=!1,this.dispatchEvent({type:"end"})};if(this.animating)return;e.preventDefault(),this._pointerStart.set(e.clientX,e.clientY);const r=this.coordinateConversion(oi.subVectors(this.camera.position,this.target)),s=Oc.setFromVector3(r),a=s.theta,o=s.phi;this._distance=s.radius,document.addEventListener("pointermove",t,!1),document.addEventListener("pointerup",n,!1),this.dispatchEvent({type:"start"})}coordinateConversion(e,t=!1){const{x:n,y:r,z:s}=e,a=ht.DEFAULT_UP;return a.x===1?t?e.set(r,s,n):e.set(s,n,r):a.z===1?t?e.set(s,n,r):e.set(r,s,n):e}_onPointerMove(e){!this.enabled||this._dragging||(this._background&&Dc(this._background,!0),this._handleHover(e))}_onPointerLeave(){!this.enabled||this._dragging||(this._background&&Dc(this._background,!1),this._focus&&dr(this._focus,!1),this._domElement.style.cursor="")}_handleClick(e){const t=Cc(e,this._domRect,this._camera,this._intersections);this._focus&&(dr(this._focus,!1),this._focus=null),t&&(this._setOrientation(t.object.position),this.dispatchEvent({type:"change"}))}_handleHover(e){const t=Cc(e,this._domRect,this._camera,this._intersections),n=(t==null?void 0:t.object)||null;this._focus!==n&&(this._domElement.style.cursor=n?"pointer":"",this._focus&&dr(this._focus,!1),(this._focus=n)?dr(n,!0):Ac(this._options,this._intersections,this.camera))}}const zc=new L,h0=new Jt,gs=new Ke,Xn=new Ke,_s=new fn,vs=new L(1,1,1),xs=new L;class Ws extends ht{constructor(...e){super(...e),this.urdfNode=null,this.urdfName=""}copy(e,t){return super.copy(e,t),this.urdfNode=e.urdfNode,this.urdfName=e.urdfName,this}}class f0 extends Ws{constructor(...e){super(...e),this.isURDFCollider=!0,this.type="URDFCollider"}}class d0 extends Ws{constructor(...e){super(...e),this.isURDFVisual=!0,this.type="URDFVisual"}}class Bu extends Ws{constructor(...e){super(...e),this.isURDFLink=!0,this.type="URDFLink"}}class zu extends Ws{get jointType(){return this._jointType}set jointType(e){if(this.jointType!==e)switch(this._jointType=e,this.matrixWorldNeedsUpdate=!0,e){case"fixed":this.jointValue=[];break;case"continuous":case"revolute":case"prismatic":this.jointValue=new Array(1).fill(0);break;case"planar":this.jointValue=new Array(3).fill(0),this.axis=new L(0,0,1);break;case"floating":this.jointValue=new Array(6).fill(0);break}}get angle(){return this.jointValue[0]}constructor(...e){super(...e),this.isURDFJoint=!0,this.type="URDFJoint",this.jointValue=null,this.jointType="fixed",this.axis=new L(1,0,0),this.limit={lower:0,upper:0},this.ignoreLimits=!1,this.origPosition=null,this.origQuaternion=null,this.mimicJoints=[]}copy(e,t){return super.copy(e,t),this.jointType=e.jointType,this.axis=e.axis.clone(),this.limit.lower=e.limit.lower,this.limit.upper=e.limit.upper,this.ignoreLimits=!1,this.jointValue=[...e.jointValue],this.origPosition=e.origPosition?e.origPosition.clone():null,this.origQuaternion=e.origQuaternion?e.origQuaternion.clone():null,this.mimicJoints=[...e.mimicJoints],this}setJointValue(...e){e=e.map(n=>n===null?null:parseFloat(n)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case"fixed":return t;case"continuous":case"revolute":{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType==="revolute"&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]!==n?(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0):t)}case"prismatic":{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),zc.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(zc,n),this.jointValue[0]!==n?(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0):t)}case"floating":return this.jointValue.every((n,r)=>e[r]===n||e[r]===null)?t:(this.jointValue[0]=e[0]!==null?e[0]:this.jointValue[0],this.jointValue[1]=e[1]!==null?e[1]:this.jointValue[1],this.jointValue[2]=e[2]!==null?e[2]:this.jointValue[2],this.jointValue[3]=e[3]!==null?e[3]:this.jointValue[3],this.jointValue[4]=e[4]!==null?e[4]:this.jointValue[4],this.jointValue[5]=e[5]!==null?e[5]:this.jointValue[5],Xn.compose(this.origPosition,this.origQuaternion,vs),_s.setFromEuler(h0.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],"XYZ")),xs.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),gs.compose(xs,_s,vs),Xn.premultiply(gs),this.position.setFromMatrixPosition(Xn),this.rotation.setFromRotationMatrix(Xn),this.matrixWorldNeedsUpdate=!0,!0);case"planar":return this.jointValue.every((n,r)=>e[r]===n||e[r]===null)?t:(this.jointValue[0]=e[0]!==null?e[0]:this.jointValue[0],this.jointValue[1]=e[1]!==null?e[1]:this.jointValue[1],this.jointValue[2]=e[2]!==null?e[2]:this.jointValue[2],Xn.compose(this.origPosition,this.origQuaternion,vs),_s.setFromAxisAngle(this.axis,this.jointValue[2]),xs.set(this.jointValue[0],this.jointValue[1],0),gs.compose(xs,_s,vs),Xn.premultiply(gs),this.position.setFromMatrixPosition(Xn),this.rotation.setFromRotationMatrix(Xn),this.matrixWorldNeedsUpdate=!0,!0)}return t}}class p0 extends zu{constructor(...e){super(...e),this.type="URDFMimicJoint",this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){const t=e.map(n=>n*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}}class m0 extends Bu{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(n=>{n.isURDFJoint&&n.urdfName in e.joints&&(this.joints[n.urdfName]=n),n.isURDFLink&&n.urdfName in e.links&&(this.links[n.urdfName]=n),n.isURDFCollider&&n.urdfName in e.colliders&&(this.colliders[n.urdfName]=n),n.isURDFVisual&&n.urdfName in e.visual&&(this.visual[n.urdfName]=n)});for(const n in this.joints)this.joints[n].mimicJoints=this.joints[n].mimicJoints.map(r=>this.joints[r.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){const n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(const n in e){const r=e[n];Array.isArray(r)?t=this.setJointValue(n,...r)||t:t=this.setJointValue(n,r)||t}return t}}const ku=st.defineStore("formToTableComp",{state:()=>({selectArray:[],selectString:""}),actions:{setSelectArray(i){this.selectArray=i},setSelectString(i){this.selectString=i}}}),g0={class:"calculator-content"},_0={class:"calculator-child"},v0={class:"calculator-child"},x0=Y.defineComponent({__name:"calculator",setup(i){const e=Y.ref(),t=Y.ref();return Y.onMounted(()=>{e.value=[{type:"Upload",label:"输入",name:"input"}],t.value=[{type:"Upload",label:"输出",name:"output"}]}),(n,r)=>(Y.openBlock(),Y.createElementBlock("div",g0,[Y.createElementVNode("div",_0,[Y.createVNode(Ht.ssForm,{rowContents:e.value,isRowFlex:!0},null,8,["rowContents"])]),Y.createElementVNode("div",v0,[Y.createVNode(Ht.ssForm,{rowContents:t.value,isEdit:!1,isRowFlex:!0},null,8,["rowContents"])])]))}}),y0=Do._export_sfc(x0,[["__scopeId","data-v-73db0fe7"]]),Vu=st.defineStore("unit",{state:()=>({selectIndex:"",selectMenu:"",selectTitle:[]}),actions:{setSelectIndex(i){this.selectIndex=i},setSelectMenu(i){this.selectMenu=i},setSelectTitle(i){this.selectTitle=i}}}),Hu=(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=Hu(o,n))}),Object.assign(a,{id:s})}else return r})),t},Gu=(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 u;return Array.isArray(c)&&(c=Gu(c,(u=r==null?void 0:r[a])==null?void 0:u.children,t)),c}))),s}),n},S0=(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 M0(i,n,t)}},M0=(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=Wu(s,r,t)),s)),n},Wu=(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=Wu(o,r,t)),o)),n},E0=(i,e,t)=>{if(e==="")return t;{const n=e.split("-");return b0(i,n,t)}},b0=(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=Xu(s,r,t)),s)),n},Xu=(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=Xu(a,r,t)),a)),n},Zo=(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(u=>!(u!=null&&u.id)))!=null&&r.every(u=>typeof u!="object"||u===null))return n;if((s=n==null?void 0:n.filter(u=>!(u!=null&&u.id)))!=null&&s.some(u=>Array.isArray(u)))return n;{let u=[];if(u.push(n==null?void 0:n.find(h=>h==null?void 0:h.id)),Array.isArray(e==null?void 0:e[0])){const h=(a=n==null?void 0:n.filter(f=>!(f!=null&&f.id)))==null?void 0:a[0];(o=Ht.getColumnChild(me.cloneDeep(e==null?void 0:e[0])))==null||o.forEach(f=>{u.push(h==null?void 0:h[(f==null?void 0:f.prop)??(f==null?void 0:f.label)??f])})}else{const h=(l=n==null?void 0:n.filter(f=>!(f!=null&&f.id)))==null?void 0:l[0];(c=Ht.getColumnChild(me.cloneDeep(e)))==null||c.forEach(f=>{u.push(h==null?void 0:h[(f==null?void 0:f.prop)??(f==null?void 0:f.label)??f])})}return u}}),T0=i=>{try{return JSON.parse(i),!0}catch{return!1}},kc=(i,e)=>bh(i,e),fi=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},A0=(i,e,t)=>{var r;let n=(r=me.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(u=>u===e[l]))return c[e[l]]=o,c}))==null?void 0:a.filter(o=>o),s}),n},w0=(i,e)=>{var a,o;const t=me.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 A0(r,fi(n).slice(0,fi(n).length-1),e)},It=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=me.cloneDeep(e.compData))==null?void 0:s.find(l=>(l==null?void 0:l.key)==="tableIndexColumn"))==null?void 0:a.contents;return(o=me.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(u=>Array.isArray(u))?c==null||c[0].unshift({label:n}):c.unshift({label:n})),t.push({key:"header",contents:c})}}),e.compData=t,e},Rs=i=>{var s,a,o,l,c;const e=(s=i.compData)==null?void 0:s.filter(u=>(u==null?void 0:u.key)==="tableContents"||(u==null?void 0:u.key)==="tableIndex"),t=(o=(a=e==null?void 0:e.find(u=>(u==null?void 0:u.key)==="tableIndex"))==null?void 0:a.contents)==null?void 0:o.map(u=>u.label),n=(l=e==null?void 0:e.find(u=>(u==null?void 0:u.key)==="tableContents"))==null?void 0:l.contents;let r=[];return(t==null?void 0:t.length)>0&&(n!=null&&n.every(u=>Array.isArray(u)))?r=t==null?void 0:t.map((u,h)=>n[h]?[u,...n[h]]:[u]):Array.isArray(n==null?void 0:n[0])&&((c=n==null?void 0:n[0])!=null&&c.every(u=>Array.isArray(u)))?r=n==null?void 0:n[0]:Array.isArray(n==null?void 0:n[0])?r=n:r.push(n),r},R0=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},C0=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},D0=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},P0=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},L0=(i,e)=>{let t;function n(r,s,a=1){var l;if(!r||r.length===0)return;const o=(l=me.cloneDeep(s))==null?void 0:l.map(c=>c==null?void 0:c.filter(u=>!Array.isArray(u)));return o!=null&&o.find(c=>kc(c,r==null?void 0:r.key))?(s==null||s.forEach(c=>{!n(r,c.find(h=>Array.isArray(h)))&&kc(c.filter(h=>!Array.isArray(h)),r==null?void 0:r.key)&&(t={type:a,contents:c.filter(h=>!Array.isArray(h))})}),!0):!1}return n(i,e,0),t},Vc=(i,e)=>{function t(n,r){return!n||n.length===0||n==null?void 0:n.map((a,o)=>{var c,u;let l=a;return l.unshift((c=r==null?void 0:r[o])==null?void 0:c.label),l.some(h=>Array.isArray(h))&&(l[l.length-1]=t(l.find(h=>Array.isArray(h)),(u=r==null?void 0:r[o])==null?void 0:u.children)),l})}return t(i,e)},_r=i=>{var t,n,r,s,a,o,l,c,u,h,f,p,g,_,m,d,E,T,y,D,C,w,P,M,x;const e=i;if((i==null?void 0:i.comp)==="Table"){if((r=(n=(t=i.compData)==null?void 0:t.find(b=>(b==null?void 0:b.key)==="tableIndex"))==null?void 0:n.contents)!=null&&r.every(b=>!(b!=null&&b.children))||!((s=i.compData)!=null&&s.find(b=>(b==null?void 0:b.key)==="tableIndex")))return((l=(o=(a=e.compData)==null?void 0:a.find(b=>(b==null?void 0:b.key)==="tableContents"))==null?void 0:o.contents)==null?void 0:l.length)===1&&((f=(h=(u=(c=e.compData)==null?void 0:c.find(b=>(b==null?void 0:b.key)==="tableContents"))==null?void 0:u.contents)==null?void 0:h[0])!=null&&f.every(b=>Array.isArray(b)))?(e.compData=(p=e.compData)==null?void 0:p.map(b=>{var O;return(b==null?void 0:b.key)==="tableContents"&&(b.contents=(O=b.contents)==null?void 0:O[0]),b}),[e]):[e];{let b=[];const O=e.compData,F=(g=me.cloneDeep(O))==null?void 0:g.find(se=>(se==null?void 0:se.key)==="tableIndexColumn"),k=(_=me.cloneDeep(O))==null?void 0:_.find(se=>(se==null?void 0:se.key)==="extraButton"),W=(m=me.cloneDeep(O))==null?void 0:m.find(se=>(se==null?void 0:se.key)==="rowButton"),B=P0((E=(d=me.cloneDeep(O))==null?void 0:d.find(se=>(se==null?void 0:se.key)==="header"))==null?void 0:E.contents),J=(T=me.cloneDeep(O))==null?void 0:T.find(se=>(se==null?void 0:se.key)==="tableIndex"),V=D0((D=(y=me.cloneDeep(O))==null?void 0:y.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:D.contents),le=Vc((w=(C=me.cloneDeep(O))==null?void 0:C.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:w.contents,J==null?void 0:J.contents),ge=C0(Vc((M=(P=me.cloneDeep(O))==null?void 0:P.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:M.contents,J==null?void 0:J.contents));if(J)return(x=R0(J.contents))==null||x.forEach((se,ke)=>{var $;let je=[];je.push({key:"tableIndex",contents:se}),je.push(F),je.push(k),je.push(W),je.push({key:"tableContents",contents:V[ke]}),je.push({key:"header",contents:B!=null&&B[ke]?[B==null?void 0:B[ke]]:[B==null?void 0:B[0]]}),b.push({comp:"Table",compData:je,name:"",parentTableContents:(($=L0(ge[ke],le))==null?void 0:$.contents)??""})}),b}}else return[e]},yr=(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},U0=async i=>{let e=[];i==null||i.forEach(t=>{var n;(n=t.compData)==null||n.forEach(async r=>{var a,o;const s=(a=me.cloneDeep(r==null?void 0:r.contents))==null?void 0:a.map(l=>{var c,u,h,f;if(Array.isArray(l)){let p=(c=l==null?void 0:l.map)==null?void 0:c.call(l,g=>{var m;return(m=_r(me.cloneDeep(g)))==null?void 0:m.map(d=>{var E,T,y,D;if(g.comp==="Table")return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(d==null?void 0:d.parentTableContents)??""},value:{pageData:{comp:(E=It(me.cloneDeep(d)))==null?void 0:E.comp,compData:(T=It(me.cloneDeep(d)))==null?void 0:T.compData,name:(y=It(me.cloneDeep(d)))==null?void 0:y.name}}};if((d==null?void 0:d.key)==="extraButton"){if(((D=Object.values(d==null?void 0:d.value))==null?void 0:D.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:d.value}}}else return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(d==null?void 0:d.parentTableContents)??""},value:{pageData:d}}})});return p=(u=p==null?void 0:p.map(g=>g!=null&&g.every(_=>_)?g:[]))==null?void 0:u.filter(g=>g.length>0),(h=p==null?void 0:p[0])==null?void 0:h[0]}else{const p=(f=_r(me.cloneDeep(l)))==null?void 0:f.map(g=>{var _,m,d,E;if(l.comp==="Table")return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(g==null?void 0:g.parentTableContents)??""},value:{pageData:{comp:(_=It(me.cloneDeep(g)))==null?void 0:_.comp,compData:(m=It(me.cloneDeep(g)))==null?void 0:m.compData,name:(d=It(me.cloneDeep(g)))==null?void 0:d.name}}};if((g==null?void 0:g.key)==="extraButton"){if(((E=Object.values(g==null?void 0:g.value))==null?void 0:E.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:g.value}}}else return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(g==null?void 0:g.parentTableContents)??""},value:{pageData:g}}});return p==null?void 0:p[0]}});if((s==null?void 0:s.length)>0){const l=await st.batchAddInsofDataApi({dataList:s});e.push(l)}(o=r.contents)==null||o.forEach(async l=>{var c;Array.isArray(l)?l==null||l.forEach(async u=>{var h;(h=_r(me.cloneDeep(u)))==null||h.forEach(async f=>{var p,g,_,m,d,E;if(u.comp==="Table"){const y=(d=(m=(await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(f==null?void 0:f.parentTableContents)??""},value:{pageData:{comp:(p=It(me.cloneDeep(f)))==null?void 0:p.comp,compData:(g=It(me.cloneDeep(f)))==null?void 0:g.compData,name:(_=It(me.cloneDeep(f)))==null?void 0:_.name}}})).data.result)==null?void 0:m[0])==null?void 0:d.id,D=await((E=Rs(me.cloneDeep(f)))==null?void 0:E.map(async C=>{var x,b,O,F,k;let w;C.length!==0&&(w=await st.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:y},value:{tableData:yr(C,(F=fi((O=(b=(x=It(me.cloneDeep(f)))==null?void 0:x.compData)==null?void 0:b.find(W=>(W==null?void 0:W.key)==="header"))==null?void 0:O.contents))==null?void 0:F.filter(W=>W!=="操作"))}}));const M=await((k=(await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",parentTable:C}})).data.result)==null?void 0:k.map(async W=>await st.updateInsofDataApi({id:W.id,key:{systemKey:W.key.systemKey,pageKey:W.key.pageKey,type:W.key.type,version:W.key.version,parentTable:w.data.result}})));return e.push(M),w}));e.push(D)}})}):(c=_r(me.cloneDeep(l)))==null||c.forEach(async u=>{var h,f,p,g,_,m,d;if(l.comp==="Table"){const T=(_=(g=(await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(u==null?void 0:u.parentTableContents)??""},value:{pageData:{comp:(h=It(me.cloneDeep(u)))==null?void 0:h.comp,compData:(f=It(me.cloneDeep(u)))==null?void 0:f.compData,name:(p=It(me.cloneDeep(u)))==null?void 0:p.name}}})).data.result)==null?void 0:g[0])==null?void 0:_.id,y=(m=Rs(me.cloneDeep(u)))==null?void 0:m.map(w=>{var P,M,x,b;if((w==null?void 0:w.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:T},value:{tableData:yr(w,(b=fi((x=(M=(P=It(me.cloneDeep(u)))==null?void 0:P.compData)==null?void 0:M.find(O=>(O==null?void 0:O.key)==="header"))==null?void 0:x.contents))==null?void 0:b.filter(O=>O!=="操作"))}}}),D=await st.batchAddInsofDataApi({dataList:y});e.push(D);const C=await((d=Rs(me.cloneDeep(u)))==null?void 0:d.map(async w=>{var b,O,F,k,W;let P;return(w==null?void 0:w.length)!==0&&(P=await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:T},value:{tableData:yr(w,(k=fi((F=(O=(b=It(me.cloneDeep(u)))==null?void 0:b.compData)==null?void 0:O.find(B=>(B==null?void 0:B.key)==="header"))==null?void 0:F.contents))==null?void 0:k.filter(B=>B!=="操作"))}})),await((W=(await st.getInsofDataApi({key:{parentTable:w,systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure"}})).data.result)==null?void 0:W.map(async B=>{var V,le;return await st.updateInsofDataApi({id:B.id,key:{systemKey:B.key.systemKey,pageKey:B.key.pageKey,type:B.key.type,version:B.key.version,parentTable:B.key.parentTable===""?"":(le=(V=P.data.result)==null?void 0:V[0])==null?void 0:le.id}})}))}));e.push(C)}})})})}),await Promise.all(e)},Hc=st.useMenuState(pr.pinia),I0=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]}))},N0=async i=>{var a,o,l,c,u,h,f,p,g,_,m,d,E,T;const e=(o=(a=i==null?void 0:i.find(y=>(y==null?void 0:y.key)==="header"))==null?void 0:a.contents)==null?void 0:o.find(y=>y==null?void 0:y.columnPath);let t=(c=(l=me.cloneDeep(e==null?void 0:e.columnPath))==null?void 0:l.split("["))==null?void 0:c[0],n=(g=(p=(f=(h=(u=me.cloneDeep(e==null?void 0:e.columnPath))==null?void 0:u.split("["))==null?void 0:h[1])==null?void 0:f.split("]"))==null?void 0:p[0])==null?void 0:g.replaceAll("'",""),r=[];const s=await st.getInsofDataApi({key:{pageKey:t,systemKey:sessionStorage.getItem("systemKey"),type:"structure"}});if(Array.isArray((_=s==null?void 0:s.data)==null?void 0:_.result)&&((d=(m=s==null?void 0:s.data)==null?void 0:m.result)==null?void 0:d.length)>0){const y=await((T=(E=s==null?void 0:s.data)==null?void 0:E.result)==null?void 0:T.map(async D=>{var C,w,P,M,x,b,O,F,k,W;if(((w=(C=D==null?void 0:D.value)==null?void 0:C.pageData)==null?void 0:w.name)===n){r=me.cloneDeep((M=(P=D==null?void 0:D.value)==null?void 0:P.pageData)==null?void 0:M.compData);const B=await st.getInsofDataApi({key:{pageKey:t,systemKey:sessionStorage.getItem("systemKey"),tableId:D==null?void 0:D.id,type:"data"}}),J=(b=(x=B==null?void 0:B.data)==null?void 0:x.result)==null?void 0:b.map(V=>{var ge;let le=[];return le.push({id:V==null?void 0:V.id}),le.push((ge=V==null?void 0:V.value)==null?void 0:ge.tableData),le});r.push({key:"tableContents",contents:Zo(J,(W=(k=(F=(O=D==null?void 0:D.value)==null?void 0:O.pageData)==null?void 0:F.compData)==null?void 0:k.find(V=>(V==null?void 0:V.key)==="header"))==null?void 0:W.contents)})}}));await Promise.all(y)}return r},qu=async(i,e,t="",n)=>{var f,p,g,_,m,d;const r=await st.getInsofDataApi({key:{pageKey:i,systemKey:e,parentTable:t}}),s=await st.getInsofDataApi({key:{pageKey:i,systemKey:e,type:"structureMethod"}}),a=(f=r.data.result)==null?void 0:f.map(E=>E.id),o=a==null?void 0:a.map(E=>st.getInsofDataApi({key:{pageKey:i,systemKey:e,tableId:E}})),l=await Promise.all(o),c=[];l==null||l.forEach(E=>{var D,C,w,P;const T=(D=E.data.result)==null?void 0:D.map(M=>{const x=Array.isArray(M.value.tableData)?M.value.tableData:[M.value.tableData];return x.unshift({id:M.id}),x}),y=(P=(w=(C=E.data.result)==null?void 0:C[0])==null?void 0:w.key)==null?void 0:P.tableId;c.push({key:y,contents:T})});const u=[],h=await((p=r.data.result)==null?void 0:p.map(async E=>{var D,C,w,P,M,x;const T=E.value.pageData;let y=(D=me.cloneDeep(T.compData))==null?void 0:D.filter(b=>(b==null?void 0:b.key)!=="tableContents");if(y&&(y!=null&&y.find(b=>(b==null?void 0:b.key)==="header"))&&((w=(C=y==null?void 0:y.find(b=>(b==null?void 0:b.key)==="header"))==null?void 0:C.contents)!=null&&w.every(b=>!(b!=null&&b.columnPath)))?y.push({key:"tableContents",contents:n==="/系统管理/用户管理"?I0(c):Zo((P=c==null?void 0:c.find(b=>(b==null?void 0:b.key)===E.id))==null?void 0:P.contents,(M=y==null?void 0:y.find(b=>(b==null?void 0:b.key)==="header"))==null?void 0:M.contents)}):y&&(y!=null&&y.find(b=>(b==null?void 0:b.key)==="header"))&&(y=await N0(me.cloneDeep(y))),T.compData=y,T.id=E.id,((x=E.key)==null?void 0:x.type)!=="method")u.push(T);else{let b;b={name:"",compData:[T],comp:"calculator"},u.push(b)}}));return await Promise.all(h),((_=(g=s.data.result)==null?void 0:g.map(E=>E.value.pageData))==null?void 0:_.filter(E=>Object.values(E).length>0).length)>0&&u.push({comp:"methodButton",name:"",compData:(d=(m=s.data.result)==null?void 0:m.map(E=>E.value.pageData))==null?void 0:d.filter(E=>Object.values(E).length>0)}),u},F0=async i=>{await st.deleteInsofDataApi({id:i})},O0=async(i,e,t,n,r,s)=>{var a;await st.createInsofDataApi({key:{type:i,pageKey:e,tableId:t,systemKey:n},value:{tableData:yr(r,(a=fi(s))==null?void 0:a.filter(o=>o!=="操作"))}})},B0=async(i,e,t,n,r,s,a)=>{var o;await st.updateInsofDataApi({key:{type:i,pageKey:e,tableId:t,systemKey:r},value:{tableData:yr(s,(o=fi(a))==null?void 0:o.filter(l=>l!=="操作"))},id:n})},z0=async(i,e)=>{await st.updateInsofDataApi({value:{pageData:e},id:i})},k0=async(i,e)=>await st.getInsofDataApi({key:i,valueLikes:e}),V0=async()=>{var i,e,t,n,r,s,a,o,l;try{const c=await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),layer:"superAdmin"}});((i=c==null?void 0:c.data)==null?void 0:i.code)===200&&(Hc.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.systemType)==="制造系统"?"client":"browser"),Hc.setPlatName(((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?void 0:l.name)??""))}catch(c){return Promise.reject(c)}},Yu=st.defineStore("modelTableComp",{state:()=>({tableIndex:0,tableShowThree:""}),actions:{setTableIndex(i){this.tableIndex=i},setTableShowThree(i){this.tableShowThree=i}}}),H0={class:"table-content"},G0=["onClick"],W0={class:"form-content"},X0={key:0,class:"dialog-footer"},q0={class:"dialog-footer"},Y0={__name:"index",props:{compName:{type:String,default:"",required:!1},operatingForm:{type:Object,default:()=>{}},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=Y.ref([]),s=st.useMenuState(),{activeMenuPath:a}=st.storeToRefs(s),o=Yu(pr.pinia),l=Xc(pr.pinia),{extraContents:c}=st.storeToRefs(l),u=Y.ref([]);Y.ref(!1);const h=Y.ref("");Y.ref();const f=Y.ref(!0),p=Y.ref(0),g=Y.ref(!1),_=Y.ref(""),m=Y.ref(!1),d=Y.ref({label:"查看三维模型"}),E=Y.ref(!1),T=Y.ref(),y=Y.ref([]),D=Y.ref([]),C=Y.ref(!1),w=Y.ref([]),P=Y.ref([]),M=Y.ref(),x=Y.ref(),b=ku(pr.pinia),O=Y.ref(),F=Vu(pr.pinia),{selectIndex:k,selectMenu:W,selectTitle:B}=st.storeToRefs(F),{selectString:J}=st.storeToRefs(b),V=Y.ref(720),le=()=>{m.value=!1},ge=K=>{n("clickTrigger",K)},se=(K,re)=>{if(Object.values(re).length!==0)return Object.values(re).find(A=>{var De,ce,de;return((De=A==null?void 0:A.toString())==null?void 0:De.includes(".txt"))||((ce=A==null?void 0:A.toString())==null?void 0:ce.includes(".cpt"))||((de=A==null?void 0:A.toString())==null?void 0:de.includes(".obj"))})?[...K,d.value]:K},ke=K=>{var ce;J.value===""?K==null||K[0]:(K==null?void 0:K.find(de=>(de==null?void 0:de.selectLabel)==="("+J.value+")"))??(K==null||K.find(de=>!(de!=null&&de.selectLabel)));let re=K;(ce=r.value)!=null&&ce.find(de=>de.prop==="index");let A=M.value;const De=[];return re==null||re.forEach((de,X)=>{var Se;let be={};if(Array.isArray(de)){let pe=[];de==null||de.filter(Qe=>!(Qe!=null&&Qe.id)).forEach((Qe,R)=>{var v,z,j,Q,q;if((v=A==null?void 0:A[R])!=null&&v.prop&&!Array.isArray(Qe)){let Re={};Re[A[R].column]=Qe,c!=null&&c.value&&((z=c==null?void 0:c.value)==null?void 0:z.length)>0&&((j=c==null?void 0:c.value)!=null&&j.find(oe=>JSON.stringify(oe==null?void 0:oe[0])===JSON.stringify(Re)))&&(pe=(Q=c==null?void 0:c.value)==null?void 0:Q.find(oe=>JSON.stringify(oe==null?void 0:oe[0])===JSON.stringify(Re))),pe&&pe.length>0?be[A[R].prop]=pe!=null&&pe.find(oe=>{var Me;return((Me=Object.keys(oe))==null?void 0:Me[0])===A[R].column})?(q=pe==null?void 0:pe.find(oe=>{var Me;return((Me=Object.keys(oe))==null?void 0:Me[0])===A[R].column}))==null?void 0:q[A[R].column]:Qe:be[A[R].prop]=Qe}})}else be=de;Array.isArray(de)&&de.some(pe=>pe==null?void 0:pe.id)?De.push(Object.assign(be,{id:(Se=de==null?void 0:de.find(pe=>pe.id))==null?void 0:Se.id})):be.id?De.push(be):De.push(Object.assign(be,{id:X}))}),De},je=async K=>{var ce,de,X,be,Se;let re={};for(let pe in K)K[pe]!==""&&(re["tableData."+pe]=K[pe]);const A=await k0({type:"data",tableId:t==null?void 0:t.index,systemKey:sessionStorage.getItem("systemKey"),pageKey:a.value},re),De=(X=(de=(ce=me.cloneDeep(A))==null?void 0:ce.data)==null?void 0:de.result)==null?void 0:X.map(pe=>{var R;let Qe=[];return Qe.push({id:pe.id}),Qe.push((R=pe==null?void 0:pe.value)==null?void 0:R.tableData),Qe});u.value=ke(Zo(De,(Se=(be=me.cloneDeep(r.value))==null?void 0:be.map(pe=>pe.label))==null?void 0:Se.filter(pe=>pe!=="操作")))},$=async K=>{var A,De,ce,de,X,be,Se;let re=await qu(a.value,sessionStorage.getItem("systemKey"),K.id);if(re=re==null?void 0:re.filter(pe=>pe.comp!=="methodButton"),re&&re.length>0){const pe=!Array.isArray(B.value)&&((A=B.value)==null?void 0:A.key)!=="main"?[]:B.value;pe.push({key:W.value===""?(De=K==null?void 0:K.id)==null?void 0:De.toString():W.value+"-"+((ce=K==null?void 0:K.id)==null?void 0:ce.toString()),value:K[(de=Object.keys(K))==null?void 0:de.filter(Qe=>Qe!=="index"&&Qe!=="id")[0]]}),F.setSelectMenu(W.value===""?(X=K==null?void 0:K.id)==null?void 0:X.toString():W.value+"-"+((be=K==null?void 0:K.id)==null?void 0:be.toString())),F.setSelectTitle(pe),F.setSelectIndex((Se=K==null?void 0:K.id)==null?void 0:Se.toString()),n("pageChange",re)}},ue=K=>{var re;(re=me.cloneDeep(t.itemData))==null||re.map(A=>((A==null?void 0:A.key)==="tableContents"&&(A.contents=K),A))},Le=(K,re,A)=>{n("contentClick",K,re,A,{id:t==null?void 0:t.index})};Y.watch(()=>t.changedContent,()=>{var A,De;if(!t.changedContent)return;let K=(A=u.value)==null?void 0:A.map(ce=>{var de;return ce.id===((de=t.changedContent)==null?void 0:de.id)&&(ce={...t.changedContent,id:t.changedContent.newId?t.changedContent.newId:t.changedContent.id},delete ce.newId),ce});const re=(De=t.itemData)==null?void 0:De.map(ce=>((ce==null?void 0:ce.key)==="tableContents"&&(ce.contents=K),ce));u.value=K,n("contentChange",{contents:re,index:t.index}),n("change",{content:K,index:t==null?void 0:t.index,buttonName:"",id:t==null?void 0:t.index})},{deep:!0,immediate:!0});const ye=()=>{},Ue=(K,re,A)=>{var De,ce,de;if(h.value="",C.value=!0,f.value=!0,n("onButtonClick",K,re),K==="删除"){u.value=(De=me.cloneDeep(u.value))==null?void 0:De.filter(be=>(be==null?void 0:be.id)!==(re==null?void 0:re.id));const X=S0(O.value,W.value,re==null?void 0:re.id);ue(X),n("change",{content:u.value,singleContent:re,index:t==null?void 0:t.index,type:"delete",buttonName:K,column:r.value})}else if(K==="新增")_.value="新增",tt(""),m.value=!0;else if(K==="编辑")_.value="编辑",tt(re),m.value=!0;else if(K==="查看")_.value="查看",tt(re),C.value=!1,f.value=!1,m.value=!0;else if(K==="查看三维模型"){const X={};for(let Se in re)Se!=="id"&&(X[Se]=re[Se]);let be=(ce=Object.values(X))==null?void 0:ce[1];o.setTableShowThree(be)}else((de=A==null?void 0:A.extra)==null?void 0:de.type)==="modelExample"&&(_.value=K,E.value=!0)},tt=K=>{var De,ce,de;const re=[];let A=[];for(let X in K)Array.isArray(K==null?void 0:K[X])&&A.push(X);(ce=Ht.getColumnChild((De=me.cloneDeep(r.value))==null?void 0:De.filter(X=>(X==null?void 0:X.label)!=="操作")))==null||ce.forEach((X,be)=>{A.find(Se=>Se===(X==null?void 0:X.prop))||re.push({label:(X==null?void 0:X.label)??"",name:(X==null?void 0:X.prop)??"t"+be,type:!(X!=null&&X.formType)||(X==null?void 0:X.formType)===""?"Input":X==null?void 0:X.formType,value:(K==null?void 0:K[X==null?void 0:X.prop])??(X==null?void 0:X.value)??"",id:(X==null?void 0:X.id)??be,contents:(X==null?void 0:X.options)??[],width:1,isFormColHidden:X==null?void 0:X.isFormColHidden})}),K===""||!K||(h.value=K==null?void 0:K.id),P.value=y.value&&((de=y.value)==null?void 0:de.length)>0?y.value:re};Y.onMounted(()=>{T.value=window.innerWidth-240*2});const ze=()=>{let K,re=me.cloneDeep(u.value);h.value===""?(p.value++,re.push(Object.assign(x.value,{id:p.value})),K=Object.assign(x.value,{id:p.value})):re=re==null?void 0:re.map(De=>((De==null?void 0:De.id)===h.value&&(De=Object.assign(De,x.value),K=De),De)),u.value=re;const A=E0(O.value,W.value,re);ue(A),m.value=!1,n("change",{content:A,singleContent:K,index:t==null?void 0:t.index,buttonName:_.value,column:r.value})},ft=K=>{x.value=K,n("onFormChange",K)};return Y.watch(()=>[t.itemData,J.value,k.value,W.value,c==null?void 0:c.value],()=>{var Se,pe,Qe,R,v,z,j,Q,q,Re,oe,Me,Pe,ee,Ee,Fe,Ne,fe,Ve,U,_e,te,Te,ie,Z,we;const K=(Se=me.cloneDeep(t.itemData))==null?void 0:Se.filter(ne=>(ne==null?void 0:ne.key)==="header");(pe=me.cloneDeep(t.itemData))==null||pe.filter(ne=>(ne==null?void 0:ne.key)==="tableIndexColumn")[0];const re=(Qe=me.cloneDeep(t.itemData))==null?void 0:Qe.find(ne=>(ne==null?void 0:ne.key)==="page"),A=(R=me.cloneDeep(t.itemData))==null?void 0:R.find(ne=>(ne==null?void 0:ne.key)==="rowButton"),De=(v=me.cloneDeep(t.itemData))==null?void 0:v.find(ne=>(ne==null?void 0:ne.key)==="extraButton"),ce=(z=me.cloneDeep(t.itemData))==null?void 0:z.filter(ne=>(ne==null?void 0:ne.key)==="tableContents"),de=(j=me.cloneDeep(t.itemData))==null?void 0:j.filter(ne=>(ne==null?void 0:ne.key)==="tableIndex");y.value=(Re=(q=(Q=me.cloneDeep(t.itemData))==null?void 0:Q.filter(ne=>(ne==null?void 0:ne.key)==="tableToForm"))==null?void 0:q[0])==null?void 0:Re.contents,g.value=(re==null?void 0:re.contents)??!1;let X=[];J.value===""?X=K==null?void 0:K[0]:X=(K==null?void 0:K.find(ne=>(ne==null?void 0:ne.selectLabel)==="("+J.value+")"))??(K==null?void 0:K.find(ne=>!(ne!=null&&ne.selectLabel)));let be=[];if(J.value===""?be=de==null?void 0:de[0]:be=(de==null?void 0:de.find(ne=>(ne==null?void 0:ne.selectLabel)==="("+J.value+")"))??(de==null?void 0:de.find(ne=>!(ne!=null&&ne.selectLabel))),((oe=X==null?void 0:X.contents)==null?void 0:oe.length)>0){let ne=[];if(X!=null&&X.contents.some(Oe=>Array.isArray(Oe)&&(Oe==null?void 0:Oe.find(ve=>ve.children))))W.value===""?ne=(Pe=(Me=Ht.getGradeColumns(me.cloneDeep(X==null?void 0:X.contents)))==null?void 0:Me[0])==null?void 0:Pe.filter(Oe=>!Array.isArray(Oe)):(W.value.split("-"),ne=(ee=Ht.getGradeColumns(me.cloneDeep(X==null?void 0:X.contents)))==null?void 0:ee[0]);else{const Oe=X!=null&&X.contents.some(ve=>Array.isArray(ve))?(Ee=X==null?void 0:X.contents)==null?void 0:Ee[0]:X==null?void 0:X.contents;Oe==null||Oe.forEach((ve,vt)=>{ne.push({label:(ve==null?void 0:ve.label)??"",prop:(ve==null?void 0:ve.label)==="操作"?"operate":(ve==null?void 0:ve.prop)??"a"+vt,width:(ve==null?void 0:ve.label)==="操作"?"200":ve!=null&&ve.width?parseInt(ve.width):"",fixed:(ve==null?void 0:ve.fixed)??void 0,sortable:(ve==null?void 0:ve.sortable)??!1,align:(ve==null?void 0:ve.align)??"center",showOverflowTooltip:(ve==null?void 0:ve.showOverflowTooltip)??!0,isNotDrag:(ve==null?void 0:ve.isNotDrag)??!1,isEditCol:(ve==null?void 0:ve.isEditCol)??!1,isOperate:(ve==null?void 0:ve.isOperate)??!1,id:(ve==null?void 0:ve.id)??vt,type:(ve==null?void 0:ve.label)==="操作"?"operate":void 0,formType:(ve==null?void 0:ve.formType)??"",isTableColHidden:ve==null?void 0:ve.isTableColHidden,isFormColHidden:ve==null?void 0:ve.isFormColHidden,options:(ve==null?void 0:ve.options)??[],value:(ve==null?void 0:ve.value)??""})})}r.value=ne;let Je=(Ne=(Fe=Ht.getAllLeafNodes(me.cloneDeep(r.value)))==null?void 0:Fe.filter(Oe=>(Oe==null?void 0:Oe.type)!=="operate"))==null?void 0:Ne.map((Oe,ve)=>({prop:(Oe==null?void 0:Oe.prop)??"a"+ve,column:Oe.label}));M.value=Je;let Xe=[];J.value===""?Xe=ce==null?void 0:ce[0]:Xe=(ce==null?void 0:ce.find(Oe=>(Oe==null?void 0:Oe.selectLabel)==="("+J.value+")"))??(ce==null?void 0:ce.find(Oe=>!(Oe!=null&&Oe.selectLabel)));let _t=Array.isArray((fe=Xe==null?void 0:Xe.contents)==null?void 0:fe[0])&&((Ve=Xe==null?void 0:Xe.contents)!=null&&Ve[0].every(Oe=>Array.isArray(Oe)))?(U=me.cloneDeep(Xe==null?void 0:Xe.contents))==null?void 0:U[0]:me.cloneDeep(Xe==null?void 0:Xe.contents);be!=null&&be.contents&&((_e=be==null?void 0:be.contents)==null?void 0:_e.length)!==0&&(_t=(te=me.cloneDeep(_t))==null?void 0:te.map((Oe,ve)=>{if(!Array.isArray(Oe)){let vt={};for(let pn in Oe)pn!=="id"&&pn!=="index"&&(vt[pn]=Oe[pn]);Oe=Object.values(vt)}return Oe}));const sn=!!((Te=r.value)!=null&&Te.find(Oe=>Oe.prop==="index"));_t=Gu(me.cloneDeep(_t),be==null?void 0:be.contents,sn);const $n=[];_t==null||_t.forEach((Oe,ve)=>{var pn;let vt={};if(Array.isArray(Oe)){let Mt=[];Oe==null||Oe.filter(Pt=>!(Pt!=null&&Pt.id)).forEach((Pt,Zt)=>{var Jn,er,tr,Lr,Ur,Ir;if((Jn=Je==null?void 0:Je[Zt])!=null&&Jn.prop&&!Array.isArray(Pt)){let nr={};nr[Je[Zt].column]=Pt,c!=null&&c.value&&((er=c==null?void 0:c.value)==null?void 0:er.length)>0&&((tr=c==null?void 0:c.value)!=null&&tr.find(Xt=>JSON.stringify(Xt==null?void 0:Xt[0])===JSON.stringify(nr)))&&(Mt=(Lr=c==null?void 0:c.value)==null?void 0:Lr.find(Xt=>JSON.stringify(Xt==null?void 0:Xt[0])===JSON.stringify(nr))),Mt&&Mt.length>0?vt[Je[Zt].prop]=Mt!=null&&Mt.find(Xt=>{var Zn;return((Zn=Object.keys(Xt))==null?void 0:Zn[0])===Je[Zt].column})?(Ur=Mt==null?void 0:Mt.find(Xt=>{var Zn;return((Zn=Object.keys(Xt))==null?void 0:Zn[0])===Je[Zt].column}))==null?void 0:Ur[Je[Zt].column]:Pt:vt[Je[Zt].prop]=Pt}else Array.isArray(Pt)&&((Ir=Je[Zt])!=null&&Ir.prop?vt[Je[Zt].prop]=Pt:vt.children=Hu(Pt,Je))})}else vt=Oe;Array.isArray(Oe)&&Oe.some(Mt=>Mt==null?void 0:Mt.id)?$n.push(Object.assign(vt,{id:(pn=Oe==null?void 0:Oe.find(Mt=>Mt.id))==null?void 0:pn.id})):vt.id?$n.push(vt):$n.push(Object.assign(vt,{id:ve}))}),u.value=$n}else r.value=[],u.value=[];((ie=A==null?void 0:A.contents)==null?void 0:ie.length)>0?D.value=A==null?void 0:A.contents:D.value=[],((Z=De==null?void 0:De.contents)==null?void 0:Z.length)>0?w.value=De==null?void 0:De.contents:w.value=[],p.value=((we=u==null?void 0:u.value)==null?void 0:we.length)??0,O.value=u.value},{deep:!0,immediate:!0}),Y.watch(()=>t==null?void 0:t.operatingForm,K=>{K!=null&&K.form&&(tt(K==null?void 0:K.form),_.value=K==null?void 0:K.dialogTitle,C.value=!0,m.value=!0)},{immediate:!0,deep:!0}),(K,re)=>{var A;return Y.openBlock(),Y.createElementBlock("div",H0,[(Y.openBlock(),Y.createBlock(Ht.ssTable,{columns:r.value,key:r.value,tableData:u.value,isShowPagination:g.value,isShowEdit:!1,isShowDelete:!1,onDbClickRow:$,extraButton:w.value,onContentClick:Le},Y.createSlots({headerButton:Y.withCtx(De=>[Y.createVNode(Ih,{compName:i.compName,buttons:De.buttons,onButtonClick:re[0]||(re[0]=ce=>Ue(ce,"",{})),columns:r.value,onFilter:je},null,8,["compName","buttons","columns"])]),_:2},[((A=D.value)==null?void 0:A.length)>0?{name:"actions",fn:Y.withCtx(({item:De})=>[(Y.openBlock(!0),Y.createElementBlock(Y.Fragment,null,Y.renderList(se(D.value,De),(ce,de)=>(Y.openBlock(),Y.createElementBlock("div",{key:de},[Y.createElementVNode("div",{style:Y.normalizeStyle({color:ce==null?void 0:ce.textColor}),class:"extra-button-label",onClick:X=>Ue(ce==null?void 0:ce.label,De,{extra:ce})},Y.toDisplayString(ce==null?void 0:ce.label),13,G0)]))),128))]),key:"0"}:void 0]),1032,["columns","tableData","isShowPagination","extraButton"])),Y.createVNode(Ht.ssDialog,{title:_.value,visible:m.value,width:V.value,onBeforeDestroy:le},{default:Y.withCtx(()=>[Y.createElementVNode("div",W0,[Y.createVNode(Ht.ssForm,{rowContents:P.value,isEnableWrap:!1,onChange:ft,onClickTrigger:ge,isEdit:f.value},null,8,["rowContents","isEdit"])])]),footer:Y.withCtx(()=>[C.value?(Y.openBlock(),Y.createElementBlock("div",X0,[Y.createElementVNode("div",{onClick:re[1]||(re[1]=De=>m.value=!1),class:"cancel-button"},Y.toDisplayString("取消")),Y.createElementVNode("div",{class:"ok-button",onClick:ze},Y.toDisplayString("确认"))])):Y.createCommentVNode("",!0)]),_:1},8,["title","visible","width"]),Y.createVNode(Ht.ssDialog,{title:_.value,visible:E.value,width:T.value,onBeforeDestroy:re[3]||(re[3]=De=>E.value=!1)},{default:Y.withCtx(()=>[Y.createVNode(y0)]),footer:Y.withCtx(()=>[Y.createElementVNode("div",q0,[Y.createElementVNode("div",{onClick:re[2]||(re[2]=De=>E.value=!1),class:"cancel-button"},Y.toDisplayString("取消")),Y.createElementVNode("div",{class:"ok-button",onClick:ye},Y.toDisplayString("确认"))])]),_:1},8,["title","visible","width"])])}}},K0=Do._export_sfc(Y0,[["__scopeId","data-v-4098a946"]]);exports.ACESFilmicToneMapping=Kc;exports.AmbientLight=Kd;exports.AnimationClip=Ud;exports.Bone=_u;exports.Box3=En;exports.BoxGeometry=ji;exports.BufferAttribute=Nt;exports.BufferGeometry=Dt;exports.ClampToEdgeWrapping=xn;exports.Color=Ye;exports.ColorManagement=it;exports.Controls=tp;exports.CylinderGeometry=qo;exports.DataTextureLoader=zd;exports.DefaultLoadingManager=Tu;exports.DirectionalLight=Yd;exports.DoubleSide=_n;exports.Euler=Jt;exports.FileLoader=Au;exports.Float32BufferAttribute=xt;exports.FrontSide=Fn;exports.Group=mr;exports.HemisphereLight=Vd;exports.IsJson=T0;exports.Line=yu;exports.LineBasicMaterial=xu;exports.LineSegments=xd;exports.LinearMipmapLinearFilter=Ln;exports.Loader=Zi;exports.LoaderUtils=jd;exports.MOUSE=Nh;exports.Material=bn;exports.MathUtils=su;exports.Matrix4=Ke;exports.Mesh=Rt;exports.MeshBasicMaterial=gi;exports.MeshLambertMaterial=bd;exports.MeshPhongMaterial=Ed;exports.OrthographicCamera=Hs;exports.PCFSoftShadowMap=Yc;exports.PerspectiveCamera=zt;exports.Plane=qn;exports.PlaneGeometry=Cr;exports.PointLight=Xd;exports.Points=yd;exports.PointsMaterial=Su;exports.Quaternion=fn;exports.QuaternionKeyframeTrack=Dr;exports.Ray=Ki;exports.RepeatWrapping=Wi;exports.SRGBColorSpace=Gt;exports.Scene=pu;exports.Skeleton=Wo;exports.SkinnedMesh=md;exports.SphereGeometry=ks;exports.Spherical=wu;exports.SpotLight=Gd;exports.TOUCH=Fh;exports.TextureLoader=kd;exports.URDFCollider=f0;exports.URDFJoint=zu;exports.URDFLink=Bu;exports.URDFMimicJoint=p0;exports.URDFRobot=m0;exports.URDFVisual=d0;exports.Vector2=We;exports.Vector3=L;exports.VectorKeyframeTrack=Ar;exports.WebGLRenderer=Bv;exports.Xe=u0;exports.addTableContents=O0;exports.conStructContents=U0;exports.deleteTableContents=F0;exports.fixFormContents=z0;exports.fixTableContents=B0;exports.getItemData=qu;exports.loadingSystemType=V0;exports.methodTableToContent=w0;exports.ssTable=K0;exports.tableEveryContents=_r;exports.tableToContents=Rs;exports.tableToStruct=It;exports.useFormToTableComp=ku;exports.useModelComp=Xc;exports.useTableComp=Yu;exports.useUnit=Vu;
|
|
4197
|
+
`};class Jo extends On{constructor(e){super({type:"LineMaterial",uniforms:Ho.clone(Wt.line.uniforms),vertexShader:Wt.line.vertexShader,fragmentShader:Wt.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Da=new et,Uc=new L,Ic=new L,Tt=new et,At=new et,mn=new et,Pa=new L,La=new Ke,wt=new tp,Nc=new L,ps=new En,ms=new Bn,gn=new et;let vn,hi;function Fc(i,e,t){return gn.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),gn.multiplyScalar(1/gn.w),gn.x=hi/t.width,gn.y=hi/t.height,gn.applyMatrix4(i.projectionMatrixInverse),gn.multiplyScalar(1/gn.w),Math.abs(Math.max(gn.x,gn.y))}function r0(i,e){const t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,r.count);for(let o=0,l=a;o<l;o++){wt.start.fromBufferAttribute(r,o),wt.end.fromBufferAttribute(s,o),wt.applyMatrix4(t);const c=new L,u=new L;vn.distanceSqToSegment(wt.start,wt.end,u,c),u.distanceTo(c)<hi*.5&&e.push({point:u,pointOnLine:c,distance:vn.origin.distanceTo(u),object:i,face:null,faceIndex:o,uv:null,uv1:null})}}function s0(i,e,t){const n=e.projectionMatrix,r=i.material.resolution,s=i.matrixWorld,a=i.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),u=-e.near;vn.at(1,mn),mn.w=1,mn.applyMatrix4(e.matrixWorldInverse),mn.applyMatrix4(n),mn.multiplyScalar(1/mn.w),mn.x*=r.x/2,mn.y*=r.y/2,mn.z=0,Pa.copy(mn),La.multiplyMatrices(e.matrixWorldInverse,s);for(let h=0,f=c;h<f;h++){if(Tt.fromBufferAttribute(o,h),At.fromBufferAttribute(l,h),Tt.w=1,At.w=1,Tt.applyMatrix4(La),At.applyMatrix4(La),Tt.z>u&&At.z>u)continue;if(Tt.z>u){const d=Tt.z-At.z,E=(Tt.z-u)/d;Tt.lerp(At,E)}else if(At.z>u){const d=At.z-Tt.z,E=(At.z-u)/d;At.lerp(Tt,E)}Tt.applyMatrix4(n),At.applyMatrix4(n),Tt.multiplyScalar(1/Tt.w),At.multiplyScalar(1/At.w),Tt.x*=r.x/2,Tt.y*=r.y/2,At.x*=r.x/2,At.y*=r.y/2,wt.start.copy(Tt),wt.start.z=0,wt.end.copy(At),wt.end.z=0;const p=wt.closestPointToPointParameter(Pa,!0);wt.at(p,Nc);const g=su.lerp(Tt.z,At.z,p),_=g>=-1&&g<=1,m=Pa.distanceTo(Nc)<hi*.5;if(_&&m){wt.start.fromBufferAttribute(o,h),wt.end.fromBufferAttribute(l,h),wt.start.applyMatrix4(s),wt.end.applyMatrix4(s);const d=new L,E=new L;vn.distanceSqToSegment(wt.start,wt.end,E,d),t.push({point:E,pointOnLine:d,distance:vn.origin.distanceTo(E),object:i,face:null,faceIndex:h,uv:null,uv1:null})}}}class a0 extends Rt{constructor(e=new Fu,t=new Jo({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let a=0,o=0,l=t.count;a<l;a++,o+=2)Uc.fromBufferAttribute(t,a),Ic.fromBufferAttribute(n,a),r[o]=o===0?0:r[o-1],r[o+1]=r[o]+Uc.distanceTo(Ic);const s=new So(r,2,1);return e.setAttribute("instanceDistanceStart",new Sn(s,1,0)),e.setAttribute("instanceDistanceEnd",new Sn(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,r=e.camera;r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;vn=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;hi=l.linewidth+s,o.boundingSphere===null&&o.computeBoundingSphere(),ms.copy(o.boundingSphere).applyMatrix4(a);let c;if(n)c=hi*.5;else{const h=Math.max(r.near,ms.distanceToPoint(vn.origin));c=Fc(r,h,l.resolution)}if(ms.radius+=c,vn.intersectsSphere(ms)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),ps.copy(o.boundingBox).applyMatrix4(a);let u;if(n)u=hi*.5;else{const h=Math.max(r.near,ps.distanceToPoint(vn.origin));u=Fc(r,h,l.resolution)}ps.expandByScalar(u),vn.intersectsBox(ps)!==!1&&(n?r0(this,t):s0(this,r,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Da),this.material.uniforms.resolution.value.set(Da.z,Da.w))}}class Ou extends Fu{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){const t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class o0 extends a0{constructor(e=new Ou,t=new Jo({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const l0=i=>{const e=new Ye,t=[],n=[],{isSphere:r}=i;if(wr.forEach((o,l)=>{const{enabled:c,line:u,scale:h,color:f}=i[o];if(!c||!u)return;const p=l<3?1:-1,g=(r?Nu-h/2:.975)*p;t.push(o.includes("x")?g:0,o.includes("y")?g:0,o.includes("z")?g:0,0,0,0);const _=e.set(f).toArray();n.push(..._,..._)}),!t.length)return null;const s=new Ou().setPositions(t).setColors(n),a=new Jo({linewidth:i.lineWidth,vertexColors:!0,resolution:new We(window.innerWidth,window.innerHeight)});return new o0(s,a).computeLineDistances()},c0=i=>{const{corners:e,edges:t}=i,n=[],r=Jv(i),s=Qv(i,r);n.push(...s),e.enabled&&n.push(...e0(i,r)),t.enabled&&n.push(...t0(i,r,e.enabled?7:6));const a=i0(s,i),o=l0(i);return[n,a,o]},dr=(i,e=!0)=>{const{material:t,userData:n}=i,{opacity:r,color:s,scale:a}=e?n.hover:n;i.scale.setScalar(a),t.opacity=r,t.map?Zv(t.map,e):t.color.set(s)},Fi=new Ke,Oc=new wu,u0=new We,oi=new L,Bc=new et;class h0 extends ht{constructor(e,t,n={}){super(),ot(this,"enabled",!0),ot(this,"camera"),ot(this,"renderer"),ot(this,"options"),ot(this,"target",new L),ot(this,"animated",!0),ot(this,"speed",1),ot(this,"animating",!1),ot(this,"_options"),ot(this,"_intersections"),ot(this,"_background",null),ot(this,"_viewport",[0,0,0,0]),ot(this,"_originalViewport",[0,0,0,0]),ot(this,"_originalScissor",[0,0,0,0]),ot(this,"_scene"),ot(this,"_camera"),ot(this,"_container"),ot(this,"_domElement"),ot(this,"_domRect"),ot(this,"_dragging",!1),ot(this,"_distance",0),ot(this,"_clock",new Qd),ot(this,"_targetQuaternion",new fn),ot(this,"_quaternionStart",new fn),ot(this,"_quaternionEnd",new fn),ot(this,"_pointerStart",new We),ot(this,"_focus",null),ot(this,"_placement"),ot(this,"_controls"),ot(this,"_controlsListeners"),this.camera=e,this.renderer=t,this._scene=new pu().add(this),this.set(n)}get placement(){return this._placement}set placement(e){this._placement=Uu(this._domElement,e),this.domUpdate()}set(e={}){this.dispose(),this.options=e,this._options=$v(e),this._camera=this._options.isSphere?new Hs(-1.8,1.8,1.8,-1.8,5,10):new zt(26,1,5,10),this._camera.position.set(0,0,7);const[t,n,r]=c0(this._options);n&&this.add(n),r&&this.add(r),this.add(...t),this._background=n,this._intersections=t;const{container:s,animated:a,speed:o}=this._options;return this.animated=a,this.speed=o,this._container=s?Gv(s):document.body,this._domElement=Hv(this._options),this._domElement.onpointerdown=l=>this._onPointerDown(l),this._domElement.onpointermove=l=>this._onPointerMove(l),this._domElement.onpointerleave=()=>this._onPointerLeave(),this._container.appendChild(this._domElement),this._controls&&this.attachControls(this._controls),this.update(),this._updateOrientation(!0),this}render(){this.animating&&this._animate();const{renderer:e,_viewport:t}=this,n=e.getScissorTest(),r=e.autoClear;return e.autoClear=!1,e.setViewport(...t),n&&e.setScissor(...t),e.clear(!1,!0,!1),e.render(this._scene,this._camera),e.setViewport(...this._originalViewport),n&&e.setScissor(...this._originalScissor),e.autoClear=r,this}domUpdate(){this._domRect=this._domElement.getBoundingClientRect();const e=this.renderer,t=this._domRect,n=e.domElement.getBoundingClientRect();return this._viewport.splice(0,4,t.left-n.left,e.domElement.clientHeight-(t.top-n.top+t.height),t.width,t.height),e.getViewport(Bc).toArray(this._originalViewport),e.getScissorTest()&&e.getScissor(Bc).toArray(this._originalScissor),this}cameraUpdate(){return this._updateOrientation(),this}update(e=!0){return e&&this._controls&&this._controls.update(),this.domUpdate().cameraUpdate()}attachControls(e){return this.detachControls(),this.target=e.target,this._controlsListeners={start:()=>e.enabled=!1,end:()=>e.enabled=!0,change:()=>this.update(!1)},this.addEventListener("start",this._controlsListeners.start),this.addEventListener("end",this._controlsListeners.end),e.addEventListener("change",this._controlsListeners.change),this._controls=e,this}detachControls(){if(!(!this._controlsListeners||!this._controls))return this.target=new L().copy(this._controls.target),this.removeEventListener("start",this._controlsListeners.start),this.removeEventListener("end",this._controlsListeners.end),this._controls.removeEventListener("change",this._controlsListeners.change),this._controlsListeners=void 0,this._controls=void 0,this}dispose(){var e;this.detachControls(),this.children.forEach(t=>{var n,r,s,a;this.remove(t);const o=t;(n=o.material)==null||n.dispose(),(s=(r=o.material)==null?void 0:r.map)==null||s.dispose(),(a=o.geometry)==null||a.dispose()}),(e=this._domElement)==null||e.remove()}_updateOrientation(e=!0){e&&(this.quaternion.copy(this.camera.quaternion).invert(),this.updateMatrixWorld()),Ac(this._options,this._intersections,this.camera)}_animate(){const{position:e,quaternion:t}=this.camera;if(e.set(0,0,1),!this.animated){e.applyQuaternion(this._quaternionEnd).multiplyScalar(this._distance).add(this.target),t.copy(this._targetQuaternion),this._updateOrientation(),this.animating=!1,this.dispatchEvent({type:"change"}),this.dispatchEvent({type:"end"});return}this._controls&&(this._controls.enabled=!1);const n=this._clock.getDelta()*qv*this.speed;this._quaternionStart.rotateTowards(this._quaternionEnd,n),e.applyQuaternion(this._quaternionStart).multiplyScalar(this._distance).add(this.target),t.rotateTowards(this._targetQuaternion,n),this._updateOrientation(),requestAnimationFrame(()=>this.dispatchEvent({type:"change"})),this._quaternionStart.angleTo(this._quaternionEnd)<Ca&&(this._controls&&(this._controls.enabled=!0),this.animating=!1,this.dispatchEvent({type:"end"}))}_setOrientation(e){const t=this.camera,n=this.target;oi.copy(e).multiplyScalar(this._distance),Fi.setPosition(oi).lookAt(oi,this.position,this.up),this._targetQuaternion.setFromRotationMatrix(Fi),oi.add(n),Fi.lookAt(oi,n,this.up),this._quaternionEnd.setFromRotationMatrix(Fi),Fi.setPosition(t.position).lookAt(t.position,n,this.up),this._quaternionStart.setFromRotationMatrix(Fi),this.animating=!0,this._clock.start(),this.dispatchEvent({type:"start"})}_onPointerDown(e){if(!this.enabled)return;const t=l=>{if(!this._dragging){if(Xv(l,this._pointerStart))return;this._dragging=!0}const c=u0.set(l.clientX,l.clientY).sub(this._pointerStart).multiplyScalar(1/this._domRect.width*Math.PI),u=this.coordinateConversion(oi.subVectors(this.camera.position,this.target)),h=Oc.setFromVector3(u);h.theta=a-c.x,h.phi=bo(o-c.y,Ca,Math.PI-Ca),this.coordinateConversion(this.camera.position.setFromSpherical(h),!0).add(this.target),this.camera.lookAt(this.target),this.quaternion.copy(this.camera.quaternion).invert(),this._updateOrientation(!1),this.dispatchEvent({type:"change"})},n=()=>{if(document.removeEventListener("pointermove",t,!1),document.removeEventListener("pointerup",n,!1),!this._dragging)return this._handleClick(e);this._focus&&(dr(this._focus,!1),this._focus=null),this._dragging=!1,this.dispatchEvent({type:"end"})};if(this.animating)return;e.preventDefault(),this._pointerStart.set(e.clientX,e.clientY);const r=this.coordinateConversion(oi.subVectors(this.camera.position,this.target)),s=Oc.setFromVector3(r),a=s.theta,o=s.phi;this._distance=s.radius,document.addEventListener("pointermove",t,!1),document.addEventListener("pointerup",n,!1),this.dispatchEvent({type:"start"})}coordinateConversion(e,t=!1){const{x:n,y:r,z:s}=e,a=ht.DEFAULT_UP;return a.x===1?t?e.set(r,s,n):e.set(s,n,r):a.z===1?t?e.set(s,n,r):e.set(r,s,n):e}_onPointerMove(e){!this.enabled||this._dragging||(this._background&&Dc(this._background,!0),this._handleHover(e))}_onPointerLeave(){!this.enabled||this._dragging||(this._background&&Dc(this._background,!1),this._focus&&dr(this._focus,!1),this._domElement.style.cursor="")}_handleClick(e){const t=Cc(e,this._domRect,this._camera,this._intersections);this._focus&&(dr(this._focus,!1),this._focus=null),t&&(this._setOrientation(t.object.position),this.dispatchEvent({type:"change"}))}_handleHover(e){const t=Cc(e,this._domRect,this._camera,this._intersections),n=(t==null?void 0:t.object)||null;this._focus!==n&&(this._domElement.style.cursor=n?"pointer":"",this._focus&&dr(this._focus,!1),(this._focus=n)?dr(n,!0):Ac(this._options,this._intersections,this.camera))}}const zc=new L,f0=new Jt,gs=new Ke,Xn=new Ke,_s=new fn,vs=new L(1,1,1),xs=new L;class Ws extends ht{constructor(...e){super(...e),this.urdfNode=null,this.urdfName=""}copy(e,t){return super.copy(e,t),this.urdfNode=e.urdfNode,this.urdfName=e.urdfName,this}}class d0 extends Ws{constructor(...e){super(...e),this.isURDFCollider=!0,this.type="URDFCollider"}}class p0 extends Ws{constructor(...e){super(...e),this.isURDFVisual=!0,this.type="URDFVisual"}}class Bu extends Ws{constructor(...e){super(...e),this.isURDFLink=!0,this.type="URDFLink"}}class zu extends Ws{get jointType(){return this._jointType}set jointType(e){if(this.jointType!==e)switch(this._jointType=e,this.matrixWorldNeedsUpdate=!0,e){case"fixed":this.jointValue=[];break;case"continuous":case"revolute":case"prismatic":this.jointValue=new Array(1).fill(0);break;case"planar":this.jointValue=new Array(3).fill(0),this.axis=new L(0,0,1);break;case"floating":this.jointValue=new Array(6).fill(0);break}}get angle(){return this.jointValue[0]}constructor(...e){super(...e),this.isURDFJoint=!0,this.type="URDFJoint",this.jointValue=null,this.jointType="fixed",this.axis=new L(1,0,0),this.limit={lower:0,upper:0},this.ignoreLimits=!1,this.origPosition=null,this.origQuaternion=null,this.mimicJoints=[]}copy(e,t){return super.copy(e,t),this.jointType=e.jointType,this.axis=e.axis.clone(),this.limit.lower=e.limit.lower,this.limit.upper=e.limit.upper,this.ignoreLimits=!1,this.jointValue=[...e.jointValue],this.origPosition=e.origPosition?e.origPosition.clone():null,this.origQuaternion=e.origQuaternion?e.origQuaternion.clone():null,this.mimicJoints=[...e.mimicJoints],this}setJointValue(...e){e=e.map(n=>n===null?null:parseFloat(n)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case"fixed":return t;case"continuous":case"revolute":{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType==="revolute"&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]!==n?(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0):t)}case"prismatic":{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),zc.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(zc,n),this.jointValue[0]!==n?(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0):t)}case"floating":return this.jointValue.every((n,r)=>e[r]===n||e[r]===null)?t:(this.jointValue[0]=e[0]!==null?e[0]:this.jointValue[0],this.jointValue[1]=e[1]!==null?e[1]:this.jointValue[1],this.jointValue[2]=e[2]!==null?e[2]:this.jointValue[2],this.jointValue[3]=e[3]!==null?e[3]:this.jointValue[3],this.jointValue[4]=e[4]!==null?e[4]:this.jointValue[4],this.jointValue[5]=e[5]!==null?e[5]:this.jointValue[5],Xn.compose(this.origPosition,this.origQuaternion,vs),_s.setFromEuler(f0.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],"XYZ")),xs.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),gs.compose(xs,_s,vs),Xn.premultiply(gs),this.position.setFromMatrixPosition(Xn),this.rotation.setFromRotationMatrix(Xn),this.matrixWorldNeedsUpdate=!0,!0);case"planar":return this.jointValue.every((n,r)=>e[r]===n||e[r]===null)?t:(this.jointValue[0]=e[0]!==null?e[0]:this.jointValue[0],this.jointValue[1]=e[1]!==null?e[1]:this.jointValue[1],this.jointValue[2]=e[2]!==null?e[2]:this.jointValue[2],Xn.compose(this.origPosition,this.origQuaternion,vs),_s.setFromAxisAngle(this.axis,this.jointValue[2]),xs.set(this.jointValue[0],this.jointValue[1],0),gs.compose(xs,_s,vs),Xn.premultiply(gs),this.position.setFromMatrixPosition(Xn),this.rotation.setFromRotationMatrix(Xn),this.matrixWorldNeedsUpdate=!0,!0)}return t}}class m0 extends zu{constructor(...e){super(...e),this.type="URDFMimicJoint",this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){const t=e.map(n=>n*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}}class g0 extends Bu{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(n=>{n.isURDFJoint&&n.urdfName in e.joints&&(this.joints[n.urdfName]=n),n.isURDFLink&&n.urdfName in e.links&&(this.links[n.urdfName]=n),n.isURDFCollider&&n.urdfName in e.colliders&&(this.colliders[n.urdfName]=n),n.isURDFVisual&&n.urdfName in e.visual&&(this.visual[n.urdfName]=n)});for(const n in this.joints)this.joints[n].mimicJoints=this.joints[n].mimicJoints.map(r=>this.joints[r.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){const n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(const n in e){const r=e[n];Array.isArray(r)?t=this.setJointValue(n,...r)||t:t=this.setJointValue(n,r)||t}return t}}const ku=st.defineStore("formToTableComp",{state:()=>({selectArray:[],selectString:""}),actions:{setSelectArray(i){this.selectArray=i},setSelectString(i){this.selectString=i}}}),_0={class:"calculator-content"},v0={class:"calculator-child"},x0={class:"calculator-child"},y0=Y.defineComponent({__name:"calculator",setup(i){const e=Y.ref(),t=Y.ref();return Y.onMounted(()=>{e.value=[{type:"Upload",label:"输入",name:"input"}],t.value=[{type:"Upload",label:"输出",name:"output"}]}),(n,r)=>(Y.openBlock(),Y.createElementBlock("div",_0,[Y.createElementVNode("div",v0,[Y.createVNode(Ht.ssForm,{rowContents:e.value,isRowFlex:!0},null,8,["rowContents"])]),Y.createElementVNode("div",x0,[Y.createVNode(Ht.ssForm,{rowContents:t.value,isEdit:!1,isRowFlex:!0},null,8,["rowContents"])])]))}}),S0=Do._export_sfc(y0,[["__scopeId","data-v-73db0fe7"]]),Vu=st.defineStore("unit",{state:()=>({selectIndex:"",selectMenu:"",selectTitle:[]}),actions:{setSelectIndex(i){this.selectIndex=i},setSelectMenu(i){this.selectMenu=i},setSelectTitle(i){this.selectTitle=i}}}),Hu=(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=Hu(o,n))}),Object.assign(a,{id:s})}else return r})),t},Gu=(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 u;return Array.isArray(c)&&(c=Gu(c,(u=r==null?void 0:r[a])==null?void 0:u.children,t)),c}))),s}),n},M0=(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 E0(i,n,t)}},E0=(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=Wu(s,r,t)),s)),n},Wu=(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=Wu(o,r,t)),o)),n},b0=(i,e,t)=>{if(e==="")return t;{const n=e.split("-");return T0(i,n,t)}},T0=(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=Xu(s,r,t)),s)),n},Xu=(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=Xu(a,r,t)),a)),n},Zo=(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(u=>!(u!=null&&u.id)))!=null&&r.every(u=>typeof u!="object"||u===null))return n;if((s=n==null?void 0:n.filter(u=>!(u!=null&&u.id)))!=null&&s.some(u=>Array.isArray(u)))return n;{let u=[];if(u.push(n==null?void 0:n.find(h=>h==null?void 0:h.id)),Array.isArray(e==null?void 0:e[0])){const h=(a=n==null?void 0:n.filter(f=>!(f!=null&&f.id)))==null?void 0:a[0];(o=Ht.getColumnChild(me.cloneDeep(e==null?void 0:e[0])))==null||o.forEach(f=>{u.push(h==null?void 0:h[(f==null?void 0:f.prop)??(f==null?void 0:f.label)??f])})}else{const h=(l=n==null?void 0:n.filter(f=>!(f!=null&&f.id)))==null?void 0:l[0];(c=Ht.getColumnChild(me.cloneDeep(e)))==null||c.forEach(f=>{u.push(h==null?void 0:h[(f==null?void 0:f.prop)??(f==null?void 0:f.label)??f])})}return u}}),A0=i=>{try{return JSON.parse(i),!0}catch{return!1}},kc=(i,e)=>bh(i,e),fi=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},w0=(i,e,t)=>{var r;let n=(r=me.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(u=>u===e[l]))return c[e[l]]=o,c}))==null?void 0:a.filter(o=>o),s}),n},R0=(i,e)=>{var a,o;const t=me.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 w0(r,fi(n).slice(0,fi(n).length-1),e)},Nt=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=me.cloneDeep(e.compData))==null?void 0:s.find(l=>(l==null?void 0:l.key)==="tableIndexColumn"))==null?void 0:a.contents;return(o=me.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(u=>Array.isArray(u))?c==null||c[0].unshift({label:n}):c.unshift({label:n})),t.push({key:"header",contents:c})}}),e.compData=t,e},Rs=i=>{var s,a,o,l,c;const e=(s=i.compData)==null?void 0:s.filter(u=>(u==null?void 0:u.key)==="tableContents"||(u==null?void 0:u.key)==="tableIndex"),t=(o=(a=e==null?void 0:e.find(u=>(u==null?void 0:u.key)==="tableIndex"))==null?void 0:a.contents)==null?void 0:o.map(u=>u.label),n=(l=e==null?void 0:e.find(u=>(u==null?void 0:u.key)==="tableContents"))==null?void 0:l.contents;let r=[];return(t==null?void 0:t.length)>0&&(n!=null&&n.every(u=>Array.isArray(u)))?r=t==null?void 0:t.map((u,h)=>n[h]?[u,...n[h]]:[u]):Array.isArray(n==null?void 0:n[0])&&((c=n==null?void 0:n[0])!=null&&c.every(u=>Array.isArray(u)))?r=n==null?void 0:n[0]:Array.isArray(n==null?void 0:n[0])?r=n:r.push(n),r},C0=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},D0=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},P0=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},L0=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},U0=(i,e)=>{let t;function n(r,s,a=1){var l;if(!r||r.length===0)return;const o=(l=me.cloneDeep(s))==null?void 0:l.map(c=>c==null?void 0:c.filter(u=>!Array.isArray(u)));return o!=null&&o.find(c=>kc(c,r==null?void 0:r.key))?(s==null||s.forEach(c=>{!n(r,c.find(h=>Array.isArray(h)))&&kc(c.filter(h=>!Array.isArray(h)),r==null?void 0:r.key)&&(t={type:a,contents:c.filter(h=>!Array.isArray(h))})}),!0):!1}return n(i,e,0),t},Vc=(i,e)=>{function t(n,r){return!n||n.length===0||n==null?void 0:n.map((a,o)=>{var c,u;let l=a;return l.unshift((c=r==null?void 0:r[o])==null?void 0:c.label),l.some(h=>Array.isArray(h))&&(l[l.length-1]=t(l.find(h=>Array.isArray(h)),(u=r==null?void 0:r[o])==null?void 0:u.children)),l})}return t(i,e)},_r=i=>{var t,n,r,s,a,o,l,c,u,h,f,p,g,_,m,d,E,T,y,D,C,w,P,M,x;const e=i;if((i==null?void 0:i.comp)==="Table"){if((r=(n=(t=i.compData)==null?void 0:t.find(b=>(b==null?void 0:b.key)==="tableIndex"))==null?void 0:n.contents)!=null&&r.every(b=>!(b!=null&&b.children))||!((s=i.compData)!=null&&s.find(b=>(b==null?void 0:b.key)==="tableIndex")))return((l=(o=(a=e.compData)==null?void 0:a.find(b=>(b==null?void 0:b.key)==="tableContents"))==null?void 0:o.contents)==null?void 0:l.length)===1&&((f=(h=(u=(c=e.compData)==null?void 0:c.find(b=>(b==null?void 0:b.key)==="tableContents"))==null?void 0:u.contents)==null?void 0:h[0])!=null&&f.every(b=>Array.isArray(b)))?(e.compData=(p=e.compData)==null?void 0:p.map(b=>{var O;return(b==null?void 0:b.key)==="tableContents"&&(b.contents=(O=b.contents)==null?void 0:O[0]),b}),[e]):[e];{let b=[];const O=e.compData,F=(g=me.cloneDeep(O))==null?void 0:g.find(se=>(se==null?void 0:se.key)==="tableIndexColumn"),k=(_=me.cloneDeep(O))==null?void 0:_.find(se=>(se==null?void 0:se.key)==="extraButton"),W=(m=me.cloneDeep(O))==null?void 0:m.find(se=>(se==null?void 0:se.key)==="rowButton"),B=L0((E=(d=me.cloneDeep(O))==null?void 0:d.find(se=>(se==null?void 0:se.key)==="header"))==null?void 0:E.contents),J=(T=me.cloneDeep(O))==null?void 0:T.find(se=>(se==null?void 0:se.key)==="tableIndex"),V=P0((D=(y=me.cloneDeep(O))==null?void 0:y.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:D.contents),le=Vc((w=(C=me.cloneDeep(O))==null?void 0:C.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:w.contents,J==null?void 0:J.contents),ge=D0(Vc((M=(P=me.cloneDeep(O))==null?void 0:P.find(se=>(se==null?void 0:se.key)==="tableContents"))==null?void 0:M.contents,J==null?void 0:J.contents));if(J)return(x=C0(J.contents))==null||x.forEach((se,ke)=>{var $;let je=[];je.push({key:"tableIndex",contents:se}),je.push(F),je.push(k),je.push(W),je.push({key:"tableContents",contents:V[ke]}),je.push({key:"header",contents:B!=null&&B[ke]?[B==null?void 0:B[ke]]:[B==null?void 0:B[0]]}),b.push({comp:"Table",compData:je,name:"",parentTableContents:(($=U0(ge[ke],le))==null?void 0:$.contents)??""})}),b}}else return[e]},yr=(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},I0=async i=>{let e=[];i==null||i.forEach(t=>{var n;(n=t.compData)==null||n.forEach(async r=>{var a,o;const s=(a=me.cloneDeep(r==null?void 0:r.contents))==null?void 0:a.map(l=>{var c,u,h,f;if(Array.isArray(l)){let p=(c=l==null?void 0:l.map)==null?void 0:c.call(l,g=>{var m;return(m=_r(me.cloneDeep(g)))==null?void 0:m.map(d=>{var E,T,y,D;if(g.comp==="Table")return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(d==null?void 0:d.parentTableContents)??""},value:{pageData:{comp:(E=Nt(me.cloneDeep(d)))==null?void 0:E.comp,compData:(T=Nt(me.cloneDeep(d)))==null?void 0:T.compData,name:(y=Nt(me.cloneDeep(d)))==null?void 0:y.name}}};if((d==null?void 0:d.key)==="extraButton"){if(((D=Object.values(d==null?void 0:d.value))==null?void 0:D.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:d.value}}}else return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(d==null?void 0:d.parentTableContents)??""},value:{pageData:d}}})});return p=(u=p==null?void 0:p.map(g=>g!=null&&g.every(_=>_)?g:[]))==null?void 0:u.filter(g=>g.length>0),(h=p==null?void 0:p[0])==null?void 0:h[0]}else{const p=(f=_r(me.cloneDeep(l)))==null?void 0:f.map(g=>{var _,m,d,E;if(l.comp==="Table")return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(g==null?void 0:g.parentTableContents)??""},value:{pageData:{comp:(_=Nt(me.cloneDeep(g)))==null?void 0:_.comp,compData:(m=Nt(me.cloneDeep(g)))==null?void 0:m.compData,name:(d=Nt(me.cloneDeep(g)))==null?void 0:d.name}}};if((g==null?void 0:g.key)==="extraButton"){if(((E=Object.values(g==null?void 0:g.value))==null?void 0:E.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structureMethod",version:1},value:{pageData:g.value}}}else return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(g==null?void 0:g.parentTableContents)??""},value:{pageData:g}}});return p==null?void 0:p[0]}});if((s==null?void 0:s.length)>0){const l=await st.batchAddInsofDataApi({dataList:s});e.push(l)}(o=r.contents)==null||o.forEach(async l=>{var c;Array.isArray(l)?l==null||l.forEach(async u=>{var h;(h=_r(me.cloneDeep(u)))==null||h.forEach(async f=>{var p,g,_,m,d,E;if(u.comp==="Table"){const y=(d=(m=(await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(f==null?void 0:f.parentTableContents)??""},value:{pageData:{comp:(p=Nt(me.cloneDeep(f)))==null?void 0:p.comp,compData:(g=Nt(me.cloneDeep(f)))==null?void 0:g.compData,name:(_=Nt(me.cloneDeep(f)))==null?void 0:_.name}}})).data.result)==null?void 0:m[0])==null?void 0:d.id,D=await((E=Rs(me.cloneDeep(f)))==null?void 0:E.map(async C=>{var x,b,O,F,k;let w;C.length!==0&&(w=await st.createInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:y},value:{tableData:yr(C,(F=fi((O=(b=(x=Nt(me.cloneDeep(f)))==null?void 0:x.compData)==null?void 0:b.find(W=>(W==null?void 0:W.key)==="header"))==null?void 0:O.contents))==null?void 0:F.filter(W=>W!=="操作"))}}));const M=await((k=(await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",parentTable:C}})).data.result)==null?void 0:k.map(async W=>await st.updateInsofDataApi({id:W.id,key:{systemKey:W.key.systemKey,pageKey:W.key.pageKey,type:W.key.type,version:W.key.version,parentTable:w.data.result}})));return e.push(M),w}));e.push(D)}})}):(c=_r(me.cloneDeep(l)))==null||c.forEach(async u=>{var h,f,p,g,_,m,d;if(l.comp==="Table"){const T=(_=(g=(await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure",version:1,parentTable:(u==null?void 0:u.parentTableContents)??""},value:{pageData:{comp:(h=Nt(me.cloneDeep(u)))==null?void 0:h.comp,compData:(f=Nt(me.cloneDeep(u)))==null?void 0:f.compData,name:(p=Nt(me.cloneDeep(u)))==null?void 0:p.name}}})).data.result)==null?void 0:g[0])==null?void 0:_.id,y=(m=Rs(me.cloneDeep(u)))==null?void 0:m.map(w=>{var P,M,x,b;if((w==null?void 0:w.length)!==0)return{key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:T},value:{tableData:yr(w,(b=fi((x=(M=(P=Nt(me.cloneDeep(u)))==null?void 0:P.compData)==null?void 0:M.find(O=>(O==null?void 0:O.key)==="header"))==null?void 0:x.contents))==null?void 0:b.filter(O=>O!=="操作"))}}}),D=await st.batchAddInsofDataApi({dataList:y});e.push(D);const C=await((d=Rs(me.cloneDeep(u)))==null?void 0:d.map(async w=>{var b,O,F,k,W;let P;return(w==null?void 0:w.length)!==0&&(P=await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"data",tableId:T},value:{tableData:yr(w,(k=fi((F=(O=(b=Nt(me.cloneDeep(u)))==null?void 0:b.compData)==null?void 0:O.find(B=>(B==null?void 0:B.key)==="header"))==null?void 0:F.contents))==null?void 0:k.filter(B=>B!=="操作"))}})),await((W=(await st.getInsofDataApi({key:{parentTable:w,systemKey:sessionStorage.getItem("systemKey"),pageKey:t.name,type:"structure"}})).data.result)==null?void 0:W.map(async B=>{var V,le;return await st.updateInsofDataApi({id:B.id,key:{systemKey:B.key.systemKey,pageKey:B.key.pageKey,type:B.key.type,version:B.key.version,parentTable:B.key.parentTable===""?"":(le=(V=P.data.result)==null?void 0:V[0])==null?void 0:le.id}})}))}));e.push(C)}})})})}),await Promise.all(e)},Hc=st.useMenuState(pr.pinia),N0=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]}))},F0=async i=>{var a,o,l,c,u,h,f,p,g,_,m,d,E,T;const e=(o=(a=i==null?void 0:i.find(y=>(y==null?void 0:y.key)==="header"))==null?void 0:a.contents)==null?void 0:o.find(y=>y==null?void 0:y.columnPath);let t=(c=(l=me.cloneDeep(e==null?void 0:e.columnPath))==null?void 0:l.split("["))==null?void 0:c[0],n=(g=(p=(f=(h=(u=me.cloneDeep(e==null?void 0:e.columnPath))==null?void 0:u.split("["))==null?void 0:h[1])==null?void 0:f.split("]"))==null?void 0:p[0])==null?void 0:g.replaceAll("'",""),r=[];const s=await st.getInsofDataApi({key:{pageKey:t,systemKey:sessionStorage.getItem("systemKey"),type:"structure"}});if(Array.isArray((_=s==null?void 0:s.data)==null?void 0:_.result)&&((d=(m=s==null?void 0:s.data)==null?void 0:m.result)==null?void 0:d.length)>0){const y=await((T=(E=s==null?void 0:s.data)==null?void 0:E.result)==null?void 0:T.map(async D=>{var C,w,P,M,x,b,O,F,k,W;if(((w=(C=D==null?void 0:D.value)==null?void 0:C.pageData)==null?void 0:w.name)===n){r=me.cloneDeep((M=(P=D==null?void 0:D.value)==null?void 0:P.pageData)==null?void 0:M.compData);const B=await st.getInsofDataApi({key:{pageKey:t,systemKey:sessionStorage.getItem("systemKey"),tableId:D==null?void 0:D.id,type:"data"}}),J=(b=(x=B==null?void 0:B.data)==null?void 0:x.result)==null?void 0:b.map(V=>{var ge;let le=[];return le.push({id:V==null?void 0:V.id}),le.push((ge=V==null?void 0:V.value)==null?void 0:ge.tableData),le});r.push({key:"tableContents",contents:Zo(J,(W=(k=(F=(O=D==null?void 0:D.value)==null?void 0:O.pageData)==null?void 0:F.compData)==null?void 0:k.find(V=>(V==null?void 0:V.key)==="header"))==null?void 0:W.contents)})}}));await Promise.all(y)}return r},qu=async(i,e,t="",n)=>{var f,p,g,_,m,d;const r=await st.getInsofDataApi({key:{pageKey:i,systemKey:e,parentTable:t}}),s=await st.getInsofDataApi({key:{pageKey:i,systemKey:e,type:"structureMethod"}}),a=(f=r.data.result)==null?void 0:f.map(E=>E.id),o=a==null?void 0:a.map(E=>st.getInsofDataApi({key:{pageKey:i,systemKey:e,tableId:E}})),l=await Promise.all(o),c=[];l==null||l.forEach(E=>{var D,C,w,P;const T=(D=E.data.result)==null?void 0:D.map(M=>{const x=Array.isArray(M.value.tableData)?M.value.tableData:[M.value.tableData];return x.unshift({id:M.id}),x}),y=(P=(w=(C=E.data.result)==null?void 0:C[0])==null?void 0:w.key)==null?void 0:P.tableId;c.push({key:y,contents:T})});const u=[],h=await((p=r.data.result)==null?void 0:p.map(async E=>{var D,C,w,P,M,x;const T=E.value.pageData;let y=(D=me.cloneDeep(T.compData))==null?void 0:D.filter(b=>(b==null?void 0:b.key)!=="tableContents");if(y&&(y!=null&&y.find(b=>(b==null?void 0:b.key)==="header"))&&((w=(C=y==null?void 0:y.find(b=>(b==null?void 0:b.key)==="header"))==null?void 0:C.contents)!=null&&w.every(b=>!(b!=null&&b.columnPath)))?y.push({key:"tableContents",contents:n==="/系统管理/用户管理"?N0(c):Zo((P=c==null?void 0:c.find(b=>(b==null?void 0:b.key)===E.id))==null?void 0:P.contents,(M=y==null?void 0:y.find(b=>(b==null?void 0:b.key)==="header"))==null?void 0:M.contents)}):y&&(y!=null&&y.find(b=>(b==null?void 0:b.key)==="header"))&&(y=await F0(me.cloneDeep(y))),T.compData=y,T.id=E.id,((x=E.key)==null?void 0:x.type)!=="method")u.push(T);else{let b;b={name:"",compData:[T],comp:"calculator"},u.push(b)}}));return await Promise.all(h),((_=(g=s.data.result)==null?void 0:g.map(E=>E.value.pageData))==null?void 0:_.filter(E=>Object.values(E).length>0).length)>0&&u.push({comp:"methodButton",name:"",compData:(d=(m=s.data.result)==null?void 0:m.map(E=>E.value.pageData))==null?void 0:d.filter(E=>Object.values(E).length>0)}),u},O0=async i=>{await st.deleteInsofDataApi({id:i})},B0=async(i,e,t,n,r,s)=>{var a;await st.createInsofDataApi({key:{type:i,pageKey:e,tableId:t,systemKey:n},value:{tableData:yr(r,(a=fi(s))==null?void 0:a.filter(o=>o!=="操作"))}})},z0=async(i,e,t,n,r,s,a)=>{var o;await st.updateInsofDataApi({key:{type:i,pageKey:e,tableId:t,systemKey:r},value:{tableData:yr(s,(o=fi(a))==null?void 0:o.filter(l=>l!=="操作"))},id:n})},k0=async(i,e)=>{await st.updateInsofDataApi({value:{pageData:e},id:i})},V0=async(i,e)=>await st.getInsofDataApi({key:i,valueLikes:e}),H0=async()=>{var i,e,t,n,r,s,a,o,l;try{const c=await st.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),layer:"superAdmin"}});((i=c==null?void 0:c.data)==null?void 0:i.code)===200&&(Hc.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.systemType)==="制造系统"?"client":"browser"),Hc.setPlatName(((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?void 0:l.name)??""))}catch(c){return Promise.reject(c)}},Yu=st.defineStore("modelTableComp",{state:()=>({tableIndex:0,tableShowThree:""}),actions:{setTableIndex(i){this.tableIndex=i},setTableShowThree(i){this.tableShowThree=i}}}),G0={class:"table-content"},W0=["onClick"],X0={class:"form-content"},q0={key:0,class:"dialog-footer"},Y0={class:"dialog-footer"},K0={__name:"index",props:{compName:{type:String,default:"",required:!1},operatingForm:{type:Object,default:()=>{}},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=Y.ref([]),s=st.useMenuState(),{activeMenuPath:a}=st.storeToRefs(s),o=Yu(pr.pinia),l=Xc(pr.pinia),{extraContents:c}=st.storeToRefs(l),u=Y.ref([]);Y.ref(!1);const h=Y.ref("");Y.ref();const f=Y.ref(!0),p=Y.ref(0),g=Y.ref(!1),_=Y.ref(""),m=Y.ref(!1),d=Y.ref({label:"查看三维模型"}),E=Y.ref(!1),T=Y.ref(),y=Y.ref([]),D=Y.ref([]),C=Y.ref(!1),w=Y.ref([]),P=Y.ref([]),M=Y.ref(),x=Y.ref(),b=ku(pr.pinia),O=Y.ref(),F=Vu(pr.pinia),{selectIndex:k,selectMenu:W,selectTitle:B}=st.storeToRefs(F),{selectString:J}=st.storeToRefs(b),V=Y.ref(720),le=()=>{m.value=!1},ge=K=>{n("clickTrigger",K)},se=(K,re)=>{if(Object.values(re).length!==0)return Object.values(re).find(A=>{var De,ce,de;return((De=A==null?void 0:A.toString())==null?void 0:De.includes(".txt"))||((ce=A==null?void 0:A.toString())==null?void 0:ce.includes(".cpt"))||((de=A==null?void 0:A.toString())==null?void 0:de.includes(".obj"))})?[...K,d.value]:K},ke=K=>{var ce;J.value===""?K==null||K[0]:(K==null?void 0:K.find(de=>(de==null?void 0:de.selectLabel)==="("+J.value+")"))??(K==null||K.find(de=>!(de!=null&&de.selectLabel)));let re=K;(ce=r.value)!=null&&ce.find(de=>de.prop==="index");let A=M.value;const De=[];return re==null||re.forEach((de,X)=>{var Se;let be={};if(Array.isArray(de)){let pe=[];de==null||de.filter(Qe=>!(Qe!=null&&Qe.id)).forEach((Qe,R)=>{var v,z,j,Q,q;if((v=A==null?void 0:A[R])!=null&&v.prop&&!Array.isArray(Qe)){let Re={};Re[A[R].column]=Qe,c!=null&&c.value&&((z=c==null?void 0:c.value)==null?void 0:z.length)>0&&((j=c==null?void 0:c.value)!=null&&j.find(oe=>JSON.stringify(oe==null?void 0:oe[0])===JSON.stringify(Re)))&&(pe=(Q=c==null?void 0:c.value)==null?void 0:Q.find(oe=>JSON.stringify(oe==null?void 0:oe[0])===JSON.stringify(Re))),pe&&pe.length>0?be[A[R].prop]=pe!=null&&pe.find(oe=>{var Me;return((Me=Object.keys(oe))==null?void 0:Me[0])===A[R].column})?(q=pe==null?void 0:pe.find(oe=>{var Me;return((Me=Object.keys(oe))==null?void 0:Me[0])===A[R].column}))==null?void 0:q[A[R].column]:Qe:be[A[R].prop]=Qe}})}else be=de;Array.isArray(de)&&de.some(pe=>pe==null?void 0:pe.id)?De.push(Object.assign(be,{id:(Se=de==null?void 0:de.find(pe=>pe.id))==null?void 0:Se.id})):be.id?De.push(be):De.push(Object.assign(be,{id:X}))}),De},je=async K=>{var ce,de,X,be,Se;let re={};for(let pe in K)K[pe]!==""&&(re["tableData."+pe]=K[pe]);const A=await V0({type:"data",tableId:t==null?void 0:t.index,systemKey:sessionStorage.getItem("systemKey"),pageKey:a.value},re),De=(X=(de=(ce=me.cloneDeep(A))==null?void 0:ce.data)==null?void 0:de.result)==null?void 0:X.map(pe=>{var R;let Qe=[];return Qe.push({id:pe.id}),Qe.push((R=pe==null?void 0:pe.value)==null?void 0:R.tableData),Qe});u.value=ke(Zo(De,(Se=(be=me.cloneDeep(r.value))==null?void 0:be.map(pe=>pe.label))==null?void 0:Se.filter(pe=>pe!=="操作")))},$=async K=>{var A,De,ce,de,X,be,Se;let re=await qu(a.value,sessionStorage.getItem("systemKey"),K.id);if(re=re==null?void 0:re.filter(pe=>pe.comp!=="methodButton"),re&&re.length>0){const pe=!Array.isArray(B.value)&&((A=B.value)==null?void 0:A.key)!=="main"?[]:B.value;pe.push({key:W.value===""?(De=K==null?void 0:K.id)==null?void 0:De.toString():W.value+"-"+((ce=K==null?void 0:K.id)==null?void 0:ce.toString()),value:K[(de=Object.keys(K))==null?void 0:de.filter(Qe=>Qe!=="index"&&Qe!=="id")[0]]}),F.setSelectMenu(W.value===""?(X=K==null?void 0:K.id)==null?void 0:X.toString():W.value+"-"+((be=K==null?void 0:K.id)==null?void 0:be.toString())),F.setSelectTitle(pe),F.setSelectIndex((Se=K==null?void 0:K.id)==null?void 0:Se.toString()),n("pageChange",re)}},ue=K=>{var re;(re=me.cloneDeep(t.itemData))==null||re.map(A=>((A==null?void 0:A.key)==="tableContents"&&(A.contents=K),A))},Le=(K,re,A)=>{n("contentClick",K,re,A,{id:t==null?void 0:t.index})};Y.watch(()=>t.changedContent,()=>{var A,De;if(!t.changedContent)return;let K=(A=u.value)==null?void 0:A.map(ce=>{var de;return ce.id===((de=t.changedContent)==null?void 0:de.id)&&(ce={...t.changedContent,id:t.changedContent.newId?t.changedContent.newId:t.changedContent.id},delete ce.newId),ce});const re=(De=t.itemData)==null?void 0:De.map(ce=>((ce==null?void 0:ce.key)==="tableContents"&&(ce.contents=K),ce));u.value=K,n("contentChange",{contents:re,index:t.index}),n("change",{content:K,index:t==null?void 0:t.index,buttonName:"",id:t==null?void 0:t.index})},{deep:!0,immediate:!0});const ye=()=>{},Ue=(K,re,A)=>{var De,ce,de;if(h.value="",C.value=!0,f.value=!0,n("onButtonClick",K,re),K==="删除"){u.value=(De=me.cloneDeep(u.value))==null?void 0:De.filter(be=>(be==null?void 0:be.id)!==(re==null?void 0:re.id));const X=M0(O.value,W.value,re==null?void 0:re.id);ue(X),n("change",{content:u.value,singleContent:re,index:t==null?void 0:t.index,type:"delete",buttonName:K,column:r.value})}else if(K==="新增")_.value="新增",tt(""),m.value=!0;else if(K==="编辑")_.value="编辑",tt(re),m.value=!0;else if(K==="查看")_.value="查看",tt(re),C.value=!1,f.value=!1,m.value=!0;else if(K==="查看三维模型"){const X={};for(let Se in re)Se!=="id"&&(X[Se]=re[Se]);let be=(ce=Object.values(X))==null?void 0:ce[1];o.setTableShowThree(be)}else((de=A==null?void 0:A.extra)==null?void 0:de.type)==="modelExample"&&(_.value=K,E.value=!0)},tt=K=>{var De,ce,de;const re=[];let A=[];for(let X in K)Array.isArray(K==null?void 0:K[X])&&A.push(X);(ce=Ht.getColumnChild((De=me.cloneDeep(r.value))==null?void 0:De.filter(X=>(X==null?void 0:X.label)!=="操作")))==null||ce.forEach((X,be)=>{A.find(Se=>Se===(X==null?void 0:X.prop))||re.push({label:(X==null?void 0:X.label)??"",name:(X==null?void 0:X.prop)??"t"+be,type:!(X!=null&&X.formType)||(X==null?void 0:X.formType)===""?"Input":X==null?void 0:X.formType,value:(K==null?void 0:K[X==null?void 0:X.prop])??(X==null?void 0:X.value)??"",id:(X==null?void 0:X.id)??be,contents:(X==null?void 0:X.options)??[],width:1,isFormColHidden:X==null?void 0:X.isFormColHidden})}),K===""||!K||(h.value=K==null?void 0:K.id),P.value=y.value&&((de=y.value)==null?void 0:de.length)>0?y.value:re};Y.onMounted(()=>{T.value=window.innerWidth-240*2});const ze=()=>{let K,re=me.cloneDeep(u.value);h.value===""?(p.value++,re.push(Object.assign(x.value,{id:p.value})),K=Object.assign(x.value,{id:p.value})):re=re==null?void 0:re.map(De=>((De==null?void 0:De.id)===h.value&&(De=Object.assign(De,x.value),K=De),De)),u.value=re;const A=b0(O.value,W.value,re);ue(A),m.value=!1,n("change",{content:A,singleContent:K,index:t==null?void 0:t.index,buttonName:_.value,column:r.value})},ft=K=>{x.value=K,n("onFormChange",K)};return Y.watch(()=>[t.itemData,J.value,k.value,W.value,c==null?void 0:c.value],()=>{var Se,pe,Qe,R,v,z,j,Q,q,Re,oe,Me,Pe,ee,Ee,Fe,Ne,fe,Ve,U,_e,te,Te,ie,Z,we;const K=(Se=me.cloneDeep(t.itemData))==null?void 0:Se.filter(ne=>(ne==null?void 0:ne.key)==="header");(pe=me.cloneDeep(t.itemData))==null||pe.filter(ne=>(ne==null?void 0:ne.key)==="tableIndexColumn")[0];const re=(Qe=me.cloneDeep(t.itemData))==null?void 0:Qe.find(ne=>(ne==null?void 0:ne.key)==="page"),A=(R=me.cloneDeep(t.itemData))==null?void 0:R.find(ne=>(ne==null?void 0:ne.key)==="rowButton"),De=(v=me.cloneDeep(t.itemData))==null?void 0:v.find(ne=>(ne==null?void 0:ne.key)==="extraButton"),ce=(z=me.cloneDeep(t.itemData))==null?void 0:z.filter(ne=>(ne==null?void 0:ne.key)==="tableContents"),de=(j=me.cloneDeep(t.itemData))==null?void 0:j.filter(ne=>(ne==null?void 0:ne.key)==="tableIndex");y.value=(Re=(q=(Q=me.cloneDeep(t.itemData))==null?void 0:Q.filter(ne=>(ne==null?void 0:ne.key)==="tableToForm"))==null?void 0:q[0])==null?void 0:Re.contents,g.value=(re==null?void 0:re.contents)??!1;let X=[];J.value===""?X=K==null?void 0:K[0]:X=(K==null?void 0:K.find(ne=>(ne==null?void 0:ne.selectLabel)==="("+J.value+")"))??(K==null?void 0:K.find(ne=>!(ne!=null&&ne.selectLabel)));let be=[];if(J.value===""?be=de==null?void 0:de[0]:be=(de==null?void 0:de.find(ne=>(ne==null?void 0:ne.selectLabel)==="("+J.value+")"))??(de==null?void 0:de.find(ne=>!(ne!=null&&ne.selectLabel))),((oe=X==null?void 0:X.contents)==null?void 0:oe.length)>0){let ne=[];if(X!=null&&X.contents.some(Oe=>Array.isArray(Oe)&&(Oe==null?void 0:Oe.find(ve=>ve.children))))W.value===""?ne=(Pe=(Me=Ht.getGradeColumns(me.cloneDeep(X==null?void 0:X.contents)))==null?void 0:Me[0])==null?void 0:Pe.filter(Oe=>!Array.isArray(Oe)):(W.value.split("-"),ne=(ee=Ht.getGradeColumns(me.cloneDeep(X==null?void 0:X.contents)))==null?void 0:ee[0]);else{const Oe=X!=null&&X.contents.some(ve=>Array.isArray(ve))?(Ee=X==null?void 0:X.contents)==null?void 0:Ee[0]:X==null?void 0:X.contents;Oe==null||Oe.forEach((ve,vt)=>{ne.push({label:(ve==null?void 0:ve.label)??"",prop:(ve==null?void 0:ve.label)==="操作"?"operate":(ve==null?void 0:ve.prop)??"a"+vt,width:(ve==null?void 0:ve.label)==="操作"?"200":ve!=null&&ve.width?parseInt(ve.width):"",fixed:(ve==null?void 0:ve.fixed)??void 0,sortable:(ve==null?void 0:ve.sortable)??!1,align:(ve==null?void 0:ve.align)??"center",showOverflowTooltip:(ve==null?void 0:ve.showOverflowTooltip)??!0,isNotDrag:(ve==null?void 0:ve.isNotDrag)??!1,isEditCol:(ve==null?void 0:ve.isEditCol)??!1,isOperate:(ve==null?void 0:ve.isOperate)??!1,id:(ve==null?void 0:ve.id)??vt,type:(ve==null?void 0:ve.label)==="操作"?"operate":void 0,formType:(ve==null?void 0:ve.formType)??"",isTableColHidden:ve==null?void 0:ve.isTableColHidden,isFormColHidden:ve==null?void 0:ve.isFormColHidden,options:(ve==null?void 0:ve.options)??[],value:(ve==null?void 0:ve.value)??""})})}r.value=ne;let Je=(Ne=(Fe=Ht.getAllLeafNodes(me.cloneDeep(r.value)))==null?void 0:Fe.filter(Oe=>(Oe==null?void 0:Oe.type)!=="operate"))==null?void 0:Ne.map((Oe,ve)=>({prop:(Oe==null?void 0:Oe.prop)??"a"+ve,column:Oe.label}));M.value=Je;let Xe=[];J.value===""?Xe=ce==null?void 0:ce[0]:Xe=(ce==null?void 0:ce.find(Oe=>(Oe==null?void 0:Oe.selectLabel)==="("+J.value+")"))??(ce==null?void 0:ce.find(Oe=>!(Oe!=null&&Oe.selectLabel)));let _t=Array.isArray((fe=Xe==null?void 0:Xe.contents)==null?void 0:fe[0])&&((Ve=Xe==null?void 0:Xe.contents)!=null&&Ve[0].every(Oe=>Array.isArray(Oe)))?(U=me.cloneDeep(Xe==null?void 0:Xe.contents))==null?void 0:U[0]:me.cloneDeep(Xe==null?void 0:Xe.contents);be!=null&&be.contents&&((_e=be==null?void 0:be.contents)==null?void 0:_e.length)!==0&&(_t=(te=me.cloneDeep(_t))==null?void 0:te.map((Oe,ve)=>{if(!Array.isArray(Oe)){let vt={};for(let pn in Oe)pn!=="id"&&pn!=="index"&&(vt[pn]=Oe[pn]);Oe=Object.values(vt)}return Oe}));const sn=!!((Te=r.value)!=null&&Te.find(Oe=>Oe.prop==="index"));_t=Gu(me.cloneDeep(_t),be==null?void 0:be.contents,sn);const $n=[];_t==null||_t.forEach((Oe,ve)=>{var pn;let vt={};if(Array.isArray(Oe)){let Mt=[];Oe==null||Oe.filter(Lt=>!(Lt!=null&&Lt.id)).forEach((Lt,Zt)=>{var Jn,er,tr,Lr,Ur,Ir;if((Jn=Je==null?void 0:Je[Zt])!=null&&Jn.prop&&!Array.isArray(Lt)){let nr={};nr[Je[Zt].column]=Lt,c!=null&&c.value&&((er=c==null?void 0:c.value)==null?void 0:er.length)>0&&((tr=c==null?void 0:c.value)!=null&&tr.find(Xt=>JSON.stringify(Xt==null?void 0:Xt[0])===JSON.stringify(nr)))&&(Mt=(Lr=c==null?void 0:c.value)==null?void 0:Lr.find(Xt=>JSON.stringify(Xt==null?void 0:Xt[0])===JSON.stringify(nr))),Mt&&Mt.length>0?vt[Je[Zt].prop]=Mt!=null&&Mt.find(Xt=>{var Zn;return((Zn=Object.keys(Xt))==null?void 0:Zn[0])===Je[Zt].column})?(Ur=Mt==null?void 0:Mt.find(Xt=>{var Zn;return((Zn=Object.keys(Xt))==null?void 0:Zn[0])===Je[Zt].column}))==null?void 0:Ur[Je[Zt].column]:Lt:vt[Je[Zt].prop]=Lt}else Array.isArray(Lt)&&((Ir=Je[Zt])!=null&&Ir.prop?vt[Je[Zt].prop]=Lt:vt.children=Hu(Lt,Je))})}else vt=Oe;Array.isArray(Oe)&&Oe.some(Mt=>Mt==null?void 0:Mt.id)?$n.push(Object.assign(vt,{id:(pn=Oe==null?void 0:Oe.find(Mt=>Mt.id))==null?void 0:pn.id})):vt.id?$n.push(vt):$n.push(Object.assign(vt,{id:ve}))}),u.value=$n}else r.value=[],u.value=[];((ie=A==null?void 0:A.contents)==null?void 0:ie.length)>0?D.value=A==null?void 0:A.contents:D.value=[],((Z=De==null?void 0:De.contents)==null?void 0:Z.length)>0?w.value=De==null?void 0:De.contents:w.value=[],p.value=((we=u==null?void 0:u.value)==null?void 0:we.length)??0,O.value=u.value},{deep:!0,immediate:!0}),Y.watch(()=>t==null?void 0:t.operatingForm,K=>{K!=null&&K.form&&(tt(K==null?void 0:K.form),_.value=K==null?void 0:K.dialogTitle,C.value=!0,m.value=!0)},{immediate:!0,deep:!0}),(K,re)=>{var A;return Y.openBlock(),Y.createElementBlock("div",G0,[(Y.openBlock(),Y.createBlock(Ht.ssTable,{columns:r.value,key:r.value,tableData:u.value,isShowPagination:g.value,isShowEdit:!1,isShowDelete:!1,onDbClickRow:$,extraButton:w.value,onContentClick:Le},Y.createSlots({headerButton:Y.withCtx(De=>[Y.createVNode(Ih,{compName:i.compName,buttons:De.buttons,onButtonClick:re[0]||(re[0]=ce=>Ue(ce,"",{})),columns:r.value,onFilter:je},null,8,["compName","buttons","columns"])]),_:2},[((A=D.value)==null?void 0:A.length)>0?{name:"actions",fn:Y.withCtx(({item:De})=>[(Y.openBlock(!0),Y.createElementBlock(Y.Fragment,null,Y.renderList(se(D.value,De),(ce,de)=>(Y.openBlock(),Y.createElementBlock("div",{key:de},[Y.createElementVNode("div",{style:Y.normalizeStyle({color:ce==null?void 0:ce.textColor}),class:"extra-button-label",onClick:X=>Ue(ce==null?void 0:ce.label,De,{extra:ce})},Y.toDisplayString(ce==null?void 0:ce.label),13,W0)]))),128))]),key:"0"}:void 0]),1032,["columns","tableData","isShowPagination","extraButton"])),Y.createVNode(Ht.ssDialog,{title:_.value,visible:m.value,width:V.value,onBeforeDestroy:le},{default:Y.withCtx(()=>[Y.createElementVNode("div",X0,[Y.createVNode(Ht.ssForm,{rowContents:P.value,isEnableWrap:!1,onChange:ft,onClickTrigger:ge,isEdit:f.value},null,8,["rowContents","isEdit"])])]),footer:Y.withCtx(()=>[C.value?(Y.openBlock(),Y.createElementBlock("div",q0,[Y.createElementVNode("div",{onClick:re[1]||(re[1]=De=>m.value=!1),class:"cancel-button"},Y.toDisplayString("取消")),Y.createElementVNode("div",{class:"ok-button",onClick:ze},Y.toDisplayString("确认"))])):Y.createCommentVNode("",!0)]),_:1},8,["title","visible","width"]),Y.createVNode(Ht.ssDialog,{title:_.value,visible:E.value,width:T.value,onBeforeDestroy:re[3]||(re[3]=De=>E.value=!1)},{default:Y.withCtx(()=>[Y.createVNode(S0)]),footer:Y.withCtx(()=>[Y.createElementVNode("div",Y0,[Y.createElementVNode("div",{onClick:re[2]||(re[2]=De=>E.value=!1),class:"cancel-button"},Y.toDisplayString("取消")),Y.createElementVNode("div",{class:"ok-button",onClick:ye},Y.toDisplayString("确认"))])]),_:1},8,["title","visible","width"])])}}},j0=Do._export_sfc(K0,[["__scopeId","data-v-4098a946"]]);exports.ACESFilmicToneMapping=Kc;exports.AmbientLight=jd;exports.AnimationClip=Id;exports.Bone=_u;exports.Box3=En;exports.BoxGeometry=ji;exports.BufferAttribute=Dt;exports.BufferGeometry=Pt;exports.ClampToEdgeWrapping=xn;exports.Color=Ye;exports.ColorManagement=it;exports.Controls=np;exports.CylinderGeometry=qo;exports.DataTextureLoader=kd;exports.DefaultLoadingManager=Tu;exports.DirectionalLight=Kd;exports.DoubleSide=_n;exports.Euler=Jt;exports.FileLoader=Au;exports.Float32BufferAttribute=xt;exports.FrontSide=Fn;exports.Group=mr;exports.HemisphereLight=Hd;exports.Int32BufferAttribute=ad;exports.IsJson=A0;exports.Line=yu;exports.LineBasicMaterial=xu;exports.LineSegments=yd;exports.LinearMipmapLinearFilter=Ln;exports.Loader=Zi;exports.LoaderUtils=$d;exports.MOUSE=Nh;exports.Material=bn;exports.MathUtils=su;exports.Matrix4=Ke;exports.Mesh=Rt;exports.MeshBasicMaterial=gi;exports.MeshLambertMaterial=Td;exports.MeshPhongMaterial=bd;exports.OrthographicCamera=Hs;exports.PCFSoftShadowMap=Yc;exports.PerspectiveCamera=zt;exports.Plane=qn;exports.PlaneGeometry=Cr;exports.PointLight=qd;exports.Points=Sd;exports.PointsMaterial=Su;exports.Quaternion=fn;exports.QuaternionKeyframeTrack=Dr;exports.Ray=Ki;exports.RepeatWrapping=Wi;exports.SRGBColorSpace=Gt;exports.Scene=pu;exports.Skeleton=Wo;exports.SkinnedMesh=gd;exports.SphereGeometry=ks;exports.Spherical=wu;exports.SpotLight=Wd;exports.TOUCH=Fh;exports.TextureLoader=Vd;exports.URDFCollider=d0;exports.URDFJoint=zu;exports.URDFLink=Bu;exports.URDFMimicJoint=m0;exports.URDFRobot=g0;exports.URDFVisual=p0;exports.Vector2=We;exports.Vector3=L;exports.VectorKeyframeTrack=Ar;exports.WebGLRenderer=zv;exports.Xe=h0;exports.addTableContents=B0;exports.conStructContents=I0;exports.deleteTableContents=O0;exports.fixFormContents=k0;exports.fixTableContents=z0;exports.getItemData=qu;exports.loadingSystemType=H0;exports.methodTableToContent=R0;exports.ssTable=j0;exports.tableEveryContents=_r;exports.tableToContents=Rs;exports.tableToStruct=Nt;exports.useFormToTableComp=ku;exports.useModelComp=Xc;exports.useTableComp=Yu;exports.useUnit=Vu;
|