chatlab-cli 0.34.3 → 0.36.0
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/{chat-command-QH7DXCAJ.mjs → chat-command-SXW67RF7.mjs} +9 -9
- package/dist/{chunk-AWXHYTD5.mjs → chunk-4YPNYQSP.mjs} +701 -7065
- package/dist/chunk-4YPNYQSP.mjs.map +1 -0
- package/dist/{chunk-SWUTRDGZ.mjs → chunk-AAGDVTP2.mjs} +2 -2
- package/dist/{chunk-ZVGDOSGG.mjs → chunk-BSGLH6G3.mjs} +188 -41
- package/dist/chunk-BSGLH6G3.mjs.map +1 -0
- package/dist/{chunk-2Q3HHVTS.mjs → chunk-CNEWMCGX.mjs} +18 -18
- package/dist/{chunk-3X26JJIP.mjs → chunk-GVW3BDGZ.mjs} +3 -3
- package/dist/{chunk-WJVE5Q4Y.mjs → chunk-JHON5FN7.mjs} +2 -2
- package/dist/{chunk-JYBPJWE2.mjs → chunk-LZGOIRLV.mjs} +13 -23
- package/dist/chunk-LZGOIRLV.mjs.map +1 -0
- package/dist/chunk-OWOEWZIC.mjs +19072 -0
- package/dist/chunk-OWOEWZIC.mjs.map +1 -0
- package/dist/{chunk-XIWVJAXH.mjs → chunk-U2NXHIJK.mjs} +34 -24
- package/dist/chunk-U2NXHIJK.mjs.map +1 -0
- package/dist/{chunk-6U2QZO3N.mjs → chunk-UNIKQFI5.mjs} +2 -2
- package/dist/{chunk-C2PD3BS7.mjs → chunk-VDWI4A4U.mjs} +2 -2
- package/dist/{chunk-AWGXYFIC.mjs → chunk-XDF6PMVZ.mjs} +2 -2
- package/dist/chunk-YKMQLAVP.mjs +25 -0
- package/dist/chunk-YKMQLAVP.mjs.map +1 -0
- package/dist/cli.mjs +10 -10
- package/dist/contacts-worker.mjs +2 -2
- package/dist/global-insight-worker.mjs +136 -4
- package/dist/global-insight-worker.mjs.map +1 -1
- package/dist/{http-D2F4QTQW.mjs → http-LVOGJFDL.mjs} +13 -13
- package/dist/{import-H7X2JU2O.mjs → import-7OU57ZHM.mjs} +8 -8
- package/dist/index.mjs +13 -13
- package/dist/{mcp-UURXRGDF.mjs → mcp-CUKHTTII.mjs} +9 -9
- package/dist/people-relationships-worker.mjs +2 -2
- package/dist/semantic-index-worker.mjs +1 -1
- package/dist/{src-MHCO4HYY.mjs → src-LORFXAUE.mjs} +121 -97
- package/dist/{stream-import-BHXACUCA.mjs → stream-import-7YUWIAD6.mjs} +8 -8
- package/dist/{worker-runtime-JOUCP2L4.mjs → worker-runtime-GQ5SY7E3.mjs} +6 -6
- package/dist-cli-web/assets/AISettingsTab-BmhNcUEh.js +1 -0
- package/dist-cli-web/assets/AboutTab-CFklrZt8.js +1 -0
- package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang-B-dIPvcs.js +110 -0
- package/dist-cli-web/assets/Alert-DJzXKcec.js +1 -0
- package/dist-cli-web/assets/ApiSettingsTab-DvDm421U.js +2 -0
- package/dist-cli-web/assets/BatchManageTab-DhIDH3Q1.js +1 -0
- package/dist-cli-web/assets/{BufferResource-Dak23r3B.js → BufferResource-DY3P-dGs.js} +1 -1
- package/dist-cli-web/assets/CanvasRenderer-As2MJTWZ.js +1 -0
- package/dist-cli-web/assets/ChatRecordDrawer-DHdas7Jp.js +1 -0
- package/dist-cli-web/assets/ChatRecordWorkspace-CVDPBmcl.js +11 -0
- package/dist-cli-web/assets/ChatRecordWorkspace-D_oJMtqh.css +1 -0
- package/dist-cli-web/assets/Checkbox-4F1WAuVF.js +1 -0
- package/dist-cli-web/assets/DataDirCleanupNotice-jebQ9il3.js +1 -0
- package/dist-cli-web/assets/DatePicker.vue_vue_type_script_setup_true_lang-Cal624eP.js +1 -0
- package/dist-cli-web/assets/DebugToolsPanel-BLU6SY8a.js +1 -0
- package/dist-cli-web/assets/EChart.vue_vue_type_script_setup_true_lang-CsgJ-Xn3.js +1 -0
- package/dist-cli-web/assets/EChartLine.vue_vue_type_script_setup_true_lang-BYhukELX.js +1 -0
- package/dist-cli-web/assets/EChartWordcloud-C16xh7Tx.js +1 -0
- package/dist-cli-web/assets/{Filter-CHKZVYB3.js → Filter-BEtPORqF.js} +1 -1
- package/dist-cli-web/assets/GlobalTaskBar-BvNmFO7q.js +1 -0
- package/dist-cli-web/assets/GlobalTaskBar-COW_uBX6.css +1 -0
- package/dist-cli-web/assets/GroupRelationshipGalaxyView-DEUIrvgz.js +1 -0
- package/dist-cli-web/assets/Label-Dgl3ghzT.js +1 -0
- package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-CwDIA0UP.js +1 -0
- package/dist-cli-web/assets/MessageExportModal-DYjhBuzO.js +1 -0
- package/dist-cli-web/assets/PageHeader-CL9AFfvl.js +1 -0
- package/dist-cli-web/assets/PageTabs.vue_vue_type_script_setup_true_lang-C22kOxIK.js +1 -0
- package/dist-cli-web/assets/{RelationshipGalaxyCanvas-mJhEPzsY.js → RelationshipGalaxyCanvas-BnkcrIpk.js} +3 -3
- package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-Bf76yzmQ.js → RelationshipGalaxyThreeCanvas-CqdqveEJ.js} +166 -166
- package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-CMuibfiA.css → RelationshipGalaxyThreeCanvas-TYGOUDiv.css} +1 -1
- package/dist-cli-web/assets/{RenderTargetSystem-1rM7OF-M.js → RenderTargetSystem-CPwnC2X3.js} +1 -1
- package/dist-cli-web/assets/RovingFocusItem-j33Nsbbn.js +1 -0
- package/dist-cli-web/assets/ScreenCaptureModal-ByKxzNQe.js +1 -0
- package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-C6EHKB_i.js +1 -0
- package/dist-cli-web/assets/Select-jVtfc_xc.js +1 -0
- package/dist-cli-web/assets/SettingsModal-CjVax3I6.css +1 -0
- package/dist-cli-web/assets/SettingsModal-Dg27piEO.js +2 -0
- package/dist-cli-web/assets/StorageTab-QdcDqA6Q.js +1 -0
- package/dist-cli-web/assets/Switch-DYHM64k9.js +1 -0
- package/dist-cli-web/assets/Tabs-B6Nzq2NQ.js +1 -0
- package/dist-cli-web/assets/Tabs-CRZdCcU4.js +1 -0
- package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-Bsq7gpC0.js +1 -0
- package/dist-cli-web/assets/TimeSelect.vue_vue_type_script_setup_true_lang-BLpQds4F.js +1 -0
- package/dist-cli-web/assets/VisuallyHiddenInput-IQpmK9yR.js +1 -0
- package/dist-cli-web/assets/{WebGLRenderer-Y0jQtBvK.js → WebGLRenderer-8JHbnkTc.js} +2 -2
- package/dist-cli-web/assets/{WebGPURenderer-BcUvCPhd.js → WebGPURenderer-CLWfB4CC.js} +2 -2
- package/dist-cli-web/assets/aiChat-4JvxWGXZ.js +8 -0
- package/dist-cli-web/assets/base-D6fxqD_X.js +1 -0
- package/dist-cli-web/assets/{browserAll-BsR1UaCC.js → browserAll-Cin6ghNg.js} +2 -2
- package/dist-cli-web/assets/chatlabSiteLocale-CrCNb8QP.js +1 -0
- package/dist-cli-web/assets/clamp-jFYhBC76.js +1 -0
- package/dist-cli-web/assets/cli-web-D7IBc3AX.js +1 -0
- package/dist-cli-web/assets/{dateFormat-B6JnNCxp.js → dateFormat-Bu4-Ux3L.js} +1 -1
- package/dist-cli-web/assets/{fetch-BAJ_VjWE.js → fetch-1NiXh-_B.js} +1 -1
- package/dist-cli-web/assets/{fetch-BNcHe2-O.js → fetch-2QEQPA9q.js} +8 -5
- package/dist-cli-web/assets/fetch-B2agy1hy.js +1 -0
- package/dist-cli-web/assets/{fetch-CPloHijF.js → fetch-B7kuohCt.js} +1 -1
- package/dist-cli-web/assets/{fetch-D7vgaLpy.js → fetch-BR71C0K9.js} +1 -1
- package/dist-cli-web/assets/{fetch-bdY0RMM3.js → fetch-Bk-7vxHV.js} +1 -1
- package/dist-cli-web/assets/fetch-C8tTTsCm.js +1 -0
- package/dist-cli-web/assets/{fetch-DtnhbqTN.js → fetch-CuUeyk0N.js} +1 -1
- package/dist-cli-web/assets/{fetch-bhHY8rO7.js → fetch-DPRDSI39.js} +1 -1
- package/dist-cli-web/assets/{fetch-DGvqctIb.js → fetch-OnnCjzee.js} +1 -1
- package/dist-cli-web/assets/{fetch-Clj_RVUD.js → fetch-_CN1EVMt.js} +1 -1
- package/dist-cli-web/assets/index-B4J99zv3.css +1 -0
- package/dist-cli-web/assets/index-BBeqtL8d.css +1 -0
- package/dist-cli-web/assets/index-BCEk6ZpL.js +64 -0
- package/dist-cli-web/assets/index-BIHFuCJK.js +1 -0
- package/dist-cli-web/assets/index-BUz_Vl9U.js +2 -0
- package/dist-cli-web/assets/index-BWZIoPV3.css +1 -0
- package/dist-cli-web/assets/index-BYQV3OA5.js +1 -0
- package/dist-cli-web/assets/index-CVVv_6qu.js +2 -0
- package/dist-cli-web/assets/index-CacwXQL4.js +1 -0
- package/dist-cli-web/assets/{index-DMYFpctK.js → index-Colc58j-.js} +3 -3
- package/dist-cli-web/assets/index-DImo7TQN.js +1 -0
- package/dist-cli-web/assets/index-DV9zQVPV.js +137 -0
- package/dist-cli-web/assets/index-DXKS-q-w.css +1 -0
- package/dist-cli-web/assets/index-DZc5A4_J.js +1 -0
- package/dist-cli-web/assets/index-DkWTvE7d.js +36 -0
- package/dist-cli-web/assets/index-DmEn0PAI.js +1 -0
- package/dist-cli-web/assets/index-b9eEQeVt.js +1 -0
- package/dist-cli-web/assets/index-waDxab2e.css +1 -0
- package/dist-cli-web/assets/insight-time-range-MJxLEu6o.js +1 -0
- package/dist-cli-web/assets/people-page-header-DNPjaSt4.js +1 -0
- package/dist-cli-web/assets/prompt-BgywZQ_g.js +1 -0
- package/dist-cli-web/assets/relationship-galaxy-connections-Cg4G5yYE.js +1 -0
- package/dist-cli-web/assets/semantic-index-config-builder-bji_UxYE.js +1 -0
- package/dist-cli-web/assets/service-DpU9fa-l.js +1 -0
- package/dist-cli-web/assets/useFormControl-De24E2zT.js +1 -0
- package/dist-cli-web/assets/useTable-C7BH94MF.js +1 -0
- package/dist-cli-web/assets/useToast-CxhJkhXK.js +1 -0
- package/dist-cli-web/assets/vendor-echarts-DfAMQxdr.js +11 -0
- package/dist-cli-web/assets/{vendor-echarts-wordcloud-Ca8n6qS6.js → vendor-echarts-wordcloud-BsaEJTPY.js} +1 -1
- package/dist-cli-web/assets/vendor-zrender-PFmZe1EY.js +8 -0
- package/dist-cli-web/assets/{webworkerAll-CfZWlukP.js → webworkerAll-BRnv6GvJ.js} +1 -1
- package/dist-cli-web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-2WYXD5ZP.mjs +0 -9451
- package/dist/chunk-2WYXD5ZP.mjs.map +0 -1
- package/dist/chunk-AWXHYTD5.mjs.map +0 -1
- package/dist/chunk-JYBPJWE2.mjs.map +0 -1
- package/dist/chunk-QZCNVAH6.mjs +0 -14
- package/dist/chunk-QZCNVAH6.mjs.map +0 -1
- package/dist/chunk-XIWVJAXH.mjs.map +0 -1
- package/dist/chunk-ZVGDOSGG.mjs.map +0 -1
- package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang-kN3uxTW8.js +0 -110
- package/dist-cli-web/assets/CanvasRenderer-Cmjtvski.js +0 -1
- package/dist-cli-web/assets/DataDirCleanupNotice-B5tyDzK-.js +0 -1
- package/dist-cli-web/assets/EChartWordcloud-Bd3L3G8I.js +0 -1
- package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-CKf_gC1k.js +0 -1
- package/dist-cli-web/assets/MessageExportModal-ODYCcSnk.js +0 -1
- package/dist-cli-web/assets/PageHeader-Bn7Jn8JW.js +0 -1
- package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-CADZpPia.js +0 -1
- package/dist-cli-web/assets/TimeSelect.vue_vue_type_script_setup_true_lang-I3FYjhfs.js +0 -1
- package/dist-cli-web/assets/annual-summary-time-range-BIADd8qE.js +0 -1
- package/dist-cli-web/assets/base-BpxxC5Z5.js +0 -1
- package/dist-cli-web/assets/cli-web-BiWUOncc.js +0 -1
- package/dist-cli-web/assets/fetch-DSxgaVBO.js +0 -1
- package/dist-cli-web/assets/index-B6Gq11lw.css +0 -1
- package/dist-cli-web/assets/index-BJ2lywiG.js +0 -1
- package/dist-cli-web/assets/index-BT3_fSP6.js +0 -2
- package/dist-cli-web/assets/index-BVZhP1J5.js +0 -1
- package/dist-cli-web/assets/index-Br8r4pu8.js +0 -1
- package/dist-cli-web/assets/index-Byok4VaA.css +0 -1
- package/dist-cli-web/assets/index-CKnnxOci.js +0 -1
- package/dist-cli-web/assets/index-CXnYfvTv.js +0 -137
- package/dist-cli-web/assets/index-CsFLLk3T.css +0 -1
- package/dist-cli-web/assets/index-CzoOQ7zg.js +0 -1
- package/dist-cli-web/assets/index-D-dTTUGj.js +0 -1
- package/dist-cli-web/assets/index-DEbvEKzi.js +0 -2
- package/dist-cli-web/assets/index-KO7uPd8W.js +0 -64
- package/dist-cli-web/assets/index-ZsZwPLWy.css +0 -1
- package/dist-cli-web/assets/index-lkmJ6dI7.js +0 -1
- package/dist-cli-web/assets/index-y7xPDpsW.js +0 -53
- package/dist-cli-web/assets/people-page-header-gjTyODWs.js +0 -1
- package/dist-cli-web/assets/vendor-echarts-B-i_56Av.js +0 -11
- package/dist-cli-web/assets/vendor-zrender-5DcYjSZk.js +0 -8
- /package/dist/{chat-command-QH7DXCAJ.mjs.map → chat-command-SXW67RF7.mjs.map} +0 -0
- /package/dist/{chunk-SWUTRDGZ.mjs.map → chunk-AAGDVTP2.mjs.map} +0 -0
- /package/dist/{chunk-2Q3HHVTS.mjs.map → chunk-CNEWMCGX.mjs.map} +0 -0
- /package/dist/{chunk-3X26JJIP.mjs.map → chunk-GVW3BDGZ.mjs.map} +0 -0
- /package/dist/{chunk-WJVE5Q4Y.mjs.map → chunk-JHON5FN7.mjs.map} +0 -0
- /package/dist/{chunk-6U2QZO3N.mjs.map → chunk-UNIKQFI5.mjs.map} +0 -0
- /package/dist/{chunk-C2PD3BS7.mjs.map → chunk-VDWI4A4U.mjs.map} +0 -0
- /package/dist/{chunk-AWGXYFIC.mjs.map → chunk-XDF6PMVZ.mjs.map} +0 -0
- /package/dist/{http-D2F4QTQW.mjs.map → http-LVOGJFDL.mjs.map} +0 -0
- /package/dist/{import-H7X2JU2O.mjs.map → import-7OU57ZHM.mjs.map} +0 -0
- /package/dist/{mcp-UURXRGDF.mjs.map → mcp-CUKHTTII.mjs.map} +0 -0
- /package/dist/{src-MHCO4HYY.mjs.map → src-LORFXAUE.mjs.map} +0 -0
- /package/dist/{stream-import-BHXACUCA.mjs.map → stream-import-7YUWIAD6.mjs.map} +0 -0
- /package/dist/{worker-runtime-JOUCP2L4.mjs.map → worker-runtime-GQ5SY7E3.mjs.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{d as hc,s as Jr,y as uc,ao as fc,w as $i,K as dc,o as Qr,c as jr,C as pc,$ as mc,a0 as gc,am as _c,Q as xc,n as vc,E as Mc,b as no,Z as Sc}from"./index-y7xPDpsW.js";import{b as yc,a as ml,g as Ec}from"./index-BT3_fSP6.js";import{n as gl}from"./relationship-galaxy-viewport-Cwfa51ER.js";import"./vendor-snapdom--nZvo8Sg.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-CKf_gC1k.js";import"./people-page-header-gjTyODWs.js";const Pa="185",Si={ROTATE:0,DOLLY:1,PAN:2},Mi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},bc=0,io=1,Tc=2,Tr=1,Ac=2,Hi=3,Bn=0,Ut=1,pn=2,gn=0,Fn=1,ro=2,so=3,ao=4,Rc=5,Yn=100,wc=101,Cc=102,Pc=103,Dc=104,Lc=200,Ic=201,Uc=202,Nc=203,Os=204,Bs=205,Fc=206,Oc=207,Bc=208,zc=209,Gc=210,Vc=211,Hc=212,kc=213,Wc=214,zs=0,Gs=1,Vs=2,Ti=3,Hs=4,ks=5,Ws=6,Xs=7,_l=0,Xc=1,Yc=2,sn=0,xl=1,vl=2,Ml=3,Sl=4,yl=5,El=6,bl=7,Tl=300,$n=301,Ai=302,es=303,ts=304,kr=306,Ys=1e3,mn=1001,qs=1002,yt=1003,qc=1004,Ji=1005,At=1006,ns=1007,Kn=1008,kt=1009,Al=1010,Rl=1011,Wi=1012,Da=1013,on=1014,nn=1015,xn=1016,La=1017,Ia=1018,Xi=1020,wl=35902,Cl=35899,Pl=1021,Dl=1022,Zt=1023,vn=1026,Zn=1027,Ll=1028,Ua=1029,Jn=1030,Na=1031,Fa=1033,Ar=33776,Rr=33777,wr=33778,Cr=33779,Ks=35840,Zs=35841,$s=35842,Js=35843,Qs=36196,js=37492,ea=37496,ta=37488,na=37489,Lr=37490,ia=37491,ra=37808,sa=37809,aa=37810,oa=37811,la=37812,ca=37813,ha=37814,ua=37815,fa=37816,da=37817,pa=37818,ma=37819,ga=37820,_a=37821,xa=36492,va=36494,Ma=36495,Sa=36283,ya=36284,Ir=36285,Ea=36286,Kc=3200,oo=0,Zc=1,Ln="",It="srgb",Ur="srgb-linear",Nr="linear",Ze="srgb",ni=7680,lo=519,$c=512,Jc=513,Qc=514,Oa=515,jc=516,eh=517,Ba=518,th=519,ba=35044,co="300 es",rn=2e3,Fr=2001;function nh(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Or(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function ih(){const i=Or("canvas");return i.style.display="block",i}const ho={};function Br(...i){const e="THREE."+i.shift();console.log(e,...i)}function Il(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function we(...i){i=Il(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=Il(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function yi(...i){const e=i.join(" ");e in ho||(ho[e]=!0,we(...i))}function rh(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)})}const sh={[zs]:Gs,[Vs]:Ws,[Hs]:Xs,[Ti]:ks,[Gs]:zs,[Ws]:Vs,[Xs]:Hs,[ks]:Ti};class Gn{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 bt=["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"],Pr=Math.PI/180,Ta=180/Math.PI;function On(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(bt[i&255]+bt[i>>8&255]+bt[i>>16&255]+bt[i>>24&255]+"-"+bt[e&255]+bt[e>>8&255]+"-"+bt[e>>16&15|64]+bt[e>>24&255]+"-"+bt[t&63|128]+bt[t>>8&255]+"-"+bt[t>>16&255]+bt[t>>24&255]+bt[n&255]+bt[n>>8&255]+bt[n>>16&255]+bt[n>>24&255]).toLowerCase()}function Oe(i,e,t){return Math.max(e,Math.min(t,i))}function ah(i,e){return(i%e+e)%e}function is(i,e,t){return(1-t)*i+t*e}function tn(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("THREE.MathUtils: Invalid component type.")}}function Qe(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("THREE.MathUtils: Invalid component type.")}}const oh={DEG2RAD:Pr},ka=class ka{constructor(e=0,t=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("THREE.Vector2: 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("THREE.Vector2: 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=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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(Oe(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}};ka.prototype.isVector2=!0;let Ce=ka;class zn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let c=n[r+0],l=n[r+1],u=n[r+2],m=n[r+3],h=s[a+0],d=s[a+1],x=s[a+2],y=s[a+3];if(m!==y||c!==h||l!==d||u!==x){let g=c*h+l*d+u*x+m*y;g<0&&(h=-h,d=-d,x=-x,y=-y,g=-g);let f=1-o;if(g<.9995){const w=Math.acos(g),C=Math.sin(w);f=Math.sin(f*w)/C,o=Math.sin(o*w)/C,c=c*f+h*o,l=l*f+d*o,u=u*f+x*o,m=m*f+y*o}else{c=c*f+h*o,l=l*f+d*o,u=u*f+x*o,m=m*f+y*o;const w=1/Math.sqrt(c*c+l*l+u*u+m*m);c*=w,l*=w,u*=w,m*=w}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=m}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],c=n[r+1],l=n[r+2],u=n[r+3],m=s[a],h=s[a+1],d=s[a+2],x=s[a+3];return e[t]=o*x+u*m+c*d-l*h,e[t+1]=c*x+u*h+l*m-o*d,e[t+2]=l*x+u*d+o*h-c*m,e[t+3]=u*x-o*m-c*h-l*d,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,c=Math.sin,l=o(n/2),u=o(r/2),m=o(s/2),h=c(n/2),d=c(r/2),x=c(s/2);switch(a){case"XYZ":this._x=h*u*m+l*d*x,this._y=l*d*m-h*u*x,this._z=l*u*x+h*d*m,this._w=l*u*m-h*d*x;break;case"YXZ":this._x=h*u*m+l*d*x,this._y=l*d*m-h*u*x,this._z=l*u*x-h*d*m,this._w=l*u*m+h*d*x;break;case"ZXY":this._x=h*u*m-l*d*x,this._y=l*d*m+h*u*x,this._z=l*u*x+h*d*m,this._w=l*u*m-h*d*x;break;case"ZYX":this._x=h*u*m-l*d*x,this._y=l*d*m+h*u*x,this._z=l*u*x-h*d*m,this._w=l*u*m+h*d*x;break;case"YZX":this._x=h*u*m+l*d*x,this._y=l*d*m+h*u*x,this._z=l*u*x-h*d*m,this._w=l*u*m-h*d*x;break;case"XZY":this._x=h*u*m-l*d*x,this._y=l*d*m-h*u*x,this._z=l*u*x+h*d*m,this._w=l*u*m+h*d*x;break;default:we("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],c=t[9],l=t[2],u=t[6],m=t[10],h=n+o+m;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-c)*d,this._y=(s-l)*d,this._z=(a-r)*d}else if(n>o&&n>m){const d=2*Math.sqrt(1+n-o-m);this._w=(u-c)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+l)/d}else if(o>m){const d=2*Math.sqrt(1+o-n-m);this._w=(s-l)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(c+u)/d}else{const d=2*Math.sqrt(1+m-n-o);this._w=(a-r)/d,this._x=(s+l)/d,this._y=(c+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(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(Oe(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,c=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+r*l-s*c,this._y=r*u+a*c+s*o-n*l,this._z=s*u+a*l+n*c-r*o,this._w=a*u-n*o-r*c-s*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,s=-s,a=-a,o=-o);let c=1-t;if(o<.9995){const l=Math.acos(o),u=Math.sin(l);c=Math.sin(c*l)/u,t=Math.sin(t*l)/u,this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this.normalize();return 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}}const Wa=class Wa{constructor(e=0,t=0,n=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("THREE.Vector3: 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("THREE.Vector3: 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(uo.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(uo.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,c=e.w,l=2*(a*r-o*n),u=2*(o*t-s*r),m=2*(s*n-a*t);return this.x=t+c*l+a*m-o*u,this.y=n+c*u+o*l-s*m,this.z=r+c*m+s*u-a*l,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=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this.z=Oe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this.z=Oe(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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,c=t.z;return this.x=r*c-s*o,this.y=s*a-n*c,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 rs.copy(this).projectOnVector(e),this.sub(rs)}reflect(e){return this.sub(rs.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(Oe(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}};Wa.prototype.isVector3=!0;let D=Wa;const rs=new D,uo=new zn,Xa=class Xa{constructor(e,t,n,r,s,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,c,l)}set(e,t,n,r,s,a,o,c,l){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=c,u[6]=n,u[7]=a,u[8]=l,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],c=n[6],l=n[1],u=n[4],m=n[7],h=n[2],d=n[5],x=n[8],y=r[0],g=r[3],f=r[6],w=r[1],C=r[4],M=r[7],R=r[2],E=r[5],P=r[8];return s[0]=a*y+o*w+c*R,s[3]=a*g+o*C+c*E,s[6]=a*f+o*M+c*P,s[1]=l*y+u*w+m*R,s[4]=l*g+u*C+m*E,s[7]=l*f+u*M+m*P,s[2]=h*y+d*w+x*R,s[5]=h*g+d*C+x*E,s[8]=h*f+d*M+x*P,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],c=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*s*u+n*o*c+r*s*l-r*a*c}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=e[8],m=u*a-o*l,h=o*c-u*s,d=l*s-a*c,x=t*m+n*h+r*d;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/x;return e[0]=m*y,e[1]=(r*l-u*n)*y,e[2]=(o*n-r*a)*y,e[3]=h*y,e[4]=(u*t-r*c)*y,e[5]=(r*s-o*t)*y,e[6]=d*y,e[7]=(n*c-l*t)*y,e[8]=(a*t-n*s)*y,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 c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-r*l,r*c,-r*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return yi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(ss.makeScale(e,t)),this}rotate(e){return yi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(ss.makeRotation(-e)),this}translate(e,t){return yi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(ss.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)}};Xa.prototype.isMatrix3=!0;let Le=Xa;const ss=new Le,fo=new Le().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),po=new Le().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function lh(){const i={enabled:!0,workingColorSpace:Ur,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ze&&(r.r=_n(r.r),r.g=_n(r.g),r.b=_n(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===Ze&&(r.r=Ei(r.r),r.g=Ei(r.g),r.b=Ei(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===Ln?Nr:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},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 yi("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return yi("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({[Ur]:{primaries:e,whitePoint:n,transfer:Nr,toXYZ:fo,fromXYZ:po,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:It},outputColorSpaceConfig:{drawingBufferColorSpace:It}},[It]:{primaries:e,whitePoint:n,transfer:Ze,toXYZ:fo,fromXYZ:po,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:It}}}),i}const Ve=lh();function _n(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Ei(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ii;class ch{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{ii===void 0&&(ii=Or("canvas")),ii.width=e.width,ii.height=e.height;const r=ii.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=ii}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=Or("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]=_n(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(_n(t[n]/255)*255):t[n]=_n(t[n]);return{data:t,width:e.width,height:e.height}}else return we("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let hh=0;class za{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:hh++}),this.uuid=On(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):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(as(r[a].image)):s.push(as(r[a]))}else s=as(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function as(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?ch.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(we("Texture: Unable to serialize Texture."),{})}let uh=0;const os=new D;class Rt extends Gn{constructor(e=Rt.DEFAULT_IMAGE,t=Rt.DEFAULT_MAPPING,n=mn,r=mn,s=At,a=Kn,o=Zt,c=kt,l=Rt.DEFAULT_ANISOTROPY,u=Ln){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:uh++}),this.uuid=On(),this.name="",this.source=new za(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Ce(0,0),this.repeat=new Ce(1,1),this.center=new Ce(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Le,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,this.normalized=!1}get width(){return this.source.getSize(os).x}get height(){return this.source.getSize(os).y}get depth(){return this.source.getSize(os).z}get image(){return this.source.data}set image(e){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.normalized=e.normalized,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){we(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){we(`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,normalized:this.normalized,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!==Tl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ys:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case qs: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 Ys:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case qs: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++}}Rt.DEFAULT_IMAGE=null;Rt.DEFAULT_MAPPING=Tl;Rt.DEFAULT_ANISOTROPY=1;const Ya=class Ya{constructor(e=0,t=0,n=0,r=1){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("THREE.Vector4: 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("THREE.Vector4: 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 c=e.elements,l=c[0],u=c[4],m=c[8],h=c[1],d=c[5],x=c[9],y=c[2],g=c[6],f=c[10];if(Math.abs(u-h)<.01&&Math.abs(m-y)<.01&&Math.abs(x-g)<.01){if(Math.abs(u+h)<.1&&Math.abs(m+y)<.1&&Math.abs(x+g)<.1&&Math.abs(l+d+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const C=(l+1)/2,M=(d+1)/2,R=(f+1)/2,E=(u+h)/4,P=(m+y)/4,_=(x+g)/4;return C>M&&C>R?C<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(C),r=E/n,s=P/n):M>R?M<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=E/r,s=_/r):R<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),n=P/s,r=_/s),this.set(n,r,s,t),this}let w=Math.sqrt((g-x)*(g-x)+(m-y)*(m-y)+(h-u)*(h-u));return Math.abs(w)<.001&&(w=1),this.x=(g-x)/w,this.y=(m-y)/w,this.z=(h-u)/w,this.w=Math.acos((l+d+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this.z=Oe(this.z,e.z,t.z),this.w=Oe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this.z=Oe(this.z,e,t),this.w=Oe(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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}};Ya.prototype.isVector4=!0;let ht=Ya;class fh extends Gn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:At,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ht(0,0,e,t),this.scissorTest=!1,this.viewport=new ht(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new Rt(r),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,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:At,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].isData3DTexture!==!0&&(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 za(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.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class an extends fh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Ul extends Rt{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=yt,this.minFilter=yt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class dh extends Rt{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=yt,this.minFilter=yt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Hr=class Hr{constructor(e,t,n,r,s,a,o,c,l,u,m,h,d,x,y,g){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,c,l,u,m,h,d,x,y,g)}set(e,t,n,r,s,a,o,c,l,u,m,h,d,x,y,g){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=c,f[2]=l,f[6]=u,f[10]=m,f[14]=h,f[3]=d,f[7]=x,f[11]=y,f[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Hr().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 this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(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){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,r=1/ri.setFromMatrixColumn(e,0).length(),s=1/ri.setFromMatrixColumn(e,1).length(),a=1/ri.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),c=Math.cos(r),l=Math.sin(r),u=Math.cos(s),m=Math.sin(s);if(e.order==="XYZ"){const h=a*u,d=a*m,x=o*u,y=o*m;t[0]=c*u,t[4]=-c*m,t[8]=l,t[1]=d+x*l,t[5]=h-y*l,t[9]=-o*c,t[2]=y-h*l,t[6]=x+d*l,t[10]=a*c}else if(e.order==="YXZ"){const h=c*u,d=c*m,x=l*u,y=l*m;t[0]=h+y*o,t[4]=x*o-d,t[8]=a*l,t[1]=a*m,t[5]=a*u,t[9]=-o,t[2]=d*o-x,t[6]=y+h*o,t[10]=a*c}else if(e.order==="ZXY"){const h=c*u,d=c*m,x=l*u,y=l*m;t[0]=h-y*o,t[4]=-a*m,t[8]=x+d*o,t[1]=d+x*o,t[5]=a*u,t[9]=y-h*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const h=a*u,d=a*m,x=o*u,y=o*m;t[0]=c*u,t[4]=x*l-d,t[8]=h*l+y,t[1]=c*m,t[5]=y*l+h,t[9]=d*l-x,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const h=a*c,d=a*l,x=o*c,y=o*l;t[0]=c*u,t[4]=y-h*m,t[8]=x*m+d,t[1]=m,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=d*m+x,t[10]=h-y*m}else if(e.order==="XZY"){const h=a*c,d=a*l,x=o*c,y=o*l;t[0]=c*u,t[4]=-m,t[8]=l*u,t[1]=h*m+y,t[5]=a*u,t[9]=d*m-x,t[2]=x*m-d,t[6]=o*u,t[10]=y*m+h}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(ph,e,mh)}lookAt(e,t,n){const r=this.elements;return Ot.subVectors(e,t),Ot.lengthSq()===0&&(Ot.z=1),Ot.normalize(),Tn.crossVectors(n,Ot),Tn.lengthSq()===0&&(Math.abs(n.z)===1?Ot.x+=1e-4:Ot.z+=1e-4,Ot.normalize(),Tn.crossVectors(n,Ot)),Tn.normalize(),Qi.crossVectors(Ot,Tn),r[0]=Tn.x,r[4]=Qi.x,r[8]=Ot.x,r[1]=Tn.y,r[5]=Qi.y,r[9]=Ot.y,r[2]=Tn.z,r[6]=Qi.z,r[10]=Ot.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],u=n[1],m=n[5],h=n[9],d=n[13],x=n[2],y=n[6],g=n[10],f=n[14],w=n[3],C=n[7],M=n[11],R=n[15],E=r[0],P=r[4],_=r[8],b=r[12],U=r[1],I=r[5],B=r[9],J=r[13],ee=r[2],V=r[6],Z=r[10],W=r[14],ne=r[3],re=r[7],de=r[11],ge=r[15];return s[0]=a*E+o*U+c*ee+l*ne,s[4]=a*P+o*I+c*V+l*re,s[8]=a*_+o*B+c*Z+l*de,s[12]=a*b+o*J+c*W+l*ge,s[1]=u*E+m*U+h*ee+d*ne,s[5]=u*P+m*I+h*V+d*re,s[9]=u*_+m*B+h*Z+d*de,s[13]=u*b+m*J+h*W+d*ge,s[2]=x*E+y*U+g*ee+f*ne,s[6]=x*P+y*I+g*V+f*re,s[10]=x*_+y*B+g*Z+f*de,s[14]=x*b+y*J+g*W+f*ge,s[3]=w*E+C*U+M*ee+R*ne,s[7]=w*P+C*I+M*V+R*re,s[11]=w*_+C*B+M*Z+R*de,s[15]=w*b+C*J+M*W+R*ge,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],c=e[9],l=e[13],u=e[2],m=e[6],h=e[10],d=e[14],x=e[3],y=e[7],g=e[11],f=e[15],w=c*d-l*h,C=o*d-l*m,M=o*h-c*m,R=a*d-l*u,E=a*h-c*u,P=a*m-o*u;return t*(y*w-g*C+f*M)-n*(x*w-g*R+f*E)+r*(x*C-y*R+f*P)-s*(x*M-y*E+g*P)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],c=e[2],l=e[6],u=e[10];return t*(a*u-o*l)-n*(s*u-o*c)+r*(s*l-a*c)}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],c=e[6],l=e[7],u=e[8],m=e[9],h=e[10],d=e[11],x=e[12],y=e[13],g=e[14],f=e[15],w=t*o-n*a,C=t*c-r*a,M=t*l-s*a,R=n*c-r*o,E=n*l-s*o,P=r*l-s*c,_=u*y-m*x,b=u*g-h*x,U=u*f-d*x,I=m*g-h*y,B=m*f-d*y,J=h*f-d*g,ee=w*J-C*B+M*I+R*U-E*b+P*_;if(ee===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const V=1/ee;return e[0]=(o*J-c*B+l*I)*V,e[1]=(r*B-n*J-s*I)*V,e[2]=(y*P-g*E+f*R)*V,e[3]=(h*E-m*P-d*R)*V,e[4]=(c*U-a*J-l*b)*V,e[5]=(t*J-r*U+s*b)*V,e[6]=(g*M-x*P-f*C)*V,e[7]=(u*P-h*M+d*C)*V,e[8]=(a*B-o*U+l*_)*V,e[9]=(n*U-t*B-s*_)*V,e[10]=(x*E-y*M+f*w)*V,e[11]=(m*M-u*E-d*w)*V,e[12]=(o*b-a*I-c*_)*V,e[13]=(t*I-n*b+r*_)*V,e[14]=(y*C-x*R-g*w)*V,e[15]=(u*R-m*C+h*w)*V,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,c=e.z,l=s*a,u=s*o;return this.set(l*a+n,l*o-r*c,l*c+r*o,0,l*o+r*c,u*o+n,u*c-r*a,0,l*c-r*o,u*c+r*a,s*c*c+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,c=t._w,l=s+s,u=a+a,m=o+o,h=s*l,d=s*u,x=s*m,y=a*u,g=a*m,f=o*m,w=c*l,C=c*u,M=c*m,R=n.x,E=n.y,P=n.z;return r[0]=(1-(y+f))*R,r[1]=(d+M)*R,r[2]=(x-C)*R,r[3]=0,r[4]=(d-M)*E,r[5]=(1-(h+f))*E,r[6]=(g+w)*E,r[7]=0,r[8]=(x+C)*P,r[9]=(g-w)*P,r[10]=(1-(h+y))*P,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;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let a=ri.set(r[0],r[1],r[2]).length();const o=ri.set(r[4],r[5],r[6]).length(),c=ri.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Yt.copy(this);const l=1/a,u=1/o,m=1/c;return Yt.elements[0]*=l,Yt.elements[1]*=l,Yt.elements[2]*=l,Yt.elements[4]*=u,Yt.elements[5]*=u,Yt.elements[6]*=u,Yt.elements[8]*=m,Yt.elements[9]*=m,Yt.elements[10]*=m,t.setFromRotationMatrix(Yt),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,r,s,a,o=rn,c=!1){const l=this.elements,u=2*s/(t-e),m=2*s/(n-r),h=(t+e)/(t-e),d=(n+r)/(n-r);let x,y;if(c)x=s/(a-s),y=a*s/(a-s);else if(o===rn)x=-(a+s)/(a-s),y=-2*a*s/(a-s);else if(o===Fr)x=-a/(a-s),y=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=m,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=x,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=rn,c=!1){const l=this.elements,u=2/(t-e),m=2/(n-r),h=-(t+e)/(t-e),d=-(n+r)/(n-r);let x,y;if(c)x=1/(a-s),y=a/(a-s);else if(o===rn)x=-2/(a-s),y=-(a+s)/(a-s);else if(o===Fr)x=-1/(a-s),y=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=m,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=x,l[14]=y,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}};Hr.prototype.isMatrix4=!0;let at=Hr;const ri=new D,Yt=new at,ph=new D(0,0,0),mh=new D(1,1,1),Tn=new D,Qi=new D,Ot=new D,mo=new at,go=new zn;class Qn{constructor(e=0,t=0,n=0,r=Qn.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],c=r[1],l=r[5],u=r[9],m=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(Oe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Oe(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-m,s),this._z=0);break;case"ZXY":this._x=Math.asin(Oe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-m,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Oe(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Oe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-m,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Oe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:we("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return mo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mo,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return go.setFromEuler(this),this.setFromQuaternion(go,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}}Qn.DEFAULT_ORDER="XYZ";class Ga{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 gh=0;const _o=new D,si=new zn,cn=new at,ji=new D,Li=new D,_h=new D,xh=new zn,xo=new D(1,0,0),vo=new D(0,1,0),Mo=new D(0,0,1),So={type:"added"},vh={type:"removed"},ai={type:"childadded",child:null},ls={type:"childremoved",child:null};class Dt extends Gn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gh++}),this.uuid=On(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Dt.DEFAULT_UP.clone();const e=new D,t=new Qn,n=new zn,r=new D(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 at},normalMatrix:{value:new Le}}),this.matrix=new at,this.matrixWorld=new at,this.matrixAutoUpdate=Dt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ga,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.static=!1,this.userData={},this.pivot=null}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 si.setFromAxisAngle(e,t),this.quaternion.multiply(si),this}rotateOnWorldAxis(e,t){return si.setFromAxisAngle(e,t),this.quaternion.premultiply(si),this}rotateX(e){return this.rotateOnAxis(xo,e)}rotateY(e){return this.rotateOnAxis(vo,e)}rotateZ(e){return this.rotateOnAxis(Mo,e)}translateOnAxis(e,t){return _o.copy(e).applyQuaternion(this.quaternion),this.position.add(_o.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(xo,e)}translateY(e){return this.translateOnAxis(vo,e)}translateZ(e){return this.translateOnAxis(Mo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(cn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ji.copy(e):ji.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Li.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?cn.lookAt(Li,ji,this.up):cn.lookAt(ji,Li,this.up),this.quaternion.setFromRotationMatrix(cn),r&&(cn.extractRotation(r.matrixWorld),si.setFromRotationMatrix(cn),this.quaternion.premultiply(si.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(So),ai.child=e,this.dispatchEvent(ai),ai.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(vh),ls.child=e,this.dispatchEvent(ls),ls.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),cn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),cn.multiply(e.parent.matrixWorld)),e.applyMatrix4(cn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(So),ai.child=e,this.dispatchEvent(ai),ai.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(Li,e,_h),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Li,xh,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);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}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,n=!1){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}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),this.static!==!1&&(r.static=this.static),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.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),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,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.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 c=o.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){const m=c[l];s(e.shapes,m)}else s(e.shapes,c)}}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 c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));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 c=this.animations[o];r.animations.push(s(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),u=a(e.images),m=a(e.shapes),h=a(e.skeletons),d=a(e.animations),x=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),m.length>0&&(n.shapes=m),h.length>0&&(n.skeletons=h),d.length>0&&(n.animations=d),x.length>0&&(n.nodes=x)}return n.object=r,n;function a(o){const c=[];for(const l in o){const u=o[l];delete u.metadata,c.push(u)}return c}}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.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,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}}Dt.DEFAULT_UP=new D(0,1,0);Dt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Un extends Dt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Mh={type:"move"};class cs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Un,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 Un,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Un,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D,this._grip.eventsEnabled=!1),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,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const y of e.hand.values()){const g=t.getJointPose(y,n),f=this._getHandJoint(l,y);g!==null&&(f.matrix.fromArray(g.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=g.radius),f.visible=g!==null}const u=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],h=u.position.distanceTo(m.position),d=.02,x=.005;l.inputState.pinching&&h>d+x?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&h<=d-x&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));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(Mh)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Un;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Nl={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},An={h:0,s:0,l:0},er={h:0,s:0,l:0};function hs(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 Be{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=It){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ve.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Ve.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ve.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Ve.workingColorSpace){if(e=ah(e,1),t=Oe(t,0,1),n=Oe(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=hs(a,s,e+1/3),this.g=hs(a,s,e),this.b=hs(a,s,e-1/3)}return Ve.colorSpaceToWorking(this,r),this}setStyle(e,t=It){function n(s){s!==void 0&&parseFloat(s)<1&&we("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:we("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);we("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=It){const n=Nl[e.toLowerCase()];return n!==void 0?this.setHex(n,t):we("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=_n(e.r),this.g=_n(e.g),this.b=_n(e.b),this}copyLinearToSRGB(e){return this.r=Ei(e.r),this.g=Ei(e.g),this.b=Ei(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=It){return Ve.workingToColorSpace(Tt.copy(this),e),Math.round(Oe(Tt.r*255,0,255))*65536+Math.round(Oe(Tt.g*255,0,255))*256+Math.round(Oe(Tt.b*255,0,255))}getHexString(e=It){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ve.workingColorSpace){Ve.workingToColorSpace(Tt.copy(this),t);const n=Tt.r,r=Tt.g,s=Tt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let c,l;const u=(o+a)/2;if(o===a)c=0,l=0;else{const m=a-o;switch(l=u<=.5?m/(a+o):m/(2-a-o),a){case n:c=(r-s)/m+(r<s?6:0);break;case r:c=(s-n)/m+2;break;case s:c=(n-r)/m+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,t=Ve.workingColorSpace){return Ve.workingToColorSpace(Tt.copy(this),t),e.r=Tt.r,e.g=Tt.g,e.b=Tt.b,e}getStyle(e=It){Ve.workingToColorSpace(Tt.copy(this),e);const t=Tt.r,n=Tt.g,r=Tt.b;return e!==It?`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(An),this.setHSL(An.h+e,An.s+t,An.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(An),e.getHSL(er);const n=is(An.h,er.h,t),r=is(An.s,er.s,t),s=is(An.l,er.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 Tt=new Be;Be.NAMES=Nl;class Va{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Be(e),this.density=t}clone(){return new Va(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Sh extends Dt{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 Qn,this.environmentIntensity=1,this.environmentRotation=new Qn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const qt=new D,hn=new D,us=new D,un=new D,oi=new D,li=new D,yo=new D,fs=new D,ds=new D,ps=new D,ms=new ht,gs=new ht,_s=new ht;class Wt{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),qt.subVectors(e,t),r.cross(qt);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){qt.subVectors(r,t),hn.subVectors(n,t),us.subVectors(e,t);const a=qt.dot(qt),o=qt.dot(hn),c=qt.dot(us),l=hn.dot(hn),u=hn.dot(us),m=a*l-o*o;if(m===0)return s.set(0,0,0),null;const h=1/m,d=(l*c-o*u)*h,x=(a*u-o*c)*h;return s.set(1-d-x,x,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,un)===null?!1:un.x>=0&&un.y>=0&&un.x+un.y<=1}static getInterpolation(e,t,n,r,s,a,o,c){return this.getBarycoord(e,t,n,r,un)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,un.x),c.addScaledVector(a,un.y),c.addScaledVector(o,un.z),c)}static getInterpolatedAttribute(e,t,n,r,s,a){return ms.setScalar(0),gs.setScalar(0),_s.setScalar(0),ms.fromBufferAttribute(e,t),gs.fromBufferAttribute(e,n),_s.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(ms,s.x),a.addScaledVector(gs,s.y),a.addScaledVector(_s,s.z),a}static isFrontFacing(e,t,n,r){return qt.subVectors(n,t),hn.subVectors(e,t),qt.cross(hn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return qt.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),qt.cross(hn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Wt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Wt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Wt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wt.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;oi.subVectors(r,n),li.subVectors(s,n),fs.subVectors(e,n);const c=oi.dot(fs),l=li.dot(fs);if(c<=0&&l<=0)return t.copy(n);ds.subVectors(e,r);const u=oi.dot(ds),m=li.dot(ds);if(u>=0&&m<=u)return t.copy(r);const h=c*m-u*l;if(h<=0&&c>=0&&u<=0)return a=c/(c-u),t.copy(n).addScaledVector(oi,a);ps.subVectors(e,s);const d=oi.dot(ps),x=li.dot(ps);if(x>=0&&d<=x)return t.copy(s);const y=d*l-c*x;if(y<=0&&l>=0&&x<=0)return o=l/(l-x),t.copy(n).addScaledVector(li,o);const g=u*x-d*m;if(g<=0&&m-u>=0&&d-x>=0)return yo.subVectors(s,r),o=(m-u)/(m-u+(d-x)),t.copy(r).addScaledVector(yo,o);const f=1/(g+y+h);return a=y*f,o=h*f,t.copy(n).addScaledVector(oi,a).addScaledVector(li,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Yi{constructor(e=new D(1/0,1/0,1/0),t=new D(-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(Kt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Kt.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=Kt.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,Kt):Kt.fromBufferAttribute(s,a),Kt.applyMatrix4(e.matrixWorld),this.expandByPoint(Kt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),tr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),tr.copy(n.boundingBox)),tr.applyMatrix4(e.matrixWorld),this.union(tr)}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,Kt),Kt.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(Ii),nr.subVectors(this.max,Ii),ci.subVectors(e.a,Ii),hi.subVectors(e.b,Ii),ui.subVectors(e.c,Ii),Rn.subVectors(hi,ci),wn.subVectors(ui,hi),Hn.subVectors(ci,ui);let t=[0,-Rn.z,Rn.y,0,-wn.z,wn.y,0,-Hn.z,Hn.y,Rn.z,0,-Rn.x,wn.z,0,-wn.x,Hn.z,0,-Hn.x,-Rn.y,Rn.x,0,-wn.y,wn.x,0,-Hn.y,Hn.x,0];return!xs(t,ci,hi,ui,nr)||(t=[1,0,0,0,1,0,0,0,1],!xs(t,ci,hi,ui,nr))?!1:(ir.crossVectors(Rn,wn),t=[ir.x,ir.y,ir.z],xs(t,ci,hi,ui,nr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Kt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kt).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:(fn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fn),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 fn=[new D,new D,new D,new D,new D,new D,new D,new D],Kt=new D,tr=new Yi,ci=new D,hi=new D,ui=new D,Rn=new D,wn=new D,Hn=new D,Ii=new D,nr=new D,ir=new D,kn=new D;function xs(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){kn.fromArray(i,s);const o=r.x*Math.abs(kn.x)+r.y*Math.abs(kn.y)+r.z*Math.abs(kn.z),c=e.dot(kn),l=t.dot(kn),u=n.dot(kn);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>o)return!1}return!0}const gt=new D,rr=new Ce;let yh=0;class $t extends Gn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:yh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ba,this.updateRanges=[],this.gpuType=nn,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++)rr.fromBufferAttribute(this,t),rr.applyMatrix3(e),this.setXY(t,rr.x,rr.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=tn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Qe(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=tn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Qe(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=tn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Qe(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=tn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Qe(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=tn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Qe(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Qe(t,this.array),n=Qe(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=Qe(t,this.array),n=Qe(n,this.array),r=Qe(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=Qe(t,this.array),n=Qe(n,this.array),r=Qe(r,this.array),s=Qe(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!==ba&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Fl extends $t{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ol extends $t{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class zt extends $t{constructor(e,t,n){super(new Float32Array(e),t,n)}}const Eh=new Yi,Ui=new D,vs=new D;class Wr{constructor(e=new D,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):Eh.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;Ui.subVectors(e,this.center);const t=Ui.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Ui,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):(vs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ui.copy(e.center).add(vs)),this.expandByPoint(Ui.copy(e.center).sub(vs))),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}}let bh=0;const Vt=new at,Ms=new Dt,fi=new D,Bt=new Yi,Ni=new Yi,Mt=new D;class Xt extends Gn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:bh++}),this.uuid=On(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(nh(e)?Ol:Fl)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,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 Le().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._transformed=!0,this}applyQuaternion(e){return Vt.makeRotationFromQuaternion(e),this.applyMatrix4(Vt),this}rotateX(e){return Vt.makeRotationX(e),this.applyMatrix4(Vt),this}rotateY(e){return Vt.makeRotationY(e),this.applyMatrix4(Vt),this}rotateZ(e){return Vt.makeRotationZ(e),this.applyMatrix4(Vt),this}translate(e,t,n){return Vt.makeTranslation(e,t,n),this.applyMatrix4(Vt),this}scale(e,t,n){return Vt.makeScale(e,t,n),this.applyMatrix4(Vt),this}lookAt(e){return Ms.lookAt(e),Ms.updateMatrix(),this.applyMatrix4(Ms.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(fi).negate(),this.translate(fi.x,fi.y,fi.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 zt(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&&we("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 Yi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Bt.setFromBufferAttribute(s),this.morphTargetsRelative?(Mt.addVectors(this.boundingBox.min,Bt.min),this.boundingBox.expandByPoint(Mt),Mt.addVectors(this.boundingBox.max,Bt.max),this.boundingBox.expandByPoint(Mt)):(this.boundingBox.expandByPoint(Bt.min),this.boundingBox.expandByPoint(Bt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('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 Wr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){const n=this.boundingSphere.center;if(Bt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ni.setFromBufferAttribute(o),this.morphTargetsRelative?(Mt.addVectors(Bt.min,Ni.min),Bt.expandByPoint(Mt),Mt.addVectors(Bt.max,Ni.max),Bt.expandByPoint(Mt)):(Bt.expandByPoint(Ni.min),Bt.expandByPoint(Ni.max))}Bt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Mt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Mt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],c=this.morphTargetsRelative;for(let l=0,u=o.count;l<u;l++)Mt.fromBufferAttribute(o,l),c&&(fi.fromBufferAttribute(e,l),Mt.add(fi)),r=Math.max(r,n.distanceToSquared(Mt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('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){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new $t(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));const o=[],c=[];for(let _=0;_<n.count;_++)o[_]=new D,c[_]=new D;const l=new D,u=new D,m=new D,h=new Ce,d=new Ce,x=new Ce,y=new D,g=new D;function f(_,b,U){l.fromBufferAttribute(n,_),u.fromBufferAttribute(n,b),m.fromBufferAttribute(n,U),h.fromBufferAttribute(s,_),d.fromBufferAttribute(s,b),x.fromBufferAttribute(s,U),u.sub(l),m.sub(l),d.sub(h),x.sub(h);const I=1/(d.x*x.y-x.x*d.y);isFinite(I)&&(y.copy(u).multiplyScalar(x.y).addScaledVector(m,-d.y).multiplyScalar(I),g.copy(m).multiplyScalar(d.x).addScaledVector(u,-x.x).multiplyScalar(I),o[_].add(y),o[b].add(y),o[U].add(y),c[_].add(g),c[b].add(g),c[U].add(g))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let _=0,b=w.length;_<b;++_){const U=w[_],I=U.start,B=U.count;for(let J=I,ee=I+B;J<ee;J+=3)f(e.getX(J+0),e.getX(J+1),e.getX(J+2))}const C=new D,M=new D,R=new D,E=new D;function P(_){R.fromBufferAttribute(r,_),E.copy(R);const b=o[_];C.copy(b),C.sub(R.multiplyScalar(R.dot(b))).normalize(),M.crossVectors(E,b);const I=M.dot(c[_])<0?-1:1;a.setXYZW(_,C.x,C.y,C.z,I)}for(let _=0,b=w.length;_<b;++_){const U=w[_],I=U.start,B=U.count;for(let J=I,ee=I+B;J<ee;J+=3)P(e.getX(J+0)),P(e.getX(J+1)),P(e.getX(J+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new $t(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,d=n.count;h<d;h++)n.setXYZ(h,0,0,0);const r=new D,s=new D,a=new D,o=new D,c=new D,l=new D,u=new D,m=new D;if(e)for(let h=0,d=e.count;h<d;h+=3){const x=e.getX(h+0),y=e.getX(h+1),g=e.getX(h+2);r.fromBufferAttribute(t,x),s.fromBufferAttribute(t,y),a.fromBufferAttribute(t,g),u.subVectors(a,s),m.subVectors(r,s),u.cross(m),o.fromBufferAttribute(n,x),c.fromBufferAttribute(n,y),l.fromBufferAttribute(n,g),o.add(u),c.add(u),l.add(u),n.setXYZ(x,o.x,o.y,o.z),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(g,l.x,l.y,l.z)}else for(let h=0,d=t.count;h<d;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),u.subVectors(a,s),m.subVectors(r,s),u.cross(m),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+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++)Mt.fromBufferAttribute(e,t),Mt.normalize(),e.setXYZ(t,Mt.x,Mt.y,Mt.z)}toNonIndexed(){function e(o,c){const l=o.array,u=o.itemSize,m=o.normalized,h=new l.constructor(c.length*u);let d=0,x=0;for(let y=0,g=c.length;y<g;y++){o.isInterleavedBufferAttribute?d=c[y]*o.data.stride+o.offset:d=c[y]*u;for(let f=0;f<u;f++)h[x++]=l[d++]}return new $t(h,u,m)}if(this.index===null)return we("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Xt,n=this.index.array,r=this.attributes;for(const o in r){const c=r[o],l=e(c,n);t.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let u=0,m=l.length;u<m;u++){const h=l[u],d=e(h,n);c.push(d)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);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 c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let m=0,h=l.length;m<h;m++){const d=l[m];u.push(d.toJSON(e.data))}u.length>0&&(r[c]=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 l in r){const u=r[l];this.setAttribute(l,u.clone(t))}const s=e.morphAttributes;for(const l in s){const u=[],m=s[l];for(let h=0,d=m.length;h<d;h++)u.push(m[h].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,u=a.length;l<u;l++){const m=a[l];this.addGroup(m.start,m.count,m.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Th{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ba,this.updateRanges=[],this.version=0,this.uuid=On()}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=On()),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=On()),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 Ct=new D;class zr{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++)Ct.fromBufferAttribute(this,t),Ct.applyMatrix4(e),this.setXYZ(t,Ct.x,Ct.y,Ct.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ct.fromBufferAttribute(this,t),Ct.applyNormalMatrix(e),this.setXYZ(t,Ct.x,Ct.y,Ct.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ct.fromBufferAttribute(this,t),Ct.transformDirection(e),this.setXYZ(t,Ct.x,Ct.y,Ct.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=tn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Qe(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Qe(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Qe(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Qe(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Qe(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=tn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=tn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=tn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=tn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Qe(t,this.array),n=Qe(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=Qe(t,this.array),n=Qe(n,this.array),r=Qe(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=Qe(t,this.array),n=Qe(n,this.array),r=Qe(r,this.array),s=Qe(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){Br("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 $t(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 zr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Br("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}}}let Ah=0;class Ci extends Gn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ah++}),this.uuid=On(),this.name="",this.type="Material",this.blending=Fn,this.side=Bn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Os,this.blendDst=Bs,this.blendEquation=Yn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Be(0,0,0),this.blendAlpha=0,this.depthFunc=Ti,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=lo,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ni,this.stencilZFail=ni,this.stencilZPass=ni,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){we(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){we(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||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.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),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!==Fn&&(n.blending=this.blending),this.side!==Bn&&(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!==Os&&(n.blendSrc=this.blendSrc),this.blendDst!==Bs&&(n.blendDst=this.blendDst),this.blendEquation!==Yn&&(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!==Ti&&(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!==lo&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ni&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ni&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ni&&(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.allowOverride===!1&&(n.allowOverride=!1),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 c=s[o];delete c.metadata,a.push(c)}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}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Be().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Ce().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Ce().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}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.allowOverride=e.allowOverride,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 Bl extends Ci{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Be(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 di;const Fi=new D,pi=new D,mi=new D,gi=new Ce,Oi=new Ce,zl=new at,sr=new D,Bi=new D,ar=new D,Eo=new Ce,Ss=new Ce,bo=new Ce;class Rh extends Dt{constructor(e=new Bl){if(super(),this.isSprite=!0,this.type="Sprite",di===void 0){di=new Xt;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 Th(t,5);di.setIndex([0,1,2,0,2,3]),di.setAttribute("position",new zr(n,3,0,!1)),di.setAttribute("uv",new zr(n,2,3,!1))}this.geometry=di,this.material=e,this.center=new Ce(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),pi.setFromMatrixScale(this.matrixWorld),zl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),mi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&pi.multiplyScalar(-mi.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;or(sr.set(-.5,-.5,0),mi,a,pi,r,s),or(Bi.set(.5,-.5,0),mi,a,pi,r,s),or(ar.set(.5,.5,0),mi,a,pi,r,s),Eo.set(0,0),Ss.set(1,0),bo.set(1,1);let o=e.ray.intersectTriangle(sr,Bi,ar,!1,Fi);if(o===null&&(or(Bi.set(-.5,.5,0),mi,a,pi,r,s),Ss.set(0,1),o=e.ray.intersectTriangle(sr,ar,Bi,!1,Fi),o===null))return;const c=e.ray.origin.distanceTo(Fi);c<e.near||c>e.far||t.push({distance:c,point:Fi.clone(),uv:Wt.getInterpolation(Fi,sr,Bi,ar,Eo,Ss,bo,new Ce),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 or(i,e,t,n,r,s){gi.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(Oi.x=s*gi.x-r*gi.y,Oi.y=r*gi.x+s*gi.y):Oi.copy(gi),i.copy(e),i.x+=Oi.x,i.y+=Oi.y,i.applyMatrix4(zl)}const dn=new D,ys=new D,lr=new D,Cn=new D,Es=new D,cr=new D,bs=new D;class Xr{constructor(e=new D,t=new D(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,dn)),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=dn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(dn.copy(this.origin).addScaledVector(this.direction,t),dn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ys.copy(e).add(t).multiplyScalar(.5),lr.copy(t).sub(e).normalize(),Cn.copy(this.origin).sub(ys);const s=e.distanceTo(t)*.5,a=-this.direction.dot(lr),o=Cn.dot(this.direction),c=-Cn.dot(lr),l=Cn.lengthSq(),u=Math.abs(1-a*a);let m,h,d,x;if(u>0)if(m=a*c-o,h=a*o-c,x=s*u,m>=0)if(h>=-x)if(h<=x){const y=1/u;m*=y,h*=y,d=m*(m+a*h+2*o)+h*(a*m+h+2*c)+l}else h=s,m=Math.max(0,-(a*h+o)),d=-m*m+h*(h+2*c)+l;else h=-s,m=Math.max(0,-(a*h+o)),d=-m*m+h*(h+2*c)+l;else h<=-x?(m=Math.max(0,-(-a*s+o)),h=m>0?-s:Math.min(Math.max(-s,-c),s),d=-m*m+h*(h+2*c)+l):h<=x?(m=0,h=Math.min(Math.max(-s,-c),s),d=h*(h+2*c)+l):(m=Math.max(0,-(a*s+o)),h=m>0?s:Math.min(Math.max(-s,-c),s),d=-m*m+h*(h+2*c)+l);else h=a>0?-s:s,m=Math.max(0,-(a*h+o)),d=-m*m+h*(h+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,m),r&&r.copy(ys).addScaledVector(lr,h),d}intersectSphere(e,t){dn.subVectors(e.center,this.origin);const n=dn.dot(this.direction),r=dn.dot(dn)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,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,c;const l=1/this.direction.x,u=1/this.direction.y,m=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(s=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),m>=0?(o=(e.min.z-h.z)*m,c=(e.max.z-h.z)*m):(o=(e.max.z-h.z)*m,c=(e.min.z-h.z)*m),n>c||o>r)||((o>n||n!==n)&&(n=o),(c<r||r!==r)&&(r=c),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,dn)!==null}intersectTriangle(e,t,n,r,s){Es.subVectors(t,e),cr.subVectors(n,e),bs.crossVectors(Es,cr);let a=this.direction.dot(bs),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Cn.subVectors(this.origin,e);const c=o*this.direction.dot(cr.crossVectors(Cn,cr));if(c<0)return null;const l=o*this.direction.dot(Es.cross(Cn));if(l<0||c+l>a)return null;const u=-o*Cn.dot(bs);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 Gl extends Ci{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Be(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 Qn,this.combine=_l,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 To=new at,Wn=new Xr,hr=new Wr,Ao=new D,ur=new D,fr=new D,dr=new D,Ts=new D,pr=new D,Ro=new D,mr=new D;class Mn extends Dt{constructor(e=new Xt,t=new Gl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){pr.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const u=o[c],m=s[c];u!==0&&(Ts.fromBufferAttribute(m,e),a?pr.addScaledVector(Ts,u):pr.addScaledVector(Ts.sub(t),u))}t.add(pr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),hr.copy(n.boundingSphere),hr.applyMatrix4(s),Wn.copy(e.ray).recast(e.near),!(hr.containsPoint(Wn.origin)===!1&&(Wn.intersectSphere(hr,Ao)===null||Wn.origin.distanceToSquared(Ao)>(e.far-e.near)**2))&&(To.copy(s).invert(),Wn.copy(e.ray).applyMatrix4(To),!(n.boundingBox!==null&&Wn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Wn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,m=s.attributes.normal,h=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,y=h.length;x<y;x++){const g=h[x],f=a[g.materialIndex],w=Math.max(g.start,d.start),C=Math.min(o.count,Math.min(g.start+g.count,d.start+d.count));for(let M=w,R=C;M<R;M+=3){const E=o.getX(M),P=o.getX(M+1),_=o.getX(M+2);r=gr(this,f,e,n,l,u,m,E,P,_),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const x=Math.max(0,d.start),y=Math.min(o.count,d.start+d.count);for(let g=x,f=y;g<f;g+=3){const w=o.getX(g),C=o.getX(g+1),M=o.getX(g+2);r=gr(this,a,e,n,l,u,m,w,C,M),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(a))for(let x=0,y=h.length;x<y;x++){const g=h[x],f=a[g.materialIndex],w=Math.max(g.start,d.start),C=Math.min(c.count,Math.min(g.start+g.count,d.start+d.count));for(let M=w,R=C;M<R;M+=3){const E=M,P=M+1,_=M+2;r=gr(this,f,e,n,l,u,m,E,P,_),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const x=Math.max(0,d.start),y=Math.min(c.count,d.start+d.count);for(let g=x,f=y;g<f;g+=3){const w=g,C=g+1,M=g+2;r=gr(this,a,e,n,l,u,m,w,C,M),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function wh(i,e,t,n,r,s,a,o){let c;if(e.side===Ut?c=n.intersectTriangle(a,s,r,!0,o):c=n.intersectTriangle(r,s,a,e.side===Bn,o),c===null)return null;mr.copy(o),mr.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(mr);return l<t.near||l>t.far?null:{distance:l,point:mr.clone(),object:i}}function gr(i,e,t,n,r,s,a,o,c,l){i.getVertexPosition(o,ur),i.getVertexPosition(c,fr),i.getVertexPosition(l,dr);const u=wh(i,e,t,n,ur,fr,dr,Ro);if(u){const m=new D;Wt.getBarycoord(Ro,ur,fr,dr,m),r&&(u.uv=Wt.getInterpolatedAttribute(r,o,c,l,m,new Ce)),s&&(u.uv1=Wt.getInterpolatedAttribute(s,o,c,l,m,new Ce)),a&&(u.normal=Wt.getInterpolatedAttribute(a,o,c,l,m,new D),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:c,c:l,normal:new D,materialIndex:0};Wt.getNormal(ur,fr,dr,h.normal),u.face=h,u.barycoord=m}return u}class Ch extends Rt{constructor(e=null,t=1,n=1,r,s,a,o,c,l=yt,u=yt,m,h){super(null,a,o,c,l,u,r,s,m,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const As=new D,Ph=new D,Dh=new Le;class Dn{constructor(e=new D(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=As.subVectors(n,t).cross(Ph.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,n=!0){const r=e.delta(As),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}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||Dh.getNormalMatrix(e),r=this.coplanarPoint(As).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 Xn=new Wr,Lh=new Ce(.5,.5),_r=new D;class Vl{constructor(e=new Dn,t=new Dn,n=new Dn,r=new Dn,s=new Dn,a=new Dn){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=rn,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],c=s[2],l=s[3],u=s[4],m=s[5],h=s[6],d=s[7],x=s[8],y=s[9],g=s[10],f=s[11],w=s[12],C=s[13],M=s[14],R=s[15];if(r[0].setComponents(l-a,d-u,f-x,R-w).normalize(),r[1].setComponents(l+a,d+u,f+x,R+w).normalize(),r[2].setComponents(l+o,d+m,f+y,R+C).normalize(),r[3].setComponents(l-o,d-m,f-y,R-C).normalize(),n)r[4].setComponents(c,h,g,M).normalize(),r[5].setComponents(l-c,d-h,f-g,R-M).normalize();else if(r[4].setComponents(l-c,d-h,f-g,R-M).normalize(),t===rn)r[5].setComponents(l+c,d+h,f+g,R+M).normalize();else if(t===Fr)r[5].setComponents(c,h,g,M).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(),Xn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Xn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Xn)}intersectsSprite(e){Xn.center.set(0,0,0);const t=Lh.distanceTo(e.center);return Xn.radius=.7071067811865476+t,Xn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xn)}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(_r.x=r.normal.x>0?e.max.x:e.min.x,_r.y=r.normal.y>0?e.max.y:e.min.y,_r.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_r)<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 Hl extends Ci{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Be(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Gr=new D,Vr=new D,wo=new at,zi=new Xr,xr=new Wr,Rs=new D,Co=new D;class Ih extends Dt{constructor(e=new Xt,t=new Hl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Gr.fromBufferAttribute(t,r-1),Vr.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Gr.distanceTo(Vr);e.setAttribute("lineDistance",new zt(n,1))}else we("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),xr.copy(n.boundingSphere),xr.applyMatrix4(r),xr.radius+=s,e.ray.intersectsSphere(xr)===!1)return;wo.copy(r).invert(),zi.copy(e.ray).applyMatrix4(wo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,u=n.index,h=n.attributes.position;if(u!==null){const d=Math.max(0,a.start),x=Math.min(u.count,a.start+a.count);for(let y=d,g=x-1;y<g;y+=l){const f=u.getX(y),w=u.getX(y+1),C=vr(this,e,zi,c,f,w,y);C&&t.push(C)}if(this.isLineLoop){const y=u.getX(x-1),g=u.getX(d),f=vr(this,e,zi,c,y,g,x-1);f&&t.push(f)}}else{const d=Math.max(0,a.start),x=Math.min(h.count,a.start+a.count);for(let y=d,g=x-1;y<g;y+=l){const f=vr(this,e,zi,c,y,y+1,y);f&&t.push(f)}if(this.isLineLoop){const y=vr(this,e,zi,c,x-1,d,x-1);y&&t.push(y)}}}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 vr(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(Gr.fromBufferAttribute(o,r),Vr.fromBufferAttribute(o,s),t.distanceSqToSegment(Gr,Vr,Rs,Co)>n)return;Rs.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Rs);if(!(l<e.near||l>e.far))return{distance:l,point:Co.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const Po=new D,Do=new D;class Uh extends Ih{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)Po.fromBufferAttribute(t,r),Do.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Po.distanceTo(Do);e.setAttribute("lineDistance",new zt(n,1))}else we("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class kl extends Rt{constructor(e=[],t=$n,n,r,s,a,o,c,l,u){super(e,t,n,r,s,a,o,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Nh extends Rt{constructor(e,t,n,r,s,a,o,c,l){super(e,t,n,r,s,a,o,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ri extends Rt{constructor(e,t,n=on,r,s,a,o=yt,c=yt,l,u=vn,m=1){if(u!==vn&&u!==Zn)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:m};super(h,r,s,a,o,c,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new za(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 Fh extends Ri{constructor(e,t=on,n=$n,r,s,a=yt,o=yt,c,l=vn){const u={width:e,height:e,depth:1},m=[u,u,u,u,u,u];super(e,e,t,n,r,s,a,o,c,l),this.image=m,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Wl extends Rt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class qi extends Xt{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 c=[],l=[],u=[],m=[];let h=0,d=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1),x("x","z","y",1,1,e,n,t,r,a,2),x("x","z","y",1,-1,e,n,-t,r,a,3),x("x","y","z",1,-1,e,t,n,r,s,4),x("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(c),this.setAttribute("position",new zt(l,3)),this.setAttribute("normal",new zt(u,3)),this.setAttribute("uv",new zt(m,2));function x(y,g,f,w,C,M,R,E,P,_,b){const U=M/P,I=R/_,B=M/2,J=R/2,ee=E/2,V=P+1,Z=_+1;let W=0,ne=0;const re=new D;for(let de=0;de<Z;de++){const ge=de*I-J;for(let ye=0;ye<V;ye++){const He=ye*U-B;re[y]=He*w,re[g]=ge*C,re[f]=ee,l.push(re.x,re.y,re.z),re[y]=0,re[g]=0,re[f]=E>0?1:-1,u.push(re.x,re.y,re.z),m.push(ye/P),m.push(1-de/_),W+=1}}for(let de=0;de<_;de++)for(let ge=0;ge<P;ge++){const ye=h+ge+V*de,He=h+ge+V*(de+1),it=h+(ge+1)+V*(de+1),ke=h+(ge+1)+V*de;c.push(ye,He,ke),c.push(He,it,ke),ne+=6}o.addGroup(d,ne,b),d+=ne,h+=W}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Oh{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){we("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,c=s-1,l;for(;o<=c;)if(r=Math.floor(o+(c-o)/2),l=n[r]-a,l<0)o=r+1;else if(l>0)c=r-1;else{c=r;break}if(r=c,n[r]===a)return r/(s-1);const u=n[r],h=n[r+1]-u,d=(a-u)/h;return(r+d)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),c=t||(a.isVector2?new Ce:new D);return c.copy(o).sub(a).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new D,r=[],s=[],a=[],o=new D,c=new at;for(let d=0;d<=e;d++){const x=d/e;r[d]=this.getTangentAt(x,new D)}s[0]=new D,a[0]=new D;let l=Number.MAX_VALUE;const u=Math.abs(r[0].x),m=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=l&&(l=u,n.set(1,0,0)),m<=l&&(l=m,n.set(0,1,0)),h<=l&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),a[d]=a[d-1].clone(),o.crossVectors(r[d-1],r[d]),o.length()>Number.EPSILON){o.normalize();const x=Math.acos(Oe(r[d-1].dot(r[d]),-1,1));s[d].applyMatrix4(c.makeRotationAxis(o,x))}a[d].crossVectors(r[d],s[d])}if(t===!0){let d=Math.acos(Oe(s[0].dot(s[e]),-1,1));d/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(d=-d);for(let x=1;x<=e;x++)s[x].applyMatrix4(c.makeRotationAxis(r[x],d*x)),a[x].crossVectors(r[x],s[x])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}function Bh(i,e){const t=1-i;return t*t*e}function zh(i,e){return 2*(1-i)*i*e}function Gh(i,e){return i*i*e}function ws(i,e,t,n){return Bh(i,e)+zh(i,t)+Gh(i,n)}class Vh extends Oh{constructor(e=new D,t=new D,n=new D){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new D){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(ws(e,r.x,s.x,a.x),ws(e,r.y,s.y,a.y),ws(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Yr extends Xt{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),c=Math.floor(r),l=o+1,u=c+1,m=e/o,h=t/c,d=[],x=[],y=[],g=[];for(let f=0;f<u;f++){const w=f*h-a;for(let C=0;C<l;C++){const M=C*m-s;x.push(M,-w,0),y.push(0,0,1),g.push(C/o),g.push(1-f/c)}}for(let f=0;f<c;f++)for(let w=0;w<o;w++){const C=w+l*f,M=w+l*(f+1),R=w+1+l*(f+1),E=w+1+l*f;d.push(C,M,E),d.push(M,R,E)}this.setIndex(d),this.setAttribute("position",new zt(x,3)),this.setAttribute("normal",new zt(y,3)),this.setAttribute("uv",new zt(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yr(e.width,e.height,e.widthSegments,e.heightSegments)}}function wi(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];if(Lo(r))r.isRenderTargetTexture?(we("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(Lo(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function Pt(i){const e={};for(let t=0;t<i.length;t++){const n=wi(i[t]);for(const r in n)e[r]=n[r]}return e}function Lo(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Hh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Xl(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ve.workingColorSpace}const kh={clone:wi,merge:Pt};var Wh=`void main() {
|
|
1
|
+
import{a as hc,J as Jr,B as uc,H as fc,i as $i,ac as dc,o as Qr,h as jr,l as pc,F as mc,q as _c,aY as gc,aj as xc,n as vc,v as Mc,r as no,ae as Sc}from"./index-DkWTvE7d.js";import{b as yc,a as ml}from"./relationship-galaxy-connections-Cg4G5yYE.js";import{n as _l}from"./relationship-galaxy-viewport-Cwfa51ER.js";import"./vendor-snapdom--nZvo8Sg.js";const Pa="185",Si={ROTATE:0,DOLLY:1,PAN:2},Mi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Ec=0,io=1,bc=2,Tr=1,Tc=2,Hi=3,On=0,Ut=1,pn=2,_n=0,Nn=1,ro=2,so=3,ao=4,Ac=5,Xn=100,Rc=101,wc=102,Cc=103,Pc=104,Dc=200,Lc=201,Ic=202,Uc=203,Os=204,Bs=205,Nc=206,Fc=207,Oc=208,Bc=209,zc=210,Gc=211,Vc=212,Hc=213,kc=214,zs=0,Gs=1,Vs=2,Ti=3,Hs=4,ks=5,Ws=6,Xs=7,gl=0,Wc=1,Xc=2,sn=0,xl=1,vl=2,Ml=3,Sl=4,yl=5,El=6,bl=7,Tl=300,$n=301,Ai=302,es=303,ts=304,kr=306,Ys=1e3,mn=1001,qs=1002,yt=1003,Yc=1004,Ji=1005,At=1006,ns=1007,qn=1008,kt=1009,Al=1010,Rl=1011,Wi=1012,Da=1013,on=1014,nn=1015,xn=1016,La=1017,Ia=1018,Xi=1020,wl=35902,Cl=35899,Pl=1021,Dl=1022,Zt=1023,vn=1026,Kn=1027,Ll=1028,Ua=1029,Jn=1030,Na=1031,Fa=1033,Ar=33776,Rr=33777,wr=33778,Cr=33779,Ks=35840,Zs=35841,$s=35842,Js=35843,Qs=36196,js=37492,ea=37496,ta=37488,na=37489,Lr=37490,ia=37491,ra=37808,sa=37809,aa=37810,oa=37811,la=37812,ca=37813,ha=37814,ua=37815,fa=37816,da=37817,pa=37818,ma=37819,_a=37820,ga=37821,xa=36492,va=36494,Ma=36495,Sa=36283,ya=36284,Ir=36285,Ea=36286,qc=3200,oo=0,Kc=1,Ln="",It="srgb",Ur="srgb-linear",Nr="linear",Ze="srgb",ni=7680,lo=519,Zc=512,$c=513,Jc=514,Oa=515,Qc=516,jc=517,Ba=518,eh=519,ba=35044,co="300 es",rn=2e3,Fr=2001;function th(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Or(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function nh(){const i=Or("canvas");return i.style.display="block",i}const ho={};function Br(...i){const e="THREE."+i.shift();console.log(e,...i)}function Il(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function we(...i){i=Il(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=Il(i);const e="THREE."+i.shift();{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function yi(...i){const e=i.join(" ");e in ho||(ho[e]=!0,we(...i))}function ih(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)})}const rh={[zs]:Gs,[Vs]:Ws,[Hs]:Xs,[Ti]:ks,[Gs]:zs,[Ws]:Vs,[Xs]:Hs,[ks]:Ti};class zn{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 bt=["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"],Pr=Math.PI/180,Ta=180/Math.PI;function Fn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(bt[i&255]+bt[i>>8&255]+bt[i>>16&255]+bt[i>>24&255]+"-"+bt[e&255]+bt[e>>8&255]+"-"+bt[e>>16&15|64]+bt[e>>24&255]+"-"+bt[t&63|128]+bt[t>>8&255]+"-"+bt[t>>16&255]+bt[t>>24&255]+bt[n&255]+bt[n>>8&255]+bt[n>>16&255]+bt[n>>24&255]).toLowerCase()}function Oe(i,e,t){return Math.max(e,Math.min(t,i))}function sh(i,e){return(i%e+e)%e}function is(i,e,t){return(1-t)*i+t*e}function tn(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("THREE.MathUtils: Invalid component type.")}}function Qe(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("THREE.MathUtils: Invalid component type.")}}const ah={DEG2RAD:Pr},ka=class ka{constructor(e=0,t=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("THREE.Vector2: 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("THREE.Vector2: 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=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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(Oe(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}};ka.prototype.isVector2=!0;let Ce=ka;class Bn{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 c=n[r+0],l=n[r+1],u=n[r+2],m=n[r+3],h=s[a+0],d=s[a+1],x=s[a+2],y=s[a+3];if(m!==y||c!==h||l!==d||u!==x){let _=c*h+l*d+u*x+m*y;_<0&&(h=-h,d=-d,x=-x,y=-y,_=-_);let f=1-o;if(_<.9995){const w=Math.acos(_),C=Math.sin(w);f=Math.sin(f*w)/C,o=Math.sin(o*w)/C,c=c*f+h*o,l=l*f+d*o,u=u*f+x*o,m=m*f+y*o}else{c=c*f+h*o,l=l*f+d*o,u=u*f+x*o,m=m*f+y*o;const w=1/Math.sqrt(c*c+l*l+u*u+m*m);c*=w,l*=w,u*=w,m*=w}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=m}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],c=n[r+1],l=n[r+2],u=n[r+3],m=s[a],h=s[a+1],d=s[a+2],x=s[a+3];return e[t]=o*x+u*m+c*d-l*h,e[t+1]=c*x+u*h+l*m-o*d,e[t+2]=l*x+u*d+o*h-c*m,e[t+3]=u*x-o*m-c*h-l*d,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,c=Math.sin,l=o(n/2),u=o(r/2),m=o(s/2),h=c(n/2),d=c(r/2),x=c(s/2);switch(a){case"XYZ":this._x=h*u*m+l*d*x,this._y=l*d*m-h*u*x,this._z=l*u*x+h*d*m,this._w=l*u*m-h*d*x;break;case"YXZ":this._x=h*u*m+l*d*x,this._y=l*d*m-h*u*x,this._z=l*u*x-h*d*m,this._w=l*u*m+h*d*x;break;case"ZXY":this._x=h*u*m-l*d*x,this._y=l*d*m+h*u*x,this._z=l*u*x+h*d*m,this._w=l*u*m-h*d*x;break;case"ZYX":this._x=h*u*m-l*d*x,this._y=l*d*m+h*u*x,this._z=l*u*x-h*d*m,this._w=l*u*m+h*d*x;break;case"YZX":this._x=h*u*m+l*d*x,this._y=l*d*m+h*u*x,this._z=l*u*x-h*d*m,this._w=l*u*m-h*d*x;break;case"XZY":this._x=h*u*m-l*d*x,this._y=l*d*m-h*u*x,this._z=l*u*x+h*d*m,this._w=l*u*m+h*d*x;break;default:we("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],c=t[9],l=t[2],u=t[6],m=t[10],h=n+o+m;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-c)*d,this._y=(s-l)*d,this._z=(a-r)*d}else if(n>o&&n>m){const d=2*Math.sqrt(1+n-o-m);this._w=(u-c)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+l)/d}else if(o>m){const d=2*Math.sqrt(1+o-n-m);this._w=(s-l)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(c+u)/d}else{const d=2*Math.sqrt(1+m-n-o);this._w=(a-r)/d,this._x=(s+l)/d,this._y=(c+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(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(Oe(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,c=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+r*l-s*c,this._y=r*u+a*c+s*o-n*l,this._z=s*u+a*l+n*c-r*o,this._w=a*u-n*o-r*c-s*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,s=-s,a=-a,o=-o);let c=1-t;if(o<.9995){const l=Math.acos(o),u=Math.sin(l);c=Math.sin(c*l)/u,t=Math.sin(t*l)/u,this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this.normalize();return 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}}const Wa=class Wa{constructor(e=0,t=0,n=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("THREE.Vector3: 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("THREE.Vector3: 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(uo.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(uo.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,c=e.w,l=2*(a*r-o*n),u=2*(o*t-s*r),m=2*(s*n-a*t);return this.x=t+c*l+a*m-o*u,this.y=n+c*u+o*l-s*m,this.z=r+c*m+s*u-a*l,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=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this.z=Oe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this.z=Oe(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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,c=t.z;return this.x=r*c-s*o,this.y=s*a-n*c,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 rs.copy(this).projectOnVector(e),this.sub(rs)}reflect(e){return this.sub(rs.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(Oe(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}};Wa.prototype.isVector3=!0;let D=Wa;const rs=new D,uo=new Bn,Xa=class Xa{constructor(e,t,n,r,s,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,c,l)}set(e,t,n,r,s,a,o,c,l){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=c,u[6]=n,u[7]=a,u[8]=l,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],c=n[6],l=n[1],u=n[4],m=n[7],h=n[2],d=n[5],x=n[8],y=r[0],_=r[3],f=r[6],w=r[1],C=r[4],M=r[7],R=r[2],E=r[5],P=r[8];return s[0]=a*y+o*w+c*R,s[3]=a*_+o*C+c*E,s[6]=a*f+o*M+c*P,s[1]=l*y+u*w+m*R,s[4]=l*_+u*C+m*E,s[7]=l*f+u*M+m*P,s[2]=h*y+d*w+x*R,s[5]=h*_+d*C+x*E,s[8]=h*f+d*M+x*P,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],c=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*s*u+n*o*c+r*s*l-r*a*c}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=e[8],m=u*a-o*l,h=o*c-u*s,d=l*s-a*c,x=t*m+n*h+r*d;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/x;return e[0]=m*y,e[1]=(r*l-u*n)*y,e[2]=(o*n-r*a)*y,e[3]=h*y,e[4]=(u*t-r*c)*y,e[5]=(r*s-o*t)*y,e[6]=d*y,e[7]=(n*c-l*t)*y,e[8]=(a*t-n*s)*y,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 c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-r*l,r*c,-r*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return yi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(ss.makeScale(e,t)),this}rotate(e){return yi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(ss.makeRotation(-e)),this}translate(e,t){return yi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(ss.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)}};Xa.prototype.isMatrix3=!0;let Le=Xa;const ss=new Le,fo=new Le().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),po=new Le().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function oh(){const i={enabled:!0,workingColorSpace:Ur,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Ze&&(r.r=gn(r.r),r.g=gn(r.g),r.b=gn(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===Ze&&(r.r=Ei(r.r),r.g=Ei(r.g),r.b=Ei(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===Ln?Nr:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},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 yi("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return yi("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({[Ur]:{primaries:e,whitePoint:n,transfer:Nr,toXYZ:fo,fromXYZ:po,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:It},outputColorSpaceConfig:{drawingBufferColorSpace:It}},[It]:{primaries:e,whitePoint:n,transfer:Ze,toXYZ:fo,fromXYZ:po,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:It}}}),i}const Ve=oh();function gn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Ei(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ii;class lh{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{ii===void 0&&(ii=Or("canvas")),ii.width=e.width,ii.height=e.height;const r=ii.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=ii}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=Or("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]=gn(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(gn(t[n]/255)*255):t[n]=gn(t[n]);return{data:t,width:e.width,height:e.height}}else return we("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let ch=0;class za{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ch++}),this.uuid=Fn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):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(as(r[a].image)):s.push(as(r[a]))}else s=as(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function as(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?lh.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(we("Texture: Unable to serialize Texture."),{})}let hh=0;const os=new D;class Rt extends zn{constructor(e=Rt.DEFAULT_IMAGE,t=Rt.DEFAULT_MAPPING,n=mn,r=mn,s=At,a=qn,o=Zt,c=kt,l=Rt.DEFAULT_ANISOTROPY,u=Ln){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:hh++}),this.uuid=Fn(),this.name="",this.source=new za(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Ce(0,0),this.repeat=new Ce(1,1),this.center=new Ce(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Le,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,this.normalized=!1}get width(){return this.source.getSize(os).x}get height(){return this.source.getSize(os).y}get depth(){return this.source.getSize(os).z}get image(){return this.source.data}set image(e){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.normalized=e.normalized,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){we(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){we(`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,normalized:this.normalized,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!==Tl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ys:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case qs: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 Ys:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case qs: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++}}Rt.DEFAULT_IMAGE=null;Rt.DEFAULT_MAPPING=Tl;Rt.DEFAULT_ANISOTROPY=1;const Ya=class Ya{constructor(e=0,t=0,n=0,r=1){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("THREE.Vector4: 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("THREE.Vector4: 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 c=e.elements,l=c[0],u=c[4],m=c[8],h=c[1],d=c[5],x=c[9],y=c[2],_=c[6],f=c[10];if(Math.abs(u-h)<.01&&Math.abs(m-y)<.01&&Math.abs(x-_)<.01){if(Math.abs(u+h)<.1&&Math.abs(m+y)<.1&&Math.abs(x+_)<.1&&Math.abs(l+d+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const C=(l+1)/2,M=(d+1)/2,R=(f+1)/2,E=(u+h)/4,P=(m+y)/4,g=(x+_)/4;return C>M&&C>R?C<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(C),r=E/n,s=P/n):M>R?M<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=E/r,s=g/r):R<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),n=P/s,r=g/s),this.set(n,r,s,t),this}let w=Math.sqrt((_-x)*(_-x)+(m-y)*(m-y)+(h-u)*(h-u));return Math.abs(w)<.001&&(w=1),this.x=(_-x)/w,this.y=(m-y)/w,this.z=(h-u)/w,this.w=Math.acos((l+d+f-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this.z=Oe(this.z,e.z,t.z),this.w=Oe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this.z=Oe(this.z,e,t),this.w=Oe(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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}};Ya.prototype.isVector4=!0;let ht=Ya;class uh extends zn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:At,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ht(0,0,e,t),this.scissorTest=!1,this.viewport=new ht(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new Rt(r),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,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:At,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].isData3DTexture!==!0&&(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 za(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.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class an extends uh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Ul extends Rt{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=yt,this.minFilter=yt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class fh extends Rt{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=yt,this.minFilter=yt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Hr=class Hr{constructor(e,t,n,r,s,a,o,c,l,u,m,h,d,x,y,_){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,c,l,u,m,h,d,x,y,_)}set(e,t,n,r,s,a,o,c,l,u,m,h,d,x,y,_){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=c,f[2]=l,f[6]=u,f[10]=m,f[14]=h,f[3]=d,f[7]=x,f[11]=y,f[15]=_,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 Hr().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 this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(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){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,r=1/ri.setFromMatrixColumn(e,0).length(),s=1/ri.setFromMatrixColumn(e,1).length(),a=1/ri.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),c=Math.cos(r),l=Math.sin(r),u=Math.cos(s),m=Math.sin(s);if(e.order==="XYZ"){const h=a*u,d=a*m,x=o*u,y=o*m;t[0]=c*u,t[4]=-c*m,t[8]=l,t[1]=d+x*l,t[5]=h-y*l,t[9]=-o*c,t[2]=y-h*l,t[6]=x+d*l,t[10]=a*c}else if(e.order==="YXZ"){const h=c*u,d=c*m,x=l*u,y=l*m;t[0]=h+y*o,t[4]=x*o-d,t[8]=a*l,t[1]=a*m,t[5]=a*u,t[9]=-o,t[2]=d*o-x,t[6]=y+h*o,t[10]=a*c}else if(e.order==="ZXY"){const h=c*u,d=c*m,x=l*u,y=l*m;t[0]=h-y*o,t[4]=-a*m,t[8]=x+d*o,t[1]=d+x*o,t[5]=a*u,t[9]=y-h*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const h=a*u,d=a*m,x=o*u,y=o*m;t[0]=c*u,t[4]=x*l-d,t[8]=h*l+y,t[1]=c*m,t[5]=y*l+h,t[9]=d*l-x,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const h=a*c,d=a*l,x=o*c,y=o*l;t[0]=c*u,t[4]=y-h*m,t[8]=x*m+d,t[1]=m,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=d*m+x,t[10]=h-y*m}else if(e.order==="XZY"){const h=a*c,d=a*l,x=o*c,y=o*l;t[0]=c*u,t[4]=-m,t[8]=l*u,t[1]=h*m+y,t[5]=a*u,t[9]=d*m-x,t[2]=x*m-d,t[6]=o*u,t[10]=y*m+h}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(dh,e,ph)}lookAt(e,t,n){const r=this.elements;return Ot.subVectors(e,t),Ot.lengthSq()===0&&(Ot.z=1),Ot.normalize(),Tn.crossVectors(n,Ot),Tn.lengthSq()===0&&(Math.abs(n.z)===1?Ot.x+=1e-4:Ot.z+=1e-4,Ot.normalize(),Tn.crossVectors(n,Ot)),Tn.normalize(),Qi.crossVectors(Ot,Tn),r[0]=Tn.x,r[4]=Qi.x,r[8]=Ot.x,r[1]=Tn.y,r[5]=Qi.y,r[9]=Ot.y,r[2]=Tn.z,r[6]=Qi.z,r[10]=Ot.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],u=n[1],m=n[5],h=n[9],d=n[13],x=n[2],y=n[6],_=n[10],f=n[14],w=n[3],C=n[7],M=n[11],R=n[15],E=r[0],P=r[4],g=r[8],b=r[12],U=r[1],I=r[5],B=r[9],J=r[13],ee=r[2],V=r[6],Z=r[10],W=r[14],ne=r[3],re=r[7],de=r[11],_e=r[15];return s[0]=a*E+o*U+c*ee+l*ne,s[4]=a*P+o*I+c*V+l*re,s[8]=a*g+o*B+c*Z+l*de,s[12]=a*b+o*J+c*W+l*_e,s[1]=u*E+m*U+h*ee+d*ne,s[5]=u*P+m*I+h*V+d*re,s[9]=u*g+m*B+h*Z+d*de,s[13]=u*b+m*J+h*W+d*_e,s[2]=x*E+y*U+_*ee+f*ne,s[6]=x*P+y*I+_*V+f*re,s[10]=x*g+y*B+_*Z+f*de,s[14]=x*b+y*J+_*W+f*_e,s[3]=w*E+C*U+M*ee+R*ne,s[7]=w*P+C*I+M*V+R*re,s[11]=w*g+C*B+M*Z+R*de,s[15]=w*b+C*J+M*W+R*_e,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],c=e[9],l=e[13],u=e[2],m=e[6],h=e[10],d=e[14],x=e[3],y=e[7],_=e[11],f=e[15],w=c*d-l*h,C=o*d-l*m,M=o*h-c*m,R=a*d-l*u,E=a*h-c*u,P=a*m-o*u;return t*(y*w-_*C+f*M)-n*(x*w-_*R+f*E)+r*(x*C-y*R+f*P)-s*(x*M-y*E+_*P)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],c=e[2],l=e[6],u=e[10];return t*(a*u-o*l)-n*(s*u-o*c)+r*(s*l-a*c)}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],c=e[6],l=e[7],u=e[8],m=e[9],h=e[10],d=e[11],x=e[12],y=e[13],_=e[14],f=e[15],w=t*o-n*a,C=t*c-r*a,M=t*l-s*a,R=n*c-r*o,E=n*l-s*o,P=r*l-s*c,g=u*y-m*x,b=u*_-h*x,U=u*f-d*x,I=m*_-h*y,B=m*f-d*y,J=h*f-d*_,ee=w*J-C*B+M*I+R*U-E*b+P*g;if(ee===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const V=1/ee;return e[0]=(o*J-c*B+l*I)*V,e[1]=(r*B-n*J-s*I)*V,e[2]=(y*P-_*E+f*R)*V,e[3]=(h*E-m*P-d*R)*V,e[4]=(c*U-a*J-l*b)*V,e[5]=(t*J-r*U+s*b)*V,e[6]=(_*M-x*P-f*C)*V,e[7]=(u*P-h*M+d*C)*V,e[8]=(a*B-o*U+l*g)*V,e[9]=(n*U-t*B-s*g)*V,e[10]=(x*E-y*M+f*w)*V,e[11]=(m*M-u*E-d*w)*V,e[12]=(o*b-a*I-c*g)*V,e[13]=(t*I-n*b+r*g)*V,e[14]=(y*C-x*R-_*w)*V,e[15]=(u*R-m*C+h*w)*V,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,c=e.z,l=s*a,u=s*o;return this.set(l*a+n,l*o-r*c,l*c+r*o,0,l*o+r*c,u*o+n,u*c-r*a,0,l*c-r*o,u*c+r*a,s*c*c+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,c=t._w,l=s+s,u=a+a,m=o+o,h=s*l,d=s*u,x=s*m,y=a*u,_=a*m,f=o*m,w=c*l,C=c*u,M=c*m,R=n.x,E=n.y,P=n.z;return r[0]=(1-(y+f))*R,r[1]=(d+M)*R,r[2]=(x-C)*R,r[3]=0,r[4]=(d-M)*E,r[5]=(1-(h+f))*E,r[6]=(_+w)*E,r[7]=0,r[8]=(x+C)*P,r[9]=(_-w)*P,r[10]=(1-(h+y))*P,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;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let a=ri.set(r[0],r[1],r[2]).length();const o=ri.set(r[4],r[5],r[6]).length(),c=ri.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Yt.copy(this);const l=1/a,u=1/o,m=1/c;return Yt.elements[0]*=l,Yt.elements[1]*=l,Yt.elements[2]*=l,Yt.elements[4]*=u,Yt.elements[5]*=u,Yt.elements[6]*=u,Yt.elements[8]*=m,Yt.elements[9]*=m,Yt.elements[10]*=m,t.setFromRotationMatrix(Yt),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,r,s,a,o=rn,c=!1){const l=this.elements,u=2*s/(t-e),m=2*s/(n-r),h=(t+e)/(t-e),d=(n+r)/(n-r);let x,y;if(c)x=s/(a-s),y=a*s/(a-s);else if(o===rn)x=-(a+s)/(a-s),y=-2*a*s/(a-s);else if(o===Fr)x=-a/(a-s),y=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=m,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=x,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=rn,c=!1){const l=this.elements,u=2/(t-e),m=2/(n-r),h=-(t+e)/(t-e),d=-(n+r)/(n-r);let x,y;if(c)x=1/(a-s),y=a/(a-s);else if(o===rn)x=-2/(a-s),y=-(a+s)/(a-s);else if(o===Fr)x=-1/(a-s),y=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=m,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=x,l[14]=y,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}};Hr.prototype.isMatrix4=!0;let at=Hr;const ri=new D,Yt=new at,dh=new D(0,0,0),ph=new D(1,1,1),Tn=new D,Qi=new D,Ot=new D,mo=new at,_o=new Bn;class Qn{constructor(e=0,t=0,n=0,r=Qn.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],c=r[1],l=r[5],u=r[9],m=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(Oe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Oe(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-m,s),this._z=0);break;case"ZXY":this._x=Math.asin(Oe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-m,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Oe(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Oe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-m,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Oe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:we("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return mo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mo,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _o.setFromEuler(this),this.setFromQuaternion(_o,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}}Qn.DEFAULT_ORDER="XYZ";class Ga{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 mh=0;const go=new D,si=new Bn,cn=new at,ji=new D,Li=new D,_h=new D,gh=new Bn,xo=new D(1,0,0),vo=new D(0,1,0),Mo=new D(0,0,1),So={type:"added"},xh={type:"removed"},ai={type:"childadded",child:null},ls={type:"childremoved",child:null};class Dt extends zn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:mh++}),this.uuid=Fn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Dt.DEFAULT_UP.clone();const e=new D,t=new Qn,n=new Bn,r=new D(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 at},normalMatrix:{value:new Le}}),this.matrix=new at,this.matrixWorld=new at,this.matrixAutoUpdate=Dt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ga,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.static=!1,this.userData={},this.pivot=null}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 si.setFromAxisAngle(e,t),this.quaternion.multiply(si),this}rotateOnWorldAxis(e,t){return si.setFromAxisAngle(e,t),this.quaternion.premultiply(si),this}rotateX(e){return this.rotateOnAxis(xo,e)}rotateY(e){return this.rotateOnAxis(vo,e)}rotateZ(e){return this.rotateOnAxis(Mo,e)}translateOnAxis(e,t){return go.copy(e).applyQuaternion(this.quaternion),this.position.add(go.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(xo,e)}translateY(e){return this.translateOnAxis(vo,e)}translateZ(e){return this.translateOnAxis(Mo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(cn.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ji.copy(e):ji.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Li.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?cn.lookAt(Li,ji,this.up):cn.lookAt(ji,Li,this.up),this.quaternion.setFromRotationMatrix(cn),r&&(cn.extractRotation(r.matrixWorld),si.setFromRotationMatrix(cn),this.quaternion.premultiply(si.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(So),ai.child=e,this.dispatchEvent(ai),ai.child=null):Ge("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(xh),ls.child=e,this.dispatchEvent(ls),ls.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),cn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),cn.multiply(e.parent.matrixWorld)),e.applyMatrix4(cn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(So),ai.child=e,this.dispatchEvent(ai),ai.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(Li,e,_h),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Li,gh,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);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}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,n=!1){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}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),this.static!==!1&&(r.static=this.static),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.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),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,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.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 c=o.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){const m=c[l];s(e.shapes,m)}else s(e.shapes,c)}}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 c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));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 c=this.animations[o];r.animations.push(s(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),u=a(e.images),m=a(e.shapes),h=a(e.skeletons),d=a(e.animations),x=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),m.length>0&&(n.shapes=m),h.length>0&&(n.skeletons=h),d.length>0&&(n.animations=d),x.length>0&&(n.nodes=x)}return n.object=r,n;function a(o){const c=[];for(const l in o){const u=o[l];delete u.metadata,c.push(u)}return c}}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.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,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}}Dt.DEFAULT_UP=new D(0,1,0);Dt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Dt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class In extends Dt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vh={type:"move"};class cs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new In,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 In,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new In,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D,this._grip.eventsEnabled=!1),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,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const y of e.hand.values()){const _=t.getJointPose(y,n),f=this._getHandJoint(l,y);_!==null&&(f.matrix.fromArray(_.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=_.radius),f.visible=_!==null}const u=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],h=u.position.distanceTo(m.position),d=.02,x=.005;l.inputState.pinching&&h>d+x?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&h<=d-x&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:e,target:this})));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(vh)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new In;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Nl={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},An={h:0,s:0,l:0},er={h:0,s:0,l:0};function hs(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 Be{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=It){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ve.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Ve.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ve.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Ve.workingColorSpace){if(e=sh(e,1),t=Oe(t,0,1),n=Oe(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=hs(a,s,e+1/3),this.g=hs(a,s,e),this.b=hs(a,s,e-1/3)}return Ve.colorSpaceToWorking(this,r),this}setStyle(e,t=It){function n(s){s!==void 0&&parseFloat(s)<1&&we("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:we("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);we("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=It){const n=Nl[e.toLowerCase()];return n!==void 0?this.setHex(n,t):we("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=gn(e.r),this.g=gn(e.g),this.b=gn(e.b),this}copyLinearToSRGB(e){return this.r=Ei(e.r),this.g=Ei(e.g),this.b=Ei(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=It){return Ve.workingToColorSpace(Tt.copy(this),e),Math.round(Oe(Tt.r*255,0,255))*65536+Math.round(Oe(Tt.g*255,0,255))*256+Math.round(Oe(Tt.b*255,0,255))}getHexString(e=It){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ve.workingColorSpace){Ve.workingToColorSpace(Tt.copy(this),t);const n=Tt.r,r=Tt.g,s=Tt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let c,l;const u=(o+a)/2;if(o===a)c=0,l=0;else{const m=a-o;switch(l=u<=.5?m/(a+o):m/(2-a-o),a){case n:c=(r-s)/m+(r<s?6:0);break;case r:c=(s-n)/m+2;break;case s:c=(n-r)/m+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,t=Ve.workingColorSpace){return Ve.workingToColorSpace(Tt.copy(this),t),e.r=Tt.r,e.g=Tt.g,e.b=Tt.b,e}getStyle(e=It){Ve.workingToColorSpace(Tt.copy(this),e);const t=Tt.r,n=Tt.g,r=Tt.b;return e!==It?`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(An),this.setHSL(An.h+e,An.s+t,An.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(An),e.getHSL(er);const n=is(An.h,er.h,t),r=is(An.s,er.s,t),s=is(An.l,er.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 Tt=new Be;Be.NAMES=Nl;class Va{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Be(e),this.density=t}clone(){return new Va(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Mh extends Dt{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 Qn,this.environmentIntensity=1,this.environmentRotation=new Qn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const qt=new D,hn=new D,us=new D,un=new D,oi=new D,li=new D,yo=new D,fs=new D,ds=new D,ps=new D,ms=new ht,_s=new ht,gs=new ht;class Wt{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),qt.subVectors(e,t),r.cross(qt);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){qt.subVectors(r,t),hn.subVectors(n,t),us.subVectors(e,t);const a=qt.dot(qt),o=qt.dot(hn),c=qt.dot(us),l=hn.dot(hn),u=hn.dot(us),m=a*l-o*o;if(m===0)return s.set(0,0,0),null;const h=1/m,d=(l*c-o*u)*h,x=(a*u-o*c)*h;return s.set(1-d-x,x,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,un)===null?!1:un.x>=0&&un.y>=0&&un.x+un.y<=1}static getInterpolation(e,t,n,r,s,a,o,c){return this.getBarycoord(e,t,n,r,un)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,un.x),c.addScaledVector(a,un.y),c.addScaledVector(o,un.z),c)}static getInterpolatedAttribute(e,t,n,r,s,a){return ms.setScalar(0),_s.setScalar(0),gs.setScalar(0),ms.fromBufferAttribute(e,t),_s.fromBufferAttribute(e,n),gs.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(ms,s.x),a.addScaledVector(_s,s.y),a.addScaledVector(gs,s.z),a}static isFrontFacing(e,t,n,r){return qt.subVectors(n,t),hn.subVectors(e,t),qt.cross(hn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return qt.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),qt.cross(hn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Wt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Wt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Wt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wt.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;oi.subVectors(r,n),li.subVectors(s,n),fs.subVectors(e,n);const c=oi.dot(fs),l=li.dot(fs);if(c<=0&&l<=0)return t.copy(n);ds.subVectors(e,r);const u=oi.dot(ds),m=li.dot(ds);if(u>=0&&m<=u)return t.copy(r);const h=c*m-u*l;if(h<=0&&c>=0&&u<=0)return a=c/(c-u),t.copy(n).addScaledVector(oi,a);ps.subVectors(e,s);const d=oi.dot(ps),x=li.dot(ps);if(x>=0&&d<=x)return t.copy(s);const y=d*l-c*x;if(y<=0&&l>=0&&x<=0)return o=l/(l-x),t.copy(n).addScaledVector(li,o);const _=u*x-d*m;if(_<=0&&m-u>=0&&d-x>=0)return yo.subVectors(s,r),o=(m-u)/(m-u+(d-x)),t.copy(r).addScaledVector(yo,o);const f=1/(_+y+h);return a=y*f,o=h*f,t.copy(n).addScaledVector(oi,a).addScaledVector(li,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Yi{constructor(e=new D(1/0,1/0,1/0),t=new D(-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(Kt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Kt.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=Kt.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,Kt):Kt.fromBufferAttribute(s,a),Kt.applyMatrix4(e.matrixWorld),this.expandByPoint(Kt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),tr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),tr.copy(n.boundingBox)),tr.applyMatrix4(e.matrixWorld),this.union(tr)}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,Kt),Kt.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(Ii),nr.subVectors(this.max,Ii),ci.subVectors(e.a,Ii),hi.subVectors(e.b,Ii),ui.subVectors(e.c,Ii),Rn.subVectors(hi,ci),wn.subVectors(ui,hi),Vn.subVectors(ci,ui);let t=[0,-Rn.z,Rn.y,0,-wn.z,wn.y,0,-Vn.z,Vn.y,Rn.z,0,-Rn.x,wn.z,0,-wn.x,Vn.z,0,-Vn.x,-Rn.y,Rn.x,0,-wn.y,wn.x,0,-Vn.y,Vn.x,0];return!xs(t,ci,hi,ui,nr)||(t=[1,0,0,0,1,0,0,0,1],!xs(t,ci,hi,ui,nr))?!1:(ir.crossVectors(Rn,wn),t=[ir.x,ir.y,ir.z],xs(t,ci,hi,ui,nr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Kt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Kt).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:(fn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fn),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 fn=[new D,new D,new D,new D,new D,new D,new D,new D],Kt=new D,tr=new Yi,ci=new D,hi=new D,ui=new D,Rn=new D,wn=new D,Vn=new D,Ii=new D,nr=new D,ir=new D,Hn=new D;function xs(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Hn.fromArray(i,s);const o=r.x*Math.abs(Hn.x)+r.y*Math.abs(Hn.y)+r.z*Math.abs(Hn.z),c=e.dot(Hn),l=t.dot(Hn),u=n.dot(Hn);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>o)return!1}return!0}const _t=new D,rr=new Ce;let Sh=0;class $t extends zn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Sh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ba,this.updateRanges=[],this.gpuType=nn,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++)rr.fromBufferAttribute(this,t),rr.applyMatrix3(e),this.setXY(t,rr.x,rr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)_t.fromBufferAttribute(this,t),_t.applyMatrix3(e),this.setXYZ(t,_t.x,_t.y,_t.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)_t.fromBufferAttribute(this,t),_t.applyMatrix4(e),this.setXYZ(t,_t.x,_t.y,_t.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)_t.fromBufferAttribute(this,t),_t.applyNormalMatrix(e),this.setXYZ(t,_t.x,_t.y,_t.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)_t.fromBufferAttribute(this,t),_t.transformDirection(e),this.setXYZ(t,_t.x,_t.y,_t.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=tn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Qe(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=tn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Qe(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=tn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Qe(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=tn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Qe(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=tn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Qe(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Qe(t,this.array),n=Qe(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=Qe(t,this.array),n=Qe(n,this.array),r=Qe(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=Qe(t,this.array),n=Qe(n,this.array),r=Qe(r,this.array),s=Qe(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!==ba&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Fl extends $t{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ol extends $t{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class zt extends $t{constructor(e,t,n){super(new Float32Array(e),t,n)}}const yh=new Yi,Ui=new D,vs=new D;class Wr{constructor(e=new D,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):yh.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;Ui.subVectors(e,this.center);const t=Ui.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Ui,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):(vs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ui.copy(e.center).add(vs)),this.expandByPoint(Ui.copy(e.center).sub(vs))),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}}let Eh=0;const Vt=new at,Ms=new Dt,fi=new D,Bt=new Yi,Ni=new Yi,Mt=new D;class Xt extends zn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Eh++}),this.uuid=Fn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(th(e)?Ol:Fl)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,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 Le().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._transformed=!0,this}applyQuaternion(e){return Vt.makeRotationFromQuaternion(e),this.applyMatrix4(Vt),this}rotateX(e){return Vt.makeRotationX(e),this.applyMatrix4(Vt),this}rotateY(e){return Vt.makeRotationY(e),this.applyMatrix4(Vt),this}rotateZ(e){return Vt.makeRotationZ(e),this.applyMatrix4(Vt),this}translate(e,t,n){return Vt.makeTranslation(e,t,n),this.applyMatrix4(Vt),this}scale(e,t,n){return Vt.makeScale(e,t,n),this.applyMatrix4(Vt),this}lookAt(e){return Ms.lookAt(e),Ms.updateMatrix(),this.applyMatrix4(Ms.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(fi).negate(),this.translate(fi.x,fi.y,fi.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 zt(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&&we("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 Yi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Bt.setFromBufferAttribute(s),this.morphTargetsRelative?(Mt.addVectors(this.boundingBox.min,Bt.min),this.boundingBox.expandByPoint(Mt),Mt.addVectors(this.boundingBox.max,Bt.max),this.boundingBox.expandByPoint(Mt)):(this.boundingBox.expandByPoint(Bt.min),this.boundingBox.expandByPoint(Bt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('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 Wr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){const n=this.boundingSphere.center;if(Bt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ni.setFromBufferAttribute(o),this.morphTargetsRelative?(Mt.addVectors(Bt.min,Ni.min),Bt.expandByPoint(Mt),Mt.addVectors(Bt.max,Ni.max),Bt.expandByPoint(Mt)):(Bt.expandByPoint(Ni.min),Bt.expandByPoint(Ni.max))}Bt.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Mt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Mt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],c=this.morphTargetsRelative;for(let l=0,u=o.count;l<u;l++)Mt.fromBufferAttribute(o,l),c&&(fi.fromBufferAttribute(e,l),Mt.add(fi)),r=Math.max(r,n.distanceToSquared(Mt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('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){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new $t(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));const o=[],c=[];for(let g=0;g<n.count;g++)o[g]=new D,c[g]=new D;const l=new D,u=new D,m=new D,h=new Ce,d=new Ce,x=new Ce,y=new D,_=new D;function f(g,b,U){l.fromBufferAttribute(n,g),u.fromBufferAttribute(n,b),m.fromBufferAttribute(n,U),h.fromBufferAttribute(s,g),d.fromBufferAttribute(s,b),x.fromBufferAttribute(s,U),u.sub(l),m.sub(l),d.sub(h),x.sub(h);const I=1/(d.x*x.y-x.x*d.y);isFinite(I)&&(y.copy(u).multiplyScalar(x.y).addScaledVector(m,-d.y).multiplyScalar(I),_.copy(m).multiplyScalar(d.x).addScaledVector(u,-x.x).multiplyScalar(I),o[g].add(y),o[b].add(y),o[U].add(y),c[g].add(_),c[b].add(_),c[U].add(_))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let g=0,b=w.length;g<b;++g){const U=w[g],I=U.start,B=U.count;for(let J=I,ee=I+B;J<ee;J+=3)f(e.getX(J+0),e.getX(J+1),e.getX(J+2))}const C=new D,M=new D,R=new D,E=new D;function P(g){R.fromBufferAttribute(r,g),E.copy(R);const b=o[g];C.copy(b),C.sub(R.multiplyScalar(R.dot(b))).normalize(),M.crossVectors(E,b);const I=M.dot(c[g])<0?-1:1;a.setXYZW(g,C.x,C.y,C.z,I)}for(let g=0,b=w.length;g<b;++g){const U=w[g],I=U.start,B=U.count;for(let J=I,ee=I+B;J<ee;J+=3)P(e.getX(J+0)),P(e.getX(J+1)),P(e.getX(J+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new $t(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,d=n.count;h<d;h++)n.setXYZ(h,0,0,0);const r=new D,s=new D,a=new D,o=new D,c=new D,l=new D,u=new D,m=new D;if(e)for(let h=0,d=e.count;h<d;h+=3){const x=e.getX(h+0),y=e.getX(h+1),_=e.getX(h+2);r.fromBufferAttribute(t,x),s.fromBufferAttribute(t,y),a.fromBufferAttribute(t,_),u.subVectors(a,s),m.subVectors(r,s),u.cross(m),o.fromBufferAttribute(n,x),c.fromBufferAttribute(n,y),l.fromBufferAttribute(n,_),o.add(u),c.add(u),l.add(u),n.setXYZ(x,o.x,o.y,o.z),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(_,l.x,l.y,l.z)}else for(let h=0,d=t.count;h<d;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),u.subVectors(a,s),m.subVectors(r,s),u.cross(m),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+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++)Mt.fromBufferAttribute(e,t),Mt.normalize(),e.setXYZ(t,Mt.x,Mt.y,Mt.z)}toNonIndexed(){function e(o,c){const l=o.array,u=o.itemSize,m=o.normalized,h=new l.constructor(c.length*u);let d=0,x=0;for(let y=0,_=c.length;y<_;y++){o.isInterleavedBufferAttribute?d=c[y]*o.data.stride+o.offset:d=c[y]*u;for(let f=0;f<u;f++)h[x++]=l[d++]}return new $t(h,u,m)}if(this.index===null)return we("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Xt,n=this.index.array,r=this.attributes;for(const o in r){const c=r[o],l=e(c,n);t.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let u=0,m=l.length;u<m;u++){const h=l[u],d=e(h,n);c.push(d)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);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 c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let m=0,h=l.length;m<h;m++){const d=l[m];u.push(d.toJSON(e.data))}u.length>0&&(r[c]=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 l in r){const u=r[l];this.setAttribute(l,u.clone(t))}const s=e.morphAttributes;for(const l in s){const u=[],m=s[l];for(let h=0,d=m.length;h<d;h++)u.push(m[h].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,u=a.length;l<u;l++){const m=a[l];this.addGroup(m.start,m.count,m.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class bh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ba,this.updateRanges=[],this.version=0,this.uuid=Fn()}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=Fn()),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=Fn()),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 Ct=new D;class zr{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++)Ct.fromBufferAttribute(this,t),Ct.applyMatrix4(e),this.setXYZ(t,Ct.x,Ct.y,Ct.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ct.fromBufferAttribute(this,t),Ct.applyNormalMatrix(e),this.setXYZ(t,Ct.x,Ct.y,Ct.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ct.fromBufferAttribute(this,t),Ct.transformDirection(e),this.setXYZ(t,Ct.x,Ct.y,Ct.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=tn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Qe(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Qe(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Qe(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Qe(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Qe(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=tn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=tn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=tn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=tn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Qe(t,this.array),n=Qe(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=Qe(t,this.array),n=Qe(n,this.array),r=Qe(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=Qe(t,this.array),n=Qe(n,this.array),r=Qe(r,this.array),s=Qe(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){Br("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 $t(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 zr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Br("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}}}let Th=0;class Ci extends zn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Th++}),this.uuid=Fn(),this.name="",this.type="Material",this.blending=Nn,this.side=On,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Os,this.blendDst=Bs,this.blendEquation=Xn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Be(0,0,0),this.blendAlpha=0,this.depthFunc=Ti,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=lo,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ni,this.stencilZFail=ni,this.stencilZPass=ni,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){we(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){we(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||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.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),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!==Nn&&(n.blending=this.blending),this.side!==On&&(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!==Os&&(n.blendSrc=this.blendSrc),this.blendDst!==Bs&&(n.blendDst=this.blendDst),this.blendEquation!==Xn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ti&&(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!==lo&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ni&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ni&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ni&&(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.allowOverride===!1&&(n.allowOverride=!1),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 c=s[o];delete c.metadata,a.push(c)}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}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Be().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Ce().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Ce().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}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.allowOverride=e.allowOverride,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 Bl extends Ci{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Be(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 di;const Fi=new D,pi=new D,mi=new D,_i=new Ce,Oi=new Ce,zl=new at,sr=new D,Bi=new D,ar=new D,Eo=new Ce,Ss=new Ce,bo=new Ce;class Ah extends Dt{constructor(e=new Bl){if(super(),this.isSprite=!0,this.type="Sprite",di===void 0){di=new Xt;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 bh(t,5);di.setIndex([0,1,2,0,2,3]),di.setAttribute("position",new zr(n,3,0,!1)),di.setAttribute("uv",new zr(n,2,3,!1))}this.geometry=di,this.material=e,this.center=new Ce(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),pi.setFromMatrixScale(this.matrixWorld),zl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),mi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&pi.multiplyScalar(-mi.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;or(sr.set(-.5,-.5,0),mi,a,pi,r,s),or(Bi.set(.5,-.5,0),mi,a,pi,r,s),or(ar.set(.5,.5,0),mi,a,pi,r,s),Eo.set(0,0),Ss.set(1,0),bo.set(1,1);let o=e.ray.intersectTriangle(sr,Bi,ar,!1,Fi);if(o===null&&(or(Bi.set(-.5,.5,0),mi,a,pi,r,s),Ss.set(0,1),o=e.ray.intersectTriangle(sr,ar,Bi,!1,Fi),o===null))return;const c=e.ray.origin.distanceTo(Fi);c<e.near||c>e.far||t.push({distance:c,point:Fi.clone(),uv:Wt.getInterpolation(Fi,sr,Bi,ar,Eo,Ss,bo,new Ce),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 or(i,e,t,n,r,s){_i.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(Oi.x=s*_i.x-r*_i.y,Oi.y=r*_i.x+s*_i.y):Oi.copy(_i),i.copy(e),i.x+=Oi.x,i.y+=Oi.y,i.applyMatrix4(zl)}const dn=new D,ys=new D,lr=new D,Cn=new D,Es=new D,cr=new D,bs=new D;class Xr{constructor(e=new D,t=new D(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,dn)),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=dn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(dn.copy(this.origin).addScaledVector(this.direction,t),dn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ys.copy(e).add(t).multiplyScalar(.5),lr.copy(t).sub(e).normalize(),Cn.copy(this.origin).sub(ys);const s=e.distanceTo(t)*.5,a=-this.direction.dot(lr),o=Cn.dot(this.direction),c=-Cn.dot(lr),l=Cn.lengthSq(),u=Math.abs(1-a*a);let m,h,d,x;if(u>0)if(m=a*c-o,h=a*o-c,x=s*u,m>=0)if(h>=-x)if(h<=x){const y=1/u;m*=y,h*=y,d=m*(m+a*h+2*o)+h*(a*m+h+2*c)+l}else h=s,m=Math.max(0,-(a*h+o)),d=-m*m+h*(h+2*c)+l;else h=-s,m=Math.max(0,-(a*h+o)),d=-m*m+h*(h+2*c)+l;else h<=-x?(m=Math.max(0,-(-a*s+o)),h=m>0?-s:Math.min(Math.max(-s,-c),s),d=-m*m+h*(h+2*c)+l):h<=x?(m=0,h=Math.min(Math.max(-s,-c),s),d=h*(h+2*c)+l):(m=Math.max(0,-(a*s+o)),h=m>0?s:Math.min(Math.max(-s,-c),s),d=-m*m+h*(h+2*c)+l);else h=a>0?-s:s,m=Math.max(0,-(a*h+o)),d=-m*m+h*(h+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,m),r&&r.copy(ys).addScaledVector(lr,h),d}intersectSphere(e,t){dn.subVectors(e.center,this.origin);const n=dn.dot(this.direction),r=dn.dot(dn)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,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,c;const l=1/this.direction.x,u=1/this.direction.y,m=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(s=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),m>=0?(o=(e.min.z-h.z)*m,c=(e.max.z-h.z)*m):(o=(e.max.z-h.z)*m,c=(e.min.z-h.z)*m),n>c||o>r)||((o>n||n!==n)&&(n=o),(c<r||r!==r)&&(r=c),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,dn)!==null}intersectTriangle(e,t,n,r,s){Es.subVectors(t,e),cr.subVectors(n,e),bs.crossVectors(Es,cr);let a=this.direction.dot(bs),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Cn.subVectors(this.origin,e);const c=o*this.direction.dot(cr.crossVectors(Cn,cr));if(c<0)return null;const l=o*this.direction.dot(Es.cross(Cn));if(l<0||c+l>a)return null;const u=-o*Cn.dot(bs);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 Gl extends Ci{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Be(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 Qn,this.combine=gl,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 To=new at,kn=new Xr,hr=new Wr,Ao=new D,ur=new D,fr=new D,dr=new D,Ts=new D,pr=new D,Ro=new D,mr=new D;class Mn extends Dt{constructor(e=new Xt,t=new Gl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){pr.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const u=o[c],m=s[c];u!==0&&(Ts.fromBufferAttribute(m,e),a?pr.addScaledVector(Ts,u):pr.addScaledVector(Ts.sub(t),u))}t.add(pr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),hr.copy(n.boundingSphere),hr.applyMatrix4(s),kn.copy(e.ray).recast(e.near),!(hr.containsPoint(kn.origin)===!1&&(kn.intersectSphere(hr,Ao)===null||kn.origin.distanceToSquared(Ao)>(e.far-e.near)**2))&&(To.copy(s).invert(),kn.copy(e.ray).applyMatrix4(To),!(n.boundingBox!==null&&kn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,kn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,m=s.attributes.normal,h=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,y=h.length;x<y;x++){const _=h[x],f=a[_.materialIndex],w=Math.max(_.start,d.start),C=Math.min(o.count,Math.min(_.start+_.count,d.start+d.count));for(let M=w,R=C;M<R;M+=3){const E=o.getX(M),P=o.getX(M+1),g=o.getX(M+2);r=_r(this,f,e,n,l,u,m,E,P,g),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const x=Math.max(0,d.start),y=Math.min(o.count,d.start+d.count);for(let _=x,f=y;_<f;_+=3){const w=o.getX(_),C=o.getX(_+1),M=o.getX(_+2);r=_r(this,a,e,n,l,u,m,w,C,M),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(a))for(let x=0,y=h.length;x<y;x++){const _=h[x],f=a[_.materialIndex],w=Math.max(_.start,d.start),C=Math.min(c.count,Math.min(_.start+_.count,d.start+d.count));for(let M=w,R=C;M<R;M+=3){const E=M,P=M+1,g=M+2;r=_r(this,f,e,n,l,u,m,E,P,g),r&&(r.faceIndex=Math.floor(M/3),r.face.materialIndex=_.materialIndex,t.push(r))}}else{const x=Math.max(0,d.start),y=Math.min(c.count,d.start+d.count);for(let _=x,f=y;_<f;_+=3){const w=_,C=_+1,M=_+2;r=_r(this,a,e,n,l,u,m,w,C,M),r&&(r.faceIndex=Math.floor(_/3),t.push(r))}}}}function Rh(i,e,t,n,r,s,a,o){let c;if(e.side===Ut?c=n.intersectTriangle(a,s,r,!0,o):c=n.intersectTriangle(r,s,a,e.side===On,o),c===null)return null;mr.copy(o),mr.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(mr);return l<t.near||l>t.far?null:{distance:l,point:mr.clone(),object:i}}function _r(i,e,t,n,r,s,a,o,c,l){i.getVertexPosition(o,ur),i.getVertexPosition(c,fr),i.getVertexPosition(l,dr);const u=Rh(i,e,t,n,ur,fr,dr,Ro);if(u){const m=new D;Wt.getBarycoord(Ro,ur,fr,dr,m),r&&(u.uv=Wt.getInterpolatedAttribute(r,o,c,l,m,new Ce)),s&&(u.uv1=Wt.getInterpolatedAttribute(s,o,c,l,m,new Ce)),a&&(u.normal=Wt.getInterpolatedAttribute(a,o,c,l,m,new D),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:c,c:l,normal:new D,materialIndex:0};Wt.getNormal(ur,fr,dr,h.normal),u.face=h,u.barycoord=m}return u}class wh extends Rt{constructor(e=null,t=1,n=1,r,s,a,o,c,l=yt,u=yt,m,h){super(null,a,o,c,l,u,r,s,m,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const As=new D,Ch=new D,Ph=new Le;class Dn{constructor(e=new D(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=As.subVectors(n,t).cross(Ch.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,n=!0){const r=e.delta(As),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}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||Ph.getNormalMatrix(e),r=this.coplanarPoint(As).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 Wn=new Wr,Dh=new Ce(.5,.5),gr=new D;class Vl{constructor(e=new Dn,t=new Dn,n=new Dn,r=new Dn,s=new Dn,a=new Dn){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=rn,n=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],c=s[2],l=s[3],u=s[4],m=s[5],h=s[6],d=s[7],x=s[8],y=s[9],_=s[10],f=s[11],w=s[12],C=s[13],M=s[14],R=s[15];if(r[0].setComponents(l-a,d-u,f-x,R-w).normalize(),r[1].setComponents(l+a,d+u,f+x,R+w).normalize(),r[2].setComponents(l+o,d+m,f+y,R+C).normalize(),r[3].setComponents(l-o,d-m,f-y,R-C).normalize(),n)r[4].setComponents(c,h,_,M).normalize(),r[5].setComponents(l-c,d-h,f-_,R-M).normalize();else if(r[4].setComponents(l-c,d-h,f-_,R-M).normalize(),t===rn)r[5].setComponents(l+c,d+h,f+_,R+M).normalize();else if(t===Fr)r[5].setComponents(c,h,_,M).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(),Wn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Wn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Wn)}intersectsSprite(e){Wn.center.set(0,0,0);const t=Dh.distanceTo(e.center);return Wn.radius=.7071067811865476+t,Wn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Wn)}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(gr.x=r.normal.x>0?e.max.x:e.min.x,gr.y=r.normal.y>0?e.max.y:e.min.y,gr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(gr)<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 Hl extends Ci{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Be(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Gr=new D,Vr=new D,wo=new at,zi=new Xr,xr=new Wr,Rs=new D,Co=new D;class Lh extends Dt{constructor(e=new Xt,t=new Hl){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Gr.fromBufferAttribute(t,r-1),Vr.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Gr.distanceTo(Vr);e.setAttribute("lineDistance",new zt(n,1))}else we("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),xr.copy(n.boundingSphere),xr.applyMatrix4(r),xr.radius+=s,e.ray.intersectsSphere(xr)===!1)return;wo.copy(r).invert(),zi.copy(e.ray).applyMatrix4(wo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,u=n.index,h=n.attributes.position;if(u!==null){const d=Math.max(0,a.start),x=Math.min(u.count,a.start+a.count);for(let y=d,_=x-1;y<_;y+=l){const f=u.getX(y),w=u.getX(y+1),C=vr(this,e,zi,c,f,w,y);C&&t.push(C)}if(this.isLineLoop){const y=u.getX(x-1),_=u.getX(d),f=vr(this,e,zi,c,y,_,x-1);f&&t.push(f)}}else{const d=Math.max(0,a.start),x=Math.min(h.count,a.start+a.count);for(let y=d,_=x-1;y<_;y+=l){const f=vr(this,e,zi,c,y,y+1,y);f&&t.push(f)}if(this.isLineLoop){const y=vr(this,e,zi,c,x-1,d,x-1);y&&t.push(y)}}}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 vr(i,e,t,n,r,s,a){const o=i.geometry.attributes.position;if(Gr.fromBufferAttribute(o,r),Vr.fromBufferAttribute(o,s),t.distanceSqToSegment(Gr,Vr,Rs,Co)>n)return;Rs.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Rs);if(!(l<e.near||l>e.far))return{distance:l,point:Co.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const Po=new D,Do=new D;class Ih extends Lh{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)Po.fromBufferAttribute(t,r),Do.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Po.distanceTo(Do);e.setAttribute("lineDistance",new zt(n,1))}else we("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class kl extends Rt{constructor(e=[],t=$n,n,r,s,a,o,c,l,u){super(e,t,n,r,s,a,o,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Uh extends Rt{constructor(e,t,n,r,s,a,o,c,l){super(e,t,n,r,s,a,o,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ri extends Rt{constructor(e,t,n=on,r,s,a,o=yt,c=yt,l,u=vn,m=1){if(u!==vn&&u!==Kn)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:m};super(h,r,s,a,o,c,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new za(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 Nh extends Ri{constructor(e,t=on,n=$n,r,s,a=yt,o=yt,c,l=vn){const u={width:e,height:e,depth:1},m=[u,u,u,u,u,u];super(e,e,t,n,r,s,a,o,c,l),this.image=m,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Wl extends Rt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class qi extends Xt{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 c=[],l=[],u=[],m=[];let h=0,d=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1),x("x","z","y",1,1,e,n,t,r,a,2),x("x","z","y",1,-1,e,n,-t,r,a,3),x("x","y","z",1,-1,e,t,n,r,s,4),x("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(c),this.setAttribute("position",new zt(l,3)),this.setAttribute("normal",new zt(u,3)),this.setAttribute("uv",new zt(m,2));function x(y,_,f,w,C,M,R,E,P,g,b){const U=M/P,I=R/g,B=M/2,J=R/2,ee=E/2,V=P+1,Z=g+1;let W=0,ne=0;const re=new D;for(let de=0;de<Z;de++){const _e=de*I-J;for(let ye=0;ye<V;ye++){const ke=ye*U-B;re[y]=ke*w,re[_]=_e*C,re[f]=ee,l.push(re.x,re.y,re.z),re[y]=0,re[_]=0,re[f]=E>0?1:-1,u.push(re.x,re.y,re.z),m.push(ye/P),m.push(1-de/g),W+=1}}for(let de=0;de<g;de++)for(let _e=0;_e<P;_e++){const ye=h+_e+V*de,ke=h+_e+V*(de+1),it=h+(_e+1)+V*(de+1),We=h+(_e+1)+V*de;c.push(ye,ke,We),c.push(ke,it,We),ne+=6}o.addGroup(d,ne,b),d+=ne,h+=W}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Fh{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){we("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,c=s-1,l;for(;o<=c;)if(r=Math.floor(o+(c-o)/2),l=n[r]-a,l<0)o=r+1;else if(l>0)c=r-1;else{c=r;break}if(r=c,n[r]===a)return r/(s-1);const u=n[r],h=n[r+1]-u,d=(a-u)/h;return(r+d)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),c=t||(a.isVector2?new Ce:new D);return c.copy(o).sub(a).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new D,r=[],s=[],a=[],o=new D,c=new at;for(let d=0;d<=e;d++){const x=d/e;r[d]=this.getTangentAt(x,new D)}s[0]=new D,a[0]=new D;let l=Number.MAX_VALUE;const u=Math.abs(r[0].x),m=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=l&&(l=u,n.set(1,0,0)),m<=l&&(l=m,n.set(0,1,0)),h<=l&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),a[d]=a[d-1].clone(),o.crossVectors(r[d-1],r[d]),o.length()>Number.EPSILON){o.normalize();const x=Math.acos(Oe(r[d-1].dot(r[d]),-1,1));s[d].applyMatrix4(c.makeRotationAxis(o,x))}a[d].crossVectors(r[d],s[d])}if(t===!0){let d=Math.acos(Oe(s[0].dot(s[e]),-1,1));d/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(d=-d);for(let x=1;x<=e;x++)s[x].applyMatrix4(c.makeRotationAxis(r[x],d*x)),a[x].crossVectors(r[x],s[x])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}function Oh(i,e){const t=1-i;return t*t*e}function Bh(i,e){return 2*(1-i)*i*e}function zh(i,e){return i*i*e}function ws(i,e,t,n){return Oh(i,e)+Bh(i,t)+zh(i,n)}class Gh extends Fh{constructor(e=new D,t=new D,n=new D){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new D){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(ws(e,r.x,s.x,a.x),ws(e,r.y,s.y,a.y),ws(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Yr extends Xt{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),c=Math.floor(r),l=o+1,u=c+1,m=e/o,h=t/c,d=[],x=[],y=[],_=[];for(let f=0;f<u;f++){const w=f*h-a;for(let C=0;C<l;C++){const M=C*m-s;x.push(M,-w,0),y.push(0,0,1),_.push(C/o),_.push(1-f/c)}}for(let f=0;f<c;f++)for(let w=0;w<o;w++){const C=w+l*f,M=w+l*(f+1),R=w+1+l*(f+1),E=w+1+l*f;d.push(C,M,E),d.push(M,R,E)}this.setIndex(d),this.setAttribute("position",new zt(x,3)),this.setAttribute("normal",new zt(y,3)),this.setAttribute("uv",new zt(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yr(e.width,e.height,e.widthSegments,e.heightSegments)}}function wi(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];if(Lo(r))r.isRenderTargetTexture?(we("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(Lo(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function Pt(i){const e={};for(let t=0;t<i.length;t++){const n=wi(i[t]);for(const r in n)e[r]=n[r]}return e}function Lo(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Vh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Xl(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ve.workingColorSpace}const Hh={clone:wi,merge:Pt};var kh=`void main() {
|
|
2
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
|
-
}`,
|
|
3
|
+
}`,Wh=`void main() {
|
|
4
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
5
|
-
}`;class ln extends Ci{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Wh,this.fragmentShader=Xh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=wi(e.uniforms),this.uniformsGroups=Hh(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.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,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}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Be().setHex(r.value);break;case"v2":this.uniforms[n].value=new Ce().fromArray(r.value);break;case"v3":this.uniforms[n].value=new D().fromArray(r.value);break;case"v4":this.uniforms[n].value=new ht().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Le().fromArray(r.value);break;case"m4":this.uniforms[n].value=new at().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class Yh extends ln{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class qh extends Ci{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Kc,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 Kh extends Ci{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Mr=new D,Sr=new zn,Qt=new D;class Yl extends Dt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new at,this.projectionMatrix=new at,this.projectionMatrixInverse=new at,this.coordinateSystem=rn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}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.matrixWorld.decompose(Mr,Sr,Qt),Qt.x===1&&Qt.y===1&&Qt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Mr,Sr,Qt.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Mr,Sr,Qt),Qt.x===1&&Qt.y===1&&Qt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Mr,Sr,Qt.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Pn=new D,Io=new Ce,Uo=new Ce;class Ht extends Yl{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=Ta*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Pr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ta*2*Math.atan(Math.tan(Pr*.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){Pn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Pn.x,Pn.y).multiplyScalar(-e/Pn.z),Pn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Pn.x,Pn.y).multiplyScalar(-e/Pn.z)}getViewSize(e,t){return this.getViewBounds(e,Io,Uo),t.subVectors(Uo,Io)}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(Pr*.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 c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*r/c,t-=a.offsetY*n/l,r*=a.width/c,n*=a.height/l}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.reversedDepth),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}}class ql extends Yl{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,c=r-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=u*this.view.offsetY,c=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),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}}const _i=-90,xi=1;class Zh extends Dt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ht(_i,xi,e,t);r.layers=this.layers,this.add(r);const s=new Ht(_i,xi,e,t);s.layers=this.layers,this.add(s);const a=new Ht(_i,xi,e,t);a.layers=this.layers,this.add(a);const o=new Ht(_i,xi,e,t);o.layers=this.layers,this.add(o);const c=new Ht(_i,xi,e,t);c.layers=this.layers,this.add(c);const l=new Ht(_i,xi,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,c]=t;for(const l of t)this.remove(l);if(e===rn)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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Fr)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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.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,c,l,u]=this.children,m=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=y,e.setRenderTarget(n,5,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(m,h,d),e.xr.enabled=x,n.texture.needsPMREMUpdate=!0}}class $h extends Ht{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const No=new at;class Jh{constructor(e,t,n=0,r=1/0){this.ray=new Xr(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Ga,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.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return No.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(No),this}intersectObject(e,t=!0,n=[]){return Aa(e,this,n,t),n.sort(Fo),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)Aa(e[r],this,n,t);return n.sort(Fo),n}}function Fo(i,e){return i.distance-e.distance}function Aa(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++)Aa(s[a],e,t,!0)}}class Oo{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=Oe(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(Oe(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const qa=class qa{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};qa.prototype.isMatrix2=!0;let Bo=qa;class Qh extends Gn{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){we("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function zo(i,e,t,n){const r=jh(n);switch(t){case Pl:return i*e;case Ll:return i*e/r.components*r.byteLength;case Ua:return i*e/r.components*r.byteLength;case Jn:return i*e*2/r.components*r.byteLength;case Na:return i*e*2/r.components*r.byteLength;case Dl:return i*e*3/r.components*r.byteLength;case Zt:return i*e*4/r.components*r.byteLength;case Fa:return i*e*4/r.components*r.byteLength;case Ar:case Rr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case wr:case Cr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Zs:case Js:return Math.max(i,16)*Math.max(e,8)/4;case Ks:case $s:return Math.max(i,8)*Math.max(e,8)/2;case Qs:case js:case ta:case na:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ea:case Lr:case ia:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ra:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case sa:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case aa:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case oa:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case la:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case ca:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case ha:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case ua:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case fa:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case da:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case pa:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case ma:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case ga:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case _a:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case xa:case va:case Ma:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Sa:case ya:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Ir:case Ea:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function jh(i){switch(i){case kt:case Al:return{byteLength:1,components:1};case Wi:case Rl:case xn:return{byteLength:2,components:1};case La:case Ia:return{byteLength:2,components:4};case on:case Da:case nn:return{byteLength:4,components:1};case wl:case Cl:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Pa}}));typeof window<"u"&&(window.__THREE__?we("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Pa);function Kl(){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&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function eu(i){const e=new WeakMap;function t(o,c){const l=o.array,u=o.usage,m=l.byteLength,h=i.createBuffer();i.bindBuffer(c,h),i.bufferData(c,l,u),o.onUploadCallback();let d;if(l instanceof Float32Array)d=i.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)d=i.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?d=i.HALF_FLOAT:d=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)d=i.SHORT;else if(l instanceof Uint32Array)d=i.UNSIGNED_INT;else if(l instanceof Int32Array)d=i.INT;else if(l instanceof Int8Array)d=i.BYTE;else if(l instanceof Uint8Array)d=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)d=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:h,type:d,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:m}}function n(o,c,l){const u=c.array,m=c.updateRanges;if(i.bindBuffer(l,o),m.length===0)i.bufferSubData(l,0,u);else{m.sort((d,x)=>d.start-x.start);let h=0;for(let d=1;d<m.length;d++){const x=m[h],y=m[d];y.start<=x.start+x.count+1?x.count=Math.max(x.count,y.start+y.count-x.start):(++h,m[h]=y)}m.length=h+1;for(let d=0,x=m.length;d<x;d++){const y=m[d];i.bufferSubData(l,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(i.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){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 l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.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(l.buffer,o,c),l.version=o.version}}return{get:r,remove:s,update:a}}var tu=`#ifdef USE_ALPHAHASH
|
|
5
|
+
}`;class ln extends Ci{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=kh,this.fragmentShader=Wh,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=wi(e.uniforms),this.uniformsGroups=Vh(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,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}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Be().setHex(r.value);break;case"v2":this.uniforms[n].value=new Ce().fromArray(r.value);break;case"v3":this.uniforms[n].value=new D().fromArray(r.value);break;case"v4":this.uniforms[n].value=new ht().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Le().fromArray(r.value);break;case"m4":this.uniforms[n].value=new at().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class Xh extends ln{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Yh extends Ci{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=qc,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 qh extends Ci{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Mr=new D,Sr=new Bn,Qt=new D;class Yl extends Dt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new at,this.projectionMatrix=new at,this.projectionMatrixInverse=new at,this.coordinateSystem=rn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}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.matrixWorld.decompose(Mr,Sr,Qt),Qt.x===1&&Qt.y===1&&Qt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Mr,Sr,Qt.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Mr,Sr,Qt),Qt.x===1&&Qt.y===1&&Qt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Mr,Sr,Qt.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Pn=new D,Io=new Ce,Uo=new Ce;class Ht extends Yl{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=Ta*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Pr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ta*2*Math.atan(Math.tan(Pr*.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){Pn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Pn.x,Pn.y).multiplyScalar(-e/Pn.z),Pn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Pn.x,Pn.y).multiplyScalar(-e/Pn.z)}getViewSize(e,t){return this.getViewBounds(e,Io,Uo),t.subVectors(Uo,Io)}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(Pr*.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 c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*r/c,t-=a.offsetY*n/l,r*=a.width/c,n*=a.height/l}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.reversedDepth),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}}class ql extends Yl{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,c=r-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=u*this.view.offsetY,c=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),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}}const gi=-90,xi=1;class Kh extends Dt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ht(gi,xi,e,t);r.layers=this.layers,this.add(r);const s=new Ht(gi,xi,e,t);s.layers=this.layers,this.add(s);const a=new Ht(gi,xi,e,t);a.layers=this.layers,this.add(a);const o=new Ht(gi,xi,e,t);o.layers=this.layers,this.add(o);const c=new Ht(gi,xi,e,t);c.layers=this.layers,this.add(c);const l=new Ht(gi,xi,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,c]=t;for(const l of t)this.remove(l);if(e===rn)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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Fr)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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.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,c,l,u]=this.children,m=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let _=!1;e.isWebGLRenderer===!0?_=e.state.buffers.depth.getReversed():_=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,r),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=y,e.setRenderTarget(n,5,r),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(m,h,d),e.xr.enabled=x,n.texture.needsPMREMUpdate=!0}}class Zh extends Ht{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const No=new at;class $h{constructor(e,t,n=0,r=1/0){this.ray=new Xr(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Ga,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.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return No.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(No),this}intersectObject(e,t=!0,n=[]){return Aa(e,this,n,t),n.sort(Fo),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)Aa(e[r],this,n,t);return n.sort(Fo),n}}function Fo(i,e){return i.distance-e.distance}function Aa(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++)Aa(s[a],e,t,!0)}}class Oo{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=Oe(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(Oe(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const qa=class qa{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};qa.prototype.isMatrix2=!0;let Bo=qa;class Jh extends zn{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){we("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function zo(i,e,t,n){const r=Qh(n);switch(t){case Pl:return i*e;case Ll:return i*e/r.components*r.byteLength;case Ua:return i*e/r.components*r.byteLength;case Jn:return i*e*2/r.components*r.byteLength;case Na:return i*e*2/r.components*r.byteLength;case Dl:return i*e*3/r.components*r.byteLength;case Zt:return i*e*4/r.components*r.byteLength;case Fa:return i*e*4/r.components*r.byteLength;case Ar:case Rr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case wr:case Cr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Zs:case Js:return Math.max(i,16)*Math.max(e,8)/4;case Ks:case $s:return Math.max(i,8)*Math.max(e,8)/2;case Qs:case js:case ta:case na:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ea:case Lr:case ia:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ra:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case sa:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case aa:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case oa:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case la:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case ca:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case ha:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case ua:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case fa:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case da:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case pa:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case ma:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case _a:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case ga:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case xa:case va:case Ma:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Sa:case ya:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Ir:case Ea:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Qh(i){switch(i){case kt:case Al:return{byteLength:1,components:1};case Wi:case Rl:case xn:return{byteLength:2,components:1};case La:case Ia:return{byteLength:2,components:4};case on:case Da:case nn:return{byteLength:4,components:1};case wl:case Cl:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Pa}}));typeof window<"u"&&(window.__THREE__?we("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Pa);function Kl(){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&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function jh(i){const e=new WeakMap;function t(o,c){const l=o.array,u=o.usage,m=l.byteLength,h=i.createBuffer();i.bindBuffer(c,h),i.bufferData(c,l,u),o.onUploadCallback();let d;if(l instanceof Float32Array)d=i.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)d=i.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?d=i.HALF_FLOAT:d=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)d=i.SHORT;else if(l instanceof Uint32Array)d=i.UNSIGNED_INT;else if(l instanceof Int32Array)d=i.INT;else if(l instanceof Int8Array)d=i.BYTE;else if(l instanceof Uint8Array)d=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)d=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:h,type:d,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:m}}function n(o,c,l){const u=c.array,m=c.updateRanges;if(i.bindBuffer(l,o),m.length===0)i.bufferSubData(l,0,u);else{m.sort((d,x)=>d.start-x.start);let h=0;for(let d=1;d<m.length;d++){const x=m[h],y=m[d];y.start<=x.start+x.count+1?x.count=Math.max(x.count,y.start+y.count-x.start):(++h,m[h]=y)}m.length=h+1;for(let d=0,x=m.length;d<x;d++){const y=m[d];i.bufferSubData(l,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(i.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){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 l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.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(l.buffer,o,c),l.version=o.version}}return{get:r,remove:s,update:a}}var eu=`#ifdef USE_ALPHAHASH
|
|
6
6
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
7
|
-
#endif`,
|
|
7
|
+
#endif`,tu=`#ifdef USE_ALPHAHASH
|
|
8
8
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
9
9
|
float hash2D( vec2 value ) {
|
|
10
10
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -39,20 +39,20 @@ import{d as hc,s as Jr,y as uc,ao as fc,w as $i,K as dc,o as Qr,c as jr,C as pc,
|
|
|
39
39
|
: cases.z;
|
|
40
40
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
41
41
|
}
|
|
42
|
-
#endif`,
|
|
42
|
+
#endif`,nu=`#ifdef USE_ALPHAMAP
|
|
43
43
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
44
|
-
#endif`,
|
|
44
|
+
#endif`,iu=`#ifdef USE_ALPHAMAP
|
|
45
45
|
uniform sampler2D alphaMap;
|
|
46
|
-
#endif`,
|
|
46
|
+
#endif`,ru=`#ifdef USE_ALPHATEST
|
|
47
47
|
#ifdef ALPHA_TO_COVERAGE
|
|
48
48
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
49
49
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
50
50
|
#else
|
|
51
51
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
52
52
|
#endif
|
|
53
|
-
#endif`,
|
|
53
|
+
#endif`,su=`#ifdef USE_ALPHATEST
|
|
54
54
|
uniform float alphaTest;
|
|
55
|
-
#endif`,
|
|
55
|
+
#endif`,au=`#ifdef USE_AOMAP
|
|
56
56
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
57
57
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
58
58
|
#if defined( USE_CLEARCOAT )
|
|
@@ -65,10 +65,10 @@ import{d as hc,s as Jr,y as uc,ao as fc,w as $i,K as dc,o as Qr,c as jr,C as pc,
|
|
|
65
65
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
66
66
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
67
67
|
#endif
|
|
68
|
-
#endif`,
|
|
68
|
+
#endif`,ou=`#ifdef USE_AOMAP
|
|
69
69
|
uniform sampler2D aoMap;
|
|
70
70
|
uniform float aoMapIntensity;
|
|
71
|
-
#endif`,
|
|
71
|
+
#endif`,lu=`#ifdef USE_BATCHING
|
|
72
72
|
#if ! defined( GL_ANGLE_multi_draw )
|
|
73
73
|
#define gl_DrawID _gl_DrawID
|
|
74
74
|
uniform int _gl_DrawID;
|
|
@@ -102,15 +102,15 @@ import{d as hc,s as Jr,y as uc,ao as fc,w as $i,K as dc,o as Qr,c as jr,C as pc,
|
|
|
102
102
|
int y = j / size;
|
|
103
103
|
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
|
|
104
104
|
}
|
|
105
|
-
#endif`,
|
|
105
|
+
#endif`,cu=`#ifdef USE_BATCHING
|
|
106
106
|
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
107
|
-
#endif`,
|
|
107
|
+
#endif`,hu=`vec3 transformed = vec3( position );
|
|
108
108
|
#ifdef USE_ALPHAHASH
|
|
109
109
|
vPosition = vec3( position );
|
|
110
|
-
#endif`,
|
|
110
|
+
#endif`,uu=`vec3 objectNormal = vec3( normal );
|
|
111
111
|
#ifdef USE_TANGENT
|
|
112
112
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
113
|
-
#endif`,
|
|
113
|
+
#endif`,fu=`float G_BlinnPhong_Implicit( ) {
|
|
114
114
|
return 0.25;
|
|
115
115
|
}
|
|
116
116
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -124,7 +124,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
124
124
|
float G = G_BlinnPhong_Implicit( );
|
|
125
125
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
126
126
|
return F * ( G * D );
|
|
127
|
-
} // validated`,
|
|
127
|
+
} // validated`,du=`#ifdef USE_IRIDESCENCE
|
|
128
128
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
129
129
|
3.2404542, -0.9692660, 0.0556434,
|
|
130
130
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -187,7 +187,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
187
187
|
}
|
|
188
188
|
return max( I, vec3( 0.0 ) );
|
|
189
189
|
}
|
|
190
|
-
#endif`,
|
|
190
|
+
#endif`,pu=`#ifdef USE_BUMPMAP
|
|
191
191
|
uniform sampler2D bumpMap;
|
|
192
192
|
uniform float bumpScale;
|
|
193
193
|
vec2 dHdxy_fwd() {
|
|
@@ -208,7 +208,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
208
208
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
209
209
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
210
210
|
}
|
|
211
|
-
#endif`,
|
|
211
|
+
#endif`,mu=`#if NUM_CLIPPING_PLANES > 0
|
|
212
212
|
vec4 plane;
|
|
213
213
|
#ifdef ALPHA_TO_COVERAGE
|
|
214
214
|
float distanceToPlane, distanceGradient;
|
|
@@ -257,17 +257,17 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
257
257
|
#endif`,_u=`#if NUM_CLIPPING_PLANES > 0
|
|
258
258
|
varying vec3 vClipPosition;
|
|
259
259
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
260
|
-
#endif`,
|
|
260
|
+
#endif`,gu=`#if NUM_CLIPPING_PLANES > 0
|
|
261
261
|
varying vec3 vClipPosition;
|
|
262
|
-
#endif`,
|
|
262
|
+
#endif`,xu=`#if NUM_CLIPPING_PLANES > 0
|
|
263
263
|
vClipPosition = - mvPosition.xyz;
|
|
264
|
-
#endif`,
|
|
264
|
+
#endif`,vu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
265
265
|
diffuseColor *= vColor;
|
|
266
|
-
#endif`,
|
|
266
|
+
#endif`,Mu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
267
267
|
varying vec4 vColor;
|
|
268
|
-
#endif`,
|
|
268
|
+
#endif`,Su=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
269
269
|
varying vec4 vColor;
|
|
270
|
-
#endif`,
|
|
270
|
+
#endif`,yu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
271
271
|
vColor = vec4( 1.0 );
|
|
272
272
|
#endif
|
|
273
273
|
#ifdef USE_COLOR_ALPHA
|
|
@@ -280,7 +280,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
280
280
|
#endif
|
|
281
281
|
#ifdef USE_BATCHING_COLOR
|
|
282
282
|
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
283
|
-
#endif`,
|
|
283
|
+
#endif`,Eu=`#define PI 3.141592653589793
|
|
284
284
|
#define PI2 6.283185307179586
|
|
285
285
|
#define PI_HALF 1.5707963267948966
|
|
286
286
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -351,7 +351,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
351
351
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
352
352
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
353
353
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
354
|
-
} // validated`,
|
|
354
|
+
} // validated`,bu=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
355
355
|
#define cubeUV_minMipLevel 4.0
|
|
356
356
|
#define cubeUV_minTileSize 16.0
|
|
357
357
|
float getFace( vec3 direction ) {
|
|
@@ -444,7 +444,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
|
444
444
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
#endif`,
|
|
447
|
+
#endif`,Tu=`vec3 transformedNormal = objectNormal;
|
|
448
448
|
#ifdef USE_TANGENT
|
|
449
449
|
vec3 transformedTangent = objectTangent;
|
|
450
450
|
#endif
|
|
@@ -470,21 +470,21 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
470
470
|
#endif
|
|
471
471
|
#ifdef USE_TANGENT
|
|
472
472
|
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
|
473
|
-
#endif`,
|
|
473
|
+
#endif`,Au=`#ifdef USE_DISPLACEMENTMAP
|
|
474
474
|
uniform sampler2D displacementMap;
|
|
475
475
|
uniform float displacementScale;
|
|
476
476
|
uniform float displacementBias;
|
|
477
|
-
#endif`,
|
|
477
|
+
#endif`,Ru=`#ifdef USE_DISPLACEMENTMAP
|
|
478
478
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
479
|
-
#endif`,
|
|
479
|
+
#endif`,wu=`#ifdef USE_EMISSIVEMAP
|
|
480
480
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
481
481
|
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
482
482
|
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
483
483
|
#endif
|
|
484
484
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
485
|
-
#endif`,
|
|
485
|
+
#endif`,Cu=`#ifdef USE_EMISSIVEMAP
|
|
486
486
|
uniform sampler2D emissiveMap;
|
|
487
|
-
#endif`,
|
|
487
|
+
#endif`,Pu="gl_FragColor = linearToOutputTexel( gl_FragColor );",Du=`vec4 LinearTransferOETF( in vec4 value ) {
|
|
488
488
|
return value;
|
|
489
489
|
}
|
|
490
490
|
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
@@ -492,7 +492,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
|
492
492
|
}
|
|
493
493
|
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
494
494
|
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 );
|
|
495
|
-
}`,
|
|
495
|
+
}`,Lu=`#ifdef USE_ENVMAP
|
|
496
496
|
#ifdef ENV_WORLDPOS
|
|
497
497
|
vec3 cameraToFrag;
|
|
498
498
|
if ( isOrthographic ) {
|
|
@@ -519,7 +519,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
519
519
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
520
520
|
#endif
|
|
521
521
|
#endif
|
|
522
|
-
#endif`,
|
|
522
|
+
#endif`,Iu=`#ifdef USE_ENVMAP
|
|
523
523
|
uniform float envMapIntensity;
|
|
524
524
|
uniform mat3 envMapRotation;
|
|
525
525
|
#ifdef ENVMAP_TYPE_CUBE
|
|
@@ -527,7 +527,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
527
527
|
#else
|
|
528
528
|
uniform sampler2D envMap;
|
|
529
529
|
#endif
|
|
530
|
-
#endif`,
|
|
530
|
+
#endif`,Uu=`#ifdef USE_ENVMAP
|
|
531
531
|
uniform float reflectivity;
|
|
532
532
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
533
533
|
#define ENV_WORLDPOS
|
|
@@ -538,7 +538,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
538
538
|
#else
|
|
539
539
|
varying vec3 vReflect;
|
|
540
540
|
#endif
|
|
541
|
-
#endif`,
|
|
541
|
+
#endif`,Nu=`#ifdef USE_ENVMAP
|
|
542
542
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
543
543
|
#define ENV_WORLDPOS
|
|
544
544
|
#endif
|
|
@@ -549,7 +549,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
549
549
|
varying vec3 vReflect;
|
|
550
550
|
uniform float refractionRatio;
|
|
551
551
|
#endif
|
|
552
|
-
#endif`,
|
|
552
|
+
#endif`,Fu=`#ifdef USE_ENVMAP
|
|
553
553
|
#ifdef ENV_WORLDPOS
|
|
554
554
|
vWorldPosition = worldPosition.xyz;
|
|
555
555
|
#else
|
|
@@ -566,18 +566,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
566
566
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
567
567
|
#endif
|
|
568
568
|
#endif
|
|
569
|
-
#endif`,
|
|
569
|
+
#endif`,Ou=`#ifdef USE_FOG
|
|
570
570
|
vFogDepth = - mvPosition.z;
|
|
571
|
-
#endif`,
|
|
571
|
+
#endif`,Bu=`#ifdef USE_FOG
|
|
572
572
|
varying float vFogDepth;
|
|
573
|
-
#endif`,
|
|
573
|
+
#endif`,zu=`#ifdef USE_FOG
|
|
574
574
|
#ifdef FOG_EXP2
|
|
575
575
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
576
576
|
#else
|
|
577
577
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
578
578
|
#endif
|
|
579
579
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
580
|
-
#endif`,
|
|
580
|
+
#endif`,Gu=`#ifdef USE_FOG
|
|
581
581
|
uniform vec3 fogColor;
|
|
582
582
|
varying float vFogDepth;
|
|
583
583
|
#ifdef FOG_EXP2
|
|
@@ -586,7 +586,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
586
586
|
uniform float fogNear;
|
|
587
587
|
uniform float fogFar;
|
|
588
588
|
#endif
|
|
589
|
-
#endif`,
|
|
589
|
+
#endif`,Vu=`#ifdef USE_GRADIENTMAP
|
|
590
590
|
uniform sampler2D gradientMap;
|
|
591
591
|
#endif
|
|
592
592
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -598,12 +598,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
598
598
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
599
599
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
600
600
|
#endif
|
|
601
|
-
}`,
|
|
601
|
+
}`,Hu=`#ifdef USE_LIGHTMAP
|
|
602
602
|
uniform sampler2D lightMap;
|
|
603
603
|
uniform float lightMapIntensity;
|
|
604
|
-
#endif`,
|
|
604
|
+
#endif`,ku=`LambertMaterial material;
|
|
605
605
|
material.diffuseColor = diffuseColor.rgb;
|
|
606
|
-
material.specularStrength = specularStrength;`,
|
|
606
|
+
material.specularStrength = specularStrength;`,Wu=`varying vec3 vViewPosition;
|
|
607
607
|
struct LambertMaterial {
|
|
608
608
|
vec3 diffuseColor;
|
|
609
609
|
float specularStrength;
|
|
@@ -617,7 +617,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
|
|
|
617
617
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
618
618
|
}
|
|
619
619
|
#define RE_Direct RE_Direct_Lambert
|
|
620
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,
|
|
620
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Xu=`uniform bool receiveShadow;
|
|
621
621
|
uniform vec3 ambientLightColor;
|
|
622
622
|
#if defined( USE_LIGHT_PROBES )
|
|
623
623
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -734,7 +734,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
734
734
|
return irradiance;
|
|
735
735
|
}
|
|
736
736
|
#endif
|
|
737
|
-
#include <lightprobes_pars_fragment>`,
|
|
737
|
+
#include <lightprobes_pars_fragment>`,Yu=`#ifdef USE_ENVMAP
|
|
738
738
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
739
739
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
740
740
|
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
|
|
@@ -767,8 +767,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
767
767
|
#endif
|
|
768
768
|
}
|
|
769
769
|
#endif
|
|
770
|
-
#endif`,
|
|
771
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
770
|
+
#endif`,qu=`ToonMaterial material;
|
|
771
|
+
material.diffuseColor = diffuseColor.rgb;`,Ku=`varying vec3 vViewPosition;
|
|
772
772
|
struct ToonMaterial {
|
|
773
773
|
vec3 diffuseColor;
|
|
774
774
|
};
|
|
@@ -780,11 +780,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
780
780
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
781
781
|
}
|
|
782
782
|
#define RE_Direct RE_Direct_Toon
|
|
783
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
|
|
783
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Zu=`BlinnPhongMaterial material;
|
|
784
784
|
material.diffuseColor = diffuseColor.rgb;
|
|
785
785
|
material.specularColor = specular;
|
|
786
786
|
material.specularShininess = shininess;
|
|
787
|
-
material.specularStrength = specularStrength
|
|
787
|
+
material.specularStrength = specularStrength;`,$u=`varying vec3 vViewPosition;
|
|
788
788
|
struct BlinnPhongMaterial {
|
|
789
789
|
vec3 diffuseColor;
|
|
790
790
|
vec3 specularColor;
|
|
@@ -801,7 +801,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
801
801
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
802
802
|
}
|
|
803
803
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
804
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,
|
|
804
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Ju=`PhysicalMaterial material;
|
|
805
805
|
material.diffuseColor = diffuseColor.rgb;
|
|
806
806
|
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
807
807
|
material.metalness = metalnessFactor;
|
|
@@ -891,7 +891,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
891
891
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
892
892
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
893
893
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
894
|
-
#endif`,
|
|
894
|
+
#endif`,Qu=`uniform sampler2D dfgLUT;
|
|
895
895
|
struct PhysicalMaterial {
|
|
896
896
|
vec3 diffuseColor;
|
|
897
897
|
vec3 diffuseContribution;
|
|
@@ -1251,7 +1251,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1251
1251
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1252
1252
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1253
1253
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1254
|
-
}`,
|
|
1254
|
+
}`,ju=`
|
|
1255
1255
|
vec3 geometryPosition = - vViewPosition;
|
|
1256
1256
|
vec3 geometryNormal = normal;
|
|
1257
1257
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1373,7 +1373,7 @@ IncidentLight directLight;
|
|
|
1373
1373
|
#if defined( RE_IndirectSpecular )
|
|
1374
1374
|
vec3 radiance = vec3( 0.0 );
|
|
1375
1375
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1376
|
-
#endif`,
|
|
1376
|
+
#endif`,ef=`#if defined( RE_IndirectDiffuse )
|
|
1377
1377
|
#ifdef USE_LIGHTMAP
|
|
1378
1378
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1379
1379
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1394,7 +1394,7 @@ IncidentLight directLight;
|
|
|
1394
1394
|
#ifdef USE_CLEARCOAT
|
|
1395
1395
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1396
1396
|
#endif
|
|
1397
|
-
#endif`,
|
|
1397
|
+
#endif`,tf=`#if defined( RE_IndirectDiffuse )
|
|
1398
1398
|
#if defined( LAMBERT ) || defined( PHONG )
|
|
1399
1399
|
irradiance += iblIrradiance;
|
|
1400
1400
|
#endif
|
|
@@ -1402,7 +1402,7 @@ IncidentLight directLight;
|
|
|
1402
1402
|
#endif
|
|
1403
1403
|
#if defined( RE_IndirectSpecular )
|
|
1404
1404
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1405
|
-
#endif`,
|
|
1405
|
+
#endif`,nf=`#ifdef USE_LIGHT_PROBES_GRID
|
|
1406
1406
|
uniform highp sampler3D probesSH;
|
|
1407
1407
|
uniform vec3 probesMin;
|
|
1408
1408
|
uniform vec3 probesMax;
|
|
@@ -1447,27 +1447,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1447
1447
|
result += c8 * 0.429043 * ( x * x - y * y );
|
|
1448
1448
|
return max( result, vec3( 0.0 ) );
|
|
1449
1449
|
}
|
|
1450
|
-
#endif`,
|
|
1450
|
+
#endif`,rf=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1451
1451
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1452
|
-
#endif`,
|
|
1452
|
+
#endif`,sf=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1453
1453
|
uniform float logDepthBufFC;
|
|
1454
1454
|
varying float vFragDepth;
|
|
1455
1455
|
varying float vIsPerspective;
|
|
1456
|
-
#endif`,
|
|
1456
|
+
#endif`,af=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1457
1457
|
varying float vFragDepth;
|
|
1458
1458
|
varying float vIsPerspective;
|
|
1459
|
-
#endif`,
|
|
1459
|
+
#endif`,of=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1460
1460
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1461
1461
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1462
|
-
#endif`,
|
|
1462
|
+
#endif`,lf=`#ifdef USE_MAP
|
|
1463
1463
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1464
1464
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1465
1465
|
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
1466
1466
|
#endif
|
|
1467
1467
|
diffuseColor *= sampledDiffuseColor;
|
|
1468
|
-
#endif`,
|
|
1468
|
+
#endif`,cf=`#ifdef USE_MAP
|
|
1469
1469
|
uniform sampler2D map;
|
|
1470
|
-
#endif`,
|
|
1470
|
+
#endif`,hf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1471
1471
|
#if defined( USE_POINTS_UV )
|
|
1472
1472
|
vec2 uv = vUv;
|
|
1473
1473
|
#else
|
|
@@ -1479,7 +1479,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1479
1479
|
#endif
|
|
1480
1480
|
#ifdef USE_ALPHAMAP
|
|
1481
1481
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1482
|
-
#endif`,
|
|
1482
|
+
#endif`,uf=`#if defined( USE_POINTS_UV )
|
|
1483
1483
|
varying vec2 vUv;
|
|
1484
1484
|
#else
|
|
1485
1485
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1491,19 +1491,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1491
1491
|
#endif
|
|
1492
1492
|
#ifdef USE_ALPHAMAP
|
|
1493
1493
|
uniform sampler2D alphaMap;
|
|
1494
|
-
#endif`,
|
|
1494
|
+
#endif`,ff=`float metalnessFactor = metalness;
|
|
1495
1495
|
#ifdef USE_METALNESSMAP
|
|
1496
1496
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1497
1497
|
metalnessFactor *= texelMetalness.b;
|
|
1498
|
-
#endif`,
|
|
1498
|
+
#endif`,df=`#ifdef USE_METALNESSMAP
|
|
1499
1499
|
uniform sampler2D metalnessMap;
|
|
1500
|
-
#endif`,
|
|
1500
|
+
#endif`,pf=`#ifdef USE_INSTANCING_MORPH
|
|
1501
1501
|
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1502
1502
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1503
1503
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1504
1504
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1505
1505
|
}
|
|
1506
|
-
#endif`,
|
|
1506
|
+
#endif`,mf=`#if defined( USE_MORPHCOLORS )
|
|
1507
1507
|
vColor *= morphTargetBaseInfluence;
|
|
1508
1508
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1509
1509
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -1517,7 +1517,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1517
1517
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1518
1518
|
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1519
1519
|
}
|
|
1520
|
-
#endif`,
|
|
1520
|
+
#endif`,gf=`#ifdef USE_MORPHTARGETS
|
|
1521
1521
|
#ifndef USE_INSTANCING_MORPH
|
|
1522
1522
|
uniform float morphTargetBaseInfluence;
|
|
1523
1523
|
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
@@ -1531,12 +1531,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1531
1531
|
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1532
1532
|
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1533
1533
|
}
|
|
1534
|
-
#endif`,
|
|
1534
|
+
#endif`,xf=`#ifdef USE_MORPHTARGETS
|
|
1535
1535
|
transformed *= morphTargetBaseInfluence;
|
|
1536
1536
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1537
1537
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1538
1538
|
}
|
|
1539
|
-
#endif`,
|
|
1539
|
+
#endif`,vf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1540
1540
|
#ifdef FLAT_SHADED
|
|
1541
1541
|
vec3 fdx = dFdx( vViewPosition );
|
|
1542
1542
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -1577,7 +1577,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1577
1577
|
tbn2[1] *= faceDirection;
|
|
1578
1578
|
#endif
|
|
1579
1579
|
#endif
|
|
1580
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
1580
|
+
vec3 nonPerturbedNormal = normal;`,Mf=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1581
1581
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1582
1582
|
#ifdef FLIP_SIDED
|
|
1583
1583
|
normal = - normal;
|
|
@@ -1595,19 +1595,19 @@ vec3 nonPerturbedNormal = normal;`,Sf=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1595
1595
|
normal = normalize( tbn * mapN );
|
|
1596
1596
|
#elif defined( USE_BUMPMAP )
|
|
1597
1597
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1598
|
-
#endif`,
|
|
1598
|
+
#endif`,Sf=`#ifndef FLAT_SHADED
|
|
1599
1599
|
varying vec3 vNormal;
|
|
1600
1600
|
#ifdef USE_TANGENT
|
|
1601
1601
|
varying vec3 vTangent;
|
|
1602
1602
|
varying vec3 vBitangent;
|
|
1603
1603
|
#endif
|
|
1604
|
-
#endif`,
|
|
1604
|
+
#endif`,yf=`#ifndef FLAT_SHADED
|
|
1605
1605
|
varying vec3 vNormal;
|
|
1606
1606
|
#ifdef USE_TANGENT
|
|
1607
1607
|
varying vec3 vTangent;
|
|
1608
1608
|
varying vec3 vBitangent;
|
|
1609
1609
|
#endif
|
|
1610
|
-
#endif`,
|
|
1610
|
+
#endif`,Ef=`#ifndef FLAT_SHADED
|
|
1611
1611
|
vNormal = normalize( transformedNormal );
|
|
1612
1612
|
#ifdef USE_TANGENT
|
|
1613
1613
|
vTangent = normalize( transformedTangent );
|
|
@@ -1616,7 +1616,7 @@ vec3 nonPerturbedNormal = normal;`,Sf=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1616
1616
|
vBitangent = - vBitangent;
|
|
1617
1617
|
#endif
|
|
1618
1618
|
#endif
|
|
1619
|
-
#endif`,
|
|
1619
|
+
#endif`,bf=`#ifdef USE_NORMALMAP
|
|
1620
1620
|
uniform sampler2D normalMap;
|
|
1621
1621
|
uniform vec2 normalScale;
|
|
1622
1622
|
#endif
|
|
@@ -1638,13 +1638,13 @@ vec3 nonPerturbedNormal = normal;`,Sf=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1638
1638
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1639
1639
|
return mat3( T * scale, B * scale, N );
|
|
1640
1640
|
}
|
|
1641
|
-
#endif`,
|
|
1641
|
+
#endif`,Tf=`#ifdef USE_CLEARCOAT
|
|
1642
1642
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1643
|
-
#endif`,
|
|
1643
|
+
#endif`,Af=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1644
1644
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1645
1645
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1646
1646
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1647
|
-
#endif`,
|
|
1647
|
+
#endif`,Rf=`#ifdef USE_CLEARCOATMAP
|
|
1648
1648
|
uniform sampler2D clearcoatMap;
|
|
1649
1649
|
#endif
|
|
1650
1650
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1653,18 +1653,18 @@ vec3 nonPerturbedNormal = normal;`,Sf=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1653
1653
|
#endif
|
|
1654
1654
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1655
1655
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1656
|
-
#endif`,
|
|
1656
|
+
#endif`,wf=`#ifdef USE_IRIDESCENCEMAP
|
|
1657
1657
|
uniform sampler2D iridescenceMap;
|
|
1658
1658
|
#endif
|
|
1659
1659
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1660
1660
|
uniform sampler2D iridescenceThicknessMap;
|
|
1661
|
-
#endif`,
|
|
1661
|
+
#endif`,Cf=`#ifdef OPAQUE
|
|
1662
1662
|
diffuseColor.a = 1.0;
|
|
1663
1663
|
#endif
|
|
1664
1664
|
#ifdef USE_TRANSMISSION
|
|
1665
1665
|
diffuseColor.a *= material.transmissionAlpha;
|
|
1666
1666
|
#endif
|
|
1667
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
1667
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Pf=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1668
1668
|
return normalize( normal ) * 0.5 + 0.5;
|
|
1669
1669
|
}
|
|
1670
1670
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -1743,9 +1743,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1743
1743
|
#else
|
|
1744
1744
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1745
1745
|
#endif
|
|
1746
|
-
}`,
|
|
1746
|
+
}`,Df=`#ifdef PREMULTIPLIED_ALPHA
|
|
1747
1747
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1748
|
-
#endif`,
|
|
1748
|
+
#endif`,Lf=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1749
1749
|
#ifdef USE_BATCHING
|
|
1750
1750
|
mvPosition = batchingMatrix * mvPosition;
|
|
1751
1751
|
#endif
|
|
@@ -1753,22 +1753,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1753
1753
|
mvPosition = instanceMatrix * mvPosition;
|
|
1754
1754
|
#endif
|
|
1755
1755
|
mvPosition = modelViewMatrix * mvPosition;
|
|
1756
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
1756
|
+
gl_Position = projectionMatrix * mvPosition;`,If=`#ifdef DITHERING
|
|
1757
1757
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1758
|
-
#endif`,
|
|
1758
|
+
#endif`,Uf=`#ifdef DITHERING
|
|
1759
1759
|
vec3 dithering( vec3 color ) {
|
|
1760
1760
|
float grid_position = rand( gl_FragCoord.xy );
|
|
1761
1761
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1762
1762
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1763
1763
|
return color + dither_shift_RGB;
|
|
1764
1764
|
}
|
|
1765
|
-
#endif`,
|
|
1765
|
+
#endif`,Nf=`float roughnessFactor = roughness;
|
|
1766
1766
|
#ifdef USE_ROUGHNESSMAP
|
|
1767
1767
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1768
1768
|
roughnessFactor *= texelRoughness.g;
|
|
1769
|
-
#endif`,
|
|
1769
|
+
#endif`,Ff=`#ifdef USE_ROUGHNESSMAP
|
|
1770
1770
|
uniform sampler2D roughnessMap;
|
|
1771
|
-
#endif`,
|
|
1771
|
+
#endif`,Of=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1772
1772
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1773
1773
|
#endif
|
|
1774
1774
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -1968,7 +1968,7 @@ gl_Position = projectionMatrix * mvPosition;`,Uf=`#ifdef DITHERING
|
|
|
1968
1968
|
}
|
|
1969
1969
|
#endif
|
|
1970
1970
|
#endif
|
|
1971
|
-
#endif`,
|
|
1971
|
+
#endif`,Bf=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1972
1972
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1973
1973
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1974
1974
|
#endif
|
|
@@ -2009,7 +2009,7 @@ gl_Position = projectionMatrix * mvPosition;`,Uf=`#ifdef DITHERING
|
|
|
2009
2009
|
};
|
|
2010
2010
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
2011
2011
|
#endif
|
|
2012
|
-
#endif`,
|
|
2012
|
+
#endif`,zf=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
2013
2013
|
#ifdef HAS_NORMAL
|
|
2014
2014
|
vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
|
|
2015
2015
|
#else
|
|
@@ -2045,7 +2045,7 @@ gl_Position = projectionMatrix * mvPosition;`,Uf=`#ifdef DITHERING
|
|
|
2045
2045
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
2046
2046
|
}
|
|
2047
2047
|
#pragma unroll_loop_end
|
|
2048
|
-
#endif`,
|
|
2048
|
+
#endif`,Gf=`float getShadowMask() {
|
|
2049
2049
|
float shadow = 1.0;
|
|
2050
2050
|
#ifdef USE_SHADOWMAP
|
|
2051
2051
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
@@ -2077,12 +2077,12 @@ gl_Position = projectionMatrix * mvPosition;`,Uf=`#ifdef DITHERING
|
|
|
2077
2077
|
#endif
|
|
2078
2078
|
#endif
|
|
2079
2079
|
return shadow;
|
|
2080
|
-
}`,
|
|
2080
|
+
}`,Vf=`#ifdef USE_SKINNING
|
|
2081
2081
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
2082
2082
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
2083
2083
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
2084
2084
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
2085
|
-
#endif`,
|
|
2085
|
+
#endif`,Hf=`#ifdef USE_SKINNING
|
|
2086
2086
|
uniform mat4 bindMatrix;
|
|
2087
2087
|
uniform mat4 bindMatrixInverse;
|
|
2088
2088
|
uniform highp sampler2D boneTexture;
|
|
@@ -2097,7 +2097,7 @@ gl_Position = projectionMatrix * mvPosition;`,Uf=`#ifdef DITHERING
|
|
|
2097
2097
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2098
2098
|
return mat4( v1, v2, v3, v4 );
|
|
2099
2099
|
}
|
|
2100
|
-
#endif`,
|
|
2100
|
+
#endif`,kf=`#ifdef USE_SKINNING
|
|
2101
2101
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2102
2102
|
vec4 skinned = vec4( 0.0 );
|
|
2103
2103
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2105,7 +2105,7 @@ gl_Position = projectionMatrix * mvPosition;`,Uf=`#ifdef DITHERING
|
|
|
2105
2105
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2106
2106
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2107
2107
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2108
|
-
#endif`,
|
|
2108
|
+
#endif`,Wf=`#ifdef USE_SKINNING
|
|
2109
2109
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2110
2110
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2111
2111
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2116,17 +2116,17 @@ gl_Position = projectionMatrix * mvPosition;`,Uf=`#ifdef DITHERING
|
|
|
2116
2116
|
#ifdef USE_TANGENT
|
|
2117
2117
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2118
2118
|
#endif
|
|
2119
|
-
#endif`,
|
|
2119
|
+
#endif`,Xf=`float specularStrength;
|
|
2120
2120
|
#ifdef USE_SPECULARMAP
|
|
2121
2121
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2122
2122
|
specularStrength = texelSpecular.r;
|
|
2123
2123
|
#else
|
|
2124
2124
|
specularStrength = 1.0;
|
|
2125
|
-
#endif`,
|
|
2125
|
+
#endif`,Yf=`#ifdef USE_SPECULARMAP
|
|
2126
2126
|
uniform sampler2D specularMap;
|
|
2127
|
-
#endif`,
|
|
2127
|
+
#endif`,qf=`#if defined( TONE_MAPPING )
|
|
2128
2128
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2129
|
-
#endif`,
|
|
2129
|
+
#endif`,Kf=`#ifndef saturate
|
|
2130
2130
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2131
2131
|
#endif
|
|
2132
2132
|
uniform float toneMappingExposure;
|
|
@@ -2223,7 +2223,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2223
2223
|
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2224
2224
|
return mix( color, vec3( newPeak ), g );
|
|
2225
2225
|
}
|
|
2226
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }
|
|
2226
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,Zf=`#ifdef USE_TRANSMISSION
|
|
2227
2227
|
material.transmission = transmission;
|
|
2228
2228
|
material.transmissionAlpha = 1.0;
|
|
2229
2229
|
material.thickness = thickness;
|
|
@@ -2244,7 +2244,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,$f=`#ifdef USE_TRANSMISS
|
|
|
2244
2244
|
material.attenuationColor, material.attenuationDistance );
|
|
2245
2245
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2246
2246
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2247
|
-
#endif
|
|
2247
|
+
#endif`,$f=`#ifdef USE_TRANSMISSION
|
|
2248
2248
|
uniform float transmission;
|
|
2249
2249
|
uniform float thickness;
|
|
2250
2250
|
uniform float attenuationDistance;
|
|
@@ -2370,7 +2370,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,$f=`#ifdef USE_TRANSMISS
|
|
|
2370
2370
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2371
2371
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2372
2372
|
}
|
|
2373
|
-
#endif`,
|
|
2373
|
+
#endif`,Jf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2374
2374
|
varying vec2 vUv;
|
|
2375
2375
|
#endif
|
|
2376
2376
|
#ifdef USE_MAP
|
|
@@ -2440,7 +2440,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,$f=`#ifdef USE_TRANSMISS
|
|
|
2440
2440
|
#ifdef USE_THICKNESSMAP
|
|
2441
2441
|
uniform mat3 thicknessMapTransform;
|
|
2442
2442
|
varying vec2 vThicknessMapUv;
|
|
2443
|
-
#endif`,
|
|
2443
|
+
#endif`,Qf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2444
2444
|
varying vec2 vUv;
|
|
2445
2445
|
#endif
|
|
2446
2446
|
#ifdef USE_MAP
|
|
@@ -2534,7 +2534,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,$f=`#ifdef USE_TRANSMISS
|
|
|
2534
2534
|
#ifdef USE_THICKNESSMAP
|
|
2535
2535
|
uniform mat3 thicknessMapTransform;
|
|
2536
2536
|
varying vec2 vThicknessMapUv;
|
|
2537
|
-
#endif`,
|
|
2537
|
+
#endif`,jf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2538
2538
|
vUv = vec3( uv, 1 ).xy;
|
|
2539
2539
|
#endif
|
|
2540
2540
|
#ifdef USE_MAP
|
|
@@ -2605,7 +2605,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,$f=`#ifdef USE_TRANSMISS
|
|
|
2605
2605
|
#endif
|
|
2606
2606
|
#ifdef USE_THICKNESSMAP
|
|
2607
2607
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2608
|
-
#endif`,
|
|
2608
|
+
#endif`,ed=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2609
2609
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2610
2610
|
#ifdef USE_BATCHING
|
|
2611
2611
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -2614,12 +2614,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,$f=`#ifdef USE_TRANSMISS
|
|
|
2614
2614
|
worldPosition = instanceMatrix * worldPosition;
|
|
2615
2615
|
#endif
|
|
2616
2616
|
worldPosition = modelMatrix * worldPosition;
|
|
2617
|
-
#endif`;const
|
|
2617
|
+
#endif`;const td=`varying vec2 vUv;
|
|
2618
2618
|
uniform mat3 uvTransform;
|
|
2619
2619
|
void main() {
|
|
2620
2620
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2621
2621
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2622
|
-
}`,
|
|
2622
|
+
}`,nd=`uniform sampler2D t2D;
|
|
2623
2623
|
uniform float backgroundIntensity;
|
|
2624
2624
|
varying vec2 vUv;
|
|
2625
2625
|
void main() {
|
|
@@ -2631,14 +2631,14 @@ void main() {
|
|
|
2631
2631
|
gl_FragColor = texColor;
|
|
2632
2632
|
#include <tonemapping_fragment>
|
|
2633
2633
|
#include <colorspace_fragment>
|
|
2634
|
-
}`,
|
|
2634
|
+
}`,id=`varying vec3 vWorldDirection;
|
|
2635
2635
|
#include <common>
|
|
2636
2636
|
void main() {
|
|
2637
2637
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2638
2638
|
#include <begin_vertex>
|
|
2639
2639
|
#include <project_vertex>
|
|
2640
2640
|
gl_Position.z = gl_Position.w;
|
|
2641
|
-
}`,
|
|
2641
|
+
}`,rd=`#ifdef ENVMAP_TYPE_CUBE
|
|
2642
2642
|
uniform samplerCube envMap;
|
|
2643
2643
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2644
2644
|
uniform sampler2D envMap;
|
|
@@ -2660,14 +2660,14 @@ void main() {
|
|
|
2660
2660
|
gl_FragColor = texColor;
|
|
2661
2661
|
#include <tonemapping_fragment>
|
|
2662
2662
|
#include <colorspace_fragment>
|
|
2663
|
-
}`,
|
|
2663
|
+
}`,sd=`varying vec3 vWorldDirection;
|
|
2664
2664
|
#include <common>
|
|
2665
2665
|
void main() {
|
|
2666
2666
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2667
2667
|
#include <begin_vertex>
|
|
2668
2668
|
#include <project_vertex>
|
|
2669
2669
|
gl_Position.z = gl_Position.w;
|
|
2670
|
-
}`,
|
|
2670
|
+
}`,ad=`uniform samplerCube tCube;
|
|
2671
2671
|
uniform float tFlip;
|
|
2672
2672
|
uniform float opacity;
|
|
2673
2673
|
varying vec3 vWorldDirection;
|
|
@@ -2677,7 +2677,7 @@ void main() {
|
|
|
2677
2677
|
gl_FragColor.a *= opacity;
|
|
2678
2678
|
#include <tonemapping_fragment>
|
|
2679
2679
|
#include <colorspace_fragment>
|
|
2680
|
-
}`,
|
|
2680
|
+
}`,od=`#include <common>
|
|
2681
2681
|
#include <batching_pars_vertex>
|
|
2682
2682
|
#include <uv_pars_vertex>
|
|
2683
2683
|
#include <displacementmap_pars_vertex>
|
|
@@ -2704,7 +2704,7 @@ void main() {
|
|
|
2704
2704
|
#include <logdepthbuf_vertex>
|
|
2705
2705
|
#include <clipping_planes_vertex>
|
|
2706
2706
|
vHighPrecisionZW = gl_Position.zw;
|
|
2707
|
-
}`,
|
|
2707
|
+
}`,ld=`#if DEPTH_PACKING == 3200
|
|
2708
2708
|
uniform float opacity;
|
|
2709
2709
|
#endif
|
|
2710
2710
|
#include <common>
|
|
@@ -2742,7 +2742,7 @@ void main() {
|
|
|
2742
2742
|
#elif DEPTH_PACKING == 3203
|
|
2743
2743
|
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
|
2744
2744
|
#endif
|
|
2745
|
-
}`,
|
|
2745
|
+
}`,cd=`#define DISTANCE
|
|
2746
2746
|
varying vec3 vWorldPosition;
|
|
2747
2747
|
#include <common>
|
|
2748
2748
|
#include <batching_pars_vertex>
|
|
@@ -2769,7 +2769,7 @@ void main() {
|
|
|
2769
2769
|
#include <worldpos_vertex>
|
|
2770
2770
|
#include <clipping_planes_vertex>
|
|
2771
2771
|
vWorldPosition = worldPosition.xyz;
|
|
2772
|
-
}`,
|
|
2772
|
+
}`,hd=`#define DISTANCE
|
|
2773
2773
|
uniform vec3 referencePosition;
|
|
2774
2774
|
uniform float nearDistance;
|
|
2775
2775
|
uniform float farDistance;
|
|
@@ -2792,13 +2792,13 @@ void main() {
|
|
|
2792
2792
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2793
2793
|
dist = saturate( dist );
|
|
2794
2794
|
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
|
|
2795
|
-
}`,
|
|
2795
|
+
}`,ud=`varying vec3 vWorldDirection;
|
|
2796
2796
|
#include <common>
|
|
2797
2797
|
void main() {
|
|
2798
2798
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2799
2799
|
#include <begin_vertex>
|
|
2800
2800
|
#include <project_vertex>
|
|
2801
|
-
}`,
|
|
2801
|
+
}`,fd=`uniform sampler2D tEquirect;
|
|
2802
2802
|
varying vec3 vWorldDirection;
|
|
2803
2803
|
#include <common>
|
|
2804
2804
|
void main() {
|
|
@@ -2807,7 +2807,7 @@ void main() {
|
|
|
2807
2807
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2808
2808
|
#include <tonemapping_fragment>
|
|
2809
2809
|
#include <colorspace_fragment>
|
|
2810
|
-
}`,
|
|
2810
|
+
}`,dd=`uniform float scale;
|
|
2811
2811
|
attribute float lineDistance;
|
|
2812
2812
|
varying float vLineDistance;
|
|
2813
2813
|
#include <common>
|
|
@@ -2829,7 +2829,7 @@ void main() {
|
|
|
2829
2829
|
#include <logdepthbuf_vertex>
|
|
2830
2830
|
#include <clipping_planes_vertex>
|
|
2831
2831
|
#include <fog_vertex>
|
|
2832
|
-
}`,
|
|
2832
|
+
}`,pd=`uniform vec3 diffuse;
|
|
2833
2833
|
uniform float opacity;
|
|
2834
2834
|
uniform float dashSize;
|
|
2835
2835
|
uniform float totalSize;
|
|
@@ -2857,7 +2857,7 @@ void main() {
|
|
|
2857
2857
|
#include <colorspace_fragment>
|
|
2858
2858
|
#include <fog_fragment>
|
|
2859
2859
|
#include <premultiplied_alpha_fragment>
|
|
2860
|
-
}`,
|
|
2860
|
+
}`,md=`#include <common>
|
|
2861
2861
|
#include <batching_pars_vertex>
|
|
2862
2862
|
#include <uv_pars_vertex>
|
|
2863
2863
|
#include <envmap_pars_vertex>
|
|
@@ -2937,7 +2937,7 @@ void main() {
|
|
|
2937
2937
|
#include <fog_fragment>
|
|
2938
2938
|
#include <premultiplied_alpha_fragment>
|
|
2939
2939
|
#include <dithering_fragment>
|
|
2940
|
-
}`,
|
|
2940
|
+
}`,gd=`#define LAMBERT
|
|
2941
2941
|
varying vec3 vViewPosition;
|
|
2942
2942
|
#include <common>
|
|
2943
2943
|
#include <batching_pars_vertex>
|
|
@@ -2976,7 +2976,7 @@ void main() {
|
|
|
2976
2976
|
#include <envmap_vertex>
|
|
2977
2977
|
#include <shadowmap_vertex>
|
|
2978
2978
|
#include <fog_vertex>
|
|
2979
|
-
}`,
|
|
2979
|
+
}`,xd=`#define LAMBERT
|
|
2980
2980
|
uniform vec3 diffuse;
|
|
2981
2981
|
uniform vec3 emissive;
|
|
2982
2982
|
uniform float opacity;
|
|
@@ -3034,7 +3034,7 @@ void main() {
|
|
|
3034
3034
|
#include <fog_fragment>
|
|
3035
3035
|
#include <premultiplied_alpha_fragment>
|
|
3036
3036
|
#include <dithering_fragment>
|
|
3037
|
-
}`,
|
|
3037
|
+
}`,vd=`#define MATCAP
|
|
3038
3038
|
varying vec3 vViewPosition;
|
|
3039
3039
|
#include <common>
|
|
3040
3040
|
#include <batching_pars_vertex>
|
|
@@ -3068,7 +3068,7 @@ void main() {
|
|
|
3068
3068
|
#include <clipping_planes_vertex>
|
|
3069
3069
|
#include <fog_vertex>
|
|
3070
3070
|
vViewPosition = - mvPosition.xyz;
|
|
3071
|
-
}`,
|
|
3071
|
+
}`,Md=`#define MATCAP
|
|
3072
3072
|
uniform vec3 diffuse;
|
|
3073
3073
|
uniform float opacity;
|
|
3074
3074
|
uniform sampler2D matcap;
|
|
@@ -3114,7 +3114,7 @@ void main() {
|
|
|
3114
3114
|
#include <fog_fragment>
|
|
3115
3115
|
#include <premultiplied_alpha_fragment>
|
|
3116
3116
|
#include <dithering_fragment>
|
|
3117
|
-
}`,
|
|
3117
|
+
}`,Sd=`#define NORMAL
|
|
3118
3118
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3119
3119
|
varying vec3 vViewPosition;
|
|
3120
3120
|
#endif
|
|
@@ -3147,7 +3147,7 @@ void main() {
|
|
|
3147
3147
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3148
3148
|
vViewPosition = - mvPosition.xyz;
|
|
3149
3149
|
#endif
|
|
3150
|
-
}`,
|
|
3150
|
+
}`,yd=`#define NORMAL
|
|
3151
3151
|
uniform float opacity;
|
|
3152
3152
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3153
3153
|
varying vec3 vViewPosition;
|
|
@@ -3168,7 +3168,7 @@ void main() {
|
|
|
3168
3168
|
#ifdef OPAQUE
|
|
3169
3169
|
gl_FragColor.a = 1.0;
|
|
3170
3170
|
#endif
|
|
3171
|
-
}`,
|
|
3171
|
+
}`,Ed=`#define PHONG
|
|
3172
3172
|
varying vec3 vViewPosition;
|
|
3173
3173
|
#include <common>
|
|
3174
3174
|
#include <batching_pars_vertex>
|
|
@@ -3207,7 +3207,7 @@ void main() {
|
|
|
3207
3207
|
#include <envmap_vertex>
|
|
3208
3208
|
#include <shadowmap_vertex>
|
|
3209
3209
|
#include <fog_vertex>
|
|
3210
|
-
}`,
|
|
3210
|
+
}`,bd=`#define PHONG
|
|
3211
3211
|
uniform vec3 diffuse;
|
|
3212
3212
|
uniform vec3 emissive;
|
|
3213
3213
|
uniform vec3 specular;
|
|
@@ -3267,7 +3267,7 @@ void main() {
|
|
|
3267
3267
|
#include <fog_fragment>
|
|
3268
3268
|
#include <premultiplied_alpha_fragment>
|
|
3269
3269
|
#include <dithering_fragment>
|
|
3270
|
-
}`,
|
|
3270
|
+
}`,Td=`#define STANDARD
|
|
3271
3271
|
varying vec3 vViewPosition;
|
|
3272
3272
|
#ifdef USE_TRANSMISSION
|
|
3273
3273
|
varying vec3 vWorldPosition;
|
|
@@ -3310,7 +3310,7 @@ void main() {
|
|
|
3310
3310
|
#ifdef USE_TRANSMISSION
|
|
3311
3311
|
vWorldPosition = worldPosition.xyz;
|
|
3312
3312
|
#endif
|
|
3313
|
-
}`,
|
|
3313
|
+
}`,Ad=`#define STANDARD
|
|
3314
3314
|
#ifdef PHYSICAL
|
|
3315
3315
|
#define IOR
|
|
3316
3316
|
#define USE_SPECULAR
|
|
@@ -3435,7 +3435,7 @@ void main() {
|
|
|
3435
3435
|
#include <fog_fragment>
|
|
3436
3436
|
#include <premultiplied_alpha_fragment>
|
|
3437
3437
|
#include <dithering_fragment>
|
|
3438
|
-
}`,
|
|
3438
|
+
}`,Rd=`#define TOON
|
|
3439
3439
|
varying vec3 vViewPosition;
|
|
3440
3440
|
#include <common>
|
|
3441
3441
|
#include <batching_pars_vertex>
|
|
@@ -3472,7 +3472,7 @@ void main() {
|
|
|
3472
3472
|
#include <worldpos_vertex>
|
|
3473
3473
|
#include <shadowmap_vertex>
|
|
3474
3474
|
#include <fog_vertex>
|
|
3475
|
-
}`,
|
|
3475
|
+
}`,wd=`#define TOON
|
|
3476
3476
|
uniform vec3 diffuse;
|
|
3477
3477
|
uniform vec3 emissive;
|
|
3478
3478
|
uniform float opacity;
|
|
@@ -3524,7 +3524,7 @@ void main() {
|
|
|
3524
3524
|
#include <fog_fragment>
|
|
3525
3525
|
#include <premultiplied_alpha_fragment>
|
|
3526
3526
|
#include <dithering_fragment>
|
|
3527
|
-
}`,
|
|
3527
|
+
}`,Cd=`uniform float size;
|
|
3528
3528
|
uniform float scale;
|
|
3529
3529
|
#include <common>
|
|
3530
3530
|
#include <color_pars_vertex>
|
|
@@ -3555,7 +3555,7 @@ void main() {
|
|
|
3555
3555
|
#include <clipping_planes_vertex>
|
|
3556
3556
|
#include <worldpos_vertex>
|
|
3557
3557
|
#include <fog_vertex>
|
|
3558
|
-
}`,
|
|
3558
|
+
}`,Pd=`uniform vec3 diffuse;
|
|
3559
3559
|
uniform float opacity;
|
|
3560
3560
|
#include <common>
|
|
3561
3561
|
#include <color_pars_fragment>
|
|
@@ -3580,7 +3580,7 @@ void main() {
|
|
|
3580
3580
|
#include <colorspace_fragment>
|
|
3581
3581
|
#include <fog_fragment>
|
|
3582
3582
|
#include <premultiplied_alpha_fragment>
|
|
3583
|
-
}`,
|
|
3583
|
+
}`,Dd=`#include <common>
|
|
3584
3584
|
#include <batching_pars_vertex>
|
|
3585
3585
|
#include <fog_pars_vertex>
|
|
3586
3586
|
#include <morphtarget_pars_vertex>
|
|
@@ -3603,7 +3603,7 @@ void main() {
|
|
|
3603
3603
|
#include <worldpos_vertex>
|
|
3604
3604
|
#include <shadowmap_vertex>
|
|
3605
3605
|
#include <fog_vertex>
|
|
3606
|
-
}`,
|
|
3606
|
+
}`,Ld=`uniform vec3 color;
|
|
3607
3607
|
uniform float opacity;
|
|
3608
3608
|
#include <common>
|
|
3609
3609
|
#include <fog_pars_fragment>
|
|
@@ -3619,7 +3619,7 @@ void main() {
|
|
|
3619
3619
|
#include <colorspace_fragment>
|
|
3620
3620
|
#include <fog_fragment>
|
|
3621
3621
|
#include <premultiplied_alpha_fragment>
|
|
3622
|
-
}`,
|
|
3622
|
+
}`,Id=`uniform float rotation;
|
|
3623
3623
|
uniform vec2 center;
|
|
3624
3624
|
#include <common>
|
|
3625
3625
|
#include <uv_pars_vertex>
|
|
@@ -3643,7 +3643,7 @@ void main() {
|
|
|
3643
3643
|
#include <logdepthbuf_vertex>
|
|
3644
3644
|
#include <clipping_planes_vertex>
|
|
3645
3645
|
#include <fog_vertex>
|
|
3646
|
-
}`,
|
|
3646
|
+
}`,Ud=`uniform vec3 diffuse;
|
|
3647
3647
|
uniform float opacity;
|
|
3648
3648
|
#include <common>
|
|
3649
3649
|
#include <uv_pars_fragment>
|
|
@@ -3668,7 +3668,7 @@ void main() {
|
|
|
3668
3668
|
#include <tonemapping_fragment>
|
|
3669
3669
|
#include <colorspace_fragment>
|
|
3670
3670
|
#include <fog_fragment>
|
|
3671
|
-
}`,Ue={alphahash_fragment:tu,alphahash_pars_fragment:nu,alphamap_fragment:iu,alphamap_pars_fragment:ru,alphatest_fragment:su,alphatest_pars_fragment:au,aomap_fragment:ou,aomap_pars_fragment:lu,batching_pars_vertex:cu,batching_vertex:hu,begin_vertex:uu,beginnormal_vertex:fu,bsdfs:du,iridescence_fragment:pu,bumpmap_pars_fragment:mu,clipping_planes_fragment:gu,clipping_planes_pars_fragment:_u,clipping_planes_pars_vertex:xu,clipping_planes_vertex:vu,color_fragment:Mu,color_pars_fragment:Su,color_pars_vertex:yu,color_vertex:Eu,common:bu,cube_uv_reflection_fragment:Tu,defaultnormal_vertex:Au,displacementmap_pars_vertex:Ru,displacementmap_vertex:wu,emissivemap_fragment:Cu,emissivemap_pars_fragment:Pu,colorspace_fragment:Du,colorspace_pars_fragment:Lu,envmap_fragment:Iu,envmap_common_pars_fragment:Uu,envmap_pars_fragment:Nu,envmap_pars_vertex:Fu,envmap_physical_pars_fragment:qu,envmap_vertex:Ou,fog_vertex:Bu,fog_pars_vertex:zu,fog_fragment:Gu,fog_pars_fragment:Vu,gradientmap_pars_fragment:Hu,lightmap_pars_fragment:ku,lights_lambert_fragment:Wu,lights_lambert_pars_fragment:Xu,lights_pars_begin:Yu,lights_toon_fragment:Ku,lights_toon_pars_fragment:Zu,lights_phong_fragment:$u,lights_phong_pars_fragment:Ju,lights_physical_fragment:Qu,lights_physical_pars_fragment:ju,lights_fragment_begin:ef,lights_fragment_maps:tf,lights_fragment_end:nf,lightprobes_pars_fragment:rf,logdepthbuf_fragment:sf,logdepthbuf_pars_fragment:af,logdepthbuf_pars_vertex:of,logdepthbuf_vertex:lf,map_fragment:cf,map_pars_fragment:hf,map_particle_fragment:uf,map_particle_pars_fragment:ff,metalnessmap_fragment:df,metalnessmap_pars_fragment:pf,morphinstance_vertex:mf,morphcolor_vertex:gf,morphnormal_vertex:_f,morphtarget_pars_vertex:xf,morphtarget_vertex:vf,normal_fragment_begin:Mf,normal_fragment_maps:Sf,normal_pars_fragment:yf,normal_pars_vertex:Ef,normal_vertex:bf,normalmap_pars_fragment:Tf,clearcoat_normal_fragment_begin:Af,clearcoat_normal_fragment_maps:Rf,clearcoat_pars_fragment:wf,iridescence_pars_fragment:Cf,opaque_fragment:Pf,packing:Df,premultiplied_alpha_fragment:Lf,project_vertex:If,dithering_fragment:Uf,dithering_pars_fragment:Nf,roughnessmap_fragment:Ff,roughnessmap_pars_fragment:Of,shadowmap_pars_fragment:Bf,shadowmap_pars_vertex:zf,shadowmap_vertex:Gf,shadowmask_pars_fragment:Vf,skinbase_vertex:Hf,skinning_pars_vertex:kf,skinning_vertex:Wf,skinnormal_vertex:Xf,specularmap_fragment:Yf,specularmap_pars_fragment:qf,tonemapping_fragment:Kf,tonemapping_pars_fragment:Zf,transmission_fragment:$f,transmission_pars_fragment:Jf,uv_pars_fragment:Qf,uv_pars_vertex:jf,uv_vertex:ed,worldpos_vertex:td,background_vert:nd,background_frag:id,backgroundCube_vert:rd,backgroundCube_frag:sd,cube_vert:ad,cube_frag:od,depth_vert:ld,depth_frag:cd,distance_vert:hd,distance_frag:ud,equirect_vert:fd,equirect_frag:dd,linedashed_vert:pd,linedashed_frag:md,meshbasic_vert:gd,meshbasic_frag:_d,meshlambert_vert:xd,meshlambert_frag:vd,meshmatcap_vert:Md,meshmatcap_frag:Sd,meshnormal_vert:yd,meshnormal_frag:Ed,meshphong_vert:bd,meshphong_frag:Td,meshphysical_vert:Ad,meshphysical_frag:Rd,meshtoon_vert:wd,meshtoon_frag:Cd,points_vert:Pd,points_frag:Dd,shadow_vert:Ld,shadow_frag:Id,sprite_vert:Ud,sprite_frag:Nd},me={common:{diffuse:{value:new Be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Le},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Le}},envmap:{envMap:{value:null},envMapRotation:{value:new Le},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Le}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Le}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Le},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Le},normalScale:{value:new Ce(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Le},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Le}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Le}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Le}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new D},probesMax:{value:new D},probesResolution:{value:new D}},points:{diffuse:{value:new Be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0},uvTransform:{value:new Le}},sprite:{diffuse:{value:new Be(16777215)},opacity:{value:1},center:{value:new Ce(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Le},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0}}},en={basic:{uniforms:Pt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:Ue.meshbasic_vert,fragmentShader:Ue.meshbasic_frag},lambert:{uniforms:Pt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Be(0)},envMapIntensity:{value:1}}]),vertexShader:Ue.meshlambert_vert,fragmentShader:Ue.meshlambert_frag},phong:{uniforms:Pt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Be(0)},specular:{value:new Be(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphong_vert,fragmentShader:Ue.meshphong_frag},standard:{uniforms:Pt([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new Be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag},toon:{uniforms:Pt([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new Be(0)}}]),vertexShader:Ue.meshtoon_vert,fragmentShader:Ue.meshtoon_frag},matcap:{uniforms:Pt([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:Ue.meshmatcap_vert,fragmentShader:Ue.meshmatcap_frag},points:{uniforms:Pt([me.points,me.fog]),vertexShader:Ue.points_vert,fragmentShader:Ue.points_frag},dashed:{uniforms:Pt([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ue.linedashed_vert,fragmentShader:Ue.linedashed_frag},depth:{uniforms:Pt([me.common,me.displacementmap]),vertexShader:Ue.depth_vert,fragmentShader:Ue.depth_frag},normal:{uniforms:Pt([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:Ue.meshnormal_vert,fragmentShader:Ue.meshnormal_frag},sprite:{uniforms:Pt([me.sprite,me.fog]),vertexShader:Ue.sprite_vert,fragmentShader:Ue.sprite_frag},background:{uniforms:{uvTransform:{value:new Le},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ue.background_vert,fragmentShader:Ue.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Le}},vertexShader:Ue.backgroundCube_vert,fragmentShader:Ue.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ue.cube_vert,fragmentShader:Ue.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ue.equirect_vert,fragmentShader:Ue.equirect_frag},distance:{uniforms:Pt([me.common,me.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ue.distance_vert,fragmentShader:Ue.distance_frag},shadow:{uniforms:Pt([me.lights,me.fog,{color:{value:new Be(0)},opacity:{value:1}}]),vertexShader:Ue.shadow_vert,fragmentShader:Ue.shadow_frag}};en.physical={uniforms:Pt([en.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Le},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Le},clearcoatNormalScale:{value:new Ce(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Le},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Le},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Le},sheen:{value:0},sheenColor:{value:new Be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Le},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Le},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Le},transmissionSamplerSize:{value:new Ce},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Le},attenuationDistance:{value:0},attenuationColor:{value:new Be(0)},specularColor:{value:new Be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Le},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Le},anisotropyVector:{value:new Ce},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Le}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag};const yr={r:0,b:0,g:0},Fd=new at,Zl=new Le;Zl.set(-1,0,0,0,1,0,0,0,1);function Od(i,e,t,n,r,s){const a=new Be(0);let o=r===!0?0:1,c,l,u=null,m=0,h=null;function d(w){let C=w.isScene===!0?w.background:null;if(C&&C.isTexture){const M=w.backgroundBlurriness>0;C=e.get(C,M)}return C}function x(w){let C=!1;const M=d(w);M===null?g(a,o):M&&M.isColor&&(g(M,1),C=!0);const R=i.xr.getEnvironmentBlendMode();R==="additive"?t.buffers.color.setClear(0,0,0,1,s):R==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||C)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function y(w,C){const M=d(C);M&&(M.isCubeTexture||M.mapping===kr)?(l===void 0&&(l=new Mn(new qi(1,1,1),new ln({name:"BackgroundCubeMaterial",uniforms:wi(en.backgroundCube.uniforms),vertexShader:en.backgroundCube.vertexShader,fragmentShader:en.backgroundCube.fragmentShader,side:Ut,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(R,E,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=C.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=C.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Fd.makeRotationFromEuler(C.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(Zl),l.material.toneMapped=Ve.getTransfer(M.colorSpace)!==Ze,(u!==M||m!==M.version||h!==i.toneMapping)&&(l.material.needsUpdate=!0,u=M,m=M.version,h=i.toneMapping),l.layers.enableAll(),w.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new Mn(new Yr(2,2),new ln({name:"BackgroundMaterial",uniforms:wi(en.background.uniforms),vertexShader:en.background.vertexShader,fragmentShader:en.background.fragmentShader,side:Bn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=C.backgroundIntensity,c.material.toneMapped=Ve.getTransfer(M.colorSpace)!==Ze,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(u!==M||m!==M.version||h!==i.toneMapping)&&(c.material.needsUpdate=!0,u=M,m=M.version,h=i.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null))}function g(w,C){w.getRGB(yr,Xl(i)),t.buffers.color.setClear(yr.r,yr.g,yr.b,C,s)}function f(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(w,C=1){a.set(w),o=C,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(w){o=w,g(a,o)},render:x,addToRenderList:y,dispose:f}}function Bd(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=h(null);let s=r,a=!1;function o(I,B,J,ee,V){let Z=!1;const W=m(I,ee,J,B);s!==W&&(s=W,l(s.object)),Z=d(I,ee,J,V),Z&&x(I,ee,J,V),V!==null&&e.update(V,i.ELEMENT_ARRAY_BUFFER),(Z||a)&&(a=!1,M(I,B,J,ee),V!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function c(){return i.createVertexArray()}function l(I){return i.bindVertexArray(I)}function u(I){return i.deleteVertexArray(I)}function m(I,B,J,ee){const V=ee.wireframe===!0;let Z=n[B.id];Z===void 0&&(Z={},n[B.id]=Z);const W=I.isInstancedMesh===!0?I.id:0;let ne=Z[W];ne===void 0&&(ne={},Z[W]=ne);let re=ne[J.id];re===void 0&&(re={},ne[J.id]=re);let de=re[V];return de===void 0&&(de=h(c()),re[V]=de),de}function h(I){const B=[],J=[],ee=[];for(let V=0;V<t;V++)B[V]=0,J[V]=0,ee[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:J,attributeDivisors:ee,object:I,attributes:{},index:null}}function d(I,B,J,ee){const V=s.attributes,Z=B.attributes;let W=0;const ne=J.getAttributes();for(const re in ne)if(ne[re].location>=0){const ge=V[re];let ye=Z[re];if(ye===void 0&&(re==="instanceMatrix"&&I.instanceMatrix&&(ye=I.instanceMatrix),re==="instanceColor"&&I.instanceColor&&(ye=I.instanceColor)),ge===void 0||ge.attribute!==ye||ye&&ge.data!==ye.data)return!0;W++}return s.attributesNum!==W||s.index!==ee}function x(I,B,J,ee){const V={},Z=B.attributes;let W=0;const ne=J.getAttributes();for(const re in ne)if(ne[re].location>=0){let ge=Z[re];ge===void 0&&(re==="instanceMatrix"&&I.instanceMatrix&&(ge=I.instanceMatrix),re==="instanceColor"&&I.instanceColor&&(ge=I.instanceColor));const ye={};ye.attribute=ge,ge&&ge.data&&(ye.data=ge.data),V[re]=ye,W++}s.attributes=V,s.attributesNum=W,s.index=ee}function y(){const I=s.newAttributes;for(let B=0,J=I.length;B<J;B++)I[B]=0}function g(I){f(I,0)}function f(I,B){const J=s.newAttributes,ee=s.enabledAttributes,V=s.attributeDivisors;J[I]=1,ee[I]===0&&(i.enableVertexAttribArray(I),ee[I]=1),V[I]!==B&&(i.vertexAttribDivisor(I,B),V[I]=B)}function w(){const I=s.newAttributes,B=s.enabledAttributes;for(let J=0,ee=B.length;J<ee;J++)B[J]!==I[J]&&(i.disableVertexAttribArray(J),B[J]=0)}function C(I,B,J,ee,V,Z,W){W===!0?i.vertexAttribIPointer(I,B,J,V,Z):i.vertexAttribPointer(I,B,J,ee,V,Z)}function M(I,B,J,ee){y();const V=ee.attributes,Z=J.getAttributes(),W=B.defaultAttributeValues;for(const ne in Z){const re=Z[ne];if(re.location>=0){let de=V[ne];if(de===void 0&&(ne==="instanceMatrix"&&I.instanceMatrix&&(de=I.instanceMatrix),ne==="instanceColor"&&I.instanceColor&&(de=I.instanceColor)),de!==void 0){const ge=de.normalized,ye=de.itemSize,He=e.get(de);if(He===void 0)continue;const it=He.buffer,ke=He.type,j=He.bytesPerElement,ue=ke===i.INT||ke===i.UNSIGNED_INT||de.gpuType===Da;if(de.isInterleavedBufferAttribute){const se=de.data,Pe=se.stride,De=de.offset;if(se.isInstancedInterleavedBuffer){for(let Re=0;Re<re.locationSize;Re++)f(re.location+Re,se.meshPerAttribute);I.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let Re=0;Re<re.locationSize;Re++)g(re.location+Re);i.bindBuffer(i.ARRAY_BUFFER,it);for(let Re=0;Re<re.locationSize;Re++)C(re.location+Re,ye/re.locationSize,ke,ge,Pe*j,(De+ye/re.locationSize*Re)*j,ue)}else{if(de.isInstancedBufferAttribute){for(let se=0;se<re.locationSize;se++)f(re.location+se,de.meshPerAttribute);I.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let se=0;se<re.locationSize;se++)g(re.location+se);i.bindBuffer(i.ARRAY_BUFFER,it);for(let se=0;se<re.locationSize;se++)C(re.location+se,ye/re.locationSize,ke,ge,ye*j,ye/re.locationSize*se*j,ue)}}else if(W!==void 0){const ge=W[ne];if(ge!==void 0)switch(ge.length){case 2:i.vertexAttrib2fv(re.location,ge);break;case 3:i.vertexAttrib3fv(re.location,ge);break;case 4:i.vertexAttrib4fv(re.location,ge);break;default:i.vertexAttrib1fv(re.location,ge)}}}}w()}function R(){b();for(const I in n){const B=n[I];for(const J in B){const ee=B[J];for(const V in ee){const Z=ee[V];for(const W in Z)u(Z[W].object),delete Z[W];delete ee[V]}}delete n[I]}}function E(I){if(n[I.id]===void 0)return;const B=n[I.id];for(const J in B){const ee=B[J];for(const V in ee){const Z=ee[V];for(const W in Z)u(Z[W].object),delete Z[W];delete ee[V]}}delete n[I.id]}function P(I){for(const B in n){const J=n[B];for(const ee in J){const V=J[ee];if(V[I.id]===void 0)continue;const Z=V[I.id];for(const W in Z)u(Z[W].object),delete Z[W];delete V[I.id]}}}function _(I){for(const B in n){const J=n[B],ee=I.isInstancedMesh===!0?I.id:0,V=J[ee];if(V!==void 0){for(const Z in V){const W=V[Z];for(const ne in W)u(W[ne].object),delete W[ne];delete V[Z]}delete J[ee],Object.keys(J).length===0&&delete n[B]}}}function b(){U(),a=!0,s!==r&&(s=r,l(s.object))}function U(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:b,resetDefaultState:U,dispose:R,releaseStatesOfGeometry:E,releaseStatesOfObject:_,releaseStatesOfProgram:P,initAttributes:y,enableAttribute:g,disableUnusedAttributes:w}}function zd(i,e,t){let n;function r(c){n=c}function s(c,l){i.drawArrays(n,c,l),t.update(l,n,1)}function a(c,l,u){u!==0&&(i.drawArraysInstanced(n,c,l,u),t.update(l,n,u))}function o(c,l,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,l,0,u);let h=0;for(let d=0;d<u;d++)h+=l[d];t.update(h,n,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function Gd(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const P=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(P){return!(P!==Zt&&n.convert(P)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(P){const _=P===xn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(P!==kt&&n.convert(P)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&P!==nn&&!_)}function c(P){if(P==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const u=c(l);u!==l&&(we("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u);const m=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&we("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_TEXTURE_SIZE),g=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),w=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),C=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),R=i.getParameter(i.MAX_SAMPLES),E=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:m,reversedDepthBuffer:h,maxTextures:d,maxVertexTextures:x,maxTextureSize:y,maxCubemapSize:g,maxAttributes:f,maxVertexUniforms:w,maxVaryings:C,maxFragmentUniforms:M,maxSamples:R,samples:E}}function Vd(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new Dn,o=new Le,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(m,h){const d=m.length!==0||h||n!==0||r;return r=h,n=m.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(m,h){t=u(m,h,0)},this.setState=function(m,h,d){const x=m.clippingPlanes,y=m.clipIntersection,g=m.clipShadows,f=i.get(m);if(!r||x===null||x.length===0||s&&!g)s?u(null):l();else{const w=s?0:n,C=w*4;let M=f.clippingState||null;c.value=M,M=u(x,h,C,d);for(let R=0;R!==C;++R)M[R]=t[R];f.clippingState=M,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=w}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(m,h,d,x){const y=m!==null?m.length:0;let g=null;if(y!==0){if(g=c.value,x!==!0||g===null){const f=d+y*4,w=h.matrixWorldInverse;o.getNormalMatrix(w),(g===null||g.length<f)&&(g=new Float32Array(f));for(let C=0,M=d;C!==y;++C,M+=4)a.copy(m[C]).applyMatrix4(w,o),a.normal.toArray(g,M),g[M+3]=a.constant}c.value=g,c.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,g}}const Nn=4,Go=[.125,.215,.35,.446,.526,.582],qn=20,Hd=256,Gi=new ql,Vo=new Be;let Cs=null,Ps=0,Ds=0,Ls=!1;const kd=new D;class Ho{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=kd}=s;Cs=this._renderer.getRenderTarget(),Ps=this._renderer.getActiveCubeFace(),Ds=this._renderer.getActiveMipmapLevel(),Ls=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,r,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Xo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Wo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Cs,Ps,Ds),this._renderer.xr.enabled=Ls,e.scissorTest=!1,vi(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===$n||e.mapping===Ai?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Cs=this._renderer.getRenderTarget(),Ps=this._renderer.getActiveCubeFace(),Ds=this._renderer.getActiveMipmapLevel(),Ls=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:At,minFilter:At,generateMipmaps:!1,type:xn,format:Zt,colorSpace:Ur,depthBuffer:!1},r=ko(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ko(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Wd(s)),this._blurMaterial=Yd(s,e,t),this._ggxMaterial=Xd(s,e,t)}return r}_compileMaterial(e){const t=new Mn(new Xt,e);this._renderer.compile(t,Gi)}_sceneToCubeUV(e,t,n,r,s){const c=new Ht(90,1,t,n),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],m=this._renderer,h=m.autoClear,d=m.toneMapping;m.getClearColor(Vo),m.toneMapping=sn,m.autoClear=!1,m.state.buffers.depth.getReversed()&&(m.setRenderTarget(r),m.clearDepth(),m.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Mn(new qi,new Gl({name:"PMREM.Background",side:Ut,depthWrite:!1,depthTest:!1})));const y=this._backgroundBox,g=y.material;let f=!1;const w=e.background;w?w.isColor&&(g.color.copy(w),e.background=null,f=!0):(g.color.copy(Vo),f=!0);for(let C=0;C<6;C++){const M=C%3;M===0?(c.up.set(0,l[C],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+u[C],s.y,s.z)):M===1?(c.up.set(0,0,l[C]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+u[C],s.z)):(c.up.set(0,l[C],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+u[C]));const R=this._cubeSize;vi(r,M*R,C>2?R:0,R,R),m.setRenderTarget(r),f&&m.render(y,c),m.render(e,c)}m.toneMapping=d,m.autoClear=h,e.background=w}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===$n||e.mapping===Ai;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Xo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Wo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;vi(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Gi)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const c=a.uniforms,l=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),m=Math.sqrt(l*l-u*u),h=0+l*1.25,d=m*h,{_lodMax:x}=this,y=this._sizeLods[n],g=3*y*(n>x-Nn?n-x+Nn:0),f=4*(this._cubeSize-y);c.envMap.value=e.texture,c.roughness.value=d,c.mipInt.value=x-t,vi(s,g,f,3*y,2*y),r.setRenderTarget(s),r.render(o,Gi),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=x-n,vi(e,g,f,3*y,2*y),r.setRenderTarget(e),r.render(o,Gi)}_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 c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Ge("blur direction must be either latitudinal or longitudinal!");const u=3,m=this._lodMeshes[r];m.material=l;const h=l.uniforms,d=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*qn-1),y=s/x,g=isFinite(s)?1+Math.floor(u*y):qn;g>qn&&we(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${qn}`);const f=[];let w=0;for(let P=0;P<qn;++P){const _=P/y,b=Math.exp(-_*_/2);f.push(b),P===0?w+=b:P<g&&(w+=2*b)}for(let P=0;P<f.length;P++)f[P]=f[P]/w;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=f,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:C}=this;h.dTheta.value=x,h.mipInt.value=C-n;const M=this._sizeLods[r],R=3*M*(r>C-Nn?r-C+Nn:0),E=4*(this._cubeSize-M);vi(t,R,E,3*M,2*M),c.setRenderTarget(t),c.render(m,Gi)}}function Wd(i){const e=[],t=[],n=[];let r=i;const s=i-Nn+1+Go.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let c=1/o;a>i-Nn?c=Go[a-i+Nn-1]:a===0&&(c=0),t.push(c);const l=1/(o-2),u=-l,m=1+l,h=[u,u,m,u,m,m,u,u,m,m,u,m],d=6,x=6,y=3,g=2,f=1,w=new Float32Array(y*x*d),C=new Float32Array(g*x*d),M=new Float32Array(f*x*d);for(let E=0;E<d;E++){const P=E%3*2/3-1,_=E>2?0:-1,b=[P,_,0,P+2/3,_,0,P+2/3,_+1,0,P,_,0,P+2/3,_+1,0,P,_+1,0];w.set(b,y*x*E),C.set(h,g*x*E);const U=[E,E,E,E,E,E];M.set(U,f*x*E)}const R=new Xt;R.setAttribute("position",new $t(w,y)),R.setAttribute("uv",new $t(C,g)),R.setAttribute("faceIndex",new $t(M,f)),n.push(new Mn(R,null)),r>Nn&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function ko(i,e,t){const n=new an(i,e,t);return n.texture.mapping=kr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function vi(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Xd(i,e,t){return new ln({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Hd,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:qr(),fragmentShader:`
|
|
3671
|
+
}`,Ue={alphahash_fragment:eu,alphahash_pars_fragment:tu,alphamap_fragment:nu,alphamap_pars_fragment:iu,alphatest_fragment:ru,alphatest_pars_fragment:su,aomap_fragment:au,aomap_pars_fragment:ou,batching_pars_vertex:lu,batching_vertex:cu,begin_vertex:hu,beginnormal_vertex:uu,bsdfs:fu,iridescence_fragment:du,bumpmap_pars_fragment:pu,clipping_planes_fragment:mu,clipping_planes_pars_fragment:_u,clipping_planes_pars_vertex:gu,clipping_planes_vertex:xu,color_fragment:vu,color_pars_fragment:Mu,color_pars_vertex:Su,color_vertex:yu,common:Eu,cube_uv_reflection_fragment:bu,defaultnormal_vertex:Tu,displacementmap_pars_vertex:Au,displacementmap_vertex:Ru,emissivemap_fragment:wu,emissivemap_pars_fragment:Cu,colorspace_fragment:Pu,colorspace_pars_fragment:Du,envmap_fragment:Lu,envmap_common_pars_fragment:Iu,envmap_pars_fragment:Uu,envmap_pars_vertex:Nu,envmap_physical_pars_fragment:Yu,envmap_vertex:Fu,fog_vertex:Ou,fog_pars_vertex:Bu,fog_fragment:zu,fog_pars_fragment:Gu,gradientmap_pars_fragment:Vu,lightmap_pars_fragment:Hu,lights_lambert_fragment:ku,lights_lambert_pars_fragment:Wu,lights_pars_begin:Xu,lights_toon_fragment:qu,lights_toon_pars_fragment:Ku,lights_phong_fragment:Zu,lights_phong_pars_fragment:$u,lights_physical_fragment:Ju,lights_physical_pars_fragment:Qu,lights_fragment_begin:ju,lights_fragment_maps:ef,lights_fragment_end:tf,lightprobes_pars_fragment:nf,logdepthbuf_fragment:rf,logdepthbuf_pars_fragment:sf,logdepthbuf_pars_vertex:af,logdepthbuf_vertex:of,map_fragment:lf,map_pars_fragment:cf,map_particle_fragment:hf,map_particle_pars_fragment:uf,metalnessmap_fragment:ff,metalnessmap_pars_fragment:df,morphinstance_vertex:pf,morphcolor_vertex:mf,morphnormal_vertex:_f,morphtarget_pars_vertex:gf,morphtarget_vertex:xf,normal_fragment_begin:vf,normal_fragment_maps:Mf,normal_pars_fragment:Sf,normal_pars_vertex:yf,normal_vertex:Ef,normalmap_pars_fragment:bf,clearcoat_normal_fragment_begin:Tf,clearcoat_normal_fragment_maps:Af,clearcoat_pars_fragment:Rf,iridescence_pars_fragment:wf,opaque_fragment:Cf,packing:Pf,premultiplied_alpha_fragment:Df,project_vertex:Lf,dithering_fragment:If,dithering_pars_fragment:Uf,roughnessmap_fragment:Nf,roughnessmap_pars_fragment:Ff,shadowmap_pars_fragment:Of,shadowmap_pars_vertex:Bf,shadowmap_vertex:zf,shadowmask_pars_fragment:Gf,skinbase_vertex:Vf,skinning_pars_vertex:Hf,skinning_vertex:kf,skinnormal_vertex:Wf,specularmap_fragment:Xf,specularmap_pars_fragment:Yf,tonemapping_fragment:qf,tonemapping_pars_fragment:Kf,transmission_fragment:Zf,transmission_pars_fragment:$f,uv_pars_fragment:Jf,uv_pars_vertex:Qf,uv_vertex:jf,worldpos_vertex:ed,background_vert:td,background_frag:nd,backgroundCube_vert:id,backgroundCube_frag:rd,cube_vert:sd,cube_frag:ad,depth_vert:od,depth_frag:ld,distance_vert:cd,distance_frag:hd,equirect_vert:ud,equirect_frag:fd,linedashed_vert:dd,linedashed_frag:pd,meshbasic_vert:md,meshbasic_frag:_d,meshlambert_vert:gd,meshlambert_frag:xd,meshmatcap_vert:vd,meshmatcap_frag:Md,meshnormal_vert:Sd,meshnormal_frag:yd,meshphong_vert:Ed,meshphong_frag:bd,meshphysical_vert:Td,meshphysical_frag:Ad,meshtoon_vert:Rd,meshtoon_frag:wd,points_vert:Cd,points_frag:Pd,shadow_vert:Dd,shadow_frag:Ld,sprite_vert:Id,sprite_frag:Ud},me={common:{diffuse:{value:new Be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Le},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Le}},envmap:{envMap:{value:null},envMapRotation:{value:new Le},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Le}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Le}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Le},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Le},normalScale:{value:new Ce(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Le},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Le}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Le}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Le}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new D},probesMax:{value:new D},probesResolution:{value:new D}},points:{diffuse:{value:new Be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0},uvTransform:{value:new Le}},sprite:{diffuse:{value:new Be(16777215)},opacity:{value:1},center:{value:new Ce(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Le},alphaMap:{value:null},alphaMapTransform:{value:new Le},alphaTest:{value:0}}},en={basic:{uniforms:Pt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:Ue.meshbasic_vert,fragmentShader:Ue.meshbasic_frag},lambert:{uniforms:Pt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Be(0)},envMapIntensity:{value:1}}]),vertexShader:Ue.meshlambert_vert,fragmentShader:Ue.meshlambert_frag},phong:{uniforms:Pt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Be(0)},specular:{value:new Be(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphong_vert,fragmentShader:Ue.meshphong_frag},standard:{uniforms:Pt([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new Be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag},toon:{uniforms:Pt([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new Be(0)}}]),vertexShader:Ue.meshtoon_vert,fragmentShader:Ue.meshtoon_frag},matcap:{uniforms:Pt([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:Ue.meshmatcap_vert,fragmentShader:Ue.meshmatcap_frag},points:{uniforms:Pt([me.points,me.fog]),vertexShader:Ue.points_vert,fragmentShader:Ue.points_frag},dashed:{uniforms:Pt([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ue.linedashed_vert,fragmentShader:Ue.linedashed_frag},depth:{uniforms:Pt([me.common,me.displacementmap]),vertexShader:Ue.depth_vert,fragmentShader:Ue.depth_frag},normal:{uniforms:Pt([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:Ue.meshnormal_vert,fragmentShader:Ue.meshnormal_frag},sprite:{uniforms:Pt([me.sprite,me.fog]),vertexShader:Ue.sprite_vert,fragmentShader:Ue.sprite_frag},background:{uniforms:{uvTransform:{value:new Le},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ue.background_vert,fragmentShader:Ue.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Le}},vertexShader:Ue.backgroundCube_vert,fragmentShader:Ue.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ue.cube_vert,fragmentShader:Ue.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ue.equirect_vert,fragmentShader:Ue.equirect_frag},distance:{uniforms:Pt([me.common,me.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ue.distance_vert,fragmentShader:Ue.distance_frag},shadow:{uniforms:Pt([me.lights,me.fog,{color:{value:new Be(0)},opacity:{value:1}}]),vertexShader:Ue.shadow_vert,fragmentShader:Ue.shadow_frag}};en.physical={uniforms:Pt([en.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Le},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Le},clearcoatNormalScale:{value:new Ce(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Le},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Le},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Le},sheen:{value:0},sheenColor:{value:new Be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Le},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Le},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Le},transmissionSamplerSize:{value:new Ce},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Le},attenuationDistance:{value:0},attenuationColor:{value:new Be(0)},specularColor:{value:new Be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Le},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Le},anisotropyVector:{value:new Ce},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Le}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag};const yr={r:0,b:0,g:0},Nd=new at,Zl=new Le;Zl.set(-1,0,0,0,1,0,0,0,1);function Fd(i,e,t,n,r,s){const a=new Be(0);let o=r===!0?0:1,c,l,u=null,m=0,h=null;function d(w){let C=w.isScene===!0?w.background:null;if(C&&C.isTexture){const M=w.backgroundBlurriness>0;C=e.get(C,M)}return C}function x(w){let C=!1;const M=d(w);M===null?_(a,o):M&&M.isColor&&(_(M,1),C=!0);const R=i.xr.getEnvironmentBlendMode();R==="additive"?t.buffers.color.setClear(0,0,0,1,s):R==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||C)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function y(w,C){const M=d(C);M&&(M.isCubeTexture||M.mapping===kr)?(l===void 0&&(l=new Mn(new qi(1,1,1),new ln({name:"BackgroundCubeMaterial",uniforms:wi(en.backgroundCube.uniforms),vertexShader:en.backgroundCube.vertexShader,fragmentShader:en.backgroundCube.fragmentShader,side:Ut,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(R,E,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=C.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=C.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Nd.makeRotationFromEuler(C.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(Zl),l.material.toneMapped=Ve.getTransfer(M.colorSpace)!==Ze,(u!==M||m!==M.version||h!==i.toneMapping)&&(l.material.needsUpdate=!0,u=M,m=M.version,h=i.toneMapping),l.layers.enableAll(),w.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new Mn(new Yr(2,2),new ln({name:"BackgroundMaterial",uniforms:wi(en.background.uniforms),vertexShader:en.background.vertexShader,fragmentShader:en.background.fragmentShader,side:On,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=C.backgroundIntensity,c.material.toneMapped=Ve.getTransfer(M.colorSpace)!==Ze,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(u!==M||m!==M.version||h!==i.toneMapping)&&(c.material.needsUpdate=!0,u=M,m=M.version,h=i.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null))}function _(w,C){w.getRGB(yr,Xl(i)),t.buffers.color.setClear(yr.r,yr.g,yr.b,C,s)}function f(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(w,C=1){a.set(w),o=C,_(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(w){o=w,_(a,o)},render:x,addToRenderList:y,dispose:f}}function Od(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=h(null);let s=r,a=!1;function o(I,B,J,ee,V){let Z=!1;const W=m(I,ee,J,B);s!==W&&(s=W,l(s.object)),Z=d(I,ee,J,V),Z&&x(I,ee,J,V),V!==null&&e.update(V,i.ELEMENT_ARRAY_BUFFER),(Z||a)&&(a=!1,M(I,B,J,ee),V!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function c(){return i.createVertexArray()}function l(I){return i.bindVertexArray(I)}function u(I){return i.deleteVertexArray(I)}function m(I,B,J,ee){const V=ee.wireframe===!0;let Z=n[B.id];Z===void 0&&(Z={},n[B.id]=Z);const W=I.isInstancedMesh===!0?I.id:0;let ne=Z[W];ne===void 0&&(ne={},Z[W]=ne);let re=ne[J.id];re===void 0&&(re={},ne[J.id]=re);let de=re[V];return de===void 0&&(de=h(c()),re[V]=de),de}function h(I){const B=[],J=[],ee=[];for(let V=0;V<t;V++)B[V]=0,J[V]=0,ee[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:J,attributeDivisors:ee,object:I,attributes:{},index:null}}function d(I,B,J,ee){const V=s.attributes,Z=B.attributes;let W=0;const ne=J.getAttributes();for(const re in ne)if(ne[re].location>=0){const _e=V[re];let ye=Z[re];if(ye===void 0&&(re==="instanceMatrix"&&I.instanceMatrix&&(ye=I.instanceMatrix),re==="instanceColor"&&I.instanceColor&&(ye=I.instanceColor)),_e===void 0||_e.attribute!==ye||ye&&_e.data!==ye.data)return!0;W++}return s.attributesNum!==W||s.index!==ee}function x(I,B,J,ee){const V={},Z=B.attributes;let W=0;const ne=J.getAttributes();for(const re in ne)if(ne[re].location>=0){let _e=Z[re];_e===void 0&&(re==="instanceMatrix"&&I.instanceMatrix&&(_e=I.instanceMatrix),re==="instanceColor"&&I.instanceColor&&(_e=I.instanceColor));const ye={};ye.attribute=_e,_e&&_e.data&&(ye.data=_e.data),V[re]=ye,W++}s.attributes=V,s.attributesNum=W,s.index=ee}function y(){const I=s.newAttributes;for(let B=0,J=I.length;B<J;B++)I[B]=0}function _(I){f(I,0)}function f(I,B){const J=s.newAttributes,ee=s.enabledAttributes,V=s.attributeDivisors;J[I]=1,ee[I]===0&&(i.enableVertexAttribArray(I),ee[I]=1),V[I]!==B&&(i.vertexAttribDivisor(I,B),V[I]=B)}function w(){const I=s.newAttributes,B=s.enabledAttributes;for(let J=0,ee=B.length;J<ee;J++)B[J]!==I[J]&&(i.disableVertexAttribArray(J),B[J]=0)}function C(I,B,J,ee,V,Z,W){W===!0?i.vertexAttribIPointer(I,B,J,V,Z):i.vertexAttribPointer(I,B,J,ee,V,Z)}function M(I,B,J,ee){y();const V=ee.attributes,Z=J.getAttributes(),W=B.defaultAttributeValues;for(const ne in Z){const re=Z[ne];if(re.location>=0){let de=V[ne];if(de===void 0&&(ne==="instanceMatrix"&&I.instanceMatrix&&(de=I.instanceMatrix),ne==="instanceColor"&&I.instanceColor&&(de=I.instanceColor)),de!==void 0){const _e=de.normalized,ye=de.itemSize,ke=e.get(de);if(ke===void 0)continue;const it=ke.buffer,We=ke.type,j=ke.bytesPerElement,ue=We===i.INT||We===i.UNSIGNED_INT||de.gpuType===Da;if(de.isInterleavedBufferAttribute){const ae=de.data,Pe=ae.stride,De=de.offset;if(ae.isInstancedInterleavedBuffer){for(let Re=0;Re<re.locationSize;Re++)f(re.location+Re,ae.meshPerAttribute);I.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=ae.meshPerAttribute*ae.count)}else for(let Re=0;Re<re.locationSize;Re++)_(re.location+Re);i.bindBuffer(i.ARRAY_BUFFER,it);for(let Re=0;Re<re.locationSize;Re++)C(re.location+Re,ye/re.locationSize,We,_e,Pe*j,(De+ye/re.locationSize*Re)*j,ue)}else{if(de.isInstancedBufferAttribute){for(let ae=0;ae<re.locationSize;ae++)f(re.location+ae,de.meshPerAttribute);I.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let ae=0;ae<re.locationSize;ae++)_(re.location+ae);i.bindBuffer(i.ARRAY_BUFFER,it);for(let ae=0;ae<re.locationSize;ae++)C(re.location+ae,ye/re.locationSize,We,_e,ye*j,ye/re.locationSize*ae*j,ue)}}else if(W!==void 0){const _e=W[ne];if(_e!==void 0)switch(_e.length){case 2:i.vertexAttrib2fv(re.location,_e);break;case 3:i.vertexAttrib3fv(re.location,_e);break;case 4:i.vertexAttrib4fv(re.location,_e);break;default:i.vertexAttrib1fv(re.location,_e)}}}}w()}function R(){b();for(const I in n){const B=n[I];for(const J in B){const ee=B[J];for(const V in ee){const Z=ee[V];for(const W in Z)u(Z[W].object),delete Z[W];delete ee[V]}}delete n[I]}}function E(I){if(n[I.id]===void 0)return;const B=n[I.id];for(const J in B){const ee=B[J];for(const V in ee){const Z=ee[V];for(const W in Z)u(Z[W].object),delete Z[W];delete ee[V]}}delete n[I.id]}function P(I){for(const B in n){const J=n[B];for(const ee in J){const V=J[ee];if(V[I.id]===void 0)continue;const Z=V[I.id];for(const W in Z)u(Z[W].object),delete Z[W];delete V[I.id]}}}function g(I){for(const B in n){const J=n[B],ee=I.isInstancedMesh===!0?I.id:0,V=J[ee];if(V!==void 0){for(const Z in V){const W=V[Z];for(const ne in W)u(W[ne].object),delete W[ne];delete V[Z]}delete J[ee],Object.keys(J).length===0&&delete n[B]}}}function b(){U(),a=!0,s!==r&&(s=r,l(s.object))}function U(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:b,resetDefaultState:U,dispose:R,releaseStatesOfGeometry:E,releaseStatesOfObject:g,releaseStatesOfProgram:P,initAttributes:y,enableAttribute:_,disableUnusedAttributes:w}}function Bd(i,e,t){let n;function r(c){n=c}function s(c,l){i.drawArrays(n,c,l),t.update(l,n,1)}function a(c,l,u){u!==0&&(i.drawArraysInstanced(n,c,l,u),t.update(l,n,u))}function o(c,l,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,l,0,u);let h=0;for(let d=0;d<u;d++)h+=l[d];t.update(h,n,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function zd(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const P=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(P){return!(P!==Zt&&n.convert(P)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(P){const g=P===xn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(P!==kt&&n.convert(P)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&P!==nn&&!g)}function c(P){if(P==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const u=c(l);u!==l&&(we("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u);const m=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&we("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_TEXTURE_SIZE),_=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),w=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),C=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),R=i.getParameter(i.MAX_SAMPLES),E=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:m,reversedDepthBuffer:h,maxTextures:d,maxVertexTextures:x,maxTextureSize:y,maxCubemapSize:_,maxAttributes:f,maxVertexUniforms:w,maxVaryings:C,maxFragmentUniforms:M,maxSamples:R,samples:E}}function Gd(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new Dn,o=new Le,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(m,h){const d=m.length!==0||h||n!==0||r;return r=h,n=m.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(m,h){t=u(m,h,0)},this.setState=function(m,h,d){const x=m.clippingPlanes,y=m.clipIntersection,_=m.clipShadows,f=i.get(m);if(!r||x===null||x.length===0||s&&!_)s?u(null):l();else{const w=s?0:n,C=w*4;let M=f.clippingState||null;c.value=M,M=u(x,h,C,d);for(let R=0;R!==C;++R)M[R]=t[R];f.clippingState=M,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=w}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(m,h,d,x){const y=m!==null?m.length:0;let _=null;if(y!==0){if(_=c.value,x!==!0||_===null){const f=d+y*4,w=h.matrixWorldInverse;o.getNormalMatrix(w),(_===null||_.length<f)&&(_=new Float32Array(f));for(let C=0,M=d;C!==y;++C,M+=4)a.copy(m[C]).applyMatrix4(w,o),a.normal.toArray(_,M),_[M+3]=a.constant}c.value=_,c.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,_}}const Un=4,Go=[.125,.215,.35,.446,.526,.582],Yn=20,Vd=256,Gi=new ql,Vo=new Be;let Cs=null,Ps=0,Ds=0,Ls=!1;const Hd=new D;class Ho{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){const{size:a=256,position:o=Hd}=s;Cs=this._renderer.getRenderTarget(),Ps=this._renderer.getActiveCubeFace(),Ds=this._renderer.getActiveMipmapLevel(),Ls=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,r,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Xo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Wo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Cs,Ps,Ds),this._renderer.xr.enabled=Ls,e.scissorTest=!1,vi(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===$n||e.mapping===Ai?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Cs=this._renderer.getRenderTarget(),Ps=this._renderer.getActiveCubeFace(),Ds=this._renderer.getActiveMipmapLevel(),Ls=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:At,minFilter:At,generateMipmaps:!1,type:xn,format:Zt,colorSpace:Ur,depthBuffer:!1},r=ko(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ko(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=kd(s)),this._blurMaterial=Xd(s,e,t),this._ggxMaterial=Wd(s,e,t)}return r}_compileMaterial(e){const t=new Mn(new Xt,e);this._renderer.compile(t,Gi)}_sceneToCubeUV(e,t,n,r,s){const c=new Ht(90,1,t,n),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],m=this._renderer,h=m.autoClear,d=m.toneMapping;m.getClearColor(Vo),m.toneMapping=sn,m.autoClear=!1,m.state.buffers.depth.getReversed()&&(m.setRenderTarget(r),m.clearDepth(),m.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Mn(new qi,new Gl({name:"PMREM.Background",side:Ut,depthWrite:!1,depthTest:!1})));const y=this._backgroundBox,_=y.material;let f=!1;const w=e.background;w?w.isColor&&(_.color.copy(w),e.background=null,f=!0):(_.color.copy(Vo),f=!0);for(let C=0;C<6;C++){const M=C%3;M===0?(c.up.set(0,l[C],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+u[C],s.y,s.z)):M===1?(c.up.set(0,0,l[C]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+u[C],s.z)):(c.up.set(0,l[C],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+u[C]));const R=this._cubeSize;vi(r,M*R,C>2?R:0,R,R),m.setRenderTarget(r),f&&m.render(y,c),m.render(e,c)}m.toneMapping=d,m.autoClear=h,e.background=w}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===$n||e.mapping===Ai;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Xo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Wo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;vi(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Gi)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const c=a.uniforms,l=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),m=Math.sqrt(l*l-u*u),h=0+l*1.25,d=m*h,{_lodMax:x}=this,y=this._sizeLods[n],_=3*y*(n>x-Un?n-x+Un:0),f=4*(this._cubeSize-y);c.envMap.value=e.texture,c.roughness.value=d,c.mipInt.value=x-t,vi(s,_,f,3*y,2*y),r.setRenderTarget(s),r.render(o,Gi),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=x-n,vi(e,_,f,3*y,2*y),r.setRenderTarget(e),r.render(o,Gi)}_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 c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Ge("blur direction must be either latitudinal or longitudinal!");const u=3,m=this._lodMeshes[r];m.material=l;const h=l.uniforms,d=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Yn-1),y=s/x,_=isFinite(s)?1+Math.floor(u*y):Yn;_>Yn&&we(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Yn}`);const f=[];let w=0;for(let P=0;P<Yn;++P){const g=P/y,b=Math.exp(-g*g/2);f.push(b),P===0?w+=b:P<_&&(w+=2*b)}for(let P=0;P<f.length;P++)f[P]=f[P]/w;h.envMap.value=e.texture,h.samples.value=_,h.weights.value=f,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:C}=this;h.dTheta.value=x,h.mipInt.value=C-n;const M=this._sizeLods[r],R=3*M*(r>C-Un?r-C+Un:0),E=4*(this._cubeSize-M);vi(t,R,E,3*M,2*M),c.setRenderTarget(t),c.render(m,Gi)}}function kd(i){const e=[],t=[],n=[];let r=i;const s=i-Un+1+Go.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let c=1/o;a>i-Un?c=Go[a-i+Un-1]:a===0&&(c=0),t.push(c);const l=1/(o-2),u=-l,m=1+l,h=[u,u,m,u,m,m,u,u,m,m,u,m],d=6,x=6,y=3,_=2,f=1,w=new Float32Array(y*x*d),C=new Float32Array(_*x*d),M=new Float32Array(f*x*d);for(let E=0;E<d;E++){const P=E%3*2/3-1,g=E>2?0:-1,b=[P,g,0,P+2/3,g,0,P+2/3,g+1,0,P,g,0,P+2/3,g+1,0,P,g+1,0];w.set(b,y*x*E),C.set(h,_*x*E);const U=[E,E,E,E,E,E];M.set(U,f*x*E)}const R=new Xt;R.setAttribute("position",new $t(w,y)),R.setAttribute("uv",new $t(C,_)),R.setAttribute("faceIndex",new $t(M,f)),n.push(new Mn(R,null)),r>Un&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function ko(i,e,t){const n=new an(i,e,t);return n.texture.mapping=kr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function vi(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Wd(i,e,t){return new ln({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Vd,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:qr(),fragmentShader:`
|
|
3672
3672
|
|
|
3673
3673
|
precision highp float;
|
|
3674
3674
|
precision highp int;
|
|
@@ -3772,7 +3772,7 @@ void main() {
|
|
|
3772
3772
|
|
|
3773
3773
|
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
3774
3774
|
}
|
|
3775
|
-
`,blending:
|
|
3775
|
+
`,blending:_n,depthTest:!1,depthWrite:!1})}function Xd(i,e,t){const n=new Float32Array(Yn),r=new D(0,1,0);return new ln({name:"SphericalGaussianBlur",defines:{n:Yn,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:qr(),fragmentShader:`
|
|
3776
3776
|
|
|
3777
3777
|
precision mediump float;
|
|
3778
3778
|
precision mediump int;
|
|
@@ -3832,7 +3832,7 @@ void main() {
|
|
|
3832
3832
|
}
|
|
3833
3833
|
|
|
3834
3834
|
}
|
|
3835
|
-
`,blending:
|
|
3835
|
+
`,blending:_n,depthTest:!1,depthWrite:!1})}function Wo(){return new ln({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:qr(),fragmentShader:`
|
|
3836
3836
|
|
|
3837
3837
|
precision mediump float;
|
|
3838
3838
|
precision mediump int;
|
|
@@ -3851,7 +3851,7 @@ void main() {
|
|
|
3851
3851
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
3852
3852
|
|
|
3853
3853
|
}
|
|
3854
|
-
`,blending:
|
|
3854
|
+
`,blending:_n,depthTest:!1,depthWrite:!1})}function Xo(){return new ln({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:qr(),fragmentShader:`
|
|
3855
3855
|
|
|
3856
3856
|
precision mediump float;
|
|
3857
3857
|
precision mediump int;
|
|
@@ -3867,7 +3867,7 @@ void main() {
|
|
|
3867
3867
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
3868
3868
|
|
|
3869
3869
|
}
|
|
3870
|
-
`,blending:
|
|
3870
|
+
`,blending:_n,depthTest:!1,depthWrite:!1})}function qr(){return`
|
|
3871
3871
|
|
|
3872
3872
|
precision mediump float;
|
|
3873
3873
|
precision mediump int;
|
|
@@ -3957,7 +3957,7 @@ void main() {
|
|
|
3957
3957
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
3958
3958
|
|
|
3959
3959
|
}
|
|
3960
|
-
`},r=new qi(5,5,5),s=new ln({name:"CubemapFromEquirect",uniforms:wi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ut,blending:
|
|
3960
|
+
`},r=new qi(5,5,5),s=new ln({name:"CubemapFromEquirect",uniforms:wi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ut,blending:_n});s.uniforms.tEquirect.value=t;const a=new Mn(r,s),o=t.minFilter;return t.minFilter===qn&&(t.minFilter=At),new Kh(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)}}function Yd(i){let e=new WeakMap,t=new WeakMap,n=null;function r(h,d=!1){return h==null?null:d?a(h):s(h)}function s(h){if(h&&h.isTexture){const d=h.mapping;if(d===es||d===ts)if(e.has(h)){const x=e.get(h).texture;return o(x,h.mapping)}else{const x=h.image;if(x&&x.height>0){const y=new $l(x.height);return y.fromEquirectangularTexture(i,h),e.set(h,y),h.addEventListener("dispose",l),o(y.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const d=h.mapping,x=d===es||d===ts,y=d===$n||d===Ai;if(x||y){let _=t.get(h);const f=_!==void 0?_.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==f)return n===null&&(n=new Ho(i)),_=x?n.fromEquirectangular(h,_):n.fromCubemap(h,_),_.texture.pmremVersion=h.pmremVersion,t.set(h,_),_.texture;if(_!==void 0)return _.texture;{const w=h.image;return x&&w&&w.height>0||y&&w&&c(w)?(n===null&&(n=new Ho(i)),_=x?n.fromEquirectangular(h):n.fromCubemap(h),_.texture.pmremVersion=h.pmremVersion,t.set(h,_),h.addEventListener("dispose",u),_.texture):null}}}return h}function o(h,d){return d===es?h.mapping=$n:d===ts&&(h.mapping=Ai),h}function c(h){let d=0;const x=6;for(let y=0;y<x;y++)h[y]!==void 0&&d++;return d===x}function l(h){const d=h.target;d.removeEventListener("dispose",l);const x=e.get(d);x!==void 0&&(e.delete(d),x.dispose())}function u(h){const d=h.target;d.removeEventListener("dispose",u);const x=t.get(d);x!==void 0&&(t.delete(d),x.dispose())}function m(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:m}}function qd(i){const e={};function t(n){if(e[n]!==void 0)return e[n];const 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&&yi("WebGLRenderer: "+n+" extension not supported."),r}}}function Kd(i,e,t,n){const r={},s=new WeakMap;function a(m){const h=m.target;h.index!==null&&e.remove(h.index);for(const x in h.attributes)e.remove(h.attributes[x]);h.removeEventListener("dispose",a),delete r[h.id];const d=s.get(h);d&&(e.remove(d),s.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(m,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function c(m){const h=m.attributes;for(const d in h)e.update(h[d],i.ARRAY_BUFFER)}function l(m){const h=[],d=m.index,x=m.attributes.position;let y=0;if(x===void 0)return;if(d!==null){const w=d.array;y=d.version;for(let C=0,M=w.length;C<M;C+=3){const R=w[C+0],E=w[C+1],P=w[C+2];h.push(R,E,E,P,P,R)}}else{const w=x.array;y=x.version;for(let C=0,M=w.length/3-1;C<M;C+=3){const R=C+0,E=C+1,P=C+2;h.push(R,E,E,P,P,R)}}const _=new(x.count>=65535?Ol:Fl)(h,1);_.version=y;const f=s.get(m);f&&e.remove(f),s.set(m,_)}function u(m){const h=s.get(m);if(h){const d=m.index;d!==null&&h.version<d.version&&l(m)}else l(m);return s.get(m)}return{get:o,update:c,getWireframeAttribute:u}}function Zd(i,e,t){let n;function r(m){n=m}let s,a;function o(m){s=m.type,a=m.bytesPerElement}function c(m,h){i.drawElements(n,h,s,m*a),t.update(h,n,1)}function l(m,h,d){d!==0&&(i.drawElementsInstanced(n,h,s,m*a,d),t.update(h,n,d))}function u(m,h,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,h,0,s,m,0,d);let y=0;for(let _=0;_<d;_++)y+=h[_];t.update(y,n,1)}this.setMode=r,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function $d(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:Ge("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 Jd(i,e,t){const n=new WeakMap,r=new ht;function s(a,o,c){const l=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,m=u!==void 0?u.length:0;let h=n.get(o);if(h===void 0||h.count!==m){let b=function(){P.dispose(),n.delete(o),o.removeEventListener("dispose",b)};h!==void 0&&h.texture.dispose();const d=o.morphAttributes.position!==void 0,x=o.morphAttributes.normal!==void 0,y=o.morphAttributes.color!==void 0,_=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],w=o.morphAttributes.color||[];let C=0;d===!0&&(C=1),x===!0&&(C=2),y===!0&&(C=3);let M=o.attributes.position.count*C,R=1;M>e.maxTextureSize&&(R=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const E=new Float32Array(M*R*4*m),P=new Ul(E,M,R,m);P.type=nn,P.needsUpdate=!0;const g=C*4;for(let U=0;U<m;U++){const I=_[U],B=f[U],J=w[U],ee=M*R*4*U;for(let V=0;V<I.count;V++){const Z=V*g;d===!0&&(r.fromBufferAttribute(I,V),E[ee+Z+0]=r.x,E[ee+Z+1]=r.y,E[ee+Z+2]=r.z,E[ee+Z+3]=0),x===!0&&(r.fromBufferAttribute(B,V),E[ee+Z+4]=r.x,E[ee+Z+5]=r.y,E[ee+Z+6]=r.z,E[ee+Z+7]=0),y===!0&&(r.fromBufferAttribute(J,V),E[ee+Z+8]=r.x,E[ee+Z+9]=r.y,E[ee+Z+10]=r.z,E[ee+Z+11]=J.itemSize===4?r.w:1)}}h={count:m,texture:P,size:new Ce(M,R)},n.set(o,h),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let d=0;for(let y=0;y<l.length;y++)d+=l[y];const x=o.morphTargetsRelative?1:1-d;c.getUniforms().setValue(i,"morphTargetBaseInfluence",x),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",h.texture,t),c.getUniforms().setValue(i,"morphTargetsTextureSize",h.size)}return{update:s}}function Qd(i,e,t,n,r){let s=new WeakMap;function a(l){const u=r.render.frame,m=l.geometry,h=e.get(l,m);if(s.get(h)!==u&&(e.update(h),s.set(h,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),s.get(l)!==u&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),s.set(l,u))),l.isSkinnedMesh){const d=l.skeleton;s.get(d)!==u&&(d.update(),s.set(d,u))}return h}function o(){s=new WeakMap}function c(l){const u=l.target;u.removeEventListener("dispose",c),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}const jd={[xl]:"LINEAR_TONE_MAPPING",[vl]:"REINHARD_TONE_MAPPING",[Ml]:"CINEON_TONE_MAPPING",[Sl]:"ACES_FILMIC_TONE_MAPPING",[El]:"AGX_TONE_MAPPING",[bl]:"NEUTRAL_TONE_MAPPING",[yl]:"CUSTOM_TONE_MAPPING"};function ep(i,e,t,n,r,s){const a=new an(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Ri(e,t):void 0}),o=new an(e,t,{type:xn,depthBuffer:!1,stencilBuffer:!1}),c=new Xt;c.setAttribute("position",new zt([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new zt([0,2,0,0,2,0],2));const l=new Xh({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
3961
3961
|
precision highp float;
|
|
3962
3962
|
|
|
3963
3963
|
uniform mat4 modelViewMatrix;
|
|
@@ -4003,17 +4003,17 @@ void main() {
|
|
|
4003
4003
|
#ifdef SRGB_TRANSFER
|
|
4004
4004
|
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
4005
4005
|
#endif
|
|
4006
|
-
}`,depthTest:!1,depthWrite:!1}),u=new Mn(c,l),m=new ql(-1,1,1,-1,0,1);let h=null,d=null,x=!1,y,
|
|
4006
|
+
}`,depthTest:!1,depthWrite:!1}),u=new Mn(c,l),m=new ql(-1,1,1,-1,0,1);let h=null,d=null,x=!1,y,_=null,f=[],w=!1;this.setSize=function(C,M){a.setSize(C,M),o.setSize(C,M);for(let R=0;R<f.length;R++){const E=f[R];E.setSize&&E.setSize(C,M)}},this.setEffects=function(C){f=C,w=f.length>0&&f[0].isRenderPass===!0;const M=a.width,R=a.height;for(let E=0;E<f.length;E++){const P=f[E];P.setSize&&P.setSize(M,R)}},this.begin=function(C,M){if(x||C.toneMapping===sn&&f.length===0)return!1;if(_=M,M!==null){const R=M.width,E=M.height;(a.width!==R||a.height!==E)&&this.setSize(R,E)}return w===!1&&C.setRenderTarget(a),y=C.toneMapping,C.toneMapping=sn,!0},this.hasRenderPass=function(){return w},this.end=function(C,M){C.toneMapping=y,x=!0;let R=a,E=o;for(let P=0;P<f.length;P++){const g=f[P];if(g.enabled!==!1&&(g.render(C,E,R,M),g.needsSwap!==!1)){const b=R;R=E,E=b}}if(h!==C.outputColorSpace||d!==C.toneMapping){h=C.outputColorSpace,d=C.toneMapping,l.defines={},Ve.getTransfer(h)===Ze&&(l.defines.SRGB_TRANSFER="");const P=jd[d];P&&(l.defines[P]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=R.texture,C.setRenderTarget(_),C.render(u,m),_=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){a.depthTexture&&a.depthTexture.dispose(),a.dispose(),o.dispose(),c.dispose(),l.dispose()}}const Jl=new Rt,Ra=new Ri(1,1),Ql=new Ul,jl=new fh,ec=new kl,Yo=[],qo=[],Ko=new Float32Array(16),Zo=new Float32Array(9),$o=new Float32Array(4);function Pi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Yo[r];if(s===void 0&&(s=new Float32Array(r),Yo[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 xt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function vt(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Kr(i,e){let t=qo[e];t===void 0&&(t=new Int32Array(e),qo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function tp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function np(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(xt(t,e))return;i.uniform2fv(this.addr,e),vt(t,e)}}function ip(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(xt(t,e))return;i.uniform3fv(this.addr,e),vt(t,e)}}function rp(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(xt(t,e))return;i.uniform4fv(this.addr,e),vt(t,e)}}function sp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(xt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),vt(t,e)}else{if(xt(t,n))return;$o.set(n),i.uniformMatrix2fv(this.addr,!1,$o),vt(t,n)}}function ap(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(xt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),vt(t,e)}else{if(xt(t,n))return;Zo.set(n),i.uniformMatrix3fv(this.addr,!1,Zo),vt(t,n)}}function op(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(xt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),vt(t,e)}else{if(xt(t,n))return;Ko.set(n),i.uniformMatrix4fv(this.addr,!1,Ko),vt(t,n)}}function lp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function cp(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(xt(t,e))return;i.uniform2iv(this.addr,e),vt(t,e)}}function hp(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(xt(t,e))return;i.uniform3iv(this.addr,e),vt(t,e)}}function up(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(xt(t,e))return;i.uniform4iv(this.addr,e),vt(t,e)}}function fp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function dp(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(xt(t,e))return;i.uniform2uiv(this.addr,e),vt(t,e)}}function pp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(xt(t,e))return;i.uniform3uiv(this.addr,e),vt(t,e)}}function mp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||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(xt(t,e))return;i.uniform4uiv(this.addr,e),vt(t,e)}}function _p(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?(Ra.compareFunction=t.isReversedDepthBuffer()?Ba:Oa,s=Ra):s=Jl,t.setTexture2D(e||s,r)}function gp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||jl,r)}function xp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||ec,r)}function vp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Ql,r)}function Mp(i){switch(i){case 5126:return tp;case 35664:return np;case 35665:return ip;case 35666:return rp;case 35674:return sp;case 35675:return ap;case 35676:return op;case 5124:case 35670:return lp;case 35667:case 35671:return cp;case 35668:case 35672:return hp;case 35669:case 35673:return up;case 5125:return fp;case 36294:return dp;case 36295:return pp;case 36296:return mp;case 35678:case 36198:case 36298:case 36306:case 35682:return _p;case 35679:case 36299:case 36307:return gp;case 35680:case 36300:case 36308:case 36293:return xp;case 36289:case 36303:case 36311:case 36292:return vp}}function Sp(i,e){i.uniform1fv(this.addr,e)}function yp(i,e){const t=Pi(e,this.size,2);i.uniform2fv(this.addr,t)}function Ep(i,e){const t=Pi(e,this.size,3);i.uniform3fv(this.addr,t)}function bp(i,e){const t=Pi(e,this.size,4);i.uniform4fv(this.addr,t)}function Tp(i,e){const t=Pi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Ap(i,e){const t=Pi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Rp(i,e){const t=Pi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function wp(i,e){i.uniform1iv(this.addr,e)}function Cp(i,e){i.uniform2iv(this.addr,e)}function Pp(i,e){i.uniform3iv(this.addr,e)}function Dp(i,e){i.uniform4iv(this.addr,e)}function Lp(i,e){i.uniform1uiv(this.addr,e)}function Ip(i,e){i.uniform2uiv(this.addr,e)}function Up(i,e){i.uniform3uiv(this.addr,e)}function Np(i,e){i.uniform4uiv(this.addr,e)}function Fp(i,e,t){const n=this.cache,r=e.length,s=Kr(t,r);xt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));let a;this.type===i.SAMPLER_2D_SHADOW?a=Ra:a=Jl;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function Op(i,e,t){const n=this.cache,r=e.length,s=Kr(t,r);xt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||jl,s[a])}function Bp(i,e,t){const n=this.cache,r=e.length,s=Kr(t,r);xt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||ec,s[a])}function zp(i,e,t){const n=this.cache,r=e.length,s=Kr(t,r);xt(n,s)||(i.uniform1iv(this.addr,s),vt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Ql,s[a])}function Gp(i){switch(i){case 5126:return Sp;case 35664:return yp;case 35665:return Ep;case 35666:return bp;case 35674:return Tp;case 35675:return Ap;case 35676:return Rp;case 5124:case 35670:return wp;case 35667:case 35671:return Cp;case 35668:case 35672:return Pp;case 35669:case 35673:return Dp;case 5125:return Lp;case 36294:return Ip;case 36295:return Up;case 36296:return Np;case 35678:case 36198:case 36298:case 36306:case 35682:return Fp;case 35679:case 36299:case 36307:return Op;case 35680:case 36300:case 36308:case 36293:return Bp;case 36289:case 36303:case 36311:case 36292:return zp}}class Vp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Mp(t.type)}}class Hp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Gp(t.type)}}class kp{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 Is=/(\w+)(\])?(\[|\.)?/g;function Jo(i,e){i.seq.push(e),i.map[e.id]=e}function Wp(i,e,t){const n=i.name,r=n.length;for(Is.lastIndex=0;;){const s=Is.exec(n),a=Is.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===r){Jo(t,l===void 0?new Vp(o,i,e):new Hp(o,i,e));break}else{let m=t.map[o];m===void 0&&(m=new kp(o),Jo(t,m)),t=m}}}class Dr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);Wp(o,c,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}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],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.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 Qo(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Xp=37297;let Yp=0;function qp(i,e){const t=i.split(`
|
|
4007
4007
|
`),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(`
|
|
4008
|
-
`)}const jo=new Le;function
|
|
4008
|
+
`)}const jo=new Le;function Kp(i){Ve._getMatrix(jo,Ve.workingColorSpace,i);const e=`mat3( ${jo.elements.map(t=>t.toFixed(4))} )`;switch(Ve.getTransfer(i)){case Nr:return[e,"LinearTransferOETF"];case Ze:return[e,"sRGBTransferOETF"];default:return we("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function el(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
|
|
4009
4009
|
|
|
4010
4010
|
`+s+`
|
|
4011
4011
|
|
|
4012
|
-
`+
|
|
4013
|
-
`)}const
|
|
4014
|
-
`)}function
|
|
4015
|
-
`)}function
|
|
4016
|
-
`)}function
|
|
4012
|
+
`+qp(i.getShaderSource(e),o)}else return s}function Zp(i,e){const t=Kp(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
|
4013
|
+
`)}const $p={[xl]:"Linear",[vl]:"Reinhard",[Ml]:"Cineon",[Sl]:"ACESFilmic",[El]:"AgX",[bl]:"Neutral",[yl]:"Custom"};function Jp(i,e){const t=$p[e];return t===void 0?(we("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Er=new D;function Qp(){Ve.getLuminanceCoefficients(Er);const i=Er.x.toFixed(4),e=Er.y.toFixed(4),t=Er.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
|
4014
|
+
`)}function jp(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ki).join(`
|
|
4015
|
+
`)}function em(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
4016
|
+
`)}function tm(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 ki(i){return i!==""}function tl(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 nl(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const nm=/^[ \t]*#include +<([\w\d./]+)>/gm;function wa(i){return i.replace(nm,rm)}const im=new Map;function rm(i,e){let t=Ue[e];if(t===void 0){const n=im.get(e);if(n!==void 0)t=Ue[n],we('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return wa(t)}const sm=/#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 il(i){return i.replace(sm,am)}function am(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 rl(i){let e=`precision ${i.precision} float;
|
|
4017
4017
|
precision ${i.precision} int;
|
|
4018
4018
|
precision ${i.precision} sampler2D;
|
|
4019
4019
|
precision ${i.precision} samplerCube;
|
|
@@ -4033,30 +4033,30 @@ void main() {
|
|
|
4033
4033
|
`;return i.precision==="highp"?e+=`
|
|
4034
4034
|
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
|
|
4035
4035
|
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
|
|
4036
|
-
#define LOW_PRECISION`),e}const
|
|
4037
|
-
`:"";t.isRawShaderMaterial?(
|
|
4038
|
-
`),
|
|
4036
|
+
#define LOW_PRECISION`),e}const om={[Tr]:"SHADOWMAP_TYPE_PCF",[Hi]:"SHADOWMAP_TYPE_VSM"};function lm(i){return om[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const cm={[$n]:"ENVMAP_TYPE_CUBE",[Ai]:"ENVMAP_TYPE_CUBE",[kr]:"ENVMAP_TYPE_CUBE_UV"};function hm(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":cm[i.envMapMode]||"ENVMAP_TYPE_CUBE"}const um={[Ai]:"ENVMAP_MODE_REFRACTION"};function fm(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":um[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const dm={[gl]:"ENVMAP_BLENDING_MULTIPLY",[Wc]:"ENVMAP_BLENDING_MIX",[Xc]:"ENVMAP_BLENDING_ADD"};function pm(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":dm[i.combine]||"ENVMAP_BLENDING_NONE"}function mm(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function _m(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=lm(t),l=hm(t),u=fm(t),m=pm(t),h=mm(t),d=jp(t),x=em(s),y=r.createProgram();let _,f,w=t.glslVersion?"#version "+t.glslVersion+`
|
|
4037
|
+
`:"";t.isRawShaderMaterial?(_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(ki).join(`
|
|
4038
|
+
`),_.length>0&&(_+=`
|
|
4039
4039
|
`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(ki).join(`
|
|
4040
4040
|
`),f.length>0&&(f+=`
|
|
4041
|
-
`)):(
|
|
4041
|
+
`)):(_=[rl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,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.vertexNormals?"#define HAS_NORMAL":"",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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
|
|
4042
4042
|
`].filter(ki).join(`
|
|
4043
|
-
`),f=[rl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,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 "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+m:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==sn?"#define TONE_MAPPING":"",t.toneMapping!==sn?Ue.tonemapping_pars_fragment:"",t.toneMapping!==sn?
|
|
4043
|
+
`),f=[rl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,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 "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+m:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==sn?"#define TONE_MAPPING":"",t.toneMapping!==sn?Ue.tonemapping_pars_fragment:"",t.toneMapping!==sn?Jp("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ue.colorspace_pars_fragment,Zp("linearToOutputTexel",t.outputColorSpace),Qp(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
4044
4044
|
`].filter(ki).join(`
|
|
4045
4045
|
`)),a=wa(a),a=tl(a,t),a=nl(a,t),o=wa(o),o=tl(o,t),o=nl(o,t),a=il(a),o=il(o),t.isRawShaderMaterial!==!0&&(w=`#version 300 es
|
|
4046
|
-
`,
|
|
4046
|
+
`,_=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
4047
4047
|
`)+`
|
|
4048
|
-
`+
|
|
4048
|
+
`+_,f=["#define varying in",t.glslVersion===co?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===co?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|
4049
4049
|
`)+`
|
|
4050
|
-
`+f);const C=w+
|
|
4050
|
+
`+f);const C=w+_+a,M=w+f+o,R=Qo(r,r.VERTEX_SHADER,C),E=Qo(r,r.FRAGMENT_SHADER,M);r.attachShader(y,R),r.attachShader(y,E),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function P(I){if(i.debug.checkShaderErrors){const B=r.getProgramInfoLog(y)||"",J=r.getShaderInfoLog(R)||"",ee=r.getShaderInfoLog(E)||"",V=B.trim(),Z=J.trim(),W=ee.trim();let ne=!0,re=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(ne=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,y,R,E);else{const de=el(r,R,"vertex"),_e=el(r,E,"fragment");Ge("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+`
|
|
4051
4051
|
|
|
4052
4052
|
Material Name: `+I.name+`
|
|
4053
4053
|
Material Type: `+I.type+`
|
|
4054
4054
|
|
|
4055
4055
|
Program Info Log: `+V+`
|
|
4056
4056
|
`+de+`
|
|
4057
|
-
`+ge)}else V!==""?we("WebGLProgram: Program Info Log:",V):(Z===""||W==="")&&(re=!1);re&&(I.diagnostics={runnable:ne,programLog:V,vertexShader:{log:Z,prefix:g},fragmentShader:{log:W,prefix:f}})}r.deleteShader(R),r.deleteShader(E),_=new Dr(r,y),b=nm(r,y)}let _;this.getUniforms=function(){return _===void 0&&P(this),_};let b;this.getAttributes=function(){return b===void 0&&P(this),b};let U=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return U===!1&&(U=r.getProgramParameter(y,Yp)),U},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=qp++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=E,this}let xm=0;class vm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.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}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}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 Mm(e),t.set(e,n)),n}}class Mm{constructor(e){this.id=xm++,this.code=e,this.usedTimes=0}}function Sm(i){return i===Jn||i===Lr||i===Ir}function ym(i,e,t,n,r,s){const a=new Ga,o=new vm,c=new Set,l=[],u=new Map,m=n.logarithmicDepthBuffer;let h=n.precision;const d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 x(_){return c.add(_),_===0?"uv":`uv${_}`}function y(_,b,U,I,B,J){const ee=I.fog,V=B.geometry,Z=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?I.environment:null,W=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,ne=e.get(_.envMap||Z,W),re=ne&&ne.mapping===kr?ne.image.height:null,de=d[_.type];_.precision!==null&&(h=n.getMaxPrecision(_.precision),h!==_.precision&&we("WebGLProgram.getParameters:",_.precision,"not supported, using",h,"instead."));const ge=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,ye=ge!==void 0?ge.length:0;let He=0;V.morphAttributes.position!==void 0&&(He=1),V.morphAttributes.normal!==void 0&&(He=2),V.morphAttributes.color!==void 0&&(He=3);let it,ke,j,ue;if(de){const pe=en[de];it=pe.vertexShader,ke=pe.fragmentShader}else{it=_.vertexShader,ke=_.fragmentShader;const pe=o.getVertexShaderStage(_),Ke=o.getFragmentShaderStage(_);o.update(_,pe,Ke),j=pe.id,ue=Ke.id}const se=i.getRenderTarget(),Pe=i.state.buffers.depth.getReversed(),De=B.isInstancedMesh===!0,Re=B.isBatchedMesh===!0,rt=!!_.map,Ne=!!_.matcap,qe=!!ne,We=!!_.aoMap,ze=!!_.lightMap,ot=!!_.bumpMap&&_.wireframe===!1,ut=!!_.normalMap,pt=!!_.displacementMap,mt=!!_.emissiveMap,st=!!_.metalnessMap,lt=!!_.roughnessMap,L=_.anisotropy>0,St=_.clearcoat>0,Xe=_.dispersion>0,S=_.iridescence>0,p=_.sheen>0,O=_.transmission>0,H=L&&!!_.anisotropyMap,q=St&&!!_.clearcoatMap,oe=St&&!!_.clearcoatNormalMap,ce=St&&!!_.clearcoatRoughnessMap,K=S&&!!_.iridescenceMap,Q=S&&!!_.iridescenceThicknessMap,he=p&&!!_.sheenColorMap,Ee=p&&!!_.sheenRoughnessMap,T=!!_.specularMap,F=!!_.specularColorMap,Y=!!_.specularIntensityMap,te=O&&!!_.transmissionMap,fe=O&&!!_.thicknessMap,A=!!_.gradientMap,ie=!!_.alphaMap,X=_.alphaTest>0,ae=!!_.alphaHash,le=!!_.extensions;let $=sn;_.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&($=i.toneMapping);const ve={shaderID:de,shaderType:_.type,shaderName:_.name,vertexShader:it,fragmentShader:ke,defines:_.defines,customVertexShaderID:j,customFragmentShaderID:ue,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:h,batching:Re,batchingColor:Re&&B._colorsTexture!==null,instancing:De,instancingColor:De&&B.instanceColor!==null,instancingMorph:De&&B.morphTexture!==null,outputColorSpace:se===null?i.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:Ve.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:rt,matcap:Ne,envMap:qe,envMapMode:qe&&ne.mapping,envMapCubeUVHeight:re,aoMap:We,lightMap:ze,bumpMap:ot,normalMap:ut,displacementMap:pt,emissiveMap:mt,normalMapObjectSpace:ut&&_.normalMapType===Zc,normalMapTangentSpace:ut&&_.normalMapType===oo,packedNormalMap:ut&&_.normalMapType===oo&&Sm(_.normalMap.format),metalnessMap:st,roughnessMap:lt,anisotropy:L,anisotropyMap:H,clearcoat:St,clearcoatMap:q,clearcoatNormalMap:oe,clearcoatRoughnessMap:ce,dispersion:Xe,iridescence:S,iridescenceMap:K,iridescenceThicknessMap:Q,sheen:p,sheenColorMap:he,sheenRoughnessMap:Ee,specularMap:T,specularColorMap:F,specularIntensityMap:Y,transmission:O,transmissionMap:te,thicknessMap:fe,gradientMap:A,opaque:_.transparent===!1&&_.blending===Fn&&_.alphaToCoverage===!1,alphaMap:ie,alphaTest:X,alphaHash:ae,combine:_.combine,mapUv:rt&&x(_.map.channel),aoMapUv:We&&x(_.aoMap.channel),lightMapUv:ze&&x(_.lightMap.channel),bumpMapUv:ot&&x(_.bumpMap.channel),normalMapUv:ut&&x(_.normalMap.channel),displacementMapUv:pt&&x(_.displacementMap.channel),emissiveMapUv:mt&&x(_.emissiveMap.channel),metalnessMapUv:st&&x(_.metalnessMap.channel),roughnessMapUv:lt&&x(_.roughnessMap.channel),anisotropyMapUv:H&&x(_.anisotropyMap.channel),clearcoatMapUv:q&&x(_.clearcoatMap.channel),clearcoatNormalMapUv:oe&&x(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ce&&x(_.clearcoatRoughnessMap.channel),iridescenceMapUv:K&&x(_.iridescenceMap.channel),iridescenceThicknessMapUv:Q&&x(_.iridescenceThicknessMap.channel),sheenColorMapUv:he&&x(_.sheenColorMap.channel),sheenRoughnessMapUv:Ee&&x(_.sheenRoughnessMap.channel),specularMapUv:T&&x(_.specularMap.channel),specularColorMapUv:F&&x(_.specularColorMap.channel),specularIntensityMapUv:Y&&x(_.specularIntensityMap.channel),transmissionMapUv:te&&x(_.transmissionMap.channel),thicknessMapUv:fe&&x(_.thicknessMap.channel),alphaMapUv:ie&&x(_.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(ut||L),vertexNormals:!!V.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!V.attributes.uv&&(rt||ie),fog:!!ee,useFog:_.fog===!0,fogExp2:!!ee&&ee.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||V.attributes.normal===void 0&&ut===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:m,reversedDepthBuffer:Pe,skinning:B.isSkinnedMesh===!0,hasPositionAttribute:V.attributes.position!==void 0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:ye,morphTextureStride:He,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numLightProbeGrids:J.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:i.shadowMap.enabled&&U.length>0,shadowMapType:i.shadowMap.type,toneMapping:$,decodeVideoTexture:rt&&_.map.isVideoTexture===!0&&Ve.getTransfer(_.map.colorSpace)===Ze,decodeVideoTextureEmissive:mt&&_.emissiveMap.isVideoTexture===!0&&Ve.getTransfer(_.emissiveMap.colorSpace)===Ze,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===pn,flipSided:_.side===Ut,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:le&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(le&&_.extensions.multiDraw===!0||Re)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return ve.vertexUv1s=c.has(1),ve.vertexUv2s=c.has(2),ve.vertexUv3s=c.has(3),c.clear(),ve}function g(_){const b=[];if(_.shaderID?b.push(_.shaderID):(b.push(_.customVertexShaderID),b.push(_.customFragmentShaderID)),_.defines!==void 0)for(const U in _.defines)b.push(U),b.push(_.defines[U]);return _.isRawShaderMaterial===!1&&(f(b,_),w(b,_),b.push(i.outputColorSpace)),b.push(_.customProgramCacheKey),b.join()}function f(_,b){_.push(b.precision),_.push(b.outputColorSpace),_.push(b.envMapMode),_.push(b.envMapCubeUVHeight),_.push(b.mapUv),_.push(b.alphaMapUv),_.push(b.lightMapUv),_.push(b.aoMapUv),_.push(b.bumpMapUv),_.push(b.normalMapUv),_.push(b.displacementMapUv),_.push(b.emissiveMapUv),_.push(b.metalnessMapUv),_.push(b.roughnessMapUv),_.push(b.anisotropyMapUv),_.push(b.clearcoatMapUv),_.push(b.clearcoatNormalMapUv),_.push(b.clearcoatRoughnessMapUv),_.push(b.iridescenceMapUv),_.push(b.iridescenceThicknessMapUv),_.push(b.sheenColorMapUv),_.push(b.sheenRoughnessMapUv),_.push(b.specularMapUv),_.push(b.specularColorMapUv),_.push(b.specularIntensityMapUv),_.push(b.transmissionMapUv),_.push(b.thicknessMapUv),_.push(b.combine),_.push(b.fogExp2),_.push(b.sizeAttenuation),_.push(b.morphTargetsCount),_.push(b.morphAttributeCount),_.push(b.numDirLights),_.push(b.numPointLights),_.push(b.numSpotLights),_.push(b.numSpotLightMaps),_.push(b.numHemiLights),_.push(b.numRectAreaLights),_.push(b.numDirLightShadows),_.push(b.numPointLightShadows),_.push(b.numSpotLightShadows),_.push(b.numSpotLightShadowsWithMaps),_.push(b.numLightProbes),_.push(b.shadowMapType),_.push(b.toneMapping),_.push(b.numClippingPlanes),_.push(b.numClipIntersection),_.push(b.depthPacking)}function w(_,b){a.disableAll(),b.instancing&&a.enable(0),b.instancingColor&&a.enable(1),b.instancingMorph&&a.enable(2),b.matcap&&a.enable(3),b.envMap&&a.enable(4),b.normalMapObjectSpace&&a.enable(5),b.normalMapTangentSpace&&a.enable(6),b.clearcoat&&a.enable(7),b.iridescence&&a.enable(8),b.alphaTest&&a.enable(9),b.vertexColors&&a.enable(10),b.vertexAlphas&&a.enable(11),b.vertexUv1s&&a.enable(12),b.vertexUv2s&&a.enable(13),b.vertexUv3s&&a.enable(14),b.vertexTangents&&a.enable(15),b.anisotropy&&a.enable(16),b.alphaHash&&a.enable(17),b.batching&&a.enable(18),b.dispersion&&a.enable(19),b.batchingColor&&a.enable(20),b.gradientMap&&a.enable(21),b.packedNormalMap&&a.enable(22),b.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.reversedDepthBuffer&&a.enable(4),b.skinning&&a.enable(5),b.morphTargets&&a.enable(6),b.morphNormals&&a.enable(7),b.morphColors&&a.enable(8),b.premultipliedAlpha&&a.enable(9),b.shadowMapEnabled&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),b.decodeVideoTexture&&a.enable(19),b.decodeVideoTextureEmissive&&a.enable(20),b.alphaToCoverage&&a.enable(21),b.numLightProbeGrids>0&&a.enable(22),b.hasPositionAttribute&&a.enable(23),_.push(a.mask)}function C(_){const b=d[_.type];let U;if(b){const I=en[b];U=kh.clone(I.uniforms)}else U=_.uniforms;return U}function M(_,b){let U=u.get(b);return U!==void 0?++U.usedTimes:(U=new _m(i,b,_,r),l.push(U),u.set(b,U)),U}function R(_){if(--_.usedTimes===0){const b=l.indexOf(_);l[b]=l[l.length-1],l.pop(),u.delete(_.cacheKey),_.destroy()}}function E(_){o.remove(_)}function P(){o.dispose()}return{getParameters:y,getProgramCacheKey:g,getUniforms:C,acquireProgram:M,releaseProgram:R,releaseShaderCache:E,programs:l,dispose:P}}function Em(){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,c){i.get(a)[o]=c}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function bm(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.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function sl(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 al(){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){let d=0;return h.isInstancedMesh&&(d+=2),h.isSkinnedMesh&&(d+=1),d}function o(h,d,x,y,g,f){let w=i[e];return w===void 0?(w={id:h.id,object:h,geometry:d,material:x,materialVariant:a(h),groupOrder:y,renderOrder:h.renderOrder,z:g,group:f},i[e]=w):(w.id=h.id,w.object=h,w.geometry=d,w.material=x,w.materialVariant=a(h),w.groupOrder=y,w.renderOrder=h.renderOrder,w.z=g,w.group=f),e++,w}function c(h,d,x,y,g,f){const w=o(h,d,x,y,g,f);x.transmission>0?n.push(w):x.transparent===!0?r.push(w):t.push(w)}function l(h,d,x,y,g,f){const w=o(h,d,x,y,g,f);x.transmission>0?n.unshift(w):x.transparent===!0?r.unshift(w):t.unshift(w)}function u(h,d,x){t.length>1&&t.sort(h||bm),n.length>1&&n.sort(d||sl),r.length>1&&r.sort(d||sl),x&&(t.reverse(),n.reverse(),r.reverse())}function m(){for(let h=e,d=i.length;h<d;h++){const x=i[h];if(x.id===null)break;x.id=null,x.object=null,x.geometry=null,x.material=null,x.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:c,unshift:l,finish:m,sort:u}}function Tm(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new al,i.set(n,[a])):r>=s.length?(a=new al,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Am(){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 D,color:new Be};break;case"SpotLight":t={position:new D,direction:new D,color:new Be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Be,groundColor:new Be};break;case"RectAreaLight":t={color:new Be,position:new D,halfWidth:new D,halfHeight:new D};break}return i[e.id]=t,t}}}function Rm(){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 Ce};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let wm=0;function Cm(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Pm(i){const e=new Am,t=Rm(),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 l=0;l<9;l++)n.probe.push(new D);const r=new D,s=new at,a=new at;function o(l){let u=0,m=0,h=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let d=0,x=0,y=0,g=0,f=0,w=0,C=0,M=0,R=0,E=0,P=0;l.sort(Cm);for(let b=0,U=l.length;b<U;b++){const I=l[b],B=I.color,J=I.intensity,ee=I.distance;let V=null;if(I.shadow&&I.shadow.map&&(I.shadow.map.texture.format===Jn?V=I.shadow.map.texture:V=I.shadow.map.depthTexture||I.shadow.map.texture),I.isAmbientLight)u+=B.r*J,m+=B.g*J,h+=B.b*J;else if(I.isLightProbe){for(let Z=0;Z<9;Z++)n.probe[Z].addScaledVector(I.sh.coefficients[Z],J);P++}else if(I.isDirectionalLight){const Z=e.get(I);if(Z.color.copy(I.color).multiplyScalar(I.intensity),I.castShadow){const W=I.shadow,ne=t.get(I);ne.shadowIntensity=W.intensity,ne.shadowBias=W.bias,ne.shadowNormalBias=W.normalBias,ne.shadowRadius=W.radius,ne.shadowMapSize=W.mapSize,n.directionalShadow[d]=ne,n.directionalShadowMap[d]=V,n.directionalShadowMatrix[d]=I.shadow.matrix,w++}n.directional[d]=Z,d++}else if(I.isSpotLight){const Z=e.get(I);Z.position.setFromMatrixPosition(I.matrixWorld),Z.color.copy(B).multiplyScalar(J),Z.distance=ee,Z.coneCos=Math.cos(I.angle),Z.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),Z.decay=I.decay,n.spot[y]=Z;const W=I.shadow;if(I.map&&(n.spotLightMap[R]=I.map,R++,W.updateMatrices(I),I.castShadow&&E++),n.spotLightMatrix[y]=W.matrix,I.castShadow){const ne=t.get(I);ne.shadowIntensity=W.intensity,ne.shadowBias=W.bias,ne.shadowNormalBias=W.normalBias,ne.shadowRadius=W.radius,ne.shadowMapSize=W.mapSize,n.spotShadow[y]=ne,n.spotShadowMap[y]=V,M++}y++}else if(I.isRectAreaLight){const Z=e.get(I);Z.color.copy(B).multiplyScalar(J),Z.halfWidth.set(I.width*.5,0,0),Z.halfHeight.set(0,I.height*.5,0),n.rectArea[g]=Z,g++}else if(I.isPointLight){const Z=e.get(I);if(Z.color.copy(I.color).multiplyScalar(I.intensity),Z.distance=I.distance,Z.decay=I.decay,I.castShadow){const W=I.shadow,ne=t.get(I);ne.shadowIntensity=W.intensity,ne.shadowBias=W.bias,ne.shadowNormalBias=W.normalBias,ne.shadowRadius=W.radius,ne.shadowMapSize=W.mapSize,ne.shadowCameraNear=W.camera.near,ne.shadowCameraFar=W.camera.far,n.pointShadow[x]=ne,n.pointShadowMap[x]=V,n.pointShadowMatrix[x]=I.shadow.matrix,C++}n.point[x]=Z,x++}else if(I.isHemisphereLight){const Z=e.get(I);Z.skyColor.copy(I.color).multiplyScalar(J),Z.groundColor.copy(I.groundColor).multiplyScalar(J),n.hemi[f]=Z,f++}}g>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=me.LTC_FLOAT_1,n.rectAreaLTC2=me.LTC_FLOAT_2):(n.rectAreaLTC1=me.LTC_HALF_1,n.rectAreaLTC2=me.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=m,n.ambient[2]=h;const _=n.hash;(_.directionalLength!==d||_.pointLength!==x||_.spotLength!==y||_.rectAreaLength!==g||_.hemiLength!==f||_.numDirectionalShadows!==w||_.numPointShadows!==C||_.numSpotShadows!==M||_.numSpotMaps!==R||_.numLightProbes!==P)&&(n.directional.length=d,n.spot.length=y,n.rectArea.length=g,n.point.length=x,n.hemi.length=f,n.directionalShadow.length=w,n.directionalShadowMap.length=w,n.pointShadow.length=C,n.pointShadowMap.length=C,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=w,n.pointShadowMatrix.length=C,n.spotLightMatrix.length=M+R-E,n.spotLightMap.length=R,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=P,_.directionalLength=d,_.pointLength=x,_.spotLength=y,_.rectAreaLength=g,_.hemiLength=f,_.numDirectionalShadows=w,_.numPointShadows=C,_.numSpotShadows=M,_.numSpotMaps=R,_.numLightProbes=P,n.version=wm++)}function c(l,u){let m=0,h=0,d=0,x=0,y=0;const g=u.matrixWorldInverse;for(let f=0,w=l.length;f<w;f++){const C=l[f];if(C.isDirectionalLight){const M=n.directional[m];M.direction.setFromMatrixPosition(C.matrixWorld),r.setFromMatrixPosition(C.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(g),m++}else if(C.isSpotLight){const M=n.spot[d];M.position.setFromMatrixPosition(C.matrixWorld),M.position.applyMatrix4(g),M.direction.setFromMatrixPosition(C.matrixWorld),r.setFromMatrixPosition(C.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(g),d++}else if(C.isRectAreaLight){const M=n.rectArea[x];M.position.setFromMatrixPosition(C.matrixWorld),M.position.applyMatrix4(g),a.identity(),s.copy(C.matrixWorld),s.premultiply(g),a.extractRotation(s),M.halfWidth.set(C.width*.5,0,0),M.halfHeight.set(0,C.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),x++}else if(C.isPointLight){const M=n.point[h];M.position.setFromMatrixPosition(C.matrixWorld),M.position.applyMatrix4(g),h++}else if(C.isHemisphereLight){const M=n.hemi[y];M.direction.setFromMatrixPosition(C.matrixWorld),M.direction.transformDirection(g),y++}}}return{setup:o,setupView:c,state:n}}function ol(i){const e=new Pm(i),t=[],n=[],r=[];function s(h){m.camera=h,t.length=0,n.length=0,r.length=0}function a(h){t.push(h)}function o(h){n.push(h)}function c(h){r.push(h)}function l(){e.setup(t)}function u(h){e.setupView(t,h)}const m={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:m,setupLights:l,setupLightsView:u,pushLight:a,pushShadow:o,pushLightProbeGrid:c}}function Dm(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new ol(i),e.set(r,[o])):s>=a.length?(o=new ol(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Lm=`void main() {
|
|
4057
|
+
`+_e)}else V!==""?we("WebGLProgram: Program Info Log:",V):(Z===""||W==="")&&(re=!1);re&&(I.diagnostics={runnable:ne,programLog:V,vertexShader:{log:Z,prefix:_},fragmentShader:{log:W,prefix:f}})}r.deleteShader(R),r.deleteShader(E),g=new Dr(r,y),b=tm(r,y)}let g;this.getUniforms=function(){return g===void 0&&P(this),g};let b;this.getAttributes=function(){return b===void 0&&P(this),b};let U=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return U===!1&&(U=r.getProgramParameter(y,Xp)),U},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Yp++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=E,this}let gm=0;class xm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.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}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}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 vm(e),t.set(e,n)),n}}class vm{constructor(e){this.id=gm++,this.code=e,this.usedTimes=0}}function Mm(i){return i===Jn||i===Lr||i===Ir}function Sm(i,e,t,n,r,s){const a=new Ga,o=new xm,c=new Set,l=[],u=new Map,m=n.logarithmicDepthBuffer;let h=n.precision;const d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 x(g){return c.add(g),g===0?"uv":`uv${g}`}function y(g,b,U,I,B,J){const ee=I.fog,V=B.geometry,Z=g.isMeshStandardMaterial||g.isMeshLambertMaterial||g.isMeshPhongMaterial?I.environment:null,W=g.isMeshStandardMaterial||g.isMeshLambertMaterial&&!g.envMap||g.isMeshPhongMaterial&&!g.envMap,ne=e.get(g.envMap||Z,W),re=ne&&ne.mapping===kr?ne.image.height:null,de=d[g.type];g.precision!==null&&(h=n.getMaxPrecision(g.precision),h!==g.precision&&we("WebGLProgram.getParameters:",g.precision,"not supported, using",h,"instead."));const _e=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,ye=_e!==void 0?_e.length:0;let ke=0;V.morphAttributes.position!==void 0&&(ke=1),V.morphAttributes.normal!==void 0&&(ke=2),V.morphAttributes.color!==void 0&&(ke=3);let it,We,j,ue;if(de){const pe=en[de];it=pe.vertexShader,We=pe.fragmentShader}else{it=g.vertexShader,We=g.fragmentShader;const pe=o.getVertexShaderStage(g),Ke=o.getFragmentShaderStage(g);o.update(g,pe,Ke),j=pe.id,ue=Ke.id}const ae=i.getRenderTarget(),Pe=i.state.buffers.depth.getReversed(),De=B.isInstancedMesh===!0,Re=B.isBatchedMesh===!0,rt=!!g.map,Ne=!!g.matcap,qe=!!ne,Xe=!!g.aoMap,ze=!!g.lightMap,ot=!!g.bumpMap&&g.wireframe===!1,ut=!!g.normalMap,pt=!!g.displacementMap,mt=!!g.emissiveMap,st=!!g.metalnessMap,lt=!!g.roughnessMap,L=g.anisotropy>0,St=g.clearcoat>0,He=g.dispersion>0,S=g.iridescence>0,p=g.sheen>0,O=g.transmission>0,H=L&&!!g.anisotropyMap,q=St&&!!g.clearcoatMap,oe=St&&!!g.clearcoatNormalMap,ce=St&&!!g.clearcoatRoughnessMap,K=S&&!!g.iridescenceMap,Q=S&&!!g.iridescenceThicknessMap,he=p&&!!g.sheenColorMap,Ee=p&&!!g.sheenRoughnessMap,T=!!g.specularMap,F=!!g.specularColorMap,Y=!!g.specularIntensityMap,te=O&&!!g.transmissionMap,fe=O&&!!g.thicknessMap,A=!!g.gradientMap,ie=!!g.alphaMap,X=g.alphaTest>0,se=!!g.alphaHash,le=!!g.extensions;let $=sn;g.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&($=i.toneMapping);const ve={shaderID:de,shaderType:g.type,shaderName:g.name,vertexShader:it,fragmentShader:We,defines:g.defines,customVertexShaderID:j,customFragmentShaderID:ue,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:h,batching:Re,batchingColor:Re&&B._colorsTexture!==null,instancing:De,instancingColor:De&&B.instanceColor!==null,instancingMorph:De&&B.morphTexture!==null,outputColorSpace:ae===null?i.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:Ve.workingColorSpace,alphaToCoverage:!!g.alphaToCoverage,map:rt,matcap:Ne,envMap:qe,envMapMode:qe&&ne.mapping,envMapCubeUVHeight:re,aoMap:Xe,lightMap:ze,bumpMap:ot,normalMap:ut,displacementMap:pt,emissiveMap:mt,normalMapObjectSpace:ut&&g.normalMapType===Kc,normalMapTangentSpace:ut&&g.normalMapType===oo,packedNormalMap:ut&&g.normalMapType===oo&&Mm(g.normalMap.format),metalnessMap:st,roughnessMap:lt,anisotropy:L,anisotropyMap:H,clearcoat:St,clearcoatMap:q,clearcoatNormalMap:oe,clearcoatRoughnessMap:ce,dispersion:He,iridescence:S,iridescenceMap:K,iridescenceThicknessMap:Q,sheen:p,sheenColorMap:he,sheenRoughnessMap:Ee,specularMap:T,specularColorMap:F,specularIntensityMap:Y,transmission:O,transmissionMap:te,thicknessMap:fe,gradientMap:A,opaque:g.transparent===!1&&g.blending===Nn&&g.alphaToCoverage===!1,alphaMap:ie,alphaTest:X,alphaHash:se,combine:g.combine,mapUv:rt&&x(g.map.channel),aoMapUv:Xe&&x(g.aoMap.channel),lightMapUv:ze&&x(g.lightMap.channel),bumpMapUv:ot&&x(g.bumpMap.channel),normalMapUv:ut&&x(g.normalMap.channel),displacementMapUv:pt&&x(g.displacementMap.channel),emissiveMapUv:mt&&x(g.emissiveMap.channel),metalnessMapUv:st&&x(g.metalnessMap.channel),roughnessMapUv:lt&&x(g.roughnessMap.channel),anisotropyMapUv:H&&x(g.anisotropyMap.channel),clearcoatMapUv:q&&x(g.clearcoatMap.channel),clearcoatNormalMapUv:oe&&x(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ce&&x(g.clearcoatRoughnessMap.channel),iridescenceMapUv:K&&x(g.iridescenceMap.channel),iridescenceThicknessMapUv:Q&&x(g.iridescenceThicknessMap.channel),sheenColorMapUv:he&&x(g.sheenColorMap.channel),sheenRoughnessMapUv:Ee&&x(g.sheenRoughnessMap.channel),specularMapUv:T&&x(g.specularMap.channel),specularColorMapUv:F&&x(g.specularColorMap.channel),specularIntensityMapUv:Y&&x(g.specularIntensityMap.channel),transmissionMapUv:te&&x(g.transmissionMap.channel),thicknessMapUv:fe&&x(g.thicknessMap.channel),alphaMapUv:ie&&x(g.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(ut||L),vertexNormals:!!V.attributes.normal,vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!V.attributes.uv&&(rt||ie),fog:!!ee,useFog:g.fog===!0,fogExp2:!!ee&&ee.isFogExp2,flatShading:g.wireframe===!1&&(g.flatShading===!0||V.attributes.normal===void 0&&ut===!1&&(g.isMeshLambertMaterial||g.isMeshPhongMaterial||g.isMeshStandardMaterial||g.isMeshPhysicalMaterial)),sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:m,reversedDepthBuffer:Pe,skinning:B.isSkinnedMesh===!0,hasPositionAttribute:V.attributes.position!==void 0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:ye,morphTextureStride:ke,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numLightProbeGrids:J.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:g.dithering,shadowMapEnabled:i.shadowMap.enabled&&U.length>0,shadowMapType:i.shadowMap.type,toneMapping:$,decodeVideoTexture:rt&&g.map.isVideoTexture===!0&&Ve.getTransfer(g.map.colorSpace)===Ze,decodeVideoTextureEmissive:mt&&g.emissiveMap.isVideoTexture===!0&&Ve.getTransfer(g.emissiveMap.colorSpace)===Ze,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===pn,flipSided:g.side===Ut,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionClipCullDistance:le&&g.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(le&&g.extensions.multiDraw===!0||Re)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return ve.vertexUv1s=c.has(1),ve.vertexUv2s=c.has(2),ve.vertexUv3s=c.has(3),c.clear(),ve}function _(g){const b=[];if(g.shaderID?b.push(g.shaderID):(b.push(g.customVertexShaderID),b.push(g.customFragmentShaderID)),g.defines!==void 0)for(const U in g.defines)b.push(U),b.push(g.defines[U]);return g.isRawShaderMaterial===!1&&(f(b,g),w(b,g),b.push(i.outputColorSpace)),b.push(g.customProgramCacheKey),b.join()}function f(g,b){g.push(b.precision),g.push(b.outputColorSpace),g.push(b.envMapMode),g.push(b.envMapCubeUVHeight),g.push(b.mapUv),g.push(b.alphaMapUv),g.push(b.lightMapUv),g.push(b.aoMapUv),g.push(b.bumpMapUv),g.push(b.normalMapUv),g.push(b.displacementMapUv),g.push(b.emissiveMapUv),g.push(b.metalnessMapUv),g.push(b.roughnessMapUv),g.push(b.anisotropyMapUv),g.push(b.clearcoatMapUv),g.push(b.clearcoatNormalMapUv),g.push(b.clearcoatRoughnessMapUv),g.push(b.iridescenceMapUv),g.push(b.iridescenceThicknessMapUv),g.push(b.sheenColorMapUv),g.push(b.sheenRoughnessMapUv),g.push(b.specularMapUv),g.push(b.specularColorMapUv),g.push(b.specularIntensityMapUv),g.push(b.transmissionMapUv),g.push(b.thicknessMapUv),g.push(b.combine),g.push(b.fogExp2),g.push(b.sizeAttenuation),g.push(b.morphTargetsCount),g.push(b.morphAttributeCount),g.push(b.numDirLights),g.push(b.numPointLights),g.push(b.numSpotLights),g.push(b.numSpotLightMaps),g.push(b.numHemiLights),g.push(b.numRectAreaLights),g.push(b.numDirLightShadows),g.push(b.numPointLightShadows),g.push(b.numSpotLightShadows),g.push(b.numSpotLightShadowsWithMaps),g.push(b.numLightProbes),g.push(b.shadowMapType),g.push(b.toneMapping),g.push(b.numClippingPlanes),g.push(b.numClipIntersection),g.push(b.depthPacking)}function w(g,b){a.disableAll(),b.instancing&&a.enable(0),b.instancingColor&&a.enable(1),b.instancingMorph&&a.enable(2),b.matcap&&a.enable(3),b.envMap&&a.enable(4),b.normalMapObjectSpace&&a.enable(5),b.normalMapTangentSpace&&a.enable(6),b.clearcoat&&a.enable(7),b.iridescence&&a.enable(8),b.alphaTest&&a.enable(9),b.vertexColors&&a.enable(10),b.vertexAlphas&&a.enable(11),b.vertexUv1s&&a.enable(12),b.vertexUv2s&&a.enable(13),b.vertexUv3s&&a.enable(14),b.vertexTangents&&a.enable(15),b.anisotropy&&a.enable(16),b.alphaHash&&a.enable(17),b.batching&&a.enable(18),b.dispersion&&a.enable(19),b.batchingColor&&a.enable(20),b.gradientMap&&a.enable(21),b.packedNormalMap&&a.enable(22),b.vertexNormals&&a.enable(23),g.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.reversedDepthBuffer&&a.enable(4),b.skinning&&a.enable(5),b.morphTargets&&a.enable(6),b.morphNormals&&a.enable(7),b.morphColors&&a.enable(8),b.premultipliedAlpha&&a.enable(9),b.shadowMapEnabled&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),b.decodeVideoTexture&&a.enable(19),b.decodeVideoTextureEmissive&&a.enable(20),b.alphaToCoverage&&a.enable(21),b.numLightProbeGrids>0&&a.enable(22),b.hasPositionAttribute&&a.enable(23),g.push(a.mask)}function C(g){const b=d[g.type];let U;if(b){const I=en[b];U=Hh.clone(I.uniforms)}else U=g.uniforms;return U}function M(g,b){let U=u.get(b);return U!==void 0?++U.usedTimes:(U=new _m(i,b,g,r),l.push(U),u.set(b,U)),U}function R(g){if(--g.usedTimes===0){const b=l.indexOf(g);l[b]=l[l.length-1],l.pop(),u.delete(g.cacheKey),g.destroy()}}function E(g){o.remove(g)}function P(){o.dispose()}return{getParameters:y,getProgramCacheKey:_,getUniforms:C,acquireProgram:M,releaseProgram:R,releaseShaderCache:E,programs:l,dispose:P}}function ym(){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,c){i.get(a)[o]=c}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Em(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.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function sl(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 al(){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){let d=0;return h.isInstancedMesh&&(d+=2),h.isSkinnedMesh&&(d+=1),d}function o(h,d,x,y,_,f){let w=i[e];return w===void 0?(w={id:h.id,object:h,geometry:d,material:x,materialVariant:a(h),groupOrder:y,renderOrder:h.renderOrder,z:_,group:f},i[e]=w):(w.id=h.id,w.object=h,w.geometry=d,w.material=x,w.materialVariant=a(h),w.groupOrder=y,w.renderOrder=h.renderOrder,w.z=_,w.group=f),e++,w}function c(h,d,x,y,_,f){const w=o(h,d,x,y,_,f);x.transmission>0?n.push(w):x.transparent===!0?r.push(w):t.push(w)}function l(h,d,x,y,_,f){const w=o(h,d,x,y,_,f);x.transmission>0?n.unshift(w):x.transparent===!0?r.unshift(w):t.unshift(w)}function u(h,d,x){t.length>1&&t.sort(h||Em),n.length>1&&n.sort(d||sl),r.length>1&&r.sort(d||sl),x&&(t.reverse(),n.reverse(),r.reverse())}function m(){for(let h=e,d=i.length;h<d;h++){const x=i[h];if(x.id===null)break;x.id=null,x.object=null,x.geometry=null,x.material=null,x.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:c,unshift:l,finish:m,sort:u}}function bm(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new al,i.set(n,[a])):r>=s.length?(a=new al,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Tm(){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 D,color:new Be};break;case"SpotLight":t={position:new D,direction:new D,color:new Be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Be,groundColor:new Be};break;case"RectAreaLight":t={color:new Be,position:new D,halfWidth:new D,halfHeight:new D};break}return i[e.id]=t,t}}}function Am(){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 Ce};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ce,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Rm=0;function wm(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Cm(i){const e=new Tm,t=Am(),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 l=0;l<9;l++)n.probe.push(new D);const r=new D,s=new at,a=new at;function o(l){let u=0,m=0,h=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let d=0,x=0,y=0,_=0,f=0,w=0,C=0,M=0,R=0,E=0,P=0;l.sort(wm);for(let b=0,U=l.length;b<U;b++){const I=l[b],B=I.color,J=I.intensity,ee=I.distance;let V=null;if(I.shadow&&I.shadow.map&&(I.shadow.map.texture.format===Jn?V=I.shadow.map.texture:V=I.shadow.map.depthTexture||I.shadow.map.texture),I.isAmbientLight)u+=B.r*J,m+=B.g*J,h+=B.b*J;else if(I.isLightProbe){for(let Z=0;Z<9;Z++)n.probe[Z].addScaledVector(I.sh.coefficients[Z],J);P++}else if(I.isDirectionalLight){const Z=e.get(I);if(Z.color.copy(I.color).multiplyScalar(I.intensity),I.castShadow){const W=I.shadow,ne=t.get(I);ne.shadowIntensity=W.intensity,ne.shadowBias=W.bias,ne.shadowNormalBias=W.normalBias,ne.shadowRadius=W.radius,ne.shadowMapSize=W.mapSize,n.directionalShadow[d]=ne,n.directionalShadowMap[d]=V,n.directionalShadowMatrix[d]=I.shadow.matrix,w++}n.directional[d]=Z,d++}else if(I.isSpotLight){const Z=e.get(I);Z.position.setFromMatrixPosition(I.matrixWorld),Z.color.copy(B).multiplyScalar(J),Z.distance=ee,Z.coneCos=Math.cos(I.angle),Z.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),Z.decay=I.decay,n.spot[y]=Z;const W=I.shadow;if(I.map&&(n.spotLightMap[R]=I.map,R++,W.updateMatrices(I),I.castShadow&&E++),n.spotLightMatrix[y]=W.matrix,I.castShadow){const ne=t.get(I);ne.shadowIntensity=W.intensity,ne.shadowBias=W.bias,ne.shadowNormalBias=W.normalBias,ne.shadowRadius=W.radius,ne.shadowMapSize=W.mapSize,n.spotShadow[y]=ne,n.spotShadowMap[y]=V,M++}y++}else if(I.isRectAreaLight){const Z=e.get(I);Z.color.copy(B).multiplyScalar(J),Z.halfWidth.set(I.width*.5,0,0),Z.halfHeight.set(0,I.height*.5,0),n.rectArea[_]=Z,_++}else if(I.isPointLight){const Z=e.get(I);if(Z.color.copy(I.color).multiplyScalar(I.intensity),Z.distance=I.distance,Z.decay=I.decay,I.castShadow){const W=I.shadow,ne=t.get(I);ne.shadowIntensity=W.intensity,ne.shadowBias=W.bias,ne.shadowNormalBias=W.normalBias,ne.shadowRadius=W.radius,ne.shadowMapSize=W.mapSize,ne.shadowCameraNear=W.camera.near,ne.shadowCameraFar=W.camera.far,n.pointShadow[x]=ne,n.pointShadowMap[x]=V,n.pointShadowMatrix[x]=I.shadow.matrix,C++}n.point[x]=Z,x++}else if(I.isHemisphereLight){const Z=e.get(I);Z.skyColor.copy(I.color).multiplyScalar(J),Z.groundColor.copy(I.groundColor).multiplyScalar(J),n.hemi[f]=Z,f++}}_>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=me.LTC_FLOAT_1,n.rectAreaLTC2=me.LTC_FLOAT_2):(n.rectAreaLTC1=me.LTC_HALF_1,n.rectAreaLTC2=me.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=m,n.ambient[2]=h;const g=n.hash;(g.directionalLength!==d||g.pointLength!==x||g.spotLength!==y||g.rectAreaLength!==_||g.hemiLength!==f||g.numDirectionalShadows!==w||g.numPointShadows!==C||g.numSpotShadows!==M||g.numSpotMaps!==R||g.numLightProbes!==P)&&(n.directional.length=d,n.spot.length=y,n.rectArea.length=_,n.point.length=x,n.hemi.length=f,n.directionalShadow.length=w,n.directionalShadowMap.length=w,n.pointShadow.length=C,n.pointShadowMap.length=C,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=w,n.pointShadowMatrix.length=C,n.spotLightMatrix.length=M+R-E,n.spotLightMap.length=R,n.numSpotLightShadowsWithMaps=E,n.numLightProbes=P,g.directionalLength=d,g.pointLength=x,g.spotLength=y,g.rectAreaLength=_,g.hemiLength=f,g.numDirectionalShadows=w,g.numPointShadows=C,g.numSpotShadows=M,g.numSpotMaps=R,g.numLightProbes=P,n.version=Rm++)}function c(l,u){let m=0,h=0,d=0,x=0,y=0;const _=u.matrixWorldInverse;for(let f=0,w=l.length;f<w;f++){const C=l[f];if(C.isDirectionalLight){const M=n.directional[m];M.direction.setFromMatrixPosition(C.matrixWorld),r.setFromMatrixPosition(C.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(_),m++}else if(C.isSpotLight){const M=n.spot[d];M.position.setFromMatrixPosition(C.matrixWorld),M.position.applyMatrix4(_),M.direction.setFromMatrixPosition(C.matrixWorld),r.setFromMatrixPosition(C.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(_),d++}else if(C.isRectAreaLight){const M=n.rectArea[x];M.position.setFromMatrixPosition(C.matrixWorld),M.position.applyMatrix4(_),a.identity(),s.copy(C.matrixWorld),s.premultiply(_),a.extractRotation(s),M.halfWidth.set(C.width*.5,0,0),M.halfHeight.set(0,C.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),x++}else if(C.isPointLight){const M=n.point[h];M.position.setFromMatrixPosition(C.matrixWorld),M.position.applyMatrix4(_),h++}else if(C.isHemisphereLight){const M=n.hemi[y];M.direction.setFromMatrixPosition(C.matrixWorld),M.direction.transformDirection(_),y++}}}return{setup:o,setupView:c,state:n}}function ol(i){const e=new Cm(i),t=[],n=[],r=[];function s(h){m.camera=h,t.length=0,n.length=0,r.length=0}function a(h){t.push(h)}function o(h){n.push(h)}function c(h){r.push(h)}function l(){e.setup(t)}function u(h){e.setupView(t,h)}const m={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:m,setupLights:l,setupLightsView:u,pushLight:a,pushShadow:o,pushLightProbeGrid:c}}function Pm(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new ol(i),e.set(r,[o])):s>=a.length?(o=new ol(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Dm=`void main() {
|
|
4058
4058
|
gl_Position = vec4( position, 1.0 );
|
|
4059
|
-
}`,
|
|
4059
|
+
}`,Lm=`uniform sampler2D shadow_pass;
|
|
4060
4060
|
uniform vec2 resolution;
|
|
4061
4061
|
uniform float radius;
|
|
4062
4062
|
void main() {
|
|
@@ -4081,12 +4081,12 @@ void main() {
|
|
|
4081
4081
|
squared_mean = squared_mean / samples;
|
|
4082
4082
|
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
|
4083
4083
|
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
|
4084
|
-
}`,Um=[new D(1,0,0),new D(-1,0,0),new D(0,1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1)],Nm=[new D(0,-1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1),new D(0,-1,0),new D(0,-1,0)],ll=new at,Vi=new D,Us=new D;function Fm(i,e,t){let n=new Vl;const r=new Ce,s=new Ce,a=new ht,o=new qh,c=new Kh,l={},u=t.maxTextureSize,m={[Bn]:Ut,[Ut]:Bn,[pn]:pn},h=new ln({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ce},radius:{value:4}},vertexShader:Lm,fragmentShader:Im}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const x=new Xt;x.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Mn(x,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Tr;let f=this.type;this.render=function(E,P,_){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||E.length===0)return;this.type===Ac&&(we("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Tr);const b=i.getRenderTarget(),U=i.getActiveCubeFace(),I=i.getActiveMipmapLevel(),B=i.state;B.setBlending(gn),B.buffers.depth.getReversed()===!0?B.buffers.color.setClear(0,0,0,0):B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const J=f!==this.type;J&&P.traverse(function(ee){ee.material&&(Array.isArray(ee.material)?ee.material.forEach(V=>V.needsUpdate=!0):ee.material.needsUpdate=!0)});for(let ee=0,V=E.length;ee<V;ee++){const Z=E[ee],W=Z.shadow;if(W===void 0){we("WebGLShadowMap:",Z,"has no shadow.");continue}if(W.autoUpdate===!1&&W.needsUpdate===!1)continue;r.copy(W.mapSize);const ne=W.getFrameExtents();r.multiply(ne),s.copy(W.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ne.x),r.x=s.x*ne.x,W.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ne.y),r.y=s.y*ne.y,W.mapSize.y=s.y));const re=i.state.buffers.depth.getReversed();if(W.camera._reversedDepth=re,W.map===null||J===!0){if(W.map!==null&&(W.map.depthTexture!==null&&(W.map.depthTexture.dispose(),W.map.depthTexture=null),W.map.dispose()),this.type===Hi){if(Z.isPointLight){we("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}W.map=new an(r.x,r.y,{format:Jn,type:xn,minFilter:At,magFilter:At,generateMipmaps:!1}),W.map.texture.name=Z.name+".shadowMap",W.map.depthTexture=new Ri(r.x,r.y,nn),W.map.depthTexture.name=Z.name+".shadowMapDepth",W.map.depthTexture.format=vn,W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=yt,W.map.depthTexture.magFilter=yt}else Z.isPointLight?(W.map=new $l(r.x),W.map.depthTexture=new Fh(r.x,on)):(W.map=new an(r.x,r.y),W.map.depthTexture=new Ri(r.x,r.y,on)),W.map.depthTexture.name=Z.name+".shadowMap",W.map.depthTexture.format=vn,this.type===Tr?(W.map.depthTexture.compareFunction=re?Ba:Oa,W.map.depthTexture.minFilter=At,W.map.depthTexture.magFilter=At):(W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=yt,W.map.depthTexture.magFilter=yt);W.camera.updateProjectionMatrix()}const de=W.map.isWebGLCubeRenderTarget?6:1;for(let ge=0;ge<de;ge++){if(W.map.isWebGLCubeRenderTarget)i.setRenderTarget(W.map,ge),i.clear();else{ge===0&&(i.setRenderTarget(W.map),i.clear());const ye=W.getViewport(ge);a.set(s.x*ye.x,s.y*ye.y,s.x*ye.z,s.y*ye.w),B.viewport(a)}if(Z.isPointLight){const ye=W.camera,He=W.matrix,it=Z.distance||ye.far;it!==ye.far&&(ye.far=it,ye.updateProjectionMatrix()),Vi.setFromMatrixPosition(Z.matrixWorld),ye.position.copy(Vi),Us.copy(ye.position),Us.add(Um[ge]),ye.up.copy(Nm[ge]),ye.lookAt(Us),ye.updateMatrixWorld(),He.makeTranslation(-Vi.x,-Vi.y,-Vi.z),ll.multiplyMatrices(ye.projectionMatrix,ye.matrixWorldInverse),W._frustum.setFromProjectionMatrix(ll,ye.coordinateSystem,ye.reversedDepth)}else W.updateMatrices(Z);n=W.getFrustum(),M(P,_,W.camera,Z,this.type)}W.isPointLightShadow!==!0&&this.type===Hi&&w(W,_),W.needsUpdate=!1}f=this.type,g.needsUpdate=!1,i.setRenderTarget(b,U,I)};function w(E,P){const _=e.update(y);h.defines.VSM_SAMPLES!==E.blurSamples&&(h.defines.VSM_SAMPLES=E.blurSamples,d.defines.VSM_SAMPLES=E.blurSamples,h.needsUpdate=!0,d.needsUpdate=!0),E.mapPass===null&&(E.mapPass=new an(r.x,r.y,{format:Jn,type:xn})),h.uniforms.shadow_pass.value=E.map.depthTexture,h.uniforms.resolution.value=E.mapSize,h.uniforms.radius.value=E.radius,i.setRenderTarget(E.mapPass),i.clear(),i.renderBufferDirect(P,null,_,h,y,null),d.uniforms.shadow_pass.value=E.mapPass.texture,d.uniforms.resolution.value=E.mapSize,d.uniforms.radius.value=E.radius,i.setRenderTarget(E.map),i.clear(),i.renderBufferDirect(P,null,_,d,y,null)}function C(E,P,_,b){let U=null;const I=_.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(I!==void 0)U=I;else if(U=_.isPointLight===!0?c:o,i.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0||P.alphaToCoverage===!0){const B=U.uuid,J=P.uuid;let ee=l[B];ee===void 0&&(ee={},l[B]=ee);let V=ee[J];V===void 0&&(V=U.clone(),ee[J]=V,P.addEventListener("dispose",R)),U=V}if(U.visible=P.visible,U.wireframe=P.wireframe,b===Hi?U.side=P.shadowSide!==null?P.shadowSide:P.side:U.side=P.shadowSide!==null?P.shadowSide:m[P.side],U.alphaMap=P.alphaMap,U.alphaTest=P.alphaToCoverage===!0?.5:P.alphaTest,U.map=P.map,U.clipShadows=P.clipShadows,U.clippingPlanes=P.clippingPlanes,U.clipIntersection=P.clipIntersection,U.displacementMap=P.displacementMap,U.displacementScale=P.displacementScale,U.displacementBias=P.displacementBias,U.wireframeLinewidth=P.wireframeLinewidth,U.linewidth=P.linewidth,_.isPointLight===!0&&U.isMeshDistanceMaterial===!0){const B=i.properties.get(U);B.light=_}return U}function M(E,P,_,b,U){if(E.visible===!1)return;if(E.layers.test(P.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&U===Hi)&&(!E.frustumCulled||n.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,E.matrixWorld);const J=e.update(E),ee=E.material;if(Array.isArray(ee)){const V=J.groups;for(let Z=0,W=V.length;Z<W;Z++){const ne=V[Z],re=ee[ne.materialIndex];if(re&&re.visible){const de=C(E,re,b,U);E.onBeforeShadow(i,E,P,_,J,de,ne),i.renderBufferDirect(_,null,J,de,E,ne),E.onAfterShadow(i,E,P,_,J,de,ne)}}}else if(ee.visible){const V=C(E,ee,b,U);E.onBeforeShadow(i,E,P,_,J,V,null),i.renderBufferDirect(_,null,J,V,E,null),E.onAfterShadow(i,E,P,_,J,V,null)}}const B=E.children;for(let J=0,ee=B.length;J<ee;J++)M(B[J],P,_,b,U)}function R(E){E.target.removeEventListener("dispose",R);for(const _ in l){const b=l[_],U=E.target.uuid;U in b&&(b[U].dispose(),delete b[U])}}}function Om(i,e){function t(){let A=!1;const ie=new ht;let X=null;const ae=new ht(0,0,0,0);return{setMask:function(le){X!==le&&!A&&(i.colorMask(le,le,le,le),X=le)},setLocked:function(le){A=le},setClear:function(le,$,ve,pe,Ke){Ke===!0&&(le*=pe,$*=pe,ve*=pe),ie.set(le,$,ve,pe),ae.equals(ie)===!1&&(i.clearColor(le,$,ve,pe),ae.copy(ie))},reset:function(){A=!1,X=null,ae.set(-1,0,0,0)}}}function n(){let A=!1,ie=!1,X=null,ae=null,le=null;return{setReversed:function($){if(ie!==$){const ve=e.get("EXT_clip_control");$?ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.ZERO_TO_ONE_EXT):ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.NEGATIVE_ONE_TO_ONE_EXT),ie=$;const pe=le;le=null,this.setClear(pe)}},getReversed:function(){return ie},setTest:function($){$?se(i.DEPTH_TEST):Pe(i.DEPTH_TEST)},setMask:function($){X!==$&&!A&&(i.depthMask($),X=$)},setFunc:function($){if(ie&&($=sh[$]),ae!==$){switch($){case zs:i.depthFunc(i.NEVER);break;case Gs:i.depthFunc(i.ALWAYS);break;case Vs:i.depthFunc(i.LESS);break;case Ti:i.depthFunc(i.LEQUAL);break;case Hs:i.depthFunc(i.EQUAL);break;case ks:i.depthFunc(i.GEQUAL);break;case Ws:i.depthFunc(i.GREATER);break;case Xs:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}ae=$}},setLocked:function($){A=$},setClear:function($){le!==$&&(le=$,ie&&($=1-$),i.clearDepth($))},reset:function(){A=!1,X=null,ae=null,le=null,ie=!1}}}function r(){let A=!1,ie=null,X=null,ae=null,le=null,$=null,ve=null,pe=null,Ke=null;return{setTest:function($e){A||($e?se(i.STENCIL_TEST):Pe(i.STENCIL_TEST))},setMask:function($e){ie!==$e&&!A&&(i.stencilMask($e),ie=$e)},setFunc:function($e,wt,Nt){(X!==$e||ae!==wt||le!==Nt)&&(i.stencilFunc($e,wt,Nt),X=$e,ae=wt,le=Nt)},setOp:function($e,wt,Nt){($!==$e||ve!==wt||pe!==Nt)&&(i.stencilOp($e,wt,Nt),$=$e,ve=wt,pe=Nt)},setLocked:function($e){A=$e},setClear:function($e){Ke!==$e&&(i.clearStencil($e),Ke=$e)},reset:function(){A=!1,ie=null,X=null,ae=null,le=null,$=null,ve=null,pe=null,Ke=null}}}const s=new t,a=new n,o=new r,c=new WeakMap,l=new WeakMap;let u={},m={},h={},d=new WeakMap,x=[],y=null,g=!1,f=null,w=null,C=null,M=null,R=null,E=null,P=null,_=new Be(0,0,0),b=0,U=!1,I=null,B=null,J=null,ee=null,V=null;const Z=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,ne=0;const re=i.getParameter(i.VERSION);re.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(re)[1]),W=ne>=1):re.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(re)[1]),W=ne>=2);let de=null,ge={};const ye=i.getParameter(i.SCISSOR_BOX),He=i.getParameter(i.VIEWPORT),it=new ht().fromArray(ye),ke=new ht().fromArray(He);function j(A,ie,X,ae){const le=new Uint8Array(4),$=i.createTexture();i.bindTexture(A,$),i.texParameteri(A,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(A,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ve=0;ve<X;ve++)A===i.TEXTURE_3D||A===i.TEXTURE_2D_ARRAY?i.texImage3D(ie,0,i.RGBA,1,1,ae,0,i.RGBA,i.UNSIGNED_BYTE,le):i.texImage2D(ie+ve,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,le);return $}const ue={};ue[i.TEXTURE_2D]=j(i.TEXTURE_2D,i.TEXTURE_2D,1),ue[i.TEXTURE_CUBE_MAP]=j(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ue[i.TEXTURE_2D_ARRAY]=j(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ue[i.TEXTURE_3D]=j(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),se(i.DEPTH_TEST),a.setFunc(Ti),ot(!1),ut(io),se(i.CULL_FACE),We(gn);function se(A){u[A]!==!0&&(i.enable(A),u[A]=!0)}function Pe(A){u[A]!==!1&&(i.disable(A),u[A]=!1)}function De(A,ie){return h[A]!==ie?(i.bindFramebuffer(A,ie),h[A]=ie,A===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=ie),A===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=ie),!0):!1}function Re(A,ie){let X=x,ae=!1;if(A){X=d.get(ie),X===void 0&&(X=[],d.set(ie,X));const le=A.textures;if(X.length!==le.length||X[0]!==i.COLOR_ATTACHMENT0){for(let $=0,ve=le.length;$<ve;$++)X[$]=i.COLOR_ATTACHMENT0+$;X.length=le.length,ae=!0}}else X[0]!==i.BACK&&(X[0]=i.BACK,ae=!0);ae&&i.drawBuffers(X)}function rt(A){return y!==A?(i.useProgram(A),y=A,!0):!1}const Ne={[Yn]:i.FUNC_ADD,[wc]:i.FUNC_SUBTRACT,[Cc]:i.FUNC_REVERSE_SUBTRACT};Ne[Pc]=i.MIN,Ne[Dc]=i.MAX;const qe={[Lc]:i.ZERO,[Ic]:i.ONE,[Uc]:i.SRC_COLOR,[Os]:i.SRC_ALPHA,[Gc]:i.SRC_ALPHA_SATURATE,[Bc]:i.DST_COLOR,[Fc]:i.DST_ALPHA,[Nc]:i.ONE_MINUS_SRC_COLOR,[Bs]:i.ONE_MINUS_SRC_ALPHA,[zc]:i.ONE_MINUS_DST_COLOR,[Oc]:i.ONE_MINUS_DST_ALPHA,[Vc]:i.CONSTANT_COLOR,[Hc]:i.ONE_MINUS_CONSTANT_COLOR,[kc]:i.CONSTANT_ALPHA,[Wc]:i.ONE_MINUS_CONSTANT_ALPHA};function We(A,ie,X,ae,le,$,ve,pe,Ke,$e){if(A===gn){g===!0&&(Pe(i.BLEND),g=!1);return}if(g===!1&&(se(i.BLEND),g=!0),A!==Rc){if(A!==f||$e!==U){if((w!==Yn||R!==Yn)&&(i.blendEquation(i.FUNC_ADD),w=Yn,R=Yn),$e)switch(A){case Fn:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ro:i.blendFunc(i.ONE,i.ONE);break;case so:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ao:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ge("WebGLState: Invalid blending: ",A);break}else switch(A){case Fn:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ro:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case so:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case ao:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",A);break}C=null,M=null,E=null,P=null,_.set(0,0,0),b=0,f=A,U=$e}return}le=le||ie,$=$||X,ve=ve||ae,(ie!==w||le!==R)&&(i.blendEquationSeparate(Ne[ie],Ne[le]),w=ie,R=le),(X!==C||ae!==M||$!==E||ve!==P)&&(i.blendFuncSeparate(qe[X],qe[ae],qe[$],qe[ve]),C=X,M=ae,E=$,P=ve),(pe.equals(_)===!1||Ke!==b)&&(i.blendColor(pe.r,pe.g,pe.b,Ke),_.copy(pe),b=Ke),f=A,U=!1}function ze(A,ie){A.side===pn?Pe(i.CULL_FACE):se(i.CULL_FACE);let X=A.side===Ut;ie&&(X=!X),ot(X),A.blending===Fn&&A.transparent===!1?We(gn):We(A.blending,A.blendEquation,A.blendSrc,A.blendDst,A.blendEquationAlpha,A.blendSrcAlpha,A.blendDstAlpha,A.blendColor,A.blendAlpha,A.premultipliedAlpha),a.setFunc(A.depthFunc),a.setTest(A.depthTest),a.setMask(A.depthWrite),s.setMask(A.colorWrite);const ae=A.stencilWrite;o.setTest(ae),ae&&(o.setMask(A.stencilWriteMask),o.setFunc(A.stencilFunc,A.stencilRef,A.stencilFuncMask),o.setOp(A.stencilFail,A.stencilZFail,A.stencilZPass)),mt(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),A.alphaToCoverage===!0?se(i.SAMPLE_ALPHA_TO_COVERAGE):Pe(i.SAMPLE_ALPHA_TO_COVERAGE)}function ot(A){I!==A&&(A?i.frontFace(i.CW):i.frontFace(i.CCW),I=A)}function ut(A){A!==bc?(se(i.CULL_FACE),A!==B&&(A===io?i.cullFace(i.BACK):A===Tc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Pe(i.CULL_FACE),B=A}function pt(A){A!==J&&(W&&i.lineWidth(A),J=A)}function mt(A,ie,X){A?(se(i.POLYGON_OFFSET_FILL),(ee!==ie||V!==X)&&(ee=ie,V=X,a.getReversed()&&(ie=-ie),i.polygonOffset(ie,X))):Pe(i.POLYGON_OFFSET_FILL)}function st(A){A?se(i.SCISSOR_TEST):Pe(i.SCISSOR_TEST)}function lt(A){A===void 0&&(A=i.TEXTURE0+Z-1),de!==A&&(i.activeTexture(A),de=A)}function L(A,ie,X){X===void 0&&(de===null?X=i.TEXTURE0+Z-1:X=de);let ae=ge[X];ae===void 0&&(ae={type:void 0,texture:void 0},ge[X]=ae),(ae.type!==A||ae.texture!==ie)&&(de!==X&&(i.activeTexture(X),de=X),i.bindTexture(A,ie||ue[A]),ae.type=A,ae.texture=ie)}function St(){const A=ge[de];A!==void 0&&A.type!==void 0&&(i.bindTexture(A.type,null),A.type=void 0,A.texture=void 0)}function Xe(){try{i.compressedTexImage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function S(){try{i.compressedTexImage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function p(){try{i.texSubImage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function O(){try{i.texSubImage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function H(){try{i.compressedTexSubImage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function q(){try{i.compressedTexSubImage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function oe(){try{i.texStorage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function ce(){try{i.texStorage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function K(){try{i.texImage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function Q(){try{i.texImage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function he(A){return m[A]!==void 0?m[A]:i.getParameter(A)}function Ee(A,ie){m[A]!==ie&&(i.pixelStorei(A,ie),m[A]=ie)}function T(A){it.equals(A)===!1&&(i.scissor(A.x,A.y,A.z,A.w),it.copy(A))}function F(A){ke.equals(A)===!1&&(i.viewport(A.x,A.y,A.z,A.w),ke.copy(A))}function Y(A,ie){let X=l.get(ie);X===void 0&&(X=new WeakMap,l.set(ie,X));let ae=X.get(A);ae===void 0&&(ae=i.getUniformBlockIndex(ie,A.name),X.set(A,ae))}function te(A,ie){const ae=l.get(ie).get(A);c.get(ie)!==ae&&(i.uniformBlockBinding(ie,ae,A.__bindingPointIndex),c.set(ie,ae))}function fe(){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),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},m={},de=null,ge={},h={},d=new WeakMap,x=[],y=null,g=!1,f=null,w=null,C=null,M=null,R=null,E=null,P=null,_=new Be(0,0,0),b=0,U=!1,I=null,B=null,J=null,ee=null,V=null,it.set(0,0,i.canvas.width,i.canvas.height),ke.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:se,disable:Pe,bindFramebuffer:De,drawBuffers:Re,useProgram:rt,setBlending:We,setMaterial:ze,setFlipSided:ot,setCullFace:ut,setLineWidth:pt,setPolygonOffset:mt,setScissorTest:st,activeTexture:lt,bindTexture:L,unbindTexture:St,compressedTexImage2D:Xe,compressedTexImage3D:S,texImage2D:K,texImage3D:Q,pixelStorei:Ee,getParameter:he,updateUBOMapping:Y,uniformBlockBinding:te,texStorage2D:oe,texStorage3D:ce,texSubImage2D:p,texSubImage3D:O,compressedTexSubImage2D:H,compressedTexSubImage3D:q,scissor:T,viewport:F,reset:fe}}function Bm(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Ce,u=new WeakMap,m=new Set;let h;const d=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(S,p){return x?new OffscreenCanvas(S,p):Or("canvas")}function g(S,p,O){let H=1;const q=Xe(S);if((q.width>O||q.height>O)&&(H=O/Math.max(q.width,q.height)),H<1)if(typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&S instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&S instanceof ImageBitmap||typeof VideoFrame<"u"&&S instanceof VideoFrame){const oe=Math.floor(H*q.width),ce=Math.floor(H*q.height);h===void 0&&(h=y(oe,ce));const K=p?y(oe,ce):h;return K.width=oe,K.height=ce,K.getContext("2d").drawImage(S,0,0,oe,ce),we("WebGLRenderer: Texture has been resized from ("+q.width+"x"+q.height+") to ("+oe+"x"+ce+")."),K}else return"data"in S&&we("WebGLRenderer: Image in DataTexture is too big ("+q.width+"x"+q.height+")."),S;return S}function f(S){return S.generateMipmaps}function w(S){i.generateMipmap(S)}function C(S){return S.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:S.isWebGL3DRenderTarget?i.TEXTURE_3D:S.isWebGLArrayRenderTarget||S.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(S,p,O,H,q,oe=!1){if(S!==null){if(i[S]!==void 0)return i[S];we("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+S+"'")}let ce;H&&(ce=e.get("EXT_texture_norm16"),ce||we("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let K=p;if(p===i.RED&&(O===i.FLOAT&&(K=i.R32F),O===i.HALF_FLOAT&&(K=i.R16F),O===i.UNSIGNED_BYTE&&(K=i.R8),O===i.UNSIGNED_SHORT&&ce&&(K=ce.R16_EXT),O===i.SHORT&&ce&&(K=ce.R16_SNORM_EXT)),p===i.RED_INTEGER&&(O===i.UNSIGNED_BYTE&&(K=i.R8UI),O===i.UNSIGNED_SHORT&&(K=i.R16UI),O===i.UNSIGNED_INT&&(K=i.R32UI),O===i.BYTE&&(K=i.R8I),O===i.SHORT&&(K=i.R16I),O===i.INT&&(K=i.R32I)),p===i.RG&&(O===i.FLOAT&&(K=i.RG32F),O===i.HALF_FLOAT&&(K=i.RG16F),O===i.UNSIGNED_BYTE&&(K=i.RG8),O===i.UNSIGNED_SHORT&&ce&&(K=ce.RG16_EXT),O===i.SHORT&&ce&&(K=ce.RG16_SNORM_EXT)),p===i.RG_INTEGER&&(O===i.UNSIGNED_BYTE&&(K=i.RG8UI),O===i.UNSIGNED_SHORT&&(K=i.RG16UI),O===i.UNSIGNED_INT&&(K=i.RG32UI),O===i.BYTE&&(K=i.RG8I),O===i.SHORT&&(K=i.RG16I),O===i.INT&&(K=i.RG32I)),p===i.RGB_INTEGER&&(O===i.UNSIGNED_BYTE&&(K=i.RGB8UI),O===i.UNSIGNED_SHORT&&(K=i.RGB16UI),O===i.UNSIGNED_INT&&(K=i.RGB32UI),O===i.BYTE&&(K=i.RGB8I),O===i.SHORT&&(K=i.RGB16I),O===i.INT&&(K=i.RGB32I)),p===i.RGBA_INTEGER&&(O===i.UNSIGNED_BYTE&&(K=i.RGBA8UI),O===i.UNSIGNED_SHORT&&(K=i.RGBA16UI),O===i.UNSIGNED_INT&&(K=i.RGBA32UI),O===i.BYTE&&(K=i.RGBA8I),O===i.SHORT&&(K=i.RGBA16I),O===i.INT&&(K=i.RGBA32I)),p===i.RGB&&(O===i.UNSIGNED_SHORT&&ce&&(K=ce.RGB16_EXT),O===i.SHORT&&ce&&(K=ce.RGB16_SNORM_EXT),O===i.UNSIGNED_INT_5_9_9_9_REV&&(K=i.RGB9_E5),O===i.UNSIGNED_INT_10F_11F_11F_REV&&(K=i.R11F_G11F_B10F)),p===i.RGBA){const Q=oe?Nr:Ve.getTransfer(q);O===i.FLOAT&&(K=i.RGBA32F),O===i.HALF_FLOAT&&(K=i.RGBA16F),O===i.UNSIGNED_BYTE&&(K=Q===Ze?i.SRGB8_ALPHA8:i.RGBA8),O===i.UNSIGNED_SHORT&&ce&&(K=ce.RGBA16_EXT),O===i.SHORT&&ce&&(K=ce.RGBA16_SNORM_EXT),O===i.UNSIGNED_SHORT_4_4_4_4&&(K=i.RGBA4),O===i.UNSIGNED_SHORT_5_5_5_1&&(K=i.RGB5_A1)}return(K===i.R16F||K===i.R32F||K===i.RG16F||K===i.RG32F||K===i.RGBA16F||K===i.RGBA32F)&&e.get("EXT_color_buffer_float"),K}function R(S,p){let O;return S?p===null||p===on||p===Xi?O=i.DEPTH24_STENCIL8:p===nn?O=i.DEPTH32F_STENCIL8:p===Wi&&(O=i.DEPTH24_STENCIL8,we("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):p===null||p===on||p===Xi?O=i.DEPTH_COMPONENT24:p===nn?O=i.DEPTH_COMPONENT32F:p===Wi&&(O=i.DEPTH_COMPONENT16),O}function E(S,p){return f(S)===!0||S.isFramebufferTexture&&S.minFilter!==yt&&S.minFilter!==At?Math.log2(Math.max(p.width,p.height))+1:S.mipmaps!==void 0&&S.mipmaps.length>0?S.mipmaps.length:S.isCompressedTexture&&Array.isArray(S.image)?p.mipmaps.length:1}function P(S){const p=S.target;p.removeEventListener("dispose",P),b(p),p.isVideoTexture&&u.delete(p),p.isHTMLTexture&&m.delete(p)}function _(S){const p=S.target;p.removeEventListener("dispose",_),I(p)}function b(S){const p=n.get(S);if(p.__webglInit===void 0)return;const O=S.source,H=d.get(O);if(H){const q=H[p.__cacheKey];q.usedTimes--,q.usedTimes===0&&U(S),Object.keys(H).length===0&&d.delete(O)}n.remove(S)}function U(S){const p=n.get(S);i.deleteTexture(p.__webglTexture);const O=S.source,H=d.get(O);delete H[p.__cacheKey],a.memory.textures--}function I(S){const p=n.get(S);if(S.depthTexture&&(S.depthTexture.dispose(),n.remove(S.depthTexture)),S.isWebGLCubeRenderTarget)for(let H=0;H<6;H++){if(Array.isArray(p.__webglFramebuffer[H]))for(let q=0;q<p.__webglFramebuffer[H].length;q++)i.deleteFramebuffer(p.__webglFramebuffer[H][q]);else i.deleteFramebuffer(p.__webglFramebuffer[H]);p.__webglDepthbuffer&&i.deleteRenderbuffer(p.__webglDepthbuffer[H])}else{if(Array.isArray(p.__webglFramebuffer))for(let H=0;H<p.__webglFramebuffer.length;H++)i.deleteFramebuffer(p.__webglFramebuffer[H]);else i.deleteFramebuffer(p.__webglFramebuffer);if(p.__webglDepthbuffer&&i.deleteRenderbuffer(p.__webglDepthbuffer),p.__webglMultisampledFramebuffer&&i.deleteFramebuffer(p.__webglMultisampledFramebuffer),p.__webglColorRenderbuffer)for(let H=0;H<p.__webglColorRenderbuffer.length;H++)p.__webglColorRenderbuffer[H]&&i.deleteRenderbuffer(p.__webglColorRenderbuffer[H]);p.__webglDepthRenderbuffer&&i.deleteRenderbuffer(p.__webglDepthRenderbuffer)}const O=S.textures;for(let H=0,q=O.length;H<q;H++){const oe=n.get(O[H]);oe.__webglTexture&&(i.deleteTexture(oe.__webglTexture),a.memory.textures--),n.remove(O[H])}n.remove(S)}let B=0;function J(){B=0}function ee(){return B}function V(S){B=S}function Z(){const S=B;return S>=r.maxTextures&&we("WebGLTextures: Trying to use "+S+" texture units while this GPU supports only "+r.maxTextures),B+=1,S}function W(S){const p=[];return p.push(S.wrapS),p.push(S.wrapT),p.push(S.wrapR||0),p.push(S.magFilter),p.push(S.minFilter),p.push(S.anisotropy),p.push(S.internalFormat),p.push(S.format),p.push(S.type),p.push(S.generateMipmaps),p.push(S.premultiplyAlpha),p.push(S.flipY),p.push(S.unpackAlignment),p.push(S.colorSpace),p.join()}function ne(S,p){const O=n.get(S);if(S.isVideoTexture&&L(S),S.isRenderTargetTexture===!1&&S.isExternalTexture!==!0&&S.version>0&&O.__version!==S.version){const H=S.image;if(H===null)we("WebGLRenderer: Texture marked for update but no image data found.");else if(H.complete===!1)we("WebGLRenderer: Texture marked for update but image is incomplete");else{Pe(O,S,p);return}}else S.isExternalTexture&&(O.__webglTexture=S.sourceTexture?S.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,O.__webglTexture,i.TEXTURE0+p)}function re(S,p){const O=n.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&O.__version!==S.version){Pe(O,S,p);return}else S.isExternalTexture&&(O.__webglTexture=S.sourceTexture?S.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,O.__webglTexture,i.TEXTURE0+p)}function de(S,p){const O=n.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&O.__version!==S.version){Pe(O,S,p);return}t.bindTexture(i.TEXTURE_3D,O.__webglTexture,i.TEXTURE0+p)}function ge(S,p){const O=n.get(S);if(S.isCubeDepthTexture!==!0&&S.version>0&&O.__version!==S.version){De(O,S,p);return}t.bindTexture(i.TEXTURE_CUBE_MAP,O.__webglTexture,i.TEXTURE0+p)}const ye={[Ys]:i.REPEAT,[mn]:i.CLAMP_TO_EDGE,[qs]:i.MIRRORED_REPEAT},He={[yt]:i.NEAREST,[qc]:i.NEAREST_MIPMAP_NEAREST,[Ji]:i.NEAREST_MIPMAP_LINEAR,[At]:i.LINEAR,[ns]:i.LINEAR_MIPMAP_NEAREST,[Kn]:i.LINEAR_MIPMAP_LINEAR},it={[$c]:i.NEVER,[th]:i.ALWAYS,[Jc]:i.LESS,[Oa]:i.LEQUAL,[Qc]:i.EQUAL,[Ba]:i.GEQUAL,[jc]:i.GREATER,[eh]:i.NOTEQUAL};function ke(S,p){if(p.type===nn&&e.has("OES_texture_float_linear")===!1&&(p.magFilter===At||p.magFilter===ns||p.magFilter===Ji||p.magFilter===Kn||p.minFilter===At||p.minFilter===ns||p.minFilter===Ji||p.minFilter===Kn)&&we("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(S,i.TEXTURE_WRAP_S,ye[p.wrapS]),i.texParameteri(S,i.TEXTURE_WRAP_T,ye[p.wrapT]),(S===i.TEXTURE_3D||S===i.TEXTURE_2D_ARRAY)&&i.texParameteri(S,i.TEXTURE_WRAP_R,ye[p.wrapR]),i.texParameteri(S,i.TEXTURE_MAG_FILTER,He[p.magFilter]),i.texParameteri(S,i.TEXTURE_MIN_FILTER,He[p.minFilter]),p.compareFunction&&(i.texParameteri(S,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(S,i.TEXTURE_COMPARE_FUNC,it[p.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(p.magFilter===yt||p.minFilter!==Ji&&p.minFilter!==Kn||p.type===nn&&e.has("OES_texture_float_linear")===!1)return;if(p.anisotropy>1||n.get(p).__currentAnisotropy){const O=e.get("EXT_texture_filter_anisotropic");i.texParameterf(S,O.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(p.anisotropy,r.getMaxAnisotropy())),n.get(p).__currentAnisotropy=p.anisotropy}}}function j(S,p){let O=!1;S.__webglInit===void 0&&(S.__webglInit=!0,p.addEventListener("dispose",P));const H=p.source;let q=d.get(H);q===void 0&&(q={},d.set(H,q));const oe=W(p);if(oe!==S.__cacheKey){q[oe]===void 0&&(q[oe]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,O=!0),q[oe].usedTimes++;const ce=q[S.__cacheKey];ce!==void 0&&(q[S.__cacheKey].usedTimes--,ce.usedTimes===0&&U(p)),S.__cacheKey=oe,S.__webglTexture=q[oe].texture}return O}function ue(S,p,O){return Math.floor(Math.floor(S/O)/p)}function se(S,p,O,H){const oe=S.updateRanges;if(oe.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,p.width,p.height,O,H,p.data);else{oe.sort((Ee,T)=>Ee.start-T.start);let ce=0;for(let Ee=1;Ee<oe.length;Ee++){const T=oe[ce],F=oe[Ee],Y=T.start+T.count,te=ue(F.start,p.width,4),fe=ue(T.start,p.width,4);F.start<=Y+1&&te===fe&&ue(F.start+F.count-1,p.width,4)===te?T.count=Math.max(T.count,F.start+F.count-T.start):(++ce,oe[ce]=F)}oe.length=ce+1;const K=t.getParameter(i.UNPACK_ROW_LENGTH),Q=t.getParameter(i.UNPACK_SKIP_PIXELS),he=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,p.width);for(let Ee=0,T=oe.length;Ee<T;Ee++){const F=oe[Ee],Y=Math.floor(F.start/4),te=Math.ceil(F.count/4),fe=Y%p.width,A=Math.floor(Y/p.width),ie=te,X=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,fe),t.pixelStorei(i.UNPACK_SKIP_ROWS,A),t.texSubImage2D(i.TEXTURE_2D,0,fe,A,ie,X,O,H,p.data)}S.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,K),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Q),t.pixelStorei(i.UNPACK_SKIP_ROWS,he)}}function Pe(S,p,O){let H=i.TEXTURE_2D;(p.isDataArrayTexture||p.isCompressedArrayTexture)&&(H=i.TEXTURE_2D_ARRAY),p.isData3DTexture&&(H=i.TEXTURE_3D);const q=j(S,p),oe=p.source;t.bindTexture(H,S.__webglTexture,i.TEXTURE0+O);const ce=n.get(oe);if(oe.version!==ce.__version||q===!0){if(t.activeTexture(i.TEXTURE0+O),(typeof ImageBitmap<"u"&&p.image instanceof ImageBitmap)===!1){const X=Ve.getPrimaries(Ve.workingColorSpace),ae=p.colorSpace===Ln?null:Ve.getPrimaries(p.colorSpace),le=p.colorSpace===Ln||X===ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,p.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,le)}t.pixelStorei(i.UNPACK_ALIGNMENT,p.unpackAlignment);let Q=g(p.image,!1,r.maxTextureSize);Q=St(p,Q);const he=s.convert(p.format,p.colorSpace),Ee=s.convert(p.type);let T=M(p.internalFormat,he,Ee,p.normalized,p.colorSpace,p.isVideoTexture);ke(H,p);let F;const Y=p.mipmaps,te=p.isVideoTexture!==!0,fe=ce.__version===void 0||q===!0,A=oe.dataReady,ie=E(p,Q);if(p.isDepthTexture)T=R(p.format===Zn,p.type),fe&&(te?t.texStorage2D(i.TEXTURE_2D,1,T,Q.width,Q.height):t.texImage2D(i.TEXTURE_2D,0,T,Q.width,Q.height,0,he,Ee,null));else if(p.isDataTexture)if(Y.length>0){te&&fe&&t.texStorage2D(i.TEXTURE_2D,ie,T,Y[0].width,Y[0].height);for(let X=0,ae=Y.length;X<ae;X++)F=Y[X],te?A&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,F.width,F.height,he,Ee,F.data):t.texImage2D(i.TEXTURE_2D,X,T,F.width,F.height,0,he,Ee,F.data);p.generateMipmaps=!1}else te?(fe&&t.texStorage2D(i.TEXTURE_2D,ie,T,Q.width,Q.height),A&&se(p,Q,he,Ee)):t.texImage2D(i.TEXTURE_2D,0,T,Q.width,Q.height,0,he,Ee,Q.data);else if(p.isCompressedTexture)if(p.isCompressedArrayTexture){te&&fe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ie,T,Y[0].width,Y[0].height,Q.depth);for(let X=0,ae=Y.length;X<ae;X++)if(F=Y[X],p.format!==Zt)if(he!==null)if(te){if(A)if(p.layerUpdates.size>0){const le=zo(F.width,F.height,p.format,p.type);for(const $ of p.layerUpdates){const ve=F.data.subarray($*le/F.data.BYTES_PER_ELEMENT,($+1)*le/F.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,$,F.width,F.height,1,he,ve)}p.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,0,F.width,F.height,Q.depth,he,F.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,X,T,F.width,F.height,Q.depth,0,F.data,0,0);else we("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else te?A&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,0,F.width,F.height,Q.depth,he,Ee,F.data):t.texImage3D(i.TEXTURE_2D_ARRAY,X,T,F.width,F.height,Q.depth,0,he,Ee,F.data)}else{te&&fe&&t.texStorage2D(i.TEXTURE_2D,ie,T,Y[0].width,Y[0].height);for(let X=0,ae=Y.length;X<ae;X++)F=Y[X],p.format!==Zt?he!==null?te?A&&t.compressedTexSubImage2D(i.TEXTURE_2D,X,0,0,F.width,F.height,he,F.data):t.compressedTexImage2D(i.TEXTURE_2D,X,T,F.width,F.height,0,F.data):we("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):te?A&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,F.width,F.height,he,Ee,F.data):t.texImage2D(i.TEXTURE_2D,X,T,F.width,F.height,0,he,Ee,F.data)}else if(p.isDataArrayTexture)if(te){if(fe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ie,T,Q.width,Q.height,Q.depth),A)if(p.layerUpdates.size>0){const X=zo(Q.width,Q.height,p.format,p.type);for(const ae of p.layerUpdates){const le=Q.data.subarray(ae*X/Q.data.BYTES_PER_ELEMENT,(ae+1)*X/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,ae,Q.width,Q.height,1,he,Ee,le)}p.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,he,Ee,Q.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,T,Q.width,Q.height,Q.depth,0,he,Ee,Q.data);else if(p.isData3DTexture)te?(fe&&t.texStorage3D(i.TEXTURE_3D,ie,T,Q.width,Q.height,Q.depth),A&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,he,Ee,Q.data)):t.texImage3D(i.TEXTURE_3D,0,T,Q.width,Q.height,Q.depth,0,he,Ee,Q.data);else if(p.isFramebufferTexture){if(fe)if(te)t.texStorage2D(i.TEXTURE_2D,ie,T,Q.width,Q.height);else{let X=Q.width,ae=Q.height;for(let le=0;le<ie;le++)t.texImage2D(i.TEXTURE_2D,le,T,X,ae,0,he,Ee,null),X>>=1,ae>>=1}}else if(p.isHTMLTexture){if("texElementImage2D"in i){const X=i.canvas;if(X.hasAttribute("layoutsubtree")||X.setAttribute("layoutsubtree","true"),Q.parentNode!==X){X.appendChild(Q),m.add(p),X.onpaint=ae=>{const le=ae.changedElements;for(const $ of m)le.includes($.image)&&($.needsUpdate=!0)},X.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Q);else{const le=i.RGBA,$=i.RGBA,ve=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,le,$,ve,Q)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Y.length>0){if(te&&fe){const X=Xe(Y[0]);t.texStorage2D(i.TEXTURE_2D,ie,T,X.width,X.height)}for(let X=0,ae=Y.length;X<ae;X++)F=Y[X],te?A&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,he,Ee,F):t.texImage2D(i.TEXTURE_2D,X,T,he,Ee,F);p.generateMipmaps=!1}else if(te){if(fe){const X=Xe(Q);t.texStorage2D(i.TEXTURE_2D,ie,T,X.width,X.height)}A&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,he,Ee,Q)}else t.texImage2D(i.TEXTURE_2D,0,T,he,Ee,Q);f(p)&&w(H),ce.__version=oe.version,p.onUpdate&&p.onUpdate(p)}S.__version=p.version}function De(S,p,O){if(p.image.length!==6)return;const H=j(S,p),q=p.source;t.bindTexture(i.TEXTURE_CUBE_MAP,S.__webglTexture,i.TEXTURE0+O);const oe=n.get(q);if(q.version!==oe.__version||H===!0){t.activeTexture(i.TEXTURE0+O);const ce=Ve.getPrimaries(Ve.workingColorSpace),K=p.colorSpace===Ln?null:Ve.getPrimaries(p.colorSpace),Q=p.colorSpace===Ln||ce===K?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,p.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,p.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Q);const he=p.isCompressedTexture||p.image[0].isCompressedTexture,Ee=p.image[0]&&p.image[0].isDataTexture,T=[];for(let $=0;$<6;$++)!he&&!Ee?T[$]=g(p.image[$],!0,r.maxCubemapSize):T[$]=Ee?p.image[$].image:p.image[$],T[$]=St(p,T[$]);const F=T[0],Y=s.convert(p.format,p.colorSpace),te=s.convert(p.type),fe=M(p.internalFormat,Y,te,p.normalized,p.colorSpace),A=p.isVideoTexture!==!0,ie=oe.__version===void 0||H===!0,X=q.dataReady;let ae=E(p,F);ke(i.TEXTURE_CUBE_MAP,p);let le;if(he){A&&ie&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ae,fe,F.width,F.height);for(let $=0;$<6;$++){le=T[$].mipmaps;for(let ve=0;ve<le.length;ve++){const pe=le[ve];p.format!==Zt?Y!==null?A?X&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,0,0,pe.width,pe.height,Y,pe.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,fe,pe.width,pe.height,0,pe.data):we("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,0,0,pe.width,pe.height,Y,te,pe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,fe,pe.width,pe.height,0,Y,te,pe.data)}}}else{if(le=p.mipmaps,A&&ie){le.length>0&&ae++;const $=Xe(T[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ae,fe,$.width,$.height)}for(let $=0;$<6;$++)if(Ee){A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,T[$].width,T[$].height,Y,te,T[$].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,fe,T[$].width,T[$].height,0,Y,te,T[$].data);for(let ve=0;ve<le.length;ve++){const Ke=le[ve].image[$].image;A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,0,0,Ke.width,Ke.height,Y,te,Ke.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,fe,Ke.width,Ke.height,0,Y,te,Ke.data)}}else{A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,Y,te,T[$]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,fe,Y,te,T[$]);for(let ve=0;ve<le.length;ve++){const pe=le[ve];A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,0,0,Y,te,pe.image[$]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,fe,Y,te,pe.image[$])}}}f(p)&&w(i.TEXTURE_CUBE_MAP),oe.__version=q.version,p.onUpdate&&p.onUpdate(p)}S.__version=p.version}function Re(S,p,O,H,q,oe){const ce=s.convert(O.format,O.colorSpace),K=s.convert(O.type),Q=M(O.internalFormat,ce,K,O.normalized,O.colorSpace),he=n.get(p),Ee=n.get(O);if(Ee.__renderTarget=p,!he.__hasExternalTextures){const T=Math.max(1,p.width>>oe),F=Math.max(1,p.height>>oe);q===i.TEXTURE_3D||q===i.TEXTURE_2D_ARRAY?t.texImage3D(q,oe,Q,T,F,p.depth,0,ce,K,null):t.texImage2D(q,oe,Q,T,F,0,ce,K,null)}t.bindFramebuffer(i.FRAMEBUFFER,S),lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,H,q,Ee.__webglTexture,0,st(p)):(q===i.TEXTURE_2D||q>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&q<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,H,q,Ee.__webglTexture,oe),t.bindFramebuffer(i.FRAMEBUFFER,null)}function rt(S,p,O){if(i.bindRenderbuffer(i.RENDERBUFFER,S),p.depthBuffer){const H=p.depthTexture,q=H&&H.isDepthTexture?H.type:null,oe=R(p.stencilBuffer,q),ce=p.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;lt(p)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,st(p),oe,p.width,p.height):O?i.renderbufferStorageMultisample(i.RENDERBUFFER,st(p),oe,p.width,p.height):i.renderbufferStorage(i.RENDERBUFFER,oe,p.width,p.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ce,i.RENDERBUFFER,S)}else{const H=p.textures;for(let q=0;q<H.length;q++){const oe=H[q],ce=s.convert(oe.format,oe.colorSpace),K=s.convert(oe.type),Q=M(oe.internalFormat,ce,K,oe.normalized,oe.colorSpace);lt(p)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,st(p),Q,p.width,p.height):O?i.renderbufferStorageMultisample(i.RENDERBUFFER,st(p),Q,p.width,p.height):i.renderbufferStorage(i.RENDERBUFFER,Q,p.width,p.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ne(S,p,O){const H=p.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,S),!(p.depthTexture&&p.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const q=n.get(p.depthTexture);if(q.__renderTarget=p,(!q.__webglTexture||p.depthTexture.image.width!==p.width||p.depthTexture.image.height!==p.height)&&(p.depthTexture.image.width=p.width,p.depthTexture.image.height=p.height,p.depthTexture.needsUpdate=!0),H){if(q.__webglInit===void 0&&(q.__webglInit=!0,p.depthTexture.addEventListener("dispose",P)),q.__webglTexture===void 0){q.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture),ke(i.TEXTURE_CUBE_MAP,p.depthTexture);const he=s.convert(p.depthTexture.format),Ee=s.convert(p.depthTexture.type);let T;p.depthTexture.format===vn?T=i.DEPTH_COMPONENT24:p.depthTexture.format===Zn&&(T=i.DEPTH24_STENCIL8);for(let F=0;F<6;F++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+F,0,T,p.width,p.height,0,he,Ee,null)}}else ne(p.depthTexture,0);const oe=q.__webglTexture,ce=st(p),K=H?i.TEXTURE_CUBE_MAP_POSITIVE_X+O:i.TEXTURE_2D,Q=p.depthTexture.format===Zn?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(p.depthTexture.format===vn)lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Q,K,oe,0,ce):i.framebufferTexture2D(i.FRAMEBUFFER,Q,K,oe,0);else if(p.depthTexture.format===Zn)lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Q,K,oe,0,ce):i.framebufferTexture2D(i.FRAMEBUFFER,Q,K,oe,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function qe(S){const p=n.get(S),O=S.isWebGLCubeRenderTarget===!0;if(p.__boundDepthTexture!==S.depthTexture){const H=S.depthTexture;if(p.__depthDisposeCallback&&p.__depthDisposeCallback(),H){const q=()=>{delete p.__boundDepthTexture,delete p.__depthDisposeCallback,H.removeEventListener("dispose",q)};H.addEventListener("dispose",q),p.__depthDisposeCallback=q}p.__boundDepthTexture=H}if(S.depthTexture&&!p.__autoAllocateDepthBuffer)if(O)for(let H=0;H<6;H++)Ne(p.__webglFramebuffer[H],S,H);else{const H=S.texture.mipmaps;H&&H.length>0?Ne(p.__webglFramebuffer[0],S,0):Ne(p.__webglFramebuffer,S,0)}else if(O){p.__webglDepthbuffer=[];for(let H=0;H<6;H++)if(t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer[H]),p.__webglDepthbuffer[H]===void 0)p.__webglDepthbuffer[H]=i.createRenderbuffer(),rt(p.__webglDepthbuffer[H],S,!1);else{const q=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=p.__webglDepthbuffer[H];i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,q,i.RENDERBUFFER,oe)}}else{const H=S.texture.mipmaps;if(H&&H.length>0?t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer),p.__webglDepthbuffer===void 0)p.__webglDepthbuffer=i.createRenderbuffer(),rt(p.__webglDepthbuffer,S,!1);else{const q=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=p.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,q,i.RENDERBUFFER,oe)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function We(S,p,O){const H=n.get(S);p!==void 0&&Re(H.__webglFramebuffer,S,S.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),O!==void 0&&qe(S)}function ze(S){const p=S.texture,O=n.get(S),H=n.get(p);S.addEventListener("dispose",_);const q=S.textures,oe=S.isWebGLCubeRenderTarget===!0,ce=q.length>1;if(ce||(H.__webglTexture===void 0&&(H.__webglTexture=i.createTexture()),H.__version=p.version,a.memory.textures++),oe){O.__webglFramebuffer=[];for(let K=0;K<6;K++)if(p.mipmaps&&p.mipmaps.length>0){O.__webglFramebuffer[K]=[];for(let Q=0;Q<p.mipmaps.length;Q++)O.__webglFramebuffer[K][Q]=i.createFramebuffer()}else O.__webglFramebuffer[K]=i.createFramebuffer()}else{if(p.mipmaps&&p.mipmaps.length>0){O.__webglFramebuffer=[];for(let K=0;K<p.mipmaps.length;K++)O.__webglFramebuffer[K]=i.createFramebuffer()}else O.__webglFramebuffer=i.createFramebuffer();if(ce)for(let K=0,Q=q.length;K<Q;K++){const he=n.get(q[K]);he.__webglTexture===void 0&&(he.__webglTexture=i.createTexture(),a.memory.textures++)}if(S.samples>0&<(S)===!1){O.__webglMultisampledFramebuffer=i.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let K=0;K<q.length;K++){const Q=q[K];O.__webglColorRenderbuffer[K]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,O.__webglColorRenderbuffer[K]);const he=s.convert(Q.format,Q.colorSpace),Ee=s.convert(Q.type),T=M(Q.internalFormat,he,Ee,Q.normalized,Q.colorSpace,S.isXRRenderTarget===!0),F=st(S);i.renderbufferStorageMultisample(i.RENDERBUFFER,F,T,S.width,S.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+K,i.RENDERBUFFER,O.__webglColorRenderbuffer[K])}i.bindRenderbuffer(i.RENDERBUFFER,null),S.depthBuffer&&(O.__webglDepthRenderbuffer=i.createRenderbuffer(),rt(O.__webglDepthRenderbuffer,S,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(oe){t.bindTexture(i.TEXTURE_CUBE_MAP,H.__webglTexture),ke(i.TEXTURE_CUBE_MAP,p);for(let K=0;K<6;K++)if(p.mipmaps&&p.mipmaps.length>0)for(let Q=0;Q<p.mipmaps.length;Q++)Re(O.__webglFramebuffer[K][Q],S,p,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+K,Q);else Re(O.__webglFramebuffer[K],S,p,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+K,0);f(p)&&w(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ce){for(let K=0,Q=q.length;K<Q;K++){const he=q[K],Ee=n.get(he);let T=i.TEXTURE_2D;(S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(T=S.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(T,Ee.__webglTexture),ke(T,he),Re(O.__webglFramebuffer,S,he,i.COLOR_ATTACHMENT0+K,T,0),f(he)&&w(T)}t.unbindTexture()}else{let K=i.TEXTURE_2D;if((S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(K=S.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(K,H.__webglTexture),ke(K,p),p.mipmaps&&p.mipmaps.length>0)for(let Q=0;Q<p.mipmaps.length;Q++)Re(O.__webglFramebuffer[Q],S,p,i.COLOR_ATTACHMENT0,K,Q);else Re(O.__webglFramebuffer,S,p,i.COLOR_ATTACHMENT0,K,0);f(p)&&w(K),t.unbindTexture()}S.depthBuffer&&qe(S)}function ot(S){const p=S.textures;for(let O=0,H=p.length;O<H;O++){const q=p[O];if(f(q)){const oe=C(S),ce=n.get(q).__webglTexture;t.bindTexture(oe,ce),w(oe),t.unbindTexture()}}}const ut=[],pt=[];function mt(S){if(S.samples>0){if(lt(S)===!1){const p=S.textures,O=S.width,H=S.height;let q=i.COLOR_BUFFER_BIT;const oe=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ce=n.get(S),K=p.length>1;if(K)for(let he=0;he<p.length;he++)t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,ce.__webglMultisampledFramebuffer);const Q=S.texture.mipmaps;Q&&Q.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ce.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ce.__webglFramebuffer);for(let he=0;he<p.length;he++){if(S.resolveDepthBuffer&&(S.depthBuffer&&(q|=i.DEPTH_BUFFER_BIT),S.stencilBuffer&&S.resolveStencilBuffer&&(q|=i.STENCIL_BUFFER_BIT)),K){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,ce.__webglColorRenderbuffer[he]);const Ee=n.get(p[he]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Ee,0)}i.blitFramebuffer(0,0,O,H,0,0,O,H,q,i.NEAREST),c===!0&&(ut.length=0,pt.length=0,ut.push(i.COLOR_ATTACHMENT0+he),S.depthBuffer&&S.resolveDepthBuffer===!1&&(ut.push(oe),pt.push(oe),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,pt)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ut))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),K)for(let he=0;he<p.length;he++){t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,ce.__webglColorRenderbuffer[he]);const Ee=n.get(p[he]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.TEXTURE_2D,Ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ce.__webglMultisampledFramebuffer)}else if(S.depthBuffer&&S.resolveDepthBuffer===!1&&c){const p=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[p])}}}function st(S){return Math.min(r.maxSamples,S.samples)}function lt(S){const p=n.get(S);return S.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&p.__useRenderToTexture!==!1}function L(S){const p=a.render.frame;u.get(S)!==p&&(u.set(S,p),S.update())}function St(S,p){const O=S.colorSpace,H=S.format,q=S.type;return S.isCompressedTexture===!0||S.isVideoTexture===!0||O!==Ur&&O!==Ln&&(Ve.getTransfer(O)===Ze?(H!==Zt||q!==kt)&&we("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",O)),p}function Xe(S){return typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement?(l.width=S.naturalWidth||S.width,l.height=S.naturalHeight||S.height):typeof VideoFrame<"u"&&S instanceof VideoFrame?(l.width=S.displayWidth,l.height=S.displayHeight):(l.width=S.width,l.height=S.height),l}this.allocateTextureUnit=Z,this.resetTextureUnits=J,this.getTextureUnits=ee,this.setTextureUnits=V,this.setTexture2D=ne,this.setTexture2DArray=re,this.setTexture3D=de,this.setTextureCube=ge,this.rebindTextures=We,this.setupRenderTarget=ze,this.updateRenderTargetMipmap=ot,this.updateMultisampleRenderTarget=mt,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=Re,this.useMultisampledRTT=lt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function zm(i,e){function t(n,r=Ln){let s;const a=Ve.getTransfer(r);if(n===kt)return i.UNSIGNED_BYTE;if(n===La)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ia)return i.UNSIGNED_SHORT_5_5_5_1;if(n===wl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Cl)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Al)return i.BYTE;if(n===Rl)return i.SHORT;if(n===Wi)return i.UNSIGNED_SHORT;if(n===Da)return i.INT;if(n===on)return i.UNSIGNED_INT;if(n===nn)return i.FLOAT;if(n===xn)return i.HALF_FLOAT;if(n===Pl)return i.ALPHA;if(n===Dl)return i.RGB;if(n===Zt)return i.RGBA;if(n===vn)return i.DEPTH_COMPONENT;if(n===Zn)return i.DEPTH_STENCIL;if(n===Ll)return i.RED;if(n===Ua)return i.RED_INTEGER;if(n===Jn)return i.RG;if(n===Na)return i.RG_INTEGER;if(n===Fa)return i.RGBA_INTEGER;if(n===Ar||n===Rr||n===wr||n===Cr)if(a===Ze)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ar)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Rr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===wr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ar)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Rr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===wr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Cr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ks||n===Zs||n===$s||n===Js)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ks)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Zs)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===$s)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Js)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Qs||n===js||n===ea||n===ta||n===na||n===Lr||n===ia)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Qs||n===js)return a===Ze?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ea)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ta)return s.COMPRESSED_R11_EAC;if(n===na)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Lr)return s.COMPRESSED_RG11_EAC;if(n===ia)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ra||n===sa||n===aa||n===oa||n===la||n===ca||n===ha||n===ua||n===fa||n===da||n===pa||n===ma||n===ga||n===_a)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ra)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===sa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===aa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===oa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===la)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ca)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ha)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ua)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===fa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===da)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===pa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ma)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===ga)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===_a)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===xa||n===va||n===Ma)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===xa)return a===Ze?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===va)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ma)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Sa||n===ya||n===Ir||n===Ea)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Sa)return s.COMPRESSED_RED_RGTC1_EXT;if(n===ya)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ir)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ea)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Xi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Gm=`
|
|
4084
|
+
}`,Im=[new D(1,0,0),new D(-1,0,0),new D(0,1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1)],Um=[new D(0,-1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1),new D(0,-1,0),new D(0,-1,0)],ll=new at,Vi=new D,Us=new D;function Nm(i,e,t){let n=new Vl;const r=new Ce,s=new Ce,a=new ht,o=new Yh,c=new qh,l={},u=t.maxTextureSize,m={[On]:Ut,[Ut]:On,[pn]:pn},h=new ln({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ce},radius:{value:4}},vertexShader:Dm,fragmentShader:Lm}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const x=new Xt;x.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Mn(x,h),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Tr;let f=this.type;this.render=function(E,P,g){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||E.length===0)return;this.type===Tc&&(we("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Tr);const b=i.getRenderTarget(),U=i.getActiveCubeFace(),I=i.getActiveMipmapLevel(),B=i.state;B.setBlending(_n),B.buffers.depth.getReversed()===!0?B.buffers.color.setClear(0,0,0,0):B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const J=f!==this.type;J&&P.traverse(function(ee){ee.material&&(Array.isArray(ee.material)?ee.material.forEach(V=>V.needsUpdate=!0):ee.material.needsUpdate=!0)});for(let ee=0,V=E.length;ee<V;ee++){const Z=E[ee],W=Z.shadow;if(W===void 0){we("WebGLShadowMap:",Z,"has no shadow.");continue}if(W.autoUpdate===!1&&W.needsUpdate===!1)continue;r.copy(W.mapSize);const ne=W.getFrameExtents();r.multiply(ne),s.copy(W.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ne.x),r.x=s.x*ne.x,W.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ne.y),r.y=s.y*ne.y,W.mapSize.y=s.y));const re=i.state.buffers.depth.getReversed();if(W.camera._reversedDepth=re,W.map===null||J===!0){if(W.map!==null&&(W.map.depthTexture!==null&&(W.map.depthTexture.dispose(),W.map.depthTexture=null),W.map.dispose()),this.type===Hi){if(Z.isPointLight){we("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}W.map=new an(r.x,r.y,{format:Jn,type:xn,minFilter:At,magFilter:At,generateMipmaps:!1}),W.map.texture.name=Z.name+".shadowMap",W.map.depthTexture=new Ri(r.x,r.y,nn),W.map.depthTexture.name=Z.name+".shadowMapDepth",W.map.depthTexture.format=vn,W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=yt,W.map.depthTexture.magFilter=yt}else Z.isPointLight?(W.map=new $l(r.x),W.map.depthTexture=new Nh(r.x,on)):(W.map=new an(r.x,r.y),W.map.depthTexture=new Ri(r.x,r.y,on)),W.map.depthTexture.name=Z.name+".shadowMap",W.map.depthTexture.format=vn,this.type===Tr?(W.map.depthTexture.compareFunction=re?Ba:Oa,W.map.depthTexture.minFilter=At,W.map.depthTexture.magFilter=At):(W.map.depthTexture.compareFunction=null,W.map.depthTexture.minFilter=yt,W.map.depthTexture.magFilter=yt);W.camera.updateProjectionMatrix()}const de=W.map.isWebGLCubeRenderTarget?6:1;for(let _e=0;_e<de;_e++){if(W.map.isWebGLCubeRenderTarget)i.setRenderTarget(W.map,_e),i.clear();else{_e===0&&(i.setRenderTarget(W.map),i.clear());const ye=W.getViewport(_e);a.set(s.x*ye.x,s.y*ye.y,s.x*ye.z,s.y*ye.w),B.viewport(a)}if(Z.isPointLight){const ye=W.camera,ke=W.matrix,it=Z.distance||ye.far;it!==ye.far&&(ye.far=it,ye.updateProjectionMatrix()),Vi.setFromMatrixPosition(Z.matrixWorld),ye.position.copy(Vi),Us.copy(ye.position),Us.add(Im[_e]),ye.up.copy(Um[_e]),ye.lookAt(Us),ye.updateMatrixWorld(),ke.makeTranslation(-Vi.x,-Vi.y,-Vi.z),ll.multiplyMatrices(ye.projectionMatrix,ye.matrixWorldInverse),W._frustum.setFromProjectionMatrix(ll,ye.coordinateSystem,ye.reversedDepth)}else W.updateMatrices(Z);n=W.getFrustum(),M(P,g,W.camera,Z,this.type)}W.isPointLightShadow!==!0&&this.type===Hi&&w(W,g),W.needsUpdate=!1}f=this.type,_.needsUpdate=!1,i.setRenderTarget(b,U,I)};function w(E,P){const g=e.update(y);h.defines.VSM_SAMPLES!==E.blurSamples&&(h.defines.VSM_SAMPLES=E.blurSamples,d.defines.VSM_SAMPLES=E.blurSamples,h.needsUpdate=!0,d.needsUpdate=!0),E.mapPass===null&&(E.mapPass=new an(r.x,r.y,{format:Jn,type:xn})),h.uniforms.shadow_pass.value=E.map.depthTexture,h.uniforms.resolution.value=E.mapSize,h.uniforms.radius.value=E.radius,i.setRenderTarget(E.mapPass),i.clear(),i.renderBufferDirect(P,null,g,h,y,null),d.uniforms.shadow_pass.value=E.mapPass.texture,d.uniforms.resolution.value=E.mapSize,d.uniforms.radius.value=E.radius,i.setRenderTarget(E.map),i.clear(),i.renderBufferDirect(P,null,g,d,y,null)}function C(E,P,g,b){let U=null;const I=g.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(I!==void 0)U=I;else if(U=g.isPointLight===!0?c:o,i.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0||P.alphaToCoverage===!0){const B=U.uuid,J=P.uuid;let ee=l[B];ee===void 0&&(ee={},l[B]=ee);let V=ee[J];V===void 0&&(V=U.clone(),ee[J]=V,P.addEventListener("dispose",R)),U=V}if(U.visible=P.visible,U.wireframe=P.wireframe,b===Hi?U.side=P.shadowSide!==null?P.shadowSide:P.side:U.side=P.shadowSide!==null?P.shadowSide:m[P.side],U.alphaMap=P.alphaMap,U.alphaTest=P.alphaToCoverage===!0?.5:P.alphaTest,U.map=P.map,U.clipShadows=P.clipShadows,U.clippingPlanes=P.clippingPlanes,U.clipIntersection=P.clipIntersection,U.displacementMap=P.displacementMap,U.displacementScale=P.displacementScale,U.displacementBias=P.displacementBias,U.wireframeLinewidth=P.wireframeLinewidth,U.linewidth=P.linewidth,g.isPointLight===!0&&U.isMeshDistanceMaterial===!0){const B=i.properties.get(U);B.light=g}return U}function M(E,P,g,b,U){if(E.visible===!1)return;if(E.layers.test(P.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&U===Hi)&&(!E.frustumCulled||n.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,E.matrixWorld);const J=e.update(E),ee=E.material;if(Array.isArray(ee)){const V=J.groups;for(let Z=0,W=V.length;Z<W;Z++){const ne=V[Z],re=ee[ne.materialIndex];if(re&&re.visible){const de=C(E,re,b,U);E.onBeforeShadow(i,E,P,g,J,de,ne),i.renderBufferDirect(g,null,J,de,E,ne),E.onAfterShadow(i,E,P,g,J,de,ne)}}}else if(ee.visible){const V=C(E,ee,b,U);E.onBeforeShadow(i,E,P,g,J,V,null),i.renderBufferDirect(g,null,J,V,E,null),E.onAfterShadow(i,E,P,g,J,V,null)}}const B=E.children;for(let J=0,ee=B.length;J<ee;J++)M(B[J],P,g,b,U)}function R(E){E.target.removeEventListener("dispose",R);for(const g in l){const b=l[g],U=E.target.uuid;U in b&&(b[U].dispose(),delete b[U])}}}function Fm(i,e){function t(){let A=!1;const ie=new ht;let X=null;const se=new ht(0,0,0,0);return{setMask:function(le){X!==le&&!A&&(i.colorMask(le,le,le,le),X=le)},setLocked:function(le){A=le},setClear:function(le,$,ve,pe,Ke){Ke===!0&&(le*=pe,$*=pe,ve*=pe),ie.set(le,$,ve,pe),se.equals(ie)===!1&&(i.clearColor(le,$,ve,pe),se.copy(ie))},reset:function(){A=!1,X=null,se.set(-1,0,0,0)}}}function n(){let A=!1,ie=!1,X=null,se=null,le=null;return{setReversed:function($){if(ie!==$){const ve=e.get("EXT_clip_control");$?ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.ZERO_TO_ONE_EXT):ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.NEGATIVE_ONE_TO_ONE_EXT),ie=$;const pe=le;le=null,this.setClear(pe)}},getReversed:function(){return ie},setTest:function($){$?ae(i.DEPTH_TEST):Pe(i.DEPTH_TEST)},setMask:function($){X!==$&&!A&&(i.depthMask($),X=$)},setFunc:function($){if(ie&&($=rh[$]),se!==$){switch($){case zs:i.depthFunc(i.NEVER);break;case Gs:i.depthFunc(i.ALWAYS);break;case Vs:i.depthFunc(i.LESS);break;case Ti:i.depthFunc(i.LEQUAL);break;case Hs:i.depthFunc(i.EQUAL);break;case ks:i.depthFunc(i.GEQUAL);break;case Ws:i.depthFunc(i.GREATER);break;case Xs:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}se=$}},setLocked:function($){A=$},setClear:function($){le!==$&&(le=$,ie&&($=1-$),i.clearDepth($))},reset:function(){A=!1,X=null,se=null,le=null,ie=!1}}}function r(){let A=!1,ie=null,X=null,se=null,le=null,$=null,ve=null,pe=null,Ke=null;return{setTest:function($e){A||($e?ae(i.STENCIL_TEST):Pe(i.STENCIL_TEST))},setMask:function($e){ie!==$e&&!A&&(i.stencilMask($e),ie=$e)},setFunc:function($e,wt,Nt){(X!==$e||se!==wt||le!==Nt)&&(i.stencilFunc($e,wt,Nt),X=$e,se=wt,le=Nt)},setOp:function($e,wt,Nt){($!==$e||ve!==wt||pe!==Nt)&&(i.stencilOp($e,wt,Nt),$=$e,ve=wt,pe=Nt)},setLocked:function($e){A=$e},setClear:function($e){Ke!==$e&&(i.clearStencil($e),Ke=$e)},reset:function(){A=!1,ie=null,X=null,se=null,le=null,$=null,ve=null,pe=null,Ke=null}}}const s=new t,a=new n,o=new r,c=new WeakMap,l=new WeakMap;let u={},m={},h={},d=new WeakMap,x=[],y=null,_=!1,f=null,w=null,C=null,M=null,R=null,E=null,P=null,g=new Be(0,0,0),b=0,U=!1,I=null,B=null,J=null,ee=null,V=null;const Z=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,ne=0;const re=i.getParameter(i.VERSION);re.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(re)[1]),W=ne>=1):re.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(re)[1]),W=ne>=2);let de=null,_e={};const ye=i.getParameter(i.SCISSOR_BOX),ke=i.getParameter(i.VIEWPORT),it=new ht().fromArray(ye),We=new ht().fromArray(ke);function j(A,ie,X,se){const le=new Uint8Array(4),$=i.createTexture();i.bindTexture(A,$),i.texParameteri(A,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(A,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ve=0;ve<X;ve++)A===i.TEXTURE_3D||A===i.TEXTURE_2D_ARRAY?i.texImage3D(ie,0,i.RGBA,1,1,se,0,i.RGBA,i.UNSIGNED_BYTE,le):i.texImage2D(ie+ve,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,le);return $}const ue={};ue[i.TEXTURE_2D]=j(i.TEXTURE_2D,i.TEXTURE_2D,1),ue[i.TEXTURE_CUBE_MAP]=j(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ue[i.TEXTURE_2D_ARRAY]=j(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ue[i.TEXTURE_3D]=j(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ae(i.DEPTH_TEST),a.setFunc(Ti),ot(!1),ut(io),ae(i.CULL_FACE),Xe(_n);function ae(A){u[A]!==!0&&(i.enable(A),u[A]=!0)}function Pe(A){u[A]!==!1&&(i.disable(A),u[A]=!1)}function De(A,ie){return h[A]!==ie?(i.bindFramebuffer(A,ie),h[A]=ie,A===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=ie),A===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=ie),!0):!1}function Re(A,ie){let X=x,se=!1;if(A){X=d.get(ie),X===void 0&&(X=[],d.set(ie,X));const le=A.textures;if(X.length!==le.length||X[0]!==i.COLOR_ATTACHMENT0){for(let $=0,ve=le.length;$<ve;$++)X[$]=i.COLOR_ATTACHMENT0+$;X.length=le.length,se=!0}}else X[0]!==i.BACK&&(X[0]=i.BACK,se=!0);se&&i.drawBuffers(X)}function rt(A){return y!==A?(i.useProgram(A),y=A,!0):!1}const Ne={[Xn]:i.FUNC_ADD,[Rc]:i.FUNC_SUBTRACT,[wc]:i.FUNC_REVERSE_SUBTRACT};Ne[Cc]=i.MIN,Ne[Pc]=i.MAX;const qe={[Dc]:i.ZERO,[Lc]:i.ONE,[Ic]:i.SRC_COLOR,[Os]:i.SRC_ALPHA,[zc]:i.SRC_ALPHA_SATURATE,[Oc]:i.DST_COLOR,[Nc]:i.DST_ALPHA,[Uc]:i.ONE_MINUS_SRC_COLOR,[Bs]:i.ONE_MINUS_SRC_ALPHA,[Bc]:i.ONE_MINUS_DST_COLOR,[Fc]:i.ONE_MINUS_DST_ALPHA,[Gc]:i.CONSTANT_COLOR,[Vc]:i.ONE_MINUS_CONSTANT_COLOR,[Hc]:i.CONSTANT_ALPHA,[kc]:i.ONE_MINUS_CONSTANT_ALPHA};function Xe(A,ie,X,se,le,$,ve,pe,Ke,$e){if(A===_n){_===!0&&(Pe(i.BLEND),_=!1);return}if(_===!1&&(ae(i.BLEND),_=!0),A!==Ac){if(A!==f||$e!==U){if((w!==Xn||R!==Xn)&&(i.blendEquation(i.FUNC_ADD),w=Xn,R=Xn),$e)switch(A){case Nn:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ro:i.blendFunc(i.ONE,i.ONE);break;case so:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ao:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ge("WebGLState: Invalid blending: ",A);break}else switch(A){case Nn:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ro:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case so:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case ao:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",A);break}C=null,M=null,E=null,P=null,g.set(0,0,0),b=0,f=A,U=$e}return}le=le||ie,$=$||X,ve=ve||se,(ie!==w||le!==R)&&(i.blendEquationSeparate(Ne[ie],Ne[le]),w=ie,R=le),(X!==C||se!==M||$!==E||ve!==P)&&(i.blendFuncSeparate(qe[X],qe[se],qe[$],qe[ve]),C=X,M=se,E=$,P=ve),(pe.equals(g)===!1||Ke!==b)&&(i.blendColor(pe.r,pe.g,pe.b,Ke),g.copy(pe),b=Ke),f=A,U=!1}function ze(A,ie){A.side===pn?Pe(i.CULL_FACE):ae(i.CULL_FACE);let X=A.side===Ut;ie&&(X=!X),ot(X),A.blending===Nn&&A.transparent===!1?Xe(_n):Xe(A.blending,A.blendEquation,A.blendSrc,A.blendDst,A.blendEquationAlpha,A.blendSrcAlpha,A.blendDstAlpha,A.blendColor,A.blendAlpha,A.premultipliedAlpha),a.setFunc(A.depthFunc),a.setTest(A.depthTest),a.setMask(A.depthWrite),s.setMask(A.colorWrite);const se=A.stencilWrite;o.setTest(se),se&&(o.setMask(A.stencilWriteMask),o.setFunc(A.stencilFunc,A.stencilRef,A.stencilFuncMask),o.setOp(A.stencilFail,A.stencilZFail,A.stencilZPass)),mt(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),A.alphaToCoverage===!0?ae(i.SAMPLE_ALPHA_TO_COVERAGE):Pe(i.SAMPLE_ALPHA_TO_COVERAGE)}function ot(A){I!==A&&(A?i.frontFace(i.CW):i.frontFace(i.CCW),I=A)}function ut(A){A!==Ec?(ae(i.CULL_FACE),A!==B&&(A===io?i.cullFace(i.BACK):A===bc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Pe(i.CULL_FACE),B=A}function pt(A){A!==J&&(W&&i.lineWidth(A),J=A)}function mt(A,ie,X){A?(ae(i.POLYGON_OFFSET_FILL),(ee!==ie||V!==X)&&(ee=ie,V=X,a.getReversed()&&(ie=-ie),i.polygonOffset(ie,X))):Pe(i.POLYGON_OFFSET_FILL)}function st(A){A?ae(i.SCISSOR_TEST):Pe(i.SCISSOR_TEST)}function lt(A){A===void 0&&(A=i.TEXTURE0+Z-1),de!==A&&(i.activeTexture(A),de=A)}function L(A,ie,X){X===void 0&&(de===null?X=i.TEXTURE0+Z-1:X=de);let se=_e[X];se===void 0&&(se={type:void 0,texture:void 0},_e[X]=se),(se.type!==A||se.texture!==ie)&&(de!==X&&(i.activeTexture(X),de=X),i.bindTexture(A,ie||ue[A]),se.type=A,se.texture=ie)}function St(){const A=_e[de];A!==void 0&&A.type!==void 0&&(i.bindTexture(A.type,null),A.type=void 0,A.texture=void 0)}function He(){try{i.compressedTexImage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function S(){try{i.compressedTexImage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function p(){try{i.texSubImage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function O(){try{i.texSubImage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function H(){try{i.compressedTexSubImage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function q(){try{i.compressedTexSubImage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function oe(){try{i.texStorage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function ce(){try{i.texStorage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function K(){try{i.texImage2D(...arguments)}catch(A){Ge("WebGLState:",A)}}function Q(){try{i.texImage3D(...arguments)}catch(A){Ge("WebGLState:",A)}}function he(A){return m[A]!==void 0?m[A]:i.getParameter(A)}function Ee(A,ie){m[A]!==ie&&(i.pixelStorei(A,ie),m[A]=ie)}function T(A){it.equals(A)===!1&&(i.scissor(A.x,A.y,A.z,A.w),it.copy(A))}function F(A){We.equals(A)===!1&&(i.viewport(A.x,A.y,A.z,A.w),We.copy(A))}function Y(A,ie){let X=l.get(ie);X===void 0&&(X=new WeakMap,l.set(ie,X));let se=X.get(A);se===void 0&&(se=i.getUniformBlockIndex(ie,A.name),X.set(A,se))}function te(A,ie){const se=l.get(ie).get(A);c.get(ie)!==se&&(i.uniformBlockBinding(ie,se,A.__bindingPointIndex),c.set(ie,se))}function fe(){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),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},m={},de=null,_e={},h={},d=new WeakMap,x=[],y=null,_=!1,f=null,w=null,C=null,M=null,R=null,E=null,P=null,g=new Be(0,0,0),b=0,U=!1,I=null,B=null,J=null,ee=null,V=null,it.set(0,0,i.canvas.width,i.canvas.height),We.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ae,disable:Pe,bindFramebuffer:De,drawBuffers:Re,useProgram:rt,setBlending:Xe,setMaterial:ze,setFlipSided:ot,setCullFace:ut,setLineWidth:pt,setPolygonOffset:mt,setScissorTest:st,activeTexture:lt,bindTexture:L,unbindTexture:St,compressedTexImage2D:He,compressedTexImage3D:S,texImage2D:K,texImage3D:Q,pixelStorei:Ee,getParameter:he,updateUBOMapping:Y,uniformBlockBinding:te,texStorage2D:oe,texStorage3D:ce,texSubImage2D:p,texSubImage3D:O,compressedTexSubImage2D:H,compressedTexSubImage3D:q,scissor:T,viewport:F,reset:fe}}function Om(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Ce,u=new WeakMap,m=new Set;let h;const d=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(S,p){return x?new OffscreenCanvas(S,p):Or("canvas")}function _(S,p,O){let H=1;const q=He(S);if((q.width>O||q.height>O)&&(H=O/Math.max(q.width,q.height)),H<1)if(typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&S instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&S instanceof ImageBitmap||typeof VideoFrame<"u"&&S instanceof VideoFrame){const oe=Math.floor(H*q.width),ce=Math.floor(H*q.height);h===void 0&&(h=y(oe,ce));const K=p?y(oe,ce):h;return K.width=oe,K.height=ce,K.getContext("2d").drawImage(S,0,0,oe,ce),we("WebGLRenderer: Texture has been resized from ("+q.width+"x"+q.height+") to ("+oe+"x"+ce+")."),K}else return"data"in S&&we("WebGLRenderer: Image in DataTexture is too big ("+q.width+"x"+q.height+")."),S;return S}function f(S){return S.generateMipmaps}function w(S){i.generateMipmap(S)}function C(S){return S.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:S.isWebGL3DRenderTarget?i.TEXTURE_3D:S.isWebGLArrayRenderTarget||S.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(S,p,O,H,q,oe=!1){if(S!==null){if(i[S]!==void 0)return i[S];we("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+S+"'")}let ce;H&&(ce=e.get("EXT_texture_norm16"),ce||we("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let K=p;if(p===i.RED&&(O===i.FLOAT&&(K=i.R32F),O===i.HALF_FLOAT&&(K=i.R16F),O===i.UNSIGNED_BYTE&&(K=i.R8),O===i.UNSIGNED_SHORT&&ce&&(K=ce.R16_EXT),O===i.SHORT&&ce&&(K=ce.R16_SNORM_EXT)),p===i.RED_INTEGER&&(O===i.UNSIGNED_BYTE&&(K=i.R8UI),O===i.UNSIGNED_SHORT&&(K=i.R16UI),O===i.UNSIGNED_INT&&(K=i.R32UI),O===i.BYTE&&(K=i.R8I),O===i.SHORT&&(K=i.R16I),O===i.INT&&(K=i.R32I)),p===i.RG&&(O===i.FLOAT&&(K=i.RG32F),O===i.HALF_FLOAT&&(K=i.RG16F),O===i.UNSIGNED_BYTE&&(K=i.RG8),O===i.UNSIGNED_SHORT&&ce&&(K=ce.RG16_EXT),O===i.SHORT&&ce&&(K=ce.RG16_SNORM_EXT)),p===i.RG_INTEGER&&(O===i.UNSIGNED_BYTE&&(K=i.RG8UI),O===i.UNSIGNED_SHORT&&(K=i.RG16UI),O===i.UNSIGNED_INT&&(K=i.RG32UI),O===i.BYTE&&(K=i.RG8I),O===i.SHORT&&(K=i.RG16I),O===i.INT&&(K=i.RG32I)),p===i.RGB_INTEGER&&(O===i.UNSIGNED_BYTE&&(K=i.RGB8UI),O===i.UNSIGNED_SHORT&&(K=i.RGB16UI),O===i.UNSIGNED_INT&&(K=i.RGB32UI),O===i.BYTE&&(K=i.RGB8I),O===i.SHORT&&(K=i.RGB16I),O===i.INT&&(K=i.RGB32I)),p===i.RGBA_INTEGER&&(O===i.UNSIGNED_BYTE&&(K=i.RGBA8UI),O===i.UNSIGNED_SHORT&&(K=i.RGBA16UI),O===i.UNSIGNED_INT&&(K=i.RGBA32UI),O===i.BYTE&&(K=i.RGBA8I),O===i.SHORT&&(K=i.RGBA16I),O===i.INT&&(K=i.RGBA32I)),p===i.RGB&&(O===i.UNSIGNED_SHORT&&ce&&(K=ce.RGB16_EXT),O===i.SHORT&&ce&&(K=ce.RGB16_SNORM_EXT),O===i.UNSIGNED_INT_5_9_9_9_REV&&(K=i.RGB9_E5),O===i.UNSIGNED_INT_10F_11F_11F_REV&&(K=i.R11F_G11F_B10F)),p===i.RGBA){const Q=oe?Nr:Ve.getTransfer(q);O===i.FLOAT&&(K=i.RGBA32F),O===i.HALF_FLOAT&&(K=i.RGBA16F),O===i.UNSIGNED_BYTE&&(K=Q===Ze?i.SRGB8_ALPHA8:i.RGBA8),O===i.UNSIGNED_SHORT&&ce&&(K=ce.RGBA16_EXT),O===i.SHORT&&ce&&(K=ce.RGBA16_SNORM_EXT),O===i.UNSIGNED_SHORT_4_4_4_4&&(K=i.RGBA4),O===i.UNSIGNED_SHORT_5_5_5_1&&(K=i.RGB5_A1)}return(K===i.R16F||K===i.R32F||K===i.RG16F||K===i.RG32F||K===i.RGBA16F||K===i.RGBA32F)&&e.get("EXT_color_buffer_float"),K}function R(S,p){let O;return S?p===null||p===on||p===Xi?O=i.DEPTH24_STENCIL8:p===nn?O=i.DEPTH32F_STENCIL8:p===Wi&&(O=i.DEPTH24_STENCIL8,we("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):p===null||p===on||p===Xi?O=i.DEPTH_COMPONENT24:p===nn?O=i.DEPTH_COMPONENT32F:p===Wi&&(O=i.DEPTH_COMPONENT16),O}function E(S,p){return f(S)===!0||S.isFramebufferTexture&&S.minFilter!==yt&&S.minFilter!==At?Math.log2(Math.max(p.width,p.height))+1:S.mipmaps!==void 0&&S.mipmaps.length>0?S.mipmaps.length:S.isCompressedTexture&&Array.isArray(S.image)?p.mipmaps.length:1}function P(S){const p=S.target;p.removeEventListener("dispose",P),b(p),p.isVideoTexture&&u.delete(p),p.isHTMLTexture&&m.delete(p)}function g(S){const p=S.target;p.removeEventListener("dispose",g),I(p)}function b(S){const p=n.get(S);if(p.__webglInit===void 0)return;const O=S.source,H=d.get(O);if(H){const q=H[p.__cacheKey];q.usedTimes--,q.usedTimes===0&&U(S),Object.keys(H).length===0&&d.delete(O)}n.remove(S)}function U(S){const p=n.get(S);i.deleteTexture(p.__webglTexture);const O=S.source,H=d.get(O);delete H[p.__cacheKey],a.memory.textures--}function I(S){const p=n.get(S);if(S.depthTexture&&(S.depthTexture.dispose(),n.remove(S.depthTexture)),S.isWebGLCubeRenderTarget)for(let H=0;H<6;H++){if(Array.isArray(p.__webglFramebuffer[H]))for(let q=0;q<p.__webglFramebuffer[H].length;q++)i.deleteFramebuffer(p.__webglFramebuffer[H][q]);else i.deleteFramebuffer(p.__webglFramebuffer[H]);p.__webglDepthbuffer&&i.deleteRenderbuffer(p.__webglDepthbuffer[H])}else{if(Array.isArray(p.__webglFramebuffer))for(let H=0;H<p.__webglFramebuffer.length;H++)i.deleteFramebuffer(p.__webglFramebuffer[H]);else i.deleteFramebuffer(p.__webglFramebuffer);if(p.__webglDepthbuffer&&i.deleteRenderbuffer(p.__webglDepthbuffer),p.__webglMultisampledFramebuffer&&i.deleteFramebuffer(p.__webglMultisampledFramebuffer),p.__webglColorRenderbuffer)for(let H=0;H<p.__webglColorRenderbuffer.length;H++)p.__webglColorRenderbuffer[H]&&i.deleteRenderbuffer(p.__webglColorRenderbuffer[H]);p.__webglDepthRenderbuffer&&i.deleteRenderbuffer(p.__webglDepthRenderbuffer)}const O=S.textures;for(let H=0,q=O.length;H<q;H++){const oe=n.get(O[H]);oe.__webglTexture&&(i.deleteTexture(oe.__webglTexture),a.memory.textures--),n.remove(O[H])}n.remove(S)}let B=0;function J(){B=0}function ee(){return B}function V(S){B=S}function Z(){const S=B;return S>=r.maxTextures&&we("WebGLTextures: Trying to use "+S+" texture units while this GPU supports only "+r.maxTextures),B+=1,S}function W(S){const p=[];return p.push(S.wrapS),p.push(S.wrapT),p.push(S.wrapR||0),p.push(S.magFilter),p.push(S.minFilter),p.push(S.anisotropy),p.push(S.internalFormat),p.push(S.format),p.push(S.type),p.push(S.generateMipmaps),p.push(S.premultiplyAlpha),p.push(S.flipY),p.push(S.unpackAlignment),p.push(S.colorSpace),p.join()}function ne(S,p){const O=n.get(S);if(S.isVideoTexture&&L(S),S.isRenderTargetTexture===!1&&S.isExternalTexture!==!0&&S.version>0&&O.__version!==S.version){const H=S.image;if(H===null)we("WebGLRenderer: Texture marked for update but no image data found.");else if(H.complete===!1)we("WebGLRenderer: Texture marked for update but image is incomplete");else{Pe(O,S,p);return}}else S.isExternalTexture&&(O.__webglTexture=S.sourceTexture?S.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,O.__webglTexture,i.TEXTURE0+p)}function re(S,p){const O=n.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&O.__version!==S.version){Pe(O,S,p);return}else S.isExternalTexture&&(O.__webglTexture=S.sourceTexture?S.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,O.__webglTexture,i.TEXTURE0+p)}function de(S,p){const O=n.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&O.__version!==S.version){Pe(O,S,p);return}t.bindTexture(i.TEXTURE_3D,O.__webglTexture,i.TEXTURE0+p)}function _e(S,p){const O=n.get(S);if(S.isCubeDepthTexture!==!0&&S.version>0&&O.__version!==S.version){De(O,S,p);return}t.bindTexture(i.TEXTURE_CUBE_MAP,O.__webglTexture,i.TEXTURE0+p)}const ye={[Ys]:i.REPEAT,[mn]:i.CLAMP_TO_EDGE,[qs]:i.MIRRORED_REPEAT},ke={[yt]:i.NEAREST,[Yc]:i.NEAREST_MIPMAP_NEAREST,[Ji]:i.NEAREST_MIPMAP_LINEAR,[At]:i.LINEAR,[ns]:i.LINEAR_MIPMAP_NEAREST,[qn]:i.LINEAR_MIPMAP_LINEAR},it={[Zc]:i.NEVER,[eh]:i.ALWAYS,[$c]:i.LESS,[Oa]:i.LEQUAL,[Jc]:i.EQUAL,[Ba]:i.GEQUAL,[Qc]:i.GREATER,[jc]:i.NOTEQUAL};function We(S,p){if(p.type===nn&&e.has("OES_texture_float_linear")===!1&&(p.magFilter===At||p.magFilter===ns||p.magFilter===Ji||p.magFilter===qn||p.minFilter===At||p.minFilter===ns||p.minFilter===Ji||p.minFilter===qn)&&we("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(S,i.TEXTURE_WRAP_S,ye[p.wrapS]),i.texParameteri(S,i.TEXTURE_WRAP_T,ye[p.wrapT]),(S===i.TEXTURE_3D||S===i.TEXTURE_2D_ARRAY)&&i.texParameteri(S,i.TEXTURE_WRAP_R,ye[p.wrapR]),i.texParameteri(S,i.TEXTURE_MAG_FILTER,ke[p.magFilter]),i.texParameteri(S,i.TEXTURE_MIN_FILTER,ke[p.minFilter]),p.compareFunction&&(i.texParameteri(S,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(S,i.TEXTURE_COMPARE_FUNC,it[p.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(p.magFilter===yt||p.minFilter!==Ji&&p.minFilter!==qn||p.type===nn&&e.has("OES_texture_float_linear")===!1)return;if(p.anisotropy>1||n.get(p).__currentAnisotropy){const O=e.get("EXT_texture_filter_anisotropic");i.texParameterf(S,O.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(p.anisotropy,r.getMaxAnisotropy())),n.get(p).__currentAnisotropy=p.anisotropy}}}function j(S,p){let O=!1;S.__webglInit===void 0&&(S.__webglInit=!0,p.addEventListener("dispose",P));const H=p.source;let q=d.get(H);q===void 0&&(q={},d.set(H,q));const oe=W(p);if(oe!==S.__cacheKey){q[oe]===void 0&&(q[oe]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,O=!0),q[oe].usedTimes++;const ce=q[S.__cacheKey];ce!==void 0&&(q[S.__cacheKey].usedTimes--,ce.usedTimes===0&&U(p)),S.__cacheKey=oe,S.__webglTexture=q[oe].texture}return O}function ue(S,p,O){return Math.floor(Math.floor(S/O)/p)}function ae(S,p,O,H){const oe=S.updateRanges;if(oe.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,p.width,p.height,O,H,p.data);else{oe.sort((Ee,T)=>Ee.start-T.start);let ce=0;for(let Ee=1;Ee<oe.length;Ee++){const T=oe[ce],F=oe[Ee],Y=T.start+T.count,te=ue(F.start,p.width,4),fe=ue(T.start,p.width,4);F.start<=Y+1&&te===fe&&ue(F.start+F.count-1,p.width,4)===te?T.count=Math.max(T.count,F.start+F.count-T.start):(++ce,oe[ce]=F)}oe.length=ce+1;const K=t.getParameter(i.UNPACK_ROW_LENGTH),Q=t.getParameter(i.UNPACK_SKIP_PIXELS),he=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,p.width);for(let Ee=0,T=oe.length;Ee<T;Ee++){const F=oe[Ee],Y=Math.floor(F.start/4),te=Math.ceil(F.count/4),fe=Y%p.width,A=Math.floor(Y/p.width),ie=te,X=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,fe),t.pixelStorei(i.UNPACK_SKIP_ROWS,A),t.texSubImage2D(i.TEXTURE_2D,0,fe,A,ie,X,O,H,p.data)}S.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,K),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Q),t.pixelStorei(i.UNPACK_SKIP_ROWS,he)}}function Pe(S,p,O){let H=i.TEXTURE_2D;(p.isDataArrayTexture||p.isCompressedArrayTexture)&&(H=i.TEXTURE_2D_ARRAY),p.isData3DTexture&&(H=i.TEXTURE_3D);const q=j(S,p),oe=p.source;t.bindTexture(H,S.__webglTexture,i.TEXTURE0+O);const ce=n.get(oe);if(oe.version!==ce.__version||q===!0){if(t.activeTexture(i.TEXTURE0+O),(typeof ImageBitmap<"u"&&p.image instanceof ImageBitmap)===!1){const X=Ve.getPrimaries(Ve.workingColorSpace),se=p.colorSpace===Ln?null:Ve.getPrimaries(p.colorSpace),le=p.colorSpace===Ln||X===se?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,p.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,le)}t.pixelStorei(i.UNPACK_ALIGNMENT,p.unpackAlignment);let Q=_(p.image,!1,r.maxTextureSize);Q=St(p,Q);const he=s.convert(p.format,p.colorSpace),Ee=s.convert(p.type);let T=M(p.internalFormat,he,Ee,p.normalized,p.colorSpace,p.isVideoTexture);We(H,p);let F;const Y=p.mipmaps,te=p.isVideoTexture!==!0,fe=ce.__version===void 0||q===!0,A=oe.dataReady,ie=E(p,Q);if(p.isDepthTexture)T=R(p.format===Kn,p.type),fe&&(te?t.texStorage2D(i.TEXTURE_2D,1,T,Q.width,Q.height):t.texImage2D(i.TEXTURE_2D,0,T,Q.width,Q.height,0,he,Ee,null));else if(p.isDataTexture)if(Y.length>0){te&&fe&&t.texStorage2D(i.TEXTURE_2D,ie,T,Y[0].width,Y[0].height);for(let X=0,se=Y.length;X<se;X++)F=Y[X],te?A&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,F.width,F.height,he,Ee,F.data):t.texImage2D(i.TEXTURE_2D,X,T,F.width,F.height,0,he,Ee,F.data);p.generateMipmaps=!1}else te?(fe&&t.texStorage2D(i.TEXTURE_2D,ie,T,Q.width,Q.height),A&&ae(p,Q,he,Ee)):t.texImage2D(i.TEXTURE_2D,0,T,Q.width,Q.height,0,he,Ee,Q.data);else if(p.isCompressedTexture)if(p.isCompressedArrayTexture){te&&fe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ie,T,Y[0].width,Y[0].height,Q.depth);for(let X=0,se=Y.length;X<se;X++)if(F=Y[X],p.format!==Zt)if(he!==null)if(te){if(A)if(p.layerUpdates.size>0){const le=zo(F.width,F.height,p.format,p.type);for(const $ of p.layerUpdates){const ve=F.data.subarray($*le/F.data.BYTES_PER_ELEMENT,($+1)*le/F.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,$,F.width,F.height,1,he,ve)}p.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,0,F.width,F.height,Q.depth,he,F.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,X,T,F.width,F.height,Q.depth,0,F.data,0,0);else we("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else te?A&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,X,0,0,0,F.width,F.height,Q.depth,he,Ee,F.data):t.texImage3D(i.TEXTURE_2D_ARRAY,X,T,F.width,F.height,Q.depth,0,he,Ee,F.data)}else{te&&fe&&t.texStorage2D(i.TEXTURE_2D,ie,T,Y[0].width,Y[0].height);for(let X=0,se=Y.length;X<se;X++)F=Y[X],p.format!==Zt?he!==null?te?A&&t.compressedTexSubImage2D(i.TEXTURE_2D,X,0,0,F.width,F.height,he,F.data):t.compressedTexImage2D(i.TEXTURE_2D,X,T,F.width,F.height,0,F.data):we("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):te?A&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,F.width,F.height,he,Ee,F.data):t.texImage2D(i.TEXTURE_2D,X,T,F.width,F.height,0,he,Ee,F.data)}else if(p.isDataArrayTexture)if(te){if(fe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ie,T,Q.width,Q.height,Q.depth),A)if(p.layerUpdates.size>0){const X=zo(Q.width,Q.height,p.format,p.type);for(const se of p.layerUpdates){const le=Q.data.subarray(se*X/Q.data.BYTES_PER_ELEMENT,(se+1)*X/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,se,Q.width,Q.height,1,he,Ee,le)}p.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,he,Ee,Q.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,T,Q.width,Q.height,Q.depth,0,he,Ee,Q.data);else if(p.isData3DTexture)te?(fe&&t.texStorage3D(i.TEXTURE_3D,ie,T,Q.width,Q.height,Q.depth),A&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,he,Ee,Q.data)):t.texImage3D(i.TEXTURE_3D,0,T,Q.width,Q.height,Q.depth,0,he,Ee,Q.data);else if(p.isFramebufferTexture){if(fe)if(te)t.texStorage2D(i.TEXTURE_2D,ie,T,Q.width,Q.height);else{let X=Q.width,se=Q.height;for(let le=0;le<ie;le++)t.texImage2D(i.TEXTURE_2D,le,T,X,se,0,he,Ee,null),X>>=1,se>>=1}}else if(p.isHTMLTexture){if("texElementImage2D"in i){const X=i.canvas;if(X.hasAttribute("layoutsubtree")||X.setAttribute("layoutsubtree","true"),Q.parentNode!==X){X.appendChild(Q),m.add(p),X.onpaint=se=>{const le=se.changedElements;for(const $ of m)le.includes($.image)&&($.needsUpdate=!0)},X.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Q);else{const le=i.RGBA,$=i.RGBA,ve=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,le,$,ve,Q)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Y.length>0){if(te&&fe){const X=He(Y[0]);t.texStorage2D(i.TEXTURE_2D,ie,T,X.width,X.height)}for(let X=0,se=Y.length;X<se;X++)F=Y[X],te?A&&t.texSubImage2D(i.TEXTURE_2D,X,0,0,he,Ee,F):t.texImage2D(i.TEXTURE_2D,X,T,he,Ee,F);p.generateMipmaps=!1}else if(te){if(fe){const X=He(Q);t.texStorage2D(i.TEXTURE_2D,ie,T,X.width,X.height)}A&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,he,Ee,Q)}else t.texImage2D(i.TEXTURE_2D,0,T,he,Ee,Q);f(p)&&w(H),ce.__version=oe.version,p.onUpdate&&p.onUpdate(p)}S.__version=p.version}function De(S,p,O){if(p.image.length!==6)return;const H=j(S,p),q=p.source;t.bindTexture(i.TEXTURE_CUBE_MAP,S.__webglTexture,i.TEXTURE0+O);const oe=n.get(q);if(q.version!==oe.__version||H===!0){t.activeTexture(i.TEXTURE0+O);const ce=Ve.getPrimaries(Ve.workingColorSpace),K=p.colorSpace===Ln?null:Ve.getPrimaries(p.colorSpace),Q=p.colorSpace===Ln||ce===K?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,p.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,p.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Q);const he=p.isCompressedTexture||p.image[0].isCompressedTexture,Ee=p.image[0]&&p.image[0].isDataTexture,T=[];for(let $=0;$<6;$++)!he&&!Ee?T[$]=_(p.image[$],!0,r.maxCubemapSize):T[$]=Ee?p.image[$].image:p.image[$],T[$]=St(p,T[$]);const F=T[0],Y=s.convert(p.format,p.colorSpace),te=s.convert(p.type),fe=M(p.internalFormat,Y,te,p.normalized,p.colorSpace),A=p.isVideoTexture!==!0,ie=oe.__version===void 0||H===!0,X=q.dataReady;let se=E(p,F);We(i.TEXTURE_CUBE_MAP,p);let le;if(he){A&&ie&&t.texStorage2D(i.TEXTURE_CUBE_MAP,se,fe,F.width,F.height);for(let $=0;$<6;$++){le=T[$].mipmaps;for(let ve=0;ve<le.length;ve++){const pe=le[ve];p.format!==Zt?Y!==null?A?X&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,0,0,pe.width,pe.height,Y,pe.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,fe,pe.width,pe.height,0,pe.data):we("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,0,0,pe.width,pe.height,Y,te,pe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve,fe,pe.width,pe.height,0,Y,te,pe.data)}}}else{if(le=p.mipmaps,A&&ie){le.length>0&&se++;const $=He(T[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,se,fe,$.width,$.height)}for(let $=0;$<6;$++)if(Ee){A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,T[$].width,T[$].height,Y,te,T[$].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,fe,T[$].width,T[$].height,0,Y,te,T[$].data);for(let ve=0;ve<le.length;ve++){const Ke=le[ve].image[$].image;A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,0,0,Ke.width,Ke.height,Y,te,Ke.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,fe,Ke.width,Ke.height,0,Y,te,Ke.data)}}else{A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,Y,te,T[$]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,fe,Y,te,T[$]);for(let ve=0;ve<le.length;ve++){const pe=le[ve];A?X&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,0,0,Y,te,pe.image[$]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,ve+1,fe,Y,te,pe.image[$])}}}f(p)&&w(i.TEXTURE_CUBE_MAP),oe.__version=q.version,p.onUpdate&&p.onUpdate(p)}S.__version=p.version}function Re(S,p,O,H,q,oe){const ce=s.convert(O.format,O.colorSpace),K=s.convert(O.type),Q=M(O.internalFormat,ce,K,O.normalized,O.colorSpace),he=n.get(p),Ee=n.get(O);if(Ee.__renderTarget=p,!he.__hasExternalTextures){const T=Math.max(1,p.width>>oe),F=Math.max(1,p.height>>oe);q===i.TEXTURE_3D||q===i.TEXTURE_2D_ARRAY?t.texImage3D(q,oe,Q,T,F,p.depth,0,ce,K,null):t.texImage2D(q,oe,Q,T,F,0,ce,K,null)}t.bindFramebuffer(i.FRAMEBUFFER,S),lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,H,q,Ee.__webglTexture,0,st(p)):(q===i.TEXTURE_2D||q>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&q<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,H,q,Ee.__webglTexture,oe),t.bindFramebuffer(i.FRAMEBUFFER,null)}function rt(S,p,O){if(i.bindRenderbuffer(i.RENDERBUFFER,S),p.depthBuffer){const H=p.depthTexture,q=H&&H.isDepthTexture?H.type:null,oe=R(p.stencilBuffer,q),ce=p.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;lt(p)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,st(p),oe,p.width,p.height):O?i.renderbufferStorageMultisample(i.RENDERBUFFER,st(p),oe,p.width,p.height):i.renderbufferStorage(i.RENDERBUFFER,oe,p.width,p.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,ce,i.RENDERBUFFER,S)}else{const H=p.textures;for(let q=0;q<H.length;q++){const oe=H[q],ce=s.convert(oe.format,oe.colorSpace),K=s.convert(oe.type),Q=M(oe.internalFormat,ce,K,oe.normalized,oe.colorSpace);lt(p)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,st(p),Q,p.width,p.height):O?i.renderbufferStorageMultisample(i.RENDERBUFFER,st(p),Q,p.width,p.height):i.renderbufferStorage(i.RENDERBUFFER,Q,p.width,p.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ne(S,p,O){const H=p.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,S),!(p.depthTexture&&p.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const q=n.get(p.depthTexture);if(q.__renderTarget=p,(!q.__webglTexture||p.depthTexture.image.width!==p.width||p.depthTexture.image.height!==p.height)&&(p.depthTexture.image.width=p.width,p.depthTexture.image.height=p.height,p.depthTexture.needsUpdate=!0),H){if(q.__webglInit===void 0&&(q.__webglInit=!0,p.depthTexture.addEventListener("dispose",P)),q.__webglTexture===void 0){q.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture),We(i.TEXTURE_CUBE_MAP,p.depthTexture);const he=s.convert(p.depthTexture.format),Ee=s.convert(p.depthTexture.type);let T;p.depthTexture.format===vn?T=i.DEPTH_COMPONENT24:p.depthTexture.format===Kn&&(T=i.DEPTH24_STENCIL8);for(let F=0;F<6;F++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+F,0,T,p.width,p.height,0,he,Ee,null)}}else ne(p.depthTexture,0);const oe=q.__webglTexture,ce=st(p),K=H?i.TEXTURE_CUBE_MAP_POSITIVE_X+O:i.TEXTURE_2D,Q=p.depthTexture.format===Kn?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(p.depthTexture.format===vn)lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Q,K,oe,0,ce):i.framebufferTexture2D(i.FRAMEBUFFER,Q,K,oe,0);else if(p.depthTexture.format===Kn)lt(p)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Q,K,oe,0,ce):i.framebufferTexture2D(i.FRAMEBUFFER,Q,K,oe,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function qe(S){const p=n.get(S),O=S.isWebGLCubeRenderTarget===!0;if(p.__boundDepthTexture!==S.depthTexture){const H=S.depthTexture;if(p.__depthDisposeCallback&&p.__depthDisposeCallback(),H){const q=()=>{delete p.__boundDepthTexture,delete p.__depthDisposeCallback,H.removeEventListener("dispose",q)};H.addEventListener("dispose",q),p.__depthDisposeCallback=q}p.__boundDepthTexture=H}if(S.depthTexture&&!p.__autoAllocateDepthBuffer)if(O)for(let H=0;H<6;H++)Ne(p.__webglFramebuffer[H],S,H);else{const H=S.texture.mipmaps;H&&H.length>0?Ne(p.__webglFramebuffer[0],S,0):Ne(p.__webglFramebuffer,S,0)}else if(O){p.__webglDepthbuffer=[];for(let H=0;H<6;H++)if(t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer[H]),p.__webglDepthbuffer[H]===void 0)p.__webglDepthbuffer[H]=i.createRenderbuffer(),rt(p.__webglDepthbuffer[H],S,!1);else{const q=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=p.__webglDepthbuffer[H];i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,q,i.RENDERBUFFER,oe)}}else{const H=S.texture.mipmaps;if(H&&H.length>0?t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,p.__webglFramebuffer),p.__webglDepthbuffer===void 0)p.__webglDepthbuffer=i.createRenderbuffer(),rt(p.__webglDepthbuffer,S,!1);else{const q=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,oe=p.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,oe),i.framebufferRenderbuffer(i.FRAMEBUFFER,q,i.RENDERBUFFER,oe)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Xe(S,p,O){const H=n.get(S);p!==void 0&&Re(H.__webglFramebuffer,S,S.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),O!==void 0&&qe(S)}function ze(S){const p=S.texture,O=n.get(S),H=n.get(p);S.addEventListener("dispose",g);const q=S.textures,oe=S.isWebGLCubeRenderTarget===!0,ce=q.length>1;if(ce||(H.__webglTexture===void 0&&(H.__webglTexture=i.createTexture()),H.__version=p.version,a.memory.textures++),oe){O.__webglFramebuffer=[];for(let K=0;K<6;K++)if(p.mipmaps&&p.mipmaps.length>0){O.__webglFramebuffer[K]=[];for(let Q=0;Q<p.mipmaps.length;Q++)O.__webglFramebuffer[K][Q]=i.createFramebuffer()}else O.__webglFramebuffer[K]=i.createFramebuffer()}else{if(p.mipmaps&&p.mipmaps.length>0){O.__webglFramebuffer=[];for(let K=0;K<p.mipmaps.length;K++)O.__webglFramebuffer[K]=i.createFramebuffer()}else O.__webglFramebuffer=i.createFramebuffer();if(ce)for(let K=0,Q=q.length;K<Q;K++){const he=n.get(q[K]);he.__webglTexture===void 0&&(he.__webglTexture=i.createTexture(),a.memory.textures++)}if(S.samples>0&<(S)===!1){O.__webglMultisampledFramebuffer=i.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let K=0;K<q.length;K++){const Q=q[K];O.__webglColorRenderbuffer[K]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,O.__webglColorRenderbuffer[K]);const he=s.convert(Q.format,Q.colorSpace),Ee=s.convert(Q.type),T=M(Q.internalFormat,he,Ee,Q.normalized,Q.colorSpace,S.isXRRenderTarget===!0),F=st(S);i.renderbufferStorageMultisample(i.RENDERBUFFER,F,T,S.width,S.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+K,i.RENDERBUFFER,O.__webglColorRenderbuffer[K])}i.bindRenderbuffer(i.RENDERBUFFER,null),S.depthBuffer&&(O.__webglDepthRenderbuffer=i.createRenderbuffer(),rt(O.__webglDepthRenderbuffer,S,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(oe){t.bindTexture(i.TEXTURE_CUBE_MAP,H.__webglTexture),We(i.TEXTURE_CUBE_MAP,p);for(let K=0;K<6;K++)if(p.mipmaps&&p.mipmaps.length>0)for(let Q=0;Q<p.mipmaps.length;Q++)Re(O.__webglFramebuffer[K][Q],S,p,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+K,Q);else Re(O.__webglFramebuffer[K],S,p,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+K,0);f(p)&&w(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ce){for(let K=0,Q=q.length;K<Q;K++){const he=q[K],Ee=n.get(he);let T=i.TEXTURE_2D;(S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(T=S.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(T,Ee.__webglTexture),We(T,he),Re(O.__webglFramebuffer,S,he,i.COLOR_ATTACHMENT0+K,T,0),f(he)&&w(T)}t.unbindTexture()}else{let K=i.TEXTURE_2D;if((S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(K=S.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(K,H.__webglTexture),We(K,p),p.mipmaps&&p.mipmaps.length>0)for(let Q=0;Q<p.mipmaps.length;Q++)Re(O.__webglFramebuffer[Q],S,p,i.COLOR_ATTACHMENT0,K,Q);else Re(O.__webglFramebuffer,S,p,i.COLOR_ATTACHMENT0,K,0);f(p)&&w(K),t.unbindTexture()}S.depthBuffer&&qe(S)}function ot(S){const p=S.textures;for(let O=0,H=p.length;O<H;O++){const q=p[O];if(f(q)){const oe=C(S),ce=n.get(q).__webglTexture;t.bindTexture(oe,ce),w(oe),t.unbindTexture()}}}const ut=[],pt=[];function mt(S){if(S.samples>0){if(lt(S)===!1){const p=S.textures,O=S.width,H=S.height;let q=i.COLOR_BUFFER_BIT;const oe=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ce=n.get(S),K=p.length>1;if(K)for(let he=0;he<p.length;he++)t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,ce.__webglMultisampledFramebuffer);const Q=S.texture.mipmaps;Q&&Q.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ce.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ce.__webglFramebuffer);for(let he=0;he<p.length;he++){if(S.resolveDepthBuffer&&(S.depthBuffer&&(q|=i.DEPTH_BUFFER_BIT),S.stencilBuffer&&S.resolveStencilBuffer&&(q|=i.STENCIL_BUFFER_BIT)),K){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,ce.__webglColorRenderbuffer[he]);const Ee=n.get(p[he]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Ee,0)}i.blitFramebuffer(0,0,O,H,0,0,O,H,q,i.NEAREST),c===!0&&(ut.length=0,pt.length=0,ut.push(i.COLOR_ATTACHMENT0+he),S.depthBuffer&&S.resolveDepthBuffer===!1&&(ut.push(oe),pt.push(oe),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,pt)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ut))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),K)for(let he=0;he<p.length;he++){t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.RENDERBUFFER,ce.__webglColorRenderbuffer[he]);const Ee=n.get(p[he]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+he,i.TEXTURE_2D,Ee,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ce.__webglMultisampledFramebuffer)}else if(S.depthBuffer&&S.resolveDepthBuffer===!1&&c){const p=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[p])}}}function st(S){return Math.min(r.maxSamples,S.samples)}function lt(S){const p=n.get(S);return S.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&p.__useRenderToTexture!==!1}function L(S){const p=a.render.frame;u.get(S)!==p&&(u.set(S,p),S.update())}function St(S,p){const O=S.colorSpace,H=S.format,q=S.type;return S.isCompressedTexture===!0||S.isVideoTexture===!0||O!==Ur&&O!==Ln&&(Ve.getTransfer(O)===Ze?(H!==Zt||q!==kt)&&we("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",O)),p}function He(S){return typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement?(l.width=S.naturalWidth||S.width,l.height=S.naturalHeight||S.height):typeof VideoFrame<"u"&&S instanceof VideoFrame?(l.width=S.displayWidth,l.height=S.displayHeight):(l.width=S.width,l.height=S.height),l}this.allocateTextureUnit=Z,this.resetTextureUnits=J,this.getTextureUnits=ee,this.setTextureUnits=V,this.setTexture2D=ne,this.setTexture2DArray=re,this.setTexture3D=de,this.setTextureCube=_e,this.rebindTextures=Xe,this.setupRenderTarget=ze,this.updateRenderTargetMipmap=ot,this.updateMultisampleRenderTarget=mt,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=Re,this.useMultisampledRTT=lt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Bm(i,e){function t(n,r=Ln){let s;const a=Ve.getTransfer(r);if(n===kt)return i.UNSIGNED_BYTE;if(n===La)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ia)return i.UNSIGNED_SHORT_5_5_5_1;if(n===wl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Cl)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Al)return i.BYTE;if(n===Rl)return i.SHORT;if(n===Wi)return i.UNSIGNED_SHORT;if(n===Da)return i.INT;if(n===on)return i.UNSIGNED_INT;if(n===nn)return i.FLOAT;if(n===xn)return i.HALF_FLOAT;if(n===Pl)return i.ALPHA;if(n===Dl)return i.RGB;if(n===Zt)return i.RGBA;if(n===vn)return i.DEPTH_COMPONENT;if(n===Kn)return i.DEPTH_STENCIL;if(n===Ll)return i.RED;if(n===Ua)return i.RED_INTEGER;if(n===Jn)return i.RG;if(n===Na)return i.RG_INTEGER;if(n===Fa)return i.RGBA_INTEGER;if(n===Ar||n===Rr||n===wr||n===Cr)if(a===Ze)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ar)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Rr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===wr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ar)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Rr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===wr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Cr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ks||n===Zs||n===$s||n===Js)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ks)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Zs)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===$s)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Js)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Qs||n===js||n===ea||n===ta||n===na||n===Lr||n===ia)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Qs||n===js)return a===Ze?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ea)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ta)return s.COMPRESSED_R11_EAC;if(n===na)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Lr)return s.COMPRESSED_RG11_EAC;if(n===ia)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ra||n===sa||n===aa||n===oa||n===la||n===ca||n===ha||n===ua||n===fa||n===da||n===pa||n===ma||n===_a||n===ga)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===ra)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===sa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===aa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===oa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===la)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ca)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ha)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ua)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===fa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===da)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===pa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ma)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===_a)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ga)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===xa||n===va||n===Ma)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===xa)return a===Ze?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===va)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ma)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Sa||n===ya||n===Ir||n===Ea)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Sa)return s.COMPRESSED_RED_RGTC1_EXT;if(n===ya)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ir)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ea)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Xi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const zm=`
|
|
4085
4085
|
void main() {
|
|
4086
4086
|
|
|
4087
4087
|
gl_Position = vec4( position, 1.0 );
|
|
4088
4088
|
|
|
4089
|
-
}`,
|
|
4089
|
+
}`,Gm=`
|
|
4090
4090
|
uniform sampler2DArray depthColor;
|
|
4091
4091
|
uniform float depthWidth;
|
|
4092
4092
|
uniform float depthHeight;
|
|
@@ -4105,4 +4105,4 @@ void main() {
|
|
|
4105
4105
|
|
|
4106
4106
|
}
|
|
4107
4107
|
|
|
4108
|
-
}`;class Hm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Wl(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ln({vertexShader:Gm,fragmentShader:Vm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Mn(new Yr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class km extends Gn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,u=null,m=null,h=null,d=null,x=null;const y=typeof XRWebGLBinding<"u",g=new Hm,f={},w=t.getContextAttributes();let C=null,M=null;const R=[],E=[],P=new Ce;let _=null;const b=new Ht;b.viewport=new ht;const U=new Ht;U.viewport=new ht;const I=[b,U],B=new $h;let J=null,ee=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ue=R[j];return ue===void 0&&(ue=new cs,R[j]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(j){let ue=R[j];return ue===void 0&&(ue=new cs,R[j]=ue),ue.getGripSpace()},this.getHand=function(j){let ue=R[j];return ue===void 0&&(ue=new cs,R[j]=ue),ue.getHandSpace()};function V(j){const ue=E.indexOf(j.inputSource);if(ue===-1)return;const se=R[ue];se!==void 0&&(se.update(j.inputSource,j.frame,l||a),se.dispatchEvent({type:j.type,data:j.inputSource}))}function Z(){r.removeEventListener("select",V),r.removeEventListener("selectstart",V),r.removeEventListener("selectend",V),r.removeEventListener("squeeze",V),r.removeEventListener("squeezestart",V),r.removeEventListener("squeezeend",V),r.removeEventListener("end",Z),r.removeEventListener("inputsourceschange",W);for(let j=0;j<R.length;j++){const ue=E[j];ue!==null&&(E[j]=null,R[j].disconnect(ue))}J=null,ee=null,g.reset();for(const j in f)delete f[j];e.setRenderTarget(C),d=null,h=null,m=null,r=null,M=null,ke.stop(),n.isPresenting=!1,e.setPixelRatio(_),e.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(j){s=j,n.isPresenting===!0&&we("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(j){o=j,n.isPresenting===!0&&we("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(j){l=j},this.getBaseLayer=function(){return h!==null?h:d},this.getBinding=function(){return m===null&&y&&(m=new XRWebGLBinding(r,t)),m},this.getFrame=function(){return x},this.getSession=function(){return r},this.setSession=async function(j){if(r=j,r!==null){if(C=e.getRenderTarget(),r.addEventListener("select",V),r.addEventListener("selectstart",V),r.addEventListener("selectend",V),r.addEventListener("squeeze",V),r.addEventListener("squeezestart",V),r.addEventListener("squeezeend",V),r.addEventListener("end",Z),r.addEventListener("inputsourceschange",W),w.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(P),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let se=null,Pe=null,De=null;w.depth&&(De=w.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=w.stencil?Zn:vn,Pe=w.stencil?Xi:on);const Re={colorFormat:t.RGBA8,depthFormat:De,scaleFactor:s};m=this.getBinding(),h=m.createProjectionLayer(Re),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),M=new an(h.textureWidth,h.textureHeight,{format:Zt,type:kt,depthTexture:new Ri(h.textureWidth,h.textureHeight,Pe,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const se={antialias:w.antialias,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,se),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new an(d.framebufferWidth,d.framebufferHeight,{format:Zt,type:kt,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),ke.setContext(r),ke.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function W(j){for(let ue=0;ue<j.removed.length;ue++){const se=j.removed[ue],Pe=E.indexOf(se);Pe>=0&&(E[Pe]=null,R[Pe].disconnect(se))}for(let ue=0;ue<j.added.length;ue++){const se=j.added[ue];let Pe=E.indexOf(se);if(Pe===-1){for(let Re=0;Re<R.length;Re++)if(Re>=E.length){E.push(se),Pe=Re;break}else if(E[Re]===null){E[Re]=se,Pe=Re;break}if(Pe===-1)break}const De=R[Pe];De&&De.connect(se)}}const ne=new D,re=new D;function de(j,ue,se){ne.setFromMatrixPosition(ue.matrixWorld),re.setFromMatrixPosition(se.matrixWorld);const Pe=ne.distanceTo(re),De=ue.projectionMatrix.elements,Re=se.projectionMatrix.elements,rt=De[14]/(De[10]-1),Ne=De[14]/(De[10]+1),qe=(De[9]+1)/De[5],We=(De[9]-1)/De[5],ze=(De[8]-1)/De[0],ot=(Re[8]+1)/Re[0],ut=rt*ze,pt=rt*ot,mt=Pe/(-ze+ot),st=mt*-ze;if(ue.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(st),j.translateZ(mt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert(),De[10]===-1)j.projectionMatrix.copy(ue.projectionMatrix),j.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const lt=rt+mt,L=Ne+mt,St=ut-st,Xe=pt+(Pe-st),S=qe*Ne/L*lt,p=We*Ne/L*lt;j.projectionMatrix.makePerspective(St,Xe,S,p,lt,L),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}}function ge(j,ue){ue===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ue.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(r===null)return;let ue=j.near,se=j.far;g.texture!==null&&(g.depthNear>0&&(ue=g.depthNear),g.depthFar>0&&(se=g.depthFar)),B.near=U.near=b.near=ue,B.far=U.far=b.far=se,(J!==B.near||ee!==B.far)&&(r.updateRenderState({depthNear:B.near,depthFar:B.far}),J=B.near,ee=B.far),B.layers.mask=j.layers.mask|6,b.layers.mask=B.layers.mask&-5,U.layers.mask=B.layers.mask&-3;const Pe=j.parent,De=B.cameras;ge(B,Pe);for(let Re=0;Re<De.length;Re++)ge(De[Re],Pe);De.length===2?de(B,b,U):B.projectionMatrix.copy(b.projectionMatrix),ye(j,B,Pe)};function ye(j,ue,se){se===null?j.matrix.copy(ue.matrixWorld):(j.matrix.copy(se.matrixWorld),j.matrix.invert(),j.matrix.multiply(ue.matrixWorld)),j.matrix.decompose(j.position,j.quaternion,j.scale),j.updateMatrixWorld(!0),j.projectionMatrix.copy(ue.projectionMatrix),j.projectionMatrixInverse.copy(ue.projectionMatrixInverse),j.isPerspectiveCamera&&(j.fov=Ta*2*Math.atan(1/j.projectionMatrix.elements[5]),j.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(h===null&&d===null))return c},this.setFoveation=function(j){c=j,h!==null&&(h.fixedFoveation=j),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=j)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(B)},this.getCameraTexture=function(j){return f[j]};let He=null;function it(j,ue){if(u=ue.getViewerPose(l||a),x=ue,u!==null){const se=u.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let Pe=!1;se.length!==B.cameras.length&&(B.cameras.length=0,Pe=!0);for(let Ne=0;Ne<se.length;Ne++){const qe=se[Ne];let We=null;if(d!==null)We=d.getViewport(qe);else{const ot=m.getViewSubImage(h,qe);We=ot.viewport,Ne===0&&(e.setRenderTargetTextures(M,ot.colorTexture,ot.depthStencilTexture),e.setRenderTarget(M))}let ze=I[Ne];ze===void 0&&(ze=new Ht,ze.layers.enable(Ne),ze.viewport=new ht,I[Ne]=ze),ze.matrix.fromArray(qe.transform.matrix),ze.matrix.decompose(ze.position,ze.quaternion,ze.scale),ze.projectionMatrix.fromArray(qe.projectionMatrix),ze.projectionMatrixInverse.copy(ze.projectionMatrix).invert(),ze.viewport.set(We.x,We.y,We.width,We.height),Ne===0&&(B.matrix.copy(ze.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),Pe===!0&&B.cameras.push(ze)}const De=r.enabledFeatures;if(De&&De.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&y){m=n.getBinding();const Ne=m.getDepthInformation(se[0]);Ne&&Ne.isValid&&Ne.texture&&g.init(Ne,r.renderState)}if(De&&De.includes("camera-access")&&y){e.state.unbindTexture(),m=n.getBinding();for(let Ne=0;Ne<se.length;Ne++){const qe=se[Ne].camera;if(qe){let We=f[qe];We||(We=new Wl,f[qe]=We);const ze=m.getCameraImage(qe);We.sourceTexture=ze}}}}for(let se=0;se<R.length;se++){const Pe=E[se],De=R[se];Pe!==null&&De!==void 0&&De.update(Pe,ue,l||a)}He&&He(j,ue),ue.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ue}),x=null}const ke=new Kl;ke.setAnimationLoop(it),this.setAnimationLoop=function(j){He=j},this.dispose=function(){}}}const Wm=new at,tc=new Le;tc.set(-1,0,0,0,1,0,0,0,1);function Xm(i,e){function t(g,f){g.matrixAutoUpdate===!0&&g.updateMatrix(),f.value.copy(g.matrix)}function n(g,f){f.color.getRGB(g.fogColor.value,Xl(i)),f.isFog?(g.fogNear.value=f.near,g.fogFar.value=f.far):f.isFogExp2&&(g.fogDensity.value=f.density)}function r(g,f,w,C,M){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?s(g,f):f.isMeshLambertMaterial?(s(g,f),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(s(g,f),m(g,f)):f.isMeshPhongMaterial?(s(g,f),u(g,f),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(s(g,f),h(g,f),f.isMeshPhysicalMaterial&&d(g,f,M)):f.isMeshMatcapMaterial?(s(g,f),x(g,f)):f.isMeshDepthMaterial?s(g,f):f.isMeshDistanceMaterial?(s(g,f),y(g,f)):f.isMeshNormalMaterial?s(g,f):f.isLineBasicMaterial?(a(g,f),f.isLineDashedMaterial&&o(g,f)):f.isPointsMaterial?c(g,f,w,C):f.isSpriteMaterial?l(g,f):f.isShadowMaterial?(g.color.value.copy(f.color),g.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(g,f){g.opacity.value=f.opacity,f.color&&g.diffuse.value.copy(f.color),f.emissive&&g.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.bumpMap&&(g.bumpMap.value=f.bumpMap,t(f.bumpMap,g.bumpMapTransform),g.bumpScale.value=f.bumpScale,f.side===Ut&&(g.bumpScale.value*=-1)),f.normalMap&&(g.normalMap.value=f.normalMap,t(f.normalMap,g.normalMapTransform),g.normalScale.value.copy(f.normalScale),f.side===Ut&&g.normalScale.value.negate()),f.displacementMap&&(g.displacementMap.value=f.displacementMap,t(f.displacementMap,g.displacementMapTransform),g.displacementScale.value=f.displacementScale,g.displacementBias.value=f.displacementBias),f.emissiveMap&&(g.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,g.emissiveMapTransform)),f.specularMap&&(g.specularMap.value=f.specularMap,t(f.specularMap,g.specularMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest);const w=e.get(f),C=w.envMap,M=w.envMapRotation;C&&(g.envMap.value=C,g.envMapRotation.value.setFromMatrix4(Wm.makeRotationFromEuler(M)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(tc),g.reflectivity.value=f.reflectivity,g.ior.value=f.ior,g.refractionRatio.value=f.refractionRatio),f.lightMap&&(g.lightMap.value=f.lightMap,g.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,g.lightMapTransform)),f.aoMap&&(g.aoMap.value=f.aoMap,g.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,g.aoMapTransform))}function a(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform))}function o(g,f){g.dashSize.value=f.dashSize,g.totalSize.value=f.dashSize+f.gapSize,g.scale.value=f.scale}function c(g,f,w,C){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.size.value=f.size*w,g.scale.value=C*.5,f.map&&(g.map.value=f.map,t(f.map,g.uvTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function l(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.rotation.value=f.rotation,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function u(g,f){g.specular.value.copy(f.specular),g.shininess.value=Math.max(f.shininess,1e-4)}function m(g,f){f.gradientMap&&(g.gradientMap.value=f.gradientMap)}function h(g,f){g.metalness.value=f.metalness,f.metalnessMap&&(g.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,g.metalnessMapTransform)),g.roughness.value=f.roughness,f.roughnessMap&&(g.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,g.roughnessMapTransform)),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)}function d(g,f,w){g.ior.value=f.ior,f.sheen>0&&(g.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),g.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(g.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,g.sheenColorMapTransform)),f.sheenRoughnessMap&&(g.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,g.sheenRoughnessMapTransform))),f.clearcoat>0&&(g.clearcoat.value=f.clearcoat,g.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(g.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,g.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(g.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ut&&g.clearcoatNormalScale.value.negate())),f.dispersion>0&&(g.dispersion.value=f.dispersion),f.iridescence>0&&(g.iridescence.value=f.iridescence,g.iridescenceIOR.value=f.iridescenceIOR,g.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(g.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,g.iridescenceMapTransform)),f.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),f.transmission>0&&(g.transmission.value=f.transmission,g.transmissionSamplerMap.value=w.texture,g.transmissionSamplerSize.value.set(w.width,w.height),f.transmissionMap&&(g.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,g.transmissionMapTransform)),g.thickness.value=f.thickness,f.thicknessMap&&(g.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=f.attenuationDistance,g.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(g.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(g.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=f.specularIntensity,g.specularColor.value.copy(f.specularColor),f.specularColorMap&&(g.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,g.specularColorMapTransform)),f.specularIntensityMap&&(g.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,g.specularIntensityMapTransform))}function x(g,f){f.matcap&&(g.matcap.value=f.matcap)}function y(g,f){const w=e.get(f).light;g.referencePosition.value.setFromMatrixPosition(w.matrixWorld),g.nearDistance.value=w.shadow.camera.near,g.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Ym(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(M,R){const E=R.program;n.uniformBlockBinding(M,E)}function l(M,R){let E=r[M.id];E===void 0&&(g(M),E=u(M),r[M.id]=E,M.addEventListener("dispose",w));const P=R.program;n.updateUBOMapping(M,P);const _=e.render.frame;s[M.id]!==_&&(h(M),s[M.id]=_)}function u(M){const R=m();M.__bindingPointIndex=R;const E=i.createBuffer(),P=M.__size,_=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,E),i.bufferData(i.UNIFORM_BUFFER,P,_),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,R,E),E}function m(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(M){const R=r[M.id],E=M.uniforms,P=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,R);for(let _=0,b=E.length;_<b;_++){const U=E[_];if(Array.isArray(U))for(let I=0,B=U.length;I<B;I++)d(U[I],_,I,P);else d(U,_,0,P)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function d(M,R,E,P){if(y(M,R,E,P)===!0){const _=M.__offset,b=M.value;if(Array.isArray(b)){let U=0;for(let I=0;I<b.length;I++){const B=b[I],J=f(B);x(B,M.__data,U),typeof B!="number"&&typeof B!="boolean"&&!B.isMatrix3&&!ArrayBuffer.isView(B)&&(U+=J.storage/Float32Array.BYTES_PER_ELEMENT)}}else x(b,M.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,_,M.__data)}}function x(M,R,E){typeof M=="number"||typeof M=="boolean"?R[0]=M:M.isMatrix3?(R[0]=M.elements[0],R[1]=M.elements[1],R[2]=M.elements[2],R[3]=0,R[4]=M.elements[3],R[5]=M.elements[4],R[6]=M.elements[5],R[7]=0,R[8]=M.elements[6],R[9]=M.elements[7],R[10]=M.elements[8],R[11]=0):ArrayBuffer.isView(M)?R.set(new M.constructor(M.buffer,M.byteOffset,R.length)):M.toArray(R,E)}function y(M,R,E,P){const _=M.value,b=R+"_"+E;if(P[b]===void 0)return typeof _=="number"||typeof _=="boolean"?P[b]=_:ArrayBuffer.isView(_)?P[b]=_.slice():P[b]=_.clone(),!0;{const U=P[b];if(typeof _=="number"||typeof _=="boolean"){if(U!==_)return P[b]=_,!0}else{if(ArrayBuffer.isView(_))return!0;if(U.equals(_)===!1)return U.copy(_),!0}}return!1}function g(M){const R=M.uniforms;let E=0;const P=16;for(let b=0,U=R.length;b<U;b++){const I=Array.isArray(R[b])?R[b]:[R[b]];for(let B=0,J=I.length;B<J;B++){const ee=I[B],V=Array.isArray(ee.value)?ee.value:[ee.value];for(let Z=0,W=V.length;Z<W;Z++){const ne=V[Z],re=f(ne),de=E%P,ge=de%re.boundary,ye=de+ge;E+=ge,ye!==0&&P-ye<re.storage&&(E+=P-ye),ee.__data=new Float32Array(re.storage/Float32Array.BYTES_PER_ELEMENT),ee.__offset=E,E+=re.storage}}}const _=E%P;return _>0&&(E+=P-_),M.__size=E,M.__cache={},this}function f(M){const R={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(R.boundary=4,R.storage=4):M.isVector2?(R.boundary=8,R.storage=8):M.isVector3||M.isColor?(R.boundary=16,R.storage=12):M.isVector4?(R.boundary=16,R.storage=16):M.isMatrix3?(R.boundary=48,R.storage=48):M.isMatrix4?(R.boundary=64,R.storage=64):M.isTexture?we("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(R.boundary=16,R.storage=M.byteLength):we("WebGLRenderer: Unsupported uniform value type.",M),R}function w(M){const R=M.target;R.removeEventListener("dispose",w);const E=a.indexOf(R.__bindingPointIndex);a.splice(E,1),i.deleteBuffer(r[R.id]),delete r[R.id],delete s[R.id]}function C(){for(const M in r)i.deleteBuffer(r[M]);a=[],r={},s={}}return{bind:c,update:l,dispose:C}}const qm=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let jt=null;function Km(){return jt===null&&(jt=new Ch(qm,16,16,Jn,xn),jt.name="DFG_LUT",jt.minFilter=At,jt.magFilter=At,jt.wrapS=mn,jt.wrapT=mn,jt.generateMipmaps=!1,jt.needsUpdate=!0),jt}class Zm{constructor(e={}){const{canvas:t=ih(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:h=!1,outputBufferType:d=kt}=e;this.isWebGLRenderer=!0;let x;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");x=n.getContextAttributes().alpha}else x=a;const y=d,g=new Set([Fa,Na,Ua]),f=new Set([kt,on,Wi,Xi,La,Ia]),w=new Uint32Array(4),C=new Int32Array(4),M=new D;let R=null,E=null;const P=[],_=[];let b=null;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=sn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const U=this;let I=!1,B=null,J=null,ee=null,V=null;this._outputColorSpace=It;let Z=0,W=0,ne=null,re=-1,de=null;const ge=new ht,ye=new ht;let He=null;const it=new Be(0);let ke=0,j=t.width,ue=t.height,se=1,Pe=null,De=null;const Re=new ht(0,0,j,ue),rt=new ht(0,0,j,ue);let Ne=!1;const qe=new Vl;let We=!1,ze=!1;const ot=new at,ut=new D,pt=new ht,mt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let st=!1;function lt(){return ne===null?se:1}let L=n;function St(v,N){return t.getContext(v,N)}try{const v={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:m};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Pa}`),t.addEventListener("webglcontextlost",Ke,!1),t.addEventListener("webglcontextrestored",$e,!1),t.addEventListener("webglcontextcreationerror",wt,!1),L===null){const N="webgl2";if(L=St(N,v),L===null)throw St(N)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(v){throw Ge("WebGLRenderer: "+v.message),v}let Xe,S,p,O,H,q,oe,ce,K,Q,he,Ee,T,F,Y,te,fe,A,ie,X,ae,le,$;function ve(){Xe=new Kd(L),Xe.init(),ae=new zm(L,Xe),S=new Gd(L,Xe,e,ae),p=new Om(L,Xe),S.reversedDepthBuffer&&h&&p.buffers.depth.setReversed(!0),J=L.createFramebuffer(),ee=L.createFramebuffer(),V=L.createFramebuffer(),O=new Jd(L),H=new Em,q=new Bm(L,Xe,p,H,S,ae,O),oe=new qd(U),ce=new eu(L),le=new Bd(L,ce),K=new Zd(L,ce,O,le),Q=new jd(L,K,ce,le,O),A=new Qd(L,S,q),Y=new Vd(H),he=new ym(U,oe,Xe,S,le,Y),Ee=new Xm(U,H),T=new Tm,F=new Dm(Xe),fe=new Od(U,oe,p,Q,x,c),te=new Fm(U,Q,S),$=new Ym(L,O,S,p),ie=new zd(L,Xe,O),X=new $d(L,Xe,O),O.programs=he.programs,U.capabilities=S,U.extensions=Xe,U.properties=H,U.renderLists=T,U.shadowMap=te,U.state=p,U.info=O}ve(),y!==kt&&(b=new tp(y,t.width,t.height,o,r,s));const pe=new km(U,L);this.xr=pe,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const v=Xe.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=Xe.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return se},this.setPixelRatio=function(v){v!==void 0&&(se=v,this.setSize(j,ue,!1))},this.getSize=function(v){return v.set(j,ue)},this.setSize=function(v,N,k=!0){if(pe.isPresenting){we("WebGLRenderer: Can't change size while VR device is presenting.");return}j=v,ue=N,t.width=Math.floor(v*se),t.height=Math.floor(N*se),k===!0&&(t.style.width=v+"px",t.style.height=N+"px"),b!==null&&b.setSize(t.width,t.height),this.setViewport(0,0,v,N)},this.getDrawingBufferSize=function(v){return v.set(j*se,ue*se).floor()},this.setDrawingBufferSize=function(v,N,k){j=v,ue=N,se=k,t.width=Math.floor(v*k),t.height=Math.floor(N*k),this.setViewport(0,0,v,N)},this.setEffects=function(v){if(y===kt){Ge("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let N=0;N<v.length;N++)if(v[N].isOutputPass===!0){we("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}b.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(ge)},this.getViewport=function(v){return v.copy(Re)},this.setViewport=function(v,N,k,z){v.isVector4?Re.set(v.x,v.y,v.z,v.w):Re.set(v,N,k,z),p.viewport(ge.copy(Re).multiplyScalar(se).round())},this.getScissor=function(v){return v.copy(rt)},this.setScissor=function(v,N,k,z){v.isVector4?rt.set(v.x,v.y,v.z,v.w):rt.set(v,N,k,z),p.scissor(ye.copy(rt).multiplyScalar(se).round())},this.getScissorTest=function(){return Ne},this.setScissorTest=function(v){p.setScissorTest(Ne=v)},this.setOpaqueSort=function(v){Pe=v},this.setTransparentSort=function(v){De=v},this.getClearColor=function(v){return v.copy(fe.getClearColor())},this.setClearColor=function(){fe.setClearColor(...arguments)},this.getClearAlpha=function(){return fe.getClearAlpha()},this.setClearAlpha=function(){fe.setClearAlpha(...arguments)},this.clear=function(v=!0,N=!0,k=!0){let z=0;if(v){let G=!1;if(ne!==null){const xe=ne.texture.format;G=g.has(xe)}if(G){const xe=ne.texture.type,Se=f.has(xe),_e=fe.getClearColor(),be=fe.getClearAlpha(),Te=_e.r,Ie=_e.g,Fe=_e.b;Se?(w[0]=Te,w[1]=Ie,w[2]=Fe,w[3]=be,L.clearBufferuiv(L.COLOR,0,w)):(C[0]=Te,C[1]=Ie,C[2]=Fe,C[3]=be,L.clearBufferiv(L.COLOR,0,C))}else z|=L.COLOR_BUFFER_BIT}N&&(z|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),k&&(z|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z!==0&&L.clear(z)},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.setNodesHandler=function(v){v.setRenderer(this),B=v},this.dispose=function(){t.removeEventListener("webglcontextlost",Ke,!1),t.removeEventListener("webglcontextrestored",$e,!1),t.removeEventListener("webglcontextcreationerror",wt,!1),fe.dispose(),T.dispose(),F.dispose(),H.dispose(),oe.dispose(),Q.dispose(),le.dispose(),$.dispose(),he.dispose(),pe.dispose(),pe.removeEventListener("sessionstart",Ka),pe.removeEventListener("sessionend",Za),Vn.stop()};function Ke(v){v.preventDefault(),Br("WebGLRenderer: Context Lost."),I=!0}function $e(){Br("WebGLRenderer: Context Restored."),I=!1;const v=O.autoReset,N=te.enabled,k=te.autoUpdate,z=te.needsUpdate,G=te.type;ve(),O.autoReset=v,te.enabled=N,te.autoUpdate=k,te.needsUpdate=z,te.type=G}function wt(v){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function Nt(v){const N=v.target;N.removeEventListener("dispose",Nt),Sn(N)}function Sn(v){Di(v),H.remove(v)}function Di(v){const N=H.get(v).programs;N!==void 0&&(N.forEach(function(k){he.releaseProgram(k)}),v.isShaderMaterial&&he.releaseShaderCache(v))}this.renderBufferDirect=function(v,N,k,z,G,xe){N===null&&(N=mt);const Se=G.isMesh&&G.matrixWorld.determinantAffine()<0,_e=oc(v,N,k,z,G);p.setMaterial(z,Se);let be=k.index,Te=1;if(z.wireframe===!0){if(be=K.getWireframeAttribute(k),be===void 0)return;Te=2}const Ie=k.drawRange,Fe=k.attributes.position;let Ae=Ie.start*Te,Je=(Ie.start+Ie.count)*Te;xe!==null&&(Ae=Math.max(Ae,xe.start*Te),Je=Math.min(Je,(xe.start+xe.count)*Te)),be!==null?(Ae=Math.max(Ae,0),Je=Math.min(Je,be.count)):Fe!=null&&(Ae=Math.max(Ae,0),Je=Math.min(Je,Fe.count));const ft=Je-Ae;if(ft<0||ft===1/0)return;le.setup(G,z,_e,k,be);let ct,et=ie;if(be!==null&&(ct=ce.get(be),et=X,et.setIndex(ct)),G.isMesh)z.wireframe===!0?(p.setLineWidth(z.wireframeLinewidth*lt()),et.setMode(L.LINES)):et.setMode(L.TRIANGLES);else if(G.isLine){let Et=z.linewidth;Et===void 0&&(Et=1),p.setLineWidth(Et*lt()),G.isLineSegments?et.setMode(L.LINES):G.isLineLoop?et.setMode(L.LINE_LOOP):et.setMode(L.LINE_STRIP)}else G.isPoints?et.setMode(L.POINTS):G.isSprite&&et.setMode(L.TRIANGLES);if(G.isBatchedMesh)if(Xe.get("WEBGL_multi_draw"))et.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else{const Et=G._multiDrawStarts,Me=G._multiDrawCounts,Ft=G._multiDrawCount,Ye=be?ce.get(be).bytesPerElement:1,Gt=H.get(z).currentProgram.getUniforms();for(let Jt=0;Jt<Ft;Jt++)Gt.setValue(L,"_gl_DrawID",Jt),et.render(Et[Jt]/Ye,Me[Jt])}else if(G.isInstancedMesh)et.renderInstances(Ae,ft,G.count);else if(k.isInstancedBufferGeometry){const Et=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,Me=Math.min(k.instanceCount,Et);et.renderInstances(Ae,ft,Me)}else et.render(Ae,ft)};function jn(v,N,k){v.transparent===!0&&v.side===pn&&v.forceSinglePass===!1?(v.side=Ut,v.needsUpdate=!0,Zi(v,N,k),v.side=Bn,v.needsUpdate=!0,Zi(v,N,k),v.side=pn):Zi(v,N,k)}this.compile=function(v,N,k=null){k===null&&(k=v),E=F.get(k),E.init(N),_.push(E),k.traverseVisible(function(G){G.isLight&&G.layers.test(N.layers)&&(E.pushLight(G),G.castShadow&&E.pushShadow(G))}),v!==k&&v.traverseVisible(function(G){G.isLight&&G.layers.test(N.layers)&&(E.pushLight(G),G.castShadow&&E.pushShadow(G))}),E.setupLights();const z=new Set;return v.traverse(function(G){if(!(G.isMesh||G.isPoints||G.isLine||G.isSprite))return;const xe=G.material;if(xe)if(Array.isArray(xe))for(let Se=0;Se<xe.length;Se++){const _e=xe[Se];jn(_e,k,G),z.add(_e)}else jn(xe,k,G),z.add(xe)}),E=_.pop(),z},this.compileAsync=function(v,N,k=null){const z=this.compile(v,N,k);return new Promise(G=>{function xe(){if(z.forEach(function(Se){H.get(Se).currentProgram.isReady()&&z.delete(Se)}),z.size===0){G(v);return}setTimeout(xe,10)}Xe.get("KHR_parallel_shader_compile")!==null?xe():setTimeout(xe,10)})};let Zr=null;function sc(v){Zr&&Zr(v)}function Ka(){Vn.stop()}function Za(){Vn.start()}const Vn=new Kl;Vn.setAnimationLoop(sc),typeof self<"u"&&Vn.setContext(self),this.setAnimationLoop=function(v){Zr=v,pe.setAnimationLoop(v),v===null?Vn.stop():Vn.start()},pe.addEventListener("sessionstart",Ka),pe.addEventListener("sessionend",Za),this.render=function(v,N){if(N!==void 0&&N.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;B!==null&&B.renderStart(v,N);const k=pe.enabled===!0&&pe.isPresenting===!0,z=b!==null&&(ne===null||k)&&b.begin(U,ne);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),pe.enabled===!0&&pe.isPresenting===!0&&(b===null||b.isCompositing()===!1)&&(pe.cameraAutoUpdate===!0&&pe.updateCamera(N),N=pe.getCamera()),v.isScene===!0&&v.onBeforeRender(U,v,N,ne),E=F.get(v,_.length),E.init(N),E.state.textureUnits=q.getTextureUnits(),_.push(E),ot.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),qe.setFromProjectionMatrix(ot,rn,N.reversedDepth),ze=this.localClippingEnabled,We=Y.init(this.clippingPlanes,ze),R=T.get(v,P.length),R.init(),P.push(R),pe.enabled===!0&&pe.isPresenting===!0){const Se=U.xr.getDepthSensingMesh();Se!==null&&$r(Se,N,-1/0,U.sortObjects)}$r(v,N,0,U.sortObjects),R.finish(),U.sortObjects===!0&&R.sort(Pe,De,N.reversedDepth),st=pe.enabled===!1||pe.isPresenting===!1||pe.hasDepthSensing()===!1,st&&fe.addToRenderList(R,v),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),We===!0&&Y.beginShadows();const G=E.state.shadowsArray;if(te.render(G,v,N),We===!0&&Y.endShadows(),(z&&b.hasRenderPass())===!1){const Se=R.opaque,_e=R.transmissive;if(E.setupLights(),N.isArrayCamera){const be=N.cameras;if(_e.length>0)for(let Te=0,Ie=be.length;Te<Ie;Te++){const Fe=be[Te];Ja(Se,_e,v,Fe)}st&&fe.render(v);for(let Te=0,Ie=be.length;Te<Ie;Te++){const Fe=be[Te];$a(R,v,Fe,Fe.viewport)}}else _e.length>0&&Ja(Se,_e,v,N),st&&fe.render(v),$a(R,v,N)}ne!==null&&W===0&&(q.updateMultisampleRenderTarget(ne),q.updateRenderTargetMipmap(ne)),z&&b.end(U),v.isScene===!0&&v.onAfterRender(U,v,N),le.resetDefaultState(),re=-1,de=null,_.pop(),_.length>0?(E=_[_.length-1],q.setTextureUnits(E.state.textureUnits),We===!0&&Y.setGlobalState(U.clippingPlanes,E.state.camera)):E=null,P.pop(),P.length>0?R=P[P.length-1]:R=null,B!==null&&B.renderEnd()};function $r(v,N,k,z){if(v.visible===!1)return;if(v.layers.test(N.layers)){if(v.isGroup)k=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(N);else if(v.isLightProbeGrid)E.pushLightProbeGrid(v);else if(v.isLight)E.pushLight(v),v.castShadow&&E.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||qe.intersectsSprite(v)){z&&pt.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ot);const Se=Q.update(v),_e=v.material;_e.visible&&R.push(v,Se,_e,k,pt.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||qe.intersectsObject(v))){const Se=Q.update(v),_e=v.material;if(z&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),pt.copy(v.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),pt.copy(Se.boundingSphere.center)),pt.applyMatrix4(v.matrixWorld).applyMatrix4(ot)),Array.isArray(_e)){const be=Se.groups;for(let Te=0,Ie=be.length;Te<Ie;Te++){const Fe=be[Te],Ae=_e[Fe.materialIndex];Ae&&Ae.visible&&R.push(v,Se,Ae,k,pt.z,Fe)}}else _e.visible&&R.push(v,Se,_e,k,pt.z,null)}}const xe=v.children;for(let Se=0,_e=xe.length;Se<_e;Se++)$r(xe[Se],N,k,z)}function $a(v,N,k,z){const{opaque:G,transmissive:xe,transparent:Se}=v;E.setupLightsView(k),We===!0&&Y.setGlobalState(U.clippingPlanes,k),z&&p.viewport(ge.copy(z)),G.length>0&&Ki(G,N,k),xe.length>0&&Ki(xe,N,k),Se.length>0&&Ki(Se,N,k),p.buffers.depth.setTest(!0),p.buffers.depth.setMask(!0),p.buffers.color.setMask(!0),p.setPolygonOffset(!1)}function Ja(v,N,k,z){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;if(E.state.transmissionRenderTarget[z.id]===void 0){const Ae=Xe.has("EXT_color_buffer_half_float")||Xe.has("EXT_color_buffer_float");E.state.transmissionRenderTarget[z.id]=new an(1,1,{generateMipmaps:!0,type:Ae?xn:kt,minFilter:Kn,samples:Math.max(4,S.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ve.workingColorSpace})}const xe=E.state.transmissionRenderTarget[z.id],Se=z.viewport||ge;xe.setSize(Se.z*U.transmissionResolutionScale,Se.w*U.transmissionResolutionScale);const _e=U.getRenderTarget(),be=U.getActiveCubeFace(),Te=U.getActiveMipmapLevel();U.setRenderTarget(xe),U.getClearColor(it),ke=U.getClearAlpha(),ke<1&&U.setClearColor(16777215,.5),U.clear(),st&&fe.render(k);const Ie=U.toneMapping;U.toneMapping=sn;const Fe=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),E.setupLightsView(z),We===!0&&Y.setGlobalState(U.clippingPlanes,z),Ki(v,k,z),q.updateMultisampleRenderTarget(xe),q.updateRenderTargetMipmap(xe),Xe.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let Je=0,ft=N.length;Je<ft;Je++){const ct=N[Je],{object:et,geometry:Et,material:Me,group:Ft}=ct;if(Me.side===pn&&et.layers.test(z.layers)){const Ye=Me.side;Me.side=Ut,Me.needsUpdate=!0,Qa(et,k,z,Et,Me,Ft),Me.side=Ye,Me.needsUpdate=!0,Ae=!0}}Ae===!0&&(q.updateMultisampleRenderTarget(xe),q.updateRenderTargetMipmap(xe))}U.setRenderTarget(_e,be,Te),U.setClearColor(it,ke),Fe!==void 0&&(z.viewport=Fe),U.toneMapping=Ie}function Ki(v,N,k){const z=N.isScene===!0?N.overrideMaterial:null;for(let G=0,xe=v.length;G<xe;G++){const Se=v[G],{object:_e,geometry:be,group:Te}=Se;let Ie=Se.material;Ie.allowOverride===!0&&z!==null&&(Ie=z),_e.layers.test(k.layers)&&Qa(_e,N,k,be,Ie,Te)}}function Qa(v,N,k,z,G,xe){v.onBeforeRender(U,N,k,z,G,xe),v.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),G.onBeforeRender(U,N,k,z,v,xe),G.transparent===!0&&G.side===pn&&G.forceSinglePass===!1?(G.side=Ut,G.needsUpdate=!0,U.renderBufferDirect(k,N,z,G,v,xe),G.side=Bn,G.needsUpdate=!0,U.renderBufferDirect(k,N,z,G,v,xe),G.side=pn):U.renderBufferDirect(k,N,z,G,v,xe),v.onAfterRender(U,N,k,z,G,xe)}function Zi(v,N,k){N.isScene!==!0&&(N=mt);const z=H.get(v),G=E.state.lights,xe=E.state.shadowsArray,Se=G.state.version,_e=he.getParameters(v,G.state,xe,N,k,E.state.lightProbeGridArray),be=he.getProgramCacheKey(_e);let Te=z.programs;z.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?N.environment:null,z.fog=N.fog;const Ie=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;z.envMap=oe.get(v.envMap||z.environment,Ie),z.envMapRotation=z.environment!==null&&v.envMap===null?N.environmentRotation:v.envMapRotation,Te===void 0&&(v.addEventListener("dispose",Nt),Te=new Map,z.programs=Te);let Fe=Te.get(be);if(Fe!==void 0){if(z.currentProgram===Fe&&z.lightsStateVersion===Se)return eo(v,_e),Fe}else _e.uniforms=he.getUniforms(v),B!==null&&v.isNodeMaterial&&B.build(v,k,_e),v.onBeforeCompile(_e,U),Fe=he.acquireProgram(_e,be),Te.set(be,Fe),z.uniforms=_e.uniforms;const Ae=z.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Ae.clippingPlanes=Y.uniform),eo(v,_e),z.needsLights=cc(v),z.lightsStateVersion=Se,z.needsLights&&(Ae.ambientLightColor.value=G.state.ambient,Ae.lightProbe.value=G.state.probe,Ae.directionalLights.value=G.state.directional,Ae.directionalLightShadows.value=G.state.directionalShadow,Ae.spotLights.value=G.state.spot,Ae.spotLightShadows.value=G.state.spotShadow,Ae.rectAreaLights.value=G.state.rectArea,Ae.ltc_1.value=G.state.rectAreaLTC1,Ae.ltc_2.value=G.state.rectAreaLTC2,Ae.pointLights.value=G.state.point,Ae.pointLightShadows.value=G.state.pointShadow,Ae.hemisphereLights.value=G.state.hemi,Ae.directionalShadowMatrix.value=G.state.directionalShadowMatrix,Ae.spotLightMatrix.value=G.state.spotLightMatrix,Ae.spotLightMap.value=G.state.spotLightMap,Ae.pointShadowMatrix.value=G.state.pointShadowMatrix),z.lightProbeGrid=E.state.lightProbeGridArray.length>0,z.currentProgram=Fe,z.uniformsList=null,Fe}function ja(v){if(v.uniformsList===null){const N=v.currentProgram.getUniforms();v.uniformsList=Dr.seqWithValue(N.seq,v.uniforms)}return v.uniformsList}function eo(v,N){const k=H.get(v);k.outputColorSpace=N.outputColorSpace,k.batching=N.batching,k.batchingColor=N.batchingColor,k.instancing=N.instancing,k.instancingColor=N.instancingColor,k.instancingMorph=N.instancingMorph,k.skinning=N.skinning,k.morphTargets=N.morphTargets,k.morphNormals=N.morphNormals,k.morphColors=N.morphColors,k.morphTargetsCount=N.morphTargetsCount,k.numClippingPlanes=N.numClippingPlanes,k.numIntersection=N.numClipIntersection,k.vertexAlphas=N.vertexAlphas,k.vertexTangents=N.vertexTangents,k.toneMapping=N.toneMapping}function ac(v,N){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(N.matrixWorld);for(let k=0,z=v.length;k<z;k++){const G=v[k];if(G.texture!==null&&G.boundingBox.containsPoint(M))return G}return null}function oc(v,N,k,z,G){N.isScene!==!0&&(N=mt),q.resetTextureUnits();const xe=N.fog,Se=z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial?N.environment:null,_e=ne===null?U.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:Ve.workingColorSpace,be=z.isMeshStandardMaterial||z.isMeshLambertMaterial&&!z.envMap||z.isMeshPhongMaterial&&!z.envMap,Te=oe.get(z.envMap||Se,be),Ie=z.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Fe=!!k.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Ae=!!k.morphAttributes.position,Je=!!k.morphAttributes.normal,ft=!!k.morphAttributes.color;let ct=sn;z.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(ct=U.toneMapping);const et=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,Et=et!==void 0?et.length:0,Me=H.get(z),Ft=E.state.lights;if(We===!0&&(ze===!0||v!==de)){const nt=v===de&&z.id===re;Y.setState(z,v,nt)}let Ye=!1;z.version===Me.__version?(Me.needsLights&&Me.lightsStateVersion!==Ft.state.version||Me.outputColorSpace!==_e||G.isBatchedMesh&&Me.batching===!1||!G.isBatchedMesh&&Me.batching===!0||G.isBatchedMesh&&Me.batchingColor===!0&&G.colorTexture===null||G.isBatchedMesh&&Me.batchingColor===!1&&G.colorTexture!==null||G.isInstancedMesh&&Me.instancing===!1||!G.isInstancedMesh&&Me.instancing===!0||G.isSkinnedMesh&&Me.skinning===!1||!G.isSkinnedMesh&&Me.skinning===!0||G.isInstancedMesh&&Me.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Me.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Me.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Me.instancingMorph===!1&&G.morphTexture!==null||Me.envMap!==Te||z.fog===!0&&Me.fog!==xe||Me.numClippingPlanes!==void 0&&(Me.numClippingPlanes!==Y.numPlanes||Me.numIntersection!==Y.numIntersection)||Me.vertexAlphas!==Ie||Me.vertexTangents!==Fe||Me.morphTargets!==Ae||Me.morphNormals!==Je||Me.morphColors!==ft||Me.toneMapping!==ct||Me.morphTargetsCount!==Et||!!Me.lightProbeGrid!=E.state.lightProbeGridArray.length>0)&&(Ye=!0):(Ye=!0,Me.__version=z.version);let Gt=Me.currentProgram;Ye===!0&&(Gt=Zi(z,N,G),B&&z.isNodeMaterial&&B.onUpdateProgram(z,Gt,Me));let Jt=!1,yn=!1,ei=!1;const tt=Gt.getUniforms(),dt=Me.uniforms;if(p.useProgram(Gt.program)&&(Jt=!0,yn=!0,ei=!0),z.id!==re&&(re=z.id,yn=!0),Me.needsLights){const nt=ac(E.state.lightProbeGridArray,G);Me.lightProbeGrid!==nt&&(Me.lightProbeGrid=nt,yn=!0)}if(Jt||de!==v){p.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),tt.setValue(L,"projectionMatrix",v.projectionMatrix),tt.setValue(L,"viewMatrix",v.matrixWorldInverse);const bn=tt.map.cameraPosition;bn!==void 0&&bn.setValue(L,ut.setFromMatrixPosition(v.matrixWorld)),S.logarithmicDepthBuffer&&tt.setValue(L,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&tt.setValue(L,"isOrthographic",v.isOrthographicCamera===!0),de!==v&&(de=v,yn=!0,ei=!0)}if(Me.needsLights&&(Ft.state.directionalShadowMap.length>0&&tt.setValue(L,"directionalShadowMap",Ft.state.directionalShadowMap,q),Ft.state.spotShadowMap.length>0&&tt.setValue(L,"spotShadowMap",Ft.state.spotShadowMap,q),Ft.state.pointShadowMap.length>0&&tt.setValue(L,"pointShadowMap",Ft.state.pointShadowMap,q)),G.isSkinnedMesh){tt.setOptional(L,G,"bindMatrix"),tt.setOptional(L,G,"bindMatrixInverse");const nt=G.skeleton;nt&&(nt.boneTexture===null&&nt.computeBoneTexture(),tt.setValue(L,"boneTexture",nt.boneTexture,q))}G.isBatchedMesh&&(tt.setOptional(L,G,"batchingTexture"),tt.setValue(L,"batchingTexture",G._matricesTexture,q),tt.setOptional(L,G,"batchingIdTexture"),tt.setValue(L,"batchingIdTexture",G._indirectTexture,q),tt.setOptional(L,G,"batchingColorTexture"),G._colorsTexture!==null&&tt.setValue(L,"batchingColorTexture",G._colorsTexture,q));const En=k.morphAttributes;if((En.position!==void 0||En.normal!==void 0||En.color!==void 0)&&A.update(G,k,Gt),(yn||Me.receiveShadow!==G.receiveShadow)&&(Me.receiveShadow=G.receiveShadow,tt.setValue(L,"receiveShadow",G.receiveShadow)),(z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial)&&z.envMap===null&&N.environment!==null&&(dt.envMapIntensity.value=N.environmentIntensity),dt.dfgLUT!==void 0&&(dt.dfgLUT.value=Km()),yn){if(tt.setValue(L,"toneMappingExposure",U.toneMappingExposure),Me.needsLights&&lc(dt,ei),xe&&z.fog===!0&&Ee.refreshFogUniforms(dt,xe),Ee.refreshMaterialUniforms(dt,z,se,ue,E.state.transmissionRenderTarget[v.id]),Me.needsLights&&Me.lightProbeGrid){const nt=Me.lightProbeGrid;dt.probesSH.value=nt.texture,dt.probesMin.value.copy(nt.boundingBox.min),dt.probesMax.value.copy(nt.boundingBox.max),dt.probesResolution.value.copy(nt.resolution)}Dr.upload(L,ja(Me),dt,q)}if(z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(Dr.upload(L,ja(Me),dt,q),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&tt.setValue(L,"center",G.center),tt.setValue(L,"modelViewMatrix",G.modelViewMatrix),tt.setValue(L,"normalMatrix",G.normalMatrix),tt.setValue(L,"modelMatrix",G.matrixWorld),z.uniformsGroups!==void 0){const nt=z.uniformsGroups;for(let bn=0,ti=nt.length;bn<ti;bn++){const to=nt[bn];$.update(to,Gt),$.bind(to,Gt)}}return Gt}function lc(v,N){v.ambientLightColor.needsUpdate=N,v.lightProbe.needsUpdate=N,v.directionalLights.needsUpdate=N,v.directionalLightShadows.needsUpdate=N,v.pointLights.needsUpdate=N,v.pointLightShadows.needsUpdate=N,v.spotLights.needsUpdate=N,v.spotLightShadows.needsUpdate=N,v.rectAreaLights.needsUpdate=N,v.hemisphereLights.needsUpdate=N}function cc(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return Z},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return ne},this.setRenderTargetTextures=function(v,N,k){const z=H.get(v);z.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,z.__autoAllocateDepthBuffer===!1&&(z.__useRenderToTexture=!1),H.get(v.texture).__webglTexture=N,H.get(v.depthTexture).__webglTexture=z.__autoAllocateDepthBuffer?void 0:k,z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,N){const k=H.get(v);k.__webglFramebuffer=N,k.__useDefaultFramebuffer=N===void 0},this.setRenderTarget=function(v,N=0,k=0){ne=v,Z=N,W=k;let z=null,G=!1,xe=!1;if(v){const _e=H.get(v);if(_e.__useDefaultFramebuffer!==void 0){p.bindFramebuffer(L.FRAMEBUFFER,_e.__webglFramebuffer),ge.copy(v.viewport),ye.copy(v.scissor),He=v.scissorTest,p.viewport(ge),p.scissor(ye),p.setScissorTest(He),re=-1;return}else if(_e.__webglFramebuffer===void 0)q.setupRenderTarget(v);else if(_e.__hasExternalTextures)q.rebindTextures(v,H.get(v.texture).__webglTexture,H.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const Ie=v.depthTexture;if(_e.__boundDepthTexture!==Ie){if(Ie!==null&&H.has(Ie)&&(v.width!==Ie.image.width||v.height!==Ie.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");q.setupDepthRenderbuffer(v)}}const be=v.texture;(be.isData3DTexture||be.isDataArrayTexture||be.isCompressedArrayTexture)&&(xe=!0);const Te=H.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Te[N])?z=Te[N][k]:z=Te[N],G=!0):v.samples>0&&q.useMultisampledRTT(v)===!1?z=H.get(v).__webglMultisampledFramebuffer:Array.isArray(Te)?z=Te[k]:z=Te,ge.copy(v.viewport),ye.copy(v.scissor),He=v.scissorTest}else ge.copy(Re).multiplyScalar(se).floor(),ye.copy(rt).multiplyScalar(se).floor(),He=Ne;if(k!==0&&(z=J),p.bindFramebuffer(L.FRAMEBUFFER,z)&&p.drawBuffers(v,z),p.viewport(ge),p.scissor(ye),p.setScissorTest(He),G){const _e=H.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+N,_e.__webglTexture,k)}else if(xe){const _e=N;for(let be=0;be<v.textures.length;be++){const Te=H.get(v.textures[be]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+be,Te.__webglTexture,k,_e)}}else if(v!==null&&k!==0){const _e=H.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,_e.__webglTexture,k)}re=-1},this.readRenderTargetPixels=function(v,N,k,z,G,xe,Se,_e=0){if(!(v&&v.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let be=H.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&Se!==void 0&&(be=be[Se]),be){p.bindFramebuffer(L.FRAMEBUFFER,be);try{const Te=v.textures[_e],Ie=Te.format,Fe=Te.type;if(v.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+_e),!S.textureFormatReadable(Ie)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!S.textureTypeReadable(Fe)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=v.width-z&&k>=0&&k<=v.height-G&&L.readPixels(N,k,z,G,ae.convert(Ie),ae.convert(Fe),xe)}finally{const Te=ne!==null?H.get(ne).__webglFramebuffer:null;p.bindFramebuffer(L.FRAMEBUFFER,Te)}}},this.readRenderTargetPixelsAsync=async function(v,N,k,z,G,xe,Se,_e=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let be=H.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&Se!==void 0&&(be=be[Se]),be)if(N>=0&&N<=v.width-z&&k>=0&&k<=v.height-G){p.bindFramebuffer(L.FRAMEBUFFER,be);const Te=v.textures[_e],Ie=Te.format,Fe=Te.type;if(v.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+_e),!S.textureFormatReadable(Ie))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!S.textureTypeReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ae=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.bufferData(L.PIXEL_PACK_BUFFER,xe.byteLength,L.STREAM_READ),L.readPixels(N,k,z,G,ae.convert(Ie),ae.convert(Fe),0);const Je=ne!==null?H.get(ne).__webglFramebuffer:null;p.bindFramebuffer(L.FRAMEBUFFER,Je);const ft=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await rh(L,ft,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,xe),L.deleteBuffer(Ae),L.deleteSync(ft),xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,N=null,k=0){const z=Math.pow(2,-k),G=Math.floor(v.image.width*z),xe=Math.floor(v.image.height*z),Se=N!==null?N.x:0,_e=N!==null?N.y:0;q.setTexture2D(v,0),L.copyTexSubImage2D(L.TEXTURE_2D,k,0,0,Se,_e,G,xe),p.unbindTexture()},this.copyTextureToTexture=function(v,N,k=null,z=null,G=0,xe=0){let Se,_e,be,Te,Ie,Fe,Ae,Je,ft;const ct=v.isCompressedTexture?v.mipmaps[xe]:v.image;if(k!==null)Se=k.max.x-k.min.x,_e=k.max.y-k.min.y,be=k.isBox3?k.max.z-k.min.z:1,Te=k.min.x,Ie=k.min.y,Fe=k.isBox3?k.min.z:0;else{const dt=Math.pow(2,-G);Se=Math.floor(ct.width*dt),_e=Math.floor(ct.height*dt),v.isDataArrayTexture?be=ct.depth:v.isData3DTexture?be=Math.floor(ct.depth*dt):be=1,Te=0,Ie=0,Fe=0}z!==null?(Ae=z.x,Je=z.y,ft=z.z):(Ae=0,Je=0,ft=0);const et=ae.convert(N.format),Et=ae.convert(N.type);let Me;N.isData3DTexture?(q.setTexture3D(N,0),Me=L.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(q.setTexture2DArray(N,0),Me=L.TEXTURE_2D_ARRAY):(q.setTexture2D(N,0),Me=L.TEXTURE_2D),p.activeTexture(L.TEXTURE0),p.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,N.flipY),p.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),p.pixelStorei(L.UNPACK_ALIGNMENT,N.unpackAlignment);const Ft=p.getParameter(L.UNPACK_ROW_LENGTH),Ye=p.getParameter(L.UNPACK_IMAGE_HEIGHT),Gt=p.getParameter(L.UNPACK_SKIP_PIXELS),Jt=p.getParameter(L.UNPACK_SKIP_ROWS),yn=p.getParameter(L.UNPACK_SKIP_IMAGES);p.pixelStorei(L.UNPACK_ROW_LENGTH,ct.width),p.pixelStorei(L.UNPACK_IMAGE_HEIGHT,ct.height),p.pixelStorei(L.UNPACK_SKIP_PIXELS,Te),p.pixelStorei(L.UNPACK_SKIP_ROWS,Ie),p.pixelStorei(L.UNPACK_SKIP_IMAGES,Fe);const ei=v.isDataArrayTexture||v.isData3DTexture,tt=N.isDataArrayTexture||N.isData3DTexture;if(v.isDepthTexture){const dt=H.get(v),En=H.get(N),nt=H.get(dt.__renderTarget),bn=H.get(En.__renderTarget);p.bindFramebuffer(L.READ_FRAMEBUFFER,nt.__webglFramebuffer),p.bindFramebuffer(L.DRAW_FRAMEBUFFER,bn.__webglFramebuffer);for(let ti=0;ti<be;ti++)ei&&(L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,H.get(v).__webglTexture,G,Fe+ti),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,H.get(N).__webglTexture,xe,ft+ti)),L.blitFramebuffer(Te,Ie,Se,_e,Ae,Je,Se,_e,L.DEPTH_BUFFER_BIT,L.NEAREST);p.bindFramebuffer(L.READ_FRAMEBUFFER,null),p.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(G!==0||v.isRenderTargetTexture||H.has(v)){const dt=H.get(v),En=H.get(N);p.bindFramebuffer(L.READ_FRAMEBUFFER,ee),p.bindFramebuffer(L.DRAW_FRAMEBUFFER,V);for(let nt=0;nt<be;nt++)ei?L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,dt.__webglTexture,G,Fe+nt):L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,dt.__webglTexture,G),tt?L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,En.__webglTexture,xe,ft+nt):L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,En.__webglTexture,xe),G!==0?L.blitFramebuffer(Te,Ie,Se,_e,Ae,Je,Se,_e,L.COLOR_BUFFER_BIT,L.NEAREST):tt?L.copyTexSubImage3D(Me,xe,Ae,Je,ft+nt,Te,Ie,Se,_e):L.copyTexSubImage2D(Me,xe,Ae,Je,Te,Ie,Se,_e);p.bindFramebuffer(L.READ_FRAMEBUFFER,null),p.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else tt?v.isDataTexture||v.isData3DTexture?L.texSubImage3D(Me,xe,Ae,Je,ft,Se,_e,be,et,Et,ct.data):N.isCompressedArrayTexture?L.compressedTexSubImage3D(Me,xe,Ae,Je,ft,Se,_e,be,et,ct.data):L.texSubImage3D(Me,xe,Ae,Je,ft,Se,_e,be,et,Et,ct):v.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,xe,Ae,Je,Se,_e,et,Et,ct.data):v.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,xe,Ae,Je,ct.width,ct.height,et,ct.data):L.texSubImage2D(L.TEXTURE_2D,xe,Ae,Je,Se,_e,et,Et,ct);p.pixelStorei(L.UNPACK_ROW_LENGTH,Ft),p.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ye),p.pixelStorei(L.UNPACK_SKIP_PIXELS,Gt),p.pixelStorei(L.UNPACK_SKIP_ROWS,Jt),p.pixelStorei(L.UNPACK_SKIP_IMAGES,yn),xe===0&&N.generateMipmaps&&L.generateMipmap(Me),p.unbindTexture()},this.initRenderTarget=function(v){H.get(v).__webglFramebuffer===void 0&&q.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?q.setTextureCube(v,0):v.isData3DTexture?q.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?q.setTexture2DArray(v,0):q.setTexture2D(v,0),p.unbindTexture()},this.resetState=function(){Z=0,W=0,ne=null,p.reset(),le.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return rn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Ve._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ve._getUnpackColorSpace()}}const cl={type:"change"},Ha={type:"start"},nc={type:"end"},br=new Xr,hl=new Dn,$m=Math.cos(70*oh.DEG2RAD),_t=new D,Lt=2*Math.PI,je={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Ns=1e-6;class Jm extends Qh{constructor(e,t=null){super(e,t),this.state=je.NONE,this.target=new D,this.cursor=new D,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Si.ROTATE,MIDDLE:Si.DOLLY,RIGHT:Si.PAN},this.touches={ONE:Mi.ROTATE,TWO:Mi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new D,this._lastQuaternion=new zn,this._lastTargetPosition=new D,this._quat=new zn().setFromUnitVectors(e.up,new D(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Oo,this._sphericalDelta=new Oo,this._scale=1,this._panOffset=new D,this._rotateStart=new Ce,this._rotateEnd=new Ce,this._rotateDelta=new Ce,this._panStart=new Ce,this._panEnd=new Ce,this._panDelta=new Ce,this._dollyStart=new Ce,this._dollyEnd=new Ce,this._dollyDelta=new Ce,this._dollyDirection=new D,this._mouse=new Ce,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=jm.bind(this),this._onPointerDown=Qm.bind(this),this._onPointerUp=eg.bind(this),this._onContextMenu=og.bind(this),this._onMouseWheel=ig.bind(this),this._onKeyDown=rg.bind(this),this._onTouchStart=sg.bind(this),this._onTouchMove=ag.bind(this),this._onMouseDown=tg.bind(this),this._onMouseMove=ng.bind(this),this._interceptControlDown=lg.bind(this),this._interceptControlUp=cg.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(cl),this.update(),this.state=je.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const t=this.object.position;_t.copy(t).sub(this.target),_t.applyQuaternion(this._quat),this._spherical.setFromVector3(_t),this.autoRotate&&this.state===je.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Lt:n>Math.PI&&(n-=Lt),r<-Math.PI?r+=Lt:r>Math.PI&&(r-=Lt),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(_t.setFromSpherical(this._spherical),_t.applyQuaternion(this._quatInverse),t.copy(this.target).add(_t),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=_t.length();a=this._clampDistance(o*this._scale);const c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const o=new D(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const l=new D(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=_t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(br.origin.copy(this.object.position),br.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(br.direction))<$m?this.object.lookAt(this.target):(hl.setFromNormalAndCoplanarPoint(this.object.up,this.target),br.intersectPlane(hl,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Ns||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ns||this._lastTargetPosition.distanceToSquared(this.target)>Ns?(this.dispatchEvent(cl),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Lt/60*this.autoRotateSpeed*e:Lt/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){_t.setFromMatrixColumn(t,0),_t.multiplyScalar(-e),this._panOffset.add(_t)}_panUp(e,t){this.screenSpacePanning===!0?_t.setFromMatrixColumn(t,1):(_t.setFromMatrixColumn(t,0),_t.crossVectors(this.object.up,_t)),_t.multiplyScalar(e),this._panOffset.add(_t)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;_t.copy(r).sub(this.target);let s=_t.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Lt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Lt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Lt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Lt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Ce,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function Qm(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function jm(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function eg(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(nc),this.state=je.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function tg(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Si.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=je.DOLLY;break;case Si.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=je.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=je.ROTATE}break;case Si.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=je.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=je.PAN}break;default:this.state=je.NONE}this.state!==je.NONE&&this.dispatchEvent(Ha)}function ng(i){switch(this.state){case je.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case je.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case je.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function ig(i){this.enabled===!1||this.enableZoom===!1||this.state!==je.NONE||(i.preventDefault(),this.dispatchEvent(Ha),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(nc))}function rg(i){this.enabled!==!1&&this._handleKeyDown(i)}function sg(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Mi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=je.TOUCH_ROTATE;break;case Mi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=je.TOUCH_PAN;break;default:this.state=je.NONE}break;case 2:switch(this.touches.TWO){case Mi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=je.TOUCH_DOLLY_PAN;break;case Mi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=je.TOUCH_DOLLY_ROTATE;break;default:this.state=je.NONE}break;default:this.state=je.NONE}this.state!==je.NONE&&this.dispatchEvent(Ha)}function ag(i){switch(this._trackPointer(i),this.state){case je.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case je.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case je.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case je.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=je.NONE}}function og(i){this.enabled!==!1&&i.preventDefault()}function lg(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function cg(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const hg=16317439,ug=[16748467,16762967,8246268,10980346,8843180,16478597,3718648,15772668,16639626,6220500],fg=[16758891,6333946,3462041,15235577,16436245,6220500,12616956,16020150,10741301,9684477],bi=1700,dg={x:1.42,y:.84,z:1},pg={x:1,y:1,z:1};function ul(i,e={}){const t=e.selectedKey??null,n=yc(i,t),r=mg(n.edges,t),s=t?ml(n,t):null,a=n.nodes.map(l=>{const u=_g(l.key,t,r),m=Ca(l.key),h=xg(l,u,t,m),d=yg(l,u),x=Eg(l,u,n.nodes.length,s);return{key:l.key,node:l,x:h.x,y:h.y,z:h.z,radius:d,color:Ag(l),state:u,labelTier:x,opacity:bg(u),seed:m}}),o=new Map(a.map(l=>[l.key,l])),c=n.edges.flatMap(l=>{const u=o.get(l.sourceKey),m=o.get(l.targetKey);if(!u||!m)return[];const h=!!(t&&(l.sourceKey===t||l.targetKey===t)),d=!!(t&&!h),x=d?.018:h?.32+Math.min(.2,l.weight*.2):l.visibility===2?.09:.06;return[{edge:l,source:u,target:m,color:u.color,alpha:x,width:gg(l,h,d),highlighted:h}]});return{nodes:a,edges:c,selectedNeighborKeys:r,bounds:Tg(a,!!t)}}function mg(i,e){const t=new Set;if(!e)return t;for(const n of i)n.sourceKey===e&&t.add(n.targetKey),n.targetKey===e&&t.add(n.sourceKey);return t}function gg(i,e,t){const n=.75+Math.log10(i.weight+1)*.7+(i.visibility===2?.18:0);return e?Math.min(2.2,Math.max(1.65,n+.65)):t?Math.min(.8,Math.max(.55,n*.58)):Math.min(1.35,Math.max(.85,n))}function _g(i,e,t){return e?i===e?"selected":t.has(i)?"neighbor":"dimmed":"normal"}function xg(i,e,t,n){if(e==="selected")return{x:0,y:0,z:0};if(!t&&i.kind==="owner")return{x:0,y:0,z:0};const r=vg(i,t),s=Mg(i,e,!!t,n),a=t?pg:dg;return{x:Fs(r.x*s*a.x,2),y:Fs(r.y*s*a.y,2),z:Fs(r.z*s*a.z,2)}}function vg(i,e){const t=e??"panorama",n=fl(`community:${t}:${i.communityId||"default"}`),r=fl(`node:${t}:${i.key}`),s=e?.7:1.15,a=e?1.15:.95;return wg({x:n.x*s+r.x*a,y:n.y*s+r.y*a,z:n.z*s+r.z*a})}function Mg(i,e,t,n){const r=Sg(i),s=(n-.5)*120;if(t&&e==="neighbor")return In(980-r*650+s,220,1050);if(t&&e==="dimmed")return In(1670-r*260+s,1280,bi);const a=i.pool==="friend"?280:620,o=i.pool==="friend"?1180:bi,c=i.pool==="non_friend"?Math.max(0,(i.rank-80)/220)*160:0;return In(o-r*(o-a)+c+s,180,bi)}function Sg(i){if(i.kind==="owner")return 1;const e=In(i.score,0,1),t=In(1-(i.rank-1)/120,0,1),n=In(Math.log10(i.privateMessageCount+1)/4,0,1),r=In(Math.log10(i.groupMessageCount+1)/4.5,0,1),s=i.pool==="friend"?.12:0;return In(e*.36+t*.36+n*.18+r*.08+s,0,1)}function yg(i,e){let t=Math.max(i.size*.5,i.kind==="owner"?14:1.6);const n=Math.max(0,1-(i.rank-1)/50);return t+=Math.pow(n,1.35)*6,i.rank<=3?t+=2.5:i.rank<=10&&(t+=1.2),e==="selected"?t+5.5:e==="neighbor"?t+1.5:t}function Eg(i,e,t,n){return n?n.has(i.key)?e==="selected"||i.kind==="owner"?2:1:0:e==="selected"||i.labelVisibility===2||i.kind==="owner"?2:e==="neighbor"&&i.rank<=30||i.labelVisibility===1&&t<=300||i.rank<=6?1:0}function bg(i){return i==="selected"?1:i==="neighbor"?.95:i==="dimmed"?.1:.82}function Tg(i,e){if(i.length===0)return{minX:-500,maxX:500,minY:-500,maxY:500,minZ:-bi,maxZ:bi,width:1e3,height:1e3,depth:bi*2};let t=0,n=0,r=0;for(const l of i)t=Math.max(t,Math.abs(l.x)),n=Math.max(n,Math.abs(l.y)),r=Math.max(r,Math.abs(l.z));const s=Math.max(400,t,n,r);if(e)return{minX:-s,maxX:s,minY:-s,maxY:s,minZ:-s,maxZ:s,width:s*2,height:s*2,depth:s*2};const a=Math.max(400,t),o=Math.max(400,n),c=Math.max(400,r);return{minX:-a,maxX:a,minY:-o,maxY:o,minZ:-c,maxZ:c,width:a*2,height:o*2,depth:c*2}}function Ag(i){return i.kind==="owner"?hg:Rg(i)}function Rg(i){const e=i.pool==="friend"?ug:fg,t=ic(`${i.communityId}:${i.key}:${i.rank}:${i.pool}`)%e.length;return e[t]??e[0]}function fl(i){const e=Ca(`${i}:azimuth`)*Math.PI*2,t=Ca(`${i}:z`)*2-1,n=Math.sqrt(Math.max(0,1-t*t));return{x:Math.cos(e)*n,y:Math.sin(e)*n,z:t}}function wg(i){const e=Math.hypot(i.x,i.y,i.z);return e<=1e-4?{x:1,y:0,z:0}:{x:i.x/e,y:i.y/e,z:i.z/e}}function Ca(i){return ic(i)/4294967295}function ic(i){let e=2166136261;for(let t=0;t<i.length;t++)e^=i.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Fs(i,e=2){const t=10**e;return Math.round(i*t)/t}function In(i,e,t){return Math.min(t,Math.max(e,i))}const Cg=6;function Pg(i,e,t){const n=i.distanceTo(e);if(n<=.001)return[i.clone(),e.clone()];const r=e.clone().sub(i).normalize(),s=new D(0,1,0);Math.abs(r.y)>.9&&s.set(1,0,0);const a=new D().crossVectors(r,s).normalize(),o=new D().crossVectors(r,a).normalize(),c=Dg(a,o,t).multiplyScalar(Math.max(5,n*.08)),l=i.clone().lerp(e,.5).add(c);return new Vh(i,l,e).getPoints(Cg)}function Dg(i,e,t){const n=t*7.1%1-.5,r=t*13.3%1-.5,s=i.clone().multiplyScalar(n).add(e.clone().multiplyScalar(r));return s.lengthSq()<=1e-4?i.clone():s.normalize()}const Lg=new Be(16777215);function Ig(i,e,t,n,r){return i.copy(e).lerp(t,Ug(r)),i.lerp(Lg,Ng(n)),i.multiplyScalar(Fg(n)),i}function Ug(i){return i<=0?0:i>=1?1:i}function Ng(i){return i==="highlight"?.06:i==="normal"?.16:.26}function Fg(i){return i==="highlight"?1:i==="normal"?.56:.38}const dl=.9;function Og(i){const e=Math.max(i.width,i.height,i.depth,900);return{position:{x:0,y:-e*.5*dl,z:e*.5*dl},target:{x:0,y:0,z:0}}}function Bg(i,e){const t=gl(e),n=Math.max(1,e.viewportWidth);if(t<=0)return i;const r=kg({x:i.target.x-i.position.x,y:i.target.y-i.position.y,z:i.target.z-i.position.z}),s=Math.max(1,Hg(i.position,i.target)),a=Math.max(.001,(n-t)/n),o=s/a;return{position:Gg(i.target,Vg(r,-o)),target:i.target}}function zg(i){const e=Math.max(1,Math.floor(i.viewportWidth)),t=Math.max(1,Math.floor(i.viewportHeight)),n=Math.floor(gl(i));return n<=0?null:{fullWidth:e+n,fullHeight:t,offsetX:n,offsetY:0,width:e,height:t}}function Gg(i,e){return{x:i.x+e.x,y:i.y+e.y,z:i.z+e.z}}function Vg(i,e){return{x:i.x*e,y:i.y*e,z:i.z*e}}function Hg(i,e){return Math.hypot(i.x-e.x,i.y-e.y,i.z-e.z)}function kg(i){const e=Math.hypot(i.x,i.y,i.z);return e<=0?{x:1,y:0,z:0}:{x:i.x/e,y:i.y/e,z:i.z/e}}function Wg(i,e,t,n){return i.key===t?i.labelTier===2?2:1:e?n?.has(i.key)?i.key===e||i.node.kind==="owner"?2:1:0:i.labelTier}function Xg(i,e){const t=zg(e);if(!t){i.clearViewOffset();return}i.setViewOffset(t.fullWidth,t.fullHeight,t.offsetX,t.offsetY,t.width,t.height)}function Yg(i,e,t){return!i||!e?null:{kind:"3d",position:{x:i.x,y:i.y,z:i.z},target:{x:e.x,y:e.y,z:e.z},hasUserMovedCamera:t}}function qg(i){return!rc(i)||i.kind!=="3d"||typeof i.hasUserMovedCamera!="boolean"||!pl(i.position)||!pl(i.target)?null:{kind:"3d",position:i.position,target:i.target,hasUserMovedCamera:i.hasUserMovedCamera}}function pl(i){return rc(i)?typeof i.x=="number"&&Number.isFinite(i.x)&&typeof i.y=="number"&&Number.isFinite(i.y)&&typeof i.z=="number"&&Number.isFinite(i.z):!1}function rc(i){return typeof i=="object"&&i!==null}const Kg=["aria-label"],Zg={class:"pointer-events-none absolute inset-0 z-10 overflow-hidden"},$g=["onBlur","onClick","onFocus","onMouseenter","onMouseleave"],Jg=hc({__name:"RelationshipGalaxyThreeCanvas",props:{graph:{},selectedKey:{default:null},privacyMode:{type:Boolean,default:!1},safeInsetRight:{default:0},emphasizeEdges:{type:Boolean,default:!1},label:{},ownerLabel:{}},emits:["select-node","fallback"],setup(i,{expose:e,emit:t}){const n=i,r=t,s=no(null),a=Jr([]),o=no(null),c=Jr(ul(n.graph,{selectedKey:n.selectedKey})),l=Jr(null);let u=null,m=null,h=null,d=null,x=null,y=0,g=0,f=0,w=!1,C=null,M=null;const R=new Un,E=new Un,P=new Un,_=new Map,b=[],U=new Map,I=new Jh,B=new Ce,J=new D;function ee(T){return Ec(T,{privacyMode:n.privacyMode,ownerLabel:n.ownerLabel})}function V(){const T=s.value?.getBoundingClientRect();return{width:Math.max(1,Math.floor(T?.width??1)),height:Math.max(1,Math.floor(T?.height??1))}}function Z(T,F){const Y=(F.bounds.minX+F.bounds.maxX)/2,te=(F.bounds.minY+F.bounds.maxY)/2;return new D(T.x-Y,-(T.y-te),T.z)}function W(T=!1){if(!m||!h||!u)return;const F=ul(n.graph,{selectedKey:n.selectedKey});c.value=F,ne(),O(E),O(P),_.clear(),b.length=0,U.clear(),o.value=null,f=0,a.value=[];for(const Y of F.edges)U.has(Y.edge.sourceKey)||U.set(Y.edge.sourceKey,new Set),U.has(Y.edge.targetKey)||U.set(Y.edge.targetKey,new Set),U.get(Y.edge.sourceKey).add(Y.edge.targetKey),U.get(Y.edge.targetKey).add(Y.edge.sourceKey);re(F,"dim"),re(F,"normal"),re(F,"highlight");for(const Y of F.nodes){const te=Z(Y,F),fe=ke(Y,te);_.set(Y.key,fe),b.push(fe.core),P.add(fe.group)}(T||!w)&&L(),pt()}function ne(){l.value=n.selectedKey?ml(n.graph,n.selectedKey):null}function re(T,F){const Y=T.edges.filter(te=>F==="highlight"?te.highlighted:F==="dim"?te.alpha<=.05:!te.highlighted&&te.alpha>.05);if(Y.length!==0)for(const te of ye(Y,F))de(T,te.edges,F,te.linewidth)}function de(T,F,Y,te){const fe=new Hl({vertexColors:!0,transparent:!0,opacity:Y==="highlight"?.62:Y==="normal"?n.emphasizeEdges?.27:.21:.05,linewidth:te,blending:Fn,depthTest:!0,depthWrite:!1}),A=new Be,ie=new Be,X=new Be,ae=[],le=[];for(const pe of F){const Ke=Z(pe.source,T),$e=Z(pe.target,T),wt=Pg(Ke,$e,pe.source.seed+pe.target.seed),Nt=Math.max(1,wt.length-1);A.setHex(pe.source.color),ie.setHex(pe.target.color);for(let Sn=0;Sn<wt.length-1;Sn+=1){const Di=wt[Sn],jn=wt[Sn+1];ae.push(Di.x,Di.y,Di.z,jn.x,jn.y,jn.z),ge(le,X,A,ie,Y,Sn/Nt),ge(le,X,A,ie,Y,(Sn+1)/Nt)}}if(ae.length===0){fe.dispose();return}const $=new Xt;$.setAttribute("position",new zt(ae,3)),$.setAttribute("color",new zt(le,3));const ve=new Uh($,fe);ve.frustumCulled=!1,E.add(ve)}function ge(T,F,Y,te,fe,A){Ig(F,Y,te,fe,A),T.push(F.r,F.g,F.b)}function ye(T,F){const Y=new Map;for(const te of T){const fe=He(te,F),A=Y.get(fe)??[];A.push(te),Y.set(fe,A)}return[...Y.entries()].map(([te,fe])=>({linewidth:te,edges:fe}))}function He(T,F){return F==="highlight"?T.width>=2?2:1.65:F==="dim"?.55:T.width>=1.2?1.12:T.width>=.95?.96:.82}function it(T){return T.state==="selected"?2.18:T.node.kind==="owner"?2.04:T.node.rank<=10?1.76:1.52}function ke(T,F){const Y=new Un;Y.position.copy(F);const te=new Rh(new Bl({map:K(T.color,Math.floor(T.seed*8)),color:16777215,transparent:!0,opacity:T.opacity,blending:Fn,depthWrite:!1,alphaTest:.02}));return te.scale.setScalar(T.radius*it(T)),te.userData.key=T.key,Y.add(te),{group:Y,core:te,sceneNode:T,basePosition:F,phase:T.seed*Math.PI*2}}function j(){if(!u||!m||!h||!d)return;const T=performance.now()-g;ue();const F=w?.003:.008;R.rotation.y=Math.sin(T/25e3)*F,R.rotation.x=Math.cos(T/3e4)*F*.4;const Y=o.value||n.selectedKey;for(const te of _.values()){const fe=T/1e3+te.phase,A=te.sceneNode.key===n.selectedKey,ie=te.sceneNode.key===Y,X=!!(Y&&U.get(Y)?.has(te.sceneNode.key)),ae=A?.3:.8,le=o.value===te.sceneNode.key?1.28:1,$=A?1.22:1,ve=X?1.08:1;te.group.position.set(te.basePosition.x+Math.sin(fe*.3)*2*ae,te.basePosition.y+Math.cos(fe*.25)*1.5*ae,te.basePosition.z+Math.sin(fe*.2)*4*ae),te.group.scale.setScalar((1+Math.sin(fe*.8)*.006)*le*$*ve);const pe=te.core.material;let Ke=te.sceneNode.opacity;Y&&(ie?Ke=1:X?Ke=.85:Ke=.1),pe.opacity+=(Ke-pe.opacity)*.16}d.update(),se(),u.render(m,h),y=requestAnimationFrame(j)}function ue(){if(!d||!h||!M)return;const T=Math.min(1,(performance.now()-M.startedAt)/M.duration),F=q(T);h.position.lerpVectors(M.fromPosition,M.toPosition,F),d.target.lerpVectors(M.fromTarget,M.toTarget,F),T>=1&&(M=null)}function se(){if(!u||!h||(f+=1,f%2!==0))return;const{width:T,height:F}=V(),Y=[],te=n.selectedKey,fe=te?U.get(te):null;for(const A of _.values()){const ie=A.sceneNode.key===te,X=!!(te&&fe?.has(A.sceneNode.key)),ae=Wg(A.sceneNode,te??null,o.value,l.value);if(ae===0)continue;A.group.getWorldPosition(J);const le=J.clone().project(h);if(le.z<-1||le.z>1)continue;const $=(le.x*.5+.5)*T,ve=(-le.y*.5+.5)*F;$<-80||$>T+80||ve<-40||ve>F+40||Y.push({key:A.sceneNode.key,text:ee(A.sceneNode.node),x:$,y:ve+A.sceneNode.radius+8,opacity:ie?1:Math.max(.42,A.core.material.opacity),selected:ie,emphasis:Pe(A.sceneNode,X,ae)})}a.value=Y}function Pe(T,F=!1,Y=T.labelTier){return Y===2||T.node.kind==="owner"||T.node.rank<=5?"major":F||T.node.rank<=30?"medium":"minor"}async function De(){const T=s.value;if(!T||u)return;const F=V();m=new Sh,m.fog=new Va(656643,32e-5),h=new Ht(45,F.width/F.height,1,3e4),h.position.set(0,-150,900);try{u=new Zm({antialias:!0,alpha:!0,powerPreference:"high-performance"})}catch(Y){console.warn("relationship galaxy 3d renderer unavailable",Y),r("fallback");return}u.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),u.setSize(F.width,F.height),u.outputColorSpace=It,u.domElement.className="h-full w-full",T.appendChild(u.domElement),d=new Jm(h,u.domElement),d.enableDamping=!0,d.dampingFactor=.055,d.rotateSpeed=.34,d.zoomSpeed=.72,d.panSpeed=.58,d.minDistance=160,d.maxDistance=9e3,d.addEventListener("start",()=>{w=!0,M=null}),R.add(E),R.add(P),m.add(R),u.domElement.addEventListener("pointermove",rt),u.domElement.addEventListener("pointerleave",Ne),u.domElement.addEventListener("click",qe),x=new ResizeObserver(Re),x.observe(T),W(!0),g=performance.now(),y=requestAnimationFrame(j)}function Re(){if(!u||!h)return;const T=V();h.aspect=T.width/T.height,u.setSize(T.width,T.height),Xe(T)}function rt(T){if(!u||!h)return;const F=u.domElement.getBoundingClientRect();B.x=(T.clientX-F.left)/F.width*2-1,B.y=-((T.clientY-F.top)/F.height)*2+1,I.setFromCamera(B,h);const[Y]=I.intersectObjects(b,!1);o.value=typeof Y?.object.userData.key=="string"?Y.object.userData.key:null}function Ne(){o.value=null}function qe(){const T=o.value;if(!T)return;const F=_.get(T);F&&r("select-node",F.sceneNode.node)}function We(T){const F=_.get(T);F&&r("select-node",F.sceneNode.node)}function ze(T){o.value=T}function ot(T){o.value===T&&(o.value=null)}function ut(T){T.preventDefault(),T.stopPropagation();const F=u?.domElement;F&&F.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:T.clientX,clientY:T.clientY,ctrlKey:T.ctrlKey,deltaMode:T.deltaMode,deltaX:T.deltaX,deltaY:T.deltaY,deltaZ:T.deltaZ,metaKey:T.metaKey,screenX:T.screenX,screenY:T.screenY,shiftKey:T.shiftKey}))}function pt(){if(!C)return;const T=C;if(!_.has(T)){C=null;return}mt(T)}function mt(T){if(!h||!d)return C=T,!1;const F=_.get(T);if(!F)return C=T,!1;C=null,w=!0;const Y=F.basePosition.clone(),te=Math.max(180,Math.min(600,c.value.bounds.width*.18)),fe=St({position:S(Y.clone().add(new D(0,-te*.25,te))),target:S(Y)});return p(new D(fe.position.x,fe.position.y,fe.position.z),new D(fe.target.x,fe.target.y,fe.target.z),540),!0}function st(){return Yg(h?.position,d?.target,w)}function lt(T){const F=qg(T);return!F||!h||!d?!1:(C=null,w=F.hasUserMovedCamera,Xe(),p(new D(F.position.x,F.position.y,F.position.z),new D(F.target.x,F.target.y,F.target.z),620),!0)}function L(){if(!h||!d)return;w=!1;const T=St(Og(c.value.bounds));p(new D(T.position.x,T.position.y,T.position.z),new D(T.target.x,T.target.y,T.target.z),620)}function St(T){const F=V();return Xe(F),Bg(T,{viewportWidth:F.width,viewportHeight:F.height,safeInsetRight:n.safeInsetRight,fovDegrees:h?.fov??45})}function Xe(T=V()){h&&Xg(h,{viewportWidth:T.width,viewportHeight:T.height,safeInsetRight:n.safeInsetRight})}function S(T){return{x:T.x,y:T.y,z:T.z}}function p(T,F,Y){!h||!d||(M={startedAt:performance.now(),duration:Y,fromPosition:h.position.clone(),toPosition:T,fromTarget:d.target.clone(),toTarget:F})}function O(T){for(;T.children.length>0;){const F=T.children.pop();F&&H(F)}}function H(T){T.traverse(F=>{const Y=F;if(Y.geometry?.dispose(),Array.isArray(Y.material))for(const te of Y.material)te.dispose();else Y.material?.dispose()})}function q(T){return T<.5?4*T*T*T:1-Math.pow(-2*T+2,3)/2}function oe(T){const F=Math.sin(T*12.9898)*43758.5453;return F-Math.floor(F)}const ce=new Map;function K(T,F){const te=`star:${T.toString(16).padStart(6,"0")}:${F}`,fe=ce.get(te);if(fe)return fe;const A=document.createElement("canvas");A.width=128,A.height=128;const ie=A.getContext("2d");if(!ie)throw new Error("failed to create galaxy texture context");const X=new Be(T),ae=1.04+oe(F+4.2)*.06,le=.94+oe(F+9.8)*.05,$=(oe(F+17.4)-.5)*.32,ve=.18+oe(F+21.7)*.12;Q(ie,ae,le,$,38,[[0,"rgba(255,255,255,0.1)"],[.26,Ee(X,.16)],[.58,Ee(X,.04)],[1,"rgba(255,255,255,0)"]]),he(ie,$,48,2.2,ve,X),he(ie,$+Math.PI/2,32,1.35,ve*.62,X),F%3===0&&he(ie,$+Math.PI/4,22,.9,ve*.34,X),Q(ie,ae,le,$,18,[[0,"rgba(255,255,255,1)"],[.28,"rgba(255,255,255,0.94)"],[.54,Ee(X,.95)],[.78,Ee(X,.38)],[1,"rgba(255,255,255,0)"]]);const pe=new Nh(A);return pe.colorSpace=It,ce.set(te,pe),pe}function Q(T,F,Y,te,fe,A){T.save(),T.translate(64,64),T.rotate(te),T.scale(F,Y);const ie=T.createRadialGradient(0,0,0,0,0,fe);for(const[X,ae]of A)ie.addColorStop(X,ae);T.fillStyle=ie,T.beginPath(),T.arc(0,0,fe,0,Math.PI*2),T.fill(),T.restore()}function he(T,F,Y,te,fe,A){T.save(),T.translate(64,64),T.rotate(F);const ie=T.createLinearGradient(-Y,0,Y,0);ie.addColorStop(0,"rgba(255,255,255,0)"),ie.addColorStop(.43,Ee(A,fe*.32)),ie.addColorStop(.5,`rgba(255,255,255,${fe})`),ie.addColorStop(.57,Ee(A,fe*.32)),ie.addColorStop(1,"rgba(255,255,255,0)"),T.fillStyle=ie,T.fillRect(-Y,-te/2,Y*2,te),T.restore()}function Ee(T,F){return`rgba(${Math.round(T.r*255)},${Math.round(T.g*255)},${Math.round(T.b*255)},${F})`}return uc(async()=>{await fc(),await De()}),$i(()=>n.graph,()=>{W(!1)},{flush:"post"}),$i(()=>n.selectedKey,()=>{W(!1)},{flush:"post"}),$i(()=>n.emphasizeEdges,()=>{W(!1)},{flush:"post"}),$i(()=>n.privacyMode,()=>{f=1,se()},{flush:"post"}),dc(()=>{y&&cancelAnimationFrame(y),x?.disconnect(),x=null,u&&(u.domElement.removeEventListener("pointermove",rt),u.domElement.removeEventListener("pointerleave",Ne),u.domElement.removeEventListener("click",qe)),O(E),O(P);for(const T of ce.values())T.dispose();ce.clear(),R.clear(),m?.clear(),d?.dispose(),u?.dispose(),u?.domElement.remove(),u=null,m=null,h=null,d=null,a.value=[]}),e({focusNode:mt,fitView:L,captureView:st,restoreView:lt}),(T,F)=>(Qr(),jr("div",{ref_key:"canvasRoot",ref:s,class:"relationship-galaxy-3d relative h-full w-full overflow-hidden",role:"img","aria-label":i.label},[pc("div",Zg,[(Qr(!0),jr(mc,null,gc(a.value,Y=>(Qr(),jr("button",{key:Y.key,type:"button",class:vc(["relationship-galaxy-3d__label",[`relationship-galaxy-3d__label--${Y.emphasis}`,{"relationship-galaxy-3d__label--selected":Y.selected}]]),style:xc({left:`${Y.x}px`,top:`${Y.y}px`,opacity:Y.opacity}),onBlur:te=>ot(Y.key),onClick:_c(te=>We(Y.key),["stop"]),onFocus:te=>ze(Y.key),onMouseenter:te=>ze(Y.key),onMouseleave:te=>ot(Y.key),onWheel:ut},Mc(Y.text),47,$g))),128))])],8,Kg))}}),r_=Sc(Jg,[["__scopeId","data-v-b6c9d005"]]);export{r_ as default};
|
|
4108
|
+
}`;class Vm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Wl(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ln({vertexShader:zm,fragmentShader:Gm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Mn(new Yr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Hm extends zn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,u=null,m=null,h=null,d=null,x=null;const y=typeof XRWebGLBinding<"u",_=new Vm,f={},w=t.getContextAttributes();let C=null,M=null;const R=[],E=[],P=new Ce;let g=null;const b=new Ht;b.viewport=new ht;const U=new Ht;U.viewport=new ht;const I=[b,U],B=new Zh;let J=null,ee=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ue=R[j];return ue===void 0&&(ue=new cs,R[j]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(j){let ue=R[j];return ue===void 0&&(ue=new cs,R[j]=ue),ue.getGripSpace()},this.getHand=function(j){let ue=R[j];return ue===void 0&&(ue=new cs,R[j]=ue),ue.getHandSpace()};function V(j){const ue=E.indexOf(j.inputSource);if(ue===-1)return;const ae=R[ue];ae!==void 0&&(ae.update(j.inputSource,j.frame,l||a),ae.dispatchEvent({type:j.type,data:j.inputSource}))}function Z(){r.removeEventListener("select",V),r.removeEventListener("selectstart",V),r.removeEventListener("selectend",V),r.removeEventListener("squeeze",V),r.removeEventListener("squeezestart",V),r.removeEventListener("squeezeend",V),r.removeEventListener("end",Z),r.removeEventListener("inputsourceschange",W);for(let j=0;j<R.length;j++){const ue=E[j];ue!==null&&(E[j]=null,R[j].disconnect(ue))}J=null,ee=null,_.reset();for(const j in f)delete f[j];e.setRenderTarget(C),d=null,h=null,m=null,r=null,M=null,We.stop(),n.isPresenting=!1,e.setPixelRatio(g),e.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(j){s=j,n.isPresenting===!0&&we("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(j){o=j,n.isPresenting===!0&&we("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(j){l=j},this.getBaseLayer=function(){return h!==null?h:d},this.getBinding=function(){return m===null&&y&&(m=new XRWebGLBinding(r,t)),m},this.getFrame=function(){return x},this.getSession=function(){return r},this.setSession=async function(j){if(r=j,r!==null){if(C=e.getRenderTarget(),r.addEventListener("select",V),r.addEventListener("selectstart",V),r.addEventListener("selectend",V),r.addEventListener("squeeze",V),r.addEventListener("squeezestart",V),r.addEventListener("squeezeend",V),r.addEventListener("end",Z),r.addEventListener("inputsourceschange",W),w.xrCompatible!==!0&&await t.makeXRCompatible(),g=e.getPixelRatio(),e.getSize(P),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let ae=null,Pe=null,De=null;w.depth&&(De=w.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ae=w.stencil?Kn:vn,Pe=w.stencil?Xi:on);const Re={colorFormat:t.RGBA8,depthFormat:De,scaleFactor:s};m=this.getBinding(),h=m.createProjectionLayer(Re),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),M=new an(h.textureWidth,h.textureHeight,{format:Zt,type:kt,depthTexture:new Ri(h.textureWidth,h.textureHeight,Pe,void 0,void 0,void 0,void 0,void 0,void 0,ae),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const ae={antialias:w.antialias,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,ae),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new an(d.framebufferWidth,d.framebufferHeight,{format:Zt,type:kt,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),We.setContext(r),We.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function W(j){for(let ue=0;ue<j.removed.length;ue++){const ae=j.removed[ue],Pe=E.indexOf(ae);Pe>=0&&(E[Pe]=null,R[Pe].disconnect(ae))}for(let ue=0;ue<j.added.length;ue++){const ae=j.added[ue];let Pe=E.indexOf(ae);if(Pe===-1){for(let Re=0;Re<R.length;Re++)if(Re>=E.length){E.push(ae),Pe=Re;break}else if(E[Re]===null){E[Re]=ae,Pe=Re;break}if(Pe===-1)break}const De=R[Pe];De&&De.connect(ae)}}const ne=new D,re=new D;function de(j,ue,ae){ne.setFromMatrixPosition(ue.matrixWorld),re.setFromMatrixPosition(ae.matrixWorld);const Pe=ne.distanceTo(re),De=ue.projectionMatrix.elements,Re=ae.projectionMatrix.elements,rt=De[14]/(De[10]-1),Ne=De[14]/(De[10]+1),qe=(De[9]+1)/De[5],Xe=(De[9]-1)/De[5],ze=(De[8]-1)/De[0],ot=(Re[8]+1)/Re[0],ut=rt*ze,pt=rt*ot,mt=Pe/(-ze+ot),st=mt*-ze;if(ue.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(st),j.translateZ(mt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert(),De[10]===-1)j.projectionMatrix.copy(ue.projectionMatrix),j.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const lt=rt+mt,L=Ne+mt,St=ut-st,He=pt+(Pe-st),S=qe*Ne/L*lt,p=Xe*Ne/L*lt;j.projectionMatrix.makePerspective(St,He,S,p,lt,L),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}}function _e(j,ue){ue===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ue.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(r===null)return;let ue=j.near,ae=j.far;_.texture!==null&&(_.depthNear>0&&(ue=_.depthNear),_.depthFar>0&&(ae=_.depthFar)),B.near=U.near=b.near=ue,B.far=U.far=b.far=ae,(J!==B.near||ee!==B.far)&&(r.updateRenderState({depthNear:B.near,depthFar:B.far}),J=B.near,ee=B.far),B.layers.mask=j.layers.mask|6,b.layers.mask=B.layers.mask&-5,U.layers.mask=B.layers.mask&-3;const Pe=j.parent,De=B.cameras;_e(B,Pe);for(let Re=0;Re<De.length;Re++)_e(De[Re],Pe);De.length===2?de(B,b,U):B.projectionMatrix.copy(b.projectionMatrix),ye(j,B,Pe)};function ye(j,ue,ae){ae===null?j.matrix.copy(ue.matrixWorld):(j.matrix.copy(ae.matrixWorld),j.matrix.invert(),j.matrix.multiply(ue.matrixWorld)),j.matrix.decompose(j.position,j.quaternion,j.scale),j.updateMatrixWorld(!0),j.projectionMatrix.copy(ue.projectionMatrix),j.projectionMatrixInverse.copy(ue.projectionMatrixInverse),j.isPerspectiveCamera&&(j.fov=Ta*2*Math.atan(1/j.projectionMatrix.elements[5]),j.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(h===null&&d===null))return c},this.setFoveation=function(j){c=j,h!==null&&(h.fixedFoveation=j),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=j)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(B)},this.getCameraTexture=function(j){return f[j]};let ke=null;function it(j,ue){if(u=ue.getViewerPose(l||a),x=ue,u!==null){const ae=u.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let Pe=!1;ae.length!==B.cameras.length&&(B.cameras.length=0,Pe=!0);for(let Ne=0;Ne<ae.length;Ne++){const qe=ae[Ne];let Xe=null;if(d!==null)Xe=d.getViewport(qe);else{const ot=m.getViewSubImage(h,qe);Xe=ot.viewport,Ne===0&&(e.setRenderTargetTextures(M,ot.colorTexture,ot.depthStencilTexture),e.setRenderTarget(M))}let ze=I[Ne];ze===void 0&&(ze=new Ht,ze.layers.enable(Ne),ze.viewport=new ht,I[Ne]=ze),ze.matrix.fromArray(qe.transform.matrix),ze.matrix.decompose(ze.position,ze.quaternion,ze.scale),ze.projectionMatrix.fromArray(qe.projectionMatrix),ze.projectionMatrixInverse.copy(ze.projectionMatrix).invert(),ze.viewport.set(Xe.x,Xe.y,Xe.width,Xe.height),Ne===0&&(B.matrix.copy(ze.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),Pe===!0&&B.cameras.push(ze)}const De=r.enabledFeatures;if(De&&De.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&y){m=n.getBinding();const Ne=m.getDepthInformation(ae[0]);Ne&&Ne.isValid&&Ne.texture&&_.init(Ne,r.renderState)}if(De&&De.includes("camera-access")&&y){e.state.unbindTexture(),m=n.getBinding();for(let Ne=0;Ne<ae.length;Ne++){const qe=ae[Ne].camera;if(qe){let Xe=f[qe];Xe||(Xe=new Wl,f[qe]=Xe);const ze=m.getCameraImage(qe);Xe.sourceTexture=ze}}}}for(let ae=0;ae<R.length;ae++){const Pe=E[ae],De=R[ae];Pe!==null&&De!==void 0&&De.update(Pe,ue,l||a)}ke&&ke(j,ue),ue.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ue}),x=null}const We=new Kl;We.setAnimationLoop(it),this.setAnimationLoop=function(j){ke=j},this.dispose=function(){}}}const km=new at,tc=new Le;tc.set(-1,0,0,0,1,0,0,0,1);function Wm(i,e){function t(_,f){_.matrixAutoUpdate===!0&&_.updateMatrix(),f.value.copy(_.matrix)}function n(_,f){f.color.getRGB(_.fogColor.value,Xl(i)),f.isFog?(_.fogNear.value=f.near,_.fogFar.value=f.far):f.isFogExp2&&(_.fogDensity.value=f.density)}function r(_,f,w,C,M){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?s(_,f):f.isMeshLambertMaterial?(s(_,f),f.envMap&&(_.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(s(_,f),m(_,f)):f.isMeshPhongMaterial?(s(_,f),u(_,f),f.envMap&&(_.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(s(_,f),h(_,f),f.isMeshPhysicalMaterial&&d(_,f,M)):f.isMeshMatcapMaterial?(s(_,f),x(_,f)):f.isMeshDepthMaterial?s(_,f):f.isMeshDistanceMaterial?(s(_,f),y(_,f)):f.isMeshNormalMaterial?s(_,f):f.isLineBasicMaterial?(a(_,f),f.isLineDashedMaterial&&o(_,f)):f.isPointsMaterial?c(_,f,w,C):f.isSpriteMaterial?l(_,f):f.isShadowMaterial?(_.color.value.copy(f.color),_.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(_,f){_.opacity.value=f.opacity,f.color&&_.diffuse.value.copy(f.color),f.emissive&&_.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(_.map.value=f.map,t(f.map,_.mapTransform)),f.alphaMap&&(_.alphaMap.value=f.alphaMap,t(f.alphaMap,_.alphaMapTransform)),f.bumpMap&&(_.bumpMap.value=f.bumpMap,t(f.bumpMap,_.bumpMapTransform),_.bumpScale.value=f.bumpScale,f.side===Ut&&(_.bumpScale.value*=-1)),f.normalMap&&(_.normalMap.value=f.normalMap,t(f.normalMap,_.normalMapTransform),_.normalScale.value.copy(f.normalScale),f.side===Ut&&_.normalScale.value.negate()),f.displacementMap&&(_.displacementMap.value=f.displacementMap,t(f.displacementMap,_.displacementMapTransform),_.displacementScale.value=f.displacementScale,_.displacementBias.value=f.displacementBias),f.emissiveMap&&(_.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,_.emissiveMapTransform)),f.specularMap&&(_.specularMap.value=f.specularMap,t(f.specularMap,_.specularMapTransform)),f.alphaTest>0&&(_.alphaTest.value=f.alphaTest);const w=e.get(f),C=w.envMap,M=w.envMapRotation;C&&(_.envMap.value=C,_.envMapRotation.value.setFromMatrix4(km.makeRotationFromEuler(M)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&_.envMapRotation.value.premultiply(tc),_.reflectivity.value=f.reflectivity,_.ior.value=f.ior,_.refractionRatio.value=f.refractionRatio),f.lightMap&&(_.lightMap.value=f.lightMap,_.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,_.lightMapTransform)),f.aoMap&&(_.aoMap.value=f.aoMap,_.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,_.aoMapTransform))}function a(_,f){_.diffuse.value.copy(f.color),_.opacity.value=f.opacity,f.map&&(_.map.value=f.map,t(f.map,_.mapTransform))}function o(_,f){_.dashSize.value=f.dashSize,_.totalSize.value=f.dashSize+f.gapSize,_.scale.value=f.scale}function c(_,f,w,C){_.diffuse.value.copy(f.color),_.opacity.value=f.opacity,_.size.value=f.size*w,_.scale.value=C*.5,f.map&&(_.map.value=f.map,t(f.map,_.uvTransform)),f.alphaMap&&(_.alphaMap.value=f.alphaMap,t(f.alphaMap,_.alphaMapTransform)),f.alphaTest>0&&(_.alphaTest.value=f.alphaTest)}function l(_,f){_.diffuse.value.copy(f.color),_.opacity.value=f.opacity,_.rotation.value=f.rotation,f.map&&(_.map.value=f.map,t(f.map,_.mapTransform)),f.alphaMap&&(_.alphaMap.value=f.alphaMap,t(f.alphaMap,_.alphaMapTransform)),f.alphaTest>0&&(_.alphaTest.value=f.alphaTest)}function u(_,f){_.specular.value.copy(f.specular),_.shininess.value=Math.max(f.shininess,1e-4)}function m(_,f){f.gradientMap&&(_.gradientMap.value=f.gradientMap)}function h(_,f){_.metalness.value=f.metalness,f.metalnessMap&&(_.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,_.metalnessMapTransform)),_.roughness.value=f.roughness,f.roughnessMap&&(_.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,_.roughnessMapTransform)),f.envMap&&(_.envMapIntensity.value=f.envMapIntensity)}function d(_,f,w){_.ior.value=f.ior,f.sheen>0&&(_.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),_.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(_.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,_.sheenColorMapTransform)),f.sheenRoughnessMap&&(_.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,_.sheenRoughnessMapTransform))),f.clearcoat>0&&(_.clearcoat.value=f.clearcoat,_.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(_.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,_.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(_.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ut&&_.clearcoatNormalScale.value.negate())),f.dispersion>0&&(_.dispersion.value=f.dispersion),f.iridescence>0&&(_.iridescence.value=f.iridescence,_.iridescenceIOR.value=f.iridescenceIOR,_.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(_.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,_.iridescenceMapTransform)),f.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),f.transmission>0&&(_.transmission.value=f.transmission,_.transmissionSamplerMap.value=w.texture,_.transmissionSamplerSize.value.set(w.width,w.height),f.transmissionMap&&(_.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,_.transmissionMapTransform)),_.thickness.value=f.thickness,f.thicknessMap&&(_.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=f.attenuationDistance,_.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(_.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(_.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=f.specularIntensity,_.specularColor.value.copy(f.specularColor),f.specularColorMap&&(_.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,_.specularColorMapTransform)),f.specularIntensityMap&&(_.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,_.specularIntensityMapTransform))}function x(_,f){f.matcap&&(_.matcap.value=f.matcap)}function y(_,f){const w=e.get(f).light;_.referencePosition.value.setFromMatrixPosition(w.matrixWorld),_.nearDistance.value=w.shadow.camera.near,_.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Xm(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(M,R){const E=R.program;n.uniformBlockBinding(M,E)}function l(M,R){let E=r[M.id];E===void 0&&(_(M),E=u(M),r[M.id]=E,M.addEventListener("dispose",w));const P=R.program;n.updateUBOMapping(M,P);const g=e.render.frame;s[M.id]!==g&&(h(M),s[M.id]=g)}function u(M){const R=m();M.__bindingPointIndex=R;const E=i.createBuffer(),P=M.__size,g=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,E),i.bufferData(i.UNIFORM_BUFFER,P,g),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,R,E),E}function m(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(M){const R=r[M.id],E=M.uniforms,P=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,R);for(let g=0,b=E.length;g<b;g++){const U=E[g];if(Array.isArray(U))for(let I=0,B=U.length;I<B;I++)d(U[I],g,I,P);else d(U,g,0,P)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function d(M,R,E,P){if(y(M,R,E,P)===!0){const g=M.__offset,b=M.value;if(Array.isArray(b)){let U=0;for(let I=0;I<b.length;I++){const B=b[I],J=f(B);x(B,M.__data,U),typeof B!="number"&&typeof B!="boolean"&&!B.isMatrix3&&!ArrayBuffer.isView(B)&&(U+=J.storage/Float32Array.BYTES_PER_ELEMENT)}}else x(b,M.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,g,M.__data)}}function x(M,R,E){typeof M=="number"||typeof M=="boolean"?R[0]=M:M.isMatrix3?(R[0]=M.elements[0],R[1]=M.elements[1],R[2]=M.elements[2],R[3]=0,R[4]=M.elements[3],R[5]=M.elements[4],R[6]=M.elements[5],R[7]=0,R[8]=M.elements[6],R[9]=M.elements[7],R[10]=M.elements[8],R[11]=0):ArrayBuffer.isView(M)?R.set(new M.constructor(M.buffer,M.byteOffset,R.length)):M.toArray(R,E)}function y(M,R,E,P){const g=M.value,b=R+"_"+E;if(P[b]===void 0)return typeof g=="number"||typeof g=="boolean"?P[b]=g:ArrayBuffer.isView(g)?P[b]=g.slice():P[b]=g.clone(),!0;{const U=P[b];if(typeof g=="number"||typeof g=="boolean"){if(U!==g)return P[b]=g,!0}else{if(ArrayBuffer.isView(g))return!0;if(U.equals(g)===!1)return U.copy(g),!0}}return!1}function _(M){const R=M.uniforms;let E=0;const P=16;for(let b=0,U=R.length;b<U;b++){const I=Array.isArray(R[b])?R[b]:[R[b]];for(let B=0,J=I.length;B<J;B++){const ee=I[B],V=Array.isArray(ee.value)?ee.value:[ee.value];for(let Z=0,W=V.length;Z<W;Z++){const ne=V[Z],re=f(ne),de=E%P,_e=de%re.boundary,ye=de+_e;E+=_e,ye!==0&&P-ye<re.storage&&(E+=P-ye),ee.__data=new Float32Array(re.storage/Float32Array.BYTES_PER_ELEMENT),ee.__offset=E,E+=re.storage}}}const g=E%P;return g>0&&(E+=P-g),M.__size=E,M.__cache={},this}function f(M){const R={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(R.boundary=4,R.storage=4):M.isVector2?(R.boundary=8,R.storage=8):M.isVector3||M.isColor?(R.boundary=16,R.storage=12):M.isVector4?(R.boundary=16,R.storage=16):M.isMatrix3?(R.boundary=48,R.storage=48):M.isMatrix4?(R.boundary=64,R.storage=64):M.isTexture?we("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(R.boundary=16,R.storage=M.byteLength):we("WebGLRenderer: Unsupported uniform value type.",M),R}function w(M){const R=M.target;R.removeEventListener("dispose",w);const E=a.indexOf(R.__bindingPointIndex);a.splice(E,1),i.deleteBuffer(r[R.id]),delete r[R.id],delete s[R.id]}function C(){for(const M in r)i.deleteBuffer(r[M]);a=[],r={},s={}}return{bind:c,update:l,dispose:C}}const Ym=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let jt=null;function qm(){return jt===null&&(jt=new wh(Ym,16,16,Jn,xn),jt.name="DFG_LUT",jt.minFilter=At,jt.magFilter=At,jt.wrapS=mn,jt.wrapT=mn,jt.generateMipmaps=!1,jt.needsUpdate=!0),jt}class Km{constructor(e={}){const{canvas:t=nh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:h=!1,outputBufferType:d=kt}=e;this.isWebGLRenderer=!0;let x;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");x=n.getContextAttributes().alpha}else x=a;const y=d,_=new Set([Fa,Na,Ua]),f=new Set([kt,on,Wi,Xi,La,Ia]),w=new Uint32Array(4),C=new Int32Array(4),M=new D;let R=null,E=null;const P=[],g=[];let b=null;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=sn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const U=this;let I=!1,B=null,J=null,ee=null,V=null;this._outputColorSpace=It;let Z=0,W=0,ne=null,re=-1,de=null;const _e=new ht,ye=new ht;let ke=null;const it=new Be(0);let We=0,j=t.width,ue=t.height,ae=1,Pe=null,De=null;const Re=new ht(0,0,j,ue),rt=new ht(0,0,j,ue);let Ne=!1;const qe=new Vl;let Xe=!1,ze=!1;const ot=new at,ut=new D,pt=new ht,mt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let st=!1;function lt(){return ne===null?ae:1}let L=n;function St(v,N){return t.getContext(v,N)}try{const v={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:m};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Pa}`),t.addEventListener("webglcontextlost",Ke,!1),t.addEventListener("webglcontextrestored",$e,!1),t.addEventListener("webglcontextcreationerror",wt,!1),L===null){const N="webgl2";if(L=St(N,v),L===null)throw St(N)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(v){throw Ge("WebGLRenderer: "+v.message),v}let He,S,p,O,H,q,oe,ce,K,Q,he,Ee,T,F,Y,te,fe,A,ie,X,se,le,$;function ve(){He=new qd(L),He.init(),se=new Bm(L,He),S=new zd(L,He,e,se),p=new Fm(L,He),S.reversedDepthBuffer&&h&&p.buffers.depth.setReversed(!0),J=L.createFramebuffer(),ee=L.createFramebuffer(),V=L.createFramebuffer(),O=new $d(L),H=new ym,q=new Om(L,He,p,H,S,se,O),oe=new Yd(U),ce=new jh(L),le=new Od(L,ce),K=new Kd(L,ce,O,le),Q=new Qd(L,K,ce,le,O),A=new Jd(L,S,q),Y=new Gd(H),he=new Sm(U,oe,He,S,le,Y),Ee=new Wm(U,H),T=new bm,F=new Pm(He),fe=new Fd(U,oe,p,Q,x,c),te=new Nm(U,Q,S),$=new Xm(L,O,S,p),ie=new Bd(L,He,O),X=new Zd(L,He,O),O.programs=he.programs,U.capabilities=S,U.extensions=He,U.properties=H,U.renderLists=T,U.shadowMap=te,U.state=p,U.info=O}ve(),y!==kt&&(b=new ep(y,t.width,t.height,o,r,s));const pe=new Hm(U,L);this.xr=pe,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const v=He.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){const v=He.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return ae},this.setPixelRatio=function(v){v!==void 0&&(ae=v,this.setSize(j,ue,!1))},this.getSize=function(v){return v.set(j,ue)},this.setSize=function(v,N,k=!0){if(pe.isPresenting){we("WebGLRenderer: Can't change size while VR device is presenting.");return}j=v,ue=N,t.width=Math.floor(v*ae),t.height=Math.floor(N*ae),k===!0&&(t.style.width=v+"px",t.style.height=N+"px"),b!==null&&b.setSize(t.width,t.height),this.setViewport(0,0,v,N)},this.getDrawingBufferSize=function(v){return v.set(j*ae,ue*ae).floor()},this.setDrawingBufferSize=function(v,N,k){j=v,ue=N,ae=k,t.width=Math.floor(v*k),t.height=Math.floor(N*k),this.setViewport(0,0,v,N)},this.setEffects=function(v){if(y===kt){Ge("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let N=0;N<v.length;N++)if(v[N].isOutputPass===!0){we("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}b.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(_e)},this.getViewport=function(v){return v.copy(Re)},this.setViewport=function(v,N,k,z){v.isVector4?Re.set(v.x,v.y,v.z,v.w):Re.set(v,N,k,z),p.viewport(_e.copy(Re).multiplyScalar(ae).round())},this.getScissor=function(v){return v.copy(rt)},this.setScissor=function(v,N,k,z){v.isVector4?rt.set(v.x,v.y,v.z,v.w):rt.set(v,N,k,z),p.scissor(ye.copy(rt).multiplyScalar(ae).round())},this.getScissorTest=function(){return Ne},this.setScissorTest=function(v){p.setScissorTest(Ne=v)},this.setOpaqueSort=function(v){Pe=v},this.setTransparentSort=function(v){De=v},this.getClearColor=function(v){return v.copy(fe.getClearColor())},this.setClearColor=function(){fe.setClearColor(...arguments)},this.getClearAlpha=function(){return fe.getClearAlpha()},this.setClearAlpha=function(){fe.setClearAlpha(...arguments)},this.clear=function(v=!0,N=!0,k=!0){let z=0;if(v){let G=!1;if(ne!==null){const xe=ne.texture.format;G=_.has(xe)}if(G){const xe=ne.texture.type,Se=f.has(xe),ge=fe.getClearColor(),be=fe.getClearAlpha(),Te=ge.r,Ie=ge.g,Fe=ge.b;Se?(w[0]=Te,w[1]=Ie,w[2]=Fe,w[3]=be,L.clearBufferuiv(L.COLOR,0,w)):(C[0]=Te,C[1]=Ie,C[2]=Fe,C[3]=be,L.clearBufferiv(L.COLOR,0,C))}else z|=L.COLOR_BUFFER_BIT}N&&(z|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),k&&(z|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z!==0&&L.clear(z)},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.setNodesHandler=function(v){v.setRenderer(this),B=v},this.dispose=function(){t.removeEventListener("webglcontextlost",Ke,!1),t.removeEventListener("webglcontextrestored",$e,!1),t.removeEventListener("webglcontextcreationerror",wt,!1),fe.dispose(),T.dispose(),F.dispose(),H.dispose(),oe.dispose(),Q.dispose(),le.dispose(),$.dispose(),he.dispose(),pe.dispose(),pe.removeEventListener("sessionstart",Ka),pe.removeEventListener("sessionend",Za),Gn.stop()};function Ke(v){v.preventDefault(),Br("WebGLRenderer: Context Lost."),I=!0}function $e(){Br("WebGLRenderer: Context Restored."),I=!1;const v=O.autoReset,N=te.enabled,k=te.autoUpdate,z=te.needsUpdate,G=te.type;ve(),O.autoReset=v,te.enabled=N,te.autoUpdate=k,te.needsUpdate=z,te.type=G}function wt(v){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function Nt(v){const N=v.target;N.removeEventListener("dispose",Nt),Sn(N)}function Sn(v){Di(v),H.remove(v)}function Di(v){const N=H.get(v).programs;N!==void 0&&(N.forEach(function(k){he.releaseProgram(k)}),v.isShaderMaterial&&he.releaseShaderCache(v))}this.renderBufferDirect=function(v,N,k,z,G,xe){N===null&&(N=mt);const Se=G.isMesh&&G.matrixWorld.determinantAffine()<0,ge=oc(v,N,k,z,G);p.setMaterial(z,Se);let be=k.index,Te=1;if(z.wireframe===!0){if(be=K.getWireframeAttribute(k),be===void 0)return;Te=2}const Ie=k.drawRange,Fe=k.attributes.position;let Ae=Ie.start*Te,Je=(Ie.start+Ie.count)*Te;xe!==null&&(Ae=Math.max(Ae,xe.start*Te),Je=Math.min(Je,(xe.start+xe.count)*Te)),be!==null?(Ae=Math.max(Ae,0),Je=Math.min(Je,be.count)):Fe!=null&&(Ae=Math.max(Ae,0),Je=Math.min(Je,Fe.count));const ft=Je-Ae;if(ft<0||ft===1/0)return;le.setup(G,z,ge,k,be);let ct,et=ie;if(be!==null&&(ct=ce.get(be),et=X,et.setIndex(ct)),G.isMesh)z.wireframe===!0?(p.setLineWidth(z.wireframeLinewidth*lt()),et.setMode(L.LINES)):et.setMode(L.TRIANGLES);else if(G.isLine){let Et=z.linewidth;Et===void 0&&(Et=1),p.setLineWidth(Et*lt()),G.isLineSegments?et.setMode(L.LINES):G.isLineLoop?et.setMode(L.LINE_LOOP):et.setMode(L.LINE_STRIP)}else G.isPoints?et.setMode(L.POINTS):G.isSprite&&et.setMode(L.TRIANGLES);if(G.isBatchedMesh)if(He.get("WEBGL_multi_draw"))et.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else{const Et=G._multiDrawStarts,Me=G._multiDrawCounts,Ft=G._multiDrawCount,Ye=be?ce.get(be).bytesPerElement:1,Gt=H.get(z).currentProgram.getUniforms();for(let Jt=0;Jt<Ft;Jt++)Gt.setValue(L,"_gl_DrawID",Jt),et.render(Et[Jt]/Ye,Me[Jt])}else if(G.isInstancedMesh)et.renderInstances(Ae,ft,G.count);else if(k.isInstancedBufferGeometry){const Et=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,Me=Math.min(k.instanceCount,Et);et.renderInstances(Ae,ft,Me)}else et.render(Ae,ft)};function jn(v,N,k){v.transparent===!0&&v.side===pn&&v.forceSinglePass===!1?(v.side=Ut,v.needsUpdate=!0,Zi(v,N,k),v.side=On,v.needsUpdate=!0,Zi(v,N,k),v.side=pn):Zi(v,N,k)}this.compile=function(v,N,k=null){k===null&&(k=v),E=F.get(k),E.init(N),g.push(E),k.traverseVisible(function(G){G.isLight&&G.layers.test(N.layers)&&(E.pushLight(G),G.castShadow&&E.pushShadow(G))}),v!==k&&v.traverseVisible(function(G){G.isLight&&G.layers.test(N.layers)&&(E.pushLight(G),G.castShadow&&E.pushShadow(G))}),E.setupLights();const z=new Set;return v.traverse(function(G){if(!(G.isMesh||G.isPoints||G.isLine||G.isSprite))return;const xe=G.material;if(xe)if(Array.isArray(xe))for(let Se=0;Se<xe.length;Se++){const ge=xe[Se];jn(ge,k,G),z.add(ge)}else jn(xe,k,G),z.add(xe)}),E=g.pop(),z},this.compileAsync=function(v,N,k=null){const z=this.compile(v,N,k);return new Promise(G=>{function xe(){if(z.forEach(function(Se){H.get(Se).currentProgram.isReady()&&z.delete(Se)}),z.size===0){G(v);return}setTimeout(xe,10)}He.get("KHR_parallel_shader_compile")!==null?xe():setTimeout(xe,10)})};let Zr=null;function sc(v){Zr&&Zr(v)}function Ka(){Gn.stop()}function Za(){Gn.start()}const Gn=new Kl;Gn.setAnimationLoop(sc),typeof self<"u"&&Gn.setContext(self),this.setAnimationLoop=function(v){Zr=v,pe.setAnimationLoop(v),v===null?Gn.stop():Gn.start()},pe.addEventListener("sessionstart",Ka),pe.addEventListener("sessionend",Za),this.render=function(v,N){if(N!==void 0&&N.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;B!==null&&B.renderStart(v,N);const k=pe.enabled===!0&&pe.isPresenting===!0,z=b!==null&&(ne===null||k)&&b.begin(U,ne);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),pe.enabled===!0&&pe.isPresenting===!0&&(b===null||b.isCompositing()===!1)&&(pe.cameraAutoUpdate===!0&&pe.updateCamera(N),N=pe.getCamera()),v.isScene===!0&&v.onBeforeRender(U,v,N,ne),E=F.get(v,g.length),E.init(N),E.state.textureUnits=q.getTextureUnits(),g.push(E),ot.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),qe.setFromProjectionMatrix(ot,rn,N.reversedDepth),ze=this.localClippingEnabled,Xe=Y.init(this.clippingPlanes,ze),R=T.get(v,P.length),R.init(),P.push(R),pe.enabled===!0&&pe.isPresenting===!0){const Se=U.xr.getDepthSensingMesh();Se!==null&&$r(Se,N,-1/0,U.sortObjects)}$r(v,N,0,U.sortObjects),R.finish(),U.sortObjects===!0&&R.sort(Pe,De,N.reversedDepth),st=pe.enabled===!1||pe.isPresenting===!1||pe.hasDepthSensing()===!1,st&&fe.addToRenderList(R,v),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Xe===!0&&Y.beginShadows();const G=E.state.shadowsArray;if(te.render(G,v,N),Xe===!0&&Y.endShadows(),(z&&b.hasRenderPass())===!1){const Se=R.opaque,ge=R.transmissive;if(E.setupLights(),N.isArrayCamera){const be=N.cameras;if(ge.length>0)for(let Te=0,Ie=be.length;Te<Ie;Te++){const Fe=be[Te];Ja(Se,ge,v,Fe)}st&&fe.render(v);for(let Te=0,Ie=be.length;Te<Ie;Te++){const Fe=be[Te];$a(R,v,Fe,Fe.viewport)}}else ge.length>0&&Ja(Se,ge,v,N),st&&fe.render(v),$a(R,v,N)}ne!==null&&W===0&&(q.updateMultisampleRenderTarget(ne),q.updateRenderTargetMipmap(ne)),z&&b.end(U),v.isScene===!0&&v.onAfterRender(U,v,N),le.resetDefaultState(),re=-1,de=null,g.pop(),g.length>0?(E=g[g.length-1],q.setTextureUnits(E.state.textureUnits),Xe===!0&&Y.setGlobalState(U.clippingPlanes,E.state.camera)):E=null,P.pop(),P.length>0?R=P[P.length-1]:R=null,B!==null&&B.renderEnd()};function $r(v,N,k,z){if(v.visible===!1)return;if(v.layers.test(N.layers)){if(v.isGroup)k=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(N);else if(v.isLightProbeGrid)E.pushLightProbeGrid(v);else if(v.isLight)E.pushLight(v),v.castShadow&&E.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||qe.intersectsSprite(v)){z&&pt.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ot);const Se=Q.update(v),ge=v.material;ge.visible&&R.push(v,Se,ge,k,pt.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||qe.intersectsObject(v))){const Se=Q.update(v),ge=v.material;if(z&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),pt.copy(v.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),pt.copy(Se.boundingSphere.center)),pt.applyMatrix4(v.matrixWorld).applyMatrix4(ot)),Array.isArray(ge)){const be=Se.groups;for(let Te=0,Ie=be.length;Te<Ie;Te++){const Fe=be[Te],Ae=ge[Fe.materialIndex];Ae&&Ae.visible&&R.push(v,Se,Ae,k,pt.z,Fe)}}else ge.visible&&R.push(v,Se,ge,k,pt.z,null)}}const xe=v.children;for(let Se=0,ge=xe.length;Se<ge;Se++)$r(xe[Se],N,k,z)}function $a(v,N,k,z){const{opaque:G,transmissive:xe,transparent:Se}=v;E.setupLightsView(k),Xe===!0&&Y.setGlobalState(U.clippingPlanes,k),z&&p.viewport(_e.copy(z)),G.length>0&&Ki(G,N,k),xe.length>0&&Ki(xe,N,k),Se.length>0&&Ki(Se,N,k),p.buffers.depth.setTest(!0),p.buffers.depth.setMask(!0),p.buffers.color.setMask(!0),p.setPolygonOffset(!1)}function Ja(v,N,k,z){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;if(E.state.transmissionRenderTarget[z.id]===void 0){const Ae=He.has("EXT_color_buffer_half_float")||He.has("EXT_color_buffer_float");E.state.transmissionRenderTarget[z.id]=new an(1,1,{generateMipmaps:!0,type:Ae?xn:kt,minFilter:qn,samples:Math.max(4,S.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ve.workingColorSpace})}const xe=E.state.transmissionRenderTarget[z.id],Se=z.viewport||_e;xe.setSize(Se.z*U.transmissionResolutionScale,Se.w*U.transmissionResolutionScale);const ge=U.getRenderTarget(),be=U.getActiveCubeFace(),Te=U.getActiveMipmapLevel();U.setRenderTarget(xe),U.getClearColor(it),We=U.getClearAlpha(),We<1&&U.setClearColor(16777215,.5),U.clear(),st&&fe.render(k);const Ie=U.toneMapping;U.toneMapping=sn;const Fe=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),E.setupLightsView(z),Xe===!0&&Y.setGlobalState(U.clippingPlanes,z),Ki(v,k,z),q.updateMultisampleRenderTarget(xe),q.updateRenderTargetMipmap(xe),He.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let Je=0,ft=N.length;Je<ft;Je++){const ct=N[Je],{object:et,geometry:Et,material:Me,group:Ft}=ct;if(Me.side===pn&&et.layers.test(z.layers)){const Ye=Me.side;Me.side=Ut,Me.needsUpdate=!0,Qa(et,k,z,Et,Me,Ft),Me.side=Ye,Me.needsUpdate=!0,Ae=!0}}Ae===!0&&(q.updateMultisampleRenderTarget(xe),q.updateRenderTargetMipmap(xe))}U.setRenderTarget(ge,be,Te),U.setClearColor(it,We),Fe!==void 0&&(z.viewport=Fe),U.toneMapping=Ie}function Ki(v,N,k){const z=N.isScene===!0?N.overrideMaterial:null;for(let G=0,xe=v.length;G<xe;G++){const Se=v[G],{object:ge,geometry:be,group:Te}=Se;let Ie=Se.material;Ie.allowOverride===!0&&z!==null&&(Ie=z),ge.layers.test(k.layers)&&Qa(ge,N,k,be,Ie,Te)}}function Qa(v,N,k,z,G,xe){v.onBeforeRender(U,N,k,z,G,xe),v.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),G.onBeforeRender(U,N,k,z,v,xe),G.transparent===!0&&G.side===pn&&G.forceSinglePass===!1?(G.side=Ut,G.needsUpdate=!0,U.renderBufferDirect(k,N,z,G,v,xe),G.side=On,G.needsUpdate=!0,U.renderBufferDirect(k,N,z,G,v,xe),G.side=pn):U.renderBufferDirect(k,N,z,G,v,xe),v.onAfterRender(U,N,k,z,G,xe)}function Zi(v,N,k){N.isScene!==!0&&(N=mt);const z=H.get(v),G=E.state.lights,xe=E.state.shadowsArray,Se=G.state.version,ge=he.getParameters(v,G.state,xe,N,k,E.state.lightProbeGridArray),be=he.getProgramCacheKey(ge);let Te=z.programs;z.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?N.environment:null,z.fog=N.fog;const Ie=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;z.envMap=oe.get(v.envMap||z.environment,Ie),z.envMapRotation=z.environment!==null&&v.envMap===null?N.environmentRotation:v.envMapRotation,Te===void 0&&(v.addEventListener("dispose",Nt),Te=new Map,z.programs=Te);let Fe=Te.get(be);if(Fe!==void 0){if(z.currentProgram===Fe&&z.lightsStateVersion===Se)return eo(v,ge),Fe}else ge.uniforms=he.getUniforms(v),B!==null&&v.isNodeMaterial&&B.build(v,k,ge),v.onBeforeCompile(ge,U),Fe=he.acquireProgram(ge,be),Te.set(be,Fe),z.uniforms=ge.uniforms;const Ae=z.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Ae.clippingPlanes=Y.uniform),eo(v,ge),z.needsLights=cc(v),z.lightsStateVersion=Se,z.needsLights&&(Ae.ambientLightColor.value=G.state.ambient,Ae.lightProbe.value=G.state.probe,Ae.directionalLights.value=G.state.directional,Ae.directionalLightShadows.value=G.state.directionalShadow,Ae.spotLights.value=G.state.spot,Ae.spotLightShadows.value=G.state.spotShadow,Ae.rectAreaLights.value=G.state.rectArea,Ae.ltc_1.value=G.state.rectAreaLTC1,Ae.ltc_2.value=G.state.rectAreaLTC2,Ae.pointLights.value=G.state.point,Ae.pointLightShadows.value=G.state.pointShadow,Ae.hemisphereLights.value=G.state.hemi,Ae.directionalShadowMatrix.value=G.state.directionalShadowMatrix,Ae.spotLightMatrix.value=G.state.spotLightMatrix,Ae.spotLightMap.value=G.state.spotLightMap,Ae.pointShadowMatrix.value=G.state.pointShadowMatrix),z.lightProbeGrid=E.state.lightProbeGridArray.length>0,z.currentProgram=Fe,z.uniformsList=null,Fe}function ja(v){if(v.uniformsList===null){const N=v.currentProgram.getUniforms();v.uniformsList=Dr.seqWithValue(N.seq,v.uniforms)}return v.uniformsList}function eo(v,N){const k=H.get(v);k.outputColorSpace=N.outputColorSpace,k.batching=N.batching,k.batchingColor=N.batchingColor,k.instancing=N.instancing,k.instancingColor=N.instancingColor,k.instancingMorph=N.instancingMorph,k.skinning=N.skinning,k.morphTargets=N.morphTargets,k.morphNormals=N.morphNormals,k.morphColors=N.morphColors,k.morphTargetsCount=N.morphTargetsCount,k.numClippingPlanes=N.numClippingPlanes,k.numIntersection=N.numClipIntersection,k.vertexAlphas=N.vertexAlphas,k.vertexTangents=N.vertexTangents,k.toneMapping=N.toneMapping}function ac(v,N){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(N.matrixWorld);for(let k=0,z=v.length;k<z;k++){const G=v[k];if(G.texture!==null&&G.boundingBox.containsPoint(M))return G}return null}function oc(v,N,k,z,G){N.isScene!==!0&&(N=mt),q.resetTextureUnits();const xe=N.fog,Se=z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial?N.environment:null,ge=ne===null?U.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:Ve.workingColorSpace,be=z.isMeshStandardMaterial||z.isMeshLambertMaterial&&!z.envMap||z.isMeshPhongMaterial&&!z.envMap,Te=oe.get(z.envMap||Se,be),Ie=z.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Fe=!!k.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Ae=!!k.morphAttributes.position,Je=!!k.morphAttributes.normal,ft=!!k.morphAttributes.color;let ct=sn;z.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(ct=U.toneMapping);const et=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,Et=et!==void 0?et.length:0,Me=H.get(z),Ft=E.state.lights;if(Xe===!0&&(ze===!0||v!==de)){const nt=v===de&&z.id===re;Y.setState(z,v,nt)}let Ye=!1;z.version===Me.__version?(Me.needsLights&&Me.lightsStateVersion!==Ft.state.version||Me.outputColorSpace!==ge||G.isBatchedMesh&&Me.batching===!1||!G.isBatchedMesh&&Me.batching===!0||G.isBatchedMesh&&Me.batchingColor===!0&&G.colorTexture===null||G.isBatchedMesh&&Me.batchingColor===!1&&G.colorTexture!==null||G.isInstancedMesh&&Me.instancing===!1||!G.isInstancedMesh&&Me.instancing===!0||G.isSkinnedMesh&&Me.skinning===!1||!G.isSkinnedMesh&&Me.skinning===!0||G.isInstancedMesh&&Me.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Me.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Me.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Me.instancingMorph===!1&&G.morphTexture!==null||Me.envMap!==Te||z.fog===!0&&Me.fog!==xe||Me.numClippingPlanes!==void 0&&(Me.numClippingPlanes!==Y.numPlanes||Me.numIntersection!==Y.numIntersection)||Me.vertexAlphas!==Ie||Me.vertexTangents!==Fe||Me.morphTargets!==Ae||Me.morphNormals!==Je||Me.morphColors!==ft||Me.toneMapping!==ct||Me.morphTargetsCount!==Et||!!Me.lightProbeGrid!=E.state.lightProbeGridArray.length>0)&&(Ye=!0):(Ye=!0,Me.__version=z.version);let Gt=Me.currentProgram;Ye===!0&&(Gt=Zi(z,N,G),B&&z.isNodeMaterial&&B.onUpdateProgram(z,Gt,Me));let Jt=!1,yn=!1,ei=!1;const tt=Gt.getUniforms(),dt=Me.uniforms;if(p.useProgram(Gt.program)&&(Jt=!0,yn=!0,ei=!0),z.id!==re&&(re=z.id,yn=!0),Me.needsLights){const nt=ac(E.state.lightProbeGridArray,G);Me.lightProbeGrid!==nt&&(Me.lightProbeGrid=nt,yn=!0)}if(Jt||de!==v){p.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),tt.setValue(L,"projectionMatrix",v.projectionMatrix),tt.setValue(L,"viewMatrix",v.matrixWorldInverse);const bn=tt.map.cameraPosition;bn!==void 0&&bn.setValue(L,ut.setFromMatrixPosition(v.matrixWorld)),S.logarithmicDepthBuffer&&tt.setValue(L,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&tt.setValue(L,"isOrthographic",v.isOrthographicCamera===!0),de!==v&&(de=v,yn=!0,ei=!0)}if(Me.needsLights&&(Ft.state.directionalShadowMap.length>0&&tt.setValue(L,"directionalShadowMap",Ft.state.directionalShadowMap,q),Ft.state.spotShadowMap.length>0&&tt.setValue(L,"spotShadowMap",Ft.state.spotShadowMap,q),Ft.state.pointShadowMap.length>0&&tt.setValue(L,"pointShadowMap",Ft.state.pointShadowMap,q)),G.isSkinnedMesh){tt.setOptional(L,G,"bindMatrix"),tt.setOptional(L,G,"bindMatrixInverse");const nt=G.skeleton;nt&&(nt.boneTexture===null&&nt.computeBoneTexture(),tt.setValue(L,"boneTexture",nt.boneTexture,q))}G.isBatchedMesh&&(tt.setOptional(L,G,"batchingTexture"),tt.setValue(L,"batchingTexture",G._matricesTexture,q),tt.setOptional(L,G,"batchingIdTexture"),tt.setValue(L,"batchingIdTexture",G._indirectTexture,q),tt.setOptional(L,G,"batchingColorTexture"),G._colorsTexture!==null&&tt.setValue(L,"batchingColorTexture",G._colorsTexture,q));const En=k.morphAttributes;if((En.position!==void 0||En.normal!==void 0||En.color!==void 0)&&A.update(G,k,Gt),(yn||Me.receiveShadow!==G.receiveShadow)&&(Me.receiveShadow=G.receiveShadow,tt.setValue(L,"receiveShadow",G.receiveShadow)),(z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial)&&z.envMap===null&&N.environment!==null&&(dt.envMapIntensity.value=N.environmentIntensity),dt.dfgLUT!==void 0&&(dt.dfgLUT.value=qm()),yn){if(tt.setValue(L,"toneMappingExposure",U.toneMappingExposure),Me.needsLights&&lc(dt,ei),xe&&z.fog===!0&&Ee.refreshFogUniforms(dt,xe),Ee.refreshMaterialUniforms(dt,z,ae,ue,E.state.transmissionRenderTarget[v.id]),Me.needsLights&&Me.lightProbeGrid){const nt=Me.lightProbeGrid;dt.probesSH.value=nt.texture,dt.probesMin.value.copy(nt.boundingBox.min),dt.probesMax.value.copy(nt.boundingBox.max),dt.probesResolution.value.copy(nt.resolution)}Dr.upload(L,ja(Me),dt,q)}if(z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(Dr.upload(L,ja(Me),dt,q),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&tt.setValue(L,"center",G.center),tt.setValue(L,"modelViewMatrix",G.modelViewMatrix),tt.setValue(L,"normalMatrix",G.normalMatrix),tt.setValue(L,"modelMatrix",G.matrixWorld),z.uniformsGroups!==void 0){const nt=z.uniformsGroups;for(let bn=0,ti=nt.length;bn<ti;bn++){const to=nt[bn];$.update(to,Gt),$.bind(to,Gt)}}return Gt}function lc(v,N){v.ambientLightColor.needsUpdate=N,v.lightProbe.needsUpdate=N,v.directionalLights.needsUpdate=N,v.directionalLightShadows.needsUpdate=N,v.pointLights.needsUpdate=N,v.pointLightShadows.needsUpdate=N,v.spotLights.needsUpdate=N,v.spotLightShadows.needsUpdate=N,v.rectAreaLights.needsUpdate=N,v.hemisphereLights.needsUpdate=N}function cc(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return Z},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return ne},this.setRenderTargetTextures=function(v,N,k){const z=H.get(v);z.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,z.__autoAllocateDepthBuffer===!1&&(z.__useRenderToTexture=!1),H.get(v.texture).__webglTexture=N,H.get(v.depthTexture).__webglTexture=z.__autoAllocateDepthBuffer?void 0:k,z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,N){const k=H.get(v);k.__webglFramebuffer=N,k.__useDefaultFramebuffer=N===void 0},this.setRenderTarget=function(v,N=0,k=0){ne=v,Z=N,W=k;let z=null,G=!1,xe=!1;if(v){const ge=H.get(v);if(ge.__useDefaultFramebuffer!==void 0){p.bindFramebuffer(L.FRAMEBUFFER,ge.__webglFramebuffer),_e.copy(v.viewport),ye.copy(v.scissor),ke=v.scissorTest,p.viewport(_e),p.scissor(ye),p.setScissorTest(ke),re=-1;return}else if(ge.__webglFramebuffer===void 0)q.setupRenderTarget(v);else if(ge.__hasExternalTextures)q.rebindTextures(v,H.get(v.texture).__webglTexture,H.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){const Ie=v.depthTexture;if(ge.__boundDepthTexture!==Ie){if(Ie!==null&&H.has(Ie)&&(v.width!==Ie.image.width||v.height!==Ie.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");q.setupDepthRenderbuffer(v)}}const be=v.texture;(be.isData3DTexture||be.isDataArrayTexture||be.isCompressedArrayTexture)&&(xe=!0);const Te=H.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(Te[N])?z=Te[N][k]:z=Te[N],G=!0):v.samples>0&&q.useMultisampledRTT(v)===!1?z=H.get(v).__webglMultisampledFramebuffer:Array.isArray(Te)?z=Te[k]:z=Te,_e.copy(v.viewport),ye.copy(v.scissor),ke=v.scissorTest}else _e.copy(Re).multiplyScalar(ae).floor(),ye.copy(rt).multiplyScalar(ae).floor(),ke=Ne;if(k!==0&&(z=J),p.bindFramebuffer(L.FRAMEBUFFER,z)&&p.drawBuffers(v,z),p.viewport(_e),p.scissor(ye),p.setScissorTest(ke),G){const ge=H.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+N,ge.__webglTexture,k)}else if(xe){const ge=N;for(let be=0;be<v.textures.length;be++){const Te=H.get(v.textures[be]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+be,Te.__webglTexture,k,ge)}}else if(v!==null&&k!==0){const ge=H.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,ge.__webglTexture,k)}re=-1},this.readRenderTargetPixels=function(v,N,k,z,G,xe,Se,ge=0){if(!(v&&v.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let be=H.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&Se!==void 0&&(be=be[Se]),be){p.bindFramebuffer(L.FRAMEBUFFER,be);try{const Te=v.textures[ge],Ie=Te.format,Fe=Te.type;if(v.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+ge),!S.textureFormatReadable(Ie)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!S.textureTypeReadable(Fe)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=v.width-z&&k>=0&&k<=v.height-G&&L.readPixels(N,k,z,G,se.convert(Ie),se.convert(Fe),xe)}finally{const Te=ne!==null?H.get(ne).__webglFramebuffer:null;p.bindFramebuffer(L.FRAMEBUFFER,Te)}}},this.readRenderTargetPixelsAsync=async function(v,N,k,z,G,xe,Se,ge=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let be=H.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&Se!==void 0&&(be=be[Se]),be)if(N>=0&&N<=v.width-z&&k>=0&&k<=v.height-G){p.bindFramebuffer(L.FRAMEBUFFER,be);const Te=v.textures[ge],Ie=Te.format,Fe=Te.type;if(v.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+ge),!S.textureFormatReadable(Ie))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!S.textureTypeReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ae=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.bufferData(L.PIXEL_PACK_BUFFER,xe.byteLength,L.STREAM_READ),L.readPixels(N,k,z,G,se.convert(Ie),se.convert(Fe),0);const Je=ne!==null?H.get(ne).__webglFramebuffer:null;p.bindFramebuffer(L.FRAMEBUFFER,Je);const ft=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await ih(L,ft,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Ae),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,xe),L.deleteBuffer(Ae),L.deleteSync(ft),xe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,N=null,k=0){const z=Math.pow(2,-k),G=Math.floor(v.image.width*z),xe=Math.floor(v.image.height*z),Se=N!==null?N.x:0,ge=N!==null?N.y:0;q.setTexture2D(v,0),L.copyTexSubImage2D(L.TEXTURE_2D,k,0,0,Se,ge,G,xe),p.unbindTexture()},this.copyTextureToTexture=function(v,N,k=null,z=null,G=0,xe=0){let Se,ge,be,Te,Ie,Fe,Ae,Je,ft;const ct=v.isCompressedTexture?v.mipmaps[xe]:v.image;if(k!==null)Se=k.max.x-k.min.x,ge=k.max.y-k.min.y,be=k.isBox3?k.max.z-k.min.z:1,Te=k.min.x,Ie=k.min.y,Fe=k.isBox3?k.min.z:0;else{const dt=Math.pow(2,-G);Se=Math.floor(ct.width*dt),ge=Math.floor(ct.height*dt),v.isDataArrayTexture?be=ct.depth:v.isData3DTexture?be=Math.floor(ct.depth*dt):be=1,Te=0,Ie=0,Fe=0}z!==null?(Ae=z.x,Je=z.y,ft=z.z):(Ae=0,Je=0,ft=0);const et=se.convert(N.format),Et=se.convert(N.type);let Me;N.isData3DTexture?(q.setTexture3D(N,0),Me=L.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(q.setTexture2DArray(N,0),Me=L.TEXTURE_2D_ARRAY):(q.setTexture2D(N,0),Me=L.TEXTURE_2D),p.activeTexture(L.TEXTURE0),p.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,N.flipY),p.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),p.pixelStorei(L.UNPACK_ALIGNMENT,N.unpackAlignment);const Ft=p.getParameter(L.UNPACK_ROW_LENGTH),Ye=p.getParameter(L.UNPACK_IMAGE_HEIGHT),Gt=p.getParameter(L.UNPACK_SKIP_PIXELS),Jt=p.getParameter(L.UNPACK_SKIP_ROWS),yn=p.getParameter(L.UNPACK_SKIP_IMAGES);p.pixelStorei(L.UNPACK_ROW_LENGTH,ct.width),p.pixelStorei(L.UNPACK_IMAGE_HEIGHT,ct.height),p.pixelStorei(L.UNPACK_SKIP_PIXELS,Te),p.pixelStorei(L.UNPACK_SKIP_ROWS,Ie),p.pixelStorei(L.UNPACK_SKIP_IMAGES,Fe);const ei=v.isDataArrayTexture||v.isData3DTexture,tt=N.isDataArrayTexture||N.isData3DTexture;if(v.isDepthTexture){const dt=H.get(v),En=H.get(N),nt=H.get(dt.__renderTarget),bn=H.get(En.__renderTarget);p.bindFramebuffer(L.READ_FRAMEBUFFER,nt.__webglFramebuffer),p.bindFramebuffer(L.DRAW_FRAMEBUFFER,bn.__webglFramebuffer);for(let ti=0;ti<be;ti++)ei&&(L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,H.get(v).__webglTexture,G,Fe+ti),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,H.get(N).__webglTexture,xe,ft+ti)),L.blitFramebuffer(Te,Ie,Se,ge,Ae,Je,Se,ge,L.DEPTH_BUFFER_BIT,L.NEAREST);p.bindFramebuffer(L.READ_FRAMEBUFFER,null),p.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(G!==0||v.isRenderTargetTexture||H.has(v)){const dt=H.get(v),En=H.get(N);p.bindFramebuffer(L.READ_FRAMEBUFFER,ee),p.bindFramebuffer(L.DRAW_FRAMEBUFFER,V);for(let nt=0;nt<be;nt++)ei?L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,dt.__webglTexture,G,Fe+nt):L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,dt.__webglTexture,G),tt?L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,En.__webglTexture,xe,ft+nt):L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,En.__webglTexture,xe),G!==0?L.blitFramebuffer(Te,Ie,Se,ge,Ae,Je,Se,ge,L.COLOR_BUFFER_BIT,L.NEAREST):tt?L.copyTexSubImage3D(Me,xe,Ae,Je,ft+nt,Te,Ie,Se,ge):L.copyTexSubImage2D(Me,xe,Ae,Je,Te,Ie,Se,ge);p.bindFramebuffer(L.READ_FRAMEBUFFER,null),p.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else tt?v.isDataTexture||v.isData3DTexture?L.texSubImage3D(Me,xe,Ae,Je,ft,Se,ge,be,et,Et,ct.data):N.isCompressedArrayTexture?L.compressedTexSubImage3D(Me,xe,Ae,Je,ft,Se,ge,be,et,ct.data):L.texSubImage3D(Me,xe,Ae,Je,ft,Se,ge,be,et,Et,ct):v.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,xe,Ae,Je,Se,ge,et,Et,ct.data):v.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,xe,Ae,Je,ct.width,ct.height,et,ct.data):L.texSubImage2D(L.TEXTURE_2D,xe,Ae,Je,Se,ge,et,Et,ct);p.pixelStorei(L.UNPACK_ROW_LENGTH,Ft),p.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ye),p.pixelStorei(L.UNPACK_SKIP_PIXELS,Gt),p.pixelStorei(L.UNPACK_SKIP_ROWS,Jt),p.pixelStorei(L.UNPACK_SKIP_IMAGES,yn),xe===0&&N.generateMipmaps&&L.generateMipmap(Me),p.unbindTexture()},this.initRenderTarget=function(v){H.get(v).__webglFramebuffer===void 0&&q.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?q.setTextureCube(v,0):v.isData3DTexture?q.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?q.setTexture2DArray(v,0):q.setTexture2D(v,0),p.unbindTexture()},this.resetState=function(){Z=0,W=0,ne=null,p.reset(),le.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return rn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Ve._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ve._getUnpackColorSpace()}}const cl={type:"change"},Ha={type:"start"},nc={type:"end"},br=new Xr,hl=new Dn,Zm=Math.cos(70*ah.DEG2RAD),gt=new D,Lt=2*Math.PI,je={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Ns=1e-6;class $m extends Jh{constructor(e,t=null){super(e,t),this.state=je.NONE,this.target=new D,this.cursor=new D,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Si.ROTATE,MIDDLE:Si.DOLLY,RIGHT:Si.PAN},this.touches={ONE:Mi.ROTATE,TWO:Mi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new D,this._lastQuaternion=new Bn,this._lastTargetPosition=new D,this._quat=new Bn().setFromUnitVectors(e.up,new D(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Oo,this._sphericalDelta=new Oo,this._scale=1,this._panOffset=new D,this._rotateStart=new Ce,this._rotateEnd=new Ce,this._rotateDelta=new Ce,this._panStart=new Ce,this._panEnd=new Ce,this._panDelta=new Ce,this._dollyStart=new Ce,this._dollyEnd=new Ce,this._dollyDelta=new Ce,this._dollyDirection=new D,this._mouse=new Ce,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Qm.bind(this),this._onPointerDown=Jm.bind(this),this._onPointerUp=jm.bind(this),this._onContextMenu=a_.bind(this),this._onMouseWheel=n_.bind(this),this._onKeyDown=i_.bind(this),this._onTouchStart=r_.bind(this),this._onTouchMove=s_.bind(this),this._onMouseDown=e_.bind(this),this._onMouseMove=t_.bind(this),this._interceptControlDown=o_.bind(this),this._interceptControlUp=l_.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(cl),this.update(),this.state=je.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const t=this.object.position;gt.copy(t).sub(this.target),gt.applyQuaternion(this._quat),this._spherical.setFromVector3(gt),this.autoRotate&&this.state===je.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Lt:n>Math.PI&&(n-=Lt),r<-Math.PI?r+=Lt:r>Math.PI&&(r-=Lt),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(gt.setFromSpherical(this._spherical),gt.applyQuaternion(this._quatInverse),t.copy(this.target).add(gt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=gt.length();a=this._clampDistance(o*this._scale);const c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const o=new D(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const l=new D(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=gt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(br.origin.copy(this.object.position),br.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(br.direction))<Zm?this.object.lookAt(this.target):(hl.setFromNormalAndCoplanarPoint(this.object.up,this.target),br.intersectPlane(hl,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Ns||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ns||this._lastTargetPosition.distanceToSquared(this.target)>Ns?(this.dispatchEvent(cl),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Lt/60*this.autoRotateSpeed*e:Lt/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){gt.setFromMatrixColumn(t,0),gt.multiplyScalar(-e),this._panOffset.add(gt)}_panUp(e,t){this.screenSpacePanning===!0?gt.setFromMatrixColumn(t,1):(gt.setFromMatrixColumn(t,0),gt.crossVectors(this.object.up,gt)),gt.multiplyScalar(e),this._panOffset.add(gt)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;gt.copy(r).sub(this.target);let s=gt.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Lt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Lt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Lt*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Lt*this._rotateDelta.x/t.clientHeight),this._rotateUp(Lt*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Ce,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function Jm(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function Qm(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function jm(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(nc),this.state=je.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function e_(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Si.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=je.DOLLY;break;case Si.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=je.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=je.ROTATE}break;case Si.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=je.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=je.PAN}break;default:this.state=je.NONE}this.state!==je.NONE&&this.dispatchEvent(Ha)}function t_(i){switch(this.state){case je.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case je.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case je.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function n_(i){this.enabled===!1||this.enableZoom===!1||this.state!==je.NONE||(i.preventDefault(),this.dispatchEvent(Ha),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(nc))}function i_(i){this.enabled!==!1&&this._handleKeyDown(i)}function r_(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Mi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=je.TOUCH_ROTATE;break;case Mi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=je.TOUCH_PAN;break;default:this.state=je.NONE}break;case 2:switch(this.touches.TWO){case Mi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=je.TOUCH_DOLLY_PAN;break;case Mi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=je.TOUCH_DOLLY_ROTATE;break;default:this.state=je.NONE}break;default:this.state=je.NONE}this.state!==je.NONE&&this.dispatchEvent(Ha)}function s_(i){switch(this._trackPointer(i),this.state){case je.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case je.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case je.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case je.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=je.NONE}}function a_(i){this.enabled!==!1&&i.preventDefault()}function o_(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function l_(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const c_=16317439,h_=[16748467,16762967,8246268,10980346,8843180,16478597,3718648,15772668,16639626,6220500],u_=[16758891,6333946,3462041,15235577,16436245,6220500,12616956,16020150,10741301,9684477],bi=1700,f_={x:1.42,y:.84,z:1},d_={x:1,y:1,z:1};function ul(i,e={}){const t=e.selectedKey??null,n=yc(i,t),r=p_(n.edges,t),s=t?ml(n,t):null,a=n.nodes.map(l=>{const u=__(l.key,t,r),m=Ca(l.key),h=g_(l,u,t,m),d=S_(l,u),x=y_(l,u,n.nodes.length,s);return{key:l.key,node:l,x:h.x,y:h.y,z:h.z,radius:d,color:T_(l),state:u,labelTier:x,opacity:E_(u),seed:m}}),o=new Map(a.map(l=>[l.key,l])),c=n.edges.flatMap(l=>{const u=o.get(l.sourceKey),m=o.get(l.targetKey);if(!u||!m)return[];const h=!!(t&&(l.sourceKey===t||l.targetKey===t)),d=!!(t&&!h),x=d?.018:h?.32+Math.min(.2,l.weight*.2):l.visibility===2?.09:.06;return[{edge:l,source:u,target:m,color:u.color,alpha:x,width:m_(l,h,d),highlighted:h}]});return{nodes:a,edges:c,selectedNeighborKeys:r,bounds:b_(a,!!t)}}function p_(i,e){const t=new Set;if(!e)return t;for(const n of i)n.sourceKey===e&&t.add(n.targetKey),n.targetKey===e&&t.add(n.sourceKey);return t}function m_(i,e,t){const n=.75+Math.log10(i.weight+1)*.7+(i.visibility===2?.18:0);return e?Math.min(2.2,Math.max(1.65,n+.65)):t?Math.min(.8,Math.max(.55,n*.58)):Math.min(1.35,Math.max(.85,n))}function __(i,e,t){return e?i===e?"selected":t.has(i)?"neighbor":"dimmed":"normal"}function g_(i,e,t,n){if(e==="selected")return{x:0,y:0,z:0};if(!t&&i.visualRole==="anchor")return{x:0,y:0,z:0};const r=x_(i,t),s=v_(i,e,!!t,n),a=t?d_:f_;return{x:Fs(r.x*s*a.x,2),y:Fs(r.y*s*a.y,2),z:Fs(r.z*s*a.z,2)}}function x_(i,e){const t=e??"panorama",n=fl(`community:${t}:${i.communityId||"default"}`),r=fl(`node:${t}:${i.key}`),s=e?.7:1.15,a=e?1.15:.95;return R_({x:n.x*s+r.x*a,y:n.y*s+r.y*a,z:n.z*s+r.z*a})}function v_(i,e,t,n){const r=M_(i),s=(n-.5)*120;if(t&&e==="neighbor")return Zn(980-r*650+s,220,1050);if(t&&e==="dimmed")return Zn(1670-r*260+s,1280,bi);const a=i.visualRole??"standard",o=a==="close"?280:620,c=a==="close"?1180:bi,l=a==="standard"?Math.max(0,(i.rank-80)/220)*160:0;return Zn(c-r*(c-o)+l+s,180,bi)}function M_(i){if(i.visualRole==="anchor")return 1;if(typeof i.importance=="number")return Zn(i.importance,0,1);const e=Zn(i.score,0,1),t=Zn(1-(i.rank-1)/120,0,1);return Zn(e*.58+t*.42,0,1)}function S_(i,e){let t=Math.max(i.size*.5,i.visualRole==="anchor"?14:1.6);const n=Math.max(0,1-(i.rank-1)/50);return t+=Math.pow(n,1.35)*6,i.rank<=3?t+=2.5:i.rank<=10&&(t+=1.2),e==="selected"?t+5.5:e==="neighbor"?t+1.5:t}function y_(i,e,t,n){return n?n.has(i.key)?e==="selected"||i.visualRole==="anchor"?2:1:0:e==="selected"||i.labelVisibility===2||i.visualRole==="anchor"?2:e==="neighbor"&&i.rank<=30||i.labelVisibility===1&&t<=300||i.rank<=6?1:0}function E_(i){return i==="selected"?1:i==="neighbor"?.95:i==="dimmed"?.1:.82}function b_(i,e){if(i.length===0)return{minX:-500,maxX:500,minY:-500,maxY:500,minZ:-bi,maxZ:bi,width:1e3,height:1e3,depth:bi*2};let t=0,n=0,r=0;for(const l of i)t=Math.max(t,Math.abs(l.x)),n=Math.max(n,Math.abs(l.y)),r=Math.max(r,Math.abs(l.z));const s=Math.max(400,t,n,r);if(e)return{minX:-s,maxX:s,minY:-s,maxY:s,minZ:-s,maxZ:s,width:s*2,height:s*2,depth:s*2};const a=Math.max(400,t),o=Math.max(400,n),c=Math.max(400,r);return{minX:-a,maxX:a,minY:-o,maxY:o,minZ:-c,maxZ:c,width:a*2,height:o*2,depth:c*2}}function T_(i){return i.visualRole==="anchor"?c_:A_(i)}function A_(i){const e=i.visualRole??"standard",t=e==="close"?h_:u_,n=e==="close"?"friend":"non_friend",r=ic(`${i.communityId}:${i.key}:${i.rank}:${n}`)%t.length;return t[r]??t[0]}function fl(i){const e=Ca(`${i}:azimuth`)*Math.PI*2,t=Ca(`${i}:z`)*2-1,n=Math.sqrt(Math.max(0,1-t*t));return{x:Math.cos(e)*n,y:Math.sin(e)*n,z:t}}function R_(i){const e=Math.hypot(i.x,i.y,i.z);return e<=1e-4?{x:1,y:0,z:0}:{x:i.x/e,y:i.y/e,z:i.z/e}}function Ca(i){return ic(i)/4294967295}function ic(i){let e=2166136261;for(let t=0;t<i.length;t++)e^=i.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Fs(i,e=2){const t=10**e;return Math.round(i*t)/t}function Zn(i,e,t){return Math.min(t,Math.max(e,i))}const w_=6;function C_(i,e,t){const n=i.distanceTo(e);if(n<=.001)return[i.clone(),e.clone()];const r=e.clone().sub(i).normalize(),s=new D(0,1,0);Math.abs(r.y)>.9&&s.set(1,0,0);const a=new D().crossVectors(r,s).normalize(),o=new D().crossVectors(r,a).normalize(),c=P_(a,o,t).multiplyScalar(Math.max(5,n*.08)),l=i.clone().lerp(e,.5).add(c);return new Gh(i,l,e).getPoints(w_)}function P_(i,e,t){const n=t*7.1%1-.5,r=t*13.3%1-.5,s=i.clone().multiplyScalar(n).add(e.clone().multiplyScalar(r));return s.lengthSq()<=1e-4?i.clone():s.normalize()}const D_=new Be(16777215);function L_(i,e,t,n,r){return i.copy(e).lerp(t,I_(r)),i.lerp(D_,U_(n)),i.multiplyScalar(N_(n)),i}function I_(i){return i<=0?0:i>=1?1:i}function U_(i){return i==="highlight"?.06:i==="normal"?.16:.26}function N_(i){return i==="highlight"?1:i==="normal"?.56:.38}const dl=.9;function F_(i){const e=Math.max(i.width,i.height,i.depth,900);return{position:{x:0,y:-e*.5*dl,z:e*.5*dl},target:{x:0,y:0,z:0}}}function O_(i,e){const t=_l(e),n=Math.max(1,e.viewportWidth);if(t<=0)return i;const r=H_({x:i.target.x-i.position.x,y:i.target.y-i.position.y,z:i.target.z-i.position.z}),s=Math.max(1,V_(i.position,i.target)),a=Math.max(.001,(n-t)/n),o=s/a;return{position:z_(i.target,G_(r,-o)),target:i.target}}function B_(i){const e=Math.max(1,Math.floor(i.viewportWidth)),t=Math.max(1,Math.floor(i.viewportHeight)),n=Math.floor(_l(i));return n<=0?null:{fullWidth:e+n,fullHeight:t,offsetX:n,offsetY:0,width:e,height:t}}function z_(i,e){return{x:i.x+e.x,y:i.y+e.y,z:i.z+e.z}}function G_(i,e){return{x:i.x*e,y:i.y*e,z:i.z*e}}function V_(i,e){return Math.hypot(i.x-e.x,i.y-e.y,i.z-e.z)}function H_(i){const e=Math.hypot(i.x,i.y,i.z);return e<=0?{x:1,y:0,z:0}:{x:i.x/e,y:i.y/e,z:i.z/e}}function k_(i,e,t,n){return i.key===t?i.labelTier===2?2:1:e?n?.has(i.key)?i.key===e||i.node.visualRole==="anchor"?2:1:0:i.labelTier}function W_(i,e){const t=B_(e);if(!t){i.clearViewOffset();return}i.setViewOffset(t.fullWidth,t.fullHeight,t.offsetX,t.offsetY,t.width,t.height)}function X_(i,e,t){return!i||!e?null:{kind:"3d",position:{x:i.x,y:i.y,z:i.z},target:{x:e.x,y:e.y,z:e.z},hasUserMovedCamera:t}}function Y_(i){return!rc(i)||i.kind!=="3d"||typeof i.hasUserMovedCamera!="boolean"||!pl(i.position)||!pl(i.target)?null:{kind:"3d",position:i.position,target:i.target,hasUserMovedCamera:i.hasUserMovedCamera}}function pl(i){return rc(i)?typeof i.x=="number"&&Number.isFinite(i.x)&&typeof i.y=="number"&&Number.isFinite(i.y)&&typeof i.z=="number"&&Number.isFinite(i.z):!1}function rc(i){return typeof i=="object"&&i!==null}const q_=["aria-label"],K_={class:"pointer-events-none absolute inset-0 z-10 overflow-hidden"},Z_=["onBlur","onClick","onFocus","onMouseenter","onMouseleave"],$_=hc({__name:"RelationshipGalaxyThreeCanvas",props:{graph:{},selectedKey:{default:null},safeInsetRight:{default:0},emphasizeEdges:{type:Boolean,default:!1},label:{}},emits:["select-node","clear-selection","fallback"],setup(i,{expose:e,emit:t}){const n=i,r=t,s=no(null),a=Jr([]),o=no(null),c=Jr(ul(n.graph,{selectedKey:n.selectedKey})),l=Jr(null);let u=null,m=null,h=null,d=null,x=null,y=0,_=0,f=0,w=!1,C=null,M=null;const R=new In,E=new In,P=new In,g=new Map,b=[],U=new Map,I=new $h,B=new Ce,J=new D;function ee(T){return T.displayName}function V(){const T=s.value?.getBoundingClientRect();return{width:Math.max(1,Math.floor(T?.width??1)),height:Math.max(1,Math.floor(T?.height??1))}}function Z(T,F){const Y=(F.bounds.minX+F.bounds.maxX)/2,te=(F.bounds.minY+F.bounds.maxY)/2;return new D(T.x-Y,-(T.y-te),T.z)}function W(T=!1){if(!m||!h||!u)return;const F=ul(n.graph,{selectedKey:n.selectedKey});c.value=F,ne(),O(E),O(P),g.clear(),b.length=0,U.clear(),o.value=null,f=0,a.value=[];for(const Y of F.edges)U.has(Y.edge.sourceKey)||U.set(Y.edge.sourceKey,new Set),U.has(Y.edge.targetKey)||U.set(Y.edge.targetKey,new Set),U.get(Y.edge.sourceKey).add(Y.edge.targetKey),U.get(Y.edge.targetKey).add(Y.edge.sourceKey);re(F,"dim"),re(F,"normal"),re(F,"highlight");for(const Y of F.nodes){const te=Z(Y,F),fe=We(Y,te);g.set(Y.key,fe),b.push(fe.core),P.add(fe.group)}(T||!w)&&L(),pt()}function ne(){l.value=n.selectedKey?ml(n.graph,n.selectedKey):null}function re(T,F){const Y=T.edges.filter(te=>F==="highlight"?te.highlighted:F==="dim"?te.alpha<=.05:!te.highlighted&&te.alpha>.05);if(Y.length!==0)for(const te of ye(Y,F))de(T,te.edges,F,te.linewidth)}function de(T,F,Y,te){const fe=new Hl({vertexColors:!0,transparent:!0,opacity:Y==="highlight"?.62:Y==="normal"?n.emphasizeEdges?.27:.21:.05,linewidth:te,blending:Nn,depthTest:!0,depthWrite:!1}),A=new Be,ie=new Be,X=new Be,se=[],le=[];for(const pe of F){const Ke=Z(pe.source,T),$e=Z(pe.target,T),wt=C_(Ke,$e,pe.source.seed+pe.target.seed),Nt=Math.max(1,wt.length-1);A.setHex(pe.source.color),ie.setHex(pe.target.color);for(let Sn=0;Sn<wt.length-1;Sn+=1){const Di=wt[Sn],jn=wt[Sn+1];se.push(Di.x,Di.y,Di.z,jn.x,jn.y,jn.z),_e(le,X,A,ie,Y,Sn/Nt),_e(le,X,A,ie,Y,(Sn+1)/Nt)}}if(se.length===0){fe.dispose();return}const $=new Xt;$.setAttribute("position",new zt(se,3)),$.setAttribute("color",new zt(le,3));const ve=new Ih($,fe);ve.frustumCulled=!1,E.add(ve)}function _e(T,F,Y,te,fe,A){L_(F,Y,te,fe,A),T.push(F.r,F.g,F.b)}function ye(T,F){const Y=new Map;for(const te of T){const fe=ke(te,F),A=Y.get(fe)??[];A.push(te),Y.set(fe,A)}return[...Y.entries()].map(([te,fe])=>({linewidth:te,edges:fe}))}function ke(T,F){return F==="highlight"?T.width>=2?2:1.65:F==="dim"?.55:T.width>=1.2?1.12:T.width>=.95?.96:.82}function it(T){return T.state==="selected"?2.18:T.node.visualRole==="anchor"?2.04:T.node.rank<=10?1.76:1.52}function We(T,F){const Y=new In;Y.position.copy(F);const te=new Ah(new Bl({map:K(T.color,Math.floor(T.seed*8)),color:16777215,transparent:!0,opacity:T.opacity,blending:Nn,depthWrite:!1,alphaTest:.02}));return te.scale.setScalar(T.radius*it(T)),te.userData.key=T.key,Y.add(te),{group:Y,core:te,sceneNode:T,basePosition:F,phase:T.seed*Math.PI*2}}function j(){if(!u||!m||!h||!d)return;const T=performance.now()-_;ue();const F=w?.003:.008;R.rotation.y=Math.sin(T/25e3)*F,R.rotation.x=Math.cos(T/3e4)*F*.4;const Y=o.value||n.selectedKey;for(const te of g.values()){const fe=T/1e3+te.phase,A=te.sceneNode.key===n.selectedKey,ie=te.sceneNode.key===Y,X=!!(Y&&U.get(Y)?.has(te.sceneNode.key)),se=A?.3:.8,le=o.value===te.sceneNode.key?1.28:1,$=A?1.22:1,ve=X?1.08:1;te.group.position.set(te.basePosition.x+Math.sin(fe*.3)*2*se,te.basePosition.y+Math.cos(fe*.25)*1.5*se,te.basePosition.z+Math.sin(fe*.2)*4*se),te.group.scale.setScalar((1+Math.sin(fe*.8)*.006)*le*$*ve);const pe=te.core.material;let Ke=te.sceneNode.opacity;Y&&(ie?Ke=1:X?Ke=.85:Ke=.1),pe.opacity+=(Ke-pe.opacity)*.16}d.update(),ae(),u.render(m,h),y=requestAnimationFrame(j)}function ue(){if(!d||!h||!M)return;const T=Math.min(1,(performance.now()-M.startedAt)/M.duration),F=q(T);h.position.lerpVectors(M.fromPosition,M.toPosition,F),d.target.lerpVectors(M.fromTarget,M.toTarget,F),T>=1&&(M=null)}function ae(){if(!u||!h||(f+=1,f%2!==0))return;const{width:T,height:F}=V(),Y=[],te=n.selectedKey,fe=te?U.get(te):null;for(const A of g.values()){const ie=A.sceneNode.key===te,X=!!(te&&fe?.has(A.sceneNode.key)),se=k_(A.sceneNode,te??null,o.value,l.value);if(se===0)continue;A.group.getWorldPosition(J);const le=J.clone().project(h);if(le.z<-1||le.z>1)continue;const $=(le.x*.5+.5)*T,ve=(-le.y*.5+.5)*F;$<-80||$>T+80||ve<-40||ve>F+40||Y.push({key:A.sceneNode.key,text:ee(A.sceneNode.node),x:$,y:ve+A.sceneNode.radius+8,opacity:ie?1:Math.max(.42,A.core.material.opacity),selected:ie,emphasis:Pe(A.sceneNode,X,se)})}a.value=Y}function Pe(T,F=!1,Y=T.labelTier){return Y===2||T.node.visualRole==="anchor"||T.node.rank<=5?"major":F||T.node.rank<=30?"medium":"minor"}async function De(){const T=s.value;if(!T||u)return;const F=V();m=new Mh,m.fog=new Va(656643,32e-5),h=new Ht(45,F.width/F.height,1,3e4),h.position.set(0,-150,900);try{u=new Km({antialias:!0,alpha:!0,powerPreference:"high-performance"})}catch(Y){console.warn("relationship galaxy 3d renderer unavailable",Y),r("fallback");return}u.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),u.setSize(F.width,F.height),u.outputColorSpace=It,u.domElement.className="h-full w-full",T.appendChild(u.domElement),d=new $m(h,u.domElement),d.enableDamping=!0,d.dampingFactor=.055,d.rotateSpeed=.34,d.zoomSpeed=.72,d.panSpeed=.58,d.minDistance=160,d.maxDistance=9e3,d.addEventListener("start",()=>{w=!0,M=null}),R.add(E),R.add(P),m.add(R),u.domElement.addEventListener("pointermove",rt),u.domElement.addEventListener("pointerleave",Ne),u.domElement.addEventListener("click",qe),x=new ResizeObserver(Re),x.observe(T),W(!0),_=performance.now(),y=requestAnimationFrame(j)}function Re(){if(!u||!h)return;const T=V();h.aspect=T.width/T.height,u.setSize(T.width,T.height),He(T)}function rt(T){if(!u||!h)return;const F=u.domElement.getBoundingClientRect();B.x=(T.clientX-F.left)/F.width*2-1,B.y=-((T.clientY-F.top)/F.height)*2+1,I.setFromCamera(B,h);const[Y]=I.intersectObjects(b,!1);o.value=typeof Y?.object.userData.key=="string"?Y.object.userData.key:null}function Ne(){o.value=null}function qe(){const T=o.value;if(!T){r("clear-selection");return}const F=g.get(T);F&&r("select-node",F.sceneNode.node)}function Xe(T){const F=g.get(T);F&&r("select-node",F.sceneNode.node)}function ze(T){o.value=T}function ot(T){o.value===T&&(o.value=null)}function ut(T){T.preventDefault(),T.stopPropagation();const F=u?.domElement;F&&F.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:T.clientX,clientY:T.clientY,ctrlKey:T.ctrlKey,deltaMode:T.deltaMode,deltaX:T.deltaX,deltaY:T.deltaY,deltaZ:T.deltaZ,metaKey:T.metaKey,screenX:T.screenX,screenY:T.screenY,shiftKey:T.shiftKey}))}function pt(){if(!C)return;const T=C;if(!g.has(T)){C=null;return}mt(T)}function mt(T){if(!h||!d)return C=T,!1;const F=g.get(T);if(!F)return C=T,!1;C=null,w=!0;const Y=F.basePosition.clone(),te=Math.max(180,Math.min(600,c.value.bounds.width*.18)),fe=St({position:S(Y.clone().add(new D(0,-te*.25,te))),target:S(Y)});return p(new D(fe.position.x,fe.position.y,fe.position.z),new D(fe.target.x,fe.target.y,fe.target.z),540),!0}function st(){return X_(h?.position,d?.target,w)}function lt(T){const F=Y_(T);return!F||!h||!d?!1:(C=null,w=F.hasUserMovedCamera,He(),p(new D(F.position.x,F.position.y,F.position.z),new D(F.target.x,F.target.y,F.target.z),620),!0)}function L(){if(!h||!d)return;w=!1;const T=St(F_(c.value.bounds));p(new D(T.position.x,T.position.y,T.position.z),new D(T.target.x,T.target.y,T.target.z),620)}function St(T){const F=V();return He(F),O_(T,{viewportWidth:F.width,viewportHeight:F.height,safeInsetRight:n.safeInsetRight,fovDegrees:h?.fov??45})}function He(T=V()){h&&W_(h,{viewportWidth:T.width,viewportHeight:T.height,safeInsetRight:n.safeInsetRight})}function S(T){return{x:T.x,y:T.y,z:T.z}}function p(T,F,Y){!h||!d||(M={startedAt:performance.now(),duration:Y,fromPosition:h.position.clone(),toPosition:T,fromTarget:d.target.clone(),toTarget:F})}function O(T){for(;T.children.length>0;){const F=T.children.pop();F&&H(F)}}function H(T){T.traverse(F=>{const Y=F;if(Y.geometry?.dispose(),Array.isArray(Y.material))for(const te of Y.material)te.dispose();else Y.material?.dispose()})}function q(T){return T<.5?4*T*T*T:1-Math.pow(-2*T+2,3)/2}function oe(T){const F=Math.sin(T*12.9898)*43758.5453;return F-Math.floor(F)}const ce=new Map;function K(T,F){const te=`star:${T.toString(16).padStart(6,"0")}:${F}`,fe=ce.get(te);if(fe)return fe;const A=document.createElement("canvas");A.width=128,A.height=128;const ie=A.getContext("2d");if(!ie)throw new Error("failed to create galaxy texture context");const X=new Be(T),se=1.04+oe(F+4.2)*.06,le=.94+oe(F+9.8)*.05,$=(oe(F+17.4)-.5)*.32,ve=.18+oe(F+21.7)*.12;Q(ie,se,le,$,38,[[0,"rgba(255,255,255,0.1)"],[.26,Ee(X,.16)],[.58,Ee(X,.04)],[1,"rgba(255,255,255,0)"]]),he(ie,$,48,2.2,ve,X),he(ie,$+Math.PI/2,32,1.35,ve*.62,X),F%3===0&&he(ie,$+Math.PI/4,22,.9,ve*.34,X),Q(ie,se,le,$,18,[[0,"rgba(255,255,255,1)"],[.28,"rgba(255,255,255,0.94)"],[.54,Ee(X,.95)],[.78,Ee(X,.38)],[1,"rgba(255,255,255,0)"]]);const pe=new Uh(A);return pe.colorSpace=It,ce.set(te,pe),pe}function Q(T,F,Y,te,fe,A){T.save(),T.translate(64,64),T.rotate(te),T.scale(F,Y);const ie=T.createRadialGradient(0,0,0,0,0,fe);for(const[X,se]of A)ie.addColorStop(X,se);T.fillStyle=ie,T.beginPath(),T.arc(0,0,fe,0,Math.PI*2),T.fill(),T.restore()}function he(T,F,Y,te,fe,A){T.save(),T.translate(64,64),T.rotate(F);const ie=T.createLinearGradient(-Y,0,Y,0);ie.addColorStop(0,"rgba(255,255,255,0)"),ie.addColorStop(.43,Ee(A,fe*.32)),ie.addColorStop(.5,`rgba(255,255,255,${fe})`),ie.addColorStop(.57,Ee(A,fe*.32)),ie.addColorStop(1,"rgba(255,255,255,0)"),T.fillStyle=ie,T.fillRect(-Y,-te/2,Y*2,te),T.restore()}function Ee(T,F){return`rgba(${Math.round(T.r*255)},${Math.round(T.g*255)},${Math.round(T.b*255)},${F})`}return uc(async()=>{await fc(),await De()}),$i(()=>n.graph,()=>{W(!1)},{flush:"post"}),$i(()=>n.selectedKey,()=>{W(!1)},{flush:"post"}),$i(()=>n.safeInsetRight,()=>{He()},{flush:"post"}),$i(()=>n.emphasizeEdges,()=>{W(!1)},{flush:"post"}),dc(()=>{y&&cancelAnimationFrame(y),x?.disconnect(),x=null,u&&(u.domElement.removeEventListener("pointermove",rt),u.domElement.removeEventListener("pointerleave",Ne),u.domElement.removeEventListener("click",qe)),O(E),O(P);for(const T of ce.values())T.dispose();ce.clear(),R.clear(),m?.clear(),d?.dispose(),u?.dispose(),u?.domElement.remove(),u=null,m=null,h=null,d=null,a.value=[]}),e({focusNode:mt,fitView:L,captureView:st,restoreView:lt}),(T,F)=>(Qr(),jr("div",{ref_key:"canvasRoot",ref:s,class:"relationship-galaxy-3d relative h-full w-full overflow-hidden",role:"img","aria-label":i.label},[pc("div",K_,[(Qr(!0),jr(mc,null,_c(a.value,Y=>(Qr(),jr("button",{key:Y.key,type:"button",class:vc(["relationship-galaxy-3d__label",[`relationship-galaxy-3d__label--${Y.emphasis}`,{"relationship-galaxy-3d__label--selected":Y.selected}]]),style:xc({left:`${Y.x}px`,top:`${Y.y}px`,opacity:Y.opacity}),onBlur:te=>ot(Y.key),onClick:gc(te=>Xe(Y.key),["stop"]),onFocus:te=>ze(Y.key),onMouseenter:te=>ze(Y.key),onMouseleave:te=>ot(Y.key),onWheel:ut},Mc(Y.text),47,Z_))),128))])],8,q_))}}),tg=Sc($_,[["__scopeId","data-v-143a6c9e"]]);export{tg as default};
|