@vyr/cli 0.0.1
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/.bin/default/index.js +74 -0
- package/.bin/index.js +17 -0
- package/.entry/app.js +78575 -0
- package/README.md +168 -0
- package/README.zh-CN.md +169 -0
- package/build/css/1060.a79f9d80.css +1 -0
- package/build/css/1111.7f5086f2.css +1 -0
- package/build/css/1124.b91daf98.css +1 -0
- package/build/css/1583.69c975fc.css +1 -0
- package/build/css/2505.39376622.css +1 -0
- package/build/css/4296.963f15af.css +1 -0
- package/build/css/530.e132216c.css +1 -0
- package/build/css/6357.7bd0168e.css +1 -0
- package/build/css/6827.7d5b54a4.css +1 -0
- package/build/css/6881.972ad8f8.css +1 -0
- package/build/css/8093.21e188eb.css +3 -0
- package/build/css/8743.b91daf98.css +1 -0
- package/build/css/9157.971090af.css +1 -0
- package/build/css/9339.e14b8c45.css +1 -0
- package/build/css/login.de13ff0c.css +1 -0
- package/build/css.worker.js +1 -0
- package/build/deps/locale.js +1 -0
- package/build/deps/socket.js +6 -0
- package/build/editor.worker.js +1 -0
- package/build/favicon.ico +0 -0
- package/build/fonts/codicon.5b7d6fac.ttf +0 -0
- package/build/fonts/iconfont.01dfbc15.ttf +0 -0
- package/build/fonts/iconfont.2e5056cd.woff +0 -0
- package/build/html.worker.js +1 -0
- package/build/index.html +1 -0
- package/build/js/1008.1212a92b.js +1 -0
- package/build/js/1018.094a4eaf.js +1 -0
- package/build/js/1048.959d2b15.js +1 -0
- package/build/js/1060.331f9a15.js +1 -0
- package/build/js/1111.8555bd5c.js +1 -0
- package/build/js/112.43f83ad0.js +1 -0
- package/build/js/1124.4cf01e6d.js +1 -0
- package/build/js/1176.03ce189a.js +1 -0
- package/build/js/1320.11b1f843.js +1 -0
- package/build/js/1346.07f056a0.js +1 -0
- package/build/js/1349.8c9198a0.js +1 -0
- package/build/js/1376.c78b811b.js +1 -0
- package/build/js/1384.330a9809.js +1 -0
- package/build/js/1402.4e06e186.js +1 -0
- package/build/js/150.0eb50ff3.js +1 -0
- package/build/js/1583.e8f36a93.js +1 -0
- package/build/js/1592.2007c851.js +1 -0
- package/build/js/1696.67999338.js +7 -0
- package/build/js/1704.a712bcfe.js +1 -0
- package/build/js/1877.41a30a46.js +1 -0
- package/build/js/1978.d78b7ff2.js +1 -0
- package/build/js/2024.61ad4ff8.js +1 -0
- package/build/js/2132.0f13c789.js +1 -0
- package/build/js/220.332f13be.js +1 -0
- package/build/js/2264.74826096.js +1 -0
- package/build/js/2320.01b45f7e.js +1 -0
- package/build/js/2328.91f4fab2.js +1 -0
- package/build/js/2424.1b901127.js +1 -0
- package/build/js/2472.fd550726.js +1 -0
- package/build/js/250.369da5c4.js +1 -0
- package/build/js/2505.b43421df.js +1 -0
- package/build/js/2521.64e8a1c3.js +1 -0
- package/build/js/2576.af7b57dd.js +1 -0
- package/build/js/2674.a0fefa3b.js +1 -0
- package/build/js/2808.2a6f1a99.js +1 -0
- package/build/js/2868.2c921d66.js +1 -0
- package/build/js/2958.148f2f28.js +1 -0
- package/build/js/3084.f01b8161.js +1 -0
- package/build/js/3124.865bbeea.js +1 -0
- package/build/js/3160.ad6a00b2.js +1 -0
- package/build/js/3328.0e752372.js +1 -0
- package/build/js/3416.59bed435.js +1 -0
- package/build/js/3454.fc17644a.js +1 -0
- package/build/js/3507.aafa886d.js +1 -0
- package/build/js/3785.151db669.js +1 -0
- package/build/js/3792.c95b5a4d.js +1 -0
- package/build/js/3944.0eafa506.js +1 -0
- package/build/js/4040.bd29cbd3.js +1 -0
- package/build/js/4124.1c353188.js +1 -0
- package/build/js/4171.ecaed70c.js +1 -0
- package/build/js/4196.1ecc5bb3.js +1 -0
- package/build/js/4230.d1f2577c.js +1 -0
- package/build/js/4263.870a448a.js +1 -0
- package/build/js/4288.cfaa98a7.js +1 -0
- package/build/js/4291.cea6a8d5.js +12 -0
- package/build/js/4296.634b3fe2.js +1 -0
- package/build/js/4416.8faeee6a.js +1 -0
- package/build/js/4490.afacfe53.js +1 -0
- package/build/js/4530.60b7c78d.js +1 -0
- package/build/js/4570.312d27c5.js +1 -0
- package/build/js/4582.a686fadd.js +1 -0
- package/build/js/4587.9701b203.js +1 -0
- package/build/js/4744.fb66347f.js +1 -0
- package/build/js/4764.df45c000.js +1 -0
- package/build/js/4786.89599e34.js +1 -0
- package/build/js/4816.cd55469f.js +1 -0
- package/build/js/4872.0bafb3d5.js +1 -0
- package/build/js/4900.cdee80ca.js +1 -0
- package/build/js/530.b4e0e136.js +1 -0
- package/build/js/5354.9e7d2a59.js +1 -0
- package/build/js/5388.ba7b29bd.js +1 -0
- package/build/js/5620.4ebcd1ef.js +1 -0
- package/build/js/5639.7661231d.js +1 -0
- package/build/js/5694.4e720480.js +1 -0
- package/build/js/5696.1ec004f6.js +5 -0
- package/build/js/5768.ff6d1da1.js +1 -0
- package/build/js/5788.fb009553.js +1 -0
- package/build/js/5804.a7530102.js +1 -0
- package/build/js/5888.e88a2170.js +1 -0
- package/build/js/5918.fd8226fe.js +1 -0
- package/build/js/6136.a7604e8a.js +1 -0
- package/build/js/6166.c3ca51e8.js +1 -0
- package/build/js/6234.8760a038.js +1 -0
- package/build/js/6248.d7c77c1a.js +1 -0
- package/build/js/6308.358e0a94.js +1 -0
- package/build/js/6315.81f5e202.js +7 -0
- package/build/js/6357.1354eb2c.js +1 -0
- package/build/js/6476.133083f0.js +1 -0
- package/build/js/6488.a1bb6380.js +1 -0
- package/build/js/6552.af7ecaa3.js +1 -0
- package/build/js/6600.66570635.js +1 -0
- package/build/js/6720.7e4d97d6.js +1 -0
- package/build/js/677.618fc137.js +1 -0
- package/build/js/6827.62f794a0.js +1 -0
- package/build/js/6881.e7455ee6.js +1 -0
- package/build/js/6937.53af487b.js +1 -0
- package/build/js/6968.07bbc3cd.js +1 -0
- package/build/js/7128.bddbefa5.js +1 -0
- package/build/js/7132.784f034a.js +1 -0
- package/build/js/7167.ba37f9e6.js +1 -0
- package/build/js/7195.7a9c1589.js +1 -0
- package/build/js/7227.9320ac5b.js +7 -0
- package/build/js/7380.378a750c.js +1 -0
- package/build/js/7390.cb73108e.js +6 -0
- package/build/js/7409.871dc004.js +7 -0
- package/build/js/7494.0fecaf55.js +1 -0
- package/build/js/7692.217959b6.js +1 -0
- package/build/js/7713.e38c75be.js +1 -0
- package/build/js/7769.15f4d355.js +1 -0
- package/build/js/7820.84cbe06d.js +1 -0
- package/build/js/7960.6e25b569.js +1 -0
- package/build/js/7980.816096c5.js +1 -0
- package/build/js/800.7696b6c7.js +1 -0
- package/build/js/8004.80b538a1.js +1 -0
- package/build/js/8030.70f27b26.js +1 -0
- package/build/js/8093.b4466960.js +3 -0
- package/build/js/8328.d2170039.js +1 -0
- package/build/js/8344.e4b1e024.js +1 -0
- package/build/js/8366.2854dcb7.js +1 -0
- package/build/js/8438.72c0fcbf.js +1 -0
- package/build/js/8550.69a717cc.js +1 -0
- package/build/js/8554.1dbe7424.js +1 -0
- package/build/js/8632.da334e90.js +1 -0
- package/build/js/8637.20577619.js +1 -0
- package/build/js/8657.d3a8799b.js +1 -0
- package/build/js/8743.2cffd0be.js +1 -0
- package/build/js/88.4db81116.js +1 -0
- package/build/js/8856.9f70af00.js +1 -0
- package/build/js/9020.b3a4d09b.js +1 -0
- package/build/js/9044.73639ece.js +1 -0
- package/build/js/9157.58a8fa2d.js +1 -0
- package/build/js/9256.85fca918.js +1 -0
- package/build/js/931.88800e05.js +1 -0
- package/build/js/9339.d75f7c2e.js +1 -0
- package/build/js/9384.adddd8c7.js +1 -0
- package/build/js/94.59ed492b.js +1 -0
- package/build/js/9620.e7e75a12.js +1 -0
- package/build/js/9751.8b76fab5.js +1 -0
- package/build/js/9842.d1ed9070.js +1 -0
- package/build/js/9947.e172d61d.js +1 -0
- package/build/js/chunk-vendors.fea3dfe0.js +24 -0
- package/build/js/index.b935de87.js +1 -0
- package/build/js/login.1488a09a.js +1 -0
- package/build/js/preview.6c550af7.js +1 -0
- package/build/json.worker.js +1 -0
- package/build/login.html +1 -0
- package/build/logo//344/270/273LOGO.png +0 -0
- package/build/logo//344/270/273/345/233/276/346/240/207.png +0 -0
- package/build/logo//344/270/273/346/226/271/345/275/242.png +0 -0
- package/build/logo//347/201/260/345/272/246LOGO.png +0 -0
- package/build/logo//351/200/217/346/230/216/345/233/276/346/240/207.png +0 -0
- package/build/logo//351/200/217/346/230/216/350/203/214/346/231/257LOGO.png +0 -0
- package/build/preview.html +1 -0
- package/build/ts.worker.js +6 -0
- package/pack/auto-provider-plugin/index.js +38 -0
- package/pack/auto-provider-plugin/loader.js +53 -0
- package/pack/auto-provider-plugin/package.json +8 -0
- package/pack/class-wrapper-plugin/index.js +42 -0
- package/pack/class-wrapper-plugin/loaders/descriptor.js +89 -0
- package/pack/class-wrapper-plugin/loaders/dynamic-interpreter.js +54 -0
- package/pack/class-wrapper-plugin/loaders/index.js +30 -0
- package/pack/class-wrapper-plugin/loaders/input-system.js +31 -0
- package/pack/class-wrapper-plugin/loaders/object-pool.js +79 -0
- package/pack/class-wrapper-plugin/package.json +8 -0
- package/pack/class-wrapper-plugin/utils.js +79 -0
- package/pack/rollup-config-plugin/build/index.d.ts +3 -0
- package/pack/rollup-config-plugin/build/index.js +34 -0
- package/pack/rollup-config-plugin/package.json +8 -0
- package/pack/rollup-config-plugin/src/index.ts +47 -0
- package/pack/rollup-config-plugin/tsconfig.json +31 -0
- package/pack/var-rename-plugin/index.js +74 -0
- package/pack/var-rename-plugin/package.json +8 -0
- package/package.json +83 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";(self["webpackChunk_vyr_cli"]=self["webpackChunk_vyr_cli"]||[]).push([[1696],{11696:function(t,e,i){i.d(e,{$EB:function(){return z},$Ed:function(){return hh},$Kf:function(){return _a},$NF:function(){return yl},$O9:function(){return Rt},$Yl:function(){return $},$_I:function(){return Vt},$ei:function(){return V},$p8:function(){return Fl},A$4:function(){return Xn},AKb:function(){return qu},ALV:function(){return rr},AQS:function(){return Is},Am1:function(){return $l},B69:function(){return un},B6O:function(){return Jh},BER:function(){return bt},BH$:function(){return Sh},BKk:function(){return Io},BND:function(){return Sp},BRH:function(){return xl},BXX:function(){return me},B_h:function(){return Se},CMB:function(){return ie},CR7:function(){return Ai},CSG:function(){return Eu},CV9:function(){return hc},CVz:function(){return be},CWW:function(){return We},Cfg:function(){return Pt},CmU:function(){return Wl},CwR:function(){return yd},D$Q:function(){return zu},DAe:function(){return Ke},DXC:function(){return wh},Df:function(){return Bu},Dmk:function(){return $t},E0M:function(){return Cp},EAD:function(){return Ca},EQC:function(){return Ze},EZo:function(){return k},EdD:function(){return R},F1T:function(){return No},F1l:function(){return op},FCc:function(){return Mh},FFZ:function(){return Ni},FNr:function(){return Fu},FV:function(){return ft},FXf:function(){return O},FZo:function(){return Ll},Fn:function(){return Fe},Fpm:function(){return tp},FvD:function(){return Ph},Fvi:function(){return vt},Fvt:function(){return Nu},G3T:function(){return De},GBG:function(){return tl},GJx:function(){return zt},GOR:function(){return Fh},GWd:function(){return te},GYF:function(){return Aa},GZZ:function(){return nc},G_z:function(){return Pu},Gu$:function(){return xu},Gwm:function(){return nt},GxU:function(){return Vn},H23:function(){return Ne},H2z:function(){return Bp},HIg:function(){return Kt},HLH:function(){return gi},HO_:function(){return Ue},HPb:function(){return Mi},HXV:function(){return ge},HgN:function(){return Js},HiM:function(){return Rl},Hit:function(){return Ku},Ho_:function(){return yc},Hrb:function(){return Jn},Hrq:function(){return Hi},I46:function(){return Sa},I9Y:function(){return Ts},IE4:function(){return le},IUQ:function(){return Qs},IWo:function(){return Mp},Iit:function(){return So},Ipv:function(){return Vh},Iw4:function(){return Pd},IzY:function(){return Ip},Jnc:function(){return b},K52:function(){return ot},KDk:function(){return we},KLL:function(){return pi},KPJ:function(){return hl},KRh:function(){return ct},Ke9:function(){return Qe},Kef:function(){return Le},Ktl:function(){return ji},Kwu:function(){return B},Kzg:function(){return Zl},Kzv:function(){return ee},LAk:function(){return gt},Ld9:function(){return kp},LiQ:function(){return W},LlO:function(){return To},LoY:function(){return no},LuO:function(){return Ld},MBL:function(){return el},MOq:function(){return qi},MSw:function(){return yu},MW4:function(){return Yn},Mjd:function(){return pt},Mmk:function(){return Vs},N1A:function(){return gh},N2s:function(){return gd},N5j:function(){return ri},NRn:function(){return cr},NTi:function(){return I},NZq:function(){return Lt},Nex:function(){return Op},Nt7:function(){return J},Nv2:function(){return kh},Nwf:function(){return Id},Nz6:function(){return de},O0B:function(){return Ks},O3Y:function(){return vu},O49:function(){return ei},O9p:function(){return Jr},ONl:function(){return Ch},OUM:function(){return jt},Oax:function(){return Gn},Om:function(){return Tt},OuU:function(){return H},P5j:function(){return kd},PFK:function(){return yp},PJ3:function(){return Xe},PPD:function(){return Ha},PTz:function(){return nr},Pdi:function(){return Xu},Pem:function(){return Rh},Pf$:function(){return cd},Pq0:function(){return or},Q1f:function(){return In},QCA:function(){return cu},QP0:function(){return M},Qev:function(){return Qi},Qrf:function(){return Te},R1W:function(){return up},R3r:function(){return Wo},RJ4:function(){return ti},ROr:function(){return xi},RQf:function(){return Jt},RcT:function(){return Ti},RiT:function(){return sl},Riy:function(){return ve},Rkk:function(){return si},RlV:function(){return Or},RoJ:function(){return Yo},RrE:function(){return G},Ru$:function(){return bi},RyA:function(){return _},S$4:function(){return Oe},S20:function(){return Lh},SUR:function(){return Dl},SYV:function(){return Bh},ScU:function(){return gl},T6I:function(){return Qu},TDQ:function(){return _c},THS:function(){return Wn},TMh:function(){return Ci},Tap:function(){return bl},TdN:function(){return Yi},TiK:function(){return Pi},TkQ:function(){return he},U3G:function(){return rt},UJ6:function(){return Gu},UPV:function(){return wu},UTZ:function(){return wt},Ufg:function(){return pu},UpK:function(){return pa},UtB:function(){return Yd},UtX:function(){return Gl},V3x:function(){return Gt},V9B:function(){return Pn},VCu:function(){return Nh},VGF:function(){return ce},VT0:function(){return ne},VVr:function(){return fi},Vb5:function(){return x},VnP:function(){return oc},Vnu:function(){return Li},Vwu:function(){return Np},VxR:function(){return di},W9U:function(){return Ve},WBB:function(){return du},WNZ:function(){return g},WTh:function(){return bp},Wdf:function(){return Zi},Wew:function(){return Zt},Wk7:function(){return S},Wyr:function(){return Xi},XG_:function(){return je},XIg:function(){return C},XJ7:function(){return Su},XMJ:function(){return Ed},XTe:function(){return Hl},XrR:function(){return ut},Y9S:function(){return pl},YHV:function(){return qd},YJl:function(){return jo},YOZ:function(){return $u},YRT:function(){return fl},Yhb:function(){return Yu},Yuy:function(){return Ht},Z0B:function(){return sc},Z58:function(){return qo},ZLX:function(){return Na},ZM4:function(){return _p},ZQM:function(){return oe},Zcv:function(){return Ua},Zpd:function(){return bu},Zr2:function(){return li},ZyN:function(){return Ol},_4j:function(){return Cu},_QJ:function(){return Ie},_Ut:function(){return Ao},_xc:function(){return rp},a$r:function(){return Et},a55:function(){return is},a5J:function(){return Ce},aEY:function(){return Z},aHM:function(){return ul},aJ8:function(){return xt},aMy:function(){return He},aVO:function(){return Ou},agE:function(){return Vi},amv:function(){return ki},b4q:function(){return Vo},bC7:function(){return Re},bCz:function(){return P},bI3:function(){return ai},bTm:function(){return w},baL:function(){return Hn},bdM:function(){return mu},bkx:function(){return qt},brA:function(){return it},bw0:function(){return at},c5h:function(){return Oh},c90:function(){return ue},cHt:function(){return Dt},cRK:function(){return Do},cZY:function(){return Qd},caT:function(){return ht},cj9:function(){return As},czI:function(){return _e},dAo:function(){return ac},dYF:function(){return sr},dcC:function(){return re},dhZ:function(){return $e},dth:function(){return wl},dwI:function(){return zs},dzP:function(){return Vd},e0p:function(){return Q},eB$:function(){return Jo},eHc:function(){return tt},eHs:function(){return Zo},eaF:function(){return xo},eoi:function(){return Ei},er$:function(){return ui},ezk:function(){return Zu},f4X:function(){return U},fBL:function(){return Wt},fJr:function(){return vi},fP5:function(){return ud},fTw:function(){return lp},fc6:function(){return qn},g7M:function(){return yt},gJ2:function(){return Yt},gO9:function(){return E},gPd:function(){return $s},gWB:function(){return Fi},ghU:function(){return Ct},h2z:function(){return Ge},hB5:function(){return A},hIf:function(){return Wi},hZF:function(){return il},h_9:function(){return cl},hdd:function(){return q},hgQ:function(){return Y},hjs:function(){return Jd},hsX:function(){return T},hxR:function(){return kt},hy7:function(){return Mt},hzE:function(){return dp},i7d:function(){return ko},i7u:function(){return Gi},iNn:function(){return wo},iOZ:function(){return Eh},iUH:function(){return Nt},ibB:function(){return jh},ie2:function(){return D},imn:function(){return Rn},ix0:function(){return Xt},iyt:function(){return zr},j6:function(){return Mu},jGm:function(){return lc},jR7:function(){return pe},jUj:function(){return Ho},jej:function(){return Fs},jf0:function(){return ci},jsO:function(){return _i},jut:function(){return jl},jzd:function(){return Oi},k6Q:function(){return fe},k6q:function(){return Ot},k8v:function(){return oi},kBv:function(){return f},kEx:function(){return ml},kG0:function(){return yi},kLi:function(){return Zs},kO0:function(){return Ri},kRr:function(){return Ft},kTW:function(){return It},kTp:function(){return ye},kYr:function(){return Si},k_V:function(){return Xd},keZ:function(){return ed},klZ:function(){return zi},kn4:function(){return Fr},kqe:function(){return mi},kxk:function(){return ca},kyO:function(){return dt},l2R:function(){return al},lGu:function(){return et},lGw:function(){return Ju},lMl:function(){return _n},lPF:function(){return Ps},lc7:function(){return qe},ljd:function(){return Je},lxW:function(){return Mo},lyL:function(){return Be},mcG:function(){return Os},mrM:function(){return ch},nCl:function(){return zl},nEu:function(){return bc},nNL:function(){return mt},nST:function(){return F},nWS:function(){return tr},nZQ:function(){return id},nc$:function(){return Fd},nzx:function(){return pc},o6l:function(){return Lo},oVO:function(){return wi},oh6:function(){return jd},ojh:function(){return L},ojs:function(){return Ee},ov9:function(){return K},pBf:function(){return xe},pFK:function(){return xc},pHI:function(){return Bt},pPE:function(){return Bd},paN:function(){return ae},ppV:function(){return Ws},psI:function(){return ze},q2:function(){return Tu},qBx:function(){return Ru},qFE:function(){return gc},qU7:function(){return mc},qUd:function(){return Pl},qa3:function(){return Me},qad:function(){return j},qq$:function(){return Rs},qtW:function(){return $n},r6x:function(){return Ul},rFo:function(){return er},rKP:function(){return fu},rOG:function(){return Ji},rQf:function(){return Ye},rSH:function(){return Ae},rYR:function(){return ii},rrX:function(){return Od},s0K:function(){return rc},sKt:function(){return Ii},sPf:function(){return m},tBo:function(){return Wd},tJf:function(){return Ut},tXL:function(){return ku},tcD:function(){return fc},tz3:function(){return rl},uB5:function(){return ke},uSd:function(){return Iu},uV5:function(){return At},uWO:function(){return Ia},uXQ:function(){return Ui},ubm:function(){return Eo},uov:function(){return Di},ure:function(){return Nl},v9J:function(){return $i},veJ:function(){return vl},vim:function(){return Bi},vmz:function(){return Zn},vyJ:function(){return hi},wAk:function(){return dc},wTz:function(){return ni},wfO:function(){return _t},wn6:function(){return X},wrO:function(){return Qt},wtR:function(){return y},wvS:function(){return Dn},xFO:function(){return St},xJ6:function(){return ou},xOk:function(){return Vl},xSv:function(){return st},xZx:function(){return fd},xfg:function(){return cc},xiE:function(){return Ns},y3Z:function(){return Pe},y9J:function(){return ir},y_p:function(){return lt},ypk:function(){return Ac},ywQ:function(){return v},zD7:function(){return sd},zdS:function(){return se},zgK:function(){return Xr},znC:function(){return N}});var s=Object.defineProperty,r=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,c=Math.pow,u=(t,e,i)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,l=(t,e)=>{for(var i in e||(e={}))a.call(e,i)&&u(t,i,e[i]);if(o)for(var i of o(e))h.call(e,i)&&u(t,i,e[i]);return t},d=(t,e)=>r(t,n(e)),p=(t,e,i)=>new Promise((s,r)=>{var n=t=>{try{a(i.next(t))}catch(e){r(e)}},o=t=>{try{a(i.throw(t))}catch(e){r(e)}},a=t=>t.done?s(t.value):Promise.resolve(t.value).then(n,o);a((i=i.apply(t,e)).next())});
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2010-2025 Three.js Authors
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
const m="175",f={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},y={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},g=0,x=1,b=2,v=3,w=0,M=1,S=2,_=3,A=0,T=1,z=2,C=0,I=1,k=2,B=3,R=4,P=5,E=100,O=101,F=102,N=103,V=104,L=200,j=201,U=202,W=203,D=204,H=205,q=206,J=207,X=208,Z=209,Y=210,G=211,$=212,Q=213,K=214,tt=0,et=1,it=2,st=3,rt=4,nt=5,ot=6,at=7,ht=0,ct=1,ut=2,lt=0,dt=1,pt=2,mt=3,ft=4,yt=5,gt=6,xt=7,bt="attached",vt="detached",wt=300,Mt=301,St=302,_t=303,At=304,Tt=306,zt=1e3,Ct=1001,It=1002,kt=1003,Bt=1004,Rt=1004,Pt=1005,Et=1005,Ot=1006,Ft=1007,Nt=1007,Vt=1008,Lt=1008,jt=1009,Ut=1010,Wt=1011,Dt=1012,Ht=1013,qt=1014,Jt=1015,Xt=1016,Zt=1017,Yt=1018,Gt=1020,$t=35902,Qt=1021,Kt=1022,te=1023,ee=1024,ie=1025,se=1026,re=1027,ne=1028,oe=1029,ae=1030,he=1031,ce=1032,ue=1033,le=33776,de=33777,pe=33778,me=33779,fe=35840,ye=35841,ge=35842,xe=35843,be=36196,ve=37492,we=37496,Me=37808,Se=37809,_e=37810,Ae=37811,Te=37812,ze=37813,Ce=37814,Ie=37815,ke=37816,Be=37817,Re=37818,Pe=37819,Ee=37820,Oe=37821,Fe=36492,Ne=36494,Ve=36495,Le=36283,je=36284,Ue=36285,We=36286,De=2200,He=2201,qe=2202,Je=2300,Xe=2301,Ze=2302,Ye=2400,Ge=2401,$e=2402,Qe=2500,Ke=2501,ti=0,ei=1,ii=2,si=3200,ri=3201,ni=3202,oi=3203,ai=0,hi=1,ci="",ui="srgb",li="srgb-linear",di="linear",pi="srgb",mi=0,fi=7680,yi=7681,gi=7682,xi=7683,bi=34055,vi=34056,wi=5386,Mi=512,Si=513,_i=514,Ai=515,Ti=516,zi=517,Ci=518,Ii=519,ki=512,Bi=513,Ri=514,Pi=515,Ei=516,Oi=517,Fi=518,Ni=519,Vi=35044,Li=35048,ji=35040,Ui=35045,Wi=35049,Di=35041,Hi=35046,qi=35050,Ji=35042,Xi="100",Zi="300 es",Yi=2e3,Gi=2001,$i={COMPUTE:"compute",RENDER:"render"};class Qi{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const s=i[t];if(void 0!==s){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,s=e.length;i<s;i++)e[i].call(this,t);t.target=null}}}const Ki=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let ts=1234567;const es=Math.PI/180,is=180/Math.PI;function ss(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,r=Ki[255&t]+Ki[t>>8&255]+Ki[t>>16&255]+Ki[t>>24&255]+"-"+Ki[255&e]+Ki[e>>8&255]+"-"+Ki[e>>16&15|64]+Ki[e>>24&255]+"-"+Ki[63&i|128]+Ki[i>>8&255]+"-"+Ki[i>>16&255]+Ki[i>>24&255]+Ki[255&s]+Ki[s>>8&255]+Ki[s>>16&255]+Ki[s>>24&255];return r.toLowerCase()}function rs(t,e,i){return Math.max(e,Math.min(i,t))}function ns(t,e){return(t%e+e)%e}function os(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)}function as(t,e,i){return t!==e?(i-t)/(e-t):0}function hs(t,e,i){return(1-i)*t+i*e}function cs(t,e,i,s){return hs(t,e,1-Math.exp(-i*s))}function us(t,e=1){return e-Math.abs(ns(t,2*e)-e)}function ls(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*(3-2*t))}function ds(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*t*(t*(6*t-15)+10))}function ps(t,e){return t+Math.floor(Math.random()*(e-t+1))}function ms(t,e){return t+Math.random()*(e-t)}function fs(t){return t*(.5-Math.random())}function ys(t){void 0!==t&&(ts=t);let e=ts+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function gs(t){return t*es}function xs(t){return t*is}function bs(t){return 0===(t&t-1)&&0!==t}function vs(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ws(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Ms(t,e,i,s,r){const n=Math.cos,o=Math.sin,a=n(i/2),h=o(i/2),c=n((e+s)/2),u=o((e+s)/2),l=n((e-s)/2),d=o((e-s)/2),p=n((s-e)/2),m=o((s-e)/2);switch(r){case"XYX":t.set(a*u,h*l,h*d,a*c);break;case"YZY":t.set(h*d,a*u,h*l,a*c);break;case"ZXZ":t.set(h*l,h*d,a*u,a*c);break;case"XZX":t.set(a*u,h*m,h*p,a*c);break;case"YXY":t.set(h*p,a*u,h*m,a*c);break;case"ZYZ":t.set(h*m,h*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ss(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function _s(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const As={DEG2RAD:es,RAD2DEG:is,generateUUID:ss,clamp:rs,euclideanModulo:ns,mapLinear:os,inverseLerp:as,lerp:hs,damp:cs,pingpong:us,smoothstep:ls,smootherstep:ds,randInt:ps,randFloat:ms,randFloatSpread:fs,seededRandom:ys,degToRad:gs,radToDeg:xs,isPowerOfTwo:bs,ceilPowerOfTwo:vs,floorPowerOfTwo:ws,setQuaternionFromProperEuler:Ms,normalize:_s,denormalize:Ss};class Ts{constructor(t=0,e=0){Ts.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=rs(this.x,t.x,e.x),this.y=rs(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=rs(this.x,t,e),this.y=rs(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rs(i,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){const t=Math.atan2(-this.y,-this.x)+Math.PI;return t}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(rs(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*i-n*s+t.x,this.y=r*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class zs{constructor(t,e,i,s,r,n,o,a,h){zs.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,o,a,h)}set(t,e,i,s,r,n,o,a,h){const c=this.elements;return c[0]=t,c[1]=s,c[2]=o,c[3]=e,c[4]=r,c[5]=a,c[6]=i,c[7]=n,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,r=this.elements,n=i[0],o=i[3],a=i[6],h=i[1],c=i[4],u=i[7],l=i[2],d=i[5],p=i[8],m=s[0],f=s[3],y=s[6],g=s[1],x=s[4],b=s[7],v=s[2],w=s[5],M=s[8];return r[0]=n*m+o*g+a*v,r[3]=n*f+o*x+a*w,r[6]=n*y+o*b+a*M,r[1]=h*m+c*g+u*v,r[4]=h*f+c*x+u*w,r[7]=h*y+c*b+u*M,r[2]=l*m+d*g+p*v,r[5]=l*f+d*x+p*w,r[8]=l*y+d*b+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],o=t[5],a=t[6],h=t[7],c=t[8];return e*n*c-e*o*h-i*r*c+i*o*a+s*r*h-s*n*a}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],o=t[5],a=t[6],h=t[7],c=t[8],u=c*n-o*h,l=o*a-c*r,d=h*r-n*a,p=e*u+i*l+s*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=u*m,t[1]=(s*h-c*i)*m,t[2]=(o*i-s*n)*m,t[3]=l*m,t[4]=(c*e-s*a)*m,t[5]=(s*r-o*e)*m,t[6]=d*m,t[7]=(i*a-h*e)*m,t[8]=(n*e-i*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,r,n,o){const a=Math.cos(r),h=Math.sin(r);return this.set(i*a,i*h,-i*(a*n+h*o)+n+t,-s*h,s*a,-s*(-h*n+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Cs.makeScale(t,e)),this}rotate(t){return this.premultiply(Cs.makeRotation(-t)),this}translate(t,e){return this.premultiply(Cs.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<9;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Cs=new zs;function Is(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const ks={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Bs(t,e){return new ks[t](e)}function Rs(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Ps(){const t=Rs("canvas");return t.style.display="block",t}const Es={};function Os(t){t in Es||(Es[t]=!0,console.warn(t))}function Fs(t,e,i){return new Promise(function(s,r){function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,i);break;default:s()}}setTimeout(n,i)})}function Ns(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Vs(t){const e=t.elements,i=-1===e[11];i?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=1-e[14])}const Ls=(new zs).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),js=(new zs).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Us(){const t={enabled:!0,workingColorSpace:li,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===pi&&(t.r=Ds(t.r),t.g=Ds(t.g),t.b=Ds(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===pi&&(t.r=Hs(t.r),t.g=Hs(t.g),t.b=Hs(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===ci?di:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],s=[.3127,.329];return t.define({[li]:{primaries:e,whitePoint:s,transfer:di,toXYZ:Ls,fromXYZ:js,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:ui},outputColorSpaceConfig:{drawingBufferColorSpace:ui}},[ui]:{primaries:e,whitePoint:s,transfer:pi,toXYZ:Ls,fromXYZ:js,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:ui}}}),t}const Ws=Us();function Ds(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Hs(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let qs;class Js{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"===typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===qs&&(qs=Rs("canvas")),qs.width=t.width,qs.height=t.height;const e=qs.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=qs}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap){const e=Rs("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let t=0;t<r.length;t++)r[t]=255*Ds(r[t]/255);return i.putImageData(s,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Ds(e[t]/255)):e[t]=Ds(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Xs=0;class Zs{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Xs++}),this.uuid=ss(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"===typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(null!==s){let t;if(Array.isArray(s)){t=[];for(let e=0,i=s.length;e<i;e++)s[e].isDataTexture?t.push(Ys(s[e].image)):t.push(Ys(s[e]))}else t=Ys(s);i.url=t}return e||(t.images[this.uuid]=i),i}}function Ys(t){return"undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap?Js.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Gs=0;class $s extends Qi{constructor(t=$s.DEFAULT_IMAGE,e=$s.DEFAULT_MAPPING,i=Ct,s=Ct,r=Ot,n=Vt,o=te,a=jt,h=$s.DEFAULT_ANISOTROPY,c=ci){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Gs++}),this.uuid=ss(),this.name="",this.source=new Zs(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=n,this.anisotropy=h,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Ts(0,0),this.repeat=new Ts(1,1),this.center=new Ts(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zs,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"===typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==wt)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case zt:t.x=t.x-Math.floor(t.x);break;case Ct:t.x=t.x<0?0:1;break;case It:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case zt:t.y=t.y-Math.floor(t.y);break;case Ct:t.y=t.y<0?0:1;break;case It:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}$s.DEFAULT_IMAGE=null,$s.DEFAULT_MAPPING=wt,$s.DEFAULT_ANISOTROPY=1;class Qs{constructor(t=0,e=0,i=0,s=1){Qs.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*e+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*e+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*e+n[7]*i+n[11]*s+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,r;const n=.01,o=.1,a=t.elements,h=a[0],c=a[4],u=a[8],l=a[1],d=a[5],p=a[9],m=a[2],f=a[6],y=a[10];if(Math.abs(c-l)<n&&Math.abs(u-m)<n&&Math.abs(p-f)<n){if(Math.abs(c+l)<o&&Math.abs(u+m)<o&&Math.abs(p+f)<o&&Math.abs(h+d+y-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(h+1)/2,a=(d+1)/2,g=(y+1)/2,x=(c+l)/4,b=(u+m)/4,v=(p+f)/4;return t>a&&t>g?t<n?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(t),s=x/i,r=b/i):a>g?a<n?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(a),i=x/s,r=v/s):g<n?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(g),i=b/r,s=v/r),this.set(i,s,r,e),this}let g=Math.sqrt((f-p)*(f-p)+(u-m)*(u-m)+(l-c)*(l-c));return Math.abs(g)<.001&&(g=1),this.x=(f-p)/g,this.y=(u-m)/g,this.z=(l-c)/g,this.w=Math.acos((h+d+y-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=rs(this.x,t.x,e.x),this.y=rs(this.y,t.y,e.y),this.z=rs(this.z,t.z,e.z),this.w=rs(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=rs(this.x,t,e),this.y=rs(this.y,t,e),this.z=rs(this.z,t,e),this.w=rs(this.w,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rs(i,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Ks extends Qi{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Qs(0,0,t,e),this.scissorTest=!1,this.viewport=new Qs(0,0,t,e);const s={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ot,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const r=new $s(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);r.flipY=!1,r.generateMipmaps=i.generateMipmaps,r.internalFormat=i.internalFormat,this.textures=[];const n=i.count;for(let o=0;o<n;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=i;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const i=Object.assign({},t.textures[e].image);this.textures[e].source=new Zs(i)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class tr extends Ks{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class er extends $s{constructor(t=null,e=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=kt,this.minFilter=kt,this.wrapR=Ct,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ir extends tr{constructor(t=1,e=1,i=1,s={}){super(t,e,s),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new er(null,t,e,i),this.texture.isRenderTargetTexture=!0}}class sr extends $s{constructor(t=null,e=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=kt,this.minFilter=kt,this.wrapR=Ct,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rr extends tr{constructor(t=1,e=1,i=1,s={}){super(t,e,s),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new sr(null,t,e,i),this.texture.isRenderTargetTexture=!0}}class nr{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,n,o){let a=i[s+0],h=i[s+1],c=i[s+2],u=i[s+3];const l=r[n+0],d=r[n+1],p=r[n+2],m=r[n+3];if(0===o)return t[e+0]=a,t[e+1]=h,t[e+2]=c,void(t[e+3]=u);if(1===o)return t[e+0]=l,t[e+1]=d,t[e+2]=p,void(t[e+3]=m);if(u!==m||a!==l||h!==d||c!==p){let t=1-o;const e=a*l+h*d+c*p+u*m,i=e>=0?1:-1,s=1-e*e;if(s>Number.EPSILON){const r=Math.sqrt(s),n=Math.atan2(r,e*i);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r}const r=o*i;if(a=a*t+l*r,h=h*t+d*r,c=c*t+p*r,u=u*t+m*r,t===1-o){const t=1/Math.sqrt(a*a+h*h+c*c+u*u);a*=t,h*=t,c*=t,u*=t}}t[e]=a,t[e+1]=h,t[e+2]=c,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,r,n){const o=i[s],a=i[s+1],h=i[s+2],c=i[s+3],u=r[n],l=r[n+1],d=r[n+2],p=r[n+3];return t[e]=o*p+c*u+a*d-h*l,t[e+1]=a*p+c*l+h*u-o*d,t[e+2]=h*p+c*d+o*l-a*u,t[e+3]=c*p-o*u-a*l-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,s=t._y,r=t._z,n=t._order,o=Math.cos,a=Math.sin,h=o(i/2),c=o(s/2),u=o(r/2),l=a(i/2),d=a(s/2),p=a(r/2);switch(n){case"XYZ":this._x=l*c*u+h*d*p,this._y=h*d*u-l*c*p,this._z=h*c*p+l*d*u,this._w=h*c*u-l*d*p;break;case"YXZ":this._x=l*c*u+h*d*p,this._y=h*d*u-l*c*p,this._z=h*c*p-l*d*u,this._w=h*c*u+l*d*p;break;case"ZXY":this._x=l*c*u-h*d*p,this._y=h*d*u+l*c*p,this._z=h*c*p+l*d*u,this._w=h*c*u-l*d*p;break;case"ZYX":this._x=l*c*u-h*d*p,this._y=h*d*u+l*c*p,this._z=h*c*p-l*d*u,this._w=h*c*u+l*d*p;break;case"YZX":this._x=l*c*u+h*d*p,this._y=h*d*u+l*c*p,this._z=h*c*p-l*d*u,this._w=h*c*u-l*d*p;break;case"XZY":this._x=l*c*u-h*d*p,this._y=h*d*u-l*c*p,this._z=h*c*p+l*d*u,this._w=h*c*u+l*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],s=e[4],r=e[8],n=e[1],o=e[5],a=e[9],h=e[2],c=e[6],u=e[10],l=i+o+u;if(l>0){const t=.5/Math.sqrt(l+1);this._w=.25/t,this._x=(c-a)*t,this._y=(r-h)*t,this._z=(n-s)*t}else if(i>o&&i>u){const t=2*Math.sqrt(1+i-o-u);this._w=(c-a)/t,this._x=.25*t,this._y=(s+n)/t,this._z=(r+h)/t}else if(o>u){const t=2*Math.sqrt(1+o-i-u);this._w=(r-h)/t,this._x=(s+n)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+u-i-o);this._w=(n-s)/t,this._x=(r+h)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(rs(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const s=Math.min(1,e/i);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,s=t._y,r=t._z,n=t._w,o=e._x,a=e._y,h=e._z,c=e._w;return this._x=i*c+n*o+s*h-r*a,this._y=s*c+n*a+r*o-i*h,this._z=r*c+n*h+i*a-s*o,this._w=n*c-i*o-s*a-r*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,s=this._y,r=this._z,n=this._w;let o=n*t._w+i*t._x+s*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=n,this._x=i,this._y=s,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*n+e*this._w,this._x=t*i+e*this._x,this._y=t*s+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const h=Math.sqrt(a),c=Math.atan2(h,o),u=Math.sin((1-e)*c)/h,l=Math.sin(e*c)/h;return this._w=n*u+this._w*l,this._x=i*u+this._x*l,this._y=s*u+this._y*l,this._z=r*u+this._z*l,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class or{constructor(t=0,e=0,i=0){or.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(hr.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(hr.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(t){const e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,o=t.z,a=t.w,h=2*(n*s-o*i),c=2*(o*e-r*s),u=2*(r*i-n*e);return this.x=e+a*h+n*u-o*c,this.y=i+a*c+o*h-r*u,this.z=s+a*u+r*c-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=rs(this.x,t.x,e.x),this.y=rs(this.y,t.y,e.y),this.z=rs(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=rs(this.x,t,e),this.y=rs(this.y,t,e),this.z=rs(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rs(i,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,s=t.y,r=t.z,n=e.x,o=e.y,a=e.z;return this.x=s*a-r*o,this.y=r*n-i*a,this.z=i*o-s*n,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return ar.copy(this).projectOnVector(t),this.sub(ar)}reflect(t){return this.sub(ar.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(rs(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ar=new or,hr=new nr;class cr{constructor(t=new or(1/0,1/0,1/0),e=new or(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(lr.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(lr.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=lr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const s=i.getAttribute("position");if(!0===e&&void 0!==s&&!0!==t.isInstancedMesh)for(let e=0,i=s.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,lr):lr.fromBufferAttribute(s,e),lr.applyMatrix4(t.matrixWorld),this.expandByPoint(lr);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),dr.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),dr.copy(i.boundingBox)),dr.applyMatrix4(t.matrixWorld),this.union(dr)}const s=t.children;for(let r=0,n=s.length;r<n;r++)this.expandByObject(s[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,lr),lr.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(br),vr.subVectors(this.max,br),pr.subVectors(t.a,br),mr.subVectors(t.b,br),fr.subVectors(t.c,br),yr.subVectors(mr,pr),gr.subVectors(fr,mr),xr.subVectors(pr,fr);let e=[0,-yr.z,yr.y,0,-gr.z,gr.y,0,-xr.z,xr.y,yr.z,0,-yr.x,gr.z,0,-gr.x,xr.z,0,-xr.x,-yr.y,yr.x,0,-gr.y,gr.x,0,-xr.y,xr.x,0];return!!Sr(e,pr,mr,fr,vr)&&(e=[1,0,0,0,1,0,0,0,1],!!Sr(e,pr,mr,fr,vr)&&(wr.crossVectors(yr,gr),e=[wr.x,wr.y,wr.z],Sr(e,pr,mr,fr,vr)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,lr).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(lr).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(ur[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ur[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ur[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ur[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ur[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ur[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ur[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ur[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ur)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const ur=[new or,new or,new or,new or,new or,new or,new or,new or],lr=new or,dr=new cr,pr=new or,mr=new or,fr=new or,yr=new or,gr=new or,xr=new or,br=new or,vr=new or,wr=new or,Mr=new or;function Sr(t,e,i,s,r){for(let n=0,o=t.length-3;n<=o;n+=3){Mr.fromArray(t,n);const o=r.x*Math.abs(Mr.x)+r.y*Math.abs(Mr.y)+r.z*Math.abs(Mr.z),a=e.dot(Mr),h=i.dot(Mr),c=s.dot(Mr);if(Math.max(-Math.max(a,h,c),Math.min(a,h,c))>o)return!1}return!0}const _r=new cr,Ar=new or,Tr=new or;class zr{constructor(t=new or,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):_r.setFromPoints(t).getCenter(i);let s=0;for(let r=0,n=t.length;r<n;r++)s=Math.max(s,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Ar.subVectors(t,this.center);const e=Ar.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(Ar,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Tr.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ar.copy(t.center).add(Tr)),this.expandByPoint(Ar.copy(t.center).sub(Tr))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Cr=new or,Ir=new or,kr=new or,Br=new or,Rr=new or,Pr=new or,Er=new or;class Or{constructor(t=new or,e=new or(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Cr)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Cr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Cr.copy(this.origin).addScaledVector(this.direction,e),Cr.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){Ir.copy(t).add(e).multiplyScalar(.5),kr.copy(e).sub(t).normalize(),Br.copy(this.origin).sub(Ir);const r=.5*t.distanceTo(e),n=-this.direction.dot(kr),o=Br.dot(this.direction),a=-Br.dot(kr),h=Br.lengthSq(),c=Math.abs(1-n*n);let u,l,d,p;if(c>0)if(u=n*a-o,l=n*o-a,p=r*c,u>=0)if(l>=-p)if(l<=p){const t=1/c;u*=t,l*=t,d=u*(u+n*l+2*o)+l*(n*u+l+2*a)+h}else l=r,u=Math.max(0,-(n*l+o)),d=-u*u+l*(l+2*a)+h;else l=-r,u=Math.max(0,-(n*l+o)),d=-u*u+l*(l+2*a)+h;else l<=-p?(u=Math.max(0,-(-n*r+o)),l=u>0?-r:Math.min(Math.max(-r,-a),r),d=-u*u+l*(l+2*a)+h):l<=p?(u=0,l=Math.min(Math.max(-r,-a),r),d=l*(l+2*a)+h):(u=Math.max(0,-(n*r+o)),l=u>0?r:Math.min(Math.max(-r,-a),r),d=-u*u+l*(l+2*a)+h);else l=n>0?-r:r,u=Math.max(0,-(n*l+o)),d=-u*u+l*(l+2*a)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(Ir).addScaledVector(kr,l),d}intersectSphere(t,e){Cr.subVectors(t.center,this.origin);const i=Cr.dot(this.direction),s=Cr.dot(Cr)-i*i,r=t.radius*t.radius;if(s>r)return null;const n=Math.sqrt(r-s),o=i-n,a=i+n;return a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;const i=t.normal.dot(this.direction);return i*e<0}intersectBox(t,e){let i,s,r,n,o,a;const h=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,l=this.origin;return h>=0?(i=(t.min.x-l.x)*h,s=(t.max.x-l.x)*h):(i=(t.max.x-l.x)*h,s=(t.min.x-l.x)*h),c>=0?(r=(t.min.y-l.y)*c,n=(t.max.y-l.y)*c):(r=(t.max.y-l.y)*c,n=(t.min.y-l.y)*c),i>n||r>s?null:((r>i||isNaN(i))&&(i=r),(n<s||isNaN(s))&&(s=n),u>=0?(o=(t.min.z-l.z)*u,a=(t.max.z-l.z)*u):(o=(t.max.z-l.z)*u,a=(t.min.z-l.z)*u),i>a||o>s?null:((o>i||i!==i)&&(i=o),(a<s||s!==s)&&(s=a),s<0?null:this.at(i>=0?i:s,e)))}intersectsBox(t){return null!==this.intersectBox(t,Cr)}intersectTriangle(t,e,i,s,r){Rr.subVectors(e,t),Pr.subVectors(i,t),Er.crossVectors(Rr,Pr);let n,o=this.direction.dot(Er);if(o>0){if(s)return null;n=1}else{if(!(o<0))return null;n=-1,o=-o}Br.subVectors(this.origin,t);const a=n*this.direction.dot(Pr.crossVectors(Br,Pr));if(a<0)return null;const h=n*this.direction.dot(Rr.cross(Br));if(h<0)return null;if(a+h>o)return null;const c=-n*Br.dot(Er);return c<0?null:this.at(c/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Fr{constructor(t,e,i,s,r,n,o,a,h,c,u,l,d,p,m,f){Fr.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,o,a,h,c,u,l,d,p,m,f)}set(t,e,i,s,r,n,o,a,h,c,u,l,d,p,m,f){const y=this.elements;return y[0]=t,y[4]=e,y[8]=i,y[12]=s,y[1]=r,y[5]=n,y[9]=o,y[13]=a,y[2]=h,y[6]=c,y[10]=u,y[14]=l,y[3]=d,y[7]=p,y[11]=m,y[15]=f,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 Fr).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,s=1/Nr.setFromMatrixColumn(t,0).length(),r=1/Nr.setFromMatrixColumn(t,1).length(),n=1/Nr.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,s=t.y,r=t.z,n=Math.cos(i),o=Math.sin(i),a=Math.cos(s),h=Math.sin(s),c=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=n*c,i=n*u,s=o*c,r=o*u;e[0]=a*c,e[4]=-a*u,e[8]=h,e[1]=i+s*h,e[5]=t-r*h,e[9]=-o*a,e[2]=r-t*h,e[6]=s+i*h,e[10]=n*a}else if("YXZ"===t.order){const t=a*c,i=a*u,s=h*c,r=h*u;e[0]=t+r*o,e[4]=s*o-i,e[8]=n*h,e[1]=n*u,e[5]=n*c,e[9]=-o,e[2]=i*o-s,e[6]=r+t*o,e[10]=n*a}else if("ZXY"===t.order){const t=a*c,i=a*u,s=h*c,r=h*u;e[0]=t-r*o,e[4]=-n*u,e[8]=s+i*o,e[1]=i+s*o,e[5]=n*c,e[9]=r-t*o,e[2]=-n*h,e[6]=o,e[10]=n*a}else if("ZYX"===t.order){const t=n*c,i=n*u,s=o*c,r=o*u;e[0]=a*c,e[4]=s*h-i,e[8]=t*h+r,e[1]=a*u,e[5]=r*h+t,e[9]=i*h-s,e[2]=-h,e[6]=o*a,e[10]=n*a}else if("YZX"===t.order){const t=n*a,i=n*h,s=o*a,r=o*h;e[0]=a*c,e[4]=r-t*u,e[8]=s*u+i,e[1]=u,e[5]=n*c,e[9]=-o*c,e[2]=-h*c,e[6]=i*u+s,e[10]=t-r*u}else if("XZY"===t.order){const t=n*a,i=n*h,s=o*a,r=o*h;e[0]=a*c,e[4]=-u,e[8]=h*c,e[1]=t*u+r,e[5]=n*c,e[9]=i*u-s,e[2]=s*u-i,e[6]=o*c,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Lr,t,jr)}lookAt(t,e,i){const s=this.elements;return Dr.subVectors(t,e),0===Dr.lengthSq()&&(Dr.z=1),Dr.normalize(),Ur.crossVectors(i,Dr),0===Ur.lengthSq()&&(1===Math.abs(i.z)?Dr.x+=1e-4:Dr.z+=1e-4,Dr.normalize(),Ur.crossVectors(i,Dr)),Ur.normalize(),Wr.crossVectors(Dr,Ur),s[0]=Ur.x,s[4]=Wr.x,s[8]=Dr.x,s[1]=Ur.y,s[5]=Wr.y,s[9]=Dr.y,s[2]=Ur.z,s[6]=Wr.z,s[10]=Dr.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,r=this.elements,n=i[0],o=i[4],a=i[8],h=i[12],c=i[1],u=i[5],l=i[9],d=i[13],p=i[2],m=i[6],f=i[10],y=i[14],g=i[3],x=i[7],b=i[11],v=i[15],w=s[0],M=s[4],S=s[8],_=s[12],A=s[1],T=s[5],z=s[9],C=s[13],I=s[2],k=s[6],B=s[10],R=s[14],P=s[3],E=s[7],O=s[11],F=s[15];return r[0]=n*w+o*A+a*I+h*P,r[4]=n*M+o*T+a*k+h*E,r[8]=n*S+o*z+a*B+h*O,r[12]=n*_+o*C+a*R+h*F,r[1]=c*w+u*A+l*I+d*P,r[5]=c*M+u*T+l*k+d*E,r[9]=c*S+u*z+l*B+d*O,r[13]=c*_+u*C+l*R+d*F,r[2]=p*w+m*A+f*I+y*P,r[6]=p*M+m*T+f*k+y*E,r[10]=p*S+m*z+f*B+y*O,r[14]=p*_+m*C+f*R+y*F,r[3]=g*w+x*A+b*I+v*P,r[7]=g*M+x*T+b*k+v*E,r[11]=g*S+x*z+b*B+v*O,r[15]=g*_+x*C+b*R+v*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],n=t[1],o=t[5],a=t[9],h=t[13],c=t[2],u=t[6],l=t[10],d=t[14],p=t[3],m=t[7],f=t[11],y=t[15];return p*(+r*a*u-s*h*u-r*o*l+i*h*l+s*o*d-i*a*d)+m*(+e*a*d-e*h*l+r*n*l-s*n*d+s*h*c-r*a*c)+f*(+e*h*u-e*o*d-r*n*u+i*n*d+r*o*c-i*h*c)+y*(-s*o*c-e*a*u+e*o*l+s*n*u-i*n*l+i*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],o=t[5],a=t[6],h=t[7],c=t[8],u=t[9],l=t[10],d=t[11],p=t[12],m=t[13],f=t[14],y=t[15],g=u*f*h-m*l*h+m*a*d-o*f*d-u*a*y+o*l*y,x=p*l*h-c*f*h-p*a*d+n*f*d+c*a*y-n*l*y,b=c*m*h-p*u*h+p*o*d-n*m*d-c*o*y+n*u*y,v=p*u*a-c*m*a-p*o*l+n*m*l+c*o*f-n*u*f,w=e*g+i*x+s*b+r*v;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/w;return t[0]=g*M,t[1]=(m*l*r-u*f*r-m*s*d+i*f*d+u*s*y-i*l*y)*M,t[2]=(o*f*r-m*a*r+m*s*h-i*f*h-o*s*y+i*a*y)*M,t[3]=(u*a*r-o*l*r-u*s*h+i*l*h+o*s*d-i*a*d)*M,t[4]=x*M,t[5]=(c*f*r-p*l*r+p*s*d-e*f*d-c*s*y+e*l*y)*M,t[6]=(p*a*r-n*f*r-p*s*h+e*f*h+n*s*y-e*a*y)*M,t[7]=(n*l*r-c*a*r+c*s*h-e*l*h-n*s*d+e*a*d)*M,t[8]=b*M,t[9]=(p*u*r-c*m*r-p*i*d+e*m*d+c*i*y-e*u*y)*M,t[10]=(n*m*r-p*o*r+p*i*h-e*m*h-n*i*y+e*o*y)*M,t[11]=(c*o*r-n*u*r-c*i*h+e*u*h+n*i*d-e*o*d)*M,t[12]=v*M,t[13]=(c*m*s-p*u*s+p*i*l-e*m*l-c*i*f+e*u*f)*M,t[14]=(p*o*s-n*m*s-p*i*a+e*m*a+n*i*f-e*o*f)*M,t[15]=(n*u*s-c*o*s+c*i*a-e*u*a-n*i*l+e*o*l)*M,this}scale(t){const e=this.elements,i=t.x,s=t.y,r=t.z;return e[0]*=i,e[4]*=s,e[8]*=r,e[1]*=i,e[5]*=s,e[9]*=r,e[2]*=i,e[6]*=s,e[10]*=r,e[3]*=i,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),s=Math.sin(e),r=1-i,n=t.x,o=t.y,a=t.z,h=r*n,c=r*o;return this.set(h*n+i,h*o-s*a,h*a+s*o,0,h*o+s*a,c*o+i,c*a-s*n,0,h*a-s*o,c*a+s*n,r*a*a+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,r,n){return this.set(1,i,r,0,t,1,n,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){const s=this.elements,r=e._x,n=e._y,o=e._z,a=e._w,h=r+r,c=n+n,u=o+o,l=r*h,d=r*c,p=r*u,m=n*c,f=n*u,y=o*u,g=a*h,x=a*c,b=a*u,v=i.x,w=i.y,M=i.z;return s[0]=(1-(m+y))*v,s[1]=(d+b)*v,s[2]=(p-x)*v,s[3]=0,s[4]=(d-b)*w,s[5]=(1-(l+y))*w,s[6]=(f+g)*w,s[7]=0,s[8]=(p+x)*M,s[9]=(f-g)*M,s[10]=(1-(l+m))*M,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){const s=this.elements;let r=Nr.set(s[0],s[1],s[2]).length();const n=Nr.set(s[4],s[5],s[6]).length(),o=Nr.set(s[8],s[9],s[10]).length(),a=this.determinant();a<0&&(r=-r),t.x=s[12],t.y=s[13],t.z=s[14],Vr.copy(this);const h=1/r,c=1/n,u=1/o;return Vr.elements[0]*=h,Vr.elements[1]*=h,Vr.elements[2]*=h,Vr.elements[4]*=c,Vr.elements[5]*=c,Vr.elements[6]*=c,Vr.elements[8]*=u,Vr.elements[9]*=u,Vr.elements[10]*=u,e.setFromRotationMatrix(Vr),i.x=r,i.y=n,i.z=o,this}makePerspective(t,e,i,s,r,n,o=Yi){const a=this.elements,h=2*r/(e-t),c=2*r/(i-s),u=(e+t)/(e-t),l=(i+s)/(i-s);let d,p;if(o===Yi)d=-(n+r)/(n-r),p=-2*n*r/(n-r);else{if(o!==Gi)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);d=-n/(n-r),p=-n*r/(n-r)}return a[0]=h,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,i,s,r,n,o=Yi){const a=this.elements,h=1/(e-t),c=1/(i-s),u=1/(n-r),l=(e+t)*h,d=(i+s)*c;let p,m;if(o===Yi)p=(n+r)*u,m=-2*u;else{if(o!==Gi)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*u,m=-1*u}return a[0]=2*h,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=m,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const Nr=new or,Vr=new Fr,Lr=new or(0,0,0),jr=new or(1,1,1),Ur=new or,Wr=new or,Dr=new or,Hr=new Fr,qr=new nr;class Jr{constructor(t=0,e=0,i=0,s=Jr.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const s=t.elements,r=s[0],n=s[4],o=s[8],a=s[1],h=s[5],c=s[9],u=s[2],l=s[6],d=s[10];switch(e){case"XYZ":this._y=Math.asin(rs(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(l,h),this._z=0);break;case"YXZ":this._x=Math.asin(-rs(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,h)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(rs(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-rs(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(l,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(rs(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,h),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-rs(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(l,h),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return Hr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Hr,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return qr.setFromEuler(this),this.setFromQuaternion(qr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Jr.DEFAULT_ORDER="XYZ";class Xr{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return 0!==(this.mask&1<<t)}}let Zr=0;const Yr=new or,Gr=new nr,$r=new Fr,Qr=new or,Kr=new or,tn=new or,en=new nr,sn=new or(1,0,0),rn=new or(0,1,0),nn=new or(0,0,1),on={type:"added"},an={type:"removed"},hn={type:"childadded",child:null},cn={type:"childremoved",child:null};class un extends Qi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Zr++}),this.uuid=ss(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=un.DEFAULT_UP.clone();const t=new or,e=new Jr,i=new nr,s=new or(1,1,1);function r(){i.setFromEuler(e,!1)}function n(){e.setFromQuaternion(i,void 0,!1)}e._onChange(r),i._onChange(n),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Fr},normalMatrix:{value:new zs}}),this.matrix=new Fr,this.matrixWorld=new Fr,this.matrixAutoUpdate=un.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=un.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Xr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Gr.setFromAxisAngle(t,e),this.quaternion.multiply(Gr),this}rotateOnWorldAxis(t,e){return Gr.setFromAxisAngle(t,e),this.quaternion.premultiply(Gr),this}rotateX(t){return this.rotateOnAxis(sn,t)}rotateY(t){return this.rotateOnAxis(rn,t)}rotateZ(t){return this.rotateOnAxis(nn,t)}translateOnAxis(t,e){return Yr.copy(t).applyQuaternion(this.quaternion),this.position.add(Yr.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(sn,t)}translateY(t){return this.translateOnAxis(rn,t)}translateZ(t){return this.translateOnAxis(nn,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4($r.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Qr.copy(t):Qr.set(t,e,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Kr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$r.lookAt(Kr,Qr,this.up):$r.lookAt(Qr,Kr,this.up),this.quaternion.setFromRotationMatrix($r),s&&($r.extractRotation(s.matrixWorld),Gr.setFromRotationMatrix($r),this.quaternion.premultiply(Gr.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(on),hn.child=t,this.dispatchEvent(hn),hn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(an),cn.child=t,this.dispatchEvent(cn),cn.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),$r.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),$r.multiply(t.parent.matrixWorld)),t.applyMatrix4($r),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(on),hn.child=t,this.dispatchEvent(hn),hn.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,s=this.children.length;i<s;i++){const s=this.children[i],r=s.getObjectByProperty(t,e);if(void 0!==r)return r}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const s=this.children;for(let r=0,n=s.length;r<n;r++)s[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kr,t,tn),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kr,en,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,s=e.length;i<s;i++){const s=e[i];s.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){const i=t[e];i.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"===typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const s={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),!1===this.frustumCulled&&(s.frustumCulled=!1),0!==this.renderOrder&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()})),s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),null!==this.boundingBox&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,s=i.length;e<s;e++){const s=i[e];r(t.shapes,s)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,s=this.material.length;i<s;i++)e.push(r(t.materials,this.material[i]));s.material=e}else s.material=r(t.materials,this.material);if(this.children.length>0){s.children=[];for(let e=0;e<this.children.length;e++)s.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];s.animations.push(r(t.animations,i))}}if(e){const e=n(t.geometries),s=n(t.materials),r=n(t.textures),o=n(t.images),a=n(t.shapes),h=n(t.skeletons),c=n(t.animations),u=n(t.nodes);e.length>0&&(i.geometries=e),s.length>0&&(i.materials=s),r.length>0&&(i.textures=r),o.length>0&&(i.images=o),a.length>0&&(i.shapes=a),h.length>0&&(i.skeletons=h),c.length>0&&(i.animations=c),u.length>0&&(i.nodes=u)}return i.object=s,i;function n(t){const e=[];for(const i in t){const s=t[i];delete s.metadata,e.push(s)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let i=0;i<t.children.length;i++){const e=t.children[i];this.add(e.clone())}return this}}un.DEFAULT_UP=new or(0,1,0),un.DEFAULT_MATRIX_AUTO_UPDATE=!0,un.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ln=new or,dn=new or,pn=new or,mn=new or,fn=new or,yn=new or,gn=new or,xn=new or,bn=new or,vn=new or,wn=new Qs,Mn=new Qs,Sn=new Qs;class _n{constructor(t=new or,e=new or,i=new or){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),ln.subVectors(t,e),s.cross(ln);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){ln.subVectors(s,e),dn.subVectors(i,e),pn.subVectors(t,e);const n=ln.dot(ln),o=ln.dot(dn),a=ln.dot(pn),h=dn.dot(dn),c=dn.dot(pn),u=n*h-o*o;if(0===u)return r.set(0,0,0),null;const l=1/u,d=(h*a-o*c)*l,p=(n*c-o*a)*l;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,s){return null!==this.getBarycoord(t,e,i,s,mn)&&(mn.x>=0&&mn.y>=0&&mn.x+mn.y<=1)}static getInterpolation(t,e,i,s,r,n,o,a){return null===this.getBarycoord(t,e,i,s,mn)?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(r,mn.x),a.addScaledVector(n,mn.y),a.addScaledVector(o,mn.z),a)}static getInterpolatedAttribute(t,e,i,s,r,n){return wn.setScalar(0),Mn.setScalar(0),Sn.setScalar(0),wn.fromBufferAttribute(t,e),Mn.fromBufferAttribute(t,i),Sn.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(wn,r.x),n.addScaledVector(Mn,r.y),n.addScaledVector(Sn,r.z),n}static isFrontFacing(t,e,i,s){return ln.subVectors(i,e),dn.subVectors(t,e),ln.cross(dn).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ln.subVectors(this.c,this.b),dn.subVectors(this.a,this.b),.5*ln.cross(dn).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return _n.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return _n.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return _n.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return _n.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return _n.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,s=this.b,r=this.c;let n,o;fn.subVectors(s,i),yn.subVectors(r,i),xn.subVectors(t,i);const a=fn.dot(xn),h=yn.dot(xn);if(a<=0&&h<=0)return e.copy(i);bn.subVectors(t,s);const c=fn.dot(bn),u=yn.dot(bn);if(c>=0&&u<=c)return e.copy(s);const l=a*u-c*h;if(l<=0&&a>=0&&c<=0)return n=a/(a-c),e.copy(i).addScaledVector(fn,n);vn.subVectors(t,r);const d=fn.dot(vn),p=yn.dot(vn);if(p>=0&&d<=p)return e.copy(r);const m=d*h-a*p;if(m<=0&&h>=0&&p<=0)return o=h/(h-p),e.copy(i).addScaledVector(yn,o);const f=c*p-d*u;if(f<=0&&u-c>=0&&d-p>=0)return gn.subVectors(r,s),o=(u-c)/(u-c+(d-p)),e.copy(s).addScaledVector(gn,o);const y=1/(f+m+l);return n=m*y,o=l*y,e.copy(i).addScaledVector(fn,n).addScaledVector(yn,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const An={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},Tn={h:0,s:0,l:0},zn={h:0,s:0,l:0};function Cn(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class In{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"===typeof e?this.setHex(e):"string"===typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ui){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ws.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=Ws.workingColorSpace){return this.r=t,this.g=e,this.b=i,Ws.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=Ws.workingColorSpace){if(t=ns(t,1),e=rs(e,0,1),i=rs(i,0,1),0===e)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+e):i+e-i*e,r=2*i-s;this.r=Cn(r,s,t+1/3),this.g=Cn(r,s,t),this.b=Cn(r,s,t-1/3)}return Ws.toWorkingColorSpace(this,s),this}setStyle(t,e=ui){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const n=s[1],o=s[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=s[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(i,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ui){const i=An[t.toLowerCase()];return void 0!==i?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ds(t.r),this.g=Ds(t.g),this.b=Ds(t.b),this}copyLinearToSRGB(t){return this.r=Hs(t.r),this.g=Hs(t.g),this.b=Hs(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ui){return Ws.fromWorkingColorSpace(kn.copy(this),t),65536*Math.round(rs(255*kn.r,0,255))+256*Math.round(rs(255*kn.g,0,255))+Math.round(rs(255*kn.b,0,255))}getHexString(t=ui){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Ws.workingColorSpace){Ws.fromWorkingColorSpace(kn.copy(this),e);const i=kn.r,s=kn.g,r=kn.b,n=Math.max(i,s,r),o=Math.min(i,s,r);let a,h;const c=(o+n)/2;if(o===n)a=0,h=0;else{const t=n-o;switch(h=c<=.5?t/(n+o):t/(2-n-o),n){case i:a=(s-r)/t+(s<r?6:0);break;case s:a=(r-i)/t+2;break;case r:a=(i-s)/t+4;break}a/=6}return t.h=a,t.s=h,t.l=c,t}getRGB(t,e=Ws.workingColorSpace){return Ws.fromWorkingColorSpace(kn.copy(this),e),t.r=kn.r,t.g=kn.g,t.b=kn.b,t}getStyle(t=ui){Ws.fromWorkingColorSpace(kn.copy(this),t);const e=kn.r,i=kn.g,s=kn.b;return t!==ui?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*s)})`}offsetHSL(t,e,i){return this.getHSL(Tn),this.setHSL(Tn.h+t,Tn.s+e,Tn.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Tn),t.getHSL(zn);const i=hs(Tn.h,zn.h,e),s=hs(Tn.s,zn.s,e),r=hs(Tn.l,zn.l,e);return this.setHSL(i,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*s,this.g=r[1]*e+r[4]*i+r[7]*s,this.b=r[2]*e+r[5]*i+r[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const kn=new In;In.NAMES=An;let Bn=0;class Rn extends Qi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Bn++}),this.uuid=ss(),this.name="",this.type="Material",this.blending=I,this.side=A,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=D,this.blendDst=H,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new In(0,0,0),this.blendAlpha=0,this.depthFunc=st,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ii,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=fi,this.stencilZFail=fi,this.stencilZPass=fi,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(t){this._alphaTest>0!==t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const s=this[e];void 0!==s?s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"===typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function s(t){const e=[];for(const i in t){const s=t[i];delete s.metadata,e.push(s)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==I&&(i.blending=this.blending),this.side!==A&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),this.blendSrc!==D&&(i.blendSrc=this.blendSrc),this.blendDst!==H&&(i.blendDst=this.blendDst),this.blendEquation!==E&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==st&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Ii&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fi&&(i.stencilFail=this.stencilFail),this.stencilZFail!==fi&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==fi&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=s(t.textures),r=s(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let s=0;s!==t;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Pn extends Rn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new In(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 Jr,this.combine=ht,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const En=On();function On(){const t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),s=new Uint32Array(512),r=new Uint32Array(512);for(let h=0;h<256;++h){const t=h-127;t<-27?(s[h]=0,s[256|h]=32768,r[h]=24,r[256|h]=24):t<-14?(s[h]=1024>>-t-14,s[256|h]=1024>>-t-14|32768,r[h]=-t-1,r[256|h]=-t-1):t<=15?(s[h]=t+15<<10,s[256|h]=t+15<<10|32768,r[h]=13,r[256|h]=13):t<128?(s[h]=31744,s[256|h]=64512,r[h]=24,r[256|h]=24):(s[h]=31744,s[256|h]=64512,r[h]=13,r[256|h]=13)}const n=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let h=1;h<1024;++h){let t=h<<13,e=0;while(0===(8388608&t))t<<=1,e-=8388608;t&=-8388609,e+=947912704,n[h]=t|e}for(let h=1024;h<2048;++h)n[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)o[h]=h<<23;o[31]=1199570944,o[32]=2147483648;for(let h=33;h<63;++h)o[h]=2147483648+(h-32<<23);o[63]=3347054592;for(let h=1;h<64;++h)32!==h&&(a[h]=1024);return{floatView:e,uint32View:i,baseTable:s,shiftTable:r,mantissaTable:n,exponentTable:o,offsetTable:a}}function Fn(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=rs(t,-65504,65504),En.floatView[0]=t;const e=En.uint32View[0],i=e>>23&511;return En.baseTable[i]+((8388607&e)>>En.shiftTable[i])}function Nn(t){const e=t>>10;return En.uint32View[0]=En.mantissaTable[En.offsetTable[e]+(1023&t)]+En.exponentTable[e],En.floatView[0]}class Vn{static toHalfFloat(t){return Fn(t)}static fromHalfFloat(t){return Nn(t)}}const Ln=new or,jn=new Ts;let Un=0;class Wn{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Un++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=Vi,this.updateRanges=[],this.gpuType=Jt,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)jn.fromBufferAttribute(this,e),jn.applyMatrix3(t),this.setXY(e,jn.x,jn.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Ln.fromBufferAttribute(this,e),Ln.applyMatrix3(t),this.setXYZ(e,Ln.x,Ln.y,Ln.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Ln.fromBufferAttribute(this,e),Ln.applyMatrix4(t),this.setXYZ(e,Ln.x,Ln.y,Ln.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Ln.fromBufferAttribute(this,e),Ln.applyNormalMatrix(t),this.setXYZ(e,Ln.x,Ln.y,Ln.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Ln.fromBufferAttribute(this,e),Ln.transformDirection(t),this.setXYZ(e,Ln.x,Ln.y,Ln.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Ss(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=_s(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ss(e,this.array)),e}setX(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ss(e,this.array)),e}setY(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ss(e,this.array)),e}setZ(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ss(e,this.array)),e}setW(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array),s=_s(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,r){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array),s=_s(s,this.array),r=_s(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==Vi&&(t.usage=this.usage),t}}class Dn extends Wn{constructor(t,e,i){super(new Int8Array(t),e,i)}}class Hn extends Wn{constructor(t,e,i){super(new Uint8Array(t),e,i)}}class qn extends Wn{constructor(t,e,i){super(new Uint8ClampedArray(t),e,i)}}class Jn extends Wn{constructor(t,e,i){super(new Int16Array(t),e,i)}}class Xn extends Wn{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Zn extends Wn{constructor(t,e,i){super(new Int32Array(t),e,i)}}class Yn extends Wn{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class Gn extends Wn{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=Nn(this.array[t*this.itemSize]);return this.normalized&&(e=Ss(e,this.array)),e}setX(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize]=Fn(e),this}getY(t){let e=Nn(this.array[t*this.itemSize+1]);return this.normalized&&(e=Ss(e,this.array)),e}setY(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+1]=Fn(e),this}getZ(t){let e=Nn(this.array[t*this.itemSize+2]);return this.normalized&&(e=Ss(e,this.array)),e}setZ(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+2]=Fn(e),this}getW(t){let e=Nn(this.array[t*this.itemSize+3]);return this.normalized&&(e=Ss(e,this.array)),e}setW(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+3]=Fn(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array)),this.array[t+0]=Fn(e),this.array[t+1]=Fn(i),this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array),s=_s(s,this.array)),this.array[t+0]=Fn(e),this.array[t+1]=Fn(i),this.array[t+2]=Fn(s),this}setXYZW(t,e,i,s,r){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array),s=_s(s,this.array),r=_s(r,this.array)),this.array[t+0]=Fn(e),this.array[t+1]=Fn(i),this.array[t+2]=Fn(s),this.array[t+3]=Fn(r),this}}class $n extends Wn{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Qn=0;const Kn=new Fr,to=new un,eo=new or,io=new cr,so=new cr,ro=new or;class no extends Qi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Qn++}),this.uuid=ss(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Is(t)?Yn:Xn)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new zs).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const s=this.attributes.tangent;return void 0!==s&&(s.transformDirection(t),s.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Kn.makeRotationFromQuaternion(t),this.applyMatrix4(Kn),this}rotateX(t){return Kn.makeRotationX(t),this.applyMatrix4(Kn),this}rotateY(t){return Kn.makeRotationY(t),this.applyMatrix4(Kn),this}rotateZ(t){return Kn.makeRotationZ(t),this.applyMatrix4(Kn),this}translate(t,e,i){return Kn.makeTranslation(t,e,i),this.applyMatrix4(Kn),this}scale(t,e,i){return Kn.makeScale(t,e,i),this.applyMatrix4(Kn),this}lookAt(t){return to.lookAt(t),to.updateMatrix(),this.applyMatrix4(to.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(eo).negate(),this.translate(eo.x,eo.y,eo.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,s=t.length;i<s;i++){const s=t[i];e.push(s.x,s.y,s.z||0)}this.setAttribute("position",new $n(e,3))}else{const i=Math.min(t.length,e.count);for(let s=0;s<i;s++){const i=t[s];e.setXYZ(s,i.x,i.y,i.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new cr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new or(-1/0,-1/0,-1/0),new or(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,s=e.length;i<s;i++){const t=e[i];io.setFromBufferAttribute(t),this.morphTargetsRelative?(ro.addVectors(this.boundingBox.min,io.min),this.boundingBox.expandByPoint(ro),ro.addVectors(this.boundingBox.max,io.max),this.boundingBox.expandByPoint(ro)):(this.boundingBox.expandByPoint(io.min),this.boundingBox.expandByPoint(io.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new zr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new or,1/0);if(t){const i=this.boundingSphere.center;if(io.setFromBufferAttribute(t),e)for(let t=0,r=e.length;t<r;t++){const i=e[t];so.setFromBufferAttribute(i),this.morphTargetsRelative?(ro.addVectors(io.min,so.min),io.expandByPoint(ro),ro.addVectors(io.max,so.max),io.expandByPoint(ro)):(io.expandByPoint(so.min),io.expandByPoint(so.max))}io.getCenter(i);let s=0;for(let e=0,r=t.count;e<r;e++)ro.fromBufferAttribute(t,e),s=Math.max(s,i.distanceToSquared(ro));if(e)for(let r=0,n=e.length;r<n;r++){const n=e[r],o=this.morphTargetsRelative;for(let e=0,r=n.count;e<r;e++)ro.fromBufferAttribute(n,e),o&&(eo.fromBufferAttribute(t,e),ro.add(eo)),s=Math.max(s,i.distanceToSquared(ro))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=e.position,s=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Wn(new Float32Array(4*i.count),4));const n=this.getAttribute("tangent"),o=[],a=[];for(let S=0;S<i.count;S++)o[S]=new or,a[S]=new or;const h=new or,c=new or,u=new or,l=new Ts,d=new Ts,p=new Ts,m=new or,f=new or;function y(t,e,s){h.fromBufferAttribute(i,t),c.fromBufferAttribute(i,e),u.fromBufferAttribute(i,s),l.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,s),c.sub(h),u.sub(h),d.sub(l),p.sub(l);const n=1/(d.x*p.y-p.x*d.y);isFinite(n)&&(m.copy(c).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(n),f.copy(u).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(n),o[t].add(m),o[e].add(m),o[s].add(m),a[t].add(f),a[e].add(f),a[s].add(f))}let g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let S=0,_=g.length;S<_;++S){const e=g[S],i=e.start,s=e.count;for(let r=i,n=i+s;r<n;r+=3)y(t.getX(r+0),t.getX(r+1),t.getX(r+2))}const x=new or,b=new or,v=new or,w=new or;function M(t){v.fromBufferAttribute(s,t),w.copy(v);const e=o[t];x.copy(e),x.sub(v.multiplyScalar(v.dot(e))).normalize(),b.crossVectors(w,e);const i=b.dot(a[t]),r=i<0?-1:1;n.setXYZW(t,x.x,x.y,x.z,r)}for(let S=0,_=g.length;S<_;++S){const e=g[S],i=e.start,s=e.count;for(let r=i,n=i+s;r<n;r+=3)M(t.getX(r+0)),M(t.getX(r+1)),M(t.getX(r+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Wn(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const s=new or,r=new or,n=new or,o=new or,a=new or,h=new or,c=new or,u=new or;if(t)for(let l=0,d=t.count;l<d;l+=3){const d=t.getX(l+0),p=t.getX(l+1),m=t.getX(l+2);s.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),n.fromBufferAttribute(e,m),c.subVectors(n,r),u.subVectors(s,r),c.cross(u),o.fromBufferAttribute(i,d),a.fromBufferAttribute(i,p),h.fromBufferAttribute(i,m),o.add(c),a.add(c),h.add(c),i.setXYZ(d,o.x,o.y,o.z),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(m,h.x,h.y,h.z)}else for(let t=0,l=e.count;t<l;t+=3)s.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),n.fromBufferAttribute(e,t+2),c.subVectors(n,r),u.subVectors(s,r),c.cross(u),i.setXYZ(t+0,c.x,c.y,c.z),i.setXYZ(t+1,c.x,c.y,c.z),i.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)ro.fromBufferAttribute(t,e),ro.normalize(),t.setXYZ(e,ro.x,ro.y,ro.z)}toNonIndexed(){function t(t,e){const i=t.array,s=t.itemSize,r=t.normalized,n=new i.constructor(e.length*s);let o=0,a=0;for(let h=0,c=e.length;h<c;h++){o=t.isInterleavedBufferAttribute?e[h]*t.data.stride+t.offset:e[h]*s;for(let t=0;t<s;t++)n[a++]=i[o++]}return new Wn(n,s,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new no,i=this.index.array,s=this.attributes;for(const o in s){const r=s[o],n=t(r,i);e.setAttribute(o,n)}const r=this.morphAttributes;for(const o in r){const s=[],n=r[o];for(let e=0,r=n.length;e<r;e++){const r=n[e],o=t(r,i);s.push(o)}e.morphAttributes[o]=s}e.morphTargetsRelative=this.morphTargetsRelative;const n=this.groups;for(let o=0,a=n.length;o<a;o++){const t=n[o];e.addGroup(t.start,t.count,t.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const a in i){const e=i[a];t.data.attributes[a]=e.toJSON(t.data)}const s={};let r=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],i=[];for(let s=0,r=e.length;s<r;s++){const r=e[s];i.push(r.toJSON(t.data))}i.length>0&&(s[a]=i,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const s=t.attributes;for(const h in s){const t=s[h];this.setAttribute(h,t.clone(e))}const r=t.morphAttributes;for(const h in r){const t=[],i=r[h];for(let s=0,r=i.length;s<r;s++)t.push(i[s].clone(e));this.morphAttributes[h]=t}this.morphTargetsRelative=t.morphTargetsRelative;const n=t.groups;for(let h=0,c=n.length;h<c;h++){const t=n[h];this.addGroup(t.start,t.count,t.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const oo=new Fr,ao=new Or,ho=new zr,co=new or,uo=new or,lo=new or,po=new or,mo=new or,fo=new or,yo=new or,go=new or;class xo extends un{constructor(t=new no,e=new Pn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry,e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}getVertexPosition(t,e){const i=this.geometry,s=i.attributes.position,r=i.morphAttributes.position,n=i.morphTargetsRelative;e.fromBufferAttribute(s,t);const o=this.morphTargetInfluences;if(r&&o){fo.set(0,0,0);for(let i=0,s=r.length;i<s;i++){const s=o[i],a=r[i];0!==s&&(mo.fromBufferAttribute(a,t),n?fo.addScaledVector(mo,s):fo.addScaledVector(mo.sub(e),s))}e.add(fo)}return e}raycast(t,e){const i=this.geometry,s=this.material,r=this.matrixWorld;if(void 0!==s){if(null===i.boundingSphere&&i.computeBoundingSphere(),ho.copy(i.boundingSphere),ho.applyMatrix4(r),ao.copy(t.ray).recast(t.near),!1===ho.containsPoint(ao.origin)){if(null===ao.intersectSphere(ho,co))return;if(ao.origin.distanceToSquared(co)>c(t.far-t.near,2))return}oo.copy(r).invert(),ao.copy(t.ray).applyMatrix4(oo),null!==i.boundingBox&&!1===ao.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,ao)}}_computeIntersections(t,e,i){let s;const r=this.geometry,n=this.material,o=r.index,a=r.attributes.position,h=r.attributes.uv,c=r.attributes.uv1,u=r.attributes.normal,l=r.groups,d=r.drawRange;if(null!==o)if(Array.isArray(n))for(let p=0,m=l.length;p<m;p++){const r=l[p],a=n[r.materialIndex],m=Math.max(r.start,d.start),f=Math.min(o.count,Math.min(r.start+r.count,d.start+d.count));for(let n=m,l=f;n<l;n+=3){const l=o.getX(n),d=o.getX(n+1),p=o.getX(n+2);s=vo(this,a,t,i,h,c,u,l,d,p),s&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=r.materialIndex,e.push(s))}}else{const r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);for(let l=r,d=a;l<d;l+=3){const r=o.getX(l),a=o.getX(l+1),d=o.getX(l+2);s=vo(this,n,t,i,h,c,u,r,a,d),s&&(s.faceIndex=Math.floor(l/3),e.push(s))}}else if(void 0!==a)if(Array.isArray(n))for(let p=0,m=l.length;p<m;p++){const r=l[p],o=n[r.materialIndex],m=Math.max(r.start,d.start),f=Math.min(a.count,Math.min(r.start+r.count,d.start+d.count));for(let n=m,a=f;n<a;n+=3){const a=n,l=n+1,d=n+2;s=vo(this,o,t,i,h,c,u,a,l,d),s&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=r.materialIndex,e.push(s))}}else{const r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);for(let a=r,l=o;a<l;a+=3){const r=a,o=a+1,l=a+2;s=vo(this,n,t,i,h,c,u,r,o,l),s&&(s.faceIndex=Math.floor(a/3),e.push(s))}}}}function bo(t,e,i,s,r,n,o,a){let h;if(h=e.side===T?s.intersectTriangle(o,n,r,!0,a):s.intersectTriangle(r,n,o,e.side===A,a),null===h)return null;go.copy(a),go.applyMatrix4(t.matrixWorld);const c=i.ray.origin.distanceTo(go);return c<i.near||c>i.far?null:{distance:c,point:go.clone(),object:t}}function vo(t,e,i,s,r,n,o,a,h,c){t.getVertexPosition(a,uo),t.getVertexPosition(h,lo),t.getVertexPosition(c,po);const u=bo(t,e,i,s,uo,lo,po,yo);if(u){const t=new or;_n.getBarycoord(yo,uo,lo,po,t),r&&(u.uv=_n.getInterpolatedAttribute(r,a,h,c,t,new Ts)),n&&(u.uv1=_n.getInterpolatedAttribute(n,a,h,c,t,new Ts)),o&&(u.normal=_n.getInterpolatedAttribute(o,a,h,c,t,new or),u.normal.dot(s.direction)>0&&u.normal.multiplyScalar(-1));const e={a:a,b:h,c:c,normal:new or,materialIndex:0};_n.getNormal(uo,lo,po,e.normal),u.face=e,u.barycoord=t}return u}class wo extends no{constructor(t=1,e=1,i=1,s=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:n};const o=this;s=Math.floor(s),r=Math.floor(r),n=Math.floor(n);const a=[],h=[],c=[],u=[];let l=0,d=0;function p(t,e,i,s,r,n,p,m,f,y,g){const x=n/f,b=p/y,v=n/2,w=p/2,M=m/2,S=f+1,_=y+1;let A=0,T=0;const z=new or;for(let o=0;o<_;o++){const n=o*b-w;for(let a=0;a<S;a++){const l=a*x-v;z[t]=l*s,z[e]=n*r,z[i]=M,h.push(z.x,z.y,z.z),z[t]=0,z[e]=0,z[i]=m>0?1:-1,c.push(z.x,z.y,z.z),u.push(a/f),u.push(1-o/y),A+=1}}for(let o=0;o<y;o++)for(let t=0;t<f;t++){const e=l+t+S*o,i=l+t+S*(o+1),s=l+(t+1)+S*(o+1),r=l+(t+1)+S*o;a.push(e,i,r),a.push(i,s,r),T+=6}o.addGroup(d,T,g),d+=T,l+=A}p("z","y","x",-1,-1,i,e,t,n,r,0),p("z","y","x",1,-1,i,e,-t,n,r,1),p("x","z","y",1,1,t,i,e,s,n,2),p("x","z","y",1,-1,t,i,-e,s,n,3),p("x","y","z",1,-1,t,e,i,s,r,4),p("x","y","z",-1,-1,t,e,-i,s,r,5),this.setIndex(a),this.setAttribute("position",new $n(h,3)),this.setAttribute("normal",new $n(c,3)),this.setAttribute("uv",new $n(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new wo(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Mo(t){const e={};for(const i in t){e[i]={};for(const s in t[i]){const r=t[i][s];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][s]=null):e[i][s]=r.clone():Array.isArray(r)?e[i][s]=r.slice():e[i][s]=r}}return e}function So(t){const e={};for(let i=0;i<t.length;i++){const s=Mo(t[i]);for(const t in s)e[t]=s[t]}return e}function _o(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}function Ao(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Ws.workingColorSpace}const To={clone:Mo,merge:So};var zo="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",Co="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";class Io extends Rn{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=zo,this.fragmentShader=Co,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,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Mo(t.uniforms),this.uniformsGroups=_o(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const s in this.uniforms){const i=this.uniforms[s],r=i.value;r&&r.isTexture?e.uniforms[s]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[s]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[s]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[s]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[s]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[s]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[s]={type:"m4",value:r.toArray()}:e.uniforms[s]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const s in this.extensions)!0===this.extensions[s]&&(i[s]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class ko extends un{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Fr,this.projectionMatrix=new Fr,this.projectionMatrixInverse=new Fr,this.coordinateSystem=Yi}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Bo=new or,Ro=new Ts,Po=new Ts;class Eo extends ko{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*is*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*es*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*is*Math.atan(Math.tan(.5*es*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){Bo.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Bo.x,Bo.y).multiplyScalar(-t/Bo.z),Bo.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Bo.x,Bo.y).multiplyScalar(-t/Bo.z)}getViewSize(t,e){return this.getViewBounds(t,Ro,Po),e.subVectors(Po,Ro)}setViewOffset(t,e,i,s,r,n){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*es*this.fov)/this.zoom,i=2*e,s=this.aspect*i,r=-.5*s;const n=this.view;if(null!==this.view&&this.view.enabled){const t=n.fullWidth,o=n.fullHeight;r+=n.offsetX*s/t,e-=n.offsetY*i/o,s*=n.width/t,i*=n.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-i,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Oo=-90,Fo=1;class No extends un{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Eo(Oo,Fo,t,e);s.layers=this.layers,this.add(s);const r=new Eo(Oo,Fo,t,e);r.layers=this.layers,this.add(r);const n=new Eo(Oo,Fo,t,e);n.layers=this.layers,this.add(n);const o=new Eo(Oo,Fo,t,e);o.layers=this.layers,this.add(o);const a=new Eo(Oo,Fo,t,e);a.layers=this.layers,this.add(a);const h=new Eo(Oo,Fo,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,s,r,n,o,a]=e;for(const h of e)this.remove(h);if(t===Yi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else{if(t!==Gi)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1)}for(const h of e)this.add(h),h.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,n,o,a,h,c]=this.children,u=t.getRenderTarget(),l=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,r),t.setRenderTarget(i,1,s),t.render(e,n),t.setRenderTarget(i,2,s),t.render(e,o),t.setRenderTarget(i,3,s),t.render(e,a),t.setRenderTarget(i,4,s),t.render(e,h),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),t.render(e,c),t.setRenderTarget(u,l,d),t.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class Vo extends $s{constructor(t=[],e=Mt,i,s,r,n,o,a,h,c){super(t,e,i,s,r,n,o,a,h,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Lo extends tr{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},s=[i,i,i,i,i,i];this.texture=new Vo(s,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:Ot}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},s=new wo(5,5,5),r=new Io({name:"CubemapFromEquirect",uniforms:Mo(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:T,blending:C});r.uniforms.tEquirect.value=e;const n=new xo(s,r),o=e.minFilter;e.minFilter===Vt&&(e.minFilter=Ot);const a=new No(1,10,this);return a.update(t,n),e.minFilter=o,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,i=!0,s=!0){const r=t.getRenderTarget();for(let n=0;n<6;n++)t.setRenderTarget(this,n),t.clear(e,i,s);t.setRenderTarget(r)}}class jo extends un{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Uo={type:"move"};class Wo{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new jo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new jo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new or,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new or),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new jo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new or,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new or),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,n=null;const o=this._targetRay,a=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){n=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i),s=this._getHandJoint(h,n);null!==t&&(s.matrix.fromArray(t.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,s.jointRadius=t.radius),s.visible=null!==t}const s=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],o=s.position.distanceTo(r.position),a=.02,c=.005;h.inputState.pinching&&o>a+c?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&o<=a-c&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));null!==o&&(s=e.getPose(t.targetRaySpace,i),null===s&&null!==r&&(s=r),null!==s&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Uo)))}return null!==o&&(o.visible=null!==s),null!==a&&(a.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new jo;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class Do{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new In(t),this.density=e}clone(){return new Do(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Ho{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new In(t),this.near=e,this.far=i}clone(){return new Ho(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class qo extends un{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 Jr,this.environmentIntensity=1,this.environmentRotation=new Jr,this.overrideMaterial=null,"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Jo{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Vi,this.updateRanges=[],this.version=0,this.uuid=ss()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,r=this.stride;s<r;s++)this.array[t+s]=e.array[i+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ss()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ss()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.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 Xo=new or;class Zo{constructor(t,e,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)Xo.fromBufferAttribute(this,e),Xo.applyMatrix4(t),this.setXYZ(e,Xo.x,Xo.y,Xo.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Xo.fromBufferAttribute(this,e),Xo.applyNormalMatrix(t),this.setXYZ(e,Xo.x,Xo.y,Xo.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Xo.fromBufferAttribute(this,e),Xo.transformDirection(t),this.setXYZ(e,Xo.x,Xo.y,Xo.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=Ss(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=_s(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ss(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ss(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ss(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ss(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array),s=_s(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this}setXYZW(t,e,i,s,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),i=_s(i,this.array),s=_s(s,this.array),r=_s(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new Wn(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Zo(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Yo extends Rn{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new In(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let Go;const $o=new or,Qo=new or,Ko=new or,ta=new Ts,ea=new Ts,ia=new Fr,sa=new or,ra=new or,na=new or,oa=new Ts,aa=new Ts,ha=new Ts;class ca extends un{constructor(t=new Yo){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Go){Go=new no;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Jo(t,5);Go.setIndex([0,1,2,0,2,3]),Go.setAttribute("position",new Zo(e,3,0,!1)),Go.setAttribute("uv",new Zo(e,2,3,!1))}this.geometry=Go,this.material=t,this.center=new Ts(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Qo.setFromMatrixScale(this.matrixWorld),ia.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Ko.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Qo.multiplyScalar(-Ko.z);const i=this.material.rotation;let s,r;0!==i&&(r=Math.cos(i),s=Math.sin(i));const n=this.center;ua(sa.set(-.5,-.5,0),Ko,n,Qo,s,r),ua(ra.set(.5,-.5,0),Ko,n,Qo,s,r),ua(na.set(.5,.5,0),Ko,n,Qo,s,r),oa.set(0,0),aa.set(1,0),ha.set(1,1);let o=t.ray.intersectTriangle(sa,ra,na,!1,$o);if(null===o&&(ua(ra.set(-.5,.5,0),Ko,n,Qo,s,r),aa.set(0,1),o=t.ray.intersectTriangle(sa,na,ra,!1,$o),null===o))return;const a=t.ray.origin.distanceTo($o);a<t.near||a>t.far||e.push({distance:a,point:$o.clone(),uv:_n.getInterpolation($o,sa,ra,na,oa,aa,ha,new Ts),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function ua(t,e,i,s,r,n){ta.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(ea.x=n*ta.x-r*ta.y,ea.y=r*ta.x+n*ta.y):ea.copy(ta),t.copy(e),t.x+=ea.x,t.y+=ea.y,t.applyMatrix4(ia)}const la=new or,da=new or;class pa extends un{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let i=0,s=e.length;i<s;i++){const t=e[i];this.addLevel(t.object.clone(),t.distance,t.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,i=0){e=Math.abs(e);const s=this.levels;let r;for(r=0;r<s.length;r++)if(e<s[r].distance)break;return s.splice(r,0,{distance:e,hysteresis:i,object:t}),this.add(t),this}removeLevel(t){const e=this.levels;for(let i=0;i<e.length;i++)if(e[i].distance===t){const t=e.splice(i,1);return this.remove(t[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let i,s;for(i=1,s=e.length;i<s;i++){let s=e[i].distance;if(e[i].object.visible&&(s-=s*e[i].hysteresis),t<s)break}return e[i-1].object}return null}raycast(t,e){const i=this.levels;if(i.length>0){la.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(la);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){la.setFromMatrixPosition(t.matrixWorld),da.setFromMatrixPosition(this.matrixWorld);const i=la.distanceTo(da)/t.zoom;let s,r;for(e[0].object.visible=!0,s=1,r=e.length;s<r;s++){let t=e[s].distance;if(e[s].object.visible&&(t-=t*e[s].hysteresis),!(i>=t))break;e[s-1].object.visible=!1,e[s].object.visible=!0}for(this._currentLevel=s-1;s<r;s++)e[s].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const i=this.levels;for(let s=0,r=i.length;s<r;s++){const t=i[s];e.object.levels.push({object:t.object.uuid,distance:t.distance,hysteresis:t.hysteresis})}return e}}const ma=new or,fa=new Qs,ya=new Qs,ga=new or,xa=new Fr,ba=new or,va=new zr,wa=new Fr,Ma=new Or;class Sa extends xo{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=bt,this.bindMatrix=new Fr,this.bindMatrixInverse=new Fr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new cr),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let i=0;i<e.count;i++)this.getVertexPosition(i,ba),this.boundingBox.expandByPoint(ba)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new zr),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let i=0;i<e.count;i++)this.getVertexPosition(i,ba),this.boundingSphere.expandByPoint(ba)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const i=this.material,s=this.matrixWorld;void 0!==i&&(null===this.boundingSphere&&this.computeBoundingSphere(),va.copy(this.boundingSphere),va.applyMatrix4(s),!1!==t.ray.intersectsSphere(va)&&(wa.copy(s).invert(),Ma.copy(t.ray).applyMatrix4(wa),null!==this.boundingBox&&!1===Ma.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,Ma)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Qs,e=this.geometry.attributes.skinWeight;for(let i=0,s=e.count;i<s;i++){t.fromBufferAttribute(e,i);const s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===bt?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===vt?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const i=this.skeleton,s=this.geometry;fa.fromBufferAttribute(s.attributes.skinIndex,t),ya.fromBufferAttribute(s.attributes.skinWeight,t),ma.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){const t=ya.getComponent(r);if(0!==t){const s=fa.getComponent(r);xa.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),e.addScaledVector(ga.copy(ma).applyMatrix4(xa),t)}}return e.applyMatrix4(this.bindMatrixInverse)}}class _a extends un{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Aa extends $s{constructor(t=null,e=1,i=1,s,r,n,o,a,h=kt,c=kt,u,l){super(null,n,o,a,h,c,s,r,u,l),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Ta=new Fr,za=new Fr;class Ca{constructor(t=[],e=[]){this.uuid=ss(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Fr)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Fr;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,i=this.boneMatrices,s=this.boneTexture;for(let r=0,n=t.length;r<n;r++){const s=t[r]?t[r].matrixWorld:za;Ta.multiplyMatrices(s,e[r]),Ta.toArray(i,16*r)}null!==s&&(s.needsUpdate=!0)}clone(){return new Ca(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const i=new Aa(e,t,t,te,Jt);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){const i=this.bones[e];if(i.name===t)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,s=t.bones.length;i<s;i++){const s=t.bones[i];let r=e[s];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),r=new _a),this.bones.push(r),this.boneInverses.push((new Fr).fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,i=this.boneInverses;for(let s=0,r=e.length;s<r;s++){const r=e[s];t.bones.push(r.uuid);const n=i[s];t.boneInverses.push(n.toArray())}return t}}class Ia extends Wn{constructor(t,e,i,s=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const ka=new Fr,Ba=new Fr,Ra=[],Pa=new cr,Ea=new Fr,Oa=new xo,Fa=new zr;class Na extends xo{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Ia(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<i;s++)this.setMatrixAt(s,Ea)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new cr),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,ka),Pa.copy(t.boundingBox).applyMatrix4(ka),this.boundingBox.union(Pa)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new zr),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,ka),Fa.copy(t.boundingSphere).applyMatrix4(ka),this.boundingSphere.union(Fa)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const i=e.morphTargetInfluences,s=this.morphTexture.source.data.data,r=i.length+1,n=t*r+1;for(let o=0;o<i.length;o++)i[o]=s[n+o]}raycast(t,e){const i=this.matrixWorld,s=this.count;if(Oa.geometry=this.geometry,Oa.material=this.material,void 0!==Oa.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Fa.copy(this.boundingSphere),Fa.applyMatrix4(i),!1!==t.ray.intersectsSphere(Fa)))for(let r=0;r<s;r++){this.getMatrixAt(r,ka),Ba.multiplyMatrices(i,ka),Oa.matrixWorld=Ba,Oa.raycast(t,Ra);for(let t=0,i=Ra.length;t<i;t++){const i=Ra[t];i.instanceId=r,i.object=this,e.push(i)}Ra.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Ia(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const i=e.morphTargetInfluences,s=i.length+1;null===this.morphTexture&&(this.morphTexture=new Aa(new Float32Array(s*this.count),s,this.count,ne,Jt));const r=this.morphTexture.source.data.data;let n=0;for(let h=0;h<i.length;h++)n+=i[h];const o=this.geometry.morphTargetsRelative?1:1-n,a=s*t;r[a]=o,r.set(i,a+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Va=new or,La=new or,ja=new zs;class Ua{constructor(t=new or(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const s=Va.subVectors(i,e).cross(La.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const i=t.delta(Va),s=this.normal.dot(i);if(0===s)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||ja.getNormalMatrix(t),s=this.coplanarPoint(Va).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Wa=new zr,Da=new or;class Ha{constructor(t=new Ua,e=new Ua,i=new Ua,s=new Ua,r=new Ua,n=new Ua){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(s),o[4].copy(r),o[5].copy(n),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=Yi){const i=this.planes,s=t.elements,r=s[0],n=s[1],o=s[2],a=s[3],h=s[4],c=s[5],u=s[6],l=s[7],d=s[8],p=s[9],m=s[10],f=s[11],y=s[12],g=s[13],x=s[14],b=s[15];if(i[0].setComponents(a-r,l-h,f-d,b-y).normalize(),i[1].setComponents(a+r,l+h,f+d,b+y).normalize(),i[2].setComponents(a+n,l+c,f+p,b+g).normalize(),i[3].setComponents(a-n,l-c,f-p,b-g).normalize(),i[4].setComponents(a-o,l-u,f-m,b-x).normalize(),e===Yi)i[5].setComponents(a+o,l+u,f+m,b+x).normalize();else{if(e!==Gi)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);i[5].setComponents(o,u,m,x).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Wa.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Wa.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Wa)}intersectsSprite(t){return Wa.center.set(0,0,0),Wa.radius=.7071067811865476,Wa.applyMatrix4(t.matrixWorld),this.intersectsSphere(Wa)}intersectsSphere(t){const e=this.planes,i=t.center,s=-t.radius;for(let r=0;r<6;r++){const t=e[r].distanceToPoint(i);if(t<s)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const s=e[i];if(Da.x=s.normal.x>0?t.max.x:t.min.x,Da.y=s.normal.y>0?t.max.y:t.min.y,Da.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(Da)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function qa(t,e){return t-e}function Ja(t,e){return t.z-e.z}function Xa(t,e){return e.z-t.z}class Za{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,i,s){const r=this.pool,n=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];n.push(o),this.index++,o.start=t,o.count=e,o.z=i,o.index=s}reset(){this.list.length=0,this.index=0}}const Ya=new Fr,Ga=new In(1,1,1),$a=new Ha,Qa=new cr,Ka=new zr,th=new or,eh=new or,ih=new or,sh=new Za,rh=new xo,nh=[];function oh(t,e,i=0){const s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let n=0;n<r;n++)for(let r=0;r<s;r++)e.setComponent(n+i,r,t.getComponent(n,r))}else e.array.set(t.array,i*s);e.needsUpdate=!0}function ah(t,e){if(t.constructor!==e.constructor){const i=Math.min(t.length,e.length);for(let s=0;s<i;s++)e[s]=t[s]}else{const i=Math.min(t.length,e.length);e.set(new t.constructor(t.buffer,0,i))}}class hh extends xo{constructor(t,e,i=2*e,s){super(new no,s),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=i,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let t=Math.sqrt(4*this._maxInstanceCount);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4),i=new Aa(e,t,t,te,Jt);this._matricesTexture=i}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Uint32Array(t*t),i=new Aa(e,t,t,oe,qt);this._indirectTexture=i}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),i=new Aa(e,t,t,te,Jt);i.colorSpace=Ws.workingColorSpace,this._colorsTexture=i}_initializeGeometry(t){const e=this.geometry,i=this._maxVertexCount,s=this._maxIndexCount;if(!1===this._geometryInitialized){for(const s in t.attributes){const r=t.getAttribute(s),{array:n,itemSize:o,normalized:a}=r,h=new n.constructor(i*o),c=new Wn(h,o,a);e.setAttribute(s,c)}if(null!==t.getIndex()){const t=i>65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new Wn(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const i in e.attributes){if(!t.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new cr);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i<s;i++){if(!1===e[i].active)continue;const s=e[i].geometryIndex;this.getMatrixAt(i,Ya),this.getBoundingBoxAt(s,Qa).applyMatrix4(Ya),t.union(Qa)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new zr);const t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i<s;i++){if(!1===e[i].active)continue;const s=e[i].geometryIndex;this.getMatrixAt(i,Ya),this.getBoundingSphereAt(s,Ka).applyMatrix4(Ya),t.union(Ka)}}addInstance(t){const e=this._instanceInfo.length>=this.maxInstanceCount;if(e&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:t};let s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(qa),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=i):(s=this._instanceInfo.length,this._instanceInfo.push(i));const r=this._matricesTexture;Ya.identity().toArray(r.image.data,16*s),r.needsUpdate=!0;const n=this._colorsTexture;return n&&(Ga.toArray(n.image.data,4*s),n.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(t,e=-1,i=-1){this._initializeGeometry(t),this._validateGeometry(t);const s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=-1===e?t.getAttribute("position").count:e;const n=t.getIndex(),o=null!==n;if(o&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=-1===i?n.count:i),-1!==s.indexStart&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let a;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(qa),a=this._availableGeometryIds.shift(),r[a]=s):(a=this._geometryCount,this._geometryCount++,r.push(s)),this.setGeometryAt(a,t),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,a}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),o=this._geometryInfo[t];if(s&&n.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const a=o.vertexStart,h=o.reservedVertexCount;o.vertexCount=e.getAttribute("position").count;for(const c in i.attributes){const t=e.getAttribute(c),s=i.getAttribute(c);oh(t,s,a);const r=t.itemSize;for(let e=t.count,i=h;e<i;e++){const t=a+e;for(let e=0;e<r;e++)s.setComponent(t,e,0)}s.needsUpdate=!0,s.addUpdateRange(a*r,h*r)}if(s){const t=o.indexStart,i=o.reservedIndexCount;o.indexCount=e.getIndex().count;for(let e=0;e<n.count;e++)r.setX(t+e,a+n.getX(e));for(let e=n.count,s=i;e<s;e++)r.setX(t+e,a);r.needsUpdate=!0,r.addUpdateRange(t,o.reservedIndexCount)}return o.start=s?o.indexStart:o.vertexStart,o.count=s?o.indexCount:o.vertexCount,o.boundingBox=null,null!==e.boundingBox&&(o.boundingBox=e.boundingBox.clone()),o.boundingSphere=null,null!==e.boundingSphere&&(o.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._geometryInfo;if(t>=e.length||!1===e[t].active)return this;const i=this._instanceInfo;for(let s=0,r=i.length;s<r;s++)i[s].active&&i[s].geometryIndex===t&&this.deleteInstance(s);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0;const i=this._geometryInfo,s=i.map((t,e)=>e).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,o=i.length;n<o;n++){const o=s[n],a=i[o];if(!1!==a.active){if(null!==r.index){if(a.indexStart!==e){const{indexStart:i,vertexStart:s,reservedIndexCount:n}=a,o=r.index,h=o.array,c=t-s;for(let t=i;t<i+n;t++)h[t]=h[t]+c;o.array.copyWithin(e,i,i+n),o.addUpdateRange(e,n),a.indexStart=e}e+=a.reservedIndexCount}if(a.vertexStart!==t){const{vertexStart:e,reservedVertexCount:i}=a,s=r.attributes;for(const r in s){const n=s[r],{array:o,itemSize:a}=n;o.copyWithin(t*a,e*a,(e+i)*a),n.addUpdateRange(t*a,i*a)}a.vertexStart=t}t+=a.reservedVertexCount,a.start=r.index?a.indexStart:a.vertexStart,this._nextIndexStart=r.index?a.indexStart+a.reservedIndexCount:0,this._nextVertexStart=a.vertexStart+a.reservedVertexCount}}return this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){const t=new cr,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i<n;i++){let s=i;e&&(s=e.getX(s)),t.expandByPoint(th.fromBufferAttribute(r,s))}s.boundingBox=t}return e.copy(s.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){const e=new zr;this.getBoundingBoxAt(t,Qa),Qa.getCenter(e.center);const r=i.index,n=i.attributes.position;let o=0;for(let t=s.start,i=s.start+s.count;t<i;t++){let i=t;r&&(i=r.getX(i)),th.fromBufferAttribute(n,i),o=Math.max(o,e.center.distanceToSquared(th))}e.radius=Math.sqrt(o),s.boundingSphere=e}return e.copy(s.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);const i=this._matricesTexture,s=this._matricesTexture.image.data;return e.toArray(s,16*t),i.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,16*t)}setColorAt(t,e){return this.validateInstanceId(t),null===this._colorsTexture&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,4*t),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,4*t)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e||(this._instanceInfo[t].visible=e,this._visibilityChanged=!0),this}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);const i=this._geometryInfo[t];return e.vertexStart=i.vertexStart,e.vertexCount=i.vertexCount,e.reservedVertexCount=i.reservedVertexCount,e.indexStart=i.indexStart,e.indexCount=i.indexCount,e.reservedIndexCount=i.reservedIndexCount,e.start=i.start,e.count=i.count,e}setInstanceCount(t){const e=this._availableInstanceIds,i=this._instanceInfo;e.sort(qa);while(e[e.length-1]===i.length)i.pop(),e.pop();if(t<i.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);const s=new Int32Array(t),r=new Int32Array(t);ah(this._multiDrawCounts,s),ah(this._multiDrawStarts,r),this._multiDrawCounts=s,this._multiDrawStarts=r,this._maxInstanceCount=t;const n=this._indirectTexture,o=this._matricesTexture,a=this._colorsTexture;n.dispose(),this._initIndirectTexture(),ah(n.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),ah(o.image.data,this._matricesTexture.image.data),a&&(a.dispose(),this._initColorsTexture(),ah(a.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){const i=[...this._geometryInfo].filter(t=>t.active),s=Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount));if(s>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index){const t=Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount));if(t>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`)}const r=this.geometry;r.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new no,this._initializeGeometry(r));const n=this.geometry;r.index&&ah(r.index.array,n.index.array);for(const o in r.attributes)ah(r.attributes[o].array,n.attributes[o].array)}raycast(t,e){const i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;rh.material=this.material,rh.geometry.index=n.index,rh.geometry.attributes=n.attributes,null===rh.geometry.boundingBox&&(rh.geometry.boundingBox=new cr),null===rh.geometry.boundingSphere&&(rh.geometry.boundingSphere=new zr);for(let o=0,a=i.length;o<a;o++){if(!i[o].visible||!i[o].active)continue;const n=i[o].geometryIndex,a=s[n];rh.geometry.setDrawRange(a.start,a.count),this.getMatrixAt(o,rh.matrixWorld).premultiply(r),this.getBoundingBoxAt(n,rh.geometry.boundingBox),this.getBoundingSphereAt(n,rh.geometry.boundingSphere),rh.raycast(t,nh);for(let t=0,i=nh.length;t<i;t++){const i=nh[t];i.object=this,i.batchId=o,e.push(i)}nh.length=0}rh.material=null,rh.geometry.index=null,rh.geometry.attributes={},rh.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=null!==t.boundingBox?t.boundingBox.clone():null,this.boundingSphere=null!==t.boundingSphere?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map(t=>d(l({},t),{boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>l({},t)),this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const n=s.getIndex(),o=null===n?1:n.array.BYTES_PER_ELEMENT,a=this._instanceInfo,h=this._multiDrawStarts,c=this._multiDrawCounts,u=this._geometryInfo,l=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data;l&&(Ya.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),$a.setFromProjectionMatrix(Ya,t.coordinateSystem));let m=0;if(this.sortObjects){Ya.copy(this.matrixWorld).invert(),th.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Ya),eh.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Ya);for(let i=0,s=a.length;i<s;i++)if(a[i].visible&&a[i].active){const t=a[i].geometryIndex;this.getMatrixAt(i,Ya),this.getBoundingSphereAt(t,Ka).applyMatrix4(Ya);let e=!1;if(l&&(e=!$a.intersectsSphere(Ka)),!e){const e=u[t],s=ih.subVectors(Ka.center,th).dot(eh);sh.push(e.start,e.count,s,i)}}const t=sh.list,e=this.customSort;null===e?t.sort(r.transparent?Xa:Ja):e.call(this,t,i);for(let i=0,s=t.length;i<s;i++){const e=t[i];h[m]=e.start*o,c[m]=e.count,p[m]=e.index,m++}sh.reset()}else for(let f=0,y=a.length;f<y;f++)if(a[f].visible&&a[f].active){const t=a[f].geometryIndex;let e=!1;if(l&&(this.getMatrixAt(f,Ya),this.getBoundingSphereAt(t,Ka).applyMatrix4(Ya),e=!$a.intersectsSphere(Ka)),!e){const e=u[t];h[m]=e.start*o,c[m]=e.count,p[m]=f,m++}}d.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(t,e,i,s,r,n){this.onBeforeRender(t,null,s,r,n)}}class ch extends Rn{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new In(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const uh=new or,lh=new or,dh=new Fr,ph=new Or,mh=new zr,fh=new or,yh=new or;class gh extends un{constructor(t=new no,e=new ch){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,s=e.count;t<s;t++)uh.fromBufferAttribute(e,t-1),lh.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=uh.distanceTo(lh);t.setAttribute("lineDistance",new $n(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,s=this.matrixWorld,r=t.params.Line.threshold,n=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),mh.copy(i.boundingSphere),mh.applyMatrix4(s),mh.radius+=r,!1===t.ray.intersectsSphere(mh))return;dh.copy(s).invert(),ph.copy(t.ray).applyMatrix4(dh);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,h=this.isLineSegments?2:1,c=i.index,u=i.attributes,l=u.position;if(null!==c){const i=Math.max(0,n.start),s=Math.min(c.count,n.start+n.count);for(let r=i,n=s-1;r<n;r+=h){const i=c.getX(r),s=c.getX(r+1),n=xh(this,t,ph,a,i,s,r);n&&e.push(n)}if(this.isLineLoop){const r=c.getX(s-1),n=c.getX(i),o=xh(this,t,ph,a,r,n,s-1);o&&e.push(o)}}else{const i=Math.max(0,n.start),s=Math.min(l.count,n.start+n.count);for(let r=i,n=s-1;r<n;r+=h){const i=xh(this,t,ph,a,r,r+1,r);i&&e.push(i)}if(this.isLineLoop){const r=xh(this,t,ph,a,s-1,i,s-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry,e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}}function xh(t,e,i,s,r,n,o){const a=t.geometry.attributes.position;uh.fromBufferAttribute(a,r),lh.fromBufferAttribute(a,n);const h=i.distanceSqToSegment(uh,lh,fh,yh);if(h>s)return;fh.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(fh);return c<e.near||c>e.far?void 0:{distance:c,point:yh.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const bh=new or,vh=new or;class wh extends gh{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,s=e.count;t<s;t+=2)bh.fromBufferAttribute(e,t),vh.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+bh.distanceTo(vh);t.setAttribute("lineDistance",new $n(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Mh extends gh{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class Sh extends Rn{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new In(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const _h=new Fr,Ah=new Or,Th=new zr,zh=new or;class Ch extends un{constructor(t=new no,e=new Sh){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const i=this.geometry,s=this.matrixWorld,r=t.params.Points.threshold,n=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Th.copy(i.boundingSphere),Th.applyMatrix4(s),Th.radius+=r,!1===t.ray.intersectsSphere(Th))return;_h.copy(s).invert(),Ah.copy(t.ray).applyMatrix4(_h);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,h=i.index,c=i.attributes,u=c.position;if(null!==h){const i=Math.max(0,n.start),r=Math.min(h.count,n.start+n.count);for(let n=i,o=r;n<o;n++){const i=h.getX(n);zh.fromBufferAttribute(u,i),Ih(zh,i,a,s,t,e,this)}}else{const i=Math.max(0,n.start),r=Math.min(u.count,n.start+n.count);for(let n=i,o=r;n<o;n++)zh.fromBufferAttribute(u,n),Ih(zh,n,a,s,t,e,this)}}updateMorphTargets(){const t=this.geometry,e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}}function Ih(t,e,i,s,r,n,o){const a=Ah.distanceSqToPoint(t);if(a<i){const i=new or;Ah.closestPointToPoint(t,i),i.applyMatrix4(s);const h=r.ray.origin.distanceTo(i);if(h<r.near||h>r.far)return;n.push({distance:h,distanceToRay:Math.sqrt(a),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class kh extends $s{constructor(t,e,i,s,r=Ot,n=Ot,o,a,h){super(t,e,i,s,r,n,o,a,h),this.isVideoTexture=!0,this.generateMipmaps=!1;const c=this;function u(){c.needsUpdate=!0,t.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image,e="requestVideoFrameCallback"in t;!1===e&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class Bh extends kh{constructor(t,e,i,s,r,n,o,a){super({},t,e,i,s,r,n,o,a),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class Rh extends $s{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=kt,this.minFilter=kt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ph extends $s{constructor(t,e,i,s,r,n,o,a,h,c,u,l){super(null,n,o,a,h,c,s,r,u,l),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class Eh extends Ph{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=Ct,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Oh extends Ph{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,Mt),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class Fh extends $s{constructor(t,e,i,s,r,n,o,a,h){super(t,e,i,s,r,n,o,a,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Nh extends $s{constructor(t,e,i=qt,s,r,n,o=kt,a=kt,h,c=se){if(c!==se&&c!==re)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,s,r,n,o,a,c,i,h),this.isDepthTexture=!0,this.image={width:t,height:e},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new Zs(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class Vh{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,s=this.getPoint(0),r=0;e.push(0);for(let n=1;n<=t;n++)i=this.getPoint(n/t),r+=i.distanceTo(s),e.push(r),s=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const i=this.getLengths();let s=0;const r=i.length;let n;n=e||t*i[r-1];let o,a=0,h=r-1;while(a<=h)if(s=Math.floor(a+(h-a)/2),o=i[s]-n,o<0)a=s+1;else{if(!(o>0)){h=s;break}h=s-1}if(s=h,i[s]===n)return s/(r-1);const c=i[s],u=i[s+1],l=u-c,d=(n-c)/l,p=(s+d)/(r-1);return p}getTangent(t,e){const i=1e-4;let s=t-i,r=t+i;s<0&&(s=0),r>1&&(r=1);const n=this.getPoint(s),o=this.getPoint(r),a=e||(n.isVector2?new Ts:new or);return a.copy(o).sub(n).normalize(),a}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){const i=new or,s=[],r=[],n=[],o=new or,a=new Fr;for(let d=0;d<=t;d++){const e=d/t;s[d]=this.getTangentAt(e,new or)}r[0]=new or,n[0]=new or;let h=Number.MAX_VALUE;const c=Math.abs(s[0].x),u=Math.abs(s[0].y),l=Math.abs(s[0].z);c<=h&&(h=c,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),l<=h&&i.set(0,0,1),o.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],o),n[0].crossVectors(s[0],r[0]);for(let d=1;d<=t;d++){if(r[d]=r[d-1].clone(),n[d]=n[d-1].clone(),o.crossVectors(s[d-1],s[d]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(rs(s[d-1].dot(s[d]),-1,1));r[d].applyMatrix4(a.makeRotationAxis(o,t))}n[d].crossVectors(s[d],r[d])}if(!0===e){let e=Math.acos(rs(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(a.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Lh extends Vh{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=o,this.aRotation=a}getPoint(t,e=new Ts){const i=e,s=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const n=Math.abs(r)<Number.EPSILON;while(r<0)r+=s;while(r>s)r-=s;r<Number.EPSILON&&(r=n?0:s),!0!==this.aClockwise||n||(r===s?r=-s:r-=s);const o=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(o),h=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=a-this.aX,s=h-this.aY;a=i*t-s*e+this.aX,h=i*e+s*t+this.aY}return i.set(a,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class jh extends Lh{constructor(t,e,i,s,r,n){super(t,e,i,i,s,r,n),this.isArcCurve=!0,this.type="ArcCurve"}}function Uh(){let t=0,e=0,i=0,s=0;function r(r,n,o,a){t=r,e=o,i=-3*r+3*n-2*o-a,s=2*r-2*n+o+a}return{initCatmullRom:function(t,e,i,s,n){r(e,i,n*(i-t),n*(s-e))},initNonuniformCatmullRom:function(t,e,i,s,n,o,a){let h=(e-t)/n-(i-t)/(n+o)+(i-e)/o,c=(i-e)/o-(s-e)/(o+a)+(s-i)/a;h*=o,c*=o,r(e,i,h,c)},calc:function(r){const n=r*r,o=n*r;return t+e*r+i*n+s*o}}}const Wh=new or,Dh=new Uh,Hh=new Uh,qh=new Uh;class Jh extends Vh{constructor(t=[],e=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=s}getPoint(t,e=new or){const i=e,s=this.points,r=s.length,n=(r-(this.closed?0:1))*t;let o,a,h=Math.floor(n),c=n-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===c&&h===r-1&&(h=r-2,c=1),this.closed||h>0?o=s[(h-1)%r]:(Wh.subVectors(s[0],s[1]).add(s[0]),o=Wh);const u=s[h%r],l=s[(h+1)%r];if(this.closed||h+2<r?a=s[(h+2)%r]:(Wh.subVectors(s[r-1],s[r-2]).add(s[r-1]),a=Wh),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(l),t),s=Math.pow(l.distanceToSquared(a),t);i<1e-4&&(i=1),e<1e-4&&(e=i),s<1e-4&&(s=i),Dh.initNonuniformCatmullRom(o.x,u.x,l.x,a.x,e,i,s),Hh.initNonuniformCatmullRom(o.y,u.y,l.y,a.y,e,i,s),qh.initNonuniformCatmullRom(o.z,u.z,l.z,a.z,e,i,s)}else"catmullrom"===this.curveType&&(Dh.initCatmullRom(o.x,u.x,l.x,a.x,this.tension),Hh.initCatmullRom(o.y,u.y,l.y,a.y,this.tension),qh.initCatmullRom(o.z,u.z,l.z,a.z,this.tension));return i.set(Dh.calc(c),Hh.calc(c),qh.calc(c)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new or).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Xh(t,e,i,s,r){const n=.5*(s-e),o=.5*(r-i),a=t*t,h=t*a;return(2*i-2*s+n+o)*h+(-3*i+3*s-2*n-o)*a+n*t+i}function Zh(t,e){const i=1-t;return i*i*e}function Yh(t,e){return 2*(1-t)*t*e}function Gh(t,e){return t*t*e}function $h(t,e,i,s){return Zh(t,e)+Yh(t,i)+Gh(t,s)}function Qh(t,e){const i=1-t;return i*i*i*e}function Kh(t,e){const i=1-t;return 3*i*i*t*e}function tc(t,e){return 3*(1-t)*t*t*e}function ec(t,e){return t*t*t*e}function ic(t,e,i,s,r){return Qh(t,e)+Kh(t,i)+tc(t,s)+ec(t,r)}class sc extends Vh{constructor(t=new Ts,e=new Ts,i=new Ts,s=new Ts){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new Ts){const i=e,s=this.v0,r=this.v1,n=this.v2,o=this.v3;return i.set(ic(t,s.x,r.x,n.x,o.x),ic(t,s.y,r.y,n.y,o.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class rc extends Vh{constructor(t=new or,e=new or,i=new or,s=new or){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new or){const i=e,s=this.v0,r=this.v1,n=this.v2,o=this.v3;return i.set(ic(t,s.x,r.x,n.x,o.x),ic(t,s.y,r.y,n.y,o.y),ic(t,s.z,r.z,n.z,o.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class nc extends Vh{constructor(t=new Ts,e=new Ts){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Ts){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Ts){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class oc extends Vh{constructor(t=new or,e=new or){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new or){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new or){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ac extends Vh{constructor(t=new Ts,e=new Ts,i=new Ts){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Ts){const i=e,s=this.v0,r=this.v1,n=this.v2;return i.set($h(t,s.x,r.x,n.x),$h(t,s.y,r.y,n.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class hc extends Vh{constructor(t=new or,e=new or,i=new or){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new or){const i=e,s=this.v0,r=this.v1,n=this.v2;return i.set($h(t,s.x,r.x,n.x),$h(t,s.y,r.y,n.y),$h(t,s.z,r.z,n.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class cc extends Vh{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Ts){const i=e,s=this.points,r=(s.length-1)*t,n=Math.floor(r),o=r-n,a=s[0===n?n:n-1],h=s[n],c=s[n>s.length-2?s.length-1:n+1],u=s[n>s.length-3?s.length-1:n+2];return i.set(Xh(o,a.x,h.x,c.x,u.x),Xh(o,a.y,h.y,c.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new Ts).fromArray(i))}return this}}var uc=Object.freeze({__proto__:null,ArcCurve:jh,CatmullRomCurve3:Jh,CubicBezierCurve:sc,CubicBezierCurve3:rc,EllipseCurve:Lh,LineCurve:nc,LineCurve3:oc,QuadraticBezierCurve:ac,QuadraticBezierCurve3:hc,SplineCurve:cc});class lc extends Vh{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new uc[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),s=this.getCurveLengths();let r=0;while(r<s.length){if(s[r]>=i){const t=s[r]-i,n=this.curves[r],o=n.getLength(),a=0===o?0:1-t/o;return n.getPointAt(a,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,s=this.curves.length;i<s;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let s=0,r=this.curves;s<r.length;s++){const n=r[s],o=n.isEllipseCurve?2*t:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?t*n.points.length:t,a=n.getPoints(o);for(let t=0;t<a.length;t++){const s=a[t];i&&i.equals(s)||(e.push(s),i=s)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new uc[i.type]).fromJSON(i))}return this}}class dc extends lc{constructor(t){super(),this.type="Path",this.currentPoint=new Ts,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new nc(this.currentPoint.clone(),new Ts(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,s){const r=new ac(this.currentPoint.clone(),new Ts(t,e),new Ts(i,s));return this.curves.push(r),this.currentPoint.set(i,s),this}bezierCurveTo(t,e,i,s,r,n){const o=new sc(this.currentPoint.clone(),new Ts(t,e),new Ts(i,s),new Ts(r,n));return this.curves.push(o),this.currentPoint.set(r,n),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new cc(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,s,r,n){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,i,s,r,n),this}absarc(t,e,i,s,r,n){return this.absellipse(t,e,i,i,s,r,n),this}ellipse(t,e,i,s,r,n,o,a){const h=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+h,e+c,i,s,r,n,o,a),this}absellipse(t,e,i,s,r,n,o,a){const h=new Lh(t,e,i,s,r,n,o,a);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const c=h.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class pc extends no{constructor(t=[new Ts(0,-.5),new Ts(.5,0),new Ts(0,.5)],e=12,i=0,s=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:s},e=Math.floor(e),s=rs(s,0,2*Math.PI);const r=[],n=[],o=[],a=[],h=[],c=1/e,u=new or,l=new Ts,d=new or,p=new or,m=new or;let f=0,y=0;for(let g=0;g<=t.length-1;g++)switch(g){case 0:f=t[g+1].x-t[g].x,y=t[g+1].y-t[g].y,d.x=1*y,d.y=-f,d.z=0*y,m.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case t.length-1:a.push(m.x,m.y,m.z);break;default:f=t[g+1].x-t[g].x,y=t[g+1].y-t[g].y,d.x=1*y,d.y=-f,d.z=0*y,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),a.push(d.x,d.y,d.z),m.copy(p)}for(let g=0;g<=e;g++){const r=i+g*c*s,d=Math.sin(r),p=Math.cos(r);for(let i=0;i<=t.length-1;i++){u.x=t[i].x*d,u.y=t[i].y,u.z=t[i].x*p,n.push(u.x,u.y,u.z),l.x=g/e,l.y=i/(t.length-1),o.push(l.x,l.y);const s=a[3*i+0]*d,r=a[3*i+1],c=a[3*i+0]*p;h.push(s,r,c)}}for(let g=0;g<e;g++)for(let e=0;e<t.length-1;e++){const i=e+g*t.length,s=i,n=i+t.length,o=i+t.length+1,a=i+1;r.push(s,n,a),r.push(o,a,n)}this.setIndex(r),this.setAttribute("position",new $n(n,3)),this.setAttribute("uv",new $n(o,2)),this.setAttribute("normal",new $n(h,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new pc(t.points,t.segments,t.phiStart,t.phiLength)}}class mc extends pc{constructor(t=1,e=1,i=4,s=8){const r=new dc;r.absarc(0,-e/2,t,1.5*Math.PI,0),r.absarc(0,e/2,t,0,.5*Math.PI),super(r.getPoints(i),s),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:i,radialSegments:s}}static fromJSON(t){return new mc(t.radius,t.length,t.capSegments,t.radialSegments)}}class fc extends no{constructor(t=1,e=32,i=0,s=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:s},e=Math.max(3,e);const r=[],n=[],o=[],a=[],h=new or,c=new Ts;n.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let u=0,l=3;u<=e;u++,l+=3){const r=i+u/e*s;h.x=t*Math.cos(r),h.y=t*Math.sin(r),n.push(h.x,h.y,h.z),o.push(0,0,1),c.x=(n[l]/t+1)/2,c.y=(n[l+1]/t+1)/2,a.push(c.x,c.y)}for(let u=1;u<=e;u++)r.push(u,u+1,0);this.setIndex(r),this.setAttribute("position",new $n(n,3)),this.setAttribute("normal",new $n(o,3)),this.setAttribute("uv",new $n(a,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new fc(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class yc extends no{constructor(t=1,e=1,i=1,s=32,r=1,n=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:s,heightSegments:r,openEnded:n,thetaStart:o,thetaLength:a};const h=this;s=Math.floor(s),r=Math.floor(r);const c=[],u=[],l=[],d=[];let p=0;const m=[],f=i/2;let y=0;function g(){const n=new or,g=new or;let x=0;const b=(e-t)/i;for(let h=0;h<=r;h++){const c=[],y=h/r,x=y*(e-t)+t;for(let t=0;t<=s;t++){const e=t/s,r=e*a+o,h=Math.sin(r),m=Math.cos(r);g.x=x*h,g.y=-y*i+f,g.z=x*m,u.push(g.x,g.y,g.z),n.set(h,b,m).normalize(),l.push(n.x,n.y,n.z),d.push(e,1-y),c.push(p++)}m.push(c)}for(let i=0;i<s;i++)for(let s=0;s<r;s++){const n=m[s][i],o=m[s+1][i],a=m[s+1][i+1],h=m[s][i+1];(t>0||0!==s)&&(c.push(n,o,h),x+=3),(e>0||s!==r-1)&&(c.push(o,a,h),x+=3)}h.addGroup(y,x,0),y+=x}function x(i){const r=p,n=new Ts,m=new or;let g=0;const x=!0===i?t:e,b=!0===i?1:-1;for(let t=1;t<=s;t++)u.push(0,f*b,0),l.push(0,b,0),d.push(.5,.5),p++;const v=p;for(let t=0;t<=s;t++){const e=t/s,i=e*a+o,r=Math.cos(i),h=Math.sin(i);m.x=x*h,m.y=f*b,m.z=x*r,u.push(m.x,m.y,m.z),l.push(0,b,0),n.x=.5*r+.5,n.y=.5*h*b+.5,d.push(n.x,n.y),p++}for(let t=0;t<s;t++){const e=r+t,s=v+t;!0===i?c.push(s,s+1,e):c.push(s+1,s,e),g+=3}h.addGroup(y,g,!0===i?1:2),y+=g}g(),!1===n&&(t>0&&x(!0),e>0&&x(!1)),this.setIndex(c),this.setAttribute("position",new $n(u,3)),this.setAttribute("normal",new $n(l,3)),this.setAttribute("uv",new $n(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new yc(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class gc extends yc{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,o=2*Math.PI){super(0,t,e,i,s,r,n,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:o}}static fromJSON(t){return new gc(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class xc extends no{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function o(t){const i=new or,s=new or,r=new or;for(let n=0;n<e.length;n+=3)d(e[n+0],i),d(e[n+1],s),d(e[n+2],r),a(i,s,r,t)}function a(t,e,i,s){const r=s+1,n=[];for(let o=0;o<=r;o++){n[o]=[];const s=t.clone().lerp(i,o/r),a=e.clone().lerp(i,o/r),h=r-o;for(let t=0;t<=h;t++)n[o][t]=0===t&&o===r?s:s.clone().lerp(a,t/h)}for(let o=0;o<r;o++)for(let t=0;t<2*(r-o)-1;t++){const e=Math.floor(t/2);t%2===0?(l(n[o][e+1]),l(n[o+1][e]),l(n[o][e])):(l(n[o][e+1]),l(n[o+1][e+1]),l(n[o+1][e]))}}function h(t){const e=new or;for(let i=0;i<r.length;i+=3)e.x=r[i+0],e.y=r[i+1],e.z=r[i+2],e.normalize().multiplyScalar(t),r[i+0]=e.x,r[i+1]=e.y,r[i+2]=e.z}function c(){const t=new or;for(let e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];const i=f(t)/2/Math.PI+.5,s=y(t)/Math.PI+.5;n.push(i,1-s)}p(),u()}function u(){for(let t=0;t<n.length;t+=6){const e=n[t+0],i=n[t+2],s=n[t+4],r=Math.max(e,i,s),o=Math.min(e,i,s);r>.9&&o<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}function l(t){r.push(t.x,t.y,t.z)}function d(e,i){const s=3*e;i.x=t[s+0],i.y=t[s+1],i.z=t[s+2]}function p(){const t=new or,e=new or,i=new or,s=new or,o=new Ts,a=new Ts,h=new Ts;for(let c=0,u=0;c<r.length;c+=9,u+=6){t.set(r[c+0],r[c+1],r[c+2]),e.set(r[c+3],r[c+4],r[c+5]),i.set(r[c+6],r[c+7],r[c+8]),o.set(n[u+0],n[u+1]),a.set(n[u+2],n[u+3]),h.set(n[u+4],n[u+5]),s.copy(t).add(e).add(i).divideScalar(3);const l=f(s);m(o,u+0,t,l),m(a,u+2,e,l),m(h,u+4,i,l)}}function m(t,e,i,s){s<0&&1===t.x&&(n[e]=t.x-1),0===i.x&&0===i.z&&(n[e]=s/2/Math.PI+.5)}function f(t){return Math.atan2(t.z,-t.x)}function y(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}o(s),h(i),c(),this.setAttribute("position",new $n(r,3)),this.setAttribute("normal",new $n(r.slice(),3)),this.setAttribute("uv",new $n(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new xc(t.vertices,t.indices,t.radius,t.details)}}class bc extends xc{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],n=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,n,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new bc(t.radius,t.detail)}}const vc=new or,wc=new or,Mc=new or,Sc=new _n;class _c extends no{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=4,s=Math.pow(10,i),r=Math.cos(es*e),n=t.getIndex(),o=t.getAttribute("position"),a=n?n.count:o.count,h=[0,0,0],c=["a","b","c"],u=new Array(3),l={},d=[];for(let t=0;t<a;t+=3){n?(h[0]=n.getX(t),h[1]=n.getX(t+1),h[2]=n.getX(t+2)):(h[0]=t,h[1]=t+1,h[2]=t+2);const{a:e,b:i,c:a}=Sc;if(e.fromBufferAttribute(o,h[0]),i.fromBufferAttribute(o,h[1]),a.fromBufferAttribute(o,h[2]),Sc.getNormal(Mc),u[0]=`${Math.round(e.x*s)},${Math.round(e.y*s)},${Math.round(e.z*s)}`,u[1]=`${Math.round(i.x*s)},${Math.round(i.y*s)},${Math.round(i.z*s)}`,u[2]=`${Math.round(a.x*s)},${Math.round(a.y*s)},${Math.round(a.z*s)}`,u[0]!==u[1]&&u[1]!==u[2]&&u[2]!==u[0])for(let t=0;t<3;t++){const e=(t+1)%3,i=u[t],s=u[e],n=Sc[c[t]],o=Sc[c[e]],a=`${i}_${s}`,p=`${s}_${i}`;p in l&&l[p]?(Mc.dot(l[p].normal)<=r&&(d.push(n.x,n.y,n.z),d.push(o.x,o.y,o.z)),l[p]=null):a in l||(l[a]={index0:h[t],index1:h[e],normal:Mc.clone()})}}for(const t in l)if(l[t]){const{index0:e,index1:i}=l[t];vc.fromBufferAttribute(o,e),wc.fromBufferAttribute(o,i),d.push(vc.x,vc.y,vc.z),d.push(wc.x,wc.y,wc.z)}this.setAttribute("position",new $n(d,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class Ac extends dc{constructor(t){super(t),this.uuid=ss(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,s=this.holes.length;i<s;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new dc).fromJSON(i))}return this}}function Tc(t,e,i=2){const s=e&&e.length,r=s?e[0]*i:t.length;let n=zc(t,0,r,i,!0);const o=[];if(!n||n.next===n.prev)return o;let a,h,c;if(s&&(n=Ec(t,e,n,i)),t.length>80*i){a=1/0,h=1/0;let e=-1/0,s=-1/0;for(let n=i;n<r;n+=i){const i=t[n],r=t[n+1];i<a&&(a=i),r<h&&(h=r),i>e&&(e=i),r>s&&(s=r)}c=Math.max(e-a,s-h),c=0!==c?32767/c:0}return Ic(n,o,i,a,h,c,0),o}function zc(t,e,i,s,r){let n;if(r===ru(t,e,i,s)>0)for(let o=e;o<i;o+=s)n=eu(o/s|0,t[o],t[o+1],n);else for(let o=i-s;o>=e;o-=s)n=eu(o/s|0,t[o],t[o+1],n);return n&&Xc(n,n.next)&&(iu(n),n=n.next),n}function Cc(t,e){if(!t)return t;e||(e=t);let i,s=t;do{if(i=!1,s.steiner||!Xc(s,s.next)&&0!==Jc(s.prev,s,s.next))s=s.next;else{if(iu(s),s=e=s.prev,s===s.next)break;i=!0}}while(i||s!==e);return e}function Ic(t,e,i,s,r,n,o){if(!t)return;!o&&n&&Lc(t,s,r,n);let a=t;while(t.prev!==t.next){const h=t.prev,c=t.next;if(n?Bc(t,s,r,n):kc(t))e.push(h.i,t.i,c.i),iu(t),t=c.next,a=c.next;else if(t=c,t===a){o?1===o?(t=Rc(Cc(t),e),Ic(t,e,i,s,r,n,2)):2===o&&Pc(t,e,i,s,r,n):Ic(Cc(t),e,i,s,r,n,1);break}}}function kc(t){const e=t.prev,i=t,s=t.next;if(Jc(e,i,s)>=0)return!1;const r=e.x,n=i.x,o=s.x,a=e.y,h=i.y,c=s.y,u=Math.min(r,n,o),l=Math.min(a,h,c),d=Math.max(r,n,o),p=Math.max(a,h,c);let m=s.next;while(m!==e){if(m.x>=u&&m.x<=d&&m.y>=l&&m.y<=p&&Hc(r,a,n,h,o,c,m.x,m.y)&&Jc(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Bc(t,e,i,s){const r=t.prev,n=t,o=t.next;if(Jc(r,n,o)>=0)return!1;const a=r.x,h=n.x,c=o.x,u=r.y,l=n.y,d=o.y,p=Math.min(a,h,c),m=Math.min(u,l,d),f=Math.max(a,h,c),y=Math.max(u,l,d),g=Uc(p,m,e,i,s),x=Uc(f,y,e,i,s);let b=t.prevZ,v=t.nextZ;while(b&&b.z>=g&&v&&v.z<=x){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=y&&b!==r&&b!==o&&Hc(a,u,h,l,c,d,b.x,b.y)&&Jc(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,v.x>=p&&v.x<=f&&v.y>=m&&v.y<=y&&v!==r&&v!==o&&Hc(a,u,h,l,c,d,v.x,v.y)&&Jc(v.prev,v,v.next)>=0)return!1;v=v.nextZ}while(b&&b.z>=g){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=y&&b!==r&&b!==o&&Hc(a,u,h,l,c,d,b.x,b.y)&&Jc(b.prev,b,b.next)>=0)return!1;b=b.prevZ}while(v&&v.z<=x){if(v.x>=p&&v.x<=f&&v.y>=m&&v.y<=y&&v!==r&&v!==o&&Hc(a,u,h,l,c,d,v.x,v.y)&&Jc(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Rc(t,e){let i=t;do{const s=i.prev,r=i.next.next;!Xc(s,r)&&Zc(s,i,i.next,r)&&Qc(s,r)&&Qc(r,s)&&(e.push(s.i,i.i,r.i),iu(i),iu(i.next),i=t=r),i=i.next}while(i!==t);return Cc(i)}function Pc(t,e,i,s,r,n){let o=t;do{let t=o.next.next;while(t!==o.prev){if(o.i!==t.i&&qc(o,t)){let a=tu(o,t);return o=Cc(o,o.next),a=Cc(a,a.next),Ic(o,e,i,s,r,n,0),void Ic(a,e,i,s,r,n,0)}t=t.next}o=o.next}while(o!==t)}function Ec(t,e,i,s){const r=[];for(let n=0,o=e.length;n<o;n++){const i=e[n]*s,a=n<o-1?e[n+1]*s:t.length,h=zc(t,i,a,s,!1);h===h.next&&(h.steiner=!0),r.push(Wc(h))}r.sort(Oc);for(let n=0;n<r.length;n++)i=Fc(r[n],i);return i}function Oc(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){const s=(t.next.y-t.y)/(t.next.x-t.x),r=(e.next.y-e.y)/(e.next.x-e.x);i=s-r}return i}function Fc(t,e){const i=Nc(t,e);if(!i)return e;const s=tu(i,t);return Cc(s,s.next),Cc(i,i.next)}function Nc(t,e){let i=e;const s=t.x,r=t.y;let n,o=-1/0;if(Xc(t,i))return i;do{if(Xc(t,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>o&&(o=t,n=i.x<i.next.x?i:i.next,t===s))return n}i=i.next}while(i!==e);if(!n)return null;const a=n,h=n.x,c=n.y;let u=1/0;i=n;do{if(s>=i.x&&i.x>=h&&s!==i.x&&Dc(r<c?s:o,r,h,c,r<c?o:s,r,i.x,i.y)){const e=Math.abs(r-i.y)/(s-i.x);Qc(i,t)&&(e<u||e===u&&(i.x>n.x||i.x===n.x&&Vc(n,i)))&&(n=i,u=e)}i=i.next}while(i!==a);return n}function Vc(t,e){return Jc(t.prev,t,e.prev)<0&&Jc(e.next,t,t.next)<0}function Lc(t,e,i,s){let r=t;do{0===r.z&&(r.z=Uc(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,jc(r)}function jc(t){let e,i=1;do{let s,r=t;t=null;let n=null;e=0;while(r){e++;let o=r,a=0;for(let t=0;t<i;t++)if(a++,o=o.nextZ,!o)break;let h=i;while(a>0||h>0&&o)0!==a&&(0===h||!o||r.z<=o.z)?(s=r,r=r.nextZ,a--):(s=o,o=o.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=o}n.nextZ=null,i*=2}while(e>1);return t}function Uc(t,e,i,s,r){return t=(t-i)*r|0,e=(e-s)*r|0,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function Wc(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Dc(t,e,i,s,r,n,o,a){return(r-o)*(e-a)>=(t-o)*(n-a)&&(t-o)*(s-a)>=(i-o)*(e-a)&&(i-o)*(n-a)>=(r-o)*(s-a)}function Hc(t,e,i,s,r,n,o,a){return!(t===o&&e===a)&&Dc(t,e,i,s,r,n,o,a)}function qc(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!$c(t,e)&&(Qc(t,e)&&Qc(e,t)&&Kc(t,e)&&(Jc(t.prev,t,e.prev)||Jc(t,e.prev,e))||Xc(t,e)&&Jc(t.prev,t,t.next)>0&&Jc(e.prev,e,e.next)>0)}function Jc(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Xc(t,e){return t.x===e.x&&t.y===e.y}function Zc(t,e,i,s){const r=Gc(Jc(t,e,i)),n=Gc(Jc(t,e,s)),o=Gc(Jc(i,s,t)),a=Gc(Jc(i,s,e));return r!==n&&o!==a||(!(0!==r||!Yc(t,i,e))||(!(0!==n||!Yc(t,s,e))||(!(0!==o||!Yc(i,t,s))||!(0!==a||!Yc(i,e,s)))))}function Yc(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Gc(t){return t>0?1:t<0?-1:0}function $c(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Zc(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function Qc(t,e){return Jc(t.prev,t,t.next)<0?Jc(t,e,t.next)>=0&&Jc(t,t.prev,e)>=0:Jc(t,e,t.prev)<0||Jc(t,t.next,e)<0}function Kc(t,e){let i=t,s=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{i.y>n!==i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==t);return s}function tu(t,e){const i=su(t.i,t.x,t.y),s=su(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function eu(t,e,i,s){const r=su(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function iu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function su(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ru(t,e,i,s){let r=0;for(let n=e,o=i-s;n<i;n+=s)r+=(t[o]-t[n])*(t[n+1]+t[o+1]),o=n;return r}class nu{static triangulate(t,e,i=2){return Tc(t,e,i)}}class ou{static area(t){const e=t.length;let i=0;for(let s=e-1,r=0;r<e;s=r++)i+=t[s].x*t[r].y-t[r].x*t[s].y;return.5*i}static isClockWise(t){return ou.area(t)<0}static triangulateShape(t,e){const i=[],s=[],r=[];au(t),hu(i,t);let n=t.length;e.forEach(au);for(let a=0;a<e.length;a++)s.push(n),n+=e[a].length,hu(i,e[a]);const o=nu.triangulate(i,s);for(let a=0;a<o.length;a+=3)r.push(o.slice(a,a+3));return r}}function au(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function hu(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class cu extends no{constructor(t=new Ac([new Ts(.5,.5),new Ts(-.5,.5),new Ts(-.5,-.5),new Ts(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,s=[],r=[];for(let o=0,a=t.length;o<a;o++){const e=t[o];n(e)}function n(t){const n=[],o=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1,h=void 0!==e.depth?e.depth:1;let c=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:.2,l=void 0!==e.bevelSize?e.bevelSize:u-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const m=e.extrudePath,f=void 0!==e.UVGenerator?e.UVGenerator:uu;let y,g,x,b,v,w=!1;m&&(y=m.getSpacedPoints(a),w=!0,c=!1,g=m.computeFrenetFrames(a,!1),x=new or,b=new or,v=new or),c||(p=0,u=0,l=0,d=0);const M=t.extractPoints(o);let S=M.shape;const _=M.holes,A=!ou.isClockWise(S);if(A){S=S.reverse();for(let t=0,e=_.length;t<e;t++){const e=_[t];ou.isClockWise(e)&&(_[t]=e.reverse())}}function T(t){const e=1e-10,i=e*e;let s=t[0];for(let r=1;r<=t.length;r++){const e=r%t.length,n=t[e],o=n.x-s.x,a=n.y-s.y,h=o*o+a*a,c=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(s.x),Math.abs(s.y)),u=i*c*c;h<=u?(t.splice(e,1),r--):s=n}}T(S),_.forEach(T);const z=_.length,C=S;for(let e=0;e<z;e++){const t=_[e];S=S.concat(t)}function I(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,i)}const k=S.length;function B(t,e,i){let s,r,n;const o=t.x-e.x,a=t.y-e.y,h=i.x-t.x,c=i.y-t.y,u=o*o+a*a,l=o*c-a*h;if(Math.abs(l)>Number.EPSILON){const l=Math.sqrt(u),d=Math.sqrt(h*h+c*c),p=e.x-a/l,m=e.y+o/l,f=i.x-c/d,y=i.y+h/d,g=((f-p)*c-(y-m)*h)/(o*c-a*h);s=p+o*g-t.x,r=m+a*g-t.y;const x=s*s+r*r;if(x<=2)return new Ts(s,r);n=Math.sqrt(x/2)}else{let t=!1;o>Number.EPSILON?h>Number.EPSILON&&(t=!0):o<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(s=-a,r=o,n=Math.sqrt(u)):(s=o,r=a,n=Math.sqrt(u/2))}return new Ts(s/n,r/n)}const R=[];for(let e=0,i=C.length,s=i-1,r=e+1;e<i;e++,s++,r++)s===i&&(s=0),r===i&&(r=0),R[e]=B(C[e],C[s],C[r]);const P=[];let E,O=R.concat();for(let e=0,i=z;e<i;e++){const t=_[e];E=[];for(let e=0,i=t.length,s=i-1,r=e+1;e<i;e++,s++,r++)s===i&&(s=0),r===i&&(r=0),E[e]=B(t[e],t[s],t[r]);P.push(E),O=O.concat(E)}const F=[],N=[];for(let e=0;e<p;e++){const t=e/p,i=u*Math.cos(t*Math.PI/2),s=l*Math.sin(t*Math.PI/2)+d;for(let e=0,r=C.length;e<r;e++){const r=I(C[e],R[e],s);H(r.x,r.y,-i),0==t&&F.push(r)}for(let e=0,r=z;e<r;e++){const r=_[e];E=P[e];const n=[];for(let e=0,o=r.length;e<o;e++){const o=I(r[e],E[e],s);H(o.x,o.y,-i),0==t&&n.push(o)}0==t&&N.push(n)}}const V=ou.triangulateShape(F,N),L=V.length,j=l+d;for(let e=0;e<k;e++){const t=c?I(S[e],O[e],j):S[e];w?(b.copy(g.normals[0]).multiplyScalar(t.x),x.copy(g.binormals[0]).multiplyScalar(t.y),v.copy(y[0]).add(b).add(x),H(v.x,v.y,v.z)):H(t.x,t.y,0)}for(let e=1;e<=a;e++)for(let t=0;t<k;t++){const i=c?I(S[t],O[t],j):S[t];w?(b.copy(g.normals[e]).multiplyScalar(i.x),x.copy(g.binormals[e]).multiplyScalar(i.y),v.copy(y[e]).add(b).add(x),H(v.x,v.y,v.z)):H(i.x,i.y,h/a*e)}for(let e=p-1;e>=0;e--){const t=e/p,i=u*Math.cos(t*Math.PI/2),s=l*Math.sin(t*Math.PI/2)+d;for(let e=0,r=C.length;e<r;e++){const t=I(C[e],R[e],s);H(t.x,t.y,h+i)}for(let e=0,r=_.length;e<r;e++){const t=_[e];E=P[e];for(let e=0,r=t.length;e<r;e++){const r=I(t[e],E[e],s);w?H(r.x,r.y+y[a-1].y,y[a-1].x+i):H(r.x,r.y,h+i)}}}function U(){const t=s.length/3;if(c){let t=0,e=k*t;for(let i=0;i<L;i++){const t=V[i];q(t[2]+e,t[1]+e,t[0]+e)}t=a+2*p,e=k*t;for(let i=0;i<L;i++){const t=V[i];q(t[0]+e,t[1]+e,t[2]+e)}}else{for(let t=0;t<L;t++){const e=V[t];q(e[2],e[1],e[0])}for(let t=0;t<L;t++){const e=V[t];q(e[0]+k*a,e[1]+k*a,e[2]+k*a)}}i.addGroup(t,s.length/3-t,0)}function W(){const t=s.length/3;let e=0;D(C,e),e+=C.length;for(let i=0,s=_.length;i<s;i++){const t=_[i];D(t,e),e+=t.length}i.addGroup(t,s.length/3-t,1)}function D(t,e){let i=t.length;while(--i>=0){const s=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=a+2*p;t<i;t++){const i=k*t,n=k*(t+1),o=e+s+i,a=e+r+i,h=e+r+n,c=e+s+n;J(o,a,h,c)}}}function H(t,e,i){n.push(t),n.push(e),n.push(i)}function q(t,e,r){X(t),X(e),X(r);const n=s.length/3,o=f.generateTopUV(i,s,n-3,n-2,n-1);Z(o[0]),Z(o[1]),Z(o[2])}function J(t,e,r,n){X(t),X(e),X(n),X(e),X(r),X(n);const o=s.length/3,a=f.generateSideWallUV(i,s,o-6,o-3,o-2,o-1);Z(a[0]),Z(a[1]),Z(a[3]),Z(a[1]),Z(a[2]),Z(a[3])}function X(t){s.push(n[3*t+0]),s.push(n[3*t+1]),s.push(n[3*t+2])}function Z(t){r.push(t.x),r.push(t.y)}U(),W()}this.setAttribute("position",new $n(s,3)),this.setAttribute("uv",new $n(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes,i=this.parameters.options;return lu(e,i,t)}static fromJSON(t,e){const i=[];for(let r=0,n=t.shapes.length;r<n;r++){const s=e[t.shapes[r]];i.push(s)}const s=t.options.extrudePath;return void 0!==s&&(t.options.extrudePath=(new uc[s.type]).fromJSON(s)),new cu(i,t.options)}}const uu={generateTopUV:function(t,e,i,s,r){const n=e[3*i],o=e[3*i+1],a=e[3*s],h=e[3*s+1],c=e[3*r],u=e[3*r+1];return[new Ts(n,o),new Ts(a,h),new Ts(c,u)]},generateSideWallUV:function(t,e,i,s,r,n){const o=e[3*i],a=e[3*i+1],h=e[3*i+2],c=e[3*s],u=e[3*s+1],l=e[3*s+2],d=e[3*r],p=e[3*r+1],m=e[3*r+2],f=e[3*n],y=e[3*n+1],g=e[3*n+2];return Math.abs(a-u)<Math.abs(o-c)?[new Ts(o,1-h),new Ts(c,1-l),new Ts(d,1-m),new Ts(f,1-g)]:[new Ts(a,1-h),new Ts(u,1-l),new Ts(p,1-m),new Ts(y,1-g)]}};function lu(t,e,i){if(i.shapes=[],Array.isArray(t))for(let s=0,r=t.length;s<r;s++){const e=t[s];i.shapes.push(e.uuid)}else i.shapes.push(t.uuid);return i.options=Object.assign({},e),void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}class du extends xc{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(s,r,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new du(t.radius,t.detail)}}class pu extends xc{constructor(t=1,e=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,s,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new pu(t.radius,t.detail)}}class mu extends no{constructor(t=1,e=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:s};const r=t/2,n=e/2,o=Math.floor(i),a=Math.floor(s),h=o+1,c=a+1,u=t/o,l=e/a,d=[],p=[],m=[],f=[];for(let y=0;y<c;y++){const t=y*l-n;for(let e=0;e<h;e++){const i=e*u-r;p.push(i,-t,0),m.push(0,0,1),f.push(e/o),f.push(1-y/a)}}for(let y=0;y<a;y++)for(let t=0;t<o;t++){const e=t+h*y,i=t+h*(y+1),s=t+1+h*(y+1),r=t+1+h*y;d.push(e,i,r),d.push(i,s,r)}this.setIndex(d),this.setAttribute("position",new $n(p,3)),this.setAttribute("normal",new $n(m,3)),this.setAttribute("uv",new $n(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new mu(t.width,t.height,t.widthSegments,t.heightSegments)}}class fu extends no{constructor(t=.5,e=1,i=32,s=1,r=0,n=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:s,thetaStart:r,thetaLength:n},i=Math.max(3,i),s=Math.max(1,s);const o=[],a=[],h=[],c=[];let u=t;const l=(e-t)/s,d=new or,p=new Ts;for(let m=0;m<=s;m++){for(let t=0;t<=i;t++){const s=r+t/i*n;d.x=u*Math.cos(s),d.y=u*Math.sin(s),a.push(d.x,d.y,d.z),h.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,c.push(p.x,p.y)}u+=l}for(let m=0;m<s;m++){const t=m*(i+1);for(let e=0;e<i;e++){const s=e+t,r=s,n=s+i+1,a=s+i+2,h=s+1;o.push(r,n,h),o.push(n,a,h)}}this.setIndex(o),this.setAttribute("position",new $n(a,3)),this.setAttribute("normal",new $n(h,3)),this.setAttribute("uv",new $n(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new fu(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class yu extends no{constructor(t=new Ac([new Ts(0,.5),new Ts(-.5,-.5),new Ts(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],s=[],r=[],n=[];let o=0,a=0;if(!1===Array.isArray(t))h(t);else for(let c=0;c<t.length;c++)h(t[c]),this.addGroup(o,a,c),o+=a,a=0;function h(t){const o=s.length/3,h=t.extractPoints(e);let c=h.shape;const u=h.holes;!1===ou.isClockWise(c)&&(c=c.reverse());for(let e=0,i=u.length;e<i;e++){const t=u[e];!0===ou.isClockWise(t)&&(u[e]=t.reverse())}const l=ou.triangulateShape(c,u);for(let e=0,i=u.length;e<i;e++){const t=u[e];c=c.concat(t)}for(let e=0,i=c.length;e<i;e++){const t=c[e];s.push(t.x,t.y,0),r.push(0,0,1),n.push(t.x,t.y)}for(let e=0,s=l.length;e<s;e++){const t=l[e],s=t[0]+o,r=t[1]+o,n=t[2]+o;i.push(s,r,n),a+=3}}this.setIndex(i),this.setAttribute("position",new $n(s,3)),this.setAttribute("normal",new $n(r,3)),this.setAttribute("uv",new $n(n,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes;return gu(e,t)}static fromJSON(t,e){const i=[];for(let s=0,r=t.shapes.length;s<r;s++){const r=e[t.shapes[s]];i.push(r)}return new yu(i,t.curveSegments)}}function gu(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,s=t.length;i<s;i++){const s=t[i];e.shapes.push(s.uuid)}else e.shapes.push(t.uuid);return e}class xu extends no{constructor(t=1,e=32,i=16,s=0,r=2*Math.PI,n=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:s,phiLength:r,thetaStart:n,thetaLength:o},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const a=Math.min(n+o,Math.PI);let h=0;const c=[],u=new or,l=new or,d=[],p=[],m=[],f=[];for(let y=0;y<=i;y++){const d=[],g=y/i;let x=0;0===y&&0===n?x=.5/e:y===i&&a===Math.PI&&(x=-.5/e);for(let i=0;i<=e;i++){const a=i/e;u.x=-t*Math.cos(s+a*r)*Math.sin(n+g*o),u.y=t*Math.cos(n+g*o),u.z=t*Math.sin(s+a*r)*Math.sin(n+g*o),p.push(u.x,u.y,u.z),l.copy(u).normalize(),m.push(l.x,l.y,l.z),f.push(a+x,1-g),d.push(h++)}c.push(d)}for(let y=0;y<i;y++)for(let t=0;t<e;t++){const e=c[y][t+1],s=c[y][t],r=c[y+1][t],o=c[y+1][t+1];(0!==y||n>0)&&d.push(e,s,o),(y!==i-1||a<Math.PI)&&d.push(s,r,o)}this.setIndex(d),this.setAttribute("position",new $n(p,3)),this.setAttribute("normal",new $n(m,3)),this.setAttribute("uv",new $n(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new xu(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class bu extends xc{constructor(t=1,e=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,s,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new bu(t.radius,t.detail)}}class vu extends no{constructor(t=1,e=.4,i=12,s=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:s,arc:r},i=Math.floor(i),s=Math.floor(s);const n=[],o=[],a=[],h=[],c=new or,u=new or,l=new or;for(let d=0;d<=i;d++)for(let n=0;n<=s;n++){const p=n/s*r,m=d/i*Math.PI*2;u.x=(t+e*Math.cos(m))*Math.cos(p),u.y=(t+e*Math.cos(m))*Math.sin(p),u.z=e*Math.sin(m),o.push(u.x,u.y,u.z),c.x=t*Math.cos(p),c.y=t*Math.sin(p),l.subVectors(u,c).normalize(),a.push(l.x,l.y,l.z),h.push(n/s),h.push(d/i)}for(let d=1;d<=i;d++)for(let t=1;t<=s;t++){const e=(s+1)*d+t-1,i=(s+1)*(d-1)+t-1,r=(s+1)*(d-1)+t,o=(s+1)*d+t;n.push(e,i,o),n.push(i,r,o)}this.setIndex(n),this.setAttribute("position",new $n(o,3)),this.setAttribute("normal",new $n(a,3)),this.setAttribute("uv",new $n(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new vu(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class wu extends no{constructor(t=1,e=.4,i=64,s=8,r=2,n=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:s,p:r,q:n},i=Math.floor(i),s=Math.floor(s);const o=[],a=[],h=[],c=[],u=new or,l=new or,d=new or,p=new or,m=new or,f=new or,y=new or;for(let x=0;x<=i;++x){const o=x/i*r*Math.PI*2;g(o,r,n,t,d),g(o+.01,r,n,t,p),f.subVectors(p,d),y.addVectors(p,d),m.crossVectors(f,y),y.crossVectors(m,f),m.normalize(),y.normalize();for(let t=0;t<=s;++t){const r=t/s*Math.PI*2,n=-e*Math.cos(r),o=e*Math.sin(r);u.x=d.x+(n*y.x+o*m.x),u.y=d.y+(n*y.y+o*m.y),u.z=d.z+(n*y.z+o*m.z),a.push(u.x,u.y,u.z),l.subVectors(u,d).normalize(),h.push(l.x,l.y,l.z),c.push(x/i),c.push(t/s)}}for(let x=1;x<=i;x++)for(let t=1;t<=s;t++){const e=(s+1)*(x-1)+(t-1),i=(s+1)*x+(t-1),r=(s+1)*x+t,n=(s+1)*(x-1)+t;o.push(e,i,n),o.push(i,r,n)}function g(t,e,i,s,r){const n=Math.cos(t),o=Math.sin(t),a=i/e*t,h=Math.cos(a);r.x=s*(2+h)*.5*n,r.y=s*(2+h)*o*.5,r.z=s*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new $n(a,3)),this.setAttribute("normal",new $n(h,3)),this.setAttribute("uv",new $n(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new wu(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Mu extends no{constructor(t=new hc(new or(-1,-1,0),new or(-1,1,0),new or(1,1,0)),e=64,i=1,s=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:s,closed:r};const n=t.computeFrenetFrames(e,r);this.tangents=n.tangents,this.normals=n.normals,this.binormals=n.binormals;const o=new or,a=new or,h=new Ts;let c=new or;const u=[],l=[],d=[],p=[];function m(){for(let t=0;t<e;t++)f(t);f(!1===r?e:0),g(),y()}function f(r){c=t.getPointAt(r/e,c);const h=n.normals[r],d=n.binormals[r];for(let t=0;t<=s;t++){const e=t/s*Math.PI*2,r=Math.sin(e),n=-Math.cos(e);a.x=n*h.x+r*d.x,a.y=n*h.y+r*d.y,a.z=n*h.z+r*d.z,a.normalize(),l.push(a.x,a.y,a.z),o.x=c.x+i*a.x,o.y=c.y+i*a.y,o.z=c.z+i*a.z,u.push(o.x,o.y,o.z)}}function y(){for(let t=1;t<=e;t++)for(let e=1;e<=s;e++){const i=(s+1)*(t-1)+(e-1),r=(s+1)*t+(e-1),n=(s+1)*t+e,o=(s+1)*(t-1)+e;p.push(i,r,o),p.push(r,n,o)}}function g(){for(let t=0;t<=e;t++)for(let i=0;i<=s;i++)h.x=t/e,h.y=i/s,d.push(h.x,h.y)}m(),this.setIndex(p),this.setAttribute("position",new $n(u,3)),this.setAttribute("normal",new $n(l,3)),this.setAttribute("uv",new $n(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Mu((new uc[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Su extends no{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],i=new Set,s=new or,r=new or;if(null!==t.index){const n=t.attributes.position,o=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let t=0,h=a.length;t<h;++t){const h=a[t],c=h.start,u=h.count;for(let t=c,a=c+u;t<a;t+=3)for(let h=0;h<3;h++){const a=o.getX(t+h),c=o.getX(t+(h+1)%3);s.fromBufferAttribute(n,a),r.fromBufferAttribute(n,c),!0===_u(s,r,i)&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}}else{const n=t.attributes.position;for(let t=0,o=n.count/3;t<o;t++)for(let a=0;a<3;a++){const o=3*t+a,h=3*t+(a+1)%3;s.fromBufferAttribute(n,o),r.fromBufferAttribute(n,h),!0===_u(s,r,i)&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new $n(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function _u(t,e,i){const s=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==i.has(s)&&!0!==i.has(r)&&(i.add(s),i.add(r),!0)}var Au=Object.freeze({__proto__:null,BoxGeometry:wo,CapsuleGeometry:mc,CircleGeometry:fc,ConeGeometry:gc,CylinderGeometry:yc,DodecahedronGeometry:bc,EdgesGeometry:_c,ExtrudeGeometry:cu,IcosahedronGeometry:du,LatheGeometry:pc,OctahedronGeometry:pu,PlaneGeometry:mu,PolyhedronGeometry:xc,RingGeometry:fu,ShapeGeometry:yu,SphereGeometry:xu,TetrahedronGeometry:bu,TorusGeometry:vu,TorusKnotGeometry:wu,TubeGeometry:Mu,WireframeGeometry:Su});class Tu extends Rn{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new In(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class zu extends Io{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Cu extends Rn{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new In(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ai,this.normalScale=new Ts(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Iu extends Cu{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ts(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return rs(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new In(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new In(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new In(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!==t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!==t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!==t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!==t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!==t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!==t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class ku extends Rn{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new In(16777215),this.specular=new In(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ai,this.normalScale=new Ts(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jr,this.combine=ht,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Bu extends Rn{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new In(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ai,this.normalScale=new Ts(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class Ru extends Rn{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ai,this.normalScale=new Ts(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class Pu extends Rn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new In(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ai,this.normalScale=new Ts(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jr,this.combine=ht,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Eu extends Rn{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=si,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Ou extends Rn{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class Fu extends Rn{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new In(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ai,this.normalScale=new Ts(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Nu extends ch{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function Vu(t,e){return t&&t.constructor!==e?"number"===typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function Lu(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ju(t){function e(e,i){return t[e]-t[i]}const i=t.length,s=new Array(i);for(let r=0;r!==i;++r)s[r]=r;return s.sort(e),s}function Uu(t,e,i){const s=t.length,r=new t.constructor(s);for(let n=0,o=0;o!==s;++n){const s=i[n]*e;for(let i=0;i!==e;++i)r[o++]=t[s+i]}return r}function Wu(t,e,i,s){let r=1,n=t[0];while(void 0!==n&&void 0===n[s])n=t[r++];if(void 0===n)return;let o=n[s];if(void 0!==o)if(Array.isArray(o))do{o=n[s],void 0!==o&&(e.push(n.time),i.push(...o)),n=t[r++]}while(void 0!==n);else if(void 0!==o.toArray)do{o=n[s],void 0!==o&&(e.push(n.time),o.toArray(i,i.length)),n=t[r++]}while(void 0!==n);else do{o=n[s],void 0!==o&&(e.push(n.time),i.push(o)),n=t[r++]}while(void 0!==n)}function Du(t,e,i,s,r=30){const n=t.clone();n.name=e;const o=[];for(let h=0;h<n.tracks.length;++h){const t=n.tracks[h],e=t.getValueSize(),a=[],c=[];for(let n=0;n<t.times.length;++n){const o=t.times[n]*r;if(!(o<i||o>=s)){a.push(t.times[n]);for(let i=0;i<e;++i)c.push(t.values[n*e+i])}}0!==a.length&&(t.times=Vu(a,t.times.constructor),t.values=Vu(c,t.values.constructor),o.push(t))}n.tracks=o;let a=1/0;for(let h=0;h<n.tracks.length;++h)a>n.tracks[h].times[0]&&(a=n.tracks[h].times[0]);for(let h=0;h<n.tracks.length;++h)n.tracks[h].shift(-1*a);return n.resetDuration(),n}function Hu(t,e=0,i=t,s=30){s<=0&&(s=30);const r=i.tracks.length,n=e/s;for(let o=0;o<r;++o){const e=i.tracks[o],s=e.ValueTypeName;if("bool"===s||"string"===s)continue;const r=t.tracks.find(function(t){return t.name===e.name&&t.ValueTypeName===s});if(void 0===r)continue;let a=0;const h=e.getValueSize();e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=h/3);let c=0;const u=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);const l=e.times.length-1;let d;if(n<=e.times[0]){const t=a,i=h-a;d=e.values.slice(t,i)}else if(n>=e.times[l]){const t=l*h+a,i=t+h-a;d=e.values.slice(t,i)}else{const t=e.createInterpolant(),i=a,s=h-a;t.evaluate(n),d=t.resultBuffer.slice(i,s)}if("quaternion"===s){const t=(new nr).fromArray(d).normalize().conjugate();t.toArray(d)}const p=r.times.length;for(let t=0;t<p;++t){const e=t*u+c;if("quaternion"===s)nr.multiplyQuaternionsFlat(r.values,e,d,0,r.values,e);else{const t=u-2*c;for(let i=0;i<t;++i)r.values[e+i]-=d[i]}}}return t.blendMode=Ke,t}class qu{static convertArray(t,e){return Vu(t,e)}static isTypedArray(t){return Lu(t)}static getKeyframeOrder(t){return ju(t)}static sortedArray(t,e,i){return Uu(t,e,i)}static flattenJSON(t,e,i,s){Wu(t,e,i,s)}static subclip(t,e,i,s,r=30){return Du(t,e,i,s,r)}static makeClipAdditive(t,e=0,i=t,s=30){return Hu(t,e,i,s)}}class Ju{constructor(t,e,i,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==s?s:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,s=e[i],r=e[i-1];t:{e:{let n;i:{s:if(!(t<s)){for(let n=i+2;;){if(void 0===s){if(t<r)break s;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===n)break;if(r=s,s=e[++i],t<s)break e}n=e.length;break i}if(!(t>=r)){const o=e[1];t<o&&(i=2,r=o);for(let n=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===n)break;if(s=r,r=e[--i-1],t>=r)break e}n=i,i=0;break i}break t}while(i<n){const s=i+n>>>1;t<e[s]?n=s:i=s+1}if(s=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===s)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,s)}return this.interpolate_(i,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=t*s;for(let n=0;n!==s;++n)e[n]=i[r+n];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Xu extends Ju{constructor(t,e,i,s){super(t,e,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ye,endingEnd:Ye}}intervalChanged_(t,e,i){const s=this.parameterPositions;let r=t-2,n=t+1,o=s[r],a=s[n];if(void 0===o)switch(this.getSettings_().endingStart){case Ge:r=t,o=2*e-i;break;case $e:r=s.length-2,o=e+s[r]-s[r+1];break;default:r=t,o=i}if(void 0===a)switch(this.getSettings_().endingEnd){case Ge:n=t,a=2*i-e;break;case $e:n=1,a=i+s[1]-s[0];break;default:n=t-1,a=e}const h=.5*(i-e),c=this.valueSize;this._weightPrev=h/(e-o),this._weightNext=h/(a-i),this._offsetPrev=r*c,this._offsetNext=n*c}interpolate_(t,e,i,s){const r=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=t*o,h=a-o,c=this._offsetPrev,u=this._offsetNext,l=this._weightPrev,d=this._weightNext,p=(i-e)/(s-e),m=p*p,f=m*p,y=-l*f+2*l*m-l*p,g=(1+l)*f+(-1.5-2*l)*m+(-.5+l)*p+1,x=(-1-d)*f+(1.5+d)*m+.5*p,b=d*f-d*m;for(let v=0;v!==o;++v)r[v]=y*n[c+v]+g*n[h+v]+x*n[a+v]+b*n[u+v];return r}}class Zu extends Ju{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){const r=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=t*o,h=a-o,c=(i-e)/(s-e),u=1-c;for(let l=0;l!==o;++l)r[l]=n[h+l]*u+n[a+l]*c;return r}}class Yu extends Ju{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t){return this.copySampleValue_(t-1)}}class Gu{constructor(t,e,i,s){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Vu(e,this.TimeBufferType),this.values=Vu(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Vu(t.times,Array),values:Vu(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Yu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Zu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Je:e=this.InterpolantFactoryMethodDiscrete;break;case Xe:e=this.InterpolantFactoryMethodLinear;break;case Ze:e=this.InterpolantFactoryMethodSmooth;break}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Je;case this.InterpolantFactoryMethodLinear:return Xe;case this.InterpolantFactoryMethodSmooth:return Ze}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]*=t}return this}trim(t,e){const i=this.times,s=i.length;let r=0,n=s-1;while(r!==s&&i[r]<t)++r;while(-1!==n&&i[n]>e)--n;if(++n,0!==r||n!==s){r>=n&&(n=Math.max(n,1),r=n-1);const t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,s=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let o=0;o!==r;o++){const e=i[o];if("number"===typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==n&&n>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,n),t=!1;break}n=e}if(void 0!==s&&Lu(s))for(let o=0,a=s.length;o!==a;++o){const e=s[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===Ze,r=t.length-1;let n=1;for(let o=1;o<r;++o){let r=!1;const a=t[o],h=t[o+1];if(a!==h&&(1!==o||a!==t[0]))if(s)r=!0;else{const t=o*i,s=t-i,n=t+i;for(let o=0;o!==i;++o){const i=e[t+o];if(i!==e[s+o]||i!==e[n+o]){r=!0;break}}}if(r){if(o!==n){t[n]=t[o];const s=o*i,r=n*i;for(let t=0;t!==i;++t)e[r+t]=e[s+t]}++n}}if(r>0){t[n]=t[r];for(let t=r*i,s=n*i,o=0;o!==i;++o)e[s+o]=e[t+o];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=this.constructor,s=new i(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}}Gu.prototype.ValueTypeName="",Gu.prototype.TimeBufferType=Float32Array,Gu.prototype.ValueBufferType=Float32Array,Gu.prototype.DefaultInterpolation=Xe;class $u extends Gu{constructor(t,e,i){super(t,e,i)}}$u.prototype.ValueTypeName="bool",$u.prototype.ValueBufferType=Array,$u.prototype.DefaultInterpolation=Je,$u.prototype.InterpolantFactoryMethodLinear=void 0,$u.prototype.InterpolantFactoryMethodSmooth=void 0;class Qu extends Gu{constructor(t,e,i,s){super(t,e,i,s)}}Qu.prototype.ValueTypeName="color";class Ku extends Gu{constructor(t,e,i,s){super(t,e,i,s)}}Ku.prototype.ValueTypeName="number";class tl extends Ju{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){const r=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=(i-e)/(s-e);let h=t*o;for(let c=h+o;h!==c;h+=4)nr.slerpFlat(r,0,n,h-o,n,h,a);return r}}class el extends Gu{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new tl(this.times,this.values,this.getValueSize(),t)}}el.prototype.ValueTypeName="quaternion",el.prototype.InterpolantFactoryMethodSmooth=void 0;class il extends Gu{constructor(t,e,i){super(t,e,i)}}il.prototype.ValueTypeName="string",il.prototype.ValueBufferType=Array,il.prototype.DefaultInterpolation=Je,il.prototype.InterpolantFactoryMethodLinear=void 0,il.prototype.InterpolantFactoryMethodSmooth=void 0;class sl extends Gu{constructor(t,e,i,s){super(t,e,i,s)}}sl.prototype.ValueTypeName="vector";class rl{constructor(t="",e=-1,i=[],s=Qe){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=ss(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,s=1/(t.fps||1);for(let n=0,o=i.length;n!==o;++n)e.push(ol(i[n]).scale(s));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,n=i.length;r!==n;++r)e.push(Gu.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(t,e,i,s){const r=e.length,n=[];for(let o=0;o<r;o++){let t=[],a=[];t.push((o+r-1)%r,o,(o+1)%r),a.push(0,1,0);const h=ju(t);t=Uu(t,1,h),a=Uu(a,1,h),s||0!==t[0]||(t.push(r),a.push(a[0])),n.push(new Ku(".morphTargetInfluences["+e[o].name+"]",t,a).scale(1/i))}return new this(t,-1,n)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let s=0;s<i.length;s++)if(i[s].name===e)return i[s];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const s={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,a=t.length;o<a;o++){const e=t[o],i=e.name.match(r);if(i&&i.length>1){const t=i[1];let r=s[t];r||(s[t]=r=[]),r.push(e)}}const n=[];for(const o in s)n.push(this.CreateFromMorphTargetSequence(o,s[o],e,i));return n}static parseAnimation(t,e){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,s,r){if(0!==i.length){const n=[],o=[];Wu(i,n,o,s),0!==n.length&&r.push(new t(e,n,o))}},s=[],r=t.name||"default",n=t.fps||30,o=t.blendMode;let a=t.length||-1;const h=t.hierarchy||[];for(let u=0;u<h.length;u++){const t=h[u].keys;if(t&&0!==t.length)if(t[0].morphTargets){const e={};let i;for(i=0;i<t.length;i++)if(t[i].morphTargets)for(let s=0;s<t[i].morphTargets.length;s++)e[t[i].morphTargets[s]]=-1;for(const r in e){const e=[],n=[];for(let s=0;s!==t[i].morphTargets.length;++s){const s=t[i];e.push(s.time),n.push(s.morphTarget===r?1:0)}s.push(new Ku(".morphTargetInfluence["+r+"]",e,n))}a=e.length*n}else{const r=".bones["+e[u].name+"]";i(sl,r+".position",t,"pos",s),i(el,r+".quaternion",t,"rot",s),i(sl,r+".scale",t,"scl",s)}}if(0===s.length)return null;const c=new this(r,a,s,o);return c}resetDuration(){const t=this.tracks;let e=0;for(let i=0,s=t.length;i!==s;++i){const t=this.tracks[i];e=Math.max(e,t.times[t.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function nl(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ku;case"vector":case"vector2":case"vector3":case"vector4":return sl;case"color":return Qu;case"quaternion":return el;case"bool":case"boolean":return $u;case"string":return il}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function ol(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=nl(t.type);if(void 0===t.times){const e=[],i=[];Wu(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const al={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class hl{constructor(t,e,i){const s=this;let r,n=!1,o=0,a=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){a++,!1===n&&void 0!==s.onStart&&s.onStart(t,o,a),n=!0},this.itemEnd=function(t){o++,void 0!==s.onProgress&&s.onProgress(t,o,a),o===a&&(n=!1,void 0!==s.onLoad&&s.onLoad())},this.itemError=function(t){void 0!==s.onError&&s.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){const i=h[e],s=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return s}return null}}}const cl=new hl;class ul{constructor(t){this.manager=void 0!==t?t:cl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise(function(s,r){i.load(t,s,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}ul.DEFAULT_MATERIAL_NAME="__DEFAULT";const ll={};class dl extends Error{constructor(t,e){super(t),this.response=e}}class pl extends ul{constructor(t){super(t),this.mimeType="",this.responseType=""}load(t,e,i,s){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=al.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==ll[t])return void ll[t].push({onLoad:e,onProgress:i,onError:s});ll[t]=[],ll[t].push({onLoad:e,onProgress:i,onError:s});const n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"===typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=ll[t],s=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,o=0!==n;let a=0;const h=new ReadableStream({start(t){function e(){s.read().then(({done:s,value:r})=>{if(s)t.close();else{a+=r.byteLength;const s=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:n});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(s)}t.enqueue(r),e()}},e=>{t.error(e)})}e()}});return new Response(h)}throw new dl(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(a){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>{const e=new DOMParser;return e.parseFromString(t,o)});case"json":return t.json();default:if(""===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i,i=e.exec(o),s=i&&i[1]?i[1].toLowerCase():void 0,r=new TextDecoder(s);return t.arrayBuffer().then(t=>r.decode(t))}}}).then(e=>{al.add(t,e);const i=ll[t];delete ll[t];for(let t=0,s=i.length;t<s;t++){const s=i[t];s.onLoad&&s.onLoad(e)}}).catch(e=>{const i=ll[t];if(void 0===i)throw this.manager.itemError(t),e;delete ll[t];for(let t=0,s=i.length;t<s;t++){const s=i[t];s.onError&&s.onError(e)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class ml extends ul{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new pl(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(n){s?s(n):console.error(n),r.manager.itemError(t)}},i,s)}parse(t){const e=[];for(let i=0;i<t.length;i++){const s=rl.parse(t[i]);e.push(s)}return e}}class fl extends ul{constructor(t){super(t)}load(t,e,i,s){const r=this,n=[],o=new Ph,a=new pl(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let h=0;function c(c){a.load(t[c],function(t){const i=r.parse(t,!0);n[c]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},h+=1,6===h&&(1===i.mipmapCount&&(o.minFilter=Ot),o.image=n,o.format=i.format,o.needsUpdate=!0,e&&e(o))},i,s)}if(Array.isArray(t))for(let u=0,l=t.length;u<l;++u)c(u);else a.load(t,function(t){const i=r.parse(t,!0);if(i.isCubemap){const t=i.mipmaps.length/i.mipmapCount;for(let e=0;e<t;e++){n[e]={mipmaps:[]};for(let t=0;t<i.mipmapCount;t++)n[e].mipmaps.push(i.mipmaps[e*i.mipmapCount+t]),n[e].format=i.format,n[e].width=i.width,n[e].height=i.height}o.image=n}else o.image.width=i.width,o.image.height=i.height,o.mipmaps=i.mipmaps;1===i.mipmapCount&&(o.minFilter=Ot),o.format=i.format,o.needsUpdate=!0,e&&e(o)},i,s);return o}}class yl extends ul{constructor(t){super(t)}load(t,e,i,s){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,n=al.get(t);if(void 0!==n)return r.manager.itemStart(t),setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n;const o=Rs("img");function a(){c(),al.add(t,this),e&&e(this),r.manager.itemEnd(t)}function h(e){c(),s&&s(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){o.removeEventListener("load",a,!1),o.removeEventListener("error",h,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",h,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}class gl extends ul{constructor(t){super(t)}load(t,e,i,s){const r=new Vo;r.colorSpace=ui;const n=new yl(this.manager);n.setCrossOrigin(this.crossOrigin),n.setPath(this.path);let o=0;function a(i){n.load(t[i],function(t){r.images[i]=t,o++,6===o&&(r.needsUpdate=!0,e&&e(r))},void 0,s)}for(let h=0;h<t.length;++h)a(h);return r}}class xl extends ul{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new Aa,o=new pl(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,function(t){let i;try{i=r.parse(t)}catch(o){if(void 0===s)return void console.error(o);s(o)}void 0!==i.image?n.image=i.image:void 0!==i.data&&(n.image.width=i.width,n.image.height=i.height,n.image.data=i.data),n.wrapS=void 0!==i.wrapS?i.wrapS:Ct,n.wrapT=void 0!==i.wrapT?i.wrapT:Ct,n.magFilter=void 0!==i.magFilter?i.magFilter:Ot,n.minFilter=void 0!==i.minFilter?i.minFilter:Ot,n.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(n.colorSpace=i.colorSpace),void 0!==i.flipY&&(n.flipY=i.flipY),void 0!==i.format&&(n.format=i.format),void 0!==i.type&&(n.type=i.type),void 0!==i.mipmaps&&(n.mipmaps=i.mipmaps,n.minFilter=Vt),1===i.mipmapCount&&(n.minFilter=Ot),void 0!==i.generateMipmaps&&(n.generateMipmaps=i.generateMipmaps),n.needsUpdate=!0,e&&e(n,i)},i,s),n}}class bl extends ul{constructor(t){super(t)}load(t,e,i,s){const r=new $s,n=new yl(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},i,s),r}}class vl extends un{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new In(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(e.object.target=this.target.uuid),e}}class wl extends vl{constructor(t,e,i){super(t,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(un.DEFAULT_UP),this.updateMatrix(),this.groundColor=new In(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const Ml=new Fr,Sl=new or,_l=new or;class Al{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ts(512,512),this.map=null,this.mapPass=null,this.matrix=new Fr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ha,this._frameExtents=new Ts(1,1),this._viewportCount=1,this._viewports=[new Qs(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;Sl.setFromMatrixPosition(t.matrixWorld),e.position.copy(Sl),_l.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(_l),e.updateMatrixWorld(),Ml.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ml),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Ml)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Tl extends Al{constructor(){super(new Eo(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,i=2*is*t.angle*this.focus,s=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&s===e.aspect&&r===e.far||(e.fov=i,e.aspect=s,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class zl extends vl{constructor(t,e,i=0,s=Math.PI/3,r=0,n=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(un.DEFAULT_UP),this.updateMatrix(),this.target=new un,this.distance=i,this.angle=s,this.penumbra=r,this.decay=n,this.map=null,this.shadow=new Tl}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Cl=new Fr,Il=new or,kl=new or;class Bl extends Al{constructor(){super(new Eo(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ts(4,2),this._viewportCount=6,this._viewports=[new Qs(2,1,1,1),new Qs(0,1,1,1),new Qs(3,1,1,1),new Qs(1,1,1,1),new Qs(3,0,1,1),new Qs(1,0,1,1)],this._cubeDirections=[new or(1,0,0),new or(-1,0,0),new or(0,0,1),new or(0,0,-1),new or(0,1,0),new or(0,-1,0)],this._cubeUps=[new or(0,1,0),new or(0,1,0),new or(0,1,0),new or(0,1,0),new or(0,0,1),new or(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,s=this.matrix,r=t.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),Il.setFromMatrixPosition(t.matrixWorld),i.position.copy(Il),kl.copy(i.position),kl.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(kl),i.updateMatrixWorld(),s.makeTranslation(-Il.x,-Il.y,-Il.z),Cl.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cl)}}class Rl extends vl{constructor(t,e,i=0,s=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new Bl}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Pl extends ko{constructor(t=-1,e=1,i=1,s=-1,r=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=s,this.near=r,this.far=n,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,s,r,n){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-t,n=i+t,o=s+e,a=s-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,n=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,n,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class El extends Al{constructor(){super(new Pl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Ol extends vl{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(un.DEFAULT_UP),this.updateMatrix(),this.target=new un,this.shadow=new El}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class Fl extends vl{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class Nl extends vl{constructor(t,e,i=10,s=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class Vl{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new or)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,s=t.y,r=t.z,n=this.coefficients;return e.copy(n[0]).multiplyScalar(.282095),e.addScaledVector(n[1],.488603*s),e.addScaledVector(n[2],.488603*r),e.addScaledVector(n[3],.488603*i),e.addScaledVector(n[4],i*s*1.092548),e.addScaledVector(n[5],s*r*1.092548),e.addScaledVector(n[6],.315392*(3*r*r-1)),e.addScaledVector(n[7],i*r*1.092548),e.addScaledVector(n[8],.546274*(i*i-s*s)),e}getIrradianceAt(t,e){const i=t.x,s=t.y,r=t.z,n=this.coefficients;return e.copy(n[0]).multiplyScalar(.886227),e.addScaledVector(n[1],1.023328*s),e.addScaledVector(n[2],1.023328*r),e.addScaledVector(n[3],1.023328*i),e.addScaledVector(n[4],.858086*i*s),e.addScaledVector(n[5],.858086*s*r),e.addScaledVector(n[6],.743125*r*r-.247708),e.addScaledVector(n[7],.858086*i*r),e.addScaledVector(n[8],.429043*(i*i-s*s)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let s=0;s<9;s++)i[s].fromArray(t,e+3*s);return this}toArray(t=[],e=0){const i=this.coefficients;for(let s=0;s<9;s++)i[s].toArray(t,e+3*s);return t}static getBasisAt(t,e){const i=t.x,s=t.y,r=t.z;e[0]=.282095,e[1]=.488603*s,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*s,e[5]=1.092548*s*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-s*s)}}class Ll extends vl{constructor(t=new Vl,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class jl extends ul{constructor(t){super(t),this.textures={}}load(t,e,i,s){const r=this,n=new pl(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(n){s?s(n):console.error(n),r.manager.itemError(t)}},i,s)}parse(t){const e=this.textures;function i(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const s=this.createMaterialFromType(t.type);if(void 0!==t.uuid&&(s.uuid=t.uuid),void 0!==t.name&&(s.name=t.name),void 0!==t.color&&void 0!==s.color&&s.color.setHex(t.color),void 0!==t.roughness&&(s.roughness=t.roughness),void 0!==t.metalness&&(s.metalness=t.metalness),void 0!==t.sheen&&(s.sheen=t.sheen),void 0!==t.sheenColor&&(s.sheenColor=(new In).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(s.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==s.emissive&&s.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==s.specular&&s.specular.setHex(t.specular),void 0!==t.specularIntensity&&(s.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==s.specularColor&&s.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(s.shininess=t.shininess),void 0!==t.clearcoat&&(s.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(s.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.dispersion&&(s.dispersion=t.dispersion),void 0!==t.iridescence&&(s.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(s.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(s.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(s.transmission=t.transmission),void 0!==t.thickness&&(s.thickness=t.thickness),void 0!==t.attenuationDistance&&(s.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==s.attenuationColor&&s.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(s.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(s.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(s.fog=t.fog),void 0!==t.flatShading&&(s.flatShading=t.flatShading),void 0!==t.blending&&(s.blending=t.blending),void 0!==t.combine&&(s.combine=t.combine),void 0!==t.side&&(s.side=t.side),void 0!==t.shadowSide&&(s.shadowSide=t.shadowSide),void 0!==t.opacity&&(s.opacity=t.opacity),void 0!==t.transparent&&(s.transparent=t.transparent),void 0!==t.alphaTest&&(s.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(s.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(s.depthFunc=t.depthFunc),void 0!==t.depthTest&&(s.depthTest=t.depthTest),void 0!==t.depthWrite&&(s.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(s.colorWrite=t.colorWrite),void 0!==t.blendSrc&&(s.blendSrc=t.blendSrc),void 0!==t.blendDst&&(s.blendDst=t.blendDst),void 0!==t.blendEquation&&(s.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(s.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(s.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(s.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==s.blendColor&&s.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(s.blendAlpha=t.blendAlpha),void 0!==t.stencilWriteMask&&(s.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(s.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(s.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(s.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(s.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(s.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(s.stencilZPass=t.stencilZPass),void 0!==t.stencilWrite&&(s.stencilWrite=t.stencilWrite),void 0!==t.wireframe&&(s.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(s.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(s.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(s.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(s.rotation=t.rotation),void 0!==t.linewidth&&(s.linewidth=t.linewidth),void 0!==t.dashSize&&(s.dashSize=t.dashSize),void 0!==t.gapSize&&(s.gapSize=t.gapSize),void 0!==t.scale&&(s.scale=t.scale),void 0!==t.polygonOffset&&(s.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(s.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(s.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(s.dithering=t.dithering),void 0!==t.alphaToCoverage&&(s.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(s.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(s.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.toneMapped&&(s.toneMapped=t.toneMapped),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.vertexColors&&("number"===typeof t.vertexColors?s.vertexColors=t.vertexColors>0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const r in t.uniforms){const e=t.uniforms[r];switch(s.uniforms[r]={},e.type){case"t":s.uniforms[r].value=i(e.value);break;case"c":s.uniforms[r].value=(new In).setHex(e.value);break;case"v2":s.uniforms[r].value=(new Ts).fromArray(e.value);break;case"v3":s.uniforms[r].value=(new or).fromArray(e.value);break;case"v4":s.uniforms[r].value=(new Qs).fromArray(e.value);break;case"m3":s.uniforms[r].value=(new zs).fromArray(e.value);break;case"m4":s.uniforms[r].value=(new Fr).fromArray(e.value);break;default:s.uniforms[r].value=e.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(const r in t.extensions)s.extensions[r]=t.extensions[r];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=(new Ts).fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=(new Ts).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return jl.createMaterialFromType(t)}static createMaterialFromType(t){const e={ShadowMaterial:Tu,SpriteMaterial:Yo,RawShaderMaterial:zu,ShaderMaterial:Io,PointsMaterial:Sh,MeshPhysicalMaterial:Iu,MeshStandardMaterial:Cu,MeshPhongMaterial:ku,MeshToonMaterial:Bu,MeshNormalMaterial:Ru,MeshLambertMaterial:Pu,MeshDepthMaterial:Eu,MeshDistanceMaterial:Ou,MeshBasicMaterial:Pn,MeshMatcapMaterial:Fu,LineDashedMaterial:Nu,LineBasicMaterial:ch,Material:Rn};return new e[t]}}class Ul{static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!==typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class Wl extends no{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class Dl extends ul{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new pl(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(n){s?s(n):console.error(n),r.manager.itemError(t)}},i,s)}parse(t){const e={},i={};function s(t,i){if(void 0!==e[i])return e[i];const s=t.interleavedBuffers,n=s[i],o=r(t,n.buffer),a=Bs(n.type,o),h=new Jo(a,n.stride);return h.uuid=n.uuid,e[i]=h,h}function r(t,e){if(void 0!==i[e])return i[e];const s=t.arrayBuffers,r=s[e],n=new Uint32Array(r).buffer;return i[e]=n,n}const n=t.isInstancedBufferGeometry?new Wl:new no,o=t.data.index;if(void 0!==o){const t=Bs(o.type,o.array);n.setIndex(new Wn(t,1))}const a=t.data.attributes;for(const d in a){const e=a[d];let i;if(e.isInterleavedBufferAttribute){const r=s(t.data,e.data);i=new Zo(r,e.itemSize,e.offset,e.normalized)}else{const t=Bs(e.type,e.array),s=e.isInstancedBufferAttribute?Ia:Wn;i=new s(t,e.itemSize,e.normalized)}void 0!==e.name&&(i.name=e.name),void 0!==e.usage&&i.setUsage(e.usage),n.setAttribute(d,i)}const h=t.data.morphAttributes;if(h)for(const d in h){const e=h[d],i=[];for(let r=0,n=e.length;r<n;r++){const n=e[r];let o;if(n.isInterleavedBufferAttribute){const e=s(t.data,n.data);o=new Zo(e,n.itemSize,n.offset,n.normalized)}else{const t=Bs(n.type,n.array);o=new Wn(t,n.itemSize,n.normalized)}void 0!==n.name&&(o.name=n.name),i.push(o)}n.morphAttributes[d]=i}const c=t.data.morphTargetsRelative;c&&(n.morphTargetsRelative=!0);const u=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==u)for(let d=0,p=u.length;d!==p;++d){const t=u[d];n.addGroup(t.start,t.count,t.materialIndex)}const l=t.data.boundingSphere;if(void 0!==l){const t=new or;void 0!==l.center&&t.fromArray(l.center),n.boundingSphere=new zr(t,l.radius)}return t.name&&(n.name=t.name),t.userData&&(n.userData=t.userData),n}}class Hl extends ul{constructor(t){super(t)}load(t,e,i,s){const r=this,n=""===this.path?Ul.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const o=new pl(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(i){let n=null;try{n=JSON.parse(i)}catch(a){return void 0!==s&&s(a),void console.error("THREE:ObjectLoader: Can't parse "+t+".",a.message)}const o=n.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==s&&s(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);r.parse(n,e)},i,s)}loadAsync(t,e){return p(this,null,function*(){const i=this,s=""===this.path?Ul.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const r=new pl(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const n=yield r.loadAsync(t,e),o=JSON.parse(n),a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return yield i.parseAsync(o)})}parse(t,e){const i=this.parseAnimations(t.animations),s=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,s),n=this.parseImages(t.images,function(){void 0!==e&&e(h)}),o=this.parseTextures(t.textures,n),a=this.parseMaterials(t.materials,o),h=this.parseObject(t.object,r,a,o,i),c=this.parseSkeletons(t.skeletons,h);if(this.bindSkeletons(h,c),this.bindLightTargets(h),void 0!==e){let t=!1;for(const e in n)if(n[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(h)}return h}parseAsync(t){return p(this,null,function*(){const e=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,i),r=yield this.parseImagesAsync(t.images),n=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,n),a=this.parseObject(t.object,s,o,n,e),h=this.parseSkeletons(t.skeletons,a);return this.bindSkeletons(a,h),this.bindLightTargets(a),a})}parseShapes(t){const e={};if(void 0!==t)for(let i=0,s=t.length;i<s;i++){const s=(new Ac).fromJSON(t[i]);e[s.uuid]=s}return e}parseSkeletons(t,e){const i={},s={};if(e.traverse(function(t){t.isBone&&(s[t.uuid]=t)}),void 0!==t)for(let r=0,n=t.length;r<n;r++){const e=(new Ca).fromJSON(t[r],s);i[e.uuid]=e}return i}parseGeometries(t,e){const i={};if(void 0!==t){const s=new Dl;for(let r=0,n=t.length;r<n;r++){let n;const o=t[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":n=s.parse(o);break;default:o.type in Au?n=Au[o.type].fromJSON(o,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}n.uuid=o.uuid,void 0!==o.name&&(n.name=o.name),void 0!==o.userData&&(n.userData=o.userData),i[o.uuid]=n}}return i}parseMaterials(t,e){const i={},s={};if(void 0!==t){const r=new jl;r.setTextures(e);for(let e=0,n=t.length;e<n;e++){const n=t[e];void 0===i[n.uuid]&&(i[n.uuid]=r.parse(n)),s[n.uuid]=i[n.uuid]}}return s}parseAnimations(t){const e={};if(void 0!==t)for(let i=0;i<t.length;i++){const s=t[i],r=rl.parse(s);e[r.uuid]=r}return e}parseImages(t,e){const i=this,s={};let r;function n(t){return i.manager.itemStart(t),r.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemError(t),i.manager.itemEnd(t)})}function o(t){if("string"===typeof t){const e=t,s=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e;return n(s)}return t.data?{data:Bs(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const i=new hl(e);r=new yl(i),r.setCrossOrigin(this.crossOrigin);for(let e=0,r=t.length;e<r;e++){const i=t[e],r=i.url;if(Array.isArray(r)){const t=[];for(let e=0,i=r.length;e<i;e++){const i=r[e],s=o(i);null!==s&&(s instanceof HTMLImageElement?t.push(s):t.push(new Aa(s.data,s.width,s.height)))}s[i.uuid]=new Zs(t)}else{const t=o(i.url);s[i.uuid]=new Zs(t)}}}return s}parseImagesAsync(t){return p(this,null,function*(){const e=this,i={};let s;function r(t){return p(this,null,function*(){if("string"===typeof t){const i=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(i)?i:e.resourcePath+i;return yield s.loadAsync(r)}return t.data?{data:Bs(t.type,t.data),width:t.width,height:t.height}:null})}if(void 0!==t&&t.length>0){s=new yl(this.manager),s.setCrossOrigin(this.crossOrigin);for(let e=0,s=t.length;e<s;e++){const s=t[e],n=s.url;if(Array.isArray(n)){const t=[];for(let e=0,i=n.length;e<i;e++){const i=n[e],s=yield r(i);null!==s&&(s instanceof HTMLImageElement?t.push(s):t.push(new Aa(s.data,s.width,s.height)))}i[s.uuid]=new Zs(t)}else{const t=yield r(s.url);i[s.uuid]=new Zs(t)}}}return i})}parseTextures(t,e){function i(t,e){return"number"===typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const s={};if(void 0!==t)for(let r=0,n=t.length;r<n;r++){const n=t[r];void 0===n.image&&console.warn('THREE.ObjectLoader: No "image" specified for',n.uuid),void 0===e[n.image]&&console.warn("THREE.ObjectLoader: Undefined image",n.image);const o=e[n.image],a=o.data;let h;Array.isArray(a)?(h=new Vo,6===a.length&&(h.needsUpdate=!0)):(h=a&&a.data?new Aa:new $s,a&&(h.needsUpdate=!0)),h.source=o,h.uuid=n.uuid,void 0!==n.name&&(h.name=n.name),void 0!==n.mapping&&(h.mapping=i(n.mapping,ql)),void 0!==n.channel&&(h.channel=n.channel),void 0!==n.offset&&h.offset.fromArray(n.offset),void 0!==n.repeat&&h.repeat.fromArray(n.repeat),void 0!==n.center&&h.center.fromArray(n.center),void 0!==n.rotation&&(h.rotation=n.rotation),void 0!==n.wrap&&(h.wrapS=i(n.wrap[0],Jl),h.wrapT=i(n.wrap[1],Jl)),void 0!==n.format&&(h.format=n.format),void 0!==n.internalFormat&&(h.internalFormat=n.internalFormat),void 0!==n.type&&(h.type=n.type),void 0!==n.colorSpace&&(h.colorSpace=n.colorSpace),void 0!==n.minFilter&&(h.minFilter=i(n.minFilter,Xl)),void 0!==n.magFilter&&(h.magFilter=i(n.magFilter,Xl)),void 0!==n.anisotropy&&(h.anisotropy=n.anisotropy),void 0!==n.flipY&&(h.flipY=n.flipY),void 0!==n.generateMipmaps&&(h.generateMipmaps=n.generateMipmaps),void 0!==n.premultiplyAlpha&&(h.premultiplyAlpha=n.premultiplyAlpha),void 0!==n.unpackAlignment&&(h.unpackAlignment=n.unpackAlignment),void 0!==n.compareFunction&&(h.compareFunction=n.compareFunction),void 0!==n.userData&&(h.userData=n.userData),s[n.uuid]=h}return s}parseObject(t,e,i,s,r){let n,o,a;function h(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];void 0===i[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(i[r])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}function u(t){return void 0===s[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),s[t]}switch(t.type){case"Scene":n=new qo,void 0!==t.background&&(Number.isInteger(t.background)?n.background=new In(t.background):n.background=u(t.background)),void 0!==t.environment&&(n.environment=u(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?n.fog=new Ho(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(n.fog=new Do(t.fog.color,t.fog.density)),""!==t.fog.name&&(n.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(n.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(n.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&n.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(n.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&n.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":n=new Eo(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(n.focus=t.focus),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.filmGauge&&(n.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(n.filmOffset=t.filmOffset),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"OrthographicCamera":n=new Pl(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"AmbientLight":n=new Fl(t.color,t.intensity);break;case"DirectionalLight":n=new Ol(t.color,t.intensity),n.target=t.target||"";break;case"PointLight":n=new Rl(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":n=new Nl(t.color,t.intensity,t.width,t.height);break;case"SpotLight":n=new zl(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),n.target=t.target||"";break;case"HemisphereLight":n=new wl(t.color,t.groundColor,t.intensity);break;case"LightProbe":n=(new Ll).fromJSON(t);break;case"SkinnedMesh":o=h(t.geometry),a=c(t.material),n=new Sa(o,a),void 0!==t.bindMode&&(n.bindMode=t.bindMode),void 0!==t.bindMatrix&&n.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(n.skeleton=t.skeleton);break;case"Mesh":o=h(t.geometry),a=c(t.material),n=new xo(o,a);break;case"InstancedMesh":o=h(t.geometry),a=c(t.material);const e=t.count,i=t.instanceMatrix,s=t.instanceColor;n=new Na(o,a,e),n.instanceMatrix=new Ia(new Float32Array(i.array),16),void 0!==s&&(n.instanceColor=new Ia(new Float32Array(s.array),s.itemSize));break;case"BatchedMesh":o=h(t.geometry),a=c(t.material),n=new hh(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,a),n.geometry=o,n.perObjectFrustumCulled=t.perObjectFrustumCulled,n.sortObjects=t.sortObjects,n._drawRanges=t.drawRanges,n._reservedRanges=t.reservedRanges,n._visibility=t.visibility,n._active=t.active,n._bounds=t.bounds.map(t=>{const e=new cr;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const i=new zr;return i.radius=t.sphereRadius,i.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:i}}),n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._geometryCount=t.geometryCount,n._matricesTexture=u(t.matricesTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=u(t.colorsTexture.uuid));break;case"LOD":n=new pa;break;case"Line":n=new gh(h(t.geometry),c(t.material));break;case"LineLoop":n=new Mh(h(t.geometry),c(t.material));break;case"LineSegments":n=new wh(h(t.geometry),c(t.material));break;case"PointCloud":case"Points":n=new Ch(h(t.geometry),c(t.material));break;case"Sprite":n=new ca(c(t.material));break;case"Group":n=new jo;break;case"Bone":n=new _a;break;default:n=new un}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){const o=t.children;for(let t=0;t<o.length;t++)n.add(this.parseObject(o[t],e,i,s,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const i=e[t];n.animations.push(r[i])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(n.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const i=e[t],s=n.getObjectByProperty("uuid",i.object);void 0!==s&&n.addLevel(s,i.distance,i.hysteresis)}}return n}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse(function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const i=e[t.skeleton];void 0===i?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(i,t.bindMatrix)}})}bindLightTargets(t){t.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){const i=e.target,s=t.getObjectByProperty("uuid",i);e.target=void 0!==s?s:new un}})}}const ql={UVMapping:wt,CubeReflectionMapping:Mt,CubeRefractionMapping:St,EquirectangularReflectionMapping:_t,EquirectangularRefractionMapping:At,CubeUVReflectionMapping:Tt},Jl={RepeatWrapping:zt,ClampToEdgeWrapping:Ct,MirroredRepeatWrapping:It},Xl={NearestFilter:kt,NearestMipmapNearestFilter:Bt,NearestMipmapLinearFilter:Pt,LinearFilter:Ot,LinearMipmapNearestFilter:Ft,LinearMipmapLinearFilter:Vt};class Zl extends ul{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,s){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,n=al.get(t);if(void 0!==n)return r.manager.itemStart(t),n.then?void n.then(i=>{e&&e(i),r.manager.itemEnd(t)}).catch(t=>{s&&s(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const a=fetch(t,o).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return al.add(t,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),al.remove(t),r.manager.itemError(t),r.manager.itemEnd(t)});al.add(t,a),r.manager.itemStart(t)}}let Yl;class Gl{static getContext(){return void 0===Yl&&(Yl=new(window.AudioContext||window.webkitAudioContext)),Yl}static setContext(t){Yl=t}}class $l extends ul{constructor(t){super(t)}load(t,e,i,s){const r=this,n=new pl(this.manager);function o(e){s?s(e):console.error(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{const i=t.slice(0),s=Gl.getContext();s.decodeAudioData(i,function(t){e(t)}).catch(o)}catch(i){o(i)}},i,s)}}const Ql=new Fr,Kl=new Fr,td=new Fr;class ed{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Eo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Eo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache,i=e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep;if(i){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,td.copy(t.projectionMatrix);const i=e.eyeSep/2,s=i*e.near/e.focus,r=e.near*Math.tan(es*e.fov*.5)/e.zoom;let n,o;Kl.elements[12]=-i,Ql.elements[12]=i,n=-r*e.aspect+s,o=r*e.aspect+s,td.elements[0]=2*e.near/(o-n),td.elements[8]=(o+n)/(o-n),this.cameraL.projectionMatrix.copy(td),n=-r*e.aspect-s,o=r*e.aspect-s,td.elements[0]=2*e.near/(o-n),td.elements[8]=(o+n)/(o-n),this.cameraR.projectionMatrix.copy(td)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Kl),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Ql)}}class id extends Eo{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t,this.index=0}}class sd{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=rd(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=rd();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function rd(){return performance.now()}const nd=new or,od=new nr,ad=new or,hd=new or;class cd extends un{constructor(){super(),this.type="AudioListener",this.context=Gl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new sd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(nd,od,ad),hd.set(0,0,-1).applyQuaternion(od),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(nd.x,t),e.positionY.linearRampToValueAtTime(nd.y,t),e.positionZ.linearRampToValueAtTime(nd.z,t),e.forwardX.linearRampToValueAtTime(hd.x,t),e.forwardY.linearRampToValueAtTime(hd.y,t),e.forwardZ.linearRampToValueAtTime(hd.z,t),e.upX.linearRampToValueAtTime(i.x,t),e.upY.linearRampToValueAtTime(i.y,t),e.upZ.linearRampToValueAtTime(i.z,t)}else e.setPosition(nd.x,nd.y,nd.z),e.setOrientation(hd.x,hd.y,hd.z,i.x,i.y,i.z)}}class ud extends un{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(t=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),"buffer"!==t.sourceType?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}}const ld=new or,dd=new nr,pd=new or,md=new or;class fd extends ud{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(ld,dd,pd),md.set(0,0,1).applyQuaternion(dd);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(ld.x,t),e.positionY.linearRampToValueAtTime(ld.y,t),e.positionZ.linearRampToValueAtTime(ld.z,t),e.orientationX.linearRampToValueAtTime(md.x,t),e.orientationY.linearRampToValueAtTime(md.y,t),e.orientationZ.linearRampToValueAtTime(md.z,t)}else e.setPosition(ld.x,ld.y,ld.z),e.setOrientation(md.x,md.y,md.z)}}class yd{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}}class gd{constructor(t,e,i){let s,r,n;switch(this.binding=t,this.valueSize=i,e){case"quaternion":s=this._slerp,r=this._slerpAdditive,n=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":s=this._select,r=this._select,n=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:s=this._lerp,r=this._lerpAdditive,n=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=r,this._setIdentity=n,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,s=this.valueSize,r=t*s+s;let n=this.cumulativeWeight;if(0===n){for(let t=0;t!==s;++t)i[r+t]=i[t];n=e}else{n+=e;const t=e/n;this._mixBufferRegion(i,r,0,t,s)}this.cumulativeWeight=n}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,s=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,s,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,s=t*e+e,r=this.cumulativeWeight,n=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(i,s,t,1-r,e)}n>0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let a=e,h=e+e;a!==h;++a)if(i[a]!==i[a+e]){o.setValue(i,s);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let r=i,n=s;r!==n;++r)e[r]=e[s+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,s,r){if(s>=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,s){nr.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){const n=this._workIndex*r;nr.multiplyQuaternionsFlat(t,n,t,e,t,i),nr.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){const n=1-s;for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]*n+t[i+o]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){const r=e+n;t[r]=t[r]+t[i+n]*s}}}const xd="\\[\\]\\.:\\/",bd=new RegExp("["+xd+"]","g"),vd="[^"+xd+"]",wd="[^"+xd.replace("\\.","")+"]",Md=/((?:WC+[\/:])*)/.source.replace("WC",vd),Sd=/(WCOD+)?/.source.replace("WCOD",wd),_d=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",vd),Ad=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",vd),Td=new RegExp("^"+Md+Sd+_d+Ad+"$"),zd=["material","materials","bones","map"];class Cd{constructor(t,e,i){const s=i||Id.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];void 0!==s&&s.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}class Id{constructor(t,e,i){this.path=e,this.parsedPath=i||Id.parseTrackName(e),this.node=Id.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new Id.Composite(t,e,i):new Id(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(bd,"")}static parseTrackName(t){const e=Td.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){const t=i.nodeName.substring(s+1);-1!==zd.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let s=0;s<t.length;s++){const r=t[s];if(r.name===e||r.uuid===e)return r;const n=i(r.children);if(n)return n}return null},s=i(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)t[e++]=i[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,s=e.propertyName;let r=e.propertyIndex;if(t||(t=Id.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(i){let s=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===s){s=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==s){if(void 0===t[s])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[s]}}const n=t[s];if(void 0===n){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+s+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?o=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===s){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=r}else void 0!==n.fromArray&&void 0!==n.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(a=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=s;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Id.Composite=Cd,Id.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Id.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Id.prototype.GetterByBindingType=[Id.prototype._getValue_direct,Id.prototype._getValue_array,Id.prototype._getValue_arrayElement,Id.prototype._getValue_toArray],Id.prototype.SetterByBindingTypeAndVersioning=[[Id.prototype._setValue_direct,Id.prototype._setValue_direct_setNeedsUpdate,Id.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Id.prototype._setValue_array,Id.prototype._setValue_array_setNeedsUpdate,Id.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Id.prototype._setValue_arrayElement,Id.prototype._setValue_arrayElement_setNeedsUpdate,Id.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Id.prototype._setValue_fromArray,Id.prototype._setValue_fromArray_setNeedsUpdate,Id.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class kd{constructor(){this.isAnimationObjectGroup=!0,this.uuid=ss(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let i=0,s=arguments.length;i!==s;++i)t[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,s=this._parsedPaths,r=this._bindings,n=r.length;let o,a=t.length,h=this.nCachedObjects_;for(let c=0,u=arguments.length;c!==u;++c){const u=arguments[c],l=u.uuid;let d=e[l];if(void 0===d){d=a++,e[l]=d,t.push(u);for(let t=0,e=n;t!==e;++t)r[t].push(new Id(u,i[t],s[t]))}else if(d<h){o=t[d];const a=--h,c=t[a];e[c.uuid]=d,t[d]=c,e[l]=a,t[a]=u;for(let t=0,e=n;t!==e;++t){const e=r[t],n=e[a];let o=e[d];e[d]=n,void 0===o&&(o=new Id(u,i[t],s[t])),e[a]=o}}else t[d]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=h}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length;let r=this.nCachedObjects_;for(let n=0,o=arguments.length;n!==o;++n){const o=arguments[n],a=o.uuid,h=e[a];if(void 0!==h&&h>=r){const n=r++,c=t[n];e[c.uuid]=h,t[h]=c,e[a]=n,t[n]=o;for(let t=0,e=s;t!==e;++t){const e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length;let r=this.nCachedObjects_,n=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o],h=a.uuid,c=e[h];if(void 0!==c)if(delete e[h],c<r){const o=--r,a=t[o],h=--n,u=t[h];e[a.uuid]=c,t[c]=a,e[u.uuid]=o,t[o]=u,t.pop();for(let t=0,e=s;t!==e;++t){const e=i[t],s=e[o],r=e[h];e[c]=s,e[o]=r,e.pop()}}else{const r=--n,o=t[r];r>0&&(e[o.uuid]=c),t[c]=o,t.pop();for(let t=0,e=s;t!==e;++t){const e=i[t];e[c]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let s=i[t];const r=this._bindings;if(void 0!==s)return r[s];const n=this._paths,o=this._parsedPaths,a=this._objects,h=a.length,c=this.nCachedObjects_,u=new Array(h);s=r.length,i[t]=s,n.push(t),o.push(e),r.push(u);for(let l=c,d=a.length;l!==d;++l){const i=a[l];u[l]=new Id(i,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const s=this._paths,r=this._parsedPaths,n=this._bindings,o=n.length-1,a=n[o],h=t[o];e[h]=i,n[i]=a,n.pop(),r[i]=r[o],r.pop(),s[i]=s[o],s.pop()}}}class Bd{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,o=new Array(n),a={endingStart:Ye,endingEnd:Ye};for(let h=0;h!==n;++h){const t=r[h].createInterpolant(null);o[h]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=He,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){const i=this._clip.duration,s=t._clip.duration,r=s/i,n=i/s;t.warp(1,r,e),this.warp(n,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const s=this._mixer,r=s.time,n=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=s._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,h=o.sampleValues;return a[0]=r,a[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);const n=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ke:for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(o);break;case Qe:default:for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){const s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let s=this.time+t,r=this._loopCount;const n=i===qe;if(0===t)return-1===r?s:n&&1===(1&r)?e-s:s;if(i===De){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(s>=e)s=e;else{if(!(s<0)){this.time=s;break t}s=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){const i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(n&&1===(1&r))return e-s}return s}_setEndings(t,e,i){const s=this._interpolantSettings;i?(s.endingStart=Ge,s.endingEnd=Ge):(s.endingStart=t?this.zeroSlopeAtStart?Ge:Ye:$e,s.endingEnd=e?this.zeroSlopeAtEnd?Ge:Ye:$e)}_scheduleFading(t,e,i){const s=this._mixer,r=s.time;let n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);const o=n.parameterPositions,a=n.sampleValues;return o[0]=r,a[0]=e,o[1]=r+t,a[1]=i,this}}const Rd=new Float32Array(1);class Pd extends Qi{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,o=t._interpolants,a=i.uuid,h=this._bindingsByRootAndName;let c=h[a];void 0===c&&(c={},h[a]=c);for(let u=0;u!==r;++u){const t=s[u],r=t.name;let h=c[r];if(void 0!==h)++h.referenceCount,n[u]=h;else{if(h=n[u],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,r));continue}const s=e&&e._propertyBindings[u].binding.parsedPath;h=new gd(Id.create(i,r,s),t.ValueTypeName,t.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,r),n[u]=h}o[u].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const s=this._actions,r=this._actionsByClip;let n=r[e];if(void 0===n)n={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=n;else{const e=n.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=s.length,s.push(t),n.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],s=t._cacheIndex;i._cacheIndex=s,e[s]=i,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,n=this._actionsByClip,o=n[r],a=o.knownActions,h=a[a.length-1],c=t._byClipCacheIndex;h._byClipCacheIndex=c,a[c]=h,a.pop(),t._byClipCacheIndex=null;const u=o.actionByRoot,l=(t._localRoot||this._root).uuid;delete u[l],0===a.length&&delete n[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let i=0,s=e.length;i!==s;++i){const t=e[i];0===--t.referenceCount&&this._removeInactiveBinding(t)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,s=this._nActiveActions++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,s=--this._nActiveActions,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){const s=this._bindingsByRootAndName,r=this._bindings;let n=s[e];void 0===n&&(n={},s[e]=n),n[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,s=i.rootNode.uuid,r=i.path,n=this._bindingsByRootAndName,o=n[s],a=e[e.length-1],h=t._cacheIndex;a._cacheIndex=h,e[h]=a,e.pop(),delete o[r],0===Object.keys(o).length&&delete n[s]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,s=this._nActiveBindings++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,s=--this._nActiveBindings,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new Zu(new Float32Array(2),new Float32Array(2),1,Rd),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,s=--this._nActiveControlInterpolants,r=e[s];t.__cacheIndex=s,e[s]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){const s=e||this._root,r=s.uuid;let n="string"===typeof t?rl.findByName(s,t):t;const o=null!==n?n.uuid:t,a=this._actionsByClip[o];let h=null;if(void 0===i&&(i=null!==n?n.blendMode:Qe),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;h=a.knownActions[0],null===n&&(n=h._clip)}if(null===n)return null;const c=new Bd(this,n,e,i);return this._bindAction(c,h),this._addInactiveAction(c,o,r),c}existingAction(t,e){const i=e||this._root,s=i.uuid,r="string"===typeof t?rl.findByName(i,t):t,n=r?r.uuid:t,o=this._actionsByClip[n];return void 0!==o&&o.actionByRoot[s]||null}stopAllAction(){const t=this._actions,e=this._nActiveActions;for(let i=e-1;i>=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let h=0;h!==i;++h){const i=e[h];i._update(s,t,r,n)}const o=this._bindings,a=this._nActiveBindings;for(let h=0;h!==a;++h)o[h].apply(n);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,s=this._actionsByClip,r=s[i];if(void 0!==r){const t=r.knownActions;for(let i=0,s=t.length;i!==s;++i){const s=t[i];this._deactivateAction(s);const r=s._cacheIndex,n=e[e.length-1];s._cacheIndex=null,s._byClipCacheIndex=null,n._cacheIndex=r,e[r]=n,e.pop(),this._removeInactiveBindingsForAction(s)}delete s[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const n in i){const t=i[n].actionByRoot,s=t[e];void 0!==s&&(this._deactivateAction(s),this._removeInactiveAction(s))}const s=this._bindingsByRootAndName,r=s[e];if(void 0!==r)for(const n in r){const t=r[n];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Ed extends Ks{constructor(t=1,e=1,i=1,s={}){super(t,e,s),this.isRenderTarget3D=!0,this.depth=i,this.texture=new sr(null,t,e,i),this.texture.isRenderTargetTexture=!0}}class Od extends Ks{constructor(t=1,e=1,i=1,s={}){super(t,e,s),this.isRenderTargetArray=!0,this.depth=i,this.texture=new er(null,t,e,i),this.texture.isRenderTargetTexture=!0}}class Fd{constructor(t){this.value=t}clone(){return new Fd(void 0===this.value.clone?this.value:this.value.clone())}}let Nd=0;class Vd extends Qi{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Nd++}),this.name="",this.usage=Vi,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let i=0,s=e.length;i<s;i++){const t=Array.isArray(e[i])?e[i]:[e[i]];for(let e=0;e<t.length;e++)this.uniforms.push(t[e].clone())}return this}clone(){return(new this.constructor).copy(this)}}class Ld extends Jo{constructor(t,e,i=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class jd{constructor(t,e,i,s,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=s,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}const Ud=new Fr;class Wd{constructor(t,e,i=0,s=1/0){this.ray=new Or(t,e),this.near=i,this.far=s,this.camera=null,this.layers=new Xr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Ud.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Ud),this}intersectObject(t,e=!0,i=[]){return Hd(t,this,i,e),i.sort(Dd),i}intersectObjects(t,e=!0,i=[]){for(let s=0,r=t.length;s<r;s++)Hd(t[s],this,i,e);return i.sort(Dd),i}}function Dd(t,e){return t.distance-e.distance}function Hd(t,e,i,s){let r=!0;if(t.layers.test(e.layers)){const s=t.raycast(e,i);!1===s&&(r=!1)}if(!0===r&&!0===s){const s=t.children;for(let t=0,r=s.length;t<r;t++)Hd(s[t],e,i,!0)}}class qd{constructor(t=1,e=0,i=0){this.radius=t,this.phi=e,this.theta=i}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=rs(this.phi,t,Math.PI-t),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(rs(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Jd{constructor(t=1,e=0,i=0){this.radius=t,this.theta=e,this.y=i}set(t,e,i){return this.radius=t,this.theta=e,this.y=i,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+i*i),this.theta=Math.atan2(t,i),this.y=e,this}clone(){return(new this.constructor).copy(this)}}class Xd{constructor(t,e,i,s){Xd.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==t&&this.set(t,e,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let i=0;i<4;i++)this.elements[i]=t[i+e];return this}set(t,e,i,s){const r=this.elements;return r[0]=t,r[2]=e,r[1]=i,r[3]=s,this}}const Zd=new Ts;class Yd{constructor(t=new Ts(1/0,1/0),e=new Ts(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Zd.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Zd).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Gd=new or,$d=new or;class Qd{constructor(t=new or,e=new or){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Gd.subVectors(t,this.start),$d.subVectors(this.end,this.start);const i=$d.dot($d),s=$d.dot(Gd);let r=s/i;return e&&(r=rs(r,0,1)),r}closestPointToPoint(t,e,i){const s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Kd=new or;class tp extends un{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new no,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let n=0,o=1,a=32;n<a;n++,o++){const t=n/a*Math.PI*2,e=o/a*Math.PI*2;s.push(Math.cos(t),Math.sin(t),1,Math.cos(e),Math.sin(e),1)}i.setAttribute("position",new $n(s,3));const r=new ch({fog:!1,toneMapped:!1});this.cone=new wh(i,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Kd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Kd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const ep=new or,ip=new Fr,sp=new Fr;class rp extends wh{constructor(t){const e=np(t),i=new no,s=[],r=[],n=new In(0,0,1),o=new In(0,1,0);for(let h=0;h<e.length;h++){const t=e[h];t.parent&&t.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),r.push(n.r,n.g,n.b),r.push(o.r,o.g,o.b))}i.setAttribute("position",new $n(s,3)),i.setAttribute("color",new $n(r,3));const a=new ch({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,s=i.getAttribute("position");sp.copy(this.root.matrixWorld).invert();for(let r=0,n=0;r<e.length;r++){const t=e[r];t.parent&&t.parent.isBone&&(ip.multiplyMatrices(sp,t.matrixWorld),ep.setFromMatrixPosition(ip),s.setXYZ(n,ep.x,ep.y,ep.z),ip.multiplyMatrices(sp,t.parent.matrixWorld),ep.setFromMatrixPosition(ip),s.setXYZ(n+1,ep.x,ep.y,ep.z),n+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}}function np(t){const e=[];!0===t.isBone&&e.push(t);for(let i=0;i<t.children.length;i++)e.push(...np(t.children[i]));return e}class op extends xo{constructor(t,e,i){const s=new xu(e,4,2),r=new Pn({wireframe:!0,fog:!1,toneMapped:!1});super(s,r),this.light=t,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const ap=new or,hp=new In,cp=new In;class up extends un{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const s=new pu(e);s.rotateY(.5*Math.PI),this.material=new Pn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=s.getAttribute("position"),n=new Float32Array(3*r.count);s.setAttribute("color",new Wn(n,3)),this.add(new xo(s,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");hp.copy(this.light.color),cp.copy(this.light.groundColor);for(let t=0,i=e.count;t<i;t++){const s=t<i/2?hp:cp;e.setXYZ(t,s.r,s.g,s.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(ap.setFromMatrixPosition(this.light.matrixWorld).negate())}}class lp extends wh{constructor(t=10,e=10,i=4473924,s=8947848){i=new In(i),s=new In(s);const r=e/2,n=t/e,o=t/2,a=[],h=[];for(let l=0,d=0,p=-o;l<=e;l++,p+=n){a.push(-o,0,p,o,0,p),a.push(p,0,-o,p,0,o);const t=l===r?i:s;t.toArray(h,d),d+=3,t.toArray(h,d),d+=3,t.toArray(h,d),d+=3,t.toArray(h,d),d+=3}const c=new no;c.setAttribute("position",new $n(a,3)),c.setAttribute("color",new $n(h,3));const u=new ch({vertexColors:!0,toneMapped:!1});super(c,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class dp extends wh{constructor(t=10,e=16,i=8,s=64,r=4473924,n=8947848){r=new In(r),n=new In(n);const o=[],a=[];if(e>1)for(let u=0;u<e;u++){const i=u/e*(2*Math.PI),s=Math.sin(i)*t,h=Math.cos(i)*t;o.push(0,0,0),o.push(s,0,h);const c=1&u?r:n;a.push(c.r,c.g,c.b),a.push(c.r,c.g,c.b)}for(let u=0;u<i;u++){const e=1&u?r:n,h=t-t/i*u;for(let t=0;t<s;t++){let i=t/s*(2*Math.PI),r=Math.sin(i)*h,n=Math.cos(i)*h;o.push(r,0,n),a.push(e.r,e.g,e.b),i=(t+1)/s*(2*Math.PI),r=Math.sin(i)*h,n=Math.cos(i)*h,o.push(r,0,n),a.push(e.r,e.g,e.b)}}const h=new no;h.setAttribute("position",new $n(o,3)),h.setAttribute("color",new $n(a,3));const c=new ch({vertexColors:!0,toneMapped:!1});super(h,c),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const pp=new or,mp=new or,fp=new or;class yp extends un{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===e&&(e=1);let s=new no;s.setAttribute("position",new $n([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new ch({fog:!1,toneMapped:!1});this.lightPlane=new gh(s,r),this.add(this.lightPlane),s=new no,s.setAttribute("position",new $n([0,0,0,0,0,1],3)),this.targetLine=new gh(s,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),pp.setFromMatrixPosition(this.light.matrixWorld),mp.setFromMatrixPosition(this.light.target.matrixWorld),fp.subVectors(mp,pp),this.lightPlane.lookAt(mp),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(mp),this.targetLine.scale.z=fp.length()}}const gp=new or,xp=new ko;class bp extends wh{constructor(t){const e=new no,i=new ch({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],r=[],n={};function o(t,e){a(t),a(e)}function a(t){s.push(0,0,0),r.push(0,0,0),void 0===n[t]&&(n[t]=[]),n[t].push(s.length/3-1)}o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4"),e.setAttribute("position",new $n(s,3)),e.setAttribute("color",new $n(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=n,this.update();const h=new In(16755200),c=new In(16711680),u=new In(43775),l=new In(16777215),d=new In(3355443);this.setColors(h,c,u,l,d)}setColors(t,e,i,s,r){const n=this.geometry,o=n.getAttribute("color");o.setXYZ(0,t.r,t.g,t.b),o.setXYZ(1,t.r,t.g,t.b),o.setXYZ(2,t.r,t.g,t.b),o.setXYZ(3,t.r,t.g,t.b),o.setXYZ(4,t.r,t.g,t.b),o.setXYZ(5,t.r,t.g,t.b),o.setXYZ(6,t.r,t.g,t.b),o.setXYZ(7,t.r,t.g,t.b),o.setXYZ(8,t.r,t.g,t.b),o.setXYZ(9,t.r,t.g,t.b),o.setXYZ(10,t.r,t.g,t.b),o.setXYZ(11,t.r,t.g,t.b),o.setXYZ(12,t.r,t.g,t.b),o.setXYZ(13,t.r,t.g,t.b),o.setXYZ(14,t.r,t.g,t.b),o.setXYZ(15,t.r,t.g,t.b),o.setXYZ(16,t.r,t.g,t.b),o.setXYZ(17,t.r,t.g,t.b),o.setXYZ(18,t.r,t.g,t.b),o.setXYZ(19,t.r,t.g,t.b),o.setXYZ(20,t.r,t.g,t.b),o.setXYZ(21,t.r,t.g,t.b),o.setXYZ(22,t.r,t.g,t.b),o.setXYZ(23,t.r,t.g,t.b),o.setXYZ(24,e.r,e.g,e.b),o.setXYZ(25,e.r,e.g,e.b),o.setXYZ(26,e.r,e.g,e.b),o.setXYZ(27,e.r,e.g,e.b),o.setXYZ(28,e.r,e.g,e.b),o.setXYZ(29,e.r,e.g,e.b),o.setXYZ(30,e.r,e.g,e.b),o.setXYZ(31,e.r,e.g,e.b),o.setXYZ(32,i.r,i.g,i.b),o.setXYZ(33,i.r,i.g,i.b),o.setXYZ(34,i.r,i.g,i.b),o.setXYZ(35,i.r,i.g,i.b),o.setXYZ(36,i.r,i.g,i.b),o.setXYZ(37,i.r,i.g,i.b),o.setXYZ(38,s.r,s.g,s.b),o.setXYZ(39,s.r,s.g,s.b),o.setXYZ(40,r.r,r.g,r.b),o.setXYZ(41,r.r,r.g,r.b),o.setXYZ(42,r.r,r.g,r.b),o.setXYZ(43,r.r,r.g,r.b),o.setXYZ(44,r.r,r.g,r.b),o.setXYZ(45,r.r,r.g,r.b),o.setXYZ(46,r.r,r.g,r.b),o.setXYZ(47,r.r,r.g,r.b),o.setXYZ(48,r.r,r.g,r.b),o.setXYZ(49,r.r,r.g,r.b),o.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap,i=1,s=1;xp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const r=this.camera.coordinateSystem===Yi?-1:0;vp("c",e,t,xp,0,0,r),vp("t",e,t,xp,0,0,1),vp("n1",e,t,xp,-1,-1,r),vp("n2",e,t,xp,i,-1,r),vp("n3",e,t,xp,-1,s,r),vp("n4",e,t,xp,i,s,r),vp("f1",e,t,xp,-1,-1,1),vp("f2",e,t,xp,i,-1,1),vp("f3",e,t,xp,-1,s,1),vp("f4",e,t,xp,i,s,1),vp("u1",e,t,xp,.7*i,1.1*s,r),vp("u2",e,t,xp,-.7,1.1*s,r),vp("u3",e,t,xp,0,2*s,r),vp("cf1",e,t,xp,-1,0,1),vp("cf2",e,t,xp,i,0,1),vp("cf3",e,t,xp,0,-1,1),vp("cf4",e,t,xp,0,s,1),vp("cn1",e,t,xp,-1,0,r),vp("cn2",e,t,xp,i,0,r),vp("cn3",e,t,xp,0,-1,r),vp("cn4",e,t,xp,0,s,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function vp(t,e,i,s,r,n,o){gp.set(r,n,o).unproject(s);const a=e[t];if(void 0!==a){const t=i.getAttribute("position");for(let e=0,i=a.length;e<i;e++)t.setXYZ(a[e],gp.x,gp.y,gp.z)}}const wp=new cr;class Mp extends wh{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=new Float32Array(24),r=new no;r.setIndex(new Wn(i,1)),r.setAttribute("position",new Wn(s,3)),super(r,new ch({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&wp.setFromObject(this.object),wp.isEmpty())return;const t=wp.min,e=wp.max,i=this.geometry.attributes.position,s=i.array;s[0]=e.x,s[1]=e.y,s[2]=e.z,s[3]=t.x,s[4]=e.y,s[5]=e.z,s[6]=t.x,s[7]=t.y,s[8]=e.z,s[9]=e.x,s[10]=t.y,s[11]=e.z,s[12]=e.x,s[13]=e.y,s[14]=t.z,s[15]=t.x,s[16]=e.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=e.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Sp extends wh{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new no;r.setIndex(new Wn(i,1)),r.setAttribute("position",new $n(s,3)),super(r,new ch({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}class _p extends gh{constructor(t,e=1,i=16776960){const s=i,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],n=new no;n.setAttribute("position",new $n(r,3)),n.computeBoundingSphere(),super(n,new ch({color:s,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],a=new no;a.setAttribute("position",new $n(o,3)),a.computeBoundingSphere(),this.add(new xo(a,new Pn({color:s,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Ap=new or;let Tp,zp;class Cp extends un{constructor(t=new or(0,0,1),e=new or(0,0,0),i=1,s=16776960,r=.2*i,n=.2*r){super(),this.type="ArrowHelper",void 0===Tp&&(Tp=new no,Tp.setAttribute("position",new $n([0,0,0,0,1,0],3)),zp=new yc(0,.5,1,5,1),zp.translate(0,-.5,0)),this.position.copy(e),this.line=new gh(Tp,new ch({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new xo(zp,new Pn({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,n)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Ap.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Ap,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Ip extends wh{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new no;s.setAttribute("position",new $n(e,3)),s.setAttribute("color",new $n(i,3));const r=new ch({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(t,e,i){const s=new In,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class kp{constructor(){this.type="ShapePath",this.color=new In,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new dc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=t[i],r=new Ac;r.curves=s.curves,e.push(r)}return e}function i(t,e){const i=e.length;let s=!1;for(let r=i-1,n=0;n<i;r=n++){let i=e[r],o=e[n],a=o.x-i.x,h=o.y-i.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(i=e[n],a=-a,o=e[r],h=-h),t.y<i.y||t.y>o.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-a*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(o.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=o.x)return!0}}return s}const s=ou.isClockWise,r=this.subPaths;if(0===r.length)return[];let n,o,a;const h=[];if(1===r.length)return o=r[0],a=new Ac,a.curves=o.curves,h.push(a),h;let c=!s(r[0].getPoints());c=t?!c:c;const u=[],l=[];let d,p,m=[],f=0;l[f]=void 0,m[f]=[];for(let y=0,g=r.length;y<g;y++)o=r[y],d=o.getPoints(),n=s(d),n=t?!n:n,n?(!c&&l[f]&&f++,l[f]={s:new Ac,p:d},l[f].s.curves=o.curves,c&&f++,m[f]=[]):m[f].push({h:o,p:d[0]});if(!l[0])return e(r);if(l.length>1){let t=!1,e=0;for(let i=0,s=l.length;i<s;i++)u[i]=[];for(let s=0,r=l.length;s<r;s++){const r=m[s];for(let n=0;n<r.length;n++){const o=r[n];let a=!0;for(let r=0;r<l.length;r++)i(o.p,l[r].p)&&(s!==r&&e++,a?(a=!1,u[r].push(o)):t=!0);a&&u[s].push(o)}}e>0&&!1===t&&(m=u)}for(let y=0,g=l.length;y<g;y++){a=l[y].s,h.push(a),p=m[y];for(let t=0,e=p.length;t<e;t++)a.holes.push(p[t].h)}return h}}class Bp extends Qi{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){void 0!==t?(null!==this.domElement&&this.disconnect(),this.domElement=t):console.warn("THREE.Controls: connect() now requires an element.")}disconnect(){}dispose(){}update(){}}function Rp(t,e){const i=t.image&&t.image.width?t.image.width/t.image.height:1;return i>e?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}function Pp(t,e){const i=t.image&&t.image.width?t.image.width/t.image.height:1;return i>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}function Ep(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function Op(t,e,i,s){const r=Fp(s);switch(i){case Qt:return t*e;case ee:return t*e;case ie:return t*e*2;case ne:return t*e/r.components*r.byteLength;case oe:return t*e/r.components*r.byteLength;case ae:return t*e*2/r.components*r.byteLength;case he:return t*e*2/r.components*r.byteLength;case Kt:return t*e*3/r.components*r.byteLength;case te:return t*e*4/r.components*r.byteLength;case ue:return t*e*4/r.components*r.byteLength;case le:case de:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case pe:case me:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case ye:case xe:return Math.max(t,16)*Math.max(e,8)/4;case fe:case ge:return Math.max(t,8)*Math.max(e,8)/2;case be:case ve:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case we:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Me:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Se:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case _e:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Ae:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case Te:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case ze:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case Ce:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Ie:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case ke:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Be:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Re:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Pe:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case Ee:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case Oe:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Fe:case Ne:case Ve:return Math.ceil(t/4)*Math.ceil(e/4)*16;case Le:case je:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Ue:case We:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${i} format.`)}function Fp(t){switch(t){case jt:case Ut:return{byteLength:1,components:1};case Dt:case Wt:case Xt:return{byteLength:2,components:1};case Zt:case Yt:return{byteLength:2,components:4};case qt:case Ht:case Jt:return{byteLength:4,components:1};case $t:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class Np{static contain(t,e){return Rp(t,e)}static cover(t,e){return Pp(t,e)}static fill(t){return Ep(t)}static getByteLength(t,e,i,s){return Op(t,e,i,s)}}"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:m}})),"undefined"!==typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=m)}}]);
|