tokentracker-cli 0.74.0 → 0.74.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dashboard/dist/assets/{ActivityHeatmap-DkoSqxrd.js → ActivityHeatmap-DGqoFvkZ.js} +1 -1
  2. package/dashboard/dist/assets/{Card-DleS-r54.js → Card-CKxmfosU.js} +1 -1
  3. package/dashboard/dist/assets/{CommunityStatsModal-DV41-F9D.js → CommunityStatsModal-C6h6BKVI.js} +1 -1
  4. package/dashboard/dist/assets/{ConfirmModal-Dgp07Uka.js → ConfirmModal-wqW-7Vs_.js} +1 -1
  5. package/dashboard/dist/assets/{DashboardPage-EKy2BzUx.js → DashboardPage-10hyXbuM.js} +1 -1
  6. package/dashboard/dist/assets/{DevicePage-eJInQ2UX.js → DevicePage-DosHEknI.js} +1 -1
  7. package/dashboard/dist/assets/{DialogClose-DEfesqFq.js → DialogClose-CRzzOKwV.js} +1 -1
  8. package/dashboard/dist/assets/DialogDescription-DuiVFMP6.js +1 -0
  9. package/dashboard/dist/assets/{DialogTitle-v1JrTvr4.js → DialogTitle-CgVdc49w.js} +1 -1
  10. package/dashboard/dist/assets/{FadeIn-hqIBbKaJ.js → FadeIn-CVkirQtu.js} +1 -1
  11. package/dashboard/dist/assets/{HeaderGithubStar-C4zauuP2.js → HeaderGithubStar-DHW75YEC.js} +1 -1
  12. package/dashboard/dist/assets/{IpCheckPage-CiRcccks.js → IpCheckPage-CMOjeIuH.js} +1 -1
  13. package/dashboard/dist/assets/{LandingPage-CbOHycnd.js → LandingPage-Cca1heHL.js} +97 -37
  14. package/dashboard/dist/assets/{LeaderboardAvatar-CQL1iOTS.js → LeaderboardAvatar-CVMcytB1.js} +1 -1
  15. package/dashboard/dist/assets/{LeaderboardPage-BuEp247d.js → LeaderboardPage-BEfsEAZY.js} +2 -2
  16. package/dashboard/dist/assets/{LeaderboardProfileModal-DT8hrPkI.js → LeaderboardProfileModal-5LuPOMoM.js} +1 -1
  17. package/dashboard/dist/assets/{LeaderboardProfilePage-B-M0AXMb.js → LeaderboardProfilePage-DUQOF16T.js} +1 -1
  18. package/dashboard/dist/assets/{LimitsPage-Df2es3Xs.js → LimitsPage-C6cPHrnU.js} +4 -4
  19. package/dashboard/dist/assets/{LocalOnlyNotice-DJIfKTKo.js → LocalOnlyNotice-B2SjP1L6.js} +1 -1
  20. package/dashboard/dist/assets/{LoginPage-DtaaIy_8.js → LoginPage-D0vP9cX4.js} +1 -1
  21. package/dashboard/dist/assets/{PopoverPopup-CqWH6aB9.js → PopoverPopup-AtVz9OM2.js} +1 -1
  22. package/dashboard/dist/assets/{ResetPasswordPage-DCH5GU1c.js → ResetPasswordPage-6eUhDnAl.js} +1 -1
  23. package/dashboard/dist/assets/{Select-BwyliVKJ.js → Select-Dt-nyHat.js} +1 -1
  24. package/dashboard/dist/assets/{SelectItemText-B5_DKKEv.js → SelectItemText-CFxs6Ipf.js} +1 -1
  25. package/dashboard/dist/assets/{SettingsPage-BoAFdOUa.js → SettingsPage-Ccv_PRTi.js} +1 -1
  26. package/dashboard/dist/assets/{SkillsPage-BVdre-kF.js → SkillsPage-Ckmq2qWZ.js} +1 -1
  27. package/dashboard/dist/assets/{WidgetsPage-CtjV405P.js → WidgetsPage-CuMpK7JS.js} +1 -1
  28. package/dashboard/dist/assets/{WrappedPage-DGmPdtHt.js → WrappedPage-C3sjJiS5.js} +1 -1
  29. package/dashboard/dist/assets/{agent-logos-DqevdWvx.js → agent-logos-CORiXh7-.js} +1 -1
  30. package/dashboard/dist/assets/{arrow-up-right-DA5Pybq1.js → arrow-up-right-D-CX3rHC.js} +1 -1
  31. package/dashboard/dist/assets/check-frbadzCO.js +1 -0
  32. package/dashboard/dist/assets/{copy-CsQRTd89.js → copy-BbbIDe0D.js} +1 -1
  33. package/dashboard/dist/assets/{download-TEHkAKT0.js → download-CnLKP9Xi.js} +1 -1
  34. package/dashboard/dist/assets/{format-tokens-CtFO_jkz.js → format-tokens-Q8buFewN.js} +1 -1
  35. package/dashboard/dist/assets/{info-Dxn3fiaX.js → info-Bg3JHknV.js} +1 -1
  36. package/dashboard/dist/assets/main--nUrKVF3.css +1 -0
  37. package/dashboard/dist/assets/{main-Dxi4sSXf.js → main-BZBZhXIl.js} +20 -17
  38. package/dashboard/dist/assets/{use-community-stats-BLNxr-bQ.js → use-community-stats-BBUKlTpE.js} +1 -1
  39. package/dashboard/dist/assets/{use-limits-display-prefs-CC7gb303.js → use-limits-display-prefs-Dnl2W8Rt.js} +1 -1
  40. package/dashboard/dist/assets/{use-native-settings-SYtjLlxZ.js → use-native-settings-DlQEd871.js} +1 -1
  41. package/dashboard/dist/assets/{use-ordered-list-_O8onJV7.js → use-ordered-list-4WtaZhJf.js} +1 -1
  42. package/dashboard/dist/assets/{use-quality-per-dollar-pref-tuspH_6n.js → use-quality-per-dollar-pref-CS0EFKxa.js} +1 -1
  43. package/dashboard/dist/assets/{use-usage-limits-whCVzQbf.js → use-usage-limits-CJ25xM-V.js} +1 -1
  44. package/dashboard/dist/assets/{useCurrency-BiDjYxfm.js → useCurrency-CaevR9XR.js} +1 -1
  45. package/dashboard/dist/assets/{useScrollLock-DK-ndHcw.js → useScrollLock-BLGPKPXr.js} +1 -1
  46. package/dashboard/dist/index.html +2 -2
  47. package/dashboard/dist/share.html +2 -2
  48. package/package.json +2 -2
  49. package/src/lib/pricing/seed-snapshot.json +1 -1
  50. package/src/lib/usage-limits.js +24 -0
  51. package/src/lib/zcode-limits.js +251 -15
  52. package/dashboard/dist/assets/DialogDescription-D6txiEc4.js +0 -1
  53. package/dashboard/dist/assets/check-BWzAT1oX.js +0 -1
  54. package/dashboard/dist/assets/main-DXM2UPde.css +0 -1
@@ -1,8 +1,8 @@
1
- import{r as Ve,j as P,$ as Vm,h as Dh,ap as wc,aq as Uf,ar as Ff,as as Hm,a0 as Vu,L as Ns,a2 as Wm,a1 as Xm,at as Ym,au as qm,ac as $m,N as Of,an as Km}from"./main-Dxi4sSXf.js";import{H as Zm}from"./HeaderGithubStar-C4zauuP2.js";import{u as jm}from"./use-community-stats-BLNxr-bQ.js";import{C as Jm}from"./check-BWzAT1oX.js";import{C as Qm}from"./copy-CsQRTd89.js";import{D as eg}from"./download-TEHkAKT0.js";import{A as Bf,L as tg}from"./agent-logos-DqevdWvx.js";import{f as Lh}from"./format-tokens-CtFO_jkz.js";function ng(){if(typeof window>"u")return!1;const r=window.location.hostname;return r==="localhost"||r==="127.0.0.1"||r==="::1"}function kf(){return ng()?"/":"/dashboard"}const ln={accent:"#8a7aff",accentSoft:"#b8b3ff",accentFaint:"rgba(138, 122, 255, 0.16)",accentGhost:"rgba(138, 122, 255, 0.06)",glint:"#fbdfff",bg:"#050507",panel:"#0a0a0d",line:"rgba(138, 122, 255, 0.22)",scrim:"rgba(5, 5, 7, 0.62)",orbSurface:"radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.06) 42%, rgba(255, 255, 255, 0) 55%), radial-gradient(circle at 68% 84%, rgba(138, 122, 255, 0.30), rgba(138, 122, 255, 0) 55%), radial-gradient(circle at 50% 50%, rgba(20, 18, 34, 0.55), rgba(8, 8, 16, 0.82) 78%)",orbShadow:"inset 0 1px 1px rgba(255, 255, 255, 0.30), inset 0 -3px 9px rgba(138, 122, 255, 0.38), inset -5px -7px 14px rgba(0, 0, 0, 0.38), 0 0 30px rgba(138, 122, 255, 0.20), 0 10px 26px rgba(0, 0, 0, 0.5)",orbHighlight:"linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0))",orbGlint:"radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 70%)"},Nl={accent:9075455,accentSoft:12104703,glint:16506879},ig={"--lv3-accent":ln.accent,"--lv3-accent-soft":ln.accentSoft,"--lv3-accent-faint":ln.accentFaint,"--lv3-accent-ghost":ln.accentGhost,"--lv3-glint":ln.glint,"--lv3-bg":ln.bg,"--lv3-panel":ln.panel,"--lv3-line":ln.line,"--lv3-scrim":ln.scrim,"--lv3-orb-surface":ln.orbSurface,"--lv3-orb-shadow":ln.orbShadow,"--lv3-orb-highlight":ln.orbHighlight,"--lv3-orb-glint":ln.orbGlint};function qi(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Nh(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e}var ni={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Ga={duration:.5,overwrite:!1,delay:0},Hu,hn,Lt,pi=1e8,wt=1/pi,Ac=Math.PI*2,rg=Ac/4,sg=0,Ih=Math.sqrt,ag=Math.cos,og=Math.sin,un=function(e){return typeof e=="string"},kt=function(e){return typeof e=="function"},ir=function(e){return typeof e=="number"},Wu=function(e){return typeof e>"u"},zi=function(e){return typeof e=="object"},Bn=function(e){return e!==!1},Xu=function(){return typeof window<"u"},ro=function(e){return kt(e)||un(e)},Uh=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},En=Array.isArray,lg=/random\([^)]+\)/g,cg=/,\s*/g,zf=/(?:-?\.?\d|\.)+/gi,Fh=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Os=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Il=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Oh=/[+-]=-?[.\d]+/,ug=/[^,'"\[\]\s]+/gi,fg=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,It,Ci,Rc,Yu,ii={},al={},Bh,kh=function(e){return(al=Zs(e,ii))&&Wn},qu=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Va=function(e,t){return!t&&console.warn(e)},zh=function(e,t){return e&&(ii[e]=t)&&al&&(al[e]=t)||ii},Ha=function(){return 0},dg={suppressEvents:!0,isStart:!0,kill:!1},Xo={suppressEvents:!0,kill:!1},hg={suppressEvents:!0},$u={},wr=[],Cc={},Gh,Zn={},Ul={},Gf=30,Yo=[],Ku="",Zu=function(e){var t=e[0],n,i;if(zi(t)||kt(t)||(e=[e]),!(n=(t._gsap||{}).harness)){for(i=Yo.length;i--&&!Yo[i].targetTest(t););n=Yo[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new cp(e[i],n)))||e.splice(i,1);return e},jr=function(e){return e._gsap||Zu(mi(e))[0]._gsap},Vh=function(e,t,n){return(n=e[t])&&kt(n)?e[t]():Wu(n)&&e.getAttribute&&e.getAttribute(t)||n},kn=function(e,t){return(e=e.split(",")).forEach(t)||e},Ht=function(e){return Math.round(e*1e5)/1e5||0},Nt=function(e){return Math.round(e*1e7)/1e7||0},zs=function(e,t){var n=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),n==="+"?e+i:n==="-"?e-i:n==="*"?e*i:e/i},pg=function(e,t){for(var n=t.length,i=0;e.indexOf(t[i])<0&&++i<n;);return i<n},ol=function(){var e=wr.length,t=wr.slice(0),n,i;for(Cc={},wr.length=0,n=0;n<e;n++)i=t[n],i&&i._lazy&&(i.render(i._lazy[0],i._lazy[1],!0)._lazy=0)},ju=function(e){return!!(e._initted||e._startAt||e.add)},Hh=function(e,t,n,i){wr.length&&!hn&&ol(),e.render(t,n,!!(hn&&t<0&&ju(e))),wr.length&&!hn&&ol()},Wh=function(e){var t=parseFloat(e);return(t||t===0)&&(e+"").match(ug).length<2?t:un(e)?e.trim():e},Xh=function(e){return e},ri=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},mg=function(e){return function(t,n){for(var i in n)i in t||i==="duration"&&e||i==="ease"||(t[i]=n[i])}},Zs=function(e,t){for(var n in t)e[n]=t[n];return e},Vf=function r(e,t){for(var n in t)n!=="__proto__"&&n!=="constructor"&&n!=="prototype"&&(e[n]=zi(t[n])?r(e[n]||(e[n]={}),t[n]):t[n]);return e},ll=function(e,t){var n={},i;for(i in e)i in t||(n[i]=e[i]);return n},Aa=function(e){var t=e.parent||It,n=e.keyframes?mg(En(e.keyframes)):ri;if(Bn(e.inherit))for(;t;)n(e,t.vars.defaults),t=t.parent||t._dp;return e},gg=function(e,t){for(var n=e.length,i=n===t.length;i&&n--&&e[n]===t[n];);return n<0},Yh=function(e,t,n,i,s){var a=e[i],o;if(s)for(o=t[s];a&&a[s]>o;)a=a._prev;return a?(t._next=a._next,a._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=a,t.parent=t._dp=e,t},El=function(e,t,n,i){n===void 0&&(n="_first"),i===void 0&&(i="_last");var s=t._prev,a=t._next;s?s._next=a:e[n]===t&&(e[n]=a),a?a._prev=s:e[i]===t&&(e[i]=s),t._next=t._prev=t.parent=null},Cr=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},Jr=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var n=e;n;)n._dirty=1,n=n.parent;return e},_g=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},Pc=function(e,t,n,i){return e._startAt&&(hn?e._startAt.revert(Xo):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},xg=function r(e){return!e||e._ts&&r(e.parent)},Hf=function(e){return e._repeat?js(e._tTime,e=e.duration()+e._rDelay)*e:0},js=function(e,t){var n=Math.floor(e=Nt(e/t));return e&&n===e?n-1:n},cl=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},Tl=function(e){return e._end=Nt(e._start+(e._tDur/Math.abs(e._ts||e._rts||wt)||0))},wl=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=Nt(n._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),Tl(e),n._dirty||Jr(n,e)),e},qh=function(e,t){var n;if((t._time||!t._dur&&t._initted||t._start<e._time&&(t._dur||!t.add))&&(n=cl(e.rawTime(),t),(!t._dur||eo(0,t.totalDuration(),n)-t._tTime>wt)&&t.render(n,!0)),Jr(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(n=e;n._dp;)n.rawTime()>=0&&n.totalTime(n._tTime),n=n._dp;e._zTime=-wt}},Li=function(e,t,n,i){return t.parent&&Cr(t),t._start=Nt((ir(n)?n:n||e!==It?li(e,n,t):e._time)+t._delay),t._end=Nt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),Yh(e,t,"_first","_last",e._sort?"_start":0),Dc(t)||(e._recent=t),i||qh(e,t),e._ts<0&&wl(e,e._tTime),e},$h=function(e,t){return(ii.ScrollTrigger||qu("scrollTrigger",t))&&ii.ScrollTrigger.create(t,e)},Kh=function(e,t,n,i,s){if(Qu(e,t,s),!e._initted)return 1;if(!n&&e._pt&&!hn&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&Gh!==Jn.frame)return wr.push(e),e._lazy=[s,i],1},vg=function r(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||r(t))},Dc=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},Mg=function(e,t,n,i){var s=e.ratio,a=t<0||!t&&(!e._start&&vg(e)&&!(!e._initted&&Dc(e))||(e._ts<0||e._dp._ts<0)&&!Dc(e))?0:1,o=e._rDelay,l=0,c,u,h;if(o&&e._repeat&&(l=eo(0,e._tDur,t),u=js(l,o),e._yoyo&&u&1&&(a=1-a),u!==js(e._tTime,o)&&(s=1-a,e.vars.repeatRefresh&&e._initted&&e.invalidate())),a!==s||hn||i||e._zTime===wt||!t&&e._zTime){if(!e._initted&&Kh(e,t,i,n,l))return;for(h=e._zTime,e._zTime=t||(n?wt:0),n||(n=t&&!h),e.ratio=a,e._from&&(a=1-a),e._time=0,e._tTime=l,c=e._pt;c;)c.r(a,c.d),c=c._next;t<0&&Pc(e,t,n,!0),e._onUpdate&&!n&&ei(e,"onUpdate"),l&&e._repeat&&!n&&e.parent&&ei(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===a&&(a&&Cr(e,1),!n&&!hn&&(ei(e,a?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},Sg=function(e,t,n){var i;if(n>t)for(i=e._first;i&&i._start<=n;){if(i.data==="isPause"&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=n;){if(i.data==="isPause"&&i._start<t)return i;i=i._prev}},Js=function(e,t,n,i){var s=e._repeat,a=Nt(t)||0,o=e._tTime/e._tDur;return o&&!i&&(e._time*=a/e._dur),e._dur=a,e._tDur=s?s<0?1e10:Nt(a*(s+1)+e._rDelay*s):a,o>0&&!i&&wl(e,e._tTime=e._tDur*o),e.parent&&Tl(e),n||Jr(e.parent,e),e},Wf=function(e){return e instanceof On?Jr(e):Js(e,e._dur)},bg={_start:0,endTime:Ha,totalDuration:Ha},li=function r(e,t,n){var i=e.labels,s=e._recent||bg,a=e.duration()>=pi?s.endTime(!1):e._dur,o,l,c;return un(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),c=t.substr(-1)==="%",o=t.indexOf("="),l==="<"||l===">"?(o>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(c?(o<0?s:n).totalDuration()/100:1)):o<0?(t in i||(i[t]=a),i[t]):(l=parseFloat(t.charAt(o-1)+t.substr(o+1)),c&&n&&(l=l/100*(En(n)?n[0]:n).totalDuration()),o>1?r(e,t.substr(0,o-1),n)+l:a+l)):t==null?a:+t},Ra=function(e,t,n){var i=ir(t[1]),s=(i?2:1)+(e<2?0:1),a=t[s],o,l;if(i&&(a.duration=t[1]),a.parent=n,e){for(o=a,l=n;l&&!("immediateRender"in o);)o=l.vars.defaults||{},l=Bn(l.vars.inherit)&&l.parent;a.immediateRender=Bn(o.immediateRender),e<2?a.runBackwards=1:a.startAt=t[s-1]}return new Zt(t[0],a,t[s+1])},Ir=function(e,t){return e||e===0?t(e):t},eo=function(e,t,n){return n<e?e:n>t?t:n},Sn=function(e,t){return!un(e)||!(t=fg.exec(e))?"":t[1]},yg=function(e,t,n){return Ir(n,function(i){return eo(e,t,i)})},Lc=[].slice,Zh=function(e,t){return e&&zi(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&zi(e[0]))&&!e.nodeType&&e!==Ci},Eg=function(e,t,n){return n===void 0&&(n=[]),e.forEach(function(i){var s;return un(i)&&!t||Zh(i,1)?(s=n).push.apply(s,mi(i)):n.push(i)})||n},mi=function(e,t,n){return Lt&&!t&&Lt.selector?Lt.selector(e):un(e)&&!n&&(Rc||!Qs())?Lc.call((t||Yu).querySelectorAll(e),0):En(e)?Eg(e,n):Zh(e)?Lc.call(e,0):e?[e]:[]},Nc=function(e){return e=mi(e)[0]||Va("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return mi(t,n.querySelectorAll?n:n===e?Va("Invalid scope")||Yu.createElement("div"):e)}},jh=function(e){return e.sort(function(){return .5-Math.random()})},Jh=function(e){if(kt(e))return e;var t=zi(e)?e:{each:e},n=Qr(t.ease),i=t.from||0,s=parseFloat(t.base)||0,a={},o=i>0&&i<1,l=isNaN(i)||o,c=t.axis,u=i,h=i;return un(i)?u=h={center:.5,edges:.5,end:1}[i]||0:!o&&l&&(u=i[0],h=i[1]),function(f,d,g){var _=(g||t).length,p=a[_],m,b,A,M,y,T,w,v,E;if(!p){if(E=t.grid==="auto"?0:(t.grid||[1,pi])[1],!E){for(w=-pi;w<(w=g[E++].getBoundingClientRect().left)&&E<_;);E<_&&E--}for(p=a[_]=[],m=l?Math.min(E,_)*u-.5:i%E,b=E===pi?0:l?_*h/E-.5:i/E|0,w=0,v=pi,T=0;T<_;T++)A=T%E-m,M=b-(T/E|0),p[T]=y=c?Math.abs(c==="y"?M:A):Ih(A*A+M*M),y>w&&(w=y),y<v&&(v=y);i==="random"&&jh(p),p.max=w-v,p.min=v,p.v=_=(parseFloat(t.amount)||parseFloat(t.each)*(E>_?_-1:c?c==="y"?_/E:E:Math.max(E,_/E))||0)*(i==="edges"?-1:1),p.b=_<0?s-_:s,p.u=Sn(t.amount||t.each)||0,n=n&&_<0?Og(n):n}return _=(p[f]-p.min)/p.max||0,Nt(p.b+(n?n(_):_)*p.v)+p.u}},Ic=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var i=Nt(Math.round(parseFloat(n)/e)*e*t);return(i-i%1)/t+(ir(n)?0:Sn(n))}},Qh=function(e,t){var n=En(e),i,s;return!n&&zi(e)&&(i=n=e.radius||pi,e.values?(e=mi(e.values),(s=!ir(e[0]))&&(i*=i)):e=Ic(e.increment)),Ir(t,n?kt(e)?function(a){return s=e(a),Math.abs(s-a)<=i?s:a}:function(a){for(var o=parseFloat(s?a.x:a),l=parseFloat(s?a.y:0),c=pi,u=0,h=e.length,f,d;h--;)s?(f=e[h].x-o,d=e[h].y-l,f=f*f+d*d):f=Math.abs(e[h]-o),f<c&&(c=f,u=h);return u=!i||c<=i?e[u]:a,s||u===a||ir(a)?u:u+Sn(a)}:Ic(e))},ep=function(e,t,n,i){return Ir(En(e)?!t:n===!0?!!(n=0):!i,function(){return En(e)?e[~~(Math.random()*e.length)]:(n=n||1e-5)&&(i=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((e-n/2+Math.random()*(t-e+n*.99))/n)*n*i)/i})},Tg=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){return t.reduce(function(s,a){return a(s)},i)}},wg=function(e,t){return function(n){return e(parseFloat(n))+(t||Sn(n))}},Ag=function(e,t,n){return np(e,t,0,1,n)},tp=function(e,t,n){return Ir(n,function(i){return e[~~t(i)]})},Rg=function r(e,t,n){var i=t-e;return En(e)?tp(e,r(0,e.length),t):Ir(n,function(s){return(i+(s-e)%i)%i+e})},Cg=function r(e,t,n){var i=t-e,s=i*2;return En(e)?tp(e,r(0,e.length-1),t):Ir(n,function(a){return a=(s+(a-e)%s)%s||0,e+(a>i?s-a:a)})},Wa=function(e){return e.replace(lg,function(t){var n=t.indexOf("[")+1,i=t.substring(n||7,n?t.indexOf("]"):t.length-1).split(cg);return ep(n?i:+i[0],n?0:+i[1],+i[2]||1e-5)})},np=function(e,t,n,i,s){var a=t-e,o=i-n;return Ir(s,function(l){return n+((l-e)/a*o||0)})},Pg=function r(e,t,n,i){var s=isNaN(e+t)?0:function(d){return(1-d)*e+d*t};if(!s){var a=un(e),o={},l,c,u,h,f;if(n===!0&&(i=1)&&(n=null),a)e={p:e},t={p:t};else if(En(e)&&!En(t)){for(u=[],h=e.length,f=h-2,c=1;c<h;c++)u.push(r(e[c-1],e[c]));h--,s=function(g){g*=h;var _=Math.min(f,~~g);return u[_](g-_)},n=t}else i||(e=Zs(En(e)?[]:{},e));if(!u){for(l in t)Ju.call(o,e,l,"get",t[l]);s=function(g){return nf(g,o)||(a?e.p:e)}}}return Ir(n,s)},Xf=function(e,t,n){var i=e.labels,s=pi,a,o,l;for(a in i)o=i[a]-t,o<0==!!n&&o&&s>(o=Math.abs(o))&&(l=a,s=o);return l},ei=function(e,t,n){var i=e.vars,s=i[t],a=Lt,o=e._ctx,l,c,u;if(s)return l=i[t+"Params"],c=i.callbackScope||e,n&&wr.length&&ol(),o&&(Lt=o),u=l?s.apply(c,l):s.call(c),Lt=a,u},xa=function(e){return Cr(e),e.scrollTrigger&&e.scrollTrigger.kill(!!hn),e.progress()<1&&ei(e,"onInterrupt"),e},Bs,ip=[],rp=function(e){if(e)if(e=!e.name&&e.default||e,Xu()||e.headless){var t=e.name,n=kt(e),i=t&&!n&&e.init?function(){this._props=[]}:e,s={init:Ha,render:nf,add:Ju,kill:qg,modifier:Yg,rawVars:0},a={targetTest:0,get:0,getSetter:tf,aliases:{},register:0};if(Qs(),e!==i){if(Zn[t])return;ri(i,ri(ll(e,s),a)),Zs(i.prototype,Zs(s,ll(e,a))),Zn[i.prop=t]=i,e.targetTest&&(Yo.push(i),$u[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}zh(t,i),e.register&&e.register(Wn,i,zn)}else ip.push(e)},Tt=255,va={aqua:[0,Tt,Tt],lime:[0,Tt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Tt],navy:[0,0,128],white:[Tt,Tt,Tt],olive:[128,128,0],yellow:[Tt,Tt,0],orange:[Tt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Tt,0,0],pink:[Tt,192,203],cyan:[0,Tt,Tt],transparent:[Tt,Tt,Tt,0]},Fl=function(e,t,n){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(n-t)*e*6:e<.5?n:e*3<2?t+(n-t)*(2/3-e)*6:t)*Tt+.5|0},sp=function(e,t,n){var i=e?ir(e)?[e>>16,e>>8&Tt,e&Tt]:0:va.black,s,a,o,l,c,u,h,f,d,g;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),va[e])i=va[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),a=e.charAt(2),o=e.charAt(3),e="#"+s+s+a+a+o+o+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return i=parseInt(e.substr(1,6),16),[i>>16,i>>8&Tt,i&Tt,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&Tt,e&Tt]}else if(e.substr(0,3)==="hsl"){if(i=g=e.match(zf),!t)l=+i[0]%360/360,c=+i[1]/100,u=+i[2]/100,a=u<=.5?u*(c+1):u+c-u*c,s=u*2-a,i.length>3&&(i[3]*=1),i[0]=Fl(l+1/3,s,a),i[1]=Fl(l,s,a),i[2]=Fl(l-1/3,s,a);else if(~e.indexOf("="))return i=e.match(Fh),n&&i.length<4&&(i[3]=1),i}else i=e.match(zf)||va.transparent;i=i.map(Number)}return t&&!g&&(s=i[0]/Tt,a=i[1]/Tt,o=i[2]/Tt,h=Math.max(s,a,o),f=Math.min(s,a,o),u=(h+f)/2,h===f?l=c=0:(d=h-f,c=u>.5?d/(2-h-f):d/(h+f),l=h===s?(a-o)/d+(a<o?6:0):h===a?(o-s)/d+2:(s-a)/d+4,l*=60),i[0]=~~(l+.5),i[1]=~~(c*100+.5),i[2]=~~(u*100+.5)),n&&i.length<4&&(i[3]=1),i},ap=function(e){var t=[],n=[],i=-1;return e.split(Ar).forEach(function(s){var a=s.match(Os)||[];t.push.apply(t,a),n.push(i+=a.length+1)}),t.c=n,t},Yf=function(e,t,n){var i="",s=(e+i).match(Ar),a=t?"hsla(":"rgba(",o=0,l,c,u,h;if(!s)return e;if(s=s.map(function(f){return(f=sp(f,t,1))&&a+(t?f[0]+","+f[1]+"%,"+f[2]+"%,"+f[3]:f.join(","))+")"}),n&&(u=ap(e),l=n.c,l.join(i)!==u.c.join(i)))for(c=e.replace(Ar,"1").split(Os),h=c.length-1;o<h;o++)i+=c[o]+(~l.indexOf(o)?s.shift()||a+"0,0,0,0)":(u.length?u:s.length?s:n).shift());if(!c)for(c=e.split(Ar),h=c.length-1;o<h;o++)i+=c[o]+s[o];return i+c[h]},Ar=(function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",e;for(e in va)r+="|"+e+"\\b";return new RegExp(r+")","gi")})(),Dg=/hsl[a]?\(/,op=function(e){var t=e.join(" "),n;if(Ar.lastIndex=0,Ar.test(t))return n=Dg.test(t),e[1]=Yf(e[1],n),e[0]=Yf(e[0],n,ap(e[1])),!0},Xa,Jn=(function(){var r=Date.now,e=500,t=33,n=r(),i=n,s=1e3/240,a=s,o=[],l,c,u,h,f,d,g=function _(p){var m=r()-i,b=p===!0,A,M,y,T;if((m>e||m<0)&&(n+=m-t),i+=m,y=i-n,A=y-a,(A>0||b)&&(T=++h.frame,f=y-h.time*1e3,h.time=y=y/1e3,a+=A+(A>=s?4:s-A),M=1),b||(l=c(_)),M)for(d=0;d<o.length;d++)o[d](y,f,T,p)};return h={time:0,frame:0,tick:function(){g(!0)},deltaRatio:function(p){return f/(1e3/(p||60))},wake:function(){Bh&&(!Rc&&Xu()&&(Ci=Rc=window,Yu=Ci.document||{},ii.gsap=Wn,(Ci.gsapVersions||(Ci.gsapVersions=[])).push(Wn.version),kh(al||Ci.GreenSockGlobals||!Ci.gsap&&Ci||{}),ip.forEach(rp)),u=typeof requestAnimationFrame<"u"&&requestAnimationFrame,l&&h.sleep(),c=u||function(p){return setTimeout(p,a-h.time*1e3+1|0)},Xa=1,g(2))},sleep:function(){(u?cancelAnimationFrame:clearTimeout)(l),Xa=0,c=Ha},lagSmoothing:function(p,m){e=p||1/0,t=Math.min(m||33,e)},fps:function(p){s=1e3/(p||240),a=h.time*1e3+s},add:function(p,m,b){var A=m?function(M,y,T,w){p(M,y,T,w),h.remove(A)}:p;return h.remove(p),o[b?"unshift":"push"](A),Qs(),A},remove:function(p,m){~(m=o.indexOf(p))&&o.splice(m,1)&&d>=m&&d--},_listeners:o},h})(),Qs=function(){return!Xa&&Jn.wake()},ut={},Lg=/^[\d.\-M][\d.\-,\s]/,Ng=/["']/g,Ig=function(e){for(var t={},n=e.substr(1,e.length-3).split(":"),i=n[0],s=1,a=n.length,o,l,c;s<a;s++)l=n[s],o=s!==a-1?l.lastIndexOf(","):l.length,c=l.substr(0,o),t[i]=isNaN(c)?c.replace(Ng,"").trim():+c,i=l.substr(o+1).trim();return t},Ug=function(e){var t=e.indexOf("(")+1,n=e.indexOf(")"),i=e.indexOf("(",t);return e.substring(t,~i&&i<n?e.indexOf(")",n+1):n)},Fg=function(e){var t=(e+"").split("("),n=ut[t[0]];return n&&t.length>1&&n.config?n.config.apply(null,~e.indexOf("{")?[Ig(t[1])]:Ug(e).split(",").map(Wh)):ut._CE&&Lg.test(e)?ut._CE("",e):n},Og=function(e){return function(t){return 1-e(1-t)}},Qr=function(e,t){return e&&(kt(e)?e:ut[e]||Fg(e))||t},us=function(e,t,n,i){n===void 0&&(n=function(l){return 1-t(1-l)}),i===void 0&&(i=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:n,easeInOut:i},a;return kn(e,function(o){ut[o]=ii[o]=s,ut[a=o.toLowerCase()]=n;for(var l in s)ut[a+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=ut[o+"."+l]=s[l]}),s},lp=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},Ol=function r(e,t,n){var i=t>=1?t:1,s=(n||(e?.3:.45))/(t<1?t:1),a=s/Ac*(Math.asin(1/i)||0),o=function(u){return u===1?1:i*Math.pow(2,-10*u)*og((u-a)*s)+1},l=e==="out"?o:e==="in"?function(c){return 1-o(1-c)}:lp(o);return s=Ac/s,l.config=function(c,u){return r(e,c,u)},l},Bl=function r(e,t){t===void 0&&(t=1.70158);var n=function(a){return a?--a*a*((t+1)*a+t)+1:0},i=e==="out"?n:e==="in"?function(s){return 1-n(1-s)}:lp(n);return i.config=function(s){return r(e,s)},i};kn("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,e){var t=e<5?e+1:e;us(r+",Power"+(t-1),e?function(n){return Math.pow(n,t)}:function(n){return n},function(n){return 1-Math.pow(1-n,t)},function(n){return n<.5?Math.pow(n*2,t)/2:1-Math.pow((1-n)*2,t)/2})});ut.Linear.easeNone=ut.none=ut.Linear.easeIn;us("Elastic",Ol("in"),Ol("out"),Ol());(function(r,e){var t=1/e,n=2*t,i=2.5*t,s=function(o){return o<t?r*o*o:o<n?r*Math.pow(o-1.5/e,2)+.75:o<i?r*(o-=2.25/e)*o+.9375:r*Math.pow(o-2.625/e,2)+.984375};us("Bounce",function(a){return 1-s(1-a)},s)})(7.5625,2.75);us("Expo",function(r){return Math.pow(2,10*(r-1))*r+r*r*r*r*r*r*(1-r)});us("Circ",function(r){return-(Ih(1-r*r)-1)});us("Sine",function(r){return r===1?1:-ag(r*rg)+1});us("Back",Bl("in"),Bl("out"),Bl());ut.SteppedEase=ut.steps=ii.SteppedEase={config:function(e,t){e===void 0&&(e=1);var n=1/e,i=e+(t?0:1),s=t?1:0,a=1-wt;return function(o){return((i*eo(0,a,o)|0)+s)*n}}};Ga.ease=ut["quad.out"];kn("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return Ku+=r+","+r+"Params,"});var cp=function(e,t){this.id=sg++,e._gsap=this,this.target=e,this.harness=t,this.get=t?t.get:Vh,this.set=t?t.getSetter:tf},Ya=(function(){function r(t){this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,Js(this,+t.duration,1,1),this.data=t.data,Lt&&(this._ctx=Lt,Lt.data.push(this)),Xa||Jn.wake()}var e=r.prototype;return e.delay=function(n){return n||n===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+n-this._delay),this._delay=n,this):this._delay},e.duration=function(n){return arguments.length?this.totalDuration(this._repeat>0?n+(n+this._rDelay)*this._repeat:n):this.totalDuration()&&this._dur},e.totalDuration=function(n){return arguments.length?(this._dirty=0,Js(this,this._repeat<0?n:(n-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(n,i){if(Qs(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(wl(this,n),!s._dp||s.parent||qh(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&n<this._tDur||this._ts<0&&n>0||!this._tDur&&!n)&&Li(this._dp,this,this._start-this._delay)}return(this._tTime!==n||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===wt||!this._initted&&this._dur&&n||!n&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=n),Hh(this,n,i)),this},e.time=function(n,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),n+Hf(this))%(this._dur+this._rDelay)||(n?this._dur:0),i):this._time},e.totalProgress=function(n,i){return arguments.length?this.totalTime(this.totalDuration()*n,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},e.progress=function(n,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-n:n)+Hf(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(n,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(n-1)*s,i):this._repeat?js(this._tTime,s)+1:1},e.timeScale=function(n,i){if(!arguments.length)return this._rts===-wt?0:this._rts;if(this._rts===n)return this;var s=this.parent&&this._ts?cl(this.parent._time,this):this._tTime;return this._rts=+n||0,this._ts=this._ps||n===-wt?0:this._rts,this.totalTime(eo(-Math.abs(this._delay),this.totalDuration(),s),i!==!1),Tl(this),_g(this)},e.paused=function(n){return arguments.length?(this._ps!==n&&(this._ps=n,n?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Qs(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==wt&&(this._tTime-=wt)))),this):this._ps},e.startTime=function(n){if(arguments.length){this._start=Nt(n);var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Li(i,this,this._start-this._delay),this}return this._start},e.endTime=function(n){return this._start+(Bn(n)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(n){var i=this.parent||this._dp;return i?n&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?cl(i.rawTime(n),this):this._tTime:this._tTime},e.revert=function(n){n===void 0&&(n=hg);var i=hn;return hn=n,ju(this)&&(this.timeline&&this.timeline.revert(n),this.totalTime(-.01,n.suppressEvents)),this.data!=="nested"&&n.kill!==!1&&this.kill(),hn=i,this},e.globalTime=function(n){for(var i=this,s=arguments.length?n:i.rawTime();i;)s=i._start+s/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(n):s},e.repeat=function(n){return arguments.length?(this._repeat=n===1/0?-2:n,Wf(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(n){if(arguments.length){var i=this._time;return this._rDelay=n,Wf(this),i?this.time(i):this}return this._rDelay},e.yoyo=function(n){return arguments.length?(this._yoyo=n,this):this._yoyo},e.seek=function(n,i){return this.totalTime(li(this,n),Bn(i))},e.restart=function(n,i){return this.play().totalTime(n?-this._delay:0,Bn(i)),this._dur||(this._zTime=-wt),this},e.play=function(n,i){return n!=null&&this.seek(n,i),this.reversed(!1).paused(!1)},e.reverse=function(n,i){return n!=null&&this.seek(n||this.totalDuration(),i),this.reversed(!0).paused(!1)},e.pause=function(n,i){return n!=null&&this.seek(n,i),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(n){return arguments.length?(!!n!==this.reversed()&&this.timeScale(-this._rts||(n?-wt:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-wt,this},e.isActive=function(){var n=this.parent||this._dp,i=this._start,s;return!!(!n||this._ts&&this._initted&&n.isActive()&&(s=n.rawTime(!0))>=i&&s<this.endTime(!0)-wt)},e.eventCallback=function(n,i,s){var a=this.vars;return arguments.length>1?(i?(a[n]=i,s&&(a[n+"Params"]=s),n==="onUpdate"&&(this._onUpdate=i)):delete a[n],this):a[n]},e.then=function(n){var i=this,s=i._prom;return new Promise(function(a){var o=kt(n)?n:Xh,l=function(){var u=i.then;i.then=null,s&&s(),kt(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=u),a(o),i.then=u};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?l():i._prom=l})},e.kill=function(){xa(this)},r})();ri(Ya.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-wt,_prom:0,_ps:!1,_rts:1});var On=(function(r){Nh(e,r);function e(n,i){var s;return n===void 0&&(n={}),s=r.call(this,n)||this,s.labels={},s.smoothChildTiming=!!n.smoothChildTiming,s.autoRemoveChildren=!!n.autoRemoveChildren,s._sort=Bn(n.sortChildren),It&&Li(n.parent||It,qi(s),i),n.reversed&&s.reverse(),n.paused&&s.paused(!0),n.scrollTrigger&&$h(qi(s),n.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,a){return Ra(0,arguments,this),this},t.from=function(i,s,a){return Ra(1,arguments,this),this},t.fromTo=function(i,s,a,o){return Ra(2,arguments,this),this},t.set=function(i,s,a){return s.duration=0,s.parent=this,Aa(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new Zt(i,s,li(this,a),1),this},t.call=function(i,s,a){return Li(this,Zt.delayedCall(0,i,s),a)},t.staggerTo=function(i,s,a,o,l,c,u){return a.duration=s,a.stagger=a.stagger||o,a.onComplete=c,a.onCompleteParams=u,a.parent=this,new Zt(i,a,li(this,l)),this},t.staggerFrom=function(i,s,a,o,l,c,u){return a.runBackwards=1,Aa(a).immediateRender=Bn(a.immediateRender),this.staggerTo(i,s,a,o,l,c,u)},t.staggerFromTo=function(i,s,a,o,l,c,u,h){return o.startAt=a,Aa(o).immediateRender=Bn(o.immediateRender),this.staggerTo(i,s,o,l,c,u,h)},t.render=function(i,s,a){var o=this._time,l=this._dirty?this.totalDuration():this._tDur,c=this._dur,u=i<=0?0:Nt(i),h=this._zTime<0!=i<0&&(this._initted||!c),f,d,g,_,p,m,b,A,M,y,T,w;if(this!==It&&u>l&&i>=0&&(u=l),u!==this._tTime||a||h){if(o!==this._time&&c&&(u+=this._time-o,i+=this._time-o),f=u,M=this._start,A=this._ts,m=!A,h&&(c||(o=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(T=this._yoyo,p=c+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(p*100+i,s,a);if(f=Nt(u%p),u===l?(_=this._repeat,f=c):(y=Nt(u/p),_=~~y,_&&_===y&&(f=c,_--),f>c&&(f=c)),y=js(this._tTime,p),!o&&this._tTime&&y!==_&&this._tTime-y*p-this._dur<=0&&(y=_),T&&_&1&&(f=c-f,w=1),_!==y&&!this._lock){var v=T&&y&1,E=v===(T&&_&1);if(_<y&&(v=!v),o=v?0:u%c?c:u,this._lock=1,this.render(o||(w?0:Nt(_*p)),s,!c)._lock=0,this._tTime=u,!s&&this.parent&&ei(this,"onRepeat"),this.vars.repeatRefresh&&!w&&(this.invalidate()._lock=1,y=_),o&&o!==this._time||m!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(c=this._dur,l=this._tDur,E&&(this._lock=2,o=v?c:-1e-4,this.render(o,!0),this.vars.repeatRefresh&&!w&&this.invalidate()),this._lock=0,!this._ts&&!m)return this}}if(this._hasPause&&!this._forcing&&this._lock<2&&(b=Sg(this,Nt(o),Nt(f)),b&&(u-=f-(f=b._start))),this._tTime=u,this._time=f,this._act=!!A,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,o=0),!o&&u&&c&&!s&&!y&&(ei(this,"onStart"),this._tTime!==u))return this;if(f>=o&&i>=0)for(d=this._first;d;){if(g=d._next,(d._act||f>=d._start)&&d._ts&&b!==d){if(d.parent!==this)return this.render(i,s,a);if(d.render(d._ts>0?(f-d._start)*d._ts:(d._dirty?d.totalDuration():d._tDur)+(f-d._start)*d._ts,s,a),f!==this._time||!this._ts&&!m){b=0,g&&(u+=this._zTime=-wt);break}}d=g}else{d=this._last;for(var C=i<0?i:f;d;){if(g=d._prev,(d._act||C<=d._end)&&d._ts&&b!==d){if(d.parent!==this)return this.render(i,s,a);if(d.render(d._ts>0?(C-d._start)*d._ts:(d._dirty?d.totalDuration():d._tDur)+(C-d._start)*d._ts,s,a||hn&&ju(d)),f!==this._time||!this._ts&&!m){b=0,g&&(u+=this._zTime=C?-wt:wt);break}}d=g}}if(b&&!s&&(this.pause(),b.render(f>=o?0:-wt)._zTime=f>=o?1:-1,this._ts))return this._start=M,Tl(this),this.render(i,s,a);this._onUpdate&&!s&&ei(this,"onUpdate",!0),(u===l&&this._tTime>=this.totalDuration()||!u&&o)&&(M===this._start||Math.abs(A)!==Math.abs(this._ts))&&(this._lock||((i||!c)&&(u===l&&this._ts>0||!u&&this._ts<0)&&Cr(this,1),!s&&!(i<0&&!o)&&(u||o||!l)&&(ei(this,u===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<l&&this.timeScale()>0)&&this._prom())))}return this},t.add=function(i,s){var a=this;if(ir(s)||(s=li(this,s,i)),!(i instanceof Ya)){if(En(i))return i.forEach(function(o){return a.add(o,s)}),this;if(un(i))return this.addLabel(i,s);if(kt(i))i=Zt.delayedCall(0,i);else return this}return this!==i?Li(this,i,s):this},t.getChildren=function(i,s,a,o){i===void 0&&(i=!0),s===void 0&&(s=!0),a===void 0&&(a=!0),o===void 0&&(o=-pi);for(var l=[],c=this._first;c;)c._start>=o&&(c instanceof Zt?s&&l.push(c):(a&&l.push(c),i&&l.push.apply(l,c.getChildren(!0,s,a)))),c=c._next;return l},t.getById=function(i){for(var s=this.getChildren(1,1,1),a=s.length;a--;)if(s[a].vars.id===i)return s[a]},t.remove=function(i){return un(i)?this.removeLabel(i):kt(i)?this.killTweensOf(i):(i.parent===this&&El(this,i),i===this._recent&&(this._recent=this._last),Jr(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Nt(Jn.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),r.prototype.totalTime.call(this,i,s),this._forcing=0,this):this._tTime},t.addLabel=function(i,s){return this.labels[i]=li(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,a){var o=Zt.delayedCall(0,s||Ha,a);return o.data="isPause",this._hasPause=1,Li(this,o,li(this,i))},t.removePause=function(i){var s=this._first;for(i=li(this,i);s;)s._start===i&&s.data==="isPause"&&Cr(s),s=s._next},t.killTweensOf=function(i,s,a){for(var o=this.getTweensOf(i,a),l=o.length;l--;)vr!==o[l]&&o[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var a=[],o=mi(i),l=this._first,c=ir(s),u;l;)l instanceof Zt?pg(l._targets,o)&&(c?(!vr||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&a.push(l):(u=l.getTweensOf(o,s)).length&&a.push.apply(a,u),l=l._next;return a},t.tweenTo=function(i,s){s=s||{};var a=this,o=li(a,i),l=s,c=l.startAt,u=l.onStart,h=l.onStartParams,f=l.immediateRender,d,g=Zt.to(a,ri({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:o,overwrite:"auto",duration:s.duration||Math.abs((o-(c&&"time"in c?c.time:a._time))/a.timeScale())||wt,onStart:function(){if(a.pause(),!d){var p=s.duration||Math.abs((o-(c&&"time"in c?c.time:a._time))/a.timeScale());g._dur!==p&&Js(g,p,0,1).render(g._time,!0,!0),d=1}u&&u.apply(g,h||[])}},s));return f?g.render(0):g},t.tweenFromTo=function(i,s,a){return this.tweenTo(s,ri({startAt:{time:li(this,i)}},a))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),Xf(this,li(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),Xf(this,li(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+wt)},t.shiftChildren=function(i,s,a){a===void 0&&(a=0);var o=this._first,l=this.labels,c;for(i=Nt(i);o;)o._start>=a&&(o._start+=i,o._end+=i),o=o._next;if(s)for(c in l)l[c]>=a&&(l[c]+=i);return Jr(this)},t.invalidate=function(i){var s=this._first;for(this._lock=0;s;)s.invalidate(i),s=s._next;return r.prototype.invalidate.call(this,i)},t.clear=function(i){i===void 0&&(i=!0);for(var s=this._first,a;s;)a=s._next,this.remove(s),s=a;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),Jr(this)},t.totalDuration=function(i){var s=0,a=this,o=a._last,l=pi,c,u,h;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-i:i));if(a._dirty){for(h=a.parent;o;)c=o._prev,o._dirty&&o.totalDuration(),u=o._start,u>l&&a._sort&&o._ts&&!a._lock?(a._lock=1,Li(a,o,u-o._delay,1)._lock=0):l=u,u<0&&o._ts&&(s-=u,(!h&&!a._dp||h&&h.smoothChildTiming)&&(a._start+=Nt(u/a._ts),a._time-=u,a._tTime-=u),a.shiftChildren(-u,!1,-1/0),l=0),o._end>s&&o._ts&&(s=o._end),o=c;Js(a,a===It&&a._time>s?a._time:s,1,1),a._dirty=0}return a._tDur},e.updateRoot=function(i){if(It._ts&&(Hh(It,cl(i,It)),Gh=Jn.frame),Jn.frame>=Gf){Gf+=ni.autoSleep||120;var s=It._first;if((!s||!s._ts)&&ni.autoSleep&&Jn._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Jn.sleep()}}},e})(Ya);ri(On.prototype,{_lock:0,_hasPause:0,_forcing:0});var Bg=function(e,t,n,i,s,a,o){var l=new zn(this._pt,e,t,0,1,mp,null,s),c=0,u=0,h,f,d,g,_,p,m,b;for(l.b=n,l.e=i,n+="",i+="",(m=~i.indexOf("random("))&&(i=Wa(i)),a&&(b=[n,i],a(b,e,t),n=b[0],i=b[1]),f=n.match(Il)||[];h=Il.exec(i);)g=h[0],_=i.substring(c,h.index),d?d=(d+1)%5:_.substr(-5)==="rgba("&&(d=1),g!==f[u++]&&(p=parseFloat(f[u-1])||0,l._pt={_next:l._pt,p:_||u===1?_:",",s:p,c:g.charAt(1)==="="?zs(p,g)-p:parseFloat(g)-p,m:d&&d<4?Math.round:0},c=Il.lastIndex);return l.c=c<i.length?i.substring(c,i.length):"",l.fp=o,(Oh.test(i)||m)&&(l.e=0),this._pt=l,l},Ju=function(e,t,n,i,s,a,o,l,c,u){kt(i)&&(i=i(s||0,e,a));var h=e[t],f=n!=="get"?n:kt(h)?c?e[t.indexOf("set")||!kt(e["get"+t.substr(3)])?t:"get"+t.substr(3)](c):e[t]():h,d=kt(h)?c?Hg:hp:ef,g;if(un(i)&&(~i.indexOf("random(")&&(i=Wa(i)),i.charAt(1)==="="&&(g=zs(f,i)+(Sn(f)||0),(g||g===0)&&(i=g))),!u||f!==i||Uc)return!isNaN(f*i)&&i!==""?(g=new zn(this._pt,e,t,+f||0,i-(f||0),typeof h=="boolean"?Xg:pp,0,d),c&&(g.fp=c),o&&g.modifier(o,this,e),this._pt=g):(!h&&!(t in e)&&qu(t,i),Bg.call(this,e,t,f,i,d,l||ni.stringFilter,c))},kg=function(e,t,n,i,s){if(kt(e)&&(e=Ca(e,s,t,n,i)),!zi(e)||e.style&&e.nodeType||En(e)||Uh(e))return un(e)?Ca(e,s,t,n,i):e;var a={},o;for(o in e)a[o]=Ca(e[o],s,t,n,i);return a},up=function(e,t,n,i,s,a){var o,l,c,u;if(Zn[e]&&(o=new Zn[e]).init(s,o.rawVars?t[e]:kg(t[e],i,s,a,n),n,i,a)!==!1&&(n._pt=l=new zn(n._pt,s,e,0,1,o.render,o,0,o.priority),n!==Bs))for(c=n._ptLookup[n._targets.indexOf(s)],u=o._props.length;u--;)c[o._props[u]]=l;return o},vr,Uc,Qu=function r(e,t,n){var i=e.vars,s=i.ease,a=i.startAt,o=i.immediateRender,l=i.lazy,c=i.onUpdate,u=i.runBackwards,h=i.yoyoEase,f=i.keyframes,d=i.autoRevert,g=e._dur,_=e._startAt,p=e._targets,m=e.parent,b=m&&m.data==="nested"?m.vars.targets:p,A=e._overwrite==="auto"&&!Hu,M=e.timeline,y=i.easeReverse||h,T,w,v,E,C,L,N,Y,H,O,z,I,W;if(M&&(!f||!s)&&(s="none"),e._ease=Qr(s,Ga.ease),e._rEase=y&&(Qr(y)||e._ease),e._from=!M&&!!i.runBackwards,e._from&&(e.ratio=1),!M||f&&!i.stagger){if(Y=p[0]?jr(p[0]).harness:0,I=Y&&i[Y.prop],T=ll(i,$u),_&&(_._zTime<0&&_.progress(1),t<0&&u&&o&&!d?_.render(-1,!0):_.revert(u&&g?Xo:dg),_._lazy=0),a){if(Cr(e._startAt=Zt.set(p,ri({data:"isStart",overwrite:!1,parent:m,immediateRender:!0,lazy:!_&&Bn(l),startAt:null,delay:0,onUpdate:c&&function(){return ei(e,"onUpdate")},stagger:0},a))),e._startAt._dp=0,e._startAt._sat=e,t<0&&(hn||!o&&!d)&&e._startAt.revert(Xo),o&&g&&t<=0&&n<=0){t&&(e._zTime=t);return}}else if(u&&g&&!_){if(t&&(o=!1),v=ri({overwrite:!1,data:"isFromStart",lazy:o&&!_&&Bn(l),immediateRender:o,stagger:0,parent:m},T),I&&(v[Y.prop]=I),Cr(e._startAt=Zt.set(p,v)),e._startAt._dp=0,e._startAt._sat=e,t<0&&(hn?e._startAt.revert(Xo):e._startAt.render(-1,!0)),e._zTime=t,!o)r(e._startAt,wt,wt);else if(!t)return}for(e._pt=e._ptCache=0,l=g&&Bn(l)||l&&!g,w=0;w<p.length;w++){if(C=p[w],N=C._gsap||Zu(p)[w]._gsap,e._ptLookup[w]=O={},Cc[N.id]&&wr.length&&ol(),z=b===p?w:b.indexOf(C),Y&&(H=new Y).init(C,I||T,e,z,b)!==!1&&(e._pt=E=new zn(e._pt,C,H.name,0,1,H.render,H,0,H.priority),H._props.forEach(function(Z){O[Z]=E}),H.priority&&(L=1)),!Y||I)for(v in T)Zn[v]&&(H=up(v,T,e,z,C,b))?H.priority&&(L=1):O[v]=E=Ju.call(e,C,v,"get",T[v],z,b,0,i.stringFilter);e._op&&e._op[w]&&e.kill(C,e._op[w]),A&&e._pt&&(vr=e,It.killTweensOf(C,O,e.globalTime(t)),W=!e.parent,vr=0),e._pt&&l&&(Cc[N.id]=1)}L&&gp(e),e._onInit&&e._onInit(e)}e._onUpdate=c,e._initted=(!e._op||e._pt)&&!W,f&&t<=0&&M.render(pi,!0,!0)},zg=function(e,t,n,i,s,a,o,l){var c=(e._pt&&e._ptCache||(e._ptCache={}))[t],u,h,f,d;if(!c)for(c=e._ptCache[t]=[],f=e._ptLookup,d=e._targets.length;d--;){if(u=f[d][t],u&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==t&&u.fp!==t;)u=u._next;if(!u)return Uc=1,e.vars[t]="+=0",Qu(e,o),Uc=0,l?Va(t+" not eligible for reset. Try splitting into individual properties"):1;c.push(u)}for(d=c.length;d--;)h=c[d],u=h._pt||h,u.s=(i||i===0)&&!s?i:u.s+(i||0)+a*u.c,u.c=n-u.s,h.e&&(h.e=Ht(n)+Sn(h.e)),h.b&&(h.b=u.s+Sn(h.b))},Gg=function(e,t){var n=e[0]?jr(e[0]).harness:0,i=n&&n.aliases,s,a,o,l;if(!i)return t;s=Zs({},t);for(a in i)if(a in s)for(l=i[a].split(","),o=l.length;o--;)s[l[o]]=s[a];return s},Vg=function(e,t,n,i){var s=t.ease||i||"power1.inOut",a,o;if(En(t))o=n[e]||(n[e]=[]),t.forEach(function(l,c){return o.push({t:c/(t.length-1)*100,v:l,e:s})});else for(a in t)o=n[a]||(n[a]=[]),a==="ease"||o.push({t:parseFloat(e),v:t[a],e:s})},Ca=function(e,t,n,i,s){return kt(e)?e.call(t,n,i,s):un(e)&&~e.indexOf("random(")?Wa(e):e},fp=Ku+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,easeReverse,autoRevert",dp={};kn(fp+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return dp[r]=1});var Zt=(function(r){Nh(e,r);function e(n,i,s,a){var o;typeof i=="number"&&(s.duration=i,i=s,s=null),o=r.call(this,a?i:Aa(i))||this;var l=o.vars,c=l.duration,u=l.delay,h=l.immediateRender,f=l.stagger,d=l.overwrite,g=l.keyframes,_=l.defaults,p=l.scrollTrigger,m=i.parent||It,b=(En(n)||Uh(n)?ir(n[0]):"length"in i)?[n]:mi(n),A,M,y,T,w,v,E,C;if(o._targets=b.length?Zu(b):Va("GSAP target "+n+" not found. https://gsap.com",!ni.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=d,g||f||ro(c)||ro(u)){i=o.vars;var L=i.easeReverse||i.yoyoEase;if(A=o.timeline=new On({data:"nested",defaults:_||{},targets:m&&m.data==="nested"?m.vars.targets:b}),A.kill(),A.parent=A._dp=qi(o),A._start=0,f||ro(c)||ro(u)){if(T=b.length,E=f&&Jh(f),zi(f))for(w in f)~fp.indexOf(w)&&(C||(C={}),C[w]=f[w]);for(M=0;M<T;M++)y=ll(i,dp),y.stagger=0,L&&(y.easeReverse=L),C&&Zs(y,C),v=b[M],y.duration=+Ca(c,qi(o),M,v,b),y.delay=(+Ca(u,qi(o),M,v,b)||0)-o._delay,!f&&T===1&&y.delay&&(o._delay=u=y.delay,o._start+=u,y.delay=0),A.to(v,y,E?E(M,v,b):0),A._ease=ut.none;A.duration()?c=u=0:o.timeline=0}else if(g){Aa(ri(A.vars.defaults,{ease:"none"})),A._ease=Qr(g.ease||i.ease||"none");var N=0,Y,H,O;if(En(g))g.forEach(function(z){return A.to(b,z,">")}),A.duration();else{y={};for(w in g)w==="ease"||w==="easeEach"||Vg(w,g[w],y,g.easeEach);for(w in y)for(Y=y[w].sort(function(z,I){return z.t-I.t}),N=0,M=0;M<Y.length;M++)H=Y[M],O={ease:H.e,duration:(H.t-(M?Y[M-1].t:0))/100*c},O[w]=H.v,A.to(b,O,N),N+=O.duration;A.duration()<c&&A.to({},{duration:c-A.duration()})}}c||o.duration(c=A.duration())}else o.timeline=0;return d===!0&&!Hu&&(vr=qi(o),It.killTweensOf(b),vr=0),Li(m,qi(o),s),i.reversed&&o.reverse(),i.paused&&o.paused(!0),(h||!c&&!g&&o._start===Nt(m._time)&&Bn(h)&&xg(qi(o))&&m.data!=="nested")&&(o._tTime=-wt,o.render(Math.max(0,-u)||0)),p&&$h(qi(o),p),o}var t=e.prototype;return t.render=function(i,s,a){var o=this._time,l=this._tDur,c=this._dur,u=i<0,h=i>l-wt&&!u?l:i<wt?0:i,f,d,g,_,p,m,b,A;if(!c)Mg(this,i,s,a);else if(h!==this._tTime||!i||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u||this._lazy){if(f=h,A=this.timeline,this._repeat){if(_=c+this._rDelay,this._repeat<-1&&u)return this.totalTime(_*100+i,s,a);if(f=Nt(h%_),h===l?(g=this._repeat,f=c):(p=Nt(h/_),g=~~p,g&&g===p?(f=c,g--):f>c&&(f=c)),m=this._yoyo&&g&1,m&&(f=c-f),p=js(this._tTime,_),f===o&&!a&&this._initted&&g===p)return this._tTime=h,this;g!==p&&this.vars.repeatRefresh&&!m&&!this._lock&&f!==_&&this._initted&&(this._lock=a=1,this.render(Nt(_*g),!0).invalidate()._lock=0)}if(!this._initted){if(Kh(this,u?i:f,a,s,h))return this._tTime=0,this;if(o!==this._time&&!(a&&this.vars.repeatRefresh&&g!==p))return this;if(c!==this._dur)return this.render(i,s,a)}if(this._rEase){var M=f<o;if(M!==this._inv){var y=M?o:c-o;this._inv=M,this._from&&(this.ratio=1-this.ratio),this._invRatio=this.ratio,this._invTime=o,this._invRecip=y?(M?-1:1)/y:0,this._invScale=M?-this.ratio:1-this.ratio,this._invEase=M?this._rEase:this._ease}this.ratio=b=this._invRatio+this._invScale*this._invEase((f-this._invTime)*this._invRecip)}else this.ratio=b=this._ease(f/c);if(this._from&&(this.ratio=b=1-b),this._tTime=h,this._time=f,!this._act&&this._ts&&(this._act=1,this._lazy=0),!o&&h&&!s&&!p&&(ei(this,"onStart"),this._tTime!==h))return this;for(d=this._pt;d;)d.r(b,d.d),d=d._next;A&&A.render(i<0?i:A._dur*A._ease(f/this._dur),s,a)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(u&&Pc(this,i,s,a),ei(this,"onUpdate")),this._repeat&&g!==p&&this.vars.onRepeat&&!s&&this.parent&&ei(this,"onRepeat"),(h===this._tDur||!h)&&this._tTime===h&&(u&&!this._onUpdate&&Pc(this,i,!0,!0),(i||!c)&&(h===this._tDur&&this._ts>0||!h&&this._ts<0)&&Cr(this,1),!s&&!(u&&!o)&&(h||o||m)&&(ei(this,h===l?"onComplete":"onReverseComplete",!0),this._prom&&!(h<l&&this.timeScale()>0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),r.prototype.invalidate.call(this,i)},t.resetTo=function(i,s,a,o,l){Xa||Jn.wake(),this._ts||this.play();var c=Math.min(this._dur,(this._dp._time-this._start)*this._ts),u;return this._initted||Qu(this,c),u=this._ease(c/this._dur),zg(this,i,s,a,o,u,c,l)?this.resetTo(i,s,a,o,1):(wl(this,0),this.parent||Yh(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(i,s){if(s===void 0&&(s="all"),!i&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?xa(this):this.scrollTrigger&&this.scrollTrigger.kill(!!hn),this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,vr&&vr.vars.overwrite!==!0)._first||xa(this),this.parent&&a!==this.timeline.totalDuration()&&Js(this,this._dur*this.timeline._tDur/a,0,1),this}var o=this._targets,l=i?mi(i):o,c=this._ptLookup,u=this._pt,h,f,d,g,_,p,m;if((!s||s==="all")&&gg(o,l))return s==="all"&&(this._pt=0),xa(this);for(h=this._op=this._op||[],s!=="all"&&(un(s)&&(_={},kn(s,function(b){return _[b]=1}),s=_),s=Gg(o,s)),m=o.length;m--;)if(~l.indexOf(o[m])){f=c[m],s==="all"?(h[m]=s,g=f,d={}):(d=h[m]=h[m]||{},g=s);for(_ in g)p=f&&f[_],p&&((!("kill"in p.d)||p.d.kill(_)===!0)&&El(this,p,"_pt"),delete f[_]),d!=="all"&&(d[_]=1)}return this._initted&&!this._pt&&u&&xa(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return Ra(1,arguments)},e.delayedCall=function(i,s,a,o){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:s,onReverseComplete:s,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:o})},e.fromTo=function(i,s,a){return Ra(2,arguments)},e.set=function(i,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(i,s)},e.killTweensOf=function(i,s,a){return It.killTweensOf(i,s,a)},e})(Ya);ri(Zt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});kn("staggerTo,staggerFrom,staggerFromTo",function(r){Zt[r]=function(){var e=new On,t=Lc.call(arguments,0);return t.splice(r==="staggerFromTo"?5:4,0,0),e[r].apply(e,t)}});var ef=function(e,t,n){return e[t]=n},hp=function(e,t,n){return e[t](n)},Hg=function(e,t,n,i){return e[t](i.fp,n)},Wg=function(e,t,n){return e.setAttribute(t,n)},tf=function(e,t){return kt(e[t])?hp:Wu(e[t])&&e.setAttribute?Wg:ef},pp=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},Xg=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},mp=function(e,t){var n=t._pt,i="";if(!e&&t.b)i=t.b;else if(e===1&&t.e)i=t.e;else{for(;n;)i=n.p+(n.m?n.m(n.s+n.c*e):Math.round((n.s+n.c*e)*1e4)/1e4)+i,n=n._next;i+=t.c}t.set(t.t,t.p,i,t)},nf=function(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next},Yg=function(e,t,n,i){for(var s=this._pt,a;s;)a=s._next,s.p===i&&s.modifier(e,t,n),s=a},qg=function(e){for(var t=this._pt,n,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?El(this,t,"_pt"):t.dep||(n=1),t=i;return!n},$g=function(e,t,n,i){i.mSet(e,t,i.m.call(i.tween,n,i.mt),i)},gp=function(e){for(var t=e._pt,n,i,s,a;t;){for(n=t._next,i=s;i&&i.pr>t.pr;)i=i._next;(t._prev=i?i._prev:a)?t._prev._next=t:s=t,(t._next=i)?i._prev=t:a=t,t=n}e._pt=s},zn=(function(){function r(t,n,i,s,a,o,l,c,u){this.t=n,this.s=s,this.c=a,this.p=i,this.r=o||pp,this.d=l||this,this.set=c||ef,this.pr=u||0,this._next=t,t&&(t._prev=this)}var e=r.prototype;return e.modifier=function(n,i,s){this.mSet=this.mSet||this.set,this.set=$g,this.m=n,this.mt=s,this.tween=i},r})();kn(Ku+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger,easeReverse",function(r){return $u[r]=1});ii.TweenMax=ii.TweenLite=Zt;ii.TimelineLite=ii.TimelineMax=On;It=new On({sortChildren:!1,defaults:Ga,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});ni.stringFilter=op;var es=[],qo={},Kg=[],qf=0,Zg=0,kl=function(e){return(qo[e]||Kg).map(function(t){return t()})},Fc=function(){var e=Date.now(),t=[];e-qf>2&&(kl("matchMediaInit"),es.forEach(function(n){var i=n.queries,s=n.conditions,a,o,l,c;for(o in i)a=Ci.matchMedia(i[o]).matches,a&&(l=1),a!==s[o]&&(s[o]=a,c=1);c&&(n.revert(),l&&t.push(n))}),kl("matchMediaRevert"),t.forEach(function(n){return n.onMatch(n,function(i){return n.add(null,i)})}),qf=e,kl("matchMedia"))},_p=(function(){function r(t,n){this.selector=n&&Nc(n),this.data=[],this._r=[],this.isReverted=!1,this.id=Zg++,t&&this.add(t)}var e=r.prototype;return e.add=function(n,i,s){kt(n)&&(s=i,i=n,n=kt);var a=this,o=function(){var c=Lt,u=a.selector,h;return c&&c!==a&&c.data.push(a),s&&(a.selector=Nc(s)),Lt=a,h=i.apply(a,arguments),kt(h)&&a._r.push(h),Lt=c,a.selector=u,a.isReverted=!1,h};return a.last=o,n===kt?o(a,function(l){return a.add(null,l)}):n?a[n]=o:o},e.ignore=function(n){var i=Lt;Lt=null,n(this),Lt=i},e.getTweens=function(){var n=[];return this.data.forEach(function(i){return i instanceof r?n.push.apply(n,i.getTweens()):i instanceof Zt&&!(i.parent&&i.parent.data==="nested")&&n.push(i)}),n},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(n,i){var s=this;if(n?(function(){for(var o=s.getTweens(),l=s.data.length,c;l--;)c=s.data[l],c.data==="isFlip"&&(c.revert(),c.getChildren(!0,!0,!1).forEach(function(u){return o.splice(o.indexOf(u),1)}));for(o.map(function(u){return{g:u._dur||u._delay||u._sat&&!u._sat.vars.immediateRender?u.globalTime(0):-1/0,t:u}}).sort(function(u,h){return h.g-u.g||-1/0}).forEach(function(u){return u.t.revert(n)}),l=s.data.length;l--;)c=s.data[l],c instanceof On?c.data!=="nested"&&(c.scrollTrigger&&c.scrollTrigger.revert(),c.kill()):!(c instanceof Zt)&&c.revert&&c.revert(n);s._r.forEach(function(u){return u(n,s)}),s.isReverted=!0})():this.data.forEach(function(o){return o.kill&&o.kill()}),this.clear(),i)for(var a=es.length;a--;)es[a].id===this.id&&es.splice(a,1)},e.revert=function(n){this.kill(n||{})},r})(),jg=(function(){function r(t){this.contexts=[],this.scope=t,Lt&&Lt.data.push(this)}var e=r.prototype;return e.add=function(n,i,s){zi(n)||(n={matches:n});var a=new _p(0,s||this.scope),o=a.conditions={},l,c,u;Lt&&!a.selector&&(a.selector=Lt.selector),this.contexts.push(a),i=a.add("onMatch",i),a.queries=n;for(c in n)c==="all"?u=1:(l=Ci.matchMedia(n[c]),l&&(es.indexOf(a)<0&&es.push(a),(o[c]=l.matches)&&(u=1),l.addListener?l.addListener(Fc):l.addEventListener("change",Fc)));return u&&i(a,function(h){return a.add(null,h)}),this},e.revert=function(n){this.kill(n||{})},e.kill=function(n){this.contexts.forEach(function(i){return i.kill(n,!0)})},r})(),ul={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach(function(i){return rp(i)})},timeline:function(e){return new On(e)},getTweensOf:function(e,t){return It.getTweensOf(e,t)},getProperty:function(e,t,n,i){un(e)&&(e=mi(e)[0]);var s=jr(e||{}).get,a=n?Xh:Wh;return n==="native"&&(n=""),e&&(t?a((Zn[t]&&Zn[t].get||s)(e,t,n,i)):function(o,l,c){return a((Zn[o]&&Zn[o].get||s)(e,o,l,c))})},quickSetter:function(e,t,n){if(e=mi(e),e.length>1){var i=e.map(function(u){return Wn.quickSetter(u,t,n)}),s=i.length;return function(u){for(var h=s;h--;)i[h](u)}}e=e[0]||{};var a=Zn[t],o=jr(e),l=o.harness&&(o.harness.aliases||{})[t]||t,c=a?function(u){var h=new a;Bs._pt=0,h.init(e,n?u+n:u,Bs,0,[e]),h.render(1,h),Bs._pt&&nf(1,Bs)}:o.set(e,l);return a?c:function(u){return c(e,l,n?u+n:u,o,1)}},quickTo:function(e,t,n){var i,s=Wn.to(e,ri((i={},i[t]="+=0.1",i.paused=!0,i.stagger=0,i),n||{})),a=function(l,c,u){return s.resetTo(t,l,c,u)};return a.tween=s,a},isTweening:function(e){return It.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=Qr(e.ease,Ga.ease)),Vf(Ga,e||{})},config:function(e){return Vf(ni,e||{})},registerEffect:function(e){var t=e.name,n=e.effect,i=e.plugins,s=e.defaults,a=e.extendTimeline;(i||"").split(",").forEach(function(o){return o&&!Zn[o]&&!ii[o]&&Va(t+" effect requires "+o+" plugin.")}),Ul[t]=function(o,l,c){return n(mi(o),ri(l||{},s),c)},a&&(On.prototype[t]=function(o,l,c){return this.add(Ul[t](o,zi(l)?l:(c=l)&&{},this),c)})},registerEase:function(e,t){ut[e]=Qr(t)},parseEase:function(e,t){return arguments.length?Qr(e,t):ut},getById:function(e){return It.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var n=new On(e),i,s;for(n.smoothChildTiming=Bn(e.smoothChildTiming),It.remove(n),n._dp=0,n._time=n._tTime=It._time,i=It._first;i;)s=i._next,(t||!(!i._dur&&i instanceof Zt&&i.vars.onComplete===i._targets[0]))&&Li(n,i,i._start-i._delay),i=s;return Li(It,n,0),n},context:function(e,t){return e?new _p(e,t):Lt},matchMedia:function(e){return new jg(e)},matchMediaRefresh:function(){return es.forEach(function(e){var t=e.conditions,n,i;for(i in t)t[i]&&(t[i]=!1,n=1);n&&e.revert()})||Fc()},addEventListener:function(e,t){var n=qo[e]||(qo[e]=[]);~n.indexOf(t)||n.push(t)},removeEventListener:function(e,t){var n=qo[e],i=n&&n.indexOf(t);i>=0&&n.splice(i,1)},utils:{wrap:Rg,wrapYoyo:Cg,distribute:Jh,random:ep,snap:Qh,normalize:Ag,getUnit:Sn,clamp:yg,splitColor:sp,toArray:mi,selector:Nc,mapRange:np,pipe:Tg,unitize:wg,interpolate:Pg,shuffle:jh},install:kh,effects:Ul,ticker:Jn,updateRoot:On.updateRoot,plugins:Zn,globalTimeline:It,core:{PropTween:zn,globals:zh,Tween:Zt,Timeline:On,Animation:Ya,getCache:jr,_removeLinkedListItem:El,reverting:function(){return hn},context:function(e){return e&&Lt&&(Lt.data.push(e),e._ctx=Lt),Lt},suppressOverwrites:function(e){return Hu=e}}};kn("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return ul[r]=Zt[r]});Jn.add(On.updateRoot);Bs=ul.to({},{duration:0});var Jg=function(e,t){for(var n=e._pt;n&&n.p!==t&&n.op!==t&&n.fp!==t;)n=n._next;return n},Qg=function(e,t){var n=e._targets,i,s,a;for(i in t)for(s=n.length;s--;)a=e._ptLookup[s][i],a&&(a=a.d)&&(a._pt&&(a=Jg(a,i)),a&&a.modifier&&a.modifier(t[i],e,n[s],i))},zl=function(e,t){return{name:e,headless:1,rawVars:1,init:function(i,s,a){a._onInit=function(o){var l,c;if(un(s)&&(l={},kn(s,function(u){return l[u]=1}),s=l),t){l={};for(c in s)l[c]=t(s[c]);s=l}Qg(o,s)}}}},Wn=ul.registerPlugin({name:"attr",init:function(e,t,n,i,s){var a,o,l;this.tween=n;for(a in t)l=e.getAttribute(a)||"",o=this.add(e,"setAttribute",(l||0)+"",t[a],i,s,0,0,a),o.op=a,o.b=l,this._props.push(a)},render:function(e,t){for(var n=t._pt;n;)hn?n.set(n.t,n.p,n.b,n):n.r(e,n.d),n=n._next}},{name:"endArray",headless:1,init:function(e,t){for(var n=t.length;n--;)this.add(e,n,e[n]||0,t[n],0,0,0,0,0,1)}},zl("roundProps",Ic),zl("modifiers"),zl("snap",Qh))||ul;Zt.version=On.version=Wn.version="3.15.0";Bh=1;Xu()&&Qs();ut.Power0;ut.Power1;ut.Power2;ut.Power3;ut.Power4;ut.Linear;ut.Quad;ut.Cubic;ut.Quart;ut.Quint;ut.Strong;ut.Elastic;ut.Back;ut.SteppedEase;ut.Bounce;ut.Sine;ut.Expo;ut.Circ;var $f,Mr,Gs,rf,qr,Kf,sf,e_=function(){return typeof window<"u"},rr={},Gr=180/Math.PI,Vs=Math.PI/180,ms=Math.atan2,Zf=1e8,af=/([A-Z])/g,t_=/(left|right|width|margin|padding|x)/i,n_=/[\s,\(]\S/,Ni={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Oc=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},i_=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},r_=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},s_=function(e,t){return t.set(t.t,t.p,e===1?t.e:e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},a_=function(e,t){var n=t.s+t.c*e;t.set(t.t,t.p,~~(n+(n<0?-.5:.5))+t.u,t)},xp=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},vp=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},o_=function(e,t,n){return e.style[t]=n},l_=function(e,t,n){return e.style.setProperty(t,n)},c_=function(e,t,n){return e._gsap[t]=n},u_=function(e,t,n){return e._gsap.scaleX=e._gsap.scaleY=n},f_=function(e,t,n,i,s){var a=e._gsap;a.scaleX=a.scaleY=n,a.renderTransform(s,a)},d_=function(e,t,n,i,s){var a=e._gsap;a[t]=n,a.renderTransform(s,a)},Ut="transform",Gn=Ut+"Origin",h_=function r(e,t){var n=this,i=this.target,s=i.style,a=i._gsap;if(e in rr&&s){if(this.tfm=this.tfm||{},e!=="transform")e=Ni[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return n.tfm[o]=$i(i,o)}):this.tfm[e]=a.x?a[e]:$i(i,e),e===Gn&&(this.tfm.zOrigin=a.zOrigin);else return Ni.transform.split(",").forEach(function(o){return r.call(n,o,t)});if(this.props.indexOf(Ut)>=0)return;a.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(Gn,t,"")),e=Ut}(s||t)&&this.props.push(e,t,s[e])},Mp=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},p_=function(){var e=this.props,t=this.target,n=t.style,i=t._gsap,s,a;for(s=0;s<e.length;s+=3)e[s+1]?e[s+1]===2?t[e[s]](e[s+2]):t[e[s]]=e[s+2]:e[s+2]?n[e[s]]=e[s+2]:n.removeProperty(e[s].substr(0,2)==="--"?e[s]:e[s].replace(af,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)i[a]=this.tfm[a];i.svg&&(i.renderTransform(),t.setAttribute("data-svg-origin",this.svgo||"")),s=sf(),(!s||!s.isStart)&&!n[Ut]&&(Mp(n),i.zOrigin&&n[Gn]&&(n[Gn]+=" "+i.zOrigin+"px",i.zOrigin=0,i.renderTransform()),i.uncache=1)}},Sp=function(e,t){var n={target:e,props:[],revert:p_,save:h_};return e._gsap||Wn.core.getCache(e),t&&e.style&&e.nodeType&&t.split(",").forEach(function(i){return n.save(i)}),n},bp,Bc=function(e,t){var n=Mr.createElementNS?Mr.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):Mr.createElement(e);return n&&n.style?n:Mr.createElement(e)},ti=function r(e,t,n){var i=getComputedStyle(e);return i[t]||i.getPropertyValue(t.replace(af,"-$1").toLowerCase())||i.getPropertyValue(t)||!n&&r(e,ea(t)||t,1)||""},jf="O,Moz,ms,Ms,Webkit".split(","),ea=function(e,t,n){var i=t||qr,s=i.style,a=5;if(e in s&&!n)return e;for(e=e.charAt(0).toUpperCase()+e.substr(1);a--&&!(jf[a]+e in s););return a<0?null:(a===3?"ms":a>=0?jf[a]:"")+e},kc=function(){e_()&&window.document&&($f=window,Mr=$f.document,Gs=Mr.documentElement,qr=Bc("div")||{style:{}},Bc("div"),Ut=ea(Ut),Gn=Ut+"Origin",qr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",bp=!!ea("perspective"),sf=Wn.core.reverting,rf=1)},Jf=function(e){var t=e.ownerSVGElement,n=Bc("svg",t&&t.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=e.cloneNode(!0),s;i.style.display="block",n.appendChild(i),Gs.appendChild(n);try{s=i.getBBox()}catch{}return n.removeChild(i),Gs.removeChild(n),s},Qf=function(e,t){for(var n=t.length;n--;)if(e.hasAttribute(t[n]))return e.getAttribute(t[n])},yp=function(e){var t,n;try{t=e.getBBox()}catch{t=Jf(e),n=1}return t&&(t.width||t.height)||n||(t=Jf(e)),t&&!t.width&&!t.x&&!t.y?{x:+Qf(e,["x","cx","x1"])||0,y:+Qf(e,["y","cy","y1"])||0,width:0,height:0}:t},Ep=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&yp(e))},Pr=function(e,t){if(t){var n=e.style,i;t in rr&&t!==Gn&&(t=Ut),n.removeProperty?(i=t.substr(0,2),(i==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),n.removeProperty(i==="--"?t:t.replace(af,"-$1").toLowerCase())):n.removeAttribute(t)}},Sr=function(e,t,n,i,s,a){var o=new zn(e._pt,t,n,0,1,a?vp:xp);return e._pt=o,o.b=i,o.e=s,e._props.push(n),o},ed={deg:1,rad:1,turn:1},m_={grid:1,flex:1},Dr=function r(e,t,n,i){var s=parseFloat(n)||0,a=(n+"").trim().substr((s+"").length)||"px",o=qr.style,l=t_.test(t),c=e.tagName.toLowerCase()==="svg",u=(c?"client":"offset")+(l?"Width":"Height"),h=100,f=i==="px",d=i==="%",g,_,p,m;if(i===a||!s||ed[i]||ed[a])return s;if(a!=="px"&&!f&&(s=r(e,t,n,"px")),m=e.getCTM&&Ep(e),(d||a==="%")&&(rr[t]||~t.indexOf("adius")))return g=m?e.getBBox()[l?"width":"height"]:e[u],Ht(d?s/g*h:s/100*g);if(o[l?"width":"height"]=h+(f?a:i),_=i!=="rem"&&~t.indexOf("adius")||i==="em"&&e.appendChild&&!c?e:e.parentNode,m&&(_=(e.ownerSVGElement||{}).parentNode),(!_||_===Mr||!_.appendChild)&&(_=Mr.body),p=_._gsap,p&&d&&p.width&&l&&p.time===Jn.time&&!p.uncache)return Ht(s/p.width*h);if(d&&(t==="height"||t==="width")){var b=e.style[t];e.style[t]=h+i,g=e[u],b?e.style[t]=b:Pr(e,t)}else(d||a==="%")&&!m_[ti(_,"display")]&&(o.position=ti(e,"position")),_===e&&(o.position="static"),_.appendChild(qr),g=qr[u],_.removeChild(qr),o.position="absolute";return l&&d&&(p=jr(_),p.time=Jn.time,p.width=_[u]),Ht(f?g*s/h:g&&s?h/g*s:0)},$i=function(e,t,n,i){var s;return rf||kc(),t in Ni&&t!=="transform"&&(t=Ni[t],~t.indexOf(",")&&(t=t.split(",")[0])),rr[t]&&t!=="transform"?(s=$a(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:dl(ti(e,Gn))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=fl[t]&&fl[t](e,t,n)||ti(e,t)||Vh(e,t)||(t==="opacity"?1:0))),n&&!~(s+"").trim().indexOf(" ")?Dr(e,t,s,n)+n:s},g_=function(e,t,n,i){if(!n||n==="none"){var s=ea(t,e,1),a=s&&ti(e,s,1);a&&a!==n?(t=s,n=a):t==="borderColor"&&(n=ti(e,"borderTopColor"))}var o=new zn(this._pt,e.style,t,0,1,mp),l=0,c=0,u,h,f,d,g,_,p,m,b,A,M,y;if(o.b=n,o.e=i,n+="",i+="",i.substring(0,6)==="var(--"&&(i=ti(e,i.substring(4,i.indexOf(")")))),i==="auto"&&(_=e.style[t],e.style[t]=i,i=ti(e,t)||i,_?e.style[t]=_:Pr(e,t)),u=[n,i],op(u),n=u[0],i=u[1],f=n.match(Os)||[],y=i.match(Os)||[],y.length){for(;h=Os.exec(i);)p=h[0],b=i.substring(l,h.index),g?g=(g+1)%5:(b.substr(-5)==="rgba("||b.substr(-5)==="hsla(")&&(g=1),p!==(_=f[c++]||"")&&(d=parseFloat(_)||0,M=_.substr((d+"").length),p.charAt(1)==="="&&(p=zs(d,p)+M),m=parseFloat(p),A=p.substr((m+"").length),l=Os.lastIndex-A.length,A||(A=A||ni.units[t]||M,l===i.length&&(i+=A,o.e+=A)),M!==A&&(d=Dr(e,t,_,A)||0),o._pt={_next:o._pt,p:b||c===1?b:",",s:d,c:m-d,m:g&&g<4||t==="zIndex"?Math.round:0});o.c=l<i.length?i.substring(l,i.length):""}else o.r=t==="display"&&i==="none"?vp:xp;return Oh.test(i)&&(o.e=0),this._pt=o,o},td={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},__=function(e){var t=e.split(" "),n=t[0],i=t[1]||"50%";return(n==="top"||n==="bottom"||i==="left"||i==="right")&&(e=n,n=i,i=e),t[0]=td[n]||n,t[1]=td[i]||i,t.join(" ")},x_=function(e,t){if(t.tween&&t.tween._time===t.tween._dur){var n=t.t,i=n.style,s=t.u,a=n._gsap,o,l,c;if(s==="all"||s===!0)i.cssText="",l=1;else for(s=s.split(","),c=s.length;--c>-1;)o=s[c],rr[o]&&(l=1,o=o==="transformOrigin"?Gn:Ut),Pr(n,o);l&&(Pr(n,Ut),a&&(a.svg&&n.removeAttribute("transform"),i.scale=i.rotate=i.translate="none",$a(n,1),a.uncache=1,Mp(i)))}},fl={clearProps:function(e,t,n,i,s){if(s.data!=="isFromStart"){var a=e._pt=new zn(e._pt,t,n,0,0,x_);return a.u=i,a.pr=-10,a.tween=s,e._props.push(n),1}}},qa=[1,0,0,1,0,0],Tp={},wp=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},nd=function(e){var t=ti(e,Ut);return wp(t)?qa:t.substr(7).match(Fh).map(Ht)},of=function(e,t){var n=e._gsap||jr(e),i=e.style,s=nd(e),a,o,l,c;return n.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?qa:s):(s===qa&&!e.offsetParent&&e!==Gs&&!n.svg&&(l=i.display,i.display="block",a=e.parentNode,(!a||!e.offsetParent&&!e.getBoundingClientRect().width)&&(c=1,o=e.nextElementSibling,Gs.appendChild(e)),s=nd(e),l?i.display=l:Pr(e,"display"),c&&(o?a.insertBefore(e,o):a?a.appendChild(e):Gs.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},zc=function(e,t,n,i,s,a){var o=e._gsap,l=s||of(e,!0),c=o.xOrigin||0,u=o.yOrigin||0,h=o.xOffset||0,f=o.yOffset||0,d=l[0],g=l[1],_=l[2],p=l[3],m=l[4],b=l[5],A=t.split(" "),M=parseFloat(A[0])||0,y=parseFloat(A[1])||0,T,w,v,E;n?l!==qa&&(w=d*p-g*_)&&(v=M*(p/w)+y*(-_/w)+(_*b-p*m)/w,E=M*(-g/w)+y*(d/w)-(d*b-g*m)/w,M=v,y=E):(T=yp(e),M=T.x+(~A[0].indexOf("%")?M/100*T.width:M),y=T.y+(~(A[1]||A[0]).indexOf("%")?y/100*T.height:y)),i||i!==!1&&o.smooth?(m=M-c,b=y-u,o.xOffset=h+(m*d+b*_)-m,o.yOffset=f+(m*g+b*p)-b):o.xOffset=o.yOffset=0,o.xOrigin=M,o.yOrigin=y,o.smooth=!!i,o.origin=t,o.originIsAbsolute=!!n,e.style[Gn]="0px 0px",a&&(Sr(a,o,"xOrigin",c,M),Sr(a,o,"yOrigin",u,y),Sr(a,o,"xOffset",h,o.xOffset),Sr(a,o,"yOffset",f,o.yOffset)),e.setAttribute("data-svg-origin",M+" "+y)},$a=function(e,t){var n=e._gsap||new cp(e);if("x"in n&&!t&&!n.uncache)return n;var i=e.style,s=n.scaleX<0,a="px",o="deg",l=getComputedStyle(e),c=ti(e,Gn)||"0",u,h,f,d,g,_,p,m,b,A,M,y,T,w,v,E,C,L,N,Y,H,O,z,I,W,Z,D,re,he,He,Be,Pe;return u=h=f=_=p=m=b=A=M=0,d=g=1,n.svg=!!(e.getCTM&&Ep(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Ut]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Ut]!=="none"?l[Ut]:"")),i.scale=i.rotate=i.translate="none"),w=of(e,n.svg),n.svg&&(n.uncache?(W=e.getBBox(),c=n.xOrigin-W.x+"px "+(n.yOrigin-W.y)+"px",I=""):I=!t&&e.getAttribute("data-svg-origin"),zc(e,I||c,!!I||n.originIsAbsolute,n.smooth!==!1,w)),y=n.xOrigin||0,T=n.yOrigin||0,w!==qa&&(L=w[0],N=w[1],Y=w[2],H=w[3],u=O=w[4],h=z=w[5],w.length===6?(d=Math.sqrt(L*L+N*N),g=Math.sqrt(H*H+Y*Y),_=L||N?ms(N,L)*Gr:0,b=Y||H?ms(Y,H)*Gr+_:0,b&&(g*=Math.abs(Math.cos(b*Vs))),n.svg&&(u-=y-(y*L+T*Y),h-=T-(y*N+T*H))):(Pe=w[6],He=w[7],D=w[8],re=w[9],he=w[10],Be=w[11],u=w[12],h=w[13],f=w[14],v=ms(Pe,he),p=v*Gr,v&&(E=Math.cos(-v),C=Math.sin(-v),I=O*E+D*C,W=z*E+re*C,Z=Pe*E+he*C,D=O*-C+D*E,re=z*-C+re*E,he=Pe*-C+he*E,Be=He*-C+Be*E,O=I,z=W,Pe=Z),v=ms(-Y,he),m=v*Gr,v&&(E=Math.cos(-v),C=Math.sin(-v),I=L*E-D*C,W=N*E-re*C,Z=Y*E-he*C,Be=H*C+Be*E,L=I,N=W,Y=Z),v=ms(N,L),_=v*Gr,v&&(E=Math.cos(v),C=Math.sin(v),I=L*E+N*C,W=O*E+z*C,N=N*E-L*C,z=z*E-O*C,L=I,O=W),p&&Math.abs(p)+Math.abs(_)>359.9&&(p=_=0,m=180-m),d=Ht(Math.sqrt(L*L+N*N+Y*Y)),g=Ht(Math.sqrt(z*z+Pe*Pe)),v=ms(O,z),b=Math.abs(v)>2e-4?v*Gr:0,M=Be?1/(Be<0?-Be:Be):0),n.svg&&(I=e.getAttribute("transform"),n.forceCSS=e.setAttribute("transform","")||!wp(ti(e,Ut)),I&&e.setAttribute("transform",I))),Math.abs(b)>90&&Math.abs(b)<270&&(s?(d*=-1,b+=_<=0?180:-180,_+=_<=0?180:-180):(g*=-1,b+=b<=0?180:-180)),t=t||n.uncache,n.x=u-((n.xPercent=u&&(!t&&n.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-u)?-50:0)))?e.offsetWidth*n.xPercent/100:0)+a,n.y=h-((n.yPercent=h&&(!t&&n.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-h)?-50:0)))?e.offsetHeight*n.yPercent/100:0)+a,n.z=f+a,n.scaleX=Ht(d),n.scaleY=Ht(g),n.rotation=Ht(_)+o,n.rotationX=Ht(p)+o,n.rotationY=Ht(m)+o,n.skewX=b+o,n.skewY=A+o,n.transformPerspective=M+a,(n.zOrigin=parseFloat(c.split(" ")[2])||!t&&n.zOrigin||0)&&(i[Gn]=dl(c)),n.xOffset=n.yOffset=0,n.force3D=ni.force3D,n.renderTransform=n.svg?M_:bp?Ap:v_,n.uncache=0,n},dl=function(e){return(e=e.split(" "))[0]+" "+e[1]},Gl=function(e,t,n){var i=Sn(t);return Ht(parseFloat(t)+parseFloat(Dr(e,"x",n+"px",i)))+i},v_=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,Ap(e,t)},Ur="0deg",ca="0px",Fr=") ",Ap=function(e,t){var n=t||this,i=n.xPercent,s=n.yPercent,a=n.x,o=n.y,l=n.z,c=n.rotation,u=n.rotationY,h=n.rotationX,f=n.skewX,d=n.skewY,g=n.scaleX,_=n.scaleY,p=n.transformPerspective,m=n.force3D,b=n.target,A=n.zOrigin,M="",y=m==="auto"&&e&&e!==1||m===!0;if(A&&(h!==Ur||u!==Ur)){var T=parseFloat(u)*Vs,w=Math.sin(T),v=Math.cos(T),E;T=parseFloat(h)*Vs,E=Math.cos(T),a=Gl(b,a,w*E*-A),o=Gl(b,o,-Math.sin(T)*-A),l=Gl(b,l,v*E*-A+A)}p!==ca&&(M+="perspective("+p+Fr),(i||s)&&(M+="translate("+i+"%, "+s+"%) "),(y||a!==ca||o!==ca||l!==ca)&&(M+=l!==ca||y?"translate3d("+a+", "+o+", "+l+") ":"translate("+a+", "+o+Fr),c!==Ur&&(M+="rotate("+c+Fr),u!==Ur&&(M+="rotateY("+u+Fr),h!==Ur&&(M+="rotateX("+h+Fr),(f!==Ur||d!==Ur)&&(M+="skew("+f+", "+d+Fr),(g!==1||_!==1)&&(M+="scale("+g+", "+_+Fr),b.style[Ut]=M||"translate(0, 0)"},M_=function(e,t){var n=t||this,i=n.xPercent,s=n.yPercent,a=n.x,o=n.y,l=n.rotation,c=n.skewX,u=n.skewY,h=n.scaleX,f=n.scaleY,d=n.target,g=n.xOrigin,_=n.yOrigin,p=n.xOffset,m=n.yOffset,b=n.forceCSS,A=parseFloat(a),M=parseFloat(o),y,T,w,v,E;l=parseFloat(l),c=parseFloat(c),u=parseFloat(u),u&&(u=parseFloat(u),c+=u,l+=u),l||c?(l*=Vs,c*=Vs,y=Math.cos(l)*h,T=Math.sin(l)*h,w=Math.sin(l-c)*-f,v=Math.cos(l-c)*f,c&&(u*=Vs,E=Math.tan(c-u),E=Math.sqrt(1+E*E),w*=E,v*=E,u&&(E=Math.tan(u),E=Math.sqrt(1+E*E),y*=E,T*=E)),y=Ht(y),T=Ht(T),w=Ht(w),v=Ht(v)):(y=h,v=f,T=w=0),(A&&!~(a+"").indexOf("px")||M&&!~(o+"").indexOf("px"))&&(A=Dr(d,"x",a,"px"),M=Dr(d,"y",o,"px")),(g||_||p||m)&&(A=Ht(A+g-(g*y+_*w)+p),M=Ht(M+_-(g*T+_*v)+m)),(i||s)&&(E=d.getBBox(),A=Ht(A+i/100*E.width),M=Ht(M+s/100*E.height)),E="matrix("+y+","+T+","+w+","+v+","+A+","+M+")",d.setAttribute("transform",E),b&&(d.style[Ut]=E)},S_=function(e,t,n,i,s){var a=360,o=un(s),l=parseFloat(s)*(o&&~s.indexOf("rad")?Gr:1),c=l-i,u=i+c+"deg",h,f;return o&&(h=s.split("_")[1],h==="short"&&(c%=a,c!==c%(a/2)&&(c+=c<0?a:-a)),h==="cw"&&c<0?c=(c+a*Zf)%a-~~(c/a)*a:h==="ccw"&&c>0&&(c=(c-a*Zf)%a-~~(c/a)*a)),e._pt=f=new zn(e._pt,t,n,i,c,i_),f.e=u,f.u="deg",e._props.push(n),f},id=function(e,t){for(var n in t)e[n]=t[n];return e},b_=function(e,t,n){var i=id({},n._gsap),s="perspective,force3D,transformOrigin,svgOrigin",a=n.style,o,l,c,u,h,f,d,g;i.svg?(c=n.getAttribute("transform"),n.setAttribute("transform",""),a[Ut]=t,o=$a(n,1),Pr(n,Ut),n.setAttribute("transform",c)):(c=getComputedStyle(n)[Ut],a[Ut]=t,o=$a(n,1),a[Ut]=c);for(l in rr)c=i[l],u=o[l],c!==u&&s.indexOf(l)<0&&(d=Sn(c),g=Sn(u),h=d!==g?Dr(n,l,c,g):parseFloat(c),f=parseFloat(u),e._pt=new zn(e._pt,o,l,h,f-h,Oc),e._pt.u=g||0,e._props.push(l));id(o,i)};kn("padding,margin,Width,Radius",function(r,e){var t="Top",n="Right",i="Bottom",s="Left",a=(e<3?[t,n,i,s]:[t+s,t+n,i+n,i+s]).map(function(o){return e<2?r+o:"border"+o+r});fl[e>1?"border"+r:r]=function(o,l,c,u,h){var f,d;if(arguments.length<4)return f=a.map(function(g){return $i(o,g,c)}),d=f.join(" "),d.split(f[0]).length===5?f[0]:d;f=(u+"").split(" "),d={},a.forEach(function(g,_){return d[g]=f[_]=f[_]||f[(_-1)/2|0]}),o.init(l,d,h)}});var Rp={name:"css",register:kc,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,n,i,s){var a=this._props,o=e.style,l=n.vars.startAt,c,u,h,f,d,g,_,p,m,b,A,M,y,T,w,v,E;rf||kc(),this.styles=this.styles||Sp(e),v=this.styles.props,this.tween=n;for(_ in t)if(_!=="autoRound"&&(u=t[_],!(Zn[_]&&up(_,t,n,i,e,s)))){if(d=typeof u,g=fl[_],d==="function"&&(u=u.call(n,i,e,s),d=typeof u),d==="string"&&~u.indexOf("random(")&&(u=Wa(u)),g)g(this,e,_,u,n)&&(w=1);else if(_.substr(0,2)==="--")c=(getComputedStyle(e).getPropertyValue(_)+"").trim(),u+="",Ar.lastIndex=0,Ar.test(c)||(p=Sn(c),m=Sn(u),m?p!==m&&(c=Dr(e,_,c,m)+m):p&&(u+=p)),this.add(o,"setProperty",c,u,i,s,0,0,_),a.push(_),v.push(_,0,o[_]);else if(d!=="undefined"){if(l&&_ in l?(c=typeof l[_]=="function"?l[_].call(n,i,e,s):l[_],un(c)&&~c.indexOf("random(")&&(c=Wa(c)),Sn(c+"")||c==="auto"||(c+=ni.units[_]||Sn($i(e,_))||""),(c+"").charAt(1)==="="&&(c=$i(e,_))):c=$i(e,_),f=parseFloat(c),b=d==="string"&&u.charAt(1)==="="&&u.substr(0,2),b&&(u=u.substr(2)),h=parseFloat(u),_ in Ni&&(_==="autoAlpha"&&(f===1&&$i(e,"visibility")==="hidden"&&h&&(f=0),v.push("visibility",0,o.visibility),Sr(this,o,"visibility",f?"inherit":"hidden",h?"inherit":"hidden",!h)),_!=="scale"&&_!=="transform"&&(_=Ni[_],~_.indexOf(",")&&(_=_.split(",")[0]))),A=_ in rr,A){if(this.styles.save(_),E=u,d==="string"&&u.substring(0,6)==="var(--"){if(u=ti(e,u.substring(4,u.indexOf(")"))),u.substring(0,5)==="calc("){var C=e.style.perspective;e.style.perspective=u,u=ti(e,"perspective"),C?e.style.perspective=C:Pr(e,"perspective")}h=parseFloat(u)}if(M||(y=e._gsap,y.renderTransform&&!t.parseTransform||$a(e,t.parseTransform),T=t.smoothOrigin!==!1&&y.smooth,M=this._pt=new zn(this._pt,o,Ut,0,1,y.renderTransform,y,0,-1),M.dep=1),_==="scale")this._pt=new zn(this._pt,y,"scaleY",y.scaleY,(b?zs(y.scaleY,b+h):h)-y.scaleY||0,Oc),this._pt.u=0,a.push("scaleY",_),_+="X";else if(_==="transformOrigin"){v.push(Gn,0,o[Gn]),u=__(u),y.svg?zc(e,u,0,T,0,this):(m=parseFloat(u.split(" ")[2])||0,m!==y.zOrigin&&Sr(this,y,"zOrigin",y.zOrigin,m),Sr(this,o,_,dl(c),dl(u)));continue}else if(_==="svgOrigin"){zc(e,u,1,T,0,this);continue}else if(_ in Tp){S_(this,y,_,f,b?zs(f,b+u):u);continue}else if(_==="smoothOrigin"){Sr(this,y,"smooth",y.smooth,u);continue}else if(_==="force3D"){y[_]=u;continue}else if(_==="transform"){b_(this,u,e);continue}}else _ in o||(_=ea(_)||_);if(A||(h||h===0)&&(f||f===0)&&!n_.test(u)&&_ in o)p=(c+"").substr((f+"").length),h||(h=0),m=Sn(u)||(_ in ni.units?ni.units[_]:p),p!==m&&(f=Dr(e,_,c,m)),this._pt=new zn(this._pt,A?y:o,_,f,(b?zs(f,b+h):h)-f,!A&&(m==="px"||_==="zIndex")&&t.autoRound!==!1?a_:Oc),this._pt.u=m||0,A&&E!==u?(this._pt.b=c,this._pt.e=E,this._pt.r=s_):p!==m&&m!=="%"&&(this._pt.b=c,this._pt.r=r_);else if(_ in o)g_.call(this,e,_,c,b?b+u:u);else if(_ in e)this.add(e,_,c||e[_],b?b+u:u,i,s);else if(_!=="parseTransform"){qu(_,u);continue}A||(_ in o?v.push(_,0,o[_]):typeof e[_]=="function"?v.push(_,2,e[_]()):v.push(_,1,c||e[_])),a.push(_)}}w&&gp(this)},render:function(e,t){if(t.tween._time||!sf())for(var n=t._pt;n;)n.r(e,n.d),n=n._next;else t.styles.revert()},get:$i,aliases:Ni,getSetter:function(e,t,n){var i=Ni[t];return i&&i.indexOf(",")<0&&(t=i),t in rr&&t!==Gn&&(e._gsap.x||$i(e,"x"))?n&&Kf===n?t==="scale"?u_:c_:(Kf=n||{})&&(t==="scale"?f_:d_):e.style&&!Wu(e.style[t])?o_:~t.indexOf("-")?l_:tf(e,t)},core:{_removeProperty:Pr,_getMatrix:of}};Wn.utils.checkPrefix=ea;Wn.core.getStyleSaver=Sp;(function(r,e,t,n){var i=kn(r+","+e+","+t,function(s){rr[s]=1});kn(e,function(s){ni.units[s]="deg",Tp[s]=1}),Ni[i[13]]=r+","+e,kn(n,function(s){var a=s.split(":");Ni[a[1]]=i[a[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");kn("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){ni.units[r]="px"});Wn.registerPlugin(Rp);var Dt=Wn.registerPlugin(Rp)||Wn;Dt.core.Tween;function y_(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function E_(r,e,t){return e&&y_(r.prototype,e),r}var fn,$o,Qn,br,yr,Hs,Cp,Vr,Ws,Pp,ji,Mi,Dp,Lp=function(){return fn||typeof window<"u"&&(fn=window.gsap)&&fn.registerPlugin&&fn},Np=1,ks=[],rt=[],Oi=[],Pa=Date.now,Gc=function(e,t){return t},T_=function(){var e=Ws.core,t=e.bridge||{},n=e._scrollers,i=e._proxies;n.push.apply(n,rt),i.push.apply(i,Oi),rt=n,Oi=i,Gc=function(a,o){return t[a](o)}},Rr=function(e,t){return~Oi.indexOf(e)&&Oi[Oi.indexOf(e)+1][t]},Da=function(e){return!!~Pp.indexOf(e)},Rn=function(e,t,n,i,s){return e.addEventListener(t,n,{passive:i!==!1,capture:!!s})},An=function(e,t,n,i){return e.removeEventListener(t,n,!!i)},so="scrollLeft",ao="scrollTop",Vc=function(){return ji&&ji.isPressed||rt.cache++},hl=function(e,t){var n=function i(s){if(s||s===0){Np&&(Qn.history.scrollRestoration="manual");var a=ji&&ji.isPressed;s=i.v=Math.round(s)||(ji&&ji.iOS?1:0),e(s),i.cacheID=rt.cache,a&&Gc("ss",s)}else(t||rt.cache!==i.cacheID||Gc("ref"))&&(i.cacheID=rt.cache,i.v=e());return i.v+i.offset};return n.offset=0,e&&n},In={s:so,p:"left",p2:"Left",os:"right",os2:"Right",d:"width",d2:"Width",a:"x",sc:hl(function(r){return arguments.length?Qn.scrollTo(r,Qt.sc()):Qn.pageXOffset||br[so]||yr[so]||Hs[so]||0})},Qt={s:ao,p:"top",p2:"Top",os:"bottom",os2:"Bottom",d:"height",d2:"Height",a:"y",op:In,sc:hl(function(r){return arguments.length?Qn.scrollTo(In.sc(),r):Qn.pageYOffset||br[ao]||yr[ao]||Hs[ao]||0})},Fn=function(e,t){return(t&&t._ctx&&t._ctx.selector||fn.utils.toArray)(e)[0]||(typeof e=="string"&&fn.config().nullTargetWarn!==!1?console.warn("Element not found:",e):null)},w_=function(e,t){for(var n=t.length;n--;)if(t[n]===e||t[n].contains(e))return!0;return!1},Lr=function(e,t){var n=t.s,i=t.sc;Da(e)&&(e=br.scrollingElement||yr);var s=rt.indexOf(e),a=i===Qt.sc?1:2;!~s&&(s=rt.push(e)-1),rt[s+a]||Rn(e,"scroll",Vc);var o=rt[s+a],l=o||(rt[s+a]=hl(Rr(e,n),!0)||(Da(e)?i:hl(function(c){return arguments.length?e[n]=c:e[n]})));return l.target=e,o||(l.smooth=fn.getProperty(e,"scrollBehavior")==="smooth"),l},Hc=function(e,t,n){var i=e,s=e,a=Pa(),o=a,l=t||50,c=Math.max(500,l*3),u=function(g,_){var p=Pa();_||p-a>l?(s=i,i=g,o=a,a=p):n?i+=g:i=s+(g-s)/(p-o)*(a-o)},h=function(){s=i=n?0:i,o=a=0},f=function(g){var _=o,p=s,m=Pa();return(g||g===0)&&g!==i&&u(g),a===o||m-o>c?0:(i+(n?p:-p))/((n?m:a)-_)*1e3};return{update:u,reset:h,getVelocity:f}},ua=function(e,t){return t&&!e._gsapAllow&&e.cancelable!==!1&&e.preventDefault(),e.changedTouches?e.changedTouches[0]:e},rd=function(e){var t=Math.max.apply(Math,e),n=Math.min.apply(Math,e);return Math.abs(t)>=Math.abs(n)?t:n},Ip=function(){Ws=fn.core.globals().ScrollTrigger,Ws&&Ws.core&&T_()},Up=function(e){return fn=e||Lp(),!$o&&fn&&typeof document<"u"&&document.body&&(Qn=window,br=document,yr=br.documentElement,Hs=br.body,Pp=[Qn,br,yr,Hs],fn.utils.clamp,Dp=fn.core.context||function(){},Vr="onpointerenter"in Hs?"pointer":"mouse",Cp=Wt.isTouch=Qn.matchMedia&&Qn.matchMedia("(hover: none), (pointer: coarse)").matches?1:"ontouchstart"in Qn||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,Mi=Wt.eventTypes=("ontouchstart"in yr?"touchstart,touchmove,touchcancel,touchend":"onpointerdown"in yr?"pointerdown,pointermove,pointercancel,pointerup":"mousedown,mousemove,mouseup,mouseup").split(","),setTimeout(function(){return Np=0},500),$o=1),Ws||Ip(),$o};In.op=Qt;rt.cache=0;var Wt=(function(){function r(t){this.init(t)}var e=r.prototype;return e.init=function(n){$o||Up(fn)||console.warn("Please gsap.registerPlugin(Observer)"),Ws||Ip();var i=n.tolerance,s=n.dragMinimum,a=n.type,o=n.target,l=n.lineHeight,c=n.debounce,u=n.preventDefault,h=n.onStop,f=n.onStopDelay,d=n.ignore,g=n.wheelSpeed,_=n.event,p=n.onDragStart,m=n.onDragEnd,b=n.onDrag,A=n.onPress,M=n.onRelease,y=n.onRight,T=n.onLeft,w=n.onUp,v=n.onDown,E=n.onChangeX,C=n.onChangeY,L=n.onChange,N=n.onToggleX,Y=n.onToggleY,H=n.onHover,O=n.onHoverEnd,z=n.onMove,I=n.ignoreCheck,W=n.isNormalizer,Z=n.onGestureStart,D=n.onGestureEnd,re=n.onWheel,he=n.onEnable,He=n.onDisable,Be=n.onClick,Pe=n.scrollSpeed,J=n.capture,ae=n.allowClicks,se=n.lockAxis,we=n.onLockAxis;this.target=o=Fn(o)||yr,this.vars=n,d&&(d=fn.utils.toArray(d)),i=i||1e-9,s=s||0,g=g||1,Pe=Pe||1,a=a||"wheel,touch,pointer",c=c!==!1,l||(l=parseFloat(Qn.getComputedStyle(Hs).lineHeight)||22);var Oe,Ee,Je,be,We,Te,Ne,$=this,je=0,ft=0,_t=n.passive||!u&&n.passive!==!1,qe=Lr(o,In),at=Lr(o,Qt),F=qe(),Mt=at(),Xe=~a.indexOf("touch")&&!~a.indexOf("pointer")&&Mi[0]==="pointerdown",R=Da(o),x=o.ownerDocument||br,B=[0,0,0],V=[0,0,0],j=0,fe=function(){return j=Pa()},ce=function(ie,ze){return($.event=ie)&&d&&w_(ie.target,d)||ze&&Xe&&ie.pointerType!=="touch"||I&&I(ie,ze)},Q=function(){$._vx.reset(),$._vy.reset(),Ee.pause(),h&&h($)},ee=function(){var ie=$.deltaX=rd(B),ze=$.deltaY=rd(V),le=Math.abs(ie)>=i,Ge=Math.abs(ze)>=i;L&&(le||Ge)&&L($,ie,ze,B,V),le&&(y&&$.deltaX>0&&y($),T&&$.deltaX<0&&T($),E&&E($),N&&$.deltaX<0!=je<0&&N($),je=$.deltaX,B[0]=B[1]=B[2]=0),Ge&&(v&&$.deltaY>0&&v($),w&&$.deltaY<0&&w($),C&&C($),Y&&$.deltaY<0!=ft<0&&Y($),ft=$.deltaY,V[0]=V[1]=V[2]=0),(be||Je)&&(z&&z($),Je&&(p&&Je===1&&p($),b&&b($),Je=0),be=!1),Te&&!(Te=!1)&&we&&we($),We&&(re($),We=!1),Oe=0},me=function(ie,ze,le){B[le]+=ie,V[le]+=ze,$._vx.update(ie),$._vy.update(ze),c?Oe||(Oe=requestAnimationFrame(ee)):ee()},Ce=function(ie,ze){se&&!Ne&&($.axis=Ne=Math.abs(ie)>Math.abs(ze)?"x":"y",Te=!0),Ne!=="y"&&(B[2]+=ie,$._vx.update(ie,!0)),Ne!=="x"&&(V[2]+=ze,$._vy.update(ze,!0)),c?Oe||(Oe=requestAnimationFrame(ee)):ee()},ge=function(ie){if(!ce(ie,1)){ie=ua(ie,u);var ze=ie.clientX,le=ie.clientY,Ge=ze-$.x,De=le-$.y,$e=$.isDragging;$.x=ze,$.y=le,($e||(Ge||De)&&(Math.abs($.startX-ze)>=s||Math.abs($.startY-le)>=s))&&(Je||(Je=$e?2:1),$e||($.isDragging=!0),Ce(Ge,De))}},pe=$.onPress=function(oe){ce(oe,1)||oe&&oe.button||($.axis=Ne=null,Ee.pause(),$.isPressed=!0,oe=ua(oe),je=ft=0,$.startX=$.x=oe.clientX,$.startY=$.y=oe.clientY,$._vx.reset(),$._vy.reset(),Rn(W?o:x,Mi[1],ge,_t,!0),$.deltaX=$.deltaY=0,A&&A($))},ue=$.onRelease=function(oe){if(!ce(oe,1)){An(W?o:x,Mi[1],ge,!0);var ie=!isNaN($.y-$.startY),ze=$.isDragging,le=ze&&(Math.abs($.x-$.startX)>3||Math.abs($.y-$.startY)>3),Ge=ua(oe);!le&&ie&&($._vx.reset(),$._vy.reset(),u&&ae&&fn.delayedCall(.08,function(){if(Pa()-j>300&&!oe.defaultPrevented){if(oe.target.click)oe.target.click();else if(x.createEvent){var De=x.createEvent("MouseEvents");De.initMouseEvent("click",!0,!0,Qn,1,Ge.screenX,Ge.screenY,Ge.clientX,Ge.clientY,!1,!1,!1,!1,0,null),oe.target.dispatchEvent(De)}}})),$.isDragging=$.isGesturing=$.isPressed=!1,h&&ze&&!W&&Ee.restart(!0),Je&&ee(),m&&ze&&m($),M&&M($,le)}},Ie=function(ie){return ie.touches&&ie.touches.length>1&&($.isGesturing=!0)&&Z(ie,$.isDragging)},ke=function(){return($.isGesturing=!1)||D($)},U=function(ie){if(!ce(ie)){var ze=qe(),le=at();me((ze-F)*Pe,(le-Mt)*Pe,1),F=ze,Mt=le,h&&Ee.restart(!0)}},de=function(ie){if(!ce(ie)){ie=ua(ie,u),re&&(We=!0);var ze=(ie.deltaMode===1?l:ie.deltaMode===2?Qn.innerHeight:1)*g;me(ie.deltaX*ze,ie.deltaY*ze,0),h&&!W&&Ee.restart(!0)}},te=function(ie){if(!ce(ie)){var ze=ie.clientX,le=ie.clientY,Ge=ze-$.x,De=le-$.y;$.x=ze,$.y=le,be=!0,h&&Ee.restart(!0),(Ge||De)&&Ce(Ge,De)}},_e=function(ie){$.event=ie,H($)},xe=function(ie){$.event=ie,O($)},ne=function(ie){return ce(ie)||ua(ie,u)&&Be($)};Ee=$._dc=fn.delayedCall(f||.25,Q).pause(),$.deltaX=$.deltaY=0,$._vx=Hc(0,50,!0),$._vy=Hc(0,50,!0),$.scrollX=qe,$.scrollY=at,$.isDragging=$.isGesturing=$.isPressed=!1,Dp(this),$.enable=function(oe){return $.isEnabled||(Rn(R?x:o,"scroll",Vc),a.indexOf("scroll")>=0&&Rn(R?x:o,"scroll",U,_t,J),a.indexOf("wheel")>=0&&Rn(o,"wheel",de,_t,J),(a.indexOf("touch")>=0&&Cp||a.indexOf("pointer")>=0)&&(Rn(o,Mi[0],pe,_t,J),Rn(x,Mi[2],ue),Rn(x,Mi[3],ue),ae&&Rn(o,"click",fe,!0,!0),Be&&Rn(o,"click",ne),Z&&Rn(x,"gesturestart",Ie),D&&Rn(x,"gestureend",ke),H&&Rn(o,Vr+"enter",_e),O&&Rn(o,Vr+"leave",xe),z&&Rn(o,Vr+"move",te)),$.isEnabled=!0,$.isDragging=$.isGesturing=$.isPressed=be=Je=!1,$._vx.reset(),$._vy.reset(),F=qe(),Mt=at(),oe&&oe.type&&pe(oe),he&&he($)),$},$.disable=function(){$.isEnabled&&(ks.filter(function(oe){return oe!==$&&Da(oe.target)}).length||An(R?x:o,"scroll",Vc),$.isPressed&&($._vx.reset(),$._vy.reset(),An(W?o:x,Mi[1],ge,!0)),An(R?x:o,"scroll",U,J),An(o,"wheel",de,J),An(o,Mi[0],pe,J),An(x,Mi[2],ue),An(x,Mi[3],ue),An(o,"click",fe,!0),An(o,"click",ne),An(x,"gesturestart",Ie),An(x,"gestureend",ke),An(o,Vr+"enter",_e),An(o,Vr+"leave",xe),An(o,Vr+"move",te),$.isEnabled=$.isPressed=$.isDragging=!1,He&&He($))},$.kill=$.revert=function(){$.disable();var oe=ks.indexOf($);oe>=0&&ks.splice(oe,1),ji===$&&(ji=0)},ks.push($),W&&Da(o)&&(ji=$),$.enable(_)},E_(r,[{key:"velocityX",get:function(){return this._vx.getVelocity()}},{key:"velocityY",get:function(){return this._vy.getVelocity()}}]),r})();Wt.version="3.15.0";Wt.create=function(r){return new Wt(r)};Wt.register=Up;Wt.getAll=function(){return ks.slice()};Wt.getById=function(r){return ks.filter(function(e){return e.vars.id===r})[0]};Lp()&&fn.registerPlugin(Wt);var Re,Is,it,xt,jn,gt,lf,pl,Ka,La,Ma,oo,xn,Al,Wc,Ln,sd,ad,Us,Fp,Vl,Op,Dn,Xc,Bp,kp,_r,Yc,cf,Xs,uf,Na,qc,Hl,lo=1,vn=Date.now,Wl=vn(),gi=0,Sa=0,od=function(e,t,n){var i=Kn(e)&&(e.substr(0,6)==="clamp("||e.indexOf("max")>-1);return n["_"+t+"Clamp"]=i,i?e.substr(6,e.length-7):e},ld=function(e,t){return t&&(!Kn(e)||e.substr(0,6)!=="clamp(")?"clamp("+e+")":e},A_=function r(){return Sa&&requestAnimationFrame(r)},cd=function(){return Al=1},ud=function(){return Al=0},Pi=function(e){return e},ba=function(e){return Math.round(e*1e5)/1e5||0},zp=function(){return typeof window<"u"},Gp=function(){return Re||zp()&&(Re=window.gsap)&&Re.registerPlugin&&Re},rs=function(e){return!!~lf.indexOf(e)},Vp=function(e){return(e==="Height"?uf:it["inner"+e])||jn["client"+e]||gt["client"+e]},Hp=function(e){return Rr(e,"getBoundingClientRect")||(rs(e)?function(){return Qo.width=it.innerWidth,Qo.height=uf,Qo}:function(){return Ki(e)})},R_=function(e,t,n){var i=n.d,s=n.d2,a=n.a;return(a=Rr(e,"getBoundingClientRect"))?function(){return a()[i]}:function(){return(t?Vp(s):e["client"+s])||0}},C_=function(e,t){return!t||~Oi.indexOf(e)?Hp(e):function(){return Qo}},Ii=function(e,t){var n=t.s,i=t.d2,s=t.d,a=t.a;return Math.max(0,(n="scroll"+i)&&(a=Rr(e,n))?a()-Hp(e)()[s]:rs(e)?(jn[n]||gt[n])-Vp(i):e[n]-e["offset"+i])},co=function(e,t){for(var n=0;n<Us.length;n+=3)(!t||~t.indexOf(Us[n+1]))&&e(Us[n],Us[n+1],Us[n+2])},Kn=function(e){return typeof e=="string"},bn=function(e){return typeof e=="function"},ya=function(e){return typeof e=="number"},Hr=function(e){return typeof e=="object"},fa=function(e,t,n){return e&&e.progress(t?0:1)&&n&&e.pause()},gs=function(e,t,n){if(e.enabled){var i=e._ctx?e._ctx.add(function(){return t(e,n)}):t(e,n);i&&i.totalTime&&(e.callbackAnimation=i)}},_s=Math.abs,Wp="left",Xp="top",ff="right",df="bottom",ts="width",ns="height",Ia="Right",Ua="Left",Fa="Top",Oa="Bottom",Kt="padding",ui="margin",ta="Width",hf="Height",Jt="px",fi=function(e){return it.getComputedStyle(e.nodeType===Node.DOCUMENT_NODE?e.scrollingElement:e)},P_=function(e){var t=fi(e).position;e.style.position=t==="absolute"||t==="fixed"?t:"relative"},fd=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},Ki=function(e,t){var n=t&&fi(e)[Wc]!=="matrix(1, 0, 0, 1, 0, 0)"&&Re.to(e,{x:0,y:0,xPercent:0,yPercent:0,rotation:0,rotationX:0,rotationY:0,scale:1,skewX:0,skewY:0}).progress(1),i=e.getBoundingClientRect?e.getBoundingClientRect():e.scrollingElement.getBoundingClientRect();return n&&n.progress(0).kill(),i},ml=function(e,t){var n=t.d2;return e["offset"+n]||e["client"+n]||0},Yp=function(e){var t=[],n=e.labels,i=e.duration(),s;for(s in n)t.push(n[s]/i);return t},D_=function(e){return function(t){return Re.utils.snap(Yp(e),t)}},pf=function(e){var t=Re.utils.snap(e),n=Array.isArray(e)&&e.slice(0).sort(function(i,s){return i-s});return n?function(i,s,a){a===void 0&&(a=.001);var o;if(!s)return t(i);if(s>0){for(i-=a,o=0;o<n.length;o++)if(n[o]>=i)return n[o];return n[o-1]}else for(o=n.length,i+=a;o--;)if(n[o]<=i)return n[o];return n[0]}:function(i,s,a){a===void 0&&(a=.001);var o=t(i);return!s||Math.abs(o-i)<a||o-i<0==s<0?o:t(s<0?i-e:i+e)}},L_=function(e){return function(t,n){return pf(Yp(e))(t,n.direction)}},uo=function(e,t,n,i){return n.split(",").forEach(function(s){return e(t,s,i)})},cn=function(e,t,n,i,s){return e.addEventListener(t,n,{passive:!i,capture:!!s})},an=function(e,t,n,i){return e.removeEventListener(t,n,!!i)},fo=function(e,t,n){n=n&&n.wheelHandler,n&&(e(t,"wheel",n),e(t,"touchmove",n))},dd={startColor:"green",endColor:"red",indent:0,fontSize:"16px",fontWeight:"normal"},ho={toggleActions:"play",anticipatePin:0},gl={top:0,left:0,center:.5,bottom:1,right:1},Ko=function(e,t){if(Kn(e)){var n=e.indexOf("="),i=~n?+(e.charAt(n-1)+1)*parseFloat(e.substr(n+1)):0;~n&&(e.indexOf("%")>n&&(i*=t/100),e=e.substr(0,n-1)),e=i+(e in gl?gl[e]*t:~e.indexOf("%")?parseFloat(e)*t/100:parseFloat(e)||0)}return e},po=function(e,t,n,i,s,a,o,l){var c=s.startColor,u=s.endColor,h=s.fontSize,f=s.indent,d=s.fontWeight,g=xt.createElement("div"),_=rs(n)||Rr(n,"pinType")==="fixed",p=e.indexOf("scroller")!==-1,m=_?gt:n.tagName==="IFRAME"?n.contentDocument.body:n,b=e.indexOf("start")!==-1,A=b?c:u,M="border-color:"+A+";font-size:"+h+";color:"+A+";font-weight:"+d+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return M+="position:"+((p||l)&&_?"fixed;":"absolute;"),(p||l||!_)&&(M+=(i===Qt?ff:df)+":"+(a+parseFloat(f))+"px;"),o&&(M+="box-sizing:border-box;text-align:left;width:"+o.offsetWidth+"px;"),g._isStart=b,g.setAttribute("class","gsap-marker-"+e+(t?" marker-"+t:"")),g.style.cssText=M,g.innerText=t||t===0?e+"-"+t:e,m.children[0]?m.insertBefore(g,m.children[0]):m.appendChild(g),g._offset=g["offset"+i.op.d2],Zo(g,0,i,b),g},Zo=function(e,t,n,i){var s={display:"block"},a=n[i?"os2":"p2"],o=n[i?"p2":"os2"];e._isFlipped=i,s[n.a+"Percent"]=i?-100:0,s[n.a]=i?"1px":0,s["border"+a+ta]=1,s["border"+o+ta]=0,s[n.p]=t+"px",Re.set(e,s)},tt=[],$c={},Za,hd=function(){return vn()-gi>34&&(Za||(Za=requestAnimationFrame(Qi)))},xs=function(){(!Dn||!Dn.isPressed||Dn.startX>gt.clientWidth)&&(rt.cache++,Dn?Za||(Za=requestAnimationFrame(Qi)):Qi(),gi||as("scrollStart"),gi=vn())},Xl=function(){kp=it.innerWidth,Bp=it.innerHeight},Ea=function(e){rt.cache++,(e===!0||!xn&&!Op&&!xt.fullscreenElement&&!xt.webkitFullscreenElement&&(!Xc||kp!==it.innerWidth||Math.abs(it.innerHeight-Bp)>it.innerHeight*.25))&&pl.restart(!0)},ss={},N_=[],qp=function r(){return an(st,"scrollEnd",r)||$r(!0)},as=function(e){return ss[e]&&ss[e].map(function(t){return t()})||N_},$n=[],$p=function(e){for(var t=0;t<$n.length;t+=5)(!e||$n[t+4]&&$n[t+4].query===e)&&($n[t].style.cssText=$n[t+1],$n[t].getBBox&&$n[t].setAttribute("transform",$n[t+2]||""),$n[t+3].uncache=1)},Kp=function(){return rt.forEach(function(e){return bn(e)&&++e.cacheID&&(e.rec=e())})},mf=function(e,t){var n;for(Ln=0;Ln<tt.length;Ln++)n=tt[Ln],n&&(!t||n._ctx===t)&&(e?n.kill(1):n.revert(!0,!0));Na=!0,t&&$p(t),t||as("revert")},Zp=function(e,t){rt.cache++,(t||!Nn)&&rt.forEach(function(n){return bn(n)&&n.cacheID++&&(n.rec=0)}),Kn(e)&&(it.history.scrollRestoration=cf=e)},Nn,is=0,pd,I_=function(){if(pd!==is){var e=pd=is;requestAnimationFrame(function(){return e===is&&$r(!0)})}},jp=function(){gt.appendChild(Xs),uf=!Dn&&Xs.offsetHeight||it.innerHeight,gt.removeChild(Xs)},md=function(e){return Ka(".gsap-marker-start, .gsap-marker-end, .gsap-marker-scroller-start, .gsap-marker-scroller-end").forEach(function(t){return t.style.display=e?"none":"block"})},$r=function(e,t){if(jn=xt.documentElement,gt=xt.body,lf=[it,xt,jn,gt],gi&&!e&&!Na){cn(st,"scrollEnd",qp);return}jp(),Nn=st.isRefreshing=!0,Na||Kp();var n=as("refreshInit");Fp&&st.sort(),t||mf(),rt.forEach(function(i){bn(i)&&(i.smooth&&(i.target.style.scrollBehavior="auto"),i(0))}),tt.slice(0).forEach(function(i){return i.refresh()}),Na=!1,tt.forEach(function(i){if(i._subPinOffset&&i.pin){var s=i.vars.horizontal?"offsetWidth":"offsetHeight",a=i.pin[s];i.revert(!0,1),i.adjustPinSpacing(i.pin[s]-a),i.refresh()}}),qc=1,md(!0),tt.forEach(function(i){var s=Ii(i.scroller,i._dir),a=i.vars.end==="max"||i._endClamp&&i.end>s,o=i._startClamp&&i.start>=s;(a||o)&&i.setPositions(o?s-1:i.start,a?Math.max(o?s:i.start+1,s):i.end,!0)}),md(!1),qc=0,n.forEach(function(i){return i&&i.render&&i.render(-1)}),rt.forEach(function(i){bn(i)&&(i.smooth&&requestAnimationFrame(function(){return i.target.style.scrollBehavior="smooth"}),i.rec&&i(i.rec))}),Zp(cf,1),pl.pause(),is++,Nn=2,Qi(2),tt.forEach(function(i){return bn(i.vars.onRefresh)&&i.vars.onRefresh(i)}),Nn=st.isRefreshing=!1,as("refresh")},Kc=0,jo=1,Ba,Qi=function(e){if(e===2||!Nn&&!Na){st.isUpdating=!0,Ba&&Ba.update(0);var t=tt.length,n=vn(),i=n-Wl>=50,s=t&&tt[0].scroll();if(jo=Kc>s?-1:1,Nn||(Kc=s),i&&(gi&&!Al&&n-gi>200&&(gi=0,as("scrollEnd")),Ma=Wl,Wl=n),jo<0){for(Ln=t;Ln-- >0;)tt[Ln]&&tt[Ln].update(0,i);jo=1}else for(Ln=0;Ln<t;Ln++)tt[Ln]&&tt[Ln].update(0,i);st.isUpdating=!1}Za=0},Zc=[Wp,Xp,df,ff,ui+Oa,ui+Ia,ui+Fa,ui+Ua,"display","flexShrink","float","zIndex","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","justifySelf","alignSelf","placeSelf","order"],Jo=Zc.concat([ts,ns,"boxSizing","max"+ta,"max"+hf,"position",ui,Kt,Kt+Fa,Kt+Ia,Kt+Oa,Kt+Ua]),U_=function(e,t,n){Ys(n);var i=e._gsap;if(i.spacerIsNative)Ys(i.spacerState);else if(e._gsap.swappedIn){var s=t.parentNode;s&&(s.insertBefore(e,t),s.removeChild(t))}e._gsap.swappedIn=!1},Yl=function(e,t,n,i){if(!e._gsap.swappedIn){for(var s=Zc.length,a=t.style,o=e.style,l;s--;)l=Zc[s],a[l]=n[l];a.position=n.position==="absolute"?"absolute":"relative",n.display==="inline"&&(a.display="inline-block"),o[df]=o[ff]="auto",a.flexBasis=n.flexBasis||"auto",a.overflow="visible",a.boxSizing="border-box",a[ts]=ml(e,In)+Jt,a[ns]=ml(e,Qt)+Jt,a[Kt]=o[ui]=o[Xp]=o[Wp]="0",Ys(i),o[ts]=o["max"+ta]=n[ts],o[ns]=o["max"+hf]=n[ns],o[Kt]=n[Kt],e.parentNode!==t&&(e.parentNode.insertBefore(t,e),t.appendChild(e)),e._gsap.swappedIn=!0}},F_=/([A-Z])/g,Ys=function(e){if(e){var t=e.t.style,n=e.length,i=0,s,a;for((e.t._gsap||Re.core.getCache(e.t)).uncache=1;i<n;i+=2)a=e[i+1],s=e[i],a?t[s]=a:t[s]&&t.removeProperty(s.replace(F_,"-$1").toLowerCase())}},mo=function(e){for(var t=Jo.length,n=e.style,i=[],s=0;s<t;s++)i.push(Jo[s],n[Jo[s]]);return i.t=e,i},O_=function(e,t,n){for(var i=[],s=e.length,a=n?8:0,o;a<s;a+=2)o=e[a],i.push(o,o in t?t[o]:e[a+1]);return i.t=e.t,i},Qo={left:0,top:0},gd=function(e,t,n,i,s,a,o,l,c,u,h,f,d,g){bn(e)&&(e=e(l)),Kn(e)&&e.substr(0,3)==="max"&&(e=f+(e.charAt(4)==="="?Ko("0"+e.substr(3),n):0));var _=d?d.time():0,p,m,b;if(d&&d.seek(0),isNaN(e)||(e=+e),ya(e))d&&(e=Re.utils.mapRange(d.scrollTrigger.start,d.scrollTrigger.end,0,f,e)),o&&Zo(o,n,i,!0);else{bn(t)&&(t=t(l));var A=(e||"0").split(" "),M,y,T,w;b=Fn(t,l)||gt,M=Ki(b)||{},(!M||!M.left&&!M.top)&&fi(b).display==="none"&&(w=b.style.display,b.style.display="block",M=Ki(b),w?b.style.display=w:b.style.removeProperty("display")),y=Ko(A[0],M[i.d]),T=Ko(A[1]||"0",n),e=M[i.p]-c[i.p]-u+y+s-T,o&&Zo(o,T,i,n-T<20||o._isStart&&T>20),n-=n-T}if(g&&(l[g]=e||-.001,e<0&&(e=0)),a){var v=e+n,E=a._isStart;p="scroll"+i.d2,Zo(a,v,i,E&&v>20||!E&&(h?Math.max(gt[p],jn[p]):a.parentNode[p])<=v+1),h&&(c=Ki(o),h&&(a.style[i.op.p]=c[i.op.p]-i.op.m-a._offset+Jt))}return d&&b&&(p=Ki(b),d.seek(f),m=Ki(b),d._caScrollDist=p[i.p]-m[i.p],e=e/d._caScrollDist*f),d&&d.seek(_),d?e:Math.round(e)},B_=/(webkit|moz|length|cssText|inset)/i,_d=function(e,t,n,i){if(e.parentNode!==t){var s=e.style,a,o;if(t===gt){e._stOrig=s.cssText,o=fi(e);for(a in o)!+a&&!B_.test(a)&&o[a]&&typeof s[a]=="string"&&a!=="0"&&(s[a]=o[a]);s.top=n,s.left=i}else s.cssText=e._stOrig;Re.core.getCache(e).uncache=1,t.appendChild(e)}},Jp=function(e,t,n){var i=t,s=i;return function(a){var o=Math.round(e());return o!==i&&o!==s&&Math.abs(o-i)>3&&Math.abs(o-s)>3&&(a=o,n&&n()),s=i,i=Math.round(a),i}},go=function(e,t,n){var i={};i[t.p]="+="+n,Re.set(e,i)},xd=function(e,t){var n=Lr(e,t),i="_scroll"+t.p2,s=function a(o,l,c,u,h){var f=a.tween,d=l.onComplete,g={};c=c||n();var _=Jp(n,c,function(){f.kill(),a.tween=0});return h=u&&h||0,u=u||o-c,f&&f.kill(),l[i]=o,l.inherit=!1,l.modifiers=g,g[i]=function(){return _(c+u*f.ratio+h*f.ratio*f.ratio)},l.onUpdate=function(){rt.cache++,a.tween&&Qi()},l.onComplete=function(){a.tween=0,d&&d.call(f)},f=a.tween=Re.to(e,l),f};return e[i]=n,n.wheelHandler=function(){return s.tween&&s.tween.kill()&&(s.tween=0)},cn(e,"wheel",n.wheelHandler),st.isTouch&&cn(e,"touchmove",n.wheelHandler),s},st=(function(){function r(t,n){Is||r.register(Re)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),Yc(this),this.init(t,n)}var e=r.prototype;return e.init=function(n,i){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),!Sa){this.update=this.refresh=this.kill=Pi;return}n=fd(Kn(n)||ya(n)||n.nodeType?{trigger:n}:n,ho);var s=n,a=s.onUpdate,o=s.toggleClass,l=s.id,c=s.onToggle,u=s.onRefresh,h=s.scrub,f=s.trigger,d=s.pin,g=s.pinSpacing,_=s.invalidateOnRefresh,p=s.anticipatePin,m=s.onScrubComplete,b=s.onSnapComplete,A=s.once,M=s.snap,y=s.pinReparent,T=s.pinSpacer,w=s.containerAnimation,v=s.fastScrollEnd,E=s.preventOverlaps,C=n.horizontal||n.containerAnimation&&n.horizontal!==!1?In:Qt,L=!h&&h!==0,N=Fn(n.scroller||it),Y=Re.core.getCache(N),H=rs(N),O=("pinType"in n?n.pinType:Rr(N,"pinType")||H&&"fixed")==="fixed",z=[n.onEnter,n.onLeave,n.onEnterBack,n.onLeaveBack],I=L&&n.toggleActions.split(" "),W="markers"in n?n.markers:ho.markers,Z=H?0:parseFloat(fi(N)["border"+C.p2+ta])||0,D=this,re=n.onRefreshInit&&function(){return n.onRefreshInit(D)},he=R_(N,H,C),He=C_(N,H),Be=0,Pe=0,J=0,ae=Lr(N,C),se,we,Oe,Ee,Je,be,We,Te,Ne,$,je,ft,_t,qe,at,F,Mt,Xe,R,x,B,V,j,fe,ce,Q,ee,me,Ce,ge,pe,ue,Ie,ke,U,de,te,_e,xe;if(D._startClamp=D._endClamp=!1,D._dir=C,p*=45,D.scroller=N,D.scroll=w?w.time.bind(w):ae,Ee=ae(),D.vars=n,i=i||n.animation,"refreshPriority"in n&&(Fp=1,n.refreshPriority===-9999&&(Ba=D)),Y.tweenScroll=Y.tweenScroll||{top:xd(N,Qt),left:xd(N,In)},D.tweenTo=se=Y.tweenScroll[C.p],D.scrubDuration=function(le){Ie=ya(le)&&le,Ie?ue?ue.duration(le):ue=Re.to(i,{ease:"expo",totalProgress:"+=0",inherit:!1,duration:Ie,paused:!0,onComplete:function(){return m&&m(D)}}):(ue&&ue.progress(1).kill(),ue=0)},i&&(i.vars.lazy=!1,i._initted&&!D.isReverted||i.vars.immediateRender!==!1&&n.immediateRender!==!1&&i.duration()&&i.render(0,!0,!0),D.animation=i.pause(),i.scrollTrigger=D,D.scrubDuration(h),ge=0,l||(l=i.vars.id)),M&&((!Hr(M)||M.push)&&(M={snapTo:M}),"scrollBehavior"in gt.style&&Re.set(H?[gt,jn]:N,{scrollBehavior:"auto"}),rt.forEach(function(le){return bn(le)&&le.target===(H?xt.scrollingElement||jn:N)&&(le.smooth=!1)}),Oe=bn(M.snapTo)?M.snapTo:M.snapTo==="labels"?D_(i):M.snapTo==="labelsDirectional"?L_(i):M.directional!==!1?function(le,Ge){return pf(M.snapTo)(le,vn()-Pe<500?0:Ge.direction)}:Re.utils.snap(M.snapTo),ke=M.duration||{min:.1,max:2},ke=Hr(ke)?La(ke.min,ke.max):La(ke,ke),U=Re.delayedCall(M.delay||Ie/2||.1,function(){var le=ae(),Ge=vn()-Pe<500,De=se.tween;if((Ge||Math.abs(D.getVelocity())<10)&&!De&&!Al&&Be!==le){var $e=(le-be)/qe,Yt=i&&!L?i.totalProgress():$e,nt=Ge?0:(Yt-pe)/(vn()-Ma)*1e3||0,Ct=Re.utils.clamp(-$e,1-$e,_s(nt/2)*nt/.185),nn=$e+(M.inertia===!1?0:Ct),Pt,bt,lt=M,Tn=lt.onStart,At=lt.onInterrupt,pn=lt.onComplete;if(Pt=Oe(nn,D),ya(Pt)||(Pt=nn),bt=Math.max(0,Math.round(be+Pt*qe)),le<=We&&le>=be&&bt!==le){if(De&&!De._initted&&De.data<=_s(bt-le))return;M.inertia===!1&&(Ct=Pt-$e),se(bt,{duration:ke(_s(Math.max(_s(nn-Yt),_s(Pt-Yt))*.185/nt/.05||0)),ease:M.ease||"power3",data:_s(bt-le),onInterrupt:function(){return U.restart(!0)&&At&&gs(D,At)},onComplete:function(){D.update(),Be=ae(),i&&!L&&(ue?ue.resetTo("totalProgress",Pt,i._tTime/i._tDur):i.progress(Pt)),ge=pe=i&&!L?i.totalProgress():D.progress,b&&b(D),pn&&gs(D,pn)}},le,Ct*qe,bt-le-Ct*qe),Tn&&gs(D,Tn,se.tween)}}else D.isActive&&Be!==le&&U.restart(!0)}).pause()),l&&($c[l]=D),f=D.trigger=Fn(f||d!==!0&&d),xe=f&&f._gsap&&f._gsap.stRevert,xe&&(xe=xe(D)),d=d===!0?f:Fn(d),Kn(o)&&(o={targets:f,className:o}),d&&(g===!1||g===ui||(g=!g&&d.parentNode&&d.parentNode.style&&fi(d.parentNode).display==="flex"?!1:Kt),D.pin=d,we=Re.core.getCache(d),we.spacer?at=we.pinState:(T&&(T=Fn(T),T&&!T.nodeType&&(T=T.current||T.nativeElement),we.spacerIsNative=!!T,T&&(we.spacerState=mo(T))),we.spacer=Xe=T||xt.createElement("div"),Xe.classList.add("pin-spacer"),l&&Xe.classList.add("pin-spacer-"+l),we.pinState=at=mo(d)),n.force3D!==!1&&Re.set(d,{force3D:!0}),D.spacer=Xe=we.spacer,Ce=fi(d),fe=Ce[g+C.os2],x=Re.getProperty(d),B=Re.quickSetter(d,C.a,Jt),Yl(d,Xe,Ce),Mt=mo(d)),W){ft=Hr(W)?fd(W,dd):dd,$=po("scroller-start",l,N,C,ft,0),je=po("scroller-end",l,N,C,ft,0,$),R=$["offset"+C.op.d2];var ne=Fn(Rr(N,"content")||N);Te=this.markerStart=po("start",l,ne,C,ft,R,0,w),Ne=this.markerEnd=po("end",l,ne,C,ft,R,0,w),w&&(_e=Re.quickSetter([Te,Ne],C.a,Jt)),!O&&!(Oi.length&&Rr(N,"fixedMarkers")===!0)&&(P_(H?gt:N),Re.set([$,je],{force3D:!0}),Q=Re.quickSetter($,C.a,Jt),me=Re.quickSetter(je,C.a,Jt))}if(w){var oe=w.vars.onUpdate,ie=w.vars.onUpdateParams;w.eventCallback("onUpdate",function(){D.update(0,0,1),oe&&oe.apply(w,ie||[])})}if(D.previous=function(){return tt[tt.indexOf(D)-1]},D.next=function(){return tt[tt.indexOf(D)+1]},D.revert=function(le,Ge){if(!Ge)return D.kill(!0);var De=le!==!1||!D.enabled,$e=xn;De!==D.isReverted&&(De&&(de=Math.max(ae(),D.scroll.rec||0),J=D.progress,te=i&&i.progress()),Te&&[Te,Ne,$,je].forEach(function(Yt){return Yt.style.display=De?"none":"block"}),De&&(xn=D,D.update(De)),d&&(!y||!D.isActive)&&(De?U_(d,Xe,at):Yl(d,Xe,fi(d),ce)),De||D.update(De),xn=$e,D.isReverted=De)},D.refresh=function(le,Ge,De,$e){if(!((xn||!D.enabled)&&!Ge)){if(d&&le&&gi){cn(r,"scrollEnd",qp);return}!Nn&&re&&re(D),xn=D,se.tween&&!De&&(se.tween.kill(),se.tween=0),ue&&ue.pause(),_&&i&&(i.revert({kill:!1}).invalidate(),i.getChildren?i.getChildren(!0,!0,!1).forEach(function(Me){return Me.vars.immediateRender&&Me.render(0,!0,!0)}):i.vars.immediateRender&&i.render(0,!0,!0)),D.isReverted||D.revert(!0,!0),D._subPinOffset=!1;var Yt=he(),nt=He(),Ct=w?w.duration():Ii(N,C),nn=qe<=.01||!qe,Pt=0,bt=$e||0,lt=Hr(De)?De.end:n.end,Tn=n.endTrigger||f,At=Hr(De)?De.start:n.start||(n.start===0||!f?0:d?"0 0":"0 100%"),pn=D.pinnedContainer=n.pinnedContainer&&Fn(n.pinnedContainer,D),wn=f&&Math.max(0,tt.indexOf(D))||0,qt=wn,Ft,jt,Ti,ds,rn,zt,si,S,k,K,G,X,ve;for(W&&Hr(De)&&(X=Re.getProperty($,C.p),ve=Re.getProperty(je,C.p));qt-- >0;)zt=tt[qt],zt.end||zt.refresh(0,1)||(xn=D),si=zt.pin,si&&(si===f||si===d||si===pn)&&!zt.isReverted&&(K||(K=[]),K.unshift(zt),zt.revert(!0,!0)),zt!==tt[qt]&&(wn--,qt--);for(bn(At)&&(At=At(D)),At=od(At,"start",D),be=gd(At,f,Yt,C,ae(),Te,$,D,nt,Z,O,Ct,w,D._startClamp&&"_startClamp")||(d?-.001:0),bn(lt)&&(lt=lt(D)),Kn(lt)&&!lt.indexOf("+=")&&(~lt.indexOf(" ")?lt=(Kn(At)?At.split(" ")[0]:"")+lt:(Pt=Ko(lt.substr(2),Yt),lt=Kn(At)?At:(w?Re.utils.mapRange(0,w.duration(),w.scrollTrigger.start,w.scrollTrigger.end,be):be)+Pt,Tn=f)),lt=od(lt,"end",D),We=Math.max(be,gd(lt||(Tn?"100% 0":Ct),Tn,Yt,C,ae()+Pt,Ne,je,D,nt,Z,O,Ct,w,D._endClamp&&"_endClamp"))||-.001,Pt=0,qt=wn;qt--;)zt=tt[qt]||{},si=zt.pin,si&&zt.start-zt._pinPush<=be&&!w&&zt.end>0&&(Ft=zt.end-(D._startClamp?Math.max(0,zt.start):zt.start),(si===f&&zt.start-zt._pinPush<be||si===pn)&&isNaN(At)&&(Pt+=Ft*(1-zt.progress)),si===d&&(bt+=Ft));if(be+=Pt,We+=Pt,D._startClamp&&(D._startClamp+=Pt),D._endClamp&&!Nn&&(D._endClamp=We||-.001,We=Math.min(We,Ii(N,C))),qe=We-be||(be-=.01)&&.001,nn&&(J=Re.utils.clamp(0,1,Re.utils.normalize(be,We,de))),D._pinPush=bt,Te&&Pt&&(Ft={},Ft[C.a]="+="+Pt,pn&&(Ft[C.p]="-="+ae()),Re.set([Te,Ne],Ft)),d&&!(qc&&D.end>=Ii(N,C)))Ft=fi(d),ds=C===Qt,Ti=ae(),V=parseFloat(x(C.a))+bt,!Ct&&We>1&&(G=(H?xt.scrollingElement||jn:N).style,G={style:G,value:G["overflow"+C.a.toUpperCase()]},H&&fi(gt)["overflow"+C.a.toUpperCase()]!=="scroll"&&(G.style["overflow"+C.a.toUpperCase()]="scroll")),Yl(d,Xe,Ft),Mt=mo(d),jt=Ki(d,!0),S=O&&Lr(N,ds?In:Qt)(),g?(ce=[g+C.os2,qe+bt+Jt],ce.t=Xe,qt=g===Kt?ml(d,C)+qe+bt:0,qt&&(ce.push(C.d,qt+Jt),Xe.style.flexBasis!=="auto"&&(Xe.style.flexBasis=qt+Jt)),Ys(ce),pn&&tt.forEach(function(Me){Me.pin===pn&&Me.vars.pinSpacing!==!1&&(Me._subPinOffset=!0)}),O&&ae(de)):(qt=ml(d,C),qt&&Xe.style.flexBasis!=="auto"&&(Xe.style.flexBasis=qt+Jt)),O&&(rn={top:jt.top+(ds?Ti-be:S)+Jt,left:jt.left+(ds?S:Ti-be)+Jt,boxSizing:"border-box",position:"fixed"},rn[ts]=rn["max"+ta]=Math.ceil(jt.width)+Jt,rn[ns]=rn["max"+hf]=Math.ceil(jt.height)+Jt,rn[ui]=rn[ui+Fa]=rn[ui+Ia]=rn[ui+Oa]=rn[ui+Ua]="0",rn[Kt]=Ft[Kt],rn[Kt+Fa]=Ft[Kt+Fa],rn[Kt+Ia]=Ft[Kt+Ia],rn[Kt+Oa]=Ft[Kt+Oa],rn[Kt+Ua]=Ft[Kt+Ua],F=O_(at,rn,y),Nn&&ae(0)),i?(k=i._initted,Vl(1),i.render(i.duration(),!0,!0),j=x(C.a)-V+qe+bt,ee=Math.abs(qe-j)>1,O&&ee&&F.splice(F.length-2,2),i.render(0,!0,!0),k||i.invalidate(!0),i.parent||i.totalTime(i.totalTime()),Vl(0)):j=qe,G&&(G.value?G.style["overflow"+C.a.toUpperCase()]=G.value:G.style.removeProperty("overflow-"+C.a));else if(f&&ae()&&!w)for(jt=f.parentNode;jt&&jt!==gt;)jt._pinOffset&&(be-=jt._pinOffset,We-=jt._pinOffset),jt=jt.parentNode;K&&K.forEach(function(Me){return Me.revert(!1,!0)}),D.start=be,D.end=We,Ee=Je=Nn?de:ae(),!w&&!Nn&&(Ee<de&&ae(de),D.scroll.rec=0),D.revert(!1,!0),Pe=vn(),U&&(Be=-1,U.restart(!0)),xn=0,i&&L&&(i._initted||te)&&i.progress()!==te&&i.progress(te||0,!0).render(i.time(),!0,!0),(nn||J!==D.progress||w||_||i&&!i._initted)&&(i&&!L&&(i._initted||J||i.vars.immediateRender!==!1)&&i.totalProgress(w&&be<-.001&&!J?Re.utils.normalize(be,We,0):J,!0),D.progress=nn||(Ee-be)/qe===J?0:J),d&&g&&(Xe._pinOffset=Math.round(D.progress*j)),ue&&ue.invalidate(),isNaN(X)||(X-=Re.getProperty($,C.p),ve-=Re.getProperty(je,C.p),go($,C,X),go(Te,C,X-($e||0)),go(je,C,ve),go(Ne,C,ve-($e||0))),nn&&!Nn&&D.update(),u&&!Nn&&!_t&&(_t=!0,u(D),_t=!1)}},D.getVelocity=function(){return(ae()-Je)/(vn()-Ma)*1e3||0},D.endAnimation=function(){fa(D.callbackAnimation),i&&(ue?ue.progress(1):i.paused()?L||fa(i,D.direction<0,1):fa(i,i.reversed()))},D.labelToScroll=function(le){return i&&i.labels&&(be||D.refresh()||be)+i.labels[le]/i.duration()*qe||0},D.getTrailing=function(le){var Ge=tt.indexOf(D),De=D.direction>0?tt.slice(0,Ge).reverse():tt.slice(Ge+1);return(Kn(le)?De.filter(function($e){return $e.vars.preventOverlaps===le}):De).filter(function($e){return D.direction>0?$e.end<=be:$e.start>=We})},D.update=function(le,Ge,De){if(!(w&&!De&&!le)){var $e=Nn===!0?de:D.scroll(),Yt=le?0:($e-be)/qe,nt=Yt<0?0:Yt>1?1:Yt||0,Ct=D.progress,nn,Pt,bt,lt,Tn,At,pn,wn;if(Ge&&(Je=Ee,Ee=w?ae():$e,M&&(pe=ge,ge=i&&!L?i.totalProgress():nt)),p&&d&&!xn&&!lo&&gi&&(!nt&&be<$e+($e-Je)/(vn()-Ma)*p?nt=1e-4:nt===1&&We>$e+($e-Je)/(vn()-Ma)*p&&(nt=.9999)),nt!==Ct&&D.enabled){if(nn=D.isActive=!!nt&&nt<1,Pt=!!Ct&&Ct<1,At=nn!==Pt,Tn=At||!!nt!=!!Ct,D.direction=nt>Ct?1:-1,D.progress=nt,Tn&&!xn&&(bt=nt&&!Ct?0:nt===1?1:Ct===1?2:3,L&&(lt=!At&&I[bt+1]!=="none"&&I[bt+1]||I[bt],wn=i&&(lt==="complete"||lt==="reset"||lt in i))),E&&(At||wn)&&(wn||h||!i)&&(bn(E)?E(D):D.getTrailing(E).forEach(function(Ti){return Ti.endAnimation()})),L||(ue&&!xn&&!lo?(ue._dp._time-ue._start!==ue._time&&ue.render(ue._dp._time-ue._start),ue.resetTo?ue.resetTo("totalProgress",nt,i._tTime/i._tDur):(ue.vars.totalProgress=nt,ue.invalidate().restart())):i&&i.totalProgress(nt,!!(xn&&(Pe||le)))),d){if(le&&g&&(Xe.style[g+C.os2]=fe),!O)B(ba(V+j*nt));else if(Tn){if(pn=!le&&nt>Ct&&We+1>$e&&$e+1>=Ii(N,C),y)if(!le&&(nn||pn)){var qt=Ki(d,!0),Ft=$e-be;_d(d,gt,qt.top+(C===Qt?Ft:0)+Jt,qt.left+(C===Qt?0:Ft)+Jt)}else _d(d,Xe);Ys(nn||pn?F:Mt),ee&&nt<1&&nn||B(V+(nt===1&&!pn?j:0))}}M&&!se.tween&&!xn&&!lo&&U.restart(!0),o&&(At||A&&nt&&(nt<1||!Hl))&&Ka(o.targets).forEach(function(Ti){return Ti.classList[nn||A?"add":"remove"](o.className)}),a&&!L&&!le&&a(D),Tn&&!xn?(L&&(wn&&(lt==="complete"?i.pause().totalProgress(1):lt==="reset"?i.restart(!0).pause():lt==="restart"?i.restart(!0):i[lt]()),a&&a(D)),(At||!Hl)&&(c&&At&&gs(D,c),z[bt]&&gs(D,z[bt]),A&&(nt===1?D.kill(!1,1):z[bt]=0),At||(bt=nt===1?1:3,z[bt]&&gs(D,z[bt]))),v&&!nn&&Math.abs(D.getVelocity())>(ya(v)?v:2500)&&(fa(D.callbackAnimation),ue?ue.progress(1):fa(i,lt==="reverse"?1:!nt,1))):L&&a&&!xn&&a(D)}if(me){var jt=w?$e/w.duration()*(w._caScrollDist||0):$e;Q(jt+($._isFlipped?1:0)),me(jt)}_e&&_e(-$e/w.duration()*(w._caScrollDist||0))}},D.enable=function(le,Ge){D.enabled||(D.enabled=!0,cn(N,"resize",Ea),H||cn(N,"scroll",xs),re&&cn(r,"refreshInit",re),le!==!1&&(D.progress=J=0,Ee=Je=Be=ae()),Ge!==!1&&D.refresh())},D.getTween=function(le){return le&&se?se.tween:ue},D.setPositions=function(le,Ge,De,$e){if(w){var Yt=w.scrollTrigger,nt=w.duration(),Ct=Yt.end-Yt.start;le=Yt.start+Ct*le/nt,Ge=Yt.start+Ct*Ge/nt}D.refresh(!1,!1,{start:ld(le,De&&!!D._startClamp),end:ld(Ge,De&&!!D._endClamp)},$e),D.update()},D.adjustPinSpacing=function(le){if(ce&&le){var Ge=ce.indexOf(C.d)+1;ce[Ge]=parseFloat(ce[Ge])+le+Jt,ce[1]=parseFloat(ce[1])+le+Jt,Ys(ce)}},D.disable=function(le,Ge){if(le!==!1&&D.revert(!0,!0),D.enabled&&(D.enabled=D.isActive=!1,Ge||ue&&ue.pause(),de=0,we&&(we.uncache=1),re&&an(r,"refreshInit",re),U&&(U.pause(),se.tween&&se.tween.kill()&&(se.tween=0)),!H)){for(var De=tt.length;De--;)if(tt[De].scroller===N&&tt[De]!==D)return;an(N,"resize",Ea),H||an(N,"scroll",xs)}},D.kill=function(le,Ge){D.disable(le,Ge),ue&&!Ge&&ue.kill(),l&&delete $c[l];var De=tt.indexOf(D);De>=0&&tt.splice(De,1),De===Ln&&jo>0&&Ln--,De=0,tt.forEach(function($e){return $e.scroller===D.scroller&&(De=1)}),De||Nn||(D.scroll.rec=0),i&&(i.scrollTrigger=null,le&&i.revert({kill:!1}),Ge||i.kill()),Te&&[Te,Ne,$,je].forEach(function($e){return $e.parentNode&&$e.parentNode.removeChild($e)}),Ba===D&&(Ba=0),d&&(we&&(we.uncache=1),De=0,tt.forEach(function($e){return $e.pin===d&&De++}),De||(we.spacer=0)),n.onKill&&n.onKill(D)},tt.push(D),D.enable(!1,!1),xe&&xe(D),i&&i.add&&!qe){var ze=D.update;D.update=function(){D.update=ze,rt.cache++,be||We||D.refresh()},Re.delayedCall(.01,D.update),qe=.01,be=We=0}else D.refresh();d&&I_()},r.register=function(n){return Is||(Re=n||Gp(),zp()&&window.document&&r.enable(),Is=Sa),Is},r.defaults=function(n){if(n)for(var i in n)ho[i]=n[i];return ho},r.disable=function(n,i){Sa=0,tt.forEach(function(a){return a[i?"kill":"disable"](n)}),an(it,"wheel",xs),an(xt,"scroll",xs),clearInterval(oo),an(xt,"touchcancel",Pi),an(gt,"touchstart",Pi),uo(an,xt,"pointerdown,touchstart,mousedown",cd),uo(an,xt,"pointerup,touchend,mouseup",ud),pl.kill(),co(an);for(var s=0;s<rt.length;s+=3)fo(an,rt[s],rt[s+1]),fo(an,rt[s],rt[s+2])},r.enable=function(){if(it=window,xt=document,jn=xt.documentElement,gt=xt.body,Re){if(Ka=Re.utils.toArray,La=Re.utils.clamp,Yc=Re.core.context||Pi,Vl=Re.core.suppressOverwrites||Pi,cf=it.history.scrollRestoration||"auto",Kc=it.pageYOffset||0,Re.core.globals("ScrollTrigger",r),gt){Sa=1,Xs=document.createElement("div"),Xs.style.height="100vh",Xs.style.position="absolute",jp(),A_(),Wt.register(Re),r.isTouch=Wt.isTouch,_r=Wt.isTouch&&/(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent),Xc=Wt.isTouch===1,cn(it,"wheel",xs),lf=[it,xt,jn,gt],Re.matchMedia?(r.matchMedia=function(u){var h=Re.matchMedia(),f;for(f in u)h.add(f,u[f]);return h},Re.addEventListener("matchMediaInit",function(){Kp(),mf()}),Re.addEventListener("matchMediaRevert",function(){return $p()}),Re.addEventListener("matchMedia",function(){$r(0,1),as("matchMedia")}),Re.matchMedia().add("(orientation: portrait)",function(){return Xl(),Xl})):console.warn("Requires GSAP 3.11.0 or later"),Xl(),cn(xt,"scroll",xs);var n=gt.hasAttribute("style"),i=gt.style,s=i.borderTopStyle,a=Re.core.Animation.prototype,o,l;for(a.revert||Object.defineProperty(a,"revert",{value:function(){return this.time(-.01,!0)}}),i.borderTopStyle="solid",o=Ki(gt),Qt.m=Math.round(o.top+Qt.sc())||0,In.m=Math.round(o.left+In.sc())||0,s?i.borderTopStyle=s:i.removeProperty("border-top-style"),n||(gt.setAttribute("style",""),gt.removeAttribute("style")),oo=setInterval(hd,250),Re.delayedCall(.5,function(){return lo=0}),cn(xt,"touchcancel",Pi),cn(gt,"touchstart",Pi),uo(cn,xt,"pointerdown,touchstart,mousedown",cd),uo(cn,xt,"pointerup,touchend,mouseup",ud),Wc=Re.utils.checkPrefix("transform"),Jo.push(Wc),Is=vn(),pl=Re.delayedCall(.2,$r).pause(),Us=[xt,"visibilitychange",function(){var u=it.innerWidth,h=it.innerHeight;xt.hidden?(sd=u,ad=h):(sd!==u||ad!==h)&&Ea()},xt,"DOMContentLoaded",$r,it,"load",$r,it,"resize",Ea],co(cn),tt.forEach(function(u){return u.enable(0,1)}),l=0;l<rt.length;l+=3)fo(an,rt[l],rt[l+1]),fo(an,rt[l],rt[l+2])}else if(xt){var c=function u(){r.enable(),xt.removeEventListener("DOMContentLoaded",u)};xt.addEventListener("DOMContentLoaded",c)}}},r.config=function(n){"limitCallbacks"in n&&(Hl=!!n.limitCallbacks);var i=n.syncInterval;i&&clearInterval(oo)||(oo=i)&&setInterval(hd,i),"ignoreMobileResize"in n&&(Xc=r.isTouch===1&&n.ignoreMobileResize),"autoRefreshEvents"in n&&(co(an)||co(cn,n.autoRefreshEvents||"none"),Op=(n.autoRefreshEvents+"").indexOf("resize")===-1)},r.scrollerProxy=function(n,i){var s=Fn(n),a=rt.indexOf(s),o=rs(s);~a&&rt.splice(a,o?6:2),i&&(o?Oi.unshift(it,i,gt,i,jn,i):Oi.unshift(s,i))},r.clearMatchMedia=function(n){tt.forEach(function(i){return i._ctx&&i._ctx.query===n&&i._ctx.kill(!0,!0)})},r.isInViewport=function(n,i,s){var a=(Kn(n)?Fn(n):n).getBoundingClientRect(),o=a[s?ts:ns]*i||0;return s?a.right-o>0&&a.left+o<it.innerWidth:a.bottom-o>0&&a.top+o<it.innerHeight},r.positionInViewport=function(n,i,s){Kn(n)&&(n=Fn(n));var a=n.getBoundingClientRect(),o=a[s?ts:ns],l=i==null?o/2:i in gl?gl[i]*o:~i.indexOf("%")?parseFloat(i)*o/100:parseFloat(i)||0;return s?(a.left+l)/it.innerWidth:(a.top+l)/it.innerHeight},r.killAll=function(n){if(tt.slice(0).forEach(function(s){return s.vars.id!=="ScrollSmoother"&&s.kill()}),n!==!0){var i=ss.killAll||[];ss={},i.forEach(function(s){return s()})}},r})();st.version="3.15.0";st.saveStyles=function(r){return r?Ka(r).forEach(function(e){if(e&&e.style){var t=$n.indexOf(e);t>=0&&$n.splice(t,5),$n.push(e,e.style.cssText,e.getBBox&&e.getAttribute("transform"),Re.core.getCache(e),Yc())}}):$n};st.revert=function(r,e){return mf(!r,e)};st.create=function(r,e){return new st(r,e)};st.refresh=function(r){return r?Ea(!0):(Is||st.register())&&$r(!0)};st.update=function(r){return++rt.cache&&Qi(r===!0?2:0)};st.clearScrollMemory=Zp;st.maxScroll=function(r,e){return Ii(r,e?In:Qt)};st.getScrollFunc=function(r,e){return Lr(Fn(r),e?In:Qt)};st.getById=function(r){return $c[r]};st.getAll=function(){return tt.filter(function(r){return r.vars.id!=="ScrollSmoother"})};st.isScrolling=function(){return!!gi};st.snapDirectional=pf;st.addEventListener=function(r,e){var t=ss[r]||(ss[r]=[]);~t.indexOf(e)||t.push(e)};st.removeEventListener=function(r,e){var t=ss[r],n=t&&t.indexOf(e);n>=0&&t.splice(n,1)};st.batch=function(r,e){var t=[],n={},i=e.interval||.016,s=e.batchMax||1e9,a=function(c,u){var h=[],f=[],d=Re.delayedCall(i,function(){u(h,f),h=[],f=[]}).pause();return function(g){h.length||d.restart(!0),h.push(g.trigger),f.push(g),s<=h.length&&d.progress(1)}},o;for(o in e)n[o]=o.substr(0,2)==="on"&&bn(e[o])&&o!=="onRefreshInit"?a(o,e[o]):e[o];return bn(s)&&(s=s(),cn(st,"refresh",function(){return s=e.batchMax()})),Ka(r).forEach(function(l){var c={};for(o in n)c[o]=n[o];c.trigger=l,t.push(st.create(c))}),t};var vd=function(e,t,n,i){return t>i?e(i):t<0&&e(0),n>i?(i-t)/(n-t):n<0?t/(t-n):1},ql=function r(e,t){t===!0?e.style.removeProperty("touch-action"):e.style.touchAction=t===!0?"auto":t?"pan-"+t+(Wt.isTouch?" pinch-zoom":""):"none",e===jn&&r(gt,t)},_o={auto:1,scroll:1},k_=function(e){var t=e.event,n=e.target,i=e.axis,s=(t.changedTouches?t.changedTouches[0]:t).target,a=s._gsap||Re.core.getCache(s),o=vn(),l;if(!a._isScrollT||o-a._isScrollT>2e3){for(;s&&s!==gt&&(s.scrollHeight<=s.clientHeight&&s.scrollWidth<=s.clientWidth||!(_o[(l=fi(s)).overflowY]||_o[l.overflowX]));)s=s.parentNode;a._isScroll=s&&s!==n&&!rs(s)&&(_o[(l=fi(s)).overflowY]||_o[l.overflowX]),a._isScrollT=o}(a._isScroll||i==="x")&&(t.stopPropagation(),t._gsapAllow=!0)},Qp=function(e,t,n,i){return Wt.create({target:e,capture:!0,debounce:!1,lockAxis:!0,type:t,onWheel:i=i&&k_,onPress:i,onDrag:i,onScroll:i,onEnable:function(){return n&&cn(xt,Wt.eventTypes[0],Sd,!1,!0)},onDisable:function(){return an(xt,Wt.eventTypes[0],Sd,!0)}})},z_=/(input|label|select|textarea)/i,Md,Sd=function(e){var t=z_.test(e.target.tagName);(t||Md)&&(e._gsapAllow=!0,Md=t)},G_=function(e){Hr(e)||(e={}),e.preventDefault=e.isNormalizer=e.allowClicks=!0,e.type||(e.type="wheel,touch"),e.debounce=!!e.debounce,e.id=e.id||"normalizer";var t=e,n=t.normalizeScrollX,i=t.momentum,s=t.allowNestedScroll,a=t.onRelease,o,l,c=Fn(e.target)||jn,u=Re.core.globals().ScrollSmoother,h=u&&u.get(),f=_r&&(e.content&&Fn(e.content)||h&&e.content!==!1&&!h.smooth()&&h.content()),d=Lr(c,Qt),g=Lr(c,In),_=1,p=(Wt.isTouch&&it.visualViewport?it.visualViewport.scale*it.visualViewport.width:it.outerWidth)/it.innerWidth,m=0,b=bn(i)?function(){return i(o)}:function(){return i||2.8},A,M,y=Qp(c,e.type,!0,s),T=function(){return M=!1},w=Pi,v=Pi,E=function(){l=Ii(c,Qt),v=La(_r?1:0,l),n&&(w=La(0,Ii(c,In))),A=is},C=function(){f._gsap.y=ba(parseFloat(f._gsap.y)+d.offset)+"px",f.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+parseFloat(f._gsap.y)+", 0, 1)",d.offset=d.cacheID=0},L=function(){if(M){requestAnimationFrame(T);var W=ba(o.deltaY/2),Z=v(d.v-W);if(f&&Z!==d.v+d.offset){d.offset=Z-d.v;var D=ba((parseFloat(f&&f._gsap.y)||0)-d.offset);f.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+D+", 0, 1)",f._gsap.y=D+"px",d.cacheID=rt.cache,Qi()}return!0}d.offset&&C(),M=!0},N,Y,H,O,z=function(){E(),N.isActive()&&N.vars.scrollY>l&&(d()>l?N.progress(1)&&d(l):N.resetTo("scrollY",l))};return f&&Re.set(f,{y:"+=0"}),e.ignoreCheck=function(I){return _r&&I.type==="touchmove"&&L()||_>1.05&&I.type!=="touchstart"||o.isGesturing||I.touches&&I.touches.length>1},e.onPress=function(){M=!1;var I=_;_=ba((it.visualViewport&&it.visualViewport.scale||1)/p),N.pause(),I!==_&&ql(c,_>1.01?!0:n?!1:"x"),Y=g(),H=d(),E(),A=is},e.onRelease=e.onGestureStart=function(I,W){if(d.offset&&C(),!W)O.restart(!0);else{rt.cache++;var Z=b(),D,re;n&&(D=g(),re=D+Z*.05*-I.velocityX/.227,Z*=vd(g,D,re,Ii(c,In)),N.vars.scrollX=w(re)),D=d(),re=D+Z*.05*-I.velocityY/.227,Z*=vd(d,D,re,Ii(c,Qt)),N.vars.scrollY=v(re),N.invalidate().duration(Z).play(.01),(_r&&N.vars.scrollY>=l||D>=l-1)&&Re.to({},{onUpdate:z,duration:Z})}a&&a(I)},e.onWheel=function(){N._ts&&N.pause(),vn()-m>1e3&&(A=0,m=vn())},e.onChange=function(I,W,Z,D,re){if(is!==A&&E(),W&&n&&g(w(D[2]===W?Y+(I.startX-I.x):g()+W-D[1])),Z){d.offset&&C();var he=re[2]===Z,He=he?H+I.startY-I.y:d()+Z-re[1],Be=v(He);he&&He!==Be&&(H+=Be-He),d(Be)}(Z||W)&&Qi()},e.onEnable=function(){ql(c,n?!1:"x"),st.addEventListener("refresh",z),cn(it,"resize",z),d.smooth&&(d.target.style.scrollBehavior="auto",d.smooth=g.smooth=!1),y.enable()},e.onDisable=function(){ql(c,!0),an(it,"resize",z),st.removeEventListener("refresh",z),y.kill()},e.lockAxis=e.lockAxis!==!1,o=new Wt(e),o.iOS=_r,_r&&!d()&&d(1),_r&&Re.ticker.add(Pi),O=o._dc,N=Re.to(o,{ease:"power4",paused:!0,inherit:!1,scrollX:n?"+=0.1":"+=0",scrollY:"+=0.1",modifiers:{scrollY:Jp(d,d(),function(){return N.pause()})},onUpdate:Qi,onComplete:O.vars.onComplete}),o};st.sort=function(r){if(bn(r))return tt.sort(r);var e=it.pageYOffset||0;return st.getAll().forEach(function(t){return t._sortY=t.trigger?e+t.trigger.getBoundingClientRect().top:t.start+it.innerHeight}),tt.sort(r||function(t,n){return(t.vars.refreshPriority||0)*-1e6+(t.vars.containerAnimation?1e6:t._sortY)-((n.vars.containerAnimation?1e6:n._sortY)+(n.vars.refreshPriority||0)*-1e6)})};st.observe=function(r){return new Wt(r)};st.normalizeScroll=function(r){if(typeof r>"u")return Dn;if(r===!0&&Dn)return Dn.enable();if(r===!1){Dn&&Dn.kill(),Dn=r;return}var e=r instanceof Wt?r:G_(r);return Dn&&Dn.target===e.target&&Dn.kill(),rs(e.target)&&(Dn=e),e};st.core={_getVelocityProp:Hc,_inputObserver:Qp,_scrollers:rt,_proxies:Oi,bridge:{ss:function(){gi||as("scrollStart"),gi=vn()},ref:function(){return xn}}};Gp()&&Re.registerPlugin(st);Dt.registerPlugin(st);const gf="185",V_=0,bd=1,H_=2,el=1,W_=2,Ta=3,Nr=0,Vn=1,Zi=2,er=0,qs=1,jc=2,yd=3,Ed=4,X_=5,Xr=100,Y_=101,q_=102,$_=103,K_=104,Z_=200,j_=201,J_=202,Q_=203,Jc=204,Qc=205,e0=206,t0=207,n0=208,i0=209,r0=210,s0=211,a0=212,o0=213,l0=214,eu=0,tu=1,nu=2,na=3,iu=4,ru=5,su=6,au=7,em=0,c0=1,u0=2,Bi=0,tm=1,nm=2,im=3,rm=4,sm=5,am=6,om=7,lm=300,os=301,ia=302,$l=303,Kl=304,Rl=306,ou=1e3,Ji=1001,lu=1002,dn=1003,f0=1004,xo=1005,yn=1006,Zl=1007,Kr=1008,hi=1009,cm=1010,um=1011,ja=1012,_f=1013,Gi=1014,Ui=1015,sr=1016,xf=1017,vf=1018,Ja=1020,fm=35902,dm=35899,hm=1021,pm=1022,bi=1023,ar=1026,Zr=1027,mm=1028,Mf=1029,ls=1030,Sf=1031,bf=1033,tl=33776,nl=33777,il=33778,rl=33779,cu=35840,uu=35841,fu=35842,du=35843,hu=36196,pu=37492,mu=37496,gu=37488,_u=37489,_l=37490,xu=37491,vu=37808,Mu=37809,Su=37810,bu=37811,yu=37812,Eu=37813,Tu=37814,wu=37815,Au=37816,Ru=37817,Cu=37818,Pu=37819,Du=37820,Lu=37821,Nu=36492,Iu=36494,Uu=36495,Fu=36283,Ou=36284,xl=36285,Bu=36286,d0=3200,Td=0,h0=1,xr="",ci="srgb",vl="srgb-linear",Ml="linear",vt="srgb",vs=7680,wd=519,p0=512,m0=513,g0=514,yf=515,_0=516,x0=517,Ef=518,v0=519,Ad=35044,Rd="300 es",Fi=2e3,Sl=2001;function M0(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function bl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function S0(){const r=bl("canvas");return r.style.display="block",r}const Cd={};function Pd(...r){const e="THREE."+r.shift();console.log(e,...r)}function gm(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function Ye(...r){r=gm(r);const e="THREE."+r.shift();{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function pt(...r){r=gm(r);const e="THREE."+r.shift();{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function $s(...r){const e=r.join(" ");e in Cd||(Cd[e]=!0,Ye(...r))}function b0(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const y0={[eu]:tu,[nu]:su,[iu]:au,[na]:ru,[tu]:eu,[su]:nu,[au]:iu,[ru]:na};class fs{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const gn=["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 Dd=1234567;const ka=Math.PI/180,Qa=180/Math.PI;function aa(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(gn[r&255]+gn[r>>8&255]+gn[r>>16&255]+gn[r>>24&255]+"-"+gn[e&255]+gn[e>>8&255]+"-"+gn[e>>16&15|64]+gn[e>>24&255]+"-"+gn[t&63|128]+gn[t>>8&255]+"-"+gn[t>>16&255]+gn[t>>24&255]+gn[n&255]+gn[n>>8&255]+gn[n>>16&255]+gn[n>>24&255]).toLowerCase()}function ot(r,e,t){return Math.max(e,Math.min(t,r))}function Tf(r,e){return(r%e+e)%e}function E0(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function T0(r,e,t){return r!==e?(t-r)/(e-r):0}function za(r,e,t){return(1-t)*r+t*e}function w0(r,e,t,n){return za(r,e,1-Math.exp(-t*n))}function A0(r,e=1){return e-Math.abs(Tf(r,e*2)-e)}function R0(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function C0(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function P0(r,e){return r+Math.floor(Math.random()*(e-r+1))}function D0(r,e){return r+Math.random()*(e-r)}function L0(r){return r*(.5-Math.random())}function N0(r){r!==void 0&&(Dd=r);let e=Dd+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function I0(r){return r*ka}function U0(r){return r*Qa}function F0(r){return(r&r-1)===0&&r!==0}function O0(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function B0(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function k0(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),f=a((e-n)/2),d=s((n-e)/2),g=a((n-e)/2);switch(i){case"XYX":r.set(o*u,l*h,l*f,o*c);break;case"YZY":r.set(l*f,o*u,l*h,o*c);break;case"ZXZ":r.set(l*h,l*f,o*u,o*c);break;case"XZX":r.set(o*u,l*g,l*d,o*c);break;case"YXY":r.set(l*d,o*u,l*g,o*c);break;case"ZYZ":r.set(l*g,l*d,o*u,o*c);break;default:Ye("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Fs(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Cn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const Ld={DEG2RAD:ka,RAD2DEG:Qa,generateUUID:aa,clamp:ot,euclideanModulo:Tf,mapLinear:E0,inverseLerp:T0,lerp:za,damp:w0,pingpong:A0,smoothstep:R0,smootherstep:C0,randInt:P0,randFloat:D0,randFloatSpread:L0,seededRandom:N0,degToRad:I0,radToDeg:U0,isPowerOfTwo:F0,ceilPowerOfTwo:O0,floorPowerOfTwo:B0,setQuaternionFromProperEuler:k0,normalize:Cn,denormalize:Fs},Cf=class Cf{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ot(this.x,e.x,t.x),this.y=ot(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ot(this.x,e,t),this.y=ot(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ot(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ot(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Cf.prototype.isVector2=!0;let mt=Cf;class oa{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3],f=s[a+0],d=s[a+1],g=s[a+2],_=s[a+3];if(h!==_||l!==f||c!==d||u!==g){let p=l*f+c*d+u*g+h*_;p<0&&(f=-f,d=-d,g=-g,_=-_,p=-p);let m=1-o;if(p<.9995){const b=Math.acos(p),A=Math.sin(b);m=Math.sin(m*b)/A,o=Math.sin(o*b)/A,l=l*m+f*o,c=c*m+d*o,u=u*m+g*o,h=h*m+_*o}else{l=l*m+f*o,c=c*m+d*o,u=u*m+g*o,h=h*m+_*o;const b=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=b,c*=b,u*=b,h*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[a],f=s[a+1],d=s[a+2],g=s[a+3];return e[t]=o*g+u*h+l*d-c*f,e[t+1]=l*g+u*f+c*h-o*d,e[t+2]=c*g+u*d+o*f-l*h,e[t+3]=u*g-o*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(i/2),h=o(s/2),f=l(n/2),d=l(i/2),g=l(s/2);switch(a){case"XYZ":this._x=f*u*h+c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h-f*d*g;break;case"YXZ":this._x=f*u*h+c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h+f*d*g;break;case"ZXY":this._x=f*u*h-c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h-f*d*g;break;case"ZYX":this._x=f*u*h-c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h+f*d*g;break;case"YZX":this._x=f*u*h+c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h-f*d*g;break;case"XZY":this._x=f*u*h-c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h+f*d*g;break;default:Ye("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+o+h;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(a-i)*d}else if(n>o&&n>h){const d=2*Math.sqrt(1+n-o-h);this._w=(u-l)/d,this._x=.25*d,this._y=(i+a)/d,this._z=(s+c)/d}else if(o>h){const d=2*Math.sqrt(1+o-n-h);this._w=(s-c)/d,this._x=(i+a)/d,this._y=.25*d,this._z=(l+u)/d}else{const d=2*Math.sqrt(1+h-n-o);this._w=(a-i)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ot(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+i*c-s*l,this._y=i*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-i*o,this._w=a*u-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Pf=class Pf{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Nd.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Nd.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),u=2*(o*t-s*i),h=2*(s*n-a*t);return this.x=t+l*c+a*h-o*u,this.y=n+l*u+o*c-s*h,this.z=i+l*h+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ot(this.x,e.x,t.x),this.y=ot(this.y,e.y,t.y),this.z=ot(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ot(this.x,e,t),this.y=ot(this.y,e,t),this.z=ot(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ot(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return jl.copy(this).projectOnVector(e),this.sub(jl)}reflect(e){return this.sub(jl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ot(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Pf.prototype.isVector3=!0;let q=Pf;const jl=new q,Nd=new oa,Df=class Df{constructor(e,t,n,i,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c)}set(e,t,n,i,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],g=n[8],_=i[0],p=i[3],m=i[6],b=i[1],A=i[4],M=i[7],y=i[2],T=i[5],w=i[8];return s[0]=a*_+o*b+l*y,s[3]=a*p+o*A+l*T,s[6]=a*m+o*M+l*w,s[1]=c*_+u*b+h*y,s[4]=c*p+u*A+h*T,s[7]=c*m+u*M+h*w,s[2]=f*_+d*b+g*y,s[5]=f*p+d*A+g*T,s[8]=f*m+d*M+g*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,f=o*l-u*s,d=c*s-a*l,g=t*h+n*f+i*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=h*_,e[1]=(i*c-u*n)*_,e[2]=(o*n-i*a)*_,e[3]=f*_,e[4]=(u*t-i*l)*_,e[5]=(i*s-o*t)*_,e[6]=d*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return $s("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Jl.makeScale(e,t)),this}rotate(e){return $s("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Jl.makeRotation(-e)),this}translate(e,t){return $s("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Jl.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Df.prototype.isMatrix3=!0;let Ke=Df;const Jl=new Ke,Id=new Ke().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ud=new Ke().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function z0(){const r={enabled:!0,workingColorSpace:vl,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===vt&&(i.r=tr(i.r),i.g=tr(i.g),i.b=tr(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===vt&&(i.r=Ks(i.r),i.g=Ks(i.g),i.b=Ks(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===xr?Ml:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return $s("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return $s("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[vl]:{primaries:e,whitePoint:n,transfer:Ml,toXYZ:Id,fromXYZ:Ud,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ci},outputColorSpaceConfig:{drawingBufferColorSpace:ci}},[ci]:{primaries:e,whitePoint:n,transfer:vt,toXYZ:Id,fromXYZ:Ud,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ci}}}),r}const ct=z0();function tr(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Ks(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Ms;class G0{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ms===void 0&&(Ms=bl("canvas")),Ms.width=e.width,Ms.height=e.height;const i=Ms.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ms}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=bl("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=tr(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(tr(t[n]/255)*255):t[n]=tr(t[n]);return{data:t,width:e.width,height:e.height}}else return Ye("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let V0=0;class wf{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:V0++}),this.uuid=aa(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(Ql(i[a].image)):s.push(Ql(i[a]))}else s=Ql(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Ql(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?G0.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(Ye("Texture: Unable to serialize Texture."),{})}let H0=0;const ec=new q;class Un extends fs{constructor(e=Un.DEFAULT_IMAGE,t=Un.DEFAULT_MAPPING,n=Ji,i=Ji,s=yn,a=Kr,o=bi,l=hi,c=Un.DEFAULT_ANISOTROPY,u=xr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:H0++}),this.uuid=aa(),this.name="",this.source=new wf(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new mt(0,0),this.repeat=new mt(1,1),this.center=new mt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(ec).x}get height(){return this.source.getSize(ec).y}get depth(){return this.source.getSize(ec).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Ye(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Ye(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==lm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ou:e.x=e.x-Math.floor(e.x);break;case Ji:e.x=e.x<0?0:1;break;case lu:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ou:e.y=e.y-Math.floor(e.y);break;case Ji:e.y=e.y<0?0:1;break;case lu:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Un.DEFAULT_IMAGE=null;Un.DEFAULT_MAPPING=lm;Un.DEFAULT_ANISOTROPY=1;const Lf=class Lf{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],g=l[9],_=l[2],p=l[6],m=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-_)<.01&&Math.abs(g-p)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+_)<.1&&Math.abs(g+p)<.1&&Math.abs(c+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const A=(c+1)/2,M=(d+1)/2,y=(m+1)/2,T=(u+f)/4,w=(h+_)/4,v=(g+p)/4;return A>M&&A>y?A<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(A),i=T/n,s=w/n):M>y?M<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),n=T/i,s=v/i):y<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(y),n=w/s,i=v/s),this.set(n,i,s,t),this}let b=Math.sqrt((p-g)*(p-g)+(h-_)*(h-_)+(f-u)*(f-u));return Math.abs(b)<.001&&(b=1),this.x=(p-g)/b,this.y=(h-_)/b,this.z=(f-u)/b,this.w=Math.acos((c+d+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ot(this.x,e.x,t.x),this.y=ot(this.y,e.y,t.y),this.z=ot(this.z,e.z,t.z),this.w=ot(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ot(this.x,e,t),this.y=ot(this.y,e,t),this.z=ot(this.z,e,t),this.w=ot(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ot(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Lf.prototype.isVector4=!0;let Bt=Lf;class W0 extends fs{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:yn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Bt(0,0,e,t),this.scissorTest=!1,this.viewport=new Bt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},s=new Un(i),a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:yn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new wf(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ki extends W0{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class _m extends Un{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=dn,this.minFilter=dn,this.wrapR=Ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class X0 extends Un{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=dn,this.minFilter=dn,this.wrapR=Ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const yl=class yl{constructor(e,t,n,i,s,a,o,l,c,u,h,f,d,g,_,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c,u,h,f,d,g,_,p)}set(e,t,n,i,s,a,o,l,c,u,h,f,d,g,_,p){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=u,m[10]=h,m[14]=f,m[3]=d,m[7]=g,m[11]=_,m[15]=p,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 yl().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,i=1/Ss.setFromMatrixColumn(e,0).length(),s=1/Ss.setFromMatrixColumn(e,1).length(),a=1/Ss.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*u,d=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+g*c,t[5]=f-_*c,t[9]=-o*l,t[2]=_-f*c,t[6]=g+d*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,d=l*h,g=c*u,_=c*h;t[0]=f+_*o,t[4]=g*o-d,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=d*o-g,t[6]=_+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,d=l*h,g=c*u,_=c*h;t[0]=f-_*o,t[4]=-a*h,t[8]=g+d*o,t[1]=d+g*o,t[5]=a*u,t[9]=_-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,d=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=g*c-d,t[8]=f*c+_,t[1]=l*h,t[5]=_*c+f,t[9]=d*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,d=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-f*h,t[8]=g*h+d,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=d*h+g,t[10]=f-_*h}else if(e.order==="XZY"){const f=a*l,d=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+_,t[5]=a*u,t[9]=d*h-g,t[2]=g*h-d,t[6]=o*u,t[10]=_*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Y0,e,q0)}lookAt(e,t,n){const i=this.elements;return Yn.subVectors(e,t),Yn.lengthSq()===0&&(Yn.z=1),Yn.normalize(),fr.crossVectors(n,Yn),fr.lengthSq()===0&&(Math.abs(n.z)===1?Yn.x+=1e-4:Yn.z+=1e-4,Yn.normalize(),fr.crossVectors(n,Yn)),fr.normalize(),vo.crossVectors(Yn,fr),i[0]=fr.x,i[4]=vo.x,i[8]=Yn.x,i[1]=fr.y,i[5]=vo.y,i[9]=Yn.y,i[2]=fr.z,i[6]=vo.z,i[10]=Yn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],h=n[5],f=n[9],d=n[13],g=n[2],_=n[6],p=n[10],m=n[14],b=n[3],A=n[7],M=n[11],y=n[15],T=i[0],w=i[4],v=i[8],E=i[12],C=i[1],L=i[5],N=i[9],Y=i[13],H=i[2],O=i[6],z=i[10],I=i[14],W=i[3],Z=i[7],D=i[11],re=i[15];return s[0]=a*T+o*C+l*H+c*W,s[4]=a*w+o*L+l*O+c*Z,s[8]=a*v+o*N+l*z+c*D,s[12]=a*E+o*Y+l*I+c*re,s[1]=u*T+h*C+f*H+d*W,s[5]=u*w+h*L+f*O+d*Z,s[9]=u*v+h*N+f*z+d*D,s[13]=u*E+h*Y+f*I+d*re,s[2]=g*T+_*C+p*H+m*W,s[6]=g*w+_*L+p*O+m*Z,s[10]=g*v+_*N+p*z+m*D,s[14]=g*E+_*Y+p*I+m*re,s[3]=b*T+A*C+M*H+y*W,s[7]=b*w+A*L+M*O+y*Z,s[11]=b*v+A*N+M*z+y*D,s[15]=b*E+A*Y+M*I+y*re,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],g=e[3],_=e[7],p=e[11],m=e[15],b=l*d-c*f,A=o*d-c*h,M=o*f-l*h,y=a*d-c*u,T=a*f-l*u,w=a*h-o*u;return t*(_*b-p*A+m*M)-n*(g*b-p*y+m*T)+i*(g*A-_*y+m*w)-s*(g*M-_*T+p*w)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],u=e[10];return t*(a*u-o*c)-n*(s*u-o*l)+i*(s*c-a*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],g=e[12],_=e[13],p=e[14],m=e[15],b=t*o-n*a,A=t*l-i*a,M=t*c-s*a,y=n*l-i*o,T=n*c-s*o,w=i*c-s*l,v=u*_-h*g,E=u*p-f*g,C=u*m-d*g,L=h*p-f*_,N=h*m-d*_,Y=f*m-d*p,H=b*Y-A*N+M*L+y*C-T*E+w*v;if(H===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const O=1/H;return e[0]=(o*Y-l*N+c*L)*O,e[1]=(i*N-n*Y-s*L)*O,e[2]=(_*w-p*T+m*y)*O,e[3]=(f*T-h*w-d*y)*O,e[4]=(l*C-a*Y-c*E)*O,e[5]=(t*Y-i*C+s*E)*O,e[6]=(p*M-g*w-m*A)*O,e[7]=(u*w-f*M+d*A)*O,e[8]=(a*N-o*C+c*v)*O,e[9]=(n*C-t*N-s*v)*O,e[10]=(g*T-_*M+m*b)*O,e[11]=(h*M-u*T-d*b)*O,e[12]=(o*E-a*L-l*v)*O,e[13]=(t*L-n*E+i*v)*O,e[14]=(_*A-g*y-p*b)*O,e[15]=(u*y-h*A+f*b)*O,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,u*o+n,u*l-i*a,0,c*l-i*o,u*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,f=s*c,d=s*u,g=s*h,_=a*u,p=a*h,m=o*h,b=l*c,A=l*u,M=l*h,y=n.x,T=n.y,w=n.z;return i[0]=(1-(_+m))*y,i[1]=(d+M)*y,i[2]=(g-A)*y,i[3]=0,i[4]=(d-M)*T,i[5]=(1-(f+m))*T,i[6]=(p+b)*T,i[7]=0,i[8]=(g+A)*w,i[9]=(p-b)*w,i[10]=(1-(f+_))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let a=Ss.set(i[0],i[1],i[2]).length();const o=Ss.set(i[4],i[5],i[6]).length(),l=Ss.set(i[8],i[9],i[10]).length();s<0&&(a=-a),_i.copy(this);const c=1/a,u=1/o,h=1/l;return _i.elements[0]*=c,_i.elements[1]*=c,_i.elements[2]*=c,_i.elements[4]*=u,_i.elements[5]*=u,_i.elements[6]*=u,_i.elements[8]*=h,_i.elements[9]*=h,_i.elements[10]*=h,t.setFromRotationMatrix(_i),n.x=a,n.y=o,n.z=l,this}makePerspective(e,t,n,i,s,a,o=Fi,l=!1){const c=this.elements,u=2*s/(t-e),h=2*s/(n-i),f=(t+e)/(t-e),d=(n+i)/(n-i);let g,_;if(l)g=s/(a-s),_=a*s/(a-s);else if(o===Fi)g=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===Sl)g=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=Fi,l=!1){const c=this.elements,u=2/(t-e),h=2/(n-i),f=-(t+e)/(t-e),d=-(n+i)/(n-i);let g,_;if(l)g=1/(a-s),_=a/(a-s);else if(o===Fi)g=-2/(a-s),_=-(a+s)/(a-s);else if(o===Sl)g=-1/(a-s),_=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=h,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=g,c[14]=_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};yl.prototype.isMatrix4=!0;let Xt=yl;const Ss=new q,_i=new Xt,Y0=new q(0,0,0),q0=new q(1,1,1),fr=new q,vo=new q,Yn=new q,Fd=new Xt,Od=new oa;class cs{constructor(e=0,t=0,n=0,i=cs.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(ot(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ot(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(ot(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ot(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ot(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-ot(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:Ye("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Fd.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Fd,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Od.setFromEuler(this),this.setFromQuaternion(Od,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}cs.DEFAULT_ORDER="XYZ";class xm{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let $0=0;const Bd=new q,bs=new oa,Vi=new Xt,Mo=new q,da=new q,K0=new q,Z0=new oa,kd=new q(1,0,0),zd=new q(0,1,0),Gd=new q(0,0,1),Vd={type:"added"},j0={type:"removed"},ys={type:"childadded",child:null},tc={type:"childremoved",child:null};class Hn extends fs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:$0++}),this.uuid=aa(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Hn.DEFAULT_UP.clone();const e=new q,t=new cs,n=new oa,i=new q(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Xt},normalMatrix:{value:new Ke}}),this.matrix=new Xt,this.matrixWorld=new Xt,this.matrixAutoUpdate=Hn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xm,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return bs.setFromAxisAngle(e,t),this.quaternion.multiply(bs),this}rotateOnWorldAxis(e,t){return bs.setFromAxisAngle(e,t),this.quaternion.premultiply(bs),this}rotateX(e){return this.rotateOnAxis(kd,e)}rotateY(e){return this.rotateOnAxis(zd,e)}rotateZ(e){return this.rotateOnAxis(Gd,e)}translateOnAxis(e,t){return Bd.copy(e).applyQuaternion(this.quaternion),this.position.add(Bd.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(kd,e)}translateY(e){return this.translateOnAxis(zd,e)}translateZ(e){return this.translateOnAxis(Gd,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Vi.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Mo.copy(e):Mo.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),da.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Vi.lookAt(da,Mo,this.up):Vi.lookAt(Mo,da,this.up),this.quaternion.setFromRotationMatrix(Vi),i&&(Vi.extractRotation(i.matrixWorld),bs.setFromRotationMatrix(Vi),this.quaternion.premultiply(bs.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(pt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Vd),ys.child=e,this.dispatchEvent(ys),ys.child=null):pt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(j0),tc.child=e,this.dispatchEvent(tc),tc.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Vi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Vi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Vi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Vd),ys.child=e,this.dispatchEvent(ys),ys.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(da,e,K0),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(da,Z0,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,i=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*i,s[13]+=n-s[1]*t-s[5]*n-s[9]*i,s[14]+=i-s[2]*t-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),h=a(e.shapes),f=a(e.skeletons),d=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=i,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Hn.DEFAULT_UP=new q(0,1,0);Hn.DEFAULT_MATRIX_AUTO_UPDATE=!0;Hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class So extends Hn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const J0={type:"move"};class nc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new So,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new So,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new So,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new q,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const p=t.getJointPose(_,n),m=this._getHandJoint(c,_);p!==null&&(m.matrix.fromArray(p.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=p.radius),m.visible=p!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,g=.005;c.inputState.pinching&&f>d+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(J0)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new So;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const vm={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},dr={h:0,s:0,l:0},bo={h:0,s:0,l:0};function ic(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class dt{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ci){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ct.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=ct.workingColorSpace){return this.r=e,this.g=t,this.b=n,ct.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=ct.workingColorSpace){if(e=Tf(e,1),t=ot(t,0,1),n=ot(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=ic(a,s,e+1/3),this.g=ic(a,s,e),this.b=ic(a,s,e-1/3)}return ct.colorSpaceToWorking(this,i),this}setStyle(e,t=ci){function n(s){s!==void 0&&parseFloat(s)<1&&Ye("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ye("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ye("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ci){const n=vm[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ye("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=tr(e.r),this.g=tr(e.g),this.b=tr(e.b),this}copyLinearToSRGB(e){return this.r=Ks(e.r),this.g=Ks(e.g),this.b=Ks(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ci){return ct.workingToColorSpace(_n.copy(this),e),Math.round(ot(_n.r*255,0,255))*65536+Math.round(ot(_n.g*255,0,255))*256+Math.round(ot(_n.b*255,0,255))}getHexString(e=ci){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ct.workingColorSpace){ct.workingToColorSpace(_n.copy(this),t);const n=_n.r,i=_n.g,s=_n.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case n:l=(i-s)/h+(i<s?6:0);break;case i:l=(s-n)/h+2;break;case s:l=(n-i)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=ct.workingColorSpace){return ct.workingToColorSpace(_n.copy(this),t),e.r=_n.r,e.g=_n.g,e.b=_n.b,e}getStyle(e=ci){ct.workingToColorSpace(_n.copy(this),e);const t=_n.r,n=_n.g,i=_n.b;return e!==ci?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(dr),this.setHSL(dr.h+e,dr.s+t,dr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(dr),e.getHSL(bo);const n=za(dr.h,bo.h,t),i=za(dr.s,bo.s,t),s=za(dr.l,bo.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const _n=new dt;dt.NAMES=vm;class Q0 extends Hn{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 cs,this.environmentIntensity=1,this.environmentRotation=new cs,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const xi=new q,Hi=new q,rc=new q,Wi=new q,Es=new q,Ts=new q,Hd=new q,sc=new q,ac=new q,oc=new q,lc=new Bt,cc=new Bt,uc=new Bt;class Si{constructor(e=new q,t=new q,n=new q){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),xi.subVectors(e,t),i.cross(xi);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){xi.subVectors(i,t),Hi.subVectors(n,t),rc.subVectors(e,t);const a=xi.dot(xi),o=xi.dot(Hi),l=xi.dot(rc),c=Hi.dot(Hi),u=Hi.dot(rc),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const f=1/h,d=(c*l-o*u)*f,g=(a*u-o*l)*f;return s.set(1-d-g,g,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Wi)===null?!1:Wi.x>=0&&Wi.y>=0&&Wi.x+Wi.y<=1}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,Wi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Wi.x),l.addScaledVector(a,Wi.y),l.addScaledVector(o,Wi.z),l)}static getInterpolatedAttribute(e,t,n,i,s,a){return lc.setScalar(0),cc.setScalar(0),uc.setScalar(0),lc.fromBufferAttribute(e,t),cc.fromBufferAttribute(e,n),uc.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(lc,s.x),a.addScaledVector(cc,s.y),a.addScaledVector(uc,s.z),a}static isFrontFacing(e,t,n,i){return xi.subVectors(n,t),Hi.subVectors(e,t),xi.cross(Hi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return xi.subVectors(this.c,this.b),Hi.subVectors(this.a,this.b),xi.cross(Hi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Si.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Si.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Si.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Si.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Si.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;Es.subVectors(i,n),Ts.subVectors(s,n),sc.subVectors(e,n);const l=Es.dot(sc),c=Ts.dot(sc);if(l<=0&&c<=0)return t.copy(n);ac.subVectors(e,i);const u=Es.dot(ac),h=Ts.dot(ac);if(u>=0&&h<=u)return t.copy(i);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Es,a);oc.subVectors(e,s);const d=Es.dot(oc),g=Ts.dot(oc);if(g>=0&&d<=g)return t.copy(s);const _=d*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(Ts,o);const p=u*g-d*h;if(p<=0&&h-u>=0&&d-g>=0)return Hd.subVectors(s,i),o=(h-u)/(h-u+(d-g)),t.copy(i).addScaledVector(Hd,o);const m=1/(p+_+f);return a=_*m,o=f*m,t.copy(n).addScaledVector(Es,a).addScaledVector(Ts,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class to{constructor(e=new q(1/0,1/0,1/0),t=new q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(vi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(vi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=vi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,vi):vi.fromBufferAttribute(s,a),vi.applyMatrix4(e.matrixWorld),this.expandByPoint(vi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),yo.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),yo.copy(n.boundingBox)),yo.applyMatrix4(e.matrixWorld),this.union(yo)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,vi),vi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ha),Eo.subVectors(this.max,ha),ws.subVectors(e.a,ha),As.subVectors(e.b,ha),Rs.subVectors(e.c,ha),hr.subVectors(As,ws),pr.subVectors(Rs,As),Or.subVectors(ws,Rs);let t=[0,-hr.z,hr.y,0,-pr.z,pr.y,0,-Or.z,Or.y,hr.z,0,-hr.x,pr.z,0,-pr.x,Or.z,0,-Or.x,-hr.y,hr.x,0,-pr.y,pr.x,0,-Or.y,Or.x,0];return!fc(t,ws,As,Rs,Eo)||(t=[1,0,0,0,1,0,0,0,1],!fc(t,ws,As,Rs,Eo))?!1:(To.crossVectors(hr,pr),t=[To.x,To.y,To.z],fc(t,ws,As,Rs,Eo))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(vi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Xi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Xi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Xi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Xi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Xi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Xi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Xi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Xi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Xi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Xi=[new q,new q,new q,new q,new q,new q,new q,new q],vi=new q,yo=new to,ws=new q,As=new q,Rs=new q,hr=new q,pr=new q,Or=new q,ha=new q,Eo=new q,To=new q,Br=new q;function fc(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Br.fromArray(r,s);const o=i.x*Math.abs(Br.x)+i.y*Math.abs(Br.y)+i.z*Math.abs(Br.z),l=e.dot(Br),c=t.dot(Br),u=n.dot(Br);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const $t=new q,wo=new mt;let ex=0;class Mn extends fs{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ex++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Ad,this.updateRanges=[],this.gpuType=Ui,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)wo.fromBufferAttribute(this,t),wo.applyMatrix3(e),this.setXY(t,wo.x,wo.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)$t.fromBufferAttribute(this,t),$t.applyMatrix3(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)$t.fromBufferAttribute(this,t),$t.applyMatrix4(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)$t.fromBufferAttribute(this,t),$t.applyNormalMatrix(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)$t.fromBufferAttribute(this,t),$t.transformDirection(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Fs(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Cn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Fs(t,this.array)),t}setX(e,t){return this.normalized&&(t=Cn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Fs(t,this.array)),t}setY(e,t){return this.normalized&&(t=Cn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Fs(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Cn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Fs(t,this.array)),t}setW(e,t){return this.normalized&&(t=Cn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Cn(t,this.array),n=Cn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Cn(t,this.array),n=Cn(n,this.array),i=Cn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Cn(t,this.array),n=Cn(n,this.array),i=Cn(i,this.array),s=Cn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ad&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Mm extends Mn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Sm extends Mn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nr extends Mn{constructor(e,t,n){super(new Float32Array(e),t,n)}}const tx=new to,pa=new q,dc=new q;class Cl{constructor(e=new q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):tx.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;pa.subVectors(e,this.center);const t=pa.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(pa,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(dc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(pa.copy(e.center).add(dc)),this.expandByPoint(pa.copy(e.center).sub(dc))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let nx=0;const oi=new Xt,hc=new Hn,Cs=new q,qn=new to,ma=new to,sn=new q;class Ei extends fs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:nx++}),this.uuid=aa(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(M0(e)?Sm:Mm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ke().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return oi.makeRotationFromQuaternion(e),this.applyMatrix4(oi),this}rotateX(e){return oi.makeRotationX(e),this.applyMatrix4(oi),this}rotateY(e){return oi.makeRotationY(e),this.applyMatrix4(oi),this}rotateZ(e){return oi.makeRotationZ(e),this.applyMatrix4(oi),this}translate(e,t,n){return oi.makeTranslation(e,t,n),this.applyMatrix4(oi),this}scale(e,t,n){return oi.makeScale(e,t,n),this.applyMatrix4(oi),this}lookAt(e){return hc.lookAt(e),hc.updateMatrix(),this.applyMatrix4(hc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Cs).negate(),this.translate(Cs.x,Cs.y,Cs.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new nr(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&Ye("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new to);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){pt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];qn.setFromBufferAttribute(s),this.morphTargetsRelative?(sn.addVectors(this.boundingBox.min,qn.min),this.boundingBox.expandByPoint(sn),sn.addVectors(this.boundingBox.max,qn.max),this.boundingBox.expandByPoint(sn)):(this.boundingBox.expandByPoint(qn.min),this.boundingBox.expandByPoint(qn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&pt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Cl);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){pt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new q,1/0);return}if(e){const n=this.boundingSphere.center;if(qn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];ma.setFromBufferAttribute(o),this.morphTargetsRelative?(sn.addVectors(qn.min,ma.min),qn.expandByPoint(sn),sn.addVectors(qn.max,ma.max),qn.expandByPoint(sn)):(qn.expandByPoint(ma.min),qn.expandByPoint(ma.max))}qn.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)sn.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(sn));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)sn.fromBufferAttribute(o,c),l&&(Cs.fromBufferAttribute(e,c),sn.add(Cs)),i=Math.max(i,n.distanceToSquared(sn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&pt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){pt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new Mn(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));const o=[],l=[];for(let v=0;v<n.count;v++)o[v]=new q,l[v]=new q;const c=new q,u=new q,h=new q,f=new mt,d=new mt,g=new mt,_=new q,p=new q;function m(v,E,C){c.fromBufferAttribute(n,v),u.fromBufferAttribute(n,E),h.fromBufferAttribute(n,C),f.fromBufferAttribute(s,v),d.fromBufferAttribute(s,E),g.fromBufferAttribute(s,C),u.sub(c),h.sub(c),d.sub(f),g.sub(f);const L=1/(d.x*g.y-g.x*d.y);isFinite(L)&&(_.copy(u).multiplyScalar(g.y).addScaledVector(h,-d.y).multiplyScalar(L),p.copy(h).multiplyScalar(d.x).addScaledVector(u,-g.x).multiplyScalar(L),o[v].add(_),o[E].add(_),o[C].add(_),l[v].add(p),l[E].add(p),l[C].add(p))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let v=0,E=b.length;v<E;++v){const C=b[v],L=C.start,N=C.count;for(let Y=L,H=L+N;Y<H;Y+=3)m(e.getX(Y+0),e.getX(Y+1),e.getX(Y+2))}const A=new q,M=new q,y=new q,T=new q;function w(v){y.fromBufferAttribute(i,v),T.copy(y);const E=o[v];A.copy(E),A.sub(y.multiplyScalar(y.dot(E))).normalize(),M.crossVectors(T,E);const L=M.dot(l[v])<0?-1:1;a.setXYZW(v,A.x,A.y,A.z,L)}for(let v=0,E=b.length;v<E;++v){const C=b[v],L=C.start,N=C.count;for(let Y=L,H=L+N;Y<H;Y+=3)w(e.getX(Y+0)),w(e.getX(Y+1)),w(e.getX(Y+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Mn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const i=new q,s=new q,a=new q,o=new q,l=new q,c=new q,u=new q,h=new q;if(e)for(let f=0,d=e.count;f<d;f+=3){const g=e.getX(f+0),_=e.getX(f+1),p=e.getX(f+2);i.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,p),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,p),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(p,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)sn.fromBufferAttribute(e,t),sn.normalize(),e.setXYZ(t,sn.x,sn.y,sn.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,h=o.normalized,f=new c.constructor(l.length*u);let d=0,g=0;for(let _=0,p=l.length;_<p;_++){o.isInterleavedBufferAttribute?d=l[_]*o.data.stride+o.offset:d=l[_]*u;for(let m=0;m<u;m++)f[g++]=c[d++]}return new Mn(f,u,h)}if(this.index===null)return Ye("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ei,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=e(f,n);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){const d=c[h];u.push(d.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}let ix=0;class no extends fs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ix++}),this.uuid=aa(),this.name="",this.type="Material",this.blending=qs,this.side=Nr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Jc,this.blendDst=Qc,this.blendEquation=Xr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new dt(0,0,0),this.blendAlpha=0,this.depthFunc=na,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=wd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vs,this.stencilZFail=vs,this.stencilZPass=vs,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Ye(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Ye(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector2&&n&&n.isVector2||i&&i.isEuler&&n&&n.isEuler||i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==qs&&(n.blending=this.blending),this.side!==Nr&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Jc&&(n.blendSrc=this.blendSrc),this.blendDst!==Qc&&(n.blendDst=this.blendDst),this.blendEquation!==Xr&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==na&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==wd&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vs&&(n.stencilFail=this.stencilFail),this.stencilZFail!==vs&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==vs&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new dt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new mt().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new mt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const Yi=new q,pc=new q,Ao=new q,mr=new q,mc=new q,Ro=new q,gc=new q;class bm{constructor(e=new q,t=new q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Yi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Yi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Yi.copy(this.origin).addScaledVector(this.direction,t),Yi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){pc.copy(e).add(t).multiplyScalar(.5),Ao.copy(t).sub(e).normalize(),mr.copy(this.origin).sub(pc);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ao),o=mr.dot(this.direction),l=-mr.dot(Ao),c=mr.lengthSq(),u=Math.abs(1-a*a);let h,f,d,g;if(u>0)if(h=a*l-o,f=a*o-l,g=s*u,h>=0)if(f>=-g)if(f<=g){const _=1/u;h*=_,f*=_,d=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;else f<=-g?(h=Math.max(0,-(-a*s+o)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=g?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=a>0?-s:s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(pc).addScaledVector(Ao,f),d}intersectSphere(e,t){Yi.subVectors(e.center,this.origin);const n=Yi.dot(this.direction),i=Yi.dot(Yi)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Yi)!==null}intersectTriangle(e,t,n,i,s){mc.subVectors(t,e),Ro.subVectors(n,e),gc.crossVectors(mc,Ro);let a=this.direction.dot(gc),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;mr.subVectors(this.origin,e);const l=o*this.direction.dot(Ro.crossVectors(mr,Ro));if(l<0)return null;const c=o*this.direction.dot(mc.cross(mr));if(c<0||l+c>a)return null;const u=-o*mr.dot(gc);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ym extends no{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new dt(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 cs,this.combine=em,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Wd=new Xt,kr=new bm,Co=new Cl,Xd=new q,Po=new q,Do=new q,Lo=new q,_c=new q,No=new q,Yd=new q,Io=new q;class or extends Hn{constructor(e=new Ei,t=new ym){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){No.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],h=s[l];u!==0&&(_c.fromBufferAttribute(h,e),a?No.addScaledVector(_c,u):No.addScaledVector(_c.sub(t),u))}t.add(No)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Co.copy(n.boundingSphere),Co.applyMatrix4(s),kr.copy(e.ray).recast(e.near),!(Co.containsPoint(kr.origin)===!1&&(kr.intersectSphere(Co,Xd)===null||kr.origin.distanceToSquared(Xd)>(e.far-e.near)**2))&&(Wd.copy(s).invert(),kr.copy(e.ray).applyMatrix4(Wd),!(n.boundingBox!==null&&kr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,kr)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const p=f[g],m=a[p.materialIndex],b=Math.max(p.start,d.start),A=Math.min(o.count,Math.min(p.start+p.count,d.start+d.count));for(let M=b,y=A;M<y;M+=3){const T=o.getX(M),w=o.getX(M+1),v=o.getX(M+2);i=Uo(this,m,e,n,c,u,h,T,w,v),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=p.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),_=Math.min(o.count,d.start+d.count);for(let p=g,m=_;p<m;p+=3){const b=o.getX(p),A=o.getX(p+1),M=o.getX(p+2);i=Uo(this,a,e,n,c,u,h,b,A,M),i&&(i.faceIndex=Math.floor(p/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const p=f[g],m=a[p.materialIndex],b=Math.max(p.start,d.start),A=Math.min(l.count,Math.min(p.start+p.count,d.start+d.count));for(let M=b,y=A;M<y;M+=3){const T=M,w=M+1,v=M+2;i=Uo(this,m,e,n,c,u,h,T,w,v),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=p.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),_=Math.min(l.count,d.start+d.count);for(let p=g,m=_;p<m;p+=3){const b=p,A=p+1,M=p+2;i=Uo(this,a,e,n,c,u,h,b,A,M),i&&(i.faceIndex=Math.floor(p/3),t.push(i))}}}}function rx(r,e,t,n,i,s,a,o){let l;if(e.side===Vn?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side===Nr,o),l===null)return null;Io.copy(o),Io.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Io);return c<t.near||c>t.far?null:{distance:c,point:Io.clone(),object:r}}function Uo(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,Po),r.getVertexPosition(l,Do),r.getVertexPosition(c,Lo);const u=rx(r,e,t,n,Po,Do,Lo,Yd);if(u){const h=new q;Si.getBarycoord(Yd,Po,Do,Lo,h),i&&(u.uv=Si.getInterpolatedAttribute(i,o,l,c,h,new mt)),s&&(u.uv1=Si.getInterpolatedAttribute(s,o,l,c,h,new mt)),a&&(u.normal=Si.getInterpolatedAttribute(a,o,l,c,h,new q),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new q,materialIndex:0};Si.getNormal(Po,Do,Lo,f.normal),u.face=f,u.barycoord=h}return u}class sx extends Un{constructor(e=null,t=1,n=1,i,s,a,o,l,c=dn,u=dn,h,f){super(null,a,o,l,c,u,i,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const xc=new q,ax=new q,ox=new Ke;class Wr{constructor(e=new q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=xc.subVectors(n,t).cross(ax.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){const i=e.delta(xc),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ox.getNormalMatrix(e),i=this.coplanarPoint(xc).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const zr=new Cl,lx=new mt(.5,.5),Fo=new q;class Em{constructor(e=new Wr,t=new Wr,n=new Wr,i=new Wr,s=new Wr,a=new Wr){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Fi,n=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],u=s[4],h=s[5],f=s[6],d=s[7],g=s[8],_=s[9],p=s[10],m=s[11],b=s[12],A=s[13],M=s[14],y=s[15];if(i[0].setComponents(c-a,d-u,m-g,y-b).normalize(),i[1].setComponents(c+a,d+u,m+g,y+b).normalize(),i[2].setComponents(c+o,d+h,m+_,y+A).normalize(),i[3].setComponents(c-o,d-h,m-_,y-A).normalize(),n)i[4].setComponents(l,f,p,M).normalize(),i[5].setComponents(c-l,d-f,m-p,y-M).normalize();else if(i[4].setComponents(c-l,d-f,m-p,y-M).normalize(),t===Fi)i[5].setComponents(c+l,d+f,m+p,y+M).normalize();else if(t===Sl)i[5].setComponents(l,f,p,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),zr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),zr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(zr)}intersectsSprite(e){zr.center.set(0,0,0);const t=lx.distanceTo(e.center);return zr.radius=.7071067811865476+t,zr.applyMatrix4(e.matrixWorld),this.intersectsSphere(zr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Fo.x=i.normal.x>0?e.max.x:e.min.x,Fo.y=i.normal.y>0?e.max.y:e.min.y,Fo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Fo)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class cx extends no{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new dt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const qd=new Xt,ku=new bm,Oo=new Cl,Bo=new q;class ux extends Hn{constructor(e=new Ei,t=new cx){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Oo.copy(n.boundingSphere),Oo.applyMatrix4(i),Oo.radius+=s,e.ray.intersectsSphere(Oo)===!1)return;qd.copy(i).invert(),ku.copy(e.ray).applyMatrix4(qd);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,a.start),d=Math.min(c.count,a.start+a.count);for(let g=f,_=d;g<_;g++){const p=c.getX(g);Bo.fromBufferAttribute(h,p),$d(Bo,p,l,i,e,t,this)}}else{const f=Math.max(0,a.start),d=Math.min(h.count,a.start+a.count);for(let g=f,_=d;g<_;g++)Bo.fromBufferAttribute(h,g),$d(Bo,g,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function $d(r,e,t,n,i,s,a){const o=ku.distanceSqToPoint(r);if(o<t){const l=new q;ku.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Tm extends Un{constructor(e=[],t=os,n,i,s,a,o,l,c,u){super(e,t,n,i,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ra extends Un{constructor(e,t,n=Gi,i,s,a,o=dn,l=dn,c,u=ar,h=1){if(u!==ar&&u!==Zr)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:h};super(f,i,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new wf(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class fx extends ra{constructor(e,t=Gi,n=os,i,s,a=dn,o=dn,l,c=ar){const u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,t,n,i,s,a,o,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class wm extends Un{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class io extends Ei{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],h=[];let f=0,d=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,i,a,2),g("x","z","y",1,-1,e,n,-t,i,a,3),g("x","y","z",1,-1,e,t,n,i,s,4),g("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new nr(c,3)),this.setAttribute("normal",new nr(u,3)),this.setAttribute("uv",new nr(h,2));function g(_,p,m,b,A,M,y,T,w,v,E){const C=M/w,L=y/v,N=M/2,Y=y/2,H=T/2,O=w+1,z=v+1;let I=0,W=0;const Z=new q;for(let D=0;D<z;D++){const re=D*L-Y;for(let he=0;he<O;he++){const He=he*C-N;Z[_]=He*b,Z[p]=re*A,Z[m]=H,c.push(Z.x,Z.y,Z.z),Z[_]=0,Z[p]=0,Z[m]=T>0?1:-1,u.push(Z.x,Z.y,Z.z),h.push(he/w),h.push(1-D/v),I+=1}}for(let D=0;D<v;D++)for(let re=0;re<w;re++){const he=f+re+O*D,He=f+re+O*(D+1),Be=f+(re+1)+O*(D+1),Pe=f+(re+1)+O*D;l.push(he,He,Pe),l.push(He,Be,Pe),W+=6}o.addGroup(d,W,E),d+=W,f+=I}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new io(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Pl extends Ei{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,u=l+1,h=e/o,f=t/l,d=[],g=[],_=[],p=[];for(let m=0;m<u;m++){const b=m*f-a;for(let A=0;A<c;A++){const M=A*h-s;g.push(M,-b,0),_.push(0,0,1),p.push(A/o),p.push(1-m/l)}}for(let m=0;m<l;m++)for(let b=0;b<o;b++){const A=b+c*m,M=b+c*(m+1),y=b+1+c*(m+1),T=b+1+c*m;d.push(A,M,T),d.push(M,y,T)}this.setIndex(d),this.setAttribute("position",new nr(g,3)),this.setAttribute("normal",new nr(_,3)),this.setAttribute("uv",new nr(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pl(e.width,e.height,e.widthSegments,e.heightSegments)}}function sa(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];if(Kd(i))i.isRenderTargetTexture?(Ye("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(Kd(i[0])){const s=[];for(let a=0,o=i.length;a<o;a++)s[a]=i[a].clone();e[t][n]=s}else e[t][n]=i.slice();else e[t][n]=i}}return e}function Pn(r){const e={};for(let t=0;t<r.length;t++){const n=sa(r[t]);for(const i in n)e[i]=n[i]}return e}function Kd(r){return r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)}function dx(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function Am(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ct.workingColorSpace}const hx={clone:sa,merge:Pn};var px=`void main() {
1
+ import{r as Oe,j as P,$ as Vm,h as Dh,ap as Ac,aq as Ff,ar as Of,as as Hm,a0 as Hu,L as Is,a2 as Wm,a1 as Xm,at as Ym,au as qm,ac as $m,N as Bf,an as Zm}from"./main-BZBZhXIl.js";import{H as Km}from"./HeaderGithubStar-DHW75YEC.js";import{u as jm}from"./use-community-stats-BBUKlTpE.js";import{C as Jm}from"./check-frbadzCO.js";import{C as Qm}from"./copy-BbbIDe0D.js";import{D as eg}from"./download-CnLKP9Xi.js";import{A as kf,L as tg}from"./agent-logos-CORiXh7-.js";import{f as Lh}from"./format-tokens-Q8buFewN.js";function ng(){if(typeof window>"u")return!1;const r=window.location.hostname;return r==="localhost"||r==="127.0.0.1"||r==="::1"}function zf(){return ng()?"/":"/dashboard"}const ln={accent:"#8a7aff",accentSoft:"#b8b3ff",accentFaint:"rgba(138, 122, 255, 0.16)",accentGhost:"rgba(138, 122, 255, 0.06)",glint:"#fbdfff",bg:"#050507",panel:"#0a0a0d",line:"rgba(138, 122, 255, 0.22)",scrim:"rgba(5, 5, 7, 0.62)",orbSurface:"radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.06) 42%, rgba(255, 255, 255, 0) 55%), radial-gradient(circle at 68% 84%, rgba(138, 122, 255, 0.30), rgba(138, 122, 255, 0) 55%), radial-gradient(circle at 50% 50%, rgba(20, 18, 34, 0.55), rgba(8, 8, 16, 0.82) 78%)",orbShadow:"inset 0 1px 1px rgba(255, 255, 255, 0.30), inset 0 -3px 9px rgba(138, 122, 255, 0.38), inset -5px -7px 14px rgba(0, 0, 0, 0.38), 0 0 30px rgba(138, 122, 255, 0.20), 0 10px 26px rgba(0, 0, 0, 0.5)",orbHighlight:"linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0))",orbGlint:"radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 70%)"},Il={accent:9075455,accentSoft:12104703,glint:16506879},ig={"--lv3-accent":ln.accent,"--lv3-accent-soft":ln.accentSoft,"--lv3-accent-faint":ln.accentFaint,"--lv3-accent-ghost":ln.accentGhost,"--lv3-glint":ln.glint,"--lv3-bg":ln.bg,"--lv3-panel":ln.panel,"--lv3-line":ln.line,"--lv3-scrim":ln.scrim,"--lv3-orb-surface":ln.orbSurface,"--lv3-orb-shadow":ln.orbShadow,"--lv3-orb-highlight":ln.orbHighlight,"--lv3-orb-glint":ln.orbGlint};function qi(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Nh(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e}var ni={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Va={duration:.5,overwrite:!1,delay:0},Wu,hn,Lt,pi=1e8,Tt=1/pi,Rc=Math.PI*2,rg=Rc/4,sg=0,Ih=Math.sqrt,ag=Math.cos,og=Math.sin,un=function(e){return typeof e=="string"},kt=function(e){return typeof e=="function"},ir=function(e){return typeof e=="number"},Xu=function(e){return typeof e>"u"},zi=function(e){return typeof e=="object"},Bn=function(e){return e!==!1},Yu=function(){return typeof window<"u"},so=function(e){return kt(e)||un(e)},Uh=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},En=Array.isArray,lg=/random\([^)]+\)/g,cg=/,\s*/g,Gf=/(?:-?\.?\d|\.)+/gi,Fh=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Bs=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Ul=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Oh=/[+-]=-?[.\d]+/,ug=/[^,'"\[\]\s]+/gi,fg=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,It,Ci,Cc,qu,ii={},ol={},Bh,kh=function(e){return(ol=js(e,ii))&&Wn},$u=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Ha=function(e,t){return!t&&console.warn(e)},zh=function(e,t){return e&&(ii[e]=t)&&ol&&(ol[e]=t)||ii},Wa=function(){return 0},dg={suppressEvents:!0,isStart:!0,kill:!1},Yo={suppressEvents:!0,kill:!1},hg={suppressEvents:!0},Zu={},wr=[],Pc={},Gh,Kn={},Fl={},Vf=30,qo=[],Ku="",ju=function(e){var t=e[0],n,i;if(zi(t)||kt(t)||(e=[e]),!(n=(t._gsap||{}).harness)){for(i=qo.length;i--&&!qo[i].targetTest(t););n=qo[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new cp(e[i],n)))||e.splice(i,1);return e},Jr=function(e){return e._gsap||ju(mi(e))[0]._gsap},Vh=function(e,t,n){return(n=e[t])&&kt(n)?e[t]():Xu(n)&&e.getAttribute&&e.getAttribute(t)||n},kn=function(e,t){return(e=e.split(",")).forEach(t)||e},Ht=function(e){return Math.round(e*1e5)/1e5||0},Nt=function(e){return Math.round(e*1e7)/1e7||0},Gs=function(e,t){var n=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),n==="+"?e+i:n==="-"?e-i:n==="*"?e*i:e/i},pg=function(e,t){for(var n=t.length,i=0;e.indexOf(t[i])<0&&++i<n;);return i<n},ll=function(){var e=wr.length,t=wr.slice(0),n,i;for(Pc={},wr.length=0,n=0;n<e;n++)i=t[n],i&&i._lazy&&(i.render(i._lazy[0],i._lazy[1],!0)._lazy=0)},Ju=function(e){return!!(e._initted||e._startAt||e.add)},Hh=function(e,t,n,i){wr.length&&!hn&&ll(),e.render(t,n,!!(hn&&t<0&&Ju(e))),wr.length&&!hn&&ll()},Wh=function(e){var t=parseFloat(e);return(t||t===0)&&(e+"").match(ug).length<2?t:un(e)?e.trim():e},Xh=function(e){return e},ri=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},mg=function(e){return function(t,n){for(var i in n)i in t||i==="duration"&&e||i==="ease"||(t[i]=n[i])}},js=function(e,t){for(var n in t)e[n]=t[n];return e},Hf=function r(e,t){for(var n in t)n!=="__proto__"&&n!=="constructor"&&n!=="prototype"&&(e[n]=zi(t[n])?r(e[n]||(e[n]={}),t[n]):t[n]);return e},cl=function(e,t){var n={},i;for(i in e)i in t||(n[i]=e[i]);return n},Ra=function(e){var t=e.parent||It,n=e.keyframes?mg(En(e.keyframes)):ri;if(Bn(e.inherit))for(;t;)n(e,t.vars.defaults),t=t.parent||t._dp;return e},gg=function(e,t){for(var n=e.length,i=n===t.length;i&&n--&&e[n]===t[n];);return n<0},Yh=function(e,t,n,i,s){var a=e[i],o;if(s)for(o=t[s];a&&a[s]>o;)a=a._prev;return a?(t._next=a._next,a._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=a,t.parent=t._dp=e,t},Tl=function(e,t,n,i){n===void 0&&(n="_first"),i===void 0&&(i="_last");var s=t._prev,a=t._next;s?s._next=a:e[n]===t&&(e[n]=a),a?a._prev=s:e[i]===t&&(e[i]=s),t._next=t._prev=t.parent=null},Cr=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},Qr=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var n=e;n;)n._dirty=1,n=n.parent;return e},_g=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},Dc=function(e,t,n,i){return e._startAt&&(hn?e._startAt.revert(Yo):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},xg=function r(e){return!e||e._ts&&r(e.parent)},Wf=function(e){return e._repeat?Js(e._tTime,e=e.duration()+e._rDelay)*e:0},Js=function(e,t){var n=Math.floor(e=Nt(e/t));return e&&n===e?n-1:n},ul=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},wl=function(e){return e._end=Nt(e._start+(e._tDur/Math.abs(e._ts||e._rts||Tt)||0))},Al=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=Nt(n._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),wl(e),n._dirty||Qr(n,e)),e},qh=function(e,t){var n;if((t._time||!t._dur&&t._initted||t._start<e._time&&(t._dur||!t.add))&&(n=ul(e.rawTime(),t),(!t._dur||to(0,t.totalDuration(),n)-t._tTime>Tt)&&t.render(n,!0)),Qr(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(n=e;n._dp;)n.rawTime()>=0&&n.totalTime(n._tTime),n=n._dp;e._zTime=-Tt}},Li=function(e,t,n,i){return t.parent&&Cr(t),t._start=Nt((ir(n)?n:n||e!==It?li(e,n,t):e._time)+t._delay),t._end=Nt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),Yh(e,t,"_first","_last",e._sort?"_start":0),Lc(t)||(e._recent=t),i||qh(e,t),e._ts<0&&Al(e,e._tTime),e},$h=function(e,t){return(ii.ScrollTrigger||$u("scrollTrigger",t))&&ii.ScrollTrigger.create(t,e)},Zh=function(e,t,n,i,s){if(ef(e,t,s),!e._initted)return 1;if(!n&&e._pt&&!hn&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&Gh!==Jn.frame)return wr.push(e),e._lazy=[s,i],1},vg=function r(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||r(t))},Lc=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},Mg=function(e,t,n,i){var s=e.ratio,a=t<0||!t&&(!e._start&&vg(e)&&!(!e._initted&&Lc(e))||(e._ts<0||e._dp._ts<0)&&!Lc(e))?0:1,o=e._rDelay,l=0,c,u,h;if(o&&e._repeat&&(l=to(0,e._tDur,t),u=Js(l,o),e._yoyo&&u&1&&(a=1-a),u!==Js(e._tTime,o)&&(s=1-a,e.vars.repeatRefresh&&e._initted&&e.invalidate())),a!==s||hn||i||e._zTime===Tt||!t&&e._zTime){if(!e._initted&&Zh(e,t,i,n,l))return;for(h=e._zTime,e._zTime=t||(n?Tt:0),n||(n=t&&!h),e.ratio=a,e._from&&(a=1-a),e._time=0,e._tTime=l,c=e._pt;c;)c.r(a,c.d),c=c._next;t<0&&Dc(e,t,n,!0),e._onUpdate&&!n&&ei(e,"onUpdate"),l&&e._repeat&&!n&&e.parent&&ei(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===a&&(a&&Cr(e,1),!n&&!hn&&(ei(e,a?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},Sg=function(e,t,n){var i;if(n>t)for(i=e._first;i&&i._start<=n;){if(i.data==="isPause"&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=n;){if(i.data==="isPause"&&i._start<t)return i;i=i._prev}},Qs=function(e,t,n,i){var s=e._repeat,a=Nt(t)||0,o=e._tTime/e._tDur;return o&&!i&&(e._time*=a/e._dur),e._dur=a,e._tDur=s?s<0?1e10:Nt(a*(s+1)+e._rDelay*s):a,o>0&&!i&&Al(e,e._tTime=e._tDur*o),e.parent&&wl(e),n||Qr(e.parent,e),e},Xf=function(e){return e instanceof On?Qr(e):Qs(e,e._dur)},bg={_start:0,endTime:Wa,totalDuration:Wa},li=function r(e,t,n){var i=e.labels,s=e._recent||bg,a=e.duration()>=pi?s.endTime(!1):e._dur,o,l,c;return un(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),c=t.substr(-1)==="%",o=t.indexOf("="),l==="<"||l===">"?(o>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(c?(o<0?s:n).totalDuration()/100:1)):o<0?(t in i||(i[t]=a),i[t]):(l=parseFloat(t.charAt(o-1)+t.substr(o+1)),c&&n&&(l=l/100*(En(n)?n[0]:n).totalDuration()),o>1?r(e,t.substr(0,o-1),n)+l:a+l)):t==null?a:+t},Ca=function(e,t,n){var i=ir(t[1]),s=(i?2:1)+(e<2?0:1),a=t[s],o,l;if(i&&(a.duration=t[1]),a.parent=n,e){for(o=a,l=n;l&&!("immediateRender"in o);)o=l.vars.defaults||{},l=Bn(l.vars.inherit)&&l.parent;a.immediateRender=Bn(o.immediateRender),e<2?a.runBackwards=1:a.startAt=t[s-1]}return new Kt(t[0],a,t[s+1])},Ir=function(e,t){return e||e===0?t(e):t},to=function(e,t,n){return n<e?e:n>t?t:n},Sn=function(e,t){return!un(e)||!(t=fg.exec(e))?"":t[1]},yg=function(e,t,n){return Ir(n,function(i){return to(e,t,i)})},Nc=[].slice,Kh=function(e,t){return e&&zi(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&zi(e[0]))&&!e.nodeType&&e!==Ci},Eg=function(e,t,n){return n===void 0&&(n=[]),e.forEach(function(i){var s;return un(i)&&!t||Kh(i,1)?(s=n).push.apply(s,mi(i)):n.push(i)})||n},mi=function(e,t,n){return Lt&&!t&&Lt.selector?Lt.selector(e):un(e)&&!n&&(Cc||!ea())?Nc.call((t||qu).querySelectorAll(e),0):En(e)?Eg(e,n):Kh(e)?Nc.call(e,0):e?[e]:[]},Ic=function(e){return e=mi(e)[0]||Ha("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return mi(t,n.querySelectorAll?n:n===e?Ha("Invalid scope")||qu.createElement("div"):e)}},jh=function(e){return e.sort(function(){return .5-Math.random()})},Jh=function(e){if(kt(e))return e;var t=zi(e)?e:{each:e},n=es(t.ease),i=t.from||0,s=parseFloat(t.base)||0,a={},o=i>0&&i<1,l=isNaN(i)||o,c=t.axis,u=i,h=i;return un(i)?u=h={center:.5,edges:.5,end:1}[i]||0:!o&&l&&(u=i[0],h=i[1]),function(f,d,g){var _=(g||t).length,p=a[_],m,b,w,M,y,T,A,v,E;if(!p){if(E=t.grid==="auto"?0:(t.grid||[1,pi])[1],!E){for(A=-pi;A<(A=g[E++].getBoundingClientRect().left)&&E<_;);E<_&&E--}for(p=a[_]=[],m=l?Math.min(E,_)*u-.5:i%E,b=E===pi?0:l?_*h/E-.5:i/E|0,A=0,v=pi,T=0;T<_;T++)w=T%E-m,M=b-(T/E|0),p[T]=y=c?Math.abs(c==="y"?M:w):Ih(w*w+M*M),y>A&&(A=y),y<v&&(v=y);i==="random"&&jh(p),p.max=A-v,p.min=v,p.v=_=(parseFloat(t.amount)||parseFloat(t.each)*(E>_?_-1:c?c==="y"?_/E:E:Math.max(E,_/E))||0)*(i==="edges"?-1:1),p.b=_<0?s-_:s,p.u=Sn(t.amount||t.each)||0,n=n&&_<0?Og(n):n}return _=(p[f]-p.min)/p.max||0,Nt(p.b+(n?n(_):_)*p.v)+p.u}},Uc=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var i=Nt(Math.round(parseFloat(n)/e)*e*t);return(i-i%1)/t+(ir(n)?0:Sn(n))}},Qh=function(e,t){var n=En(e),i,s;return!n&&zi(e)&&(i=n=e.radius||pi,e.values?(e=mi(e.values),(s=!ir(e[0]))&&(i*=i)):e=Uc(e.increment)),Ir(t,n?kt(e)?function(a){return s=e(a),Math.abs(s-a)<=i?s:a}:function(a){for(var o=parseFloat(s?a.x:a),l=parseFloat(s?a.y:0),c=pi,u=0,h=e.length,f,d;h--;)s?(f=e[h].x-o,d=e[h].y-l,f=f*f+d*d):f=Math.abs(e[h]-o),f<c&&(c=f,u=h);return u=!i||c<=i?e[u]:a,s||u===a||ir(a)?u:u+Sn(a)}:Uc(e))},ep=function(e,t,n,i){return Ir(En(e)?!t:n===!0?!!(n=0):!i,function(){return En(e)?e[~~(Math.random()*e.length)]:(n=n||1e-5)&&(i=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((e-n/2+Math.random()*(t-e+n*.99))/n)*n*i)/i})},Tg=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){return t.reduce(function(s,a){return a(s)},i)}},wg=function(e,t){return function(n){return e(parseFloat(n))+(t||Sn(n))}},Ag=function(e,t,n){return np(e,t,0,1,n)},tp=function(e,t,n){return Ir(n,function(i){return e[~~t(i)]})},Rg=function r(e,t,n){var i=t-e;return En(e)?tp(e,r(0,e.length),t):Ir(n,function(s){return(i+(s-e)%i)%i+e})},Cg=function r(e,t,n){var i=t-e,s=i*2;return En(e)?tp(e,r(0,e.length-1),t):Ir(n,function(a){return a=(s+(a-e)%s)%s||0,e+(a>i?s-a:a)})},Xa=function(e){return e.replace(lg,function(t){var n=t.indexOf("[")+1,i=t.substring(n||7,n?t.indexOf("]"):t.length-1).split(cg);return ep(n?i:+i[0],n?0:+i[1],+i[2]||1e-5)})},np=function(e,t,n,i,s){var a=t-e,o=i-n;return Ir(s,function(l){return n+((l-e)/a*o||0)})},Pg=function r(e,t,n,i){var s=isNaN(e+t)?0:function(d){return(1-d)*e+d*t};if(!s){var a=un(e),o={},l,c,u,h,f;if(n===!0&&(i=1)&&(n=null),a)e={p:e},t={p:t};else if(En(e)&&!En(t)){for(u=[],h=e.length,f=h-2,c=1;c<h;c++)u.push(r(e[c-1],e[c]));h--,s=function(g){g*=h;var _=Math.min(f,~~g);return u[_](g-_)},n=t}else i||(e=js(En(e)?[]:{},e));if(!u){for(l in t)Qu.call(o,e,l,"get",t[l]);s=function(g){return rf(g,o)||(a?e.p:e)}}}return Ir(n,s)},Yf=function(e,t,n){var i=e.labels,s=pi,a,o,l;for(a in i)o=i[a]-t,o<0==!!n&&o&&s>(o=Math.abs(o))&&(l=a,s=o);return l},ei=function(e,t,n){var i=e.vars,s=i[t],a=Lt,o=e._ctx,l,c,u;if(s)return l=i[t+"Params"],c=i.callbackScope||e,n&&wr.length&&ll(),o&&(Lt=o),u=l?s.apply(c,l):s.call(c),Lt=a,u},va=function(e){return Cr(e),e.scrollTrigger&&e.scrollTrigger.kill(!!hn),e.progress()<1&&ei(e,"onInterrupt"),e},ks,ip=[],rp=function(e){if(e)if(e=!e.name&&e.default||e,Yu()||e.headless){var t=e.name,n=kt(e),i=t&&!n&&e.init?function(){this._props=[]}:e,s={init:Wa,render:rf,add:Qu,kill:qg,modifier:Yg,rawVars:0},a={targetTest:0,get:0,getSetter:nf,aliases:{},register:0};if(ea(),e!==i){if(Kn[t])return;ri(i,ri(cl(e,s),a)),js(i.prototype,js(s,cl(e,a))),Kn[i.prop=t]=i,e.targetTest&&(qo.push(i),Zu[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}zh(t,i),e.register&&e.register(Wn,i,zn)}else ip.push(e)},Et=255,Ma={aqua:[0,Et,Et],lime:[0,Et,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Et],navy:[0,0,128],white:[Et,Et,Et],olive:[128,128,0],yellow:[Et,Et,0],orange:[Et,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Et,0,0],pink:[Et,192,203],cyan:[0,Et,Et],transparent:[Et,Et,Et,0]},Ol=function(e,t,n){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(n-t)*e*6:e<.5?n:e*3<2?t+(n-t)*(2/3-e)*6:t)*Et+.5|0},sp=function(e,t,n){var i=e?ir(e)?[e>>16,e>>8&Et,e&Et]:0:Ma.black,s,a,o,l,c,u,h,f,d,g;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),Ma[e])i=Ma[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),a=e.charAt(2),o=e.charAt(3),e="#"+s+s+a+a+o+o+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return i=parseInt(e.substr(1,6),16),[i>>16,i>>8&Et,i&Et,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&Et,e&Et]}else if(e.substr(0,3)==="hsl"){if(i=g=e.match(Gf),!t)l=+i[0]%360/360,c=+i[1]/100,u=+i[2]/100,a=u<=.5?u*(c+1):u+c-u*c,s=u*2-a,i.length>3&&(i[3]*=1),i[0]=Ol(l+1/3,s,a),i[1]=Ol(l,s,a),i[2]=Ol(l-1/3,s,a);else if(~e.indexOf("="))return i=e.match(Fh),n&&i.length<4&&(i[3]=1),i}else i=e.match(Gf)||Ma.transparent;i=i.map(Number)}return t&&!g&&(s=i[0]/Et,a=i[1]/Et,o=i[2]/Et,h=Math.max(s,a,o),f=Math.min(s,a,o),u=(h+f)/2,h===f?l=c=0:(d=h-f,c=u>.5?d/(2-h-f):d/(h+f),l=h===s?(a-o)/d+(a<o?6:0):h===a?(o-s)/d+2:(s-a)/d+4,l*=60),i[0]=~~(l+.5),i[1]=~~(c*100+.5),i[2]=~~(u*100+.5)),n&&i.length<4&&(i[3]=1),i},ap=function(e){var t=[],n=[],i=-1;return e.split(Ar).forEach(function(s){var a=s.match(Bs)||[];t.push.apply(t,a),n.push(i+=a.length+1)}),t.c=n,t},qf=function(e,t,n){var i="",s=(e+i).match(Ar),a=t?"hsla(":"rgba(",o=0,l,c,u,h;if(!s)return e;if(s=s.map(function(f){return(f=sp(f,t,1))&&a+(t?f[0]+","+f[1]+"%,"+f[2]+"%,"+f[3]:f.join(","))+")"}),n&&(u=ap(e),l=n.c,l.join(i)!==u.c.join(i)))for(c=e.replace(Ar,"1").split(Bs),h=c.length-1;o<h;o++)i+=c[o]+(~l.indexOf(o)?s.shift()||a+"0,0,0,0)":(u.length?u:s.length?s:n).shift());if(!c)for(c=e.split(Ar),h=c.length-1;o<h;o++)i+=c[o]+s[o];return i+c[h]},Ar=(function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",e;for(e in Ma)r+="|"+e+"\\b";return new RegExp(r+")","gi")})(),Dg=/hsl[a]?\(/,op=function(e){var t=e.join(" "),n;if(Ar.lastIndex=0,Ar.test(t))return n=Dg.test(t),e[1]=qf(e[1],n),e[0]=qf(e[0],n,ap(e[1])),!0},Ya,Jn=(function(){var r=Date.now,e=500,t=33,n=r(),i=n,s=1e3/240,a=s,o=[],l,c,u,h,f,d,g=function _(p){var m=r()-i,b=p===!0,w,M,y,T;if((m>e||m<0)&&(n+=m-t),i+=m,y=i-n,w=y-a,(w>0||b)&&(T=++h.frame,f=y-h.time*1e3,h.time=y=y/1e3,a+=w+(w>=s?4:s-w),M=1),b||(l=c(_)),M)for(d=0;d<o.length;d++)o[d](y,f,T,p)};return h={time:0,frame:0,tick:function(){g(!0)},deltaRatio:function(p){return f/(1e3/(p||60))},wake:function(){Bh&&(!Cc&&Yu()&&(Ci=Cc=window,qu=Ci.document||{},ii.gsap=Wn,(Ci.gsapVersions||(Ci.gsapVersions=[])).push(Wn.version),kh(ol||Ci.GreenSockGlobals||!Ci.gsap&&Ci||{}),ip.forEach(rp)),u=typeof requestAnimationFrame<"u"&&requestAnimationFrame,l&&h.sleep(),c=u||function(p){return setTimeout(p,a-h.time*1e3+1|0)},Ya=1,g(2))},sleep:function(){(u?cancelAnimationFrame:clearTimeout)(l),Ya=0,c=Wa},lagSmoothing:function(p,m){e=p||1/0,t=Math.min(m||33,e)},fps:function(p){s=1e3/(p||240),a=h.time*1e3+s},add:function(p,m,b){var w=m?function(M,y,T,A){p(M,y,T,A),h.remove(w)}:p;return h.remove(p),o[b?"unshift":"push"](w),ea(),w},remove:function(p,m){~(m=o.indexOf(p))&&o.splice(m,1)&&d>=m&&d--},_listeners:o},h})(),ea=function(){return!Ya&&Jn.wake()},ut={},Lg=/^[\d.\-M][\d.\-,\s]/,Ng=/["']/g,Ig=function(e){for(var t={},n=e.substr(1,e.length-3).split(":"),i=n[0],s=1,a=n.length,o,l,c;s<a;s++)l=n[s],o=s!==a-1?l.lastIndexOf(","):l.length,c=l.substr(0,o),t[i]=isNaN(c)?c.replace(Ng,"").trim():+c,i=l.substr(o+1).trim();return t},Ug=function(e){var t=e.indexOf("(")+1,n=e.indexOf(")"),i=e.indexOf("(",t);return e.substring(t,~i&&i<n?e.indexOf(")",n+1):n)},Fg=function(e){var t=(e+"").split("("),n=ut[t[0]];return n&&t.length>1&&n.config?n.config.apply(null,~e.indexOf("{")?[Ig(t[1])]:Ug(e).split(",").map(Wh)):ut._CE&&Lg.test(e)?ut._CE("",e):n},Og=function(e){return function(t){return 1-e(1-t)}},es=function(e,t){return e&&(kt(e)?e:ut[e]||Fg(e))||t},fs=function(e,t,n,i){n===void 0&&(n=function(l){return 1-t(1-l)}),i===void 0&&(i=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:n,easeInOut:i},a;return kn(e,function(o){ut[o]=ii[o]=s,ut[a=o.toLowerCase()]=n;for(var l in s)ut[a+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=ut[o+"."+l]=s[l]}),s},lp=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},Bl=function r(e,t,n){var i=t>=1?t:1,s=(n||(e?.3:.45))/(t<1?t:1),a=s/Rc*(Math.asin(1/i)||0),o=function(u){return u===1?1:i*Math.pow(2,-10*u)*og((u-a)*s)+1},l=e==="out"?o:e==="in"?function(c){return 1-o(1-c)}:lp(o);return s=Rc/s,l.config=function(c,u){return r(e,c,u)},l},kl=function r(e,t){t===void 0&&(t=1.70158);var n=function(a){return a?--a*a*((t+1)*a+t)+1:0},i=e==="out"?n:e==="in"?function(s){return 1-n(1-s)}:lp(n);return i.config=function(s){return r(e,s)},i};kn("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,e){var t=e<5?e+1:e;fs(r+",Power"+(t-1),e?function(n){return Math.pow(n,t)}:function(n){return n},function(n){return 1-Math.pow(1-n,t)},function(n){return n<.5?Math.pow(n*2,t)/2:1-Math.pow((1-n)*2,t)/2})});ut.Linear.easeNone=ut.none=ut.Linear.easeIn;fs("Elastic",Bl("in"),Bl("out"),Bl());(function(r,e){var t=1/e,n=2*t,i=2.5*t,s=function(o){return o<t?r*o*o:o<n?r*Math.pow(o-1.5/e,2)+.75:o<i?r*(o-=2.25/e)*o+.9375:r*Math.pow(o-2.625/e,2)+.984375};fs("Bounce",function(a){return 1-s(1-a)},s)})(7.5625,2.75);fs("Expo",function(r){return Math.pow(2,10*(r-1))*r+r*r*r*r*r*r*(1-r)});fs("Circ",function(r){return-(Ih(1-r*r)-1)});fs("Sine",function(r){return r===1?1:-ag(r*rg)+1});fs("Back",kl("in"),kl("out"),kl());ut.SteppedEase=ut.steps=ii.SteppedEase={config:function(e,t){e===void 0&&(e=1);var n=1/e,i=e+(t?0:1),s=t?1:0,a=1-Tt;return function(o){return((i*to(0,a,o)|0)+s)*n}}};Va.ease=ut["quad.out"];kn("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return Ku+=r+","+r+"Params,"});var cp=function(e,t){this.id=sg++,e._gsap=this,this.target=e,this.harness=t,this.get=t?t.get:Vh,this.set=t?t.getSetter:nf},qa=(function(){function r(t){this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,Qs(this,+t.duration,1,1),this.data=t.data,Lt&&(this._ctx=Lt,Lt.data.push(this)),Ya||Jn.wake()}var e=r.prototype;return e.delay=function(n){return n||n===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+n-this._delay),this._delay=n,this):this._delay},e.duration=function(n){return arguments.length?this.totalDuration(this._repeat>0?n+(n+this._rDelay)*this._repeat:n):this.totalDuration()&&this._dur},e.totalDuration=function(n){return arguments.length?(this._dirty=0,Qs(this,this._repeat<0?n:(n-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(n,i){if(ea(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(Al(this,n),!s._dp||s.parent||qh(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&n<this._tDur||this._ts<0&&n>0||!this._tDur&&!n)&&Li(this._dp,this,this._start-this._delay)}return(this._tTime!==n||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===Tt||!this._initted&&this._dur&&n||!n&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=n),Hh(this,n,i)),this},e.time=function(n,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),n+Wf(this))%(this._dur+this._rDelay)||(n?this._dur:0),i):this._time},e.totalProgress=function(n,i){return arguments.length?this.totalTime(this.totalDuration()*n,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},e.progress=function(n,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-n:n)+Wf(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(n,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(n-1)*s,i):this._repeat?Js(this._tTime,s)+1:1},e.timeScale=function(n,i){if(!arguments.length)return this._rts===-Tt?0:this._rts;if(this._rts===n)return this;var s=this.parent&&this._ts?ul(this.parent._time,this):this._tTime;return this._rts=+n||0,this._ts=this._ps||n===-Tt?0:this._rts,this.totalTime(to(-Math.abs(this._delay),this.totalDuration(),s),i!==!1),wl(this),_g(this)},e.paused=function(n){return arguments.length?(this._ps!==n&&(this._ps=n,n?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(ea(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Tt&&(this._tTime-=Tt)))),this):this._ps},e.startTime=function(n){if(arguments.length){this._start=Nt(n);var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Li(i,this,this._start-this._delay),this}return this._start},e.endTime=function(n){return this._start+(Bn(n)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(n){var i=this.parent||this._dp;return i?n&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?ul(i.rawTime(n),this):this._tTime:this._tTime},e.revert=function(n){n===void 0&&(n=hg);var i=hn;return hn=n,Ju(this)&&(this.timeline&&this.timeline.revert(n),this.totalTime(-.01,n.suppressEvents)),this.data!=="nested"&&n.kill!==!1&&this.kill(),hn=i,this},e.globalTime=function(n){for(var i=this,s=arguments.length?n:i.rawTime();i;)s=i._start+s/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(n):s},e.repeat=function(n){return arguments.length?(this._repeat=n===1/0?-2:n,Xf(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(n){if(arguments.length){var i=this._time;return this._rDelay=n,Xf(this),i?this.time(i):this}return this._rDelay},e.yoyo=function(n){return arguments.length?(this._yoyo=n,this):this._yoyo},e.seek=function(n,i){return this.totalTime(li(this,n),Bn(i))},e.restart=function(n,i){return this.play().totalTime(n?-this._delay:0,Bn(i)),this._dur||(this._zTime=-Tt),this},e.play=function(n,i){return n!=null&&this.seek(n,i),this.reversed(!1).paused(!1)},e.reverse=function(n,i){return n!=null&&this.seek(n||this.totalDuration(),i),this.reversed(!0).paused(!1)},e.pause=function(n,i){return n!=null&&this.seek(n,i),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(n){return arguments.length?(!!n!==this.reversed()&&this.timeScale(-this._rts||(n?-Tt:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-Tt,this},e.isActive=function(){var n=this.parent||this._dp,i=this._start,s;return!!(!n||this._ts&&this._initted&&n.isActive()&&(s=n.rawTime(!0))>=i&&s<this.endTime(!0)-Tt)},e.eventCallback=function(n,i,s){var a=this.vars;return arguments.length>1?(i?(a[n]=i,s&&(a[n+"Params"]=s),n==="onUpdate"&&(this._onUpdate=i)):delete a[n],this):a[n]},e.then=function(n){var i=this,s=i._prom;return new Promise(function(a){var o=kt(n)?n:Xh,l=function(){var u=i.then;i.then=null,s&&s(),kt(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=u),a(o),i.then=u};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?l():i._prom=l})},e.kill=function(){va(this)},r})();ri(qa.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Tt,_prom:0,_ps:!1,_rts:1});var On=(function(r){Nh(e,r);function e(n,i){var s;return n===void 0&&(n={}),s=r.call(this,n)||this,s.labels={},s.smoothChildTiming=!!n.smoothChildTiming,s.autoRemoveChildren=!!n.autoRemoveChildren,s._sort=Bn(n.sortChildren),It&&Li(n.parent||It,qi(s),i),n.reversed&&s.reverse(),n.paused&&s.paused(!0),n.scrollTrigger&&$h(qi(s),n.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,a){return Ca(0,arguments,this),this},t.from=function(i,s,a){return Ca(1,arguments,this),this},t.fromTo=function(i,s,a,o){return Ca(2,arguments,this),this},t.set=function(i,s,a){return s.duration=0,s.parent=this,Ra(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new Kt(i,s,li(this,a),1),this},t.call=function(i,s,a){return Li(this,Kt.delayedCall(0,i,s),a)},t.staggerTo=function(i,s,a,o,l,c,u){return a.duration=s,a.stagger=a.stagger||o,a.onComplete=c,a.onCompleteParams=u,a.parent=this,new Kt(i,a,li(this,l)),this},t.staggerFrom=function(i,s,a,o,l,c,u){return a.runBackwards=1,Ra(a).immediateRender=Bn(a.immediateRender),this.staggerTo(i,s,a,o,l,c,u)},t.staggerFromTo=function(i,s,a,o,l,c,u,h){return o.startAt=a,Ra(o).immediateRender=Bn(o.immediateRender),this.staggerTo(i,s,o,l,c,u,h)},t.render=function(i,s,a){var o=this._time,l=this._dirty?this.totalDuration():this._tDur,c=this._dur,u=i<=0?0:Nt(i),h=this._zTime<0!=i<0&&(this._initted||!c),f,d,g,_,p,m,b,w,M,y,T,A;if(this!==It&&u>l&&i>=0&&(u=l),u!==this._tTime||a||h){if(o!==this._time&&c&&(u+=this._time-o,i+=this._time-o),f=u,M=this._start,w=this._ts,m=!w,h&&(c||(o=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(T=this._yoyo,p=c+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(p*100+i,s,a);if(f=Nt(u%p),u===l?(_=this._repeat,f=c):(y=Nt(u/p),_=~~y,_&&_===y&&(f=c,_--),f>c&&(f=c)),y=Js(this._tTime,p),!o&&this._tTime&&y!==_&&this._tTime-y*p-this._dur<=0&&(y=_),T&&_&1&&(f=c-f,A=1),_!==y&&!this._lock){var v=T&&y&1,E=v===(T&&_&1);if(_<y&&(v=!v),o=v?0:u%c?c:u,this._lock=1,this.render(o||(A?0:Nt(_*p)),s,!c)._lock=0,this._tTime=u,!s&&this.parent&&ei(this,"onRepeat"),this.vars.repeatRefresh&&!A&&(this.invalidate()._lock=1,y=_),o&&o!==this._time||m!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(c=this._dur,l=this._tDur,E&&(this._lock=2,o=v?c:-1e-4,this.render(o,!0),this.vars.repeatRefresh&&!A&&this.invalidate()),this._lock=0,!this._ts&&!m)return this}}if(this._hasPause&&!this._forcing&&this._lock<2&&(b=Sg(this,Nt(o),Nt(f)),b&&(u-=f-(f=b._start))),this._tTime=u,this._time=f,this._act=!!w,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,o=0),!o&&u&&c&&!s&&!y&&(ei(this,"onStart"),this._tTime!==u))return this;if(f>=o&&i>=0)for(d=this._first;d;){if(g=d._next,(d._act||f>=d._start)&&d._ts&&b!==d){if(d.parent!==this)return this.render(i,s,a);if(d.render(d._ts>0?(f-d._start)*d._ts:(d._dirty?d.totalDuration():d._tDur)+(f-d._start)*d._ts,s,a),f!==this._time||!this._ts&&!m){b=0,g&&(u+=this._zTime=-Tt);break}}d=g}else{d=this._last;for(var C=i<0?i:f;d;){if(g=d._prev,(d._act||C<=d._end)&&d._ts&&b!==d){if(d.parent!==this)return this.render(i,s,a);if(d.render(d._ts>0?(C-d._start)*d._ts:(d._dirty?d.totalDuration():d._tDur)+(C-d._start)*d._ts,s,a||hn&&Ju(d)),f!==this._time||!this._ts&&!m){b=0,g&&(u+=this._zTime=C?-Tt:Tt);break}}d=g}}if(b&&!s&&(this.pause(),b.render(f>=o?0:-Tt)._zTime=f>=o?1:-1,this._ts))return this._start=M,wl(this),this.render(i,s,a);this._onUpdate&&!s&&ei(this,"onUpdate",!0),(u===l&&this._tTime>=this.totalDuration()||!u&&o)&&(M===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!c)&&(u===l&&this._ts>0||!u&&this._ts<0)&&Cr(this,1),!s&&!(i<0&&!o)&&(u||o||!l)&&(ei(this,u===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<l&&this.timeScale()>0)&&this._prom())))}return this},t.add=function(i,s){var a=this;if(ir(s)||(s=li(this,s,i)),!(i instanceof qa)){if(En(i))return i.forEach(function(o){return a.add(o,s)}),this;if(un(i))return this.addLabel(i,s);if(kt(i))i=Kt.delayedCall(0,i);else return this}return this!==i?Li(this,i,s):this},t.getChildren=function(i,s,a,o){i===void 0&&(i=!0),s===void 0&&(s=!0),a===void 0&&(a=!0),o===void 0&&(o=-pi);for(var l=[],c=this._first;c;)c._start>=o&&(c instanceof Kt?s&&l.push(c):(a&&l.push(c),i&&l.push.apply(l,c.getChildren(!0,s,a)))),c=c._next;return l},t.getById=function(i){for(var s=this.getChildren(1,1,1),a=s.length;a--;)if(s[a].vars.id===i)return s[a]},t.remove=function(i){return un(i)?this.removeLabel(i):kt(i)?this.killTweensOf(i):(i.parent===this&&Tl(this,i),i===this._recent&&(this._recent=this._last),Qr(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Nt(Jn.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),r.prototype.totalTime.call(this,i,s),this._forcing=0,this):this._tTime},t.addLabel=function(i,s){return this.labels[i]=li(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,a){var o=Kt.delayedCall(0,s||Wa,a);return o.data="isPause",this._hasPause=1,Li(this,o,li(this,i))},t.removePause=function(i){var s=this._first;for(i=li(this,i);s;)s._start===i&&s.data==="isPause"&&Cr(s),s=s._next},t.killTweensOf=function(i,s,a){for(var o=this.getTweensOf(i,a),l=o.length;l--;)vr!==o[l]&&o[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var a=[],o=mi(i),l=this._first,c=ir(s),u;l;)l instanceof Kt?pg(l._targets,o)&&(c?(!vr||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&a.push(l):(u=l.getTweensOf(o,s)).length&&a.push.apply(a,u),l=l._next;return a},t.tweenTo=function(i,s){s=s||{};var a=this,o=li(a,i),l=s,c=l.startAt,u=l.onStart,h=l.onStartParams,f=l.immediateRender,d,g=Kt.to(a,ri({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:o,overwrite:"auto",duration:s.duration||Math.abs((o-(c&&"time"in c?c.time:a._time))/a.timeScale())||Tt,onStart:function(){if(a.pause(),!d){var p=s.duration||Math.abs((o-(c&&"time"in c?c.time:a._time))/a.timeScale());g._dur!==p&&Qs(g,p,0,1).render(g._time,!0,!0),d=1}u&&u.apply(g,h||[])}},s));return f?g.render(0):g},t.tweenFromTo=function(i,s,a){return this.tweenTo(s,ri({startAt:{time:li(this,i)}},a))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),Yf(this,li(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),Yf(this,li(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+Tt)},t.shiftChildren=function(i,s,a){a===void 0&&(a=0);var o=this._first,l=this.labels,c;for(i=Nt(i);o;)o._start>=a&&(o._start+=i,o._end+=i),o=o._next;if(s)for(c in l)l[c]>=a&&(l[c]+=i);return Qr(this)},t.invalidate=function(i){var s=this._first;for(this._lock=0;s;)s.invalidate(i),s=s._next;return r.prototype.invalidate.call(this,i)},t.clear=function(i){i===void 0&&(i=!0);for(var s=this._first,a;s;)a=s._next,this.remove(s),s=a;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),Qr(this)},t.totalDuration=function(i){var s=0,a=this,o=a._last,l=pi,c,u,h;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-i:i));if(a._dirty){for(h=a.parent;o;)c=o._prev,o._dirty&&o.totalDuration(),u=o._start,u>l&&a._sort&&o._ts&&!a._lock?(a._lock=1,Li(a,o,u-o._delay,1)._lock=0):l=u,u<0&&o._ts&&(s-=u,(!h&&!a._dp||h&&h.smoothChildTiming)&&(a._start+=Nt(u/a._ts),a._time-=u,a._tTime-=u),a.shiftChildren(-u,!1,-1/0),l=0),o._end>s&&o._ts&&(s=o._end),o=c;Qs(a,a===It&&a._time>s?a._time:s,1,1),a._dirty=0}return a._tDur},e.updateRoot=function(i){if(It._ts&&(Hh(It,ul(i,It)),Gh=Jn.frame),Jn.frame>=Vf){Vf+=ni.autoSleep||120;var s=It._first;if((!s||!s._ts)&&ni.autoSleep&&Jn._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Jn.sleep()}}},e})(qa);ri(On.prototype,{_lock:0,_hasPause:0,_forcing:0});var Bg=function(e,t,n,i,s,a,o){var l=new zn(this._pt,e,t,0,1,mp,null,s),c=0,u=0,h,f,d,g,_,p,m,b;for(l.b=n,l.e=i,n+="",i+="",(m=~i.indexOf("random("))&&(i=Xa(i)),a&&(b=[n,i],a(b,e,t),n=b[0],i=b[1]),f=n.match(Ul)||[];h=Ul.exec(i);)g=h[0],_=i.substring(c,h.index),d?d=(d+1)%5:_.substr(-5)==="rgba("&&(d=1),g!==f[u++]&&(p=parseFloat(f[u-1])||0,l._pt={_next:l._pt,p:_||u===1?_:",",s:p,c:g.charAt(1)==="="?Gs(p,g)-p:parseFloat(g)-p,m:d&&d<4?Math.round:0},c=Ul.lastIndex);return l.c=c<i.length?i.substring(c,i.length):"",l.fp=o,(Oh.test(i)||m)&&(l.e=0),this._pt=l,l},Qu=function(e,t,n,i,s,a,o,l,c,u){kt(i)&&(i=i(s||0,e,a));var h=e[t],f=n!=="get"?n:kt(h)?c?e[t.indexOf("set")||!kt(e["get"+t.substr(3)])?t:"get"+t.substr(3)](c):e[t]():h,d=kt(h)?c?Hg:hp:tf,g;if(un(i)&&(~i.indexOf("random(")&&(i=Xa(i)),i.charAt(1)==="="&&(g=Gs(f,i)+(Sn(f)||0),(g||g===0)&&(i=g))),!u||f!==i||Fc)return!isNaN(f*i)&&i!==""?(g=new zn(this._pt,e,t,+f||0,i-(f||0),typeof h=="boolean"?Xg:pp,0,d),c&&(g.fp=c),o&&g.modifier(o,this,e),this._pt=g):(!h&&!(t in e)&&$u(t,i),Bg.call(this,e,t,f,i,d,l||ni.stringFilter,c))},kg=function(e,t,n,i,s){if(kt(e)&&(e=Pa(e,s,t,n,i)),!zi(e)||e.style&&e.nodeType||En(e)||Uh(e))return un(e)?Pa(e,s,t,n,i):e;var a={},o;for(o in e)a[o]=Pa(e[o],s,t,n,i);return a},up=function(e,t,n,i,s,a){var o,l,c,u;if(Kn[e]&&(o=new Kn[e]).init(s,o.rawVars?t[e]:kg(t[e],i,s,a,n),n,i,a)!==!1&&(n._pt=l=new zn(n._pt,s,e,0,1,o.render,o,0,o.priority),n!==ks))for(c=n._ptLookup[n._targets.indexOf(s)],u=o._props.length;u--;)c[o._props[u]]=l;return o},vr,Fc,ef=function r(e,t,n){var i=e.vars,s=i.ease,a=i.startAt,o=i.immediateRender,l=i.lazy,c=i.onUpdate,u=i.runBackwards,h=i.yoyoEase,f=i.keyframes,d=i.autoRevert,g=e._dur,_=e._startAt,p=e._targets,m=e.parent,b=m&&m.data==="nested"?m.vars.targets:p,w=e._overwrite==="auto"&&!Wu,M=e.timeline,y=i.easeReverse||h,T,A,v,E,C,L,N,q,W,B,G,I,$;if(M&&(!f||!s)&&(s="none"),e._ease=es(s,Va.ease),e._rEase=y&&(es(y)||e._ease),e._from=!M&&!!i.runBackwards,e._from&&(e.ratio=1),!M||f&&!i.stagger){if(q=p[0]?Jr(p[0]).harness:0,I=q&&i[q.prop],T=cl(i,Zu),_&&(_._zTime<0&&_.progress(1),t<0&&u&&o&&!d?_.render(-1,!0):_.revert(u&&g?Yo:dg),_._lazy=0),a){if(Cr(e._startAt=Kt.set(p,ri({data:"isStart",overwrite:!1,parent:m,immediateRender:!0,lazy:!_&&Bn(l),startAt:null,delay:0,onUpdate:c&&function(){return ei(e,"onUpdate")},stagger:0},a))),e._startAt._dp=0,e._startAt._sat=e,t<0&&(hn||!o&&!d)&&e._startAt.revert(Yo),o&&g&&t<=0&&n<=0){t&&(e._zTime=t);return}}else if(u&&g&&!_){if(t&&(o=!1),v=ri({overwrite:!1,data:"isFromStart",lazy:o&&!_&&Bn(l),immediateRender:o,stagger:0,parent:m},T),I&&(v[q.prop]=I),Cr(e._startAt=Kt.set(p,v)),e._startAt._dp=0,e._startAt._sat=e,t<0&&(hn?e._startAt.revert(Yo):e._startAt.render(-1,!0)),e._zTime=t,!o)r(e._startAt,Tt,Tt);else if(!t)return}for(e._pt=e._ptCache=0,l=g&&Bn(l)||l&&!g,A=0;A<p.length;A++){if(C=p[A],N=C._gsap||ju(p)[A]._gsap,e._ptLookup[A]=B={},Pc[N.id]&&wr.length&&ll(),G=b===p?A:b.indexOf(C),q&&(W=new q).init(C,I||T,e,G,b)!==!1&&(e._pt=E=new zn(e._pt,C,W.name,0,1,W.render,W,0,W.priority),W._props.forEach(function(j){B[j]=E}),W.priority&&(L=1)),!q||I)for(v in T)Kn[v]&&(W=up(v,T,e,G,C,b))?W.priority&&(L=1):B[v]=E=Qu.call(e,C,v,"get",T[v],G,b,0,i.stringFilter);e._op&&e._op[A]&&e.kill(C,e._op[A]),w&&e._pt&&(vr=e,It.killTweensOf(C,B,e.globalTime(t)),$=!e.parent,vr=0),e._pt&&l&&(Pc[N.id]=1)}L&&gp(e),e._onInit&&e._onInit(e)}e._onUpdate=c,e._initted=(!e._op||e._pt)&&!$,f&&t<=0&&M.render(pi,!0,!0)},zg=function(e,t,n,i,s,a,o,l){var c=(e._pt&&e._ptCache||(e._ptCache={}))[t],u,h,f,d;if(!c)for(c=e._ptCache[t]=[],f=e._ptLookup,d=e._targets.length;d--;){if(u=f[d][t],u&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==t&&u.fp!==t;)u=u._next;if(!u)return Fc=1,e.vars[t]="+=0",ef(e,o),Fc=0,l?Ha(t+" not eligible for reset. Try splitting into individual properties"):1;c.push(u)}for(d=c.length;d--;)h=c[d],u=h._pt||h,u.s=(i||i===0)&&!s?i:u.s+(i||0)+a*u.c,u.c=n-u.s,h.e&&(h.e=Ht(n)+Sn(h.e)),h.b&&(h.b=u.s+Sn(h.b))},Gg=function(e,t){var n=e[0]?Jr(e[0]).harness:0,i=n&&n.aliases,s,a,o,l;if(!i)return t;s=js({},t);for(a in i)if(a in s)for(l=i[a].split(","),o=l.length;o--;)s[l[o]]=s[a];return s},Vg=function(e,t,n,i){var s=t.ease||i||"power1.inOut",a,o;if(En(t))o=n[e]||(n[e]=[]),t.forEach(function(l,c){return o.push({t:c/(t.length-1)*100,v:l,e:s})});else for(a in t)o=n[a]||(n[a]=[]),a==="ease"||o.push({t:parseFloat(e),v:t[a],e:s})},Pa=function(e,t,n,i,s){return kt(e)?e.call(t,n,i,s):un(e)&&~e.indexOf("random(")?Xa(e):e},fp=Ku+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,easeReverse,autoRevert",dp={};kn(fp+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return dp[r]=1});var Kt=(function(r){Nh(e,r);function e(n,i,s,a){var o;typeof i=="number"&&(s.duration=i,i=s,s=null),o=r.call(this,a?i:Ra(i))||this;var l=o.vars,c=l.duration,u=l.delay,h=l.immediateRender,f=l.stagger,d=l.overwrite,g=l.keyframes,_=l.defaults,p=l.scrollTrigger,m=i.parent||It,b=(En(n)||Uh(n)?ir(n[0]):"length"in i)?[n]:mi(n),w,M,y,T,A,v,E,C;if(o._targets=b.length?ju(b):Ha("GSAP target "+n+" not found. https://gsap.com",!ni.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=d,g||f||so(c)||so(u)){i=o.vars;var L=i.easeReverse||i.yoyoEase;if(w=o.timeline=new On({data:"nested",defaults:_||{},targets:m&&m.data==="nested"?m.vars.targets:b}),w.kill(),w.parent=w._dp=qi(o),w._start=0,f||so(c)||so(u)){if(T=b.length,E=f&&Jh(f),zi(f))for(A in f)~fp.indexOf(A)&&(C||(C={}),C[A]=f[A]);for(M=0;M<T;M++)y=cl(i,dp),y.stagger=0,L&&(y.easeReverse=L),C&&js(y,C),v=b[M],y.duration=+Pa(c,qi(o),M,v,b),y.delay=(+Pa(u,qi(o),M,v,b)||0)-o._delay,!f&&T===1&&y.delay&&(o._delay=u=y.delay,o._start+=u,y.delay=0),w.to(v,y,E?E(M,v,b):0),w._ease=ut.none;w.duration()?c=u=0:o.timeline=0}else if(g){Ra(ri(w.vars.defaults,{ease:"none"})),w._ease=es(g.ease||i.ease||"none");var N=0,q,W,B;if(En(g))g.forEach(function(G){return w.to(b,G,">")}),w.duration();else{y={};for(A in g)A==="ease"||A==="easeEach"||Vg(A,g[A],y,g.easeEach);for(A in y)for(q=y[A].sort(function(G,I){return G.t-I.t}),N=0,M=0;M<q.length;M++)W=q[M],B={ease:W.e,duration:(W.t-(M?q[M-1].t:0))/100*c},B[A]=W.v,w.to(b,B,N),N+=B.duration;w.duration()<c&&w.to({},{duration:c-w.duration()})}}c||o.duration(c=w.duration())}else o.timeline=0;return d===!0&&!Wu&&(vr=qi(o),It.killTweensOf(b),vr=0),Li(m,qi(o),s),i.reversed&&o.reverse(),i.paused&&o.paused(!0),(h||!c&&!g&&o._start===Nt(m._time)&&Bn(h)&&xg(qi(o))&&m.data!=="nested")&&(o._tTime=-Tt,o.render(Math.max(0,-u)||0)),p&&$h(qi(o),p),o}var t=e.prototype;return t.render=function(i,s,a){var o=this._time,l=this._tDur,c=this._dur,u=i<0,h=i>l-Tt&&!u?l:i<Tt?0:i,f,d,g,_,p,m,b,w;if(!c)Mg(this,i,s,a);else if(h!==this._tTime||!i||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u||this._lazy){if(f=h,w=this.timeline,this._repeat){if(_=c+this._rDelay,this._repeat<-1&&u)return this.totalTime(_*100+i,s,a);if(f=Nt(h%_),h===l?(g=this._repeat,f=c):(p=Nt(h/_),g=~~p,g&&g===p?(f=c,g--):f>c&&(f=c)),m=this._yoyo&&g&1,m&&(f=c-f),p=Js(this._tTime,_),f===o&&!a&&this._initted&&g===p)return this._tTime=h,this;g!==p&&this.vars.repeatRefresh&&!m&&!this._lock&&f!==_&&this._initted&&(this._lock=a=1,this.render(Nt(_*g),!0).invalidate()._lock=0)}if(!this._initted){if(Zh(this,u?i:f,a,s,h))return this._tTime=0,this;if(o!==this._time&&!(a&&this.vars.repeatRefresh&&g!==p))return this;if(c!==this._dur)return this.render(i,s,a)}if(this._rEase){var M=f<o;if(M!==this._inv){var y=M?o:c-o;this._inv=M,this._from&&(this.ratio=1-this.ratio),this._invRatio=this.ratio,this._invTime=o,this._invRecip=y?(M?-1:1)/y:0,this._invScale=M?-this.ratio:1-this.ratio,this._invEase=M?this._rEase:this._ease}this.ratio=b=this._invRatio+this._invScale*this._invEase((f-this._invTime)*this._invRecip)}else this.ratio=b=this._ease(f/c);if(this._from&&(this.ratio=b=1-b),this._tTime=h,this._time=f,!this._act&&this._ts&&(this._act=1,this._lazy=0),!o&&h&&!s&&!p&&(ei(this,"onStart"),this._tTime!==h))return this;for(d=this._pt;d;)d.r(b,d.d),d=d._next;w&&w.render(i<0?i:w._dur*w._ease(f/this._dur),s,a)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(u&&Dc(this,i,s,a),ei(this,"onUpdate")),this._repeat&&g!==p&&this.vars.onRepeat&&!s&&this.parent&&ei(this,"onRepeat"),(h===this._tDur||!h)&&this._tTime===h&&(u&&!this._onUpdate&&Dc(this,i,!0,!0),(i||!c)&&(h===this._tDur&&this._ts>0||!h&&this._ts<0)&&Cr(this,1),!s&&!(u&&!o)&&(h||o||m)&&(ei(this,h===l?"onComplete":"onReverseComplete",!0),this._prom&&!(h<l&&this.timeScale()>0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),r.prototype.invalidate.call(this,i)},t.resetTo=function(i,s,a,o,l){Ya||Jn.wake(),this._ts||this.play();var c=Math.min(this._dur,(this._dp._time-this._start)*this._ts),u;return this._initted||ef(this,c),u=this._ease(c/this._dur),zg(this,i,s,a,o,u,c,l)?this.resetTo(i,s,a,o,1):(Al(this,0),this.parent||Yh(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(i,s){if(s===void 0&&(s="all"),!i&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?va(this):this.scrollTrigger&&this.scrollTrigger.kill(!!hn),this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,vr&&vr.vars.overwrite!==!0)._first||va(this),this.parent&&a!==this.timeline.totalDuration()&&Qs(this,this._dur*this.timeline._tDur/a,0,1),this}var o=this._targets,l=i?mi(i):o,c=this._ptLookup,u=this._pt,h,f,d,g,_,p,m;if((!s||s==="all")&&gg(o,l))return s==="all"&&(this._pt=0),va(this);for(h=this._op=this._op||[],s!=="all"&&(un(s)&&(_={},kn(s,function(b){return _[b]=1}),s=_),s=Gg(o,s)),m=o.length;m--;)if(~l.indexOf(o[m])){f=c[m],s==="all"?(h[m]=s,g=f,d={}):(d=h[m]=h[m]||{},g=s);for(_ in g)p=f&&f[_],p&&((!("kill"in p.d)||p.d.kill(_)===!0)&&Tl(this,p,"_pt"),delete f[_]),d!=="all"&&(d[_]=1)}return this._initted&&!this._pt&&u&&va(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return Ca(1,arguments)},e.delayedCall=function(i,s,a,o){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:s,onReverseComplete:s,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:o})},e.fromTo=function(i,s,a){return Ca(2,arguments)},e.set=function(i,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(i,s)},e.killTweensOf=function(i,s,a){return It.killTweensOf(i,s,a)},e})(qa);ri(Kt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});kn("staggerTo,staggerFrom,staggerFromTo",function(r){Kt[r]=function(){var e=new On,t=Nc.call(arguments,0);return t.splice(r==="staggerFromTo"?5:4,0,0),e[r].apply(e,t)}});var tf=function(e,t,n){return e[t]=n},hp=function(e,t,n){return e[t](n)},Hg=function(e,t,n,i){return e[t](i.fp,n)},Wg=function(e,t,n){return e.setAttribute(t,n)},nf=function(e,t){return kt(e[t])?hp:Xu(e[t])&&e.setAttribute?Wg:tf},pp=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},Xg=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},mp=function(e,t){var n=t._pt,i="";if(!e&&t.b)i=t.b;else if(e===1&&t.e)i=t.e;else{for(;n;)i=n.p+(n.m?n.m(n.s+n.c*e):Math.round((n.s+n.c*e)*1e4)/1e4)+i,n=n._next;i+=t.c}t.set(t.t,t.p,i,t)},rf=function(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next},Yg=function(e,t,n,i){for(var s=this._pt,a;s;)a=s._next,s.p===i&&s.modifier(e,t,n),s=a},qg=function(e){for(var t=this._pt,n,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?Tl(this,t,"_pt"):t.dep||(n=1),t=i;return!n},$g=function(e,t,n,i){i.mSet(e,t,i.m.call(i.tween,n,i.mt),i)},gp=function(e){for(var t=e._pt,n,i,s,a;t;){for(n=t._next,i=s;i&&i.pr>t.pr;)i=i._next;(t._prev=i?i._prev:a)?t._prev._next=t:s=t,(t._next=i)?i._prev=t:a=t,t=n}e._pt=s},zn=(function(){function r(t,n,i,s,a,o,l,c,u){this.t=n,this.s=s,this.c=a,this.p=i,this.r=o||pp,this.d=l||this,this.set=c||tf,this.pr=u||0,this._next=t,t&&(t._prev=this)}var e=r.prototype;return e.modifier=function(n,i,s){this.mSet=this.mSet||this.set,this.set=$g,this.m=n,this.mt=s,this.tween=i},r})();kn(Ku+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger,easeReverse",function(r){return Zu[r]=1});ii.TweenMax=ii.TweenLite=Kt;ii.TimelineLite=ii.TimelineMax=On;It=new On({sortChildren:!1,defaults:Va,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});ni.stringFilter=op;var ts=[],$o={},Zg=[],$f=0,Kg=0,zl=function(e){return($o[e]||Zg).map(function(t){return t()})},Oc=function(){var e=Date.now(),t=[];e-$f>2&&(zl("matchMediaInit"),ts.forEach(function(n){var i=n.queries,s=n.conditions,a,o,l,c;for(o in i)a=Ci.matchMedia(i[o]).matches,a&&(l=1),a!==s[o]&&(s[o]=a,c=1);c&&(n.revert(),l&&t.push(n))}),zl("matchMediaRevert"),t.forEach(function(n){return n.onMatch(n,function(i){return n.add(null,i)})}),$f=e,zl("matchMedia"))},_p=(function(){function r(t,n){this.selector=n&&Ic(n),this.data=[],this._r=[],this.isReverted=!1,this.id=Kg++,t&&this.add(t)}var e=r.prototype;return e.add=function(n,i,s){kt(n)&&(s=i,i=n,n=kt);var a=this,o=function(){var c=Lt,u=a.selector,h;return c&&c!==a&&c.data.push(a),s&&(a.selector=Ic(s)),Lt=a,h=i.apply(a,arguments),kt(h)&&a._r.push(h),Lt=c,a.selector=u,a.isReverted=!1,h};return a.last=o,n===kt?o(a,function(l){return a.add(null,l)}):n?a[n]=o:o},e.ignore=function(n){var i=Lt;Lt=null,n(this),Lt=i},e.getTweens=function(){var n=[];return this.data.forEach(function(i){return i instanceof r?n.push.apply(n,i.getTweens()):i instanceof Kt&&!(i.parent&&i.parent.data==="nested")&&n.push(i)}),n},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(n,i){var s=this;if(n?(function(){for(var o=s.getTweens(),l=s.data.length,c;l--;)c=s.data[l],c.data==="isFlip"&&(c.revert(),c.getChildren(!0,!0,!1).forEach(function(u){return o.splice(o.indexOf(u),1)}));for(o.map(function(u){return{g:u._dur||u._delay||u._sat&&!u._sat.vars.immediateRender?u.globalTime(0):-1/0,t:u}}).sort(function(u,h){return h.g-u.g||-1/0}).forEach(function(u){return u.t.revert(n)}),l=s.data.length;l--;)c=s.data[l],c instanceof On?c.data!=="nested"&&(c.scrollTrigger&&c.scrollTrigger.revert(),c.kill()):!(c instanceof Kt)&&c.revert&&c.revert(n);s._r.forEach(function(u){return u(n,s)}),s.isReverted=!0})():this.data.forEach(function(o){return o.kill&&o.kill()}),this.clear(),i)for(var a=ts.length;a--;)ts[a].id===this.id&&ts.splice(a,1)},e.revert=function(n){this.kill(n||{})},r})(),jg=(function(){function r(t){this.contexts=[],this.scope=t,Lt&&Lt.data.push(this)}var e=r.prototype;return e.add=function(n,i,s){zi(n)||(n={matches:n});var a=new _p(0,s||this.scope),o=a.conditions={},l,c,u;Lt&&!a.selector&&(a.selector=Lt.selector),this.contexts.push(a),i=a.add("onMatch",i),a.queries=n;for(c in n)c==="all"?u=1:(l=Ci.matchMedia(n[c]),l&&(ts.indexOf(a)<0&&ts.push(a),(o[c]=l.matches)&&(u=1),l.addListener?l.addListener(Oc):l.addEventListener("change",Oc)));return u&&i(a,function(h){return a.add(null,h)}),this},e.revert=function(n){this.kill(n||{})},e.kill=function(n){this.contexts.forEach(function(i){return i.kill(n,!0)})},r})(),fl={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach(function(i){return rp(i)})},timeline:function(e){return new On(e)},getTweensOf:function(e,t){return It.getTweensOf(e,t)},getProperty:function(e,t,n,i){un(e)&&(e=mi(e)[0]);var s=Jr(e||{}).get,a=n?Xh:Wh;return n==="native"&&(n=""),e&&(t?a((Kn[t]&&Kn[t].get||s)(e,t,n,i)):function(o,l,c){return a((Kn[o]&&Kn[o].get||s)(e,o,l,c))})},quickSetter:function(e,t,n){if(e=mi(e),e.length>1){var i=e.map(function(u){return Wn.quickSetter(u,t,n)}),s=i.length;return function(u){for(var h=s;h--;)i[h](u)}}e=e[0]||{};var a=Kn[t],o=Jr(e),l=o.harness&&(o.harness.aliases||{})[t]||t,c=a?function(u){var h=new a;ks._pt=0,h.init(e,n?u+n:u,ks,0,[e]),h.render(1,h),ks._pt&&rf(1,ks)}:o.set(e,l);return a?c:function(u){return c(e,l,n?u+n:u,o,1)}},quickTo:function(e,t,n){var i,s=Wn.to(e,ri((i={},i[t]="+=0.1",i.paused=!0,i.stagger=0,i),n||{})),a=function(l,c,u){return s.resetTo(t,l,c,u)};return a.tween=s,a},isTweening:function(e){return It.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=es(e.ease,Va.ease)),Hf(Va,e||{})},config:function(e){return Hf(ni,e||{})},registerEffect:function(e){var t=e.name,n=e.effect,i=e.plugins,s=e.defaults,a=e.extendTimeline;(i||"").split(",").forEach(function(o){return o&&!Kn[o]&&!ii[o]&&Ha(t+" effect requires "+o+" plugin.")}),Fl[t]=function(o,l,c){return n(mi(o),ri(l||{},s),c)},a&&(On.prototype[t]=function(o,l,c){return this.add(Fl[t](o,zi(l)?l:(c=l)&&{},this),c)})},registerEase:function(e,t){ut[e]=es(t)},parseEase:function(e,t){return arguments.length?es(e,t):ut},getById:function(e){return It.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var n=new On(e),i,s;for(n.smoothChildTiming=Bn(e.smoothChildTiming),It.remove(n),n._dp=0,n._time=n._tTime=It._time,i=It._first;i;)s=i._next,(t||!(!i._dur&&i instanceof Kt&&i.vars.onComplete===i._targets[0]))&&Li(n,i,i._start-i._delay),i=s;return Li(It,n,0),n},context:function(e,t){return e?new _p(e,t):Lt},matchMedia:function(e){return new jg(e)},matchMediaRefresh:function(){return ts.forEach(function(e){var t=e.conditions,n,i;for(i in t)t[i]&&(t[i]=!1,n=1);n&&e.revert()})||Oc()},addEventListener:function(e,t){var n=$o[e]||($o[e]=[]);~n.indexOf(t)||n.push(t)},removeEventListener:function(e,t){var n=$o[e],i=n&&n.indexOf(t);i>=0&&n.splice(i,1)},utils:{wrap:Rg,wrapYoyo:Cg,distribute:Jh,random:ep,snap:Qh,normalize:Ag,getUnit:Sn,clamp:yg,splitColor:sp,toArray:mi,selector:Ic,mapRange:np,pipe:Tg,unitize:wg,interpolate:Pg,shuffle:jh},install:kh,effects:Fl,ticker:Jn,updateRoot:On.updateRoot,plugins:Kn,globalTimeline:It,core:{PropTween:zn,globals:zh,Tween:Kt,Timeline:On,Animation:qa,getCache:Jr,_removeLinkedListItem:Tl,reverting:function(){return hn},context:function(e){return e&&Lt&&(Lt.data.push(e),e._ctx=Lt),Lt},suppressOverwrites:function(e){return Wu=e}}};kn("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return fl[r]=Kt[r]});Jn.add(On.updateRoot);ks=fl.to({},{duration:0});var Jg=function(e,t){for(var n=e._pt;n&&n.p!==t&&n.op!==t&&n.fp!==t;)n=n._next;return n},Qg=function(e,t){var n=e._targets,i,s,a;for(i in t)for(s=n.length;s--;)a=e._ptLookup[s][i],a&&(a=a.d)&&(a._pt&&(a=Jg(a,i)),a&&a.modifier&&a.modifier(t[i],e,n[s],i))},Gl=function(e,t){return{name:e,headless:1,rawVars:1,init:function(i,s,a){a._onInit=function(o){var l,c;if(un(s)&&(l={},kn(s,function(u){return l[u]=1}),s=l),t){l={};for(c in s)l[c]=t(s[c]);s=l}Qg(o,s)}}}},Wn=fl.registerPlugin({name:"attr",init:function(e,t,n,i,s){var a,o,l;this.tween=n;for(a in t)l=e.getAttribute(a)||"",o=this.add(e,"setAttribute",(l||0)+"",t[a],i,s,0,0,a),o.op=a,o.b=l,this._props.push(a)},render:function(e,t){for(var n=t._pt;n;)hn?n.set(n.t,n.p,n.b,n):n.r(e,n.d),n=n._next}},{name:"endArray",headless:1,init:function(e,t){for(var n=t.length;n--;)this.add(e,n,e[n]||0,t[n],0,0,0,0,0,1)}},Gl("roundProps",Uc),Gl("modifiers"),Gl("snap",Qh))||fl;Kt.version=On.version=Wn.version="3.15.0";Bh=1;Yu()&&ea();ut.Power0;ut.Power1;ut.Power2;ut.Power3;ut.Power4;ut.Linear;ut.Quad;ut.Cubic;ut.Quart;ut.Quint;ut.Strong;ut.Elastic;ut.Back;ut.SteppedEase;ut.Bounce;ut.Sine;ut.Expo;ut.Circ;var Zf,Mr,Vs,sf,$r,Kf,af,e0=function(){return typeof window<"u"},rr={},Vr=180/Math.PI,Hs=Math.PI/180,gs=Math.atan2,jf=1e8,of=/([A-Z])/g,t0=/(left|right|width|margin|padding|x)/i,n0=/[\s,\(]\S/,Ni={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Bc=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},i0=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},r0=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},s0=function(e,t){return t.set(t.t,t.p,e===1?t.e:e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},a0=function(e,t){var n=t.s+t.c*e;t.set(t.t,t.p,~~(n+(n<0?-.5:.5))+t.u,t)},xp=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},vp=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},o0=function(e,t,n){return e.style[t]=n},l0=function(e,t,n){return e.style.setProperty(t,n)},c0=function(e,t,n){return e._gsap[t]=n},u0=function(e,t,n){return e._gsap.scaleX=e._gsap.scaleY=n},f0=function(e,t,n,i,s){var a=e._gsap;a.scaleX=a.scaleY=n,a.renderTransform(s,a)},d0=function(e,t,n,i,s){var a=e._gsap;a[t]=n,a.renderTransform(s,a)},Ut="transform",Gn=Ut+"Origin",h0=function r(e,t){var n=this,i=this.target,s=i.style,a=i._gsap;if(e in rr&&s){if(this.tfm=this.tfm||{},e!=="transform")e=Ni[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return n.tfm[o]=$i(i,o)}):this.tfm[e]=a.x?a[e]:$i(i,e),e===Gn&&(this.tfm.zOrigin=a.zOrigin);else return Ni.transform.split(",").forEach(function(o){return r.call(n,o,t)});if(this.props.indexOf(Ut)>=0)return;a.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(Gn,t,"")),e=Ut}(s||t)&&this.props.push(e,t,s[e])},Mp=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},p0=function(){var e=this.props,t=this.target,n=t.style,i=t._gsap,s,a;for(s=0;s<e.length;s+=3)e[s+1]?e[s+1]===2?t[e[s]](e[s+2]):t[e[s]]=e[s+2]:e[s+2]?n[e[s]]=e[s+2]:n.removeProperty(e[s].substr(0,2)==="--"?e[s]:e[s].replace(of,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)i[a]=this.tfm[a];i.svg&&(i.renderTransform(),t.setAttribute("data-svg-origin",this.svgo||"")),s=af(),(!s||!s.isStart)&&!n[Ut]&&(Mp(n),i.zOrigin&&n[Gn]&&(n[Gn]+=" "+i.zOrigin+"px",i.zOrigin=0,i.renderTransform()),i.uncache=1)}},Sp=function(e,t){var n={target:e,props:[],revert:p0,save:h0};return e._gsap||Wn.core.getCache(e),t&&e.style&&e.nodeType&&t.split(",").forEach(function(i){return n.save(i)}),n},bp,kc=function(e,t){var n=Mr.createElementNS?Mr.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):Mr.createElement(e);return n&&n.style?n:Mr.createElement(e)},ti=function r(e,t,n){var i=getComputedStyle(e);return i[t]||i.getPropertyValue(t.replace(of,"-$1").toLowerCase())||i.getPropertyValue(t)||!n&&r(e,ta(t)||t,1)||""},Jf="O,Moz,ms,Ms,Webkit".split(","),ta=function(e,t,n){var i=t||$r,s=i.style,a=5;if(e in s&&!n)return e;for(e=e.charAt(0).toUpperCase()+e.substr(1);a--&&!(Jf[a]+e in s););return a<0?null:(a===3?"ms":a>=0?Jf[a]:"")+e},zc=function(){e0()&&window.document&&(Zf=window,Mr=Zf.document,Vs=Mr.documentElement,$r=kc("div")||{style:{}},kc("div"),Ut=ta(Ut),Gn=Ut+"Origin",$r.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",bp=!!ta("perspective"),af=Wn.core.reverting,sf=1)},Qf=function(e){var t=e.ownerSVGElement,n=kc("svg",t&&t.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=e.cloneNode(!0),s;i.style.display="block",n.appendChild(i),Vs.appendChild(n);try{s=i.getBBox()}catch{}return n.removeChild(i),Vs.removeChild(n),s},ed=function(e,t){for(var n=t.length;n--;)if(e.hasAttribute(t[n]))return e.getAttribute(t[n])},yp=function(e){var t,n;try{t=e.getBBox()}catch{t=Qf(e),n=1}return t&&(t.width||t.height)||n||(t=Qf(e)),t&&!t.width&&!t.x&&!t.y?{x:+ed(e,["x","cx","x1"])||0,y:+ed(e,["y","cy","y1"])||0,width:0,height:0}:t},Ep=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&yp(e))},Pr=function(e,t){if(t){var n=e.style,i;t in rr&&t!==Gn&&(t=Ut),n.removeProperty?(i=t.substr(0,2),(i==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),n.removeProperty(i==="--"?t:t.replace(of,"-$1").toLowerCase())):n.removeAttribute(t)}},Sr=function(e,t,n,i,s,a){var o=new zn(e._pt,t,n,0,1,a?vp:xp);return e._pt=o,o.b=i,o.e=s,e._props.push(n),o},td={deg:1,rad:1,turn:1},m0={grid:1,flex:1},Dr=function r(e,t,n,i){var s=parseFloat(n)||0,a=(n+"").trim().substr((s+"").length)||"px",o=$r.style,l=t0.test(t),c=e.tagName.toLowerCase()==="svg",u=(c?"client":"offset")+(l?"Width":"Height"),h=100,f=i==="px",d=i==="%",g,_,p,m;if(i===a||!s||td[i]||td[a])return s;if(a!=="px"&&!f&&(s=r(e,t,n,"px")),m=e.getCTM&&Ep(e),(d||a==="%")&&(rr[t]||~t.indexOf("adius")))return g=m?e.getBBox()[l?"width":"height"]:e[u],Ht(d?s/g*h:s/100*g);if(o[l?"width":"height"]=h+(f?a:i),_=i!=="rem"&&~t.indexOf("adius")||i==="em"&&e.appendChild&&!c?e:e.parentNode,m&&(_=(e.ownerSVGElement||{}).parentNode),(!_||_===Mr||!_.appendChild)&&(_=Mr.body),p=_._gsap,p&&d&&p.width&&l&&p.time===Jn.time&&!p.uncache)return Ht(s/p.width*h);if(d&&(t==="height"||t==="width")){var b=e.style[t];e.style[t]=h+i,g=e[u],b?e.style[t]=b:Pr(e,t)}else(d||a==="%")&&!m0[ti(_,"display")]&&(o.position=ti(e,"position")),_===e&&(o.position="static"),_.appendChild($r),g=$r[u],_.removeChild($r),o.position="absolute";return l&&d&&(p=Jr(_),p.time=Jn.time,p.width=_[u]),Ht(f?g*s/h:g&&s?h/g*s:0)},$i=function(e,t,n,i){var s;return sf||zc(),t in Ni&&t!=="transform"&&(t=Ni[t],~t.indexOf(",")&&(t=t.split(",")[0])),rr[t]&&t!=="transform"?(s=Za(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:hl(ti(e,Gn))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=dl[t]&&dl[t](e,t,n)||ti(e,t)||Vh(e,t)||(t==="opacity"?1:0))),n&&!~(s+"").trim().indexOf(" ")?Dr(e,t,s,n)+n:s},g0=function(e,t,n,i){if(!n||n==="none"){var s=ta(t,e,1),a=s&&ti(e,s,1);a&&a!==n?(t=s,n=a):t==="borderColor"&&(n=ti(e,"borderTopColor"))}var o=new zn(this._pt,e.style,t,0,1,mp),l=0,c=0,u,h,f,d,g,_,p,m,b,w,M,y;if(o.b=n,o.e=i,n+="",i+="",i.substring(0,6)==="var(--"&&(i=ti(e,i.substring(4,i.indexOf(")")))),i==="auto"&&(_=e.style[t],e.style[t]=i,i=ti(e,t)||i,_?e.style[t]=_:Pr(e,t)),u=[n,i],op(u),n=u[0],i=u[1],f=n.match(Bs)||[],y=i.match(Bs)||[],y.length){for(;h=Bs.exec(i);)p=h[0],b=i.substring(l,h.index),g?g=(g+1)%5:(b.substr(-5)==="rgba("||b.substr(-5)==="hsla(")&&(g=1),p!==(_=f[c++]||"")&&(d=parseFloat(_)||0,M=_.substr((d+"").length),p.charAt(1)==="="&&(p=Gs(d,p)+M),m=parseFloat(p),w=p.substr((m+"").length),l=Bs.lastIndex-w.length,w||(w=w||ni.units[t]||M,l===i.length&&(i+=w,o.e+=w)),M!==w&&(d=Dr(e,t,_,w)||0),o._pt={_next:o._pt,p:b||c===1?b:",",s:d,c:m-d,m:g&&g<4||t==="zIndex"?Math.round:0});o.c=l<i.length?i.substring(l,i.length):""}else o.r=t==="display"&&i==="none"?vp:xp;return Oh.test(i)&&(o.e=0),this._pt=o,o},nd={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},_0=function(e){var t=e.split(" "),n=t[0],i=t[1]||"50%";return(n==="top"||n==="bottom"||i==="left"||i==="right")&&(e=n,n=i,i=e),t[0]=nd[n]||n,t[1]=nd[i]||i,t.join(" ")},x0=function(e,t){if(t.tween&&t.tween._time===t.tween._dur){var n=t.t,i=n.style,s=t.u,a=n._gsap,o,l,c;if(s==="all"||s===!0)i.cssText="",l=1;else for(s=s.split(","),c=s.length;--c>-1;)o=s[c],rr[o]&&(l=1,o=o==="transformOrigin"?Gn:Ut),Pr(n,o);l&&(Pr(n,Ut),a&&(a.svg&&n.removeAttribute("transform"),i.scale=i.rotate=i.translate="none",Za(n,1),a.uncache=1,Mp(i)))}},dl={clearProps:function(e,t,n,i,s){if(s.data!=="isFromStart"){var a=e._pt=new zn(e._pt,t,n,0,0,x0);return a.u=i,a.pr=-10,a.tween=s,e._props.push(n),1}}},$a=[1,0,0,1,0,0],Tp={},wp=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},id=function(e){var t=ti(e,Ut);return wp(t)?$a:t.substr(7).match(Fh).map(Ht)},lf=function(e,t){var n=e._gsap||Jr(e),i=e.style,s=id(e),a,o,l,c;return n.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?$a:s):(s===$a&&!e.offsetParent&&e!==Vs&&!n.svg&&(l=i.display,i.display="block",a=e.parentNode,(!a||!e.offsetParent&&!e.getBoundingClientRect().width)&&(c=1,o=e.nextElementSibling,Vs.appendChild(e)),s=id(e),l?i.display=l:Pr(e,"display"),c&&(o?a.insertBefore(e,o):a?a.appendChild(e):Vs.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},Gc=function(e,t,n,i,s,a){var o=e._gsap,l=s||lf(e,!0),c=o.xOrigin||0,u=o.yOrigin||0,h=o.xOffset||0,f=o.yOffset||0,d=l[0],g=l[1],_=l[2],p=l[3],m=l[4],b=l[5],w=t.split(" "),M=parseFloat(w[0])||0,y=parseFloat(w[1])||0,T,A,v,E;n?l!==$a&&(A=d*p-g*_)&&(v=M*(p/A)+y*(-_/A)+(_*b-p*m)/A,E=M*(-g/A)+y*(d/A)-(d*b-g*m)/A,M=v,y=E):(T=yp(e),M=T.x+(~w[0].indexOf("%")?M/100*T.width:M),y=T.y+(~(w[1]||w[0]).indexOf("%")?y/100*T.height:y)),i||i!==!1&&o.smooth?(m=M-c,b=y-u,o.xOffset=h+(m*d+b*_)-m,o.yOffset=f+(m*g+b*p)-b):o.xOffset=o.yOffset=0,o.xOrigin=M,o.yOrigin=y,o.smooth=!!i,o.origin=t,o.originIsAbsolute=!!n,e.style[Gn]="0px 0px",a&&(Sr(a,o,"xOrigin",c,M),Sr(a,o,"yOrigin",u,y),Sr(a,o,"xOffset",h,o.xOffset),Sr(a,o,"yOffset",f,o.yOffset)),e.setAttribute("data-svg-origin",M+" "+y)},Za=function(e,t){var n=e._gsap||new cp(e);if("x"in n&&!t&&!n.uncache)return n;var i=e.style,s=n.scaleX<0,a="px",o="deg",l=getComputedStyle(e),c=ti(e,Gn)||"0",u,h,f,d,g,_,p,m,b,w,M,y,T,A,v,E,C,L,N,q,W,B,G,I,$,j,D,se,he,Ve,He,De;return u=h=f=_=p=m=b=w=M=0,d=g=1,n.svg=!!(e.getCTM&&Ep(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Ut]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Ut]!=="none"?l[Ut]:"")),i.scale=i.rotate=i.translate="none"),A=lf(e,n.svg),n.svg&&(n.uncache?($=e.getBBox(),c=n.xOrigin-$.x+"px "+(n.yOrigin-$.y)+"px",I=""):I=!t&&e.getAttribute("data-svg-origin"),Gc(e,I||c,!!I||n.originIsAbsolute,n.smooth!==!1,A)),y=n.xOrigin||0,T=n.yOrigin||0,A!==$a&&(L=A[0],N=A[1],q=A[2],W=A[3],u=B=A[4],h=G=A[5],A.length===6?(d=Math.sqrt(L*L+N*N),g=Math.sqrt(W*W+q*q),_=L||N?gs(N,L)*Vr:0,b=q||W?gs(q,W)*Vr+_:0,b&&(g*=Math.abs(Math.cos(b*Hs))),n.svg&&(u-=y-(y*L+T*q),h-=T-(y*N+T*W))):(De=A[6],Ve=A[7],D=A[8],se=A[9],he=A[10],He=A[11],u=A[12],h=A[13],f=A[14],v=gs(De,he),p=v*Vr,v&&(E=Math.cos(-v),C=Math.sin(-v),I=B*E+D*C,$=G*E+se*C,j=De*E+he*C,D=B*-C+D*E,se=G*-C+se*E,he=De*-C+he*E,He=Ve*-C+He*E,B=I,G=$,De=j),v=gs(-q,he),m=v*Vr,v&&(E=Math.cos(-v),C=Math.sin(-v),I=L*E-D*C,$=N*E-se*C,j=q*E-he*C,He=W*C+He*E,L=I,N=$,q=j),v=gs(N,L),_=v*Vr,v&&(E=Math.cos(v),C=Math.sin(v),I=L*E+N*C,$=B*E+G*C,N=N*E-L*C,G=G*E-B*C,L=I,B=$),p&&Math.abs(p)+Math.abs(_)>359.9&&(p=_=0,m=180-m),d=Ht(Math.sqrt(L*L+N*N+q*q)),g=Ht(Math.sqrt(G*G+De*De)),v=gs(B,G),b=Math.abs(v)>2e-4?v*Vr:0,M=He?1/(He<0?-He:He):0),n.svg&&(I=e.getAttribute("transform"),n.forceCSS=e.setAttribute("transform","")||!wp(ti(e,Ut)),I&&e.setAttribute("transform",I))),Math.abs(b)>90&&Math.abs(b)<270&&(s?(d*=-1,b+=_<=0?180:-180,_+=_<=0?180:-180):(g*=-1,b+=b<=0?180:-180)),t=t||n.uncache,n.x=u-((n.xPercent=u&&(!t&&n.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-u)?-50:0)))?e.offsetWidth*n.xPercent/100:0)+a,n.y=h-((n.yPercent=h&&(!t&&n.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-h)?-50:0)))?e.offsetHeight*n.yPercent/100:0)+a,n.z=f+a,n.scaleX=Ht(d),n.scaleY=Ht(g),n.rotation=Ht(_)+o,n.rotationX=Ht(p)+o,n.rotationY=Ht(m)+o,n.skewX=b+o,n.skewY=w+o,n.transformPerspective=M+a,(n.zOrigin=parseFloat(c.split(" ")[2])||!t&&n.zOrigin||0)&&(i[Gn]=hl(c)),n.xOffset=n.yOffset=0,n.force3D=ni.force3D,n.renderTransform=n.svg?M0:bp?Ap:v0,n.uncache=0,n},hl=function(e){return(e=e.split(" "))[0]+" "+e[1]},Vl=function(e,t,n){var i=Sn(t);return Ht(parseFloat(t)+parseFloat(Dr(e,"x",n+"px",i)))+i},v0=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,Ap(e,t)},Ur="0deg",ua="0px",Fr=") ",Ap=function(e,t){var n=t||this,i=n.xPercent,s=n.yPercent,a=n.x,o=n.y,l=n.z,c=n.rotation,u=n.rotationY,h=n.rotationX,f=n.skewX,d=n.skewY,g=n.scaleX,_=n.scaleY,p=n.transformPerspective,m=n.force3D,b=n.target,w=n.zOrigin,M="",y=m==="auto"&&e&&e!==1||m===!0;if(w&&(h!==Ur||u!==Ur)){var T=parseFloat(u)*Hs,A=Math.sin(T),v=Math.cos(T),E;T=parseFloat(h)*Hs,E=Math.cos(T),a=Vl(b,a,A*E*-w),o=Vl(b,o,-Math.sin(T)*-w),l=Vl(b,l,v*E*-w+w)}p!==ua&&(M+="perspective("+p+Fr),(i||s)&&(M+="translate("+i+"%, "+s+"%) "),(y||a!==ua||o!==ua||l!==ua)&&(M+=l!==ua||y?"translate3d("+a+", "+o+", "+l+") ":"translate("+a+", "+o+Fr),c!==Ur&&(M+="rotate("+c+Fr),u!==Ur&&(M+="rotateY("+u+Fr),h!==Ur&&(M+="rotateX("+h+Fr),(f!==Ur||d!==Ur)&&(M+="skew("+f+", "+d+Fr),(g!==1||_!==1)&&(M+="scale("+g+", "+_+Fr),b.style[Ut]=M||"translate(0, 0)"},M0=function(e,t){var n=t||this,i=n.xPercent,s=n.yPercent,a=n.x,o=n.y,l=n.rotation,c=n.skewX,u=n.skewY,h=n.scaleX,f=n.scaleY,d=n.target,g=n.xOrigin,_=n.yOrigin,p=n.xOffset,m=n.yOffset,b=n.forceCSS,w=parseFloat(a),M=parseFloat(o),y,T,A,v,E;l=parseFloat(l),c=parseFloat(c),u=parseFloat(u),u&&(u=parseFloat(u),c+=u,l+=u),l||c?(l*=Hs,c*=Hs,y=Math.cos(l)*h,T=Math.sin(l)*h,A=Math.sin(l-c)*-f,v=Math.cos(l-c)*f,c&&(u*=Hs,E=Math.tan(c-u),E=Math.sqrt(1+E*E),A*=E,v*=E,u&&(E=Math.tan(u),E=Math.sqrt(1+E*E),y*=E,T*=E)),y=Ht(y),T=Ht(T),A=Ht(A),v=Ht(v)):(y=h,v=f,T=A=0),(w&&!~(a+"").indexOf("px")||M&&!~(o+"").indexOf("px"))&&(w=Dr(d,"x",a,"px"),M=Dr(d,"y",o,"px")),(g||_||p||m)&&(w=Ht(w+g-(g*y+_*A)+p),M=Ht(M+_-(g*T+_*v)+m)),(i||s)&&(E=d.getBBox(),w=Ht(w+i/100*E.width),M=Ht(M+s/100*E.height)),E="matrix("+y+","+T+","+A+","+v+","+w+","+M+")",d.setAttribute("transform",E),b&&(d.style[Ut]=E)},S0=function(e,t,n,i,s){var a=360,o=un(s),l=parseFloat(s)*(o&&~s.indexOf("rad")?Vr:1),c=l-i,u=i+c+"deg",h,f;return o&&(h=s.split("_")[1],h==="short"&&(c%=a,c!==c%(a/2)&&(c+=c<0?a:-a)),h==="cw"&&c<0?c=(c+a*jf)%a-~~(c/a)*a:h==="ccw"&&c>0&&(c=(c-a*jf)%a-~~(c/a)*a)),e._pt=f=new zn(e._pt,t,n,i,c,i0),f.e=u,f.u="deg",e._props.push(n),f},rd=function(e,t){for(var n in t)e[n]=t[n];return e},b0=function(e,t,n){var i=rd({},n._gsap),s="perspective,force3D,transformOrigin,svgOrigin",a=n.style,o,l,c,u,h,f,d,g;i.svg?(c=n.getAttribute("transform"),n.setAttribute("transform",""),a[Ut]=t,o=Za(n,1),Pr(n,Ut),n.setAttribute("transform",c)):(c=getComputedStyle(n)[Ut],a[Ut]=t,o=Za(n,1),a[Ut]=c);for(l in rr)c=i[l],u=o[l],c!==u&&s.indexOf(l)<0&&(d=Sn(c),g=Sn(u),h=d!==g?Dr(n,l,c,g):parseFloat(c),f=parseFloat(u),e._pt=new zn(e._pt,o,l,h,f-h,Bc),e._pt.u=g||0,e._props.push(l));rd(o,i)};kn("padding,margin,Width,Radius",function(r,e){var t="Top",n="Right",i="Bottom",s="Left",a=(e<3?[t,n,i,s]:[t+s,t+n,i+n,i+s]).map(function(o){return e<2?r+o:"border"+o+r});dl[e>1?"border"+r:r]=function(o,l,c,u,h){var f,d;if(arguments.length<4)return f=a.map(function(g){return $i(o,g,c)}),d=f.join(" "),d.split(f[0]).length===5?f[0]:d;f=(u+"").split(" "),d={},a.forEach(function(g,_){return d[g]=f[_]=f[_]||f[(_-1)/2|0]}),o.init(l,d,h)}});var Rp={name:"css",register:zc,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,n,i,s){var a=this._props,o=e.style,l=n.vars.startAt,c,u,h,f,d,g,_,p,m,b,w,M,y,T,A,v,E;sf||zc(),this.styles=this.styles||Sp(e),v=this.styles.props,this.tween=n;for(_ in t)if(_!=="autoRound"&&(u=t[_],!(Kn[_]&&up(_,t,n,i,e,s)))){if(d=typeof u,g=dl[_],d==="function"&&(u=u.call(n,i,e,s),d=typeof u),d==="string"&&~u.indexOf("random(")&&(u=Xa(u)),g)g(this,e,_,u,n)&&(A=1);else if(_.substr(0,2)==="--")c=(getComputedStyle(e).getPropertyValue(_)+"").trim(),u+="",Ar.lastIndex=0,Ar.test(c)||(p=Sn(c),m=Sn(u),m?p!==m&&(c=Dr(e,_,c,m)+m):p&&(u+=p)),this.add(o,"setProperty",c,u,i,s,0,0,_),a.push(_),v.push(_,0,o[_]);else if(d!=="undefined"){if(l&&_ in l?(c=typeof l[_]=="function"?l[_].call(n,i,e,s):l[_],un(c)&&~c.indexOf("random(")&&(c=Xa(c)),Sn(c+"")||c==="auto"||(c+=ni.units[_]||Sn($i(e,_))||""),(c+"").charAt(1)==="="&&(c=$i(e,_))):c=$i(e,_),f=parseFloat(c),b=d==="string"&&u.charAt(1)==="="&&u.substr(0,2),b&&(u=u.substr(2)),h=parseFloat(u),_ in Ni&&(_==="autoAlpha"&&(f===1&&$i(e,"visibility")==="hidden"&&h&&(f=0),v.push("visibility",0,o.visibility),Sr(this,o,"visibility",f?"inherit":"hidden",h?"inherit":"hidden",!h)),_!=="scale"&&_!=="transform"&&(_=Ni[_],~_.indexOf(",")&&(_=_.split(",")[0]))),w=_ in rr,w){if(this.styles.save(_),E=u,d==="string"&&u.substring(0,6)==="var(--"){if(u=ti(e,u.substring(4,u.indexOf(")"))),u.substring(0,5)==="calc("){var C=e.style.perspective;e.style.perspective=u,u=ti(e,"perspective"),C?e.style.perspective=C:Pr(e,"perspective")}h=parseFloat(u)}if(M||(y=e._gsap,y.renderTransform&&!t.parseTransform||Za(e,t.parseTransform),T=t.smoothOrigin!==!1&&y.smooth,M=this._pt=new zn(this._pt,o,Ut,0,1,y.renderTransform,y,0,-1),M.dep=1),_==="scale")this._pt=new zn(this._pt,y,"scaleY",y.scaleY,(b?Gs(y.scaleY,b+h):h)-y.scaleY||0,Bc),this._pt.u=0,a.push("scaleY",_),_+="X";else if(_==="transformOrigin"){v.push(Gn,0,o[Gn]),u=_0(u),y.svg?Gc(e,u,0,T,0,this):(m=parseFloat(u.split(" ")[2])||0,m!==y.zOrigin&&Sr(this,y,"zOrigin",y.zOrigin,m),Sr(this,o,_,hl(c),hl(u)));continue}else if(_==="svgOrigin"){Gc(e,u,1,T,0,this);continue}else if(_ in Tp){S0(this,y,_,f,b?Gs(f,b+u):u);continue}else if(_==="smoothOrigin"){Sr(this,y,"smooth",y.smooth,u);continue}else if(_==="force3D"){y[_]=u;continue}else if(_==="transform"){b0(this,u,e);continue}}else _ in o||(_=ta(_)||_);if(w||(h||h===0)&&(f||f===0)&&!n0.test(u)&&_ in o)p=(c+"").substr((f+"").length),h||(h=0),m=Sn(u)||(_ in ni.units?ni.units[_]:p),p!==m&&(f=Dr(e,_,c,m)),this._pt=new zn(this._pt,w?y:o,_,f,(b?Gs(f,b+h):h)-f,!w&&(m==="px"||_==="zIndex")&&t.autoRound!==!1?a0:Bc),this._pt.u=m||0,w&&E!==u?(this._pt.b=c,this._pt.e=E,this._pt.r=s0):p!==m&&m!=="%"&&(this._pt.b=c,this._pt.r=r0);else if(_ in o)g0.call(this,e,_,c,b?b+u:u);else if(_ in e)this.add(e,_,c||e[_],b?b+u:u,i,s);else if(_!=="parseTransform"){$u(_,u);continue}w||(_ in o?v.push(_,0,o[_]):typeof e[_]=="function"?v.push(_,2,e[_]()):v.push(_,1,c||e[_])),a.push(_)}}A&&gp(this)},render:function(e,t){if(t.tween._time||!af())for(var n=t._pt;n;)n.r(e,n.d),n=n._next;else t.styles.revert()},get:$i,aliases:Ni,getSetter:function(e,t,n){var i=Ni[t];return i&&i.indexOf(",")<0&&(t=i),t in rr&&t!==Gn&&(e._gsap.x||$i(e,"x"))?n&&Kf===n?t==="scale"?u0:c0:(Kf=n||{})&&(t==="scale"?f0:d0):e.style&&!Xu(e.style[t])?o0:~t.indexOf("-")?l0:nf(e,t)},core:{_removeProperty:Pr,_getMatrix:lf}};Wn.utils.checkPrefix=ta;Wn.core.getStyleSaver=Sp;(function(r,e,t,n){var i=kn(r+","+e+","+t,function(s){rr[s]=1});kn(e,function(s){ni.units[s]="deg",Tp[s]=1}),Ni[i[13]]=r+","+e,kn(n,function(s){var a=s.split(":");Ni[a[1]]=i[a[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");kn("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){ni.units[r]="px"});Wn.registerPlugin(Rp);var Pt=Wn.registerPlugin(Rp)||Wn;Pt.core.Tween;function y0(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function E0(r,e,t){return e&&y0(r.prototype,e),r}var fn,Zo,Qn,br,yr,Ws,Cp,Hr,Xs,Pp,ji,Mi,Dp,Lp=function(){return fn||typeof window<"u"&&(fn=window.gsap)&&fn.registerPlugin&&fn},Np=1,zs=[],st=[],Oi=[],Da=Date.now,Vc=function(e,t){return t},T0=function(){var e=Xs.core,t=e.bridge||{},n=e._scrollers,i=e._proxies;n.push.apply(n,st),i.push.apply(i,Oi),st=n,Oi=i,Vc=function(a,o){return t[a](o)}},Rr=function(e,t){return~Oi.indexOf(e)&&Oi[Oi.indexOf(e)+1][t]},La=function(e){return!!~Pp.indexOf(e)},Rn=function(e,t,n,i,s){return e.addEventListener(t,n,{passive:i!==!1,capture:!!s})},An=function(e,t,n,i){return e.removeEventListener(t,n,!!i)},ao="scrollLeft",oo="scrollTop",Hc=function(){return ji&&ji.isPressed||st.cache++},pl=function(e,t){var n=function i(s){if(s||s===0){Np&&(Qn.history.scrollRestoration="manual");var a=ji&&ji.isPressed;s=i.v=Math.round(s)||(ji&&ji.iOS?1:0),e(s),i.cacheID=st.cache,a&&Vc("ss",s)}else(t||st.cache!==i.cacheID||Vc("ref"))&&(i.cacheID=st.cache,i.v=e());return i.v+i.offset};return n.offset=0,e&&n},In={s:ao,p:"left",p2:"Left",os:"right",os2:"Right",d:"width",d2:"Width",a:"x",sc:pl(function(r){return arguments.length?Qn.scrollTo(r,en.sc()):Qn.pageXOffset||br[ao]||yr[ao]||Ws[ao]||0})},en={s:oo,p:"top",p2:"Top",os:"bottom",os2:"Bottom",d:"height",d2:"Height",a:"y",op:In,sc:pl(function(r){return arguments.length?Qn.scrollTo(In.sc(),r):Qn.pageYOffset||br[oo]||yr[oo]||Ws[oo]||0})},Fn=function(e,t){return(t&&t._ctx&&t._ctx.selector||fn.utils.toArray)(e)[0]||(typeof e=="string"&&fn.config().nullTargetWarn!==!1?console.warn("Element not found:",e):null)},w0=function(e,t){for(var n=t.length;n--;)if(t[n]===e||t[n].contains(e))return!0;return!1},Lr=function(e,t){var n=t.s,i=t.sc;La(e)&&(e=br.scrollingElement||yr);var s=st.indexOf(e),a=i===en.sc?1:2;!~s&&(s=st.push(e)-1),st[s+a]||Rn(e,"scroll",Hc);var o=st[s+a],l=o||(st[s+a]=pl(Rr(e,n),!0)||(La(e)?i:pl(function(c){return arguments.length?e[n]=c:e[n]})));return l.target=e,o||(l.smooth=fn.getProperty(e,"scrollBehavior")==="smooth"),l},Wc=function(e,t,n){var i=e,s=e,a=Da(),o=a,l=t||50,c=Math.max(500,l*3),u=function(g,_){var p=Da();_||p-a>l?(s=i,i=g,o=a,a=p):n?i+=g:i=s+(g-s)/(p-o)*(a-o)},h=function(){s=i=n?0:i,o=a=0},f=function(g){var _=o,p=s,m=Da();return(g||g===0)&&g!==i&&u(g),a===o||m-o>c?0:(i+(n?p:-p))/((n?m:a)-_)*1e3};return{update:u,reset:h,getVelocity:f}},fa=function(e,t){return t&&!e._gsapAllow&&e.cancelable!==!1&&e.preventDefault(),e.changedTouches?e.changedTouches[0]:e},sd=function(e){var t=Math.max.apply(Math,e),n=Math.min.apply(Math,e);return Math.abs(t)>=Math.abs(n)?t:n},Ip=function(){Xs=fn.core.globals().ScrollTrigger,Xs&&Xs.core&&T0()},Up=function(e){return fn=e||Lp(),!Zo&&fn&&typeof document<"u"&&document.body&&(Qn=window,br=document,yr=br.documentElement,Ws=br.body,Pp=[Qn,br,yr,Ws],fn.utils.clamp,Dp=fn.core.context||function(){},Hr="onpointerenter"in Ws?"pointer":"mouse",Cp=Wt.isTouch=Qn.matchMedia&&Qn.matchMedia("(hover: none), (pointer: coarse)").matches?1:"ontouchstart"in Qn||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,Mi=Wt.eventTypes=("ontouchstart"in yr?"touchstart,touchmove,touchcancel,touchend":"onpointerdown"in yr?"pointerdown,pointermove,pointercancel,pointerup":"mousedown,mousemove,mouseup,mouseup").split(","),setTimeout(function(){return Np=0},500),Zo=1),Xs||Ip(),Zo};In.op=en;st.cache=0;var Wt=(function(){function r(t){this.init(t)}var e=r.prototype;return e.init=function(n){Zo||Up(fn)||console.warn("Please gsap.registerPlugin(Observer)"),Xs||Ip();var i=n.tolerance,s=n.dragMinimum,a=n.type,o=n.target,l=n.lineHeight,c=n.debounce,u=n.preventDefault,h=n.onStop,f=n.onStopDelay,d=n.ignore,g=n.wheelSpeed,_=n.event,p=n.onDragStart,m=n.onDragEnd,b=n.onDrag,w=n.onPress,M=n.onRelease,y=n.onRight,T=n.onLeft,A=n.onUp,v=n.onDown,E=n.onChangeX,C=n.onChangeY,L=n.onChange,N=n.onToggleX,q=n.onToggleY,W=n.onHover,B=n.onHoverEnd,G=n.onMove,I=n.ignoreCheck,$=n.isNormalizer,j=n.onGestureStart,D=n.onGestureEnd,se=n.onWheel,he=n.onEnable,Ve=n.onDisable,He=n.onClick,De=n.scrollSpeed,J=n.capture,ae=n.allowClicks,re=n.lockAxis,Re=n.onLockAxis;this.target=o=Fn(o)||yr,this.vars=n,d&&(d=fn.utils.toArray(d)),i=i||1e-9,s=s||0,g=g||1,De=De||1,a=a||"wheel,touch,pointer",c=c!==!1,l||(l=parseFloat(Qn.getComputedStyle(Ws).lineHeight)||22);var Ie,Ee,Qe,ye,Ge,Xe,Te,V=this,Je=0,$e=0,pt=n.passive||!u&&n.passive!==!1,qe=Lr(o,In),mt=Lr(o,en),F=qe(),Dt=mt(),We=~a.indexOf("touch")&&!~a.indexOf("pointer")&&Mi[0]==="pointerdown",R=La(o),x=o.ownerDocument||br,O=[0,0,0],z=[0,0,0],K=0,ue=function(){return K=Da()},oe=function(ie,ke){return(V.event=ie)&&d&&w0(ie.target,d)||ke&&We&&ie.pointerType!=="touch"||I&&I(ie,ke)},Q=function(){V._vx.reset(),V._vy.reset(),Ee.pause(),h&&h(V)},ee=function(){var ie=V.deltaX=sd(O),ke=V.deltaY=sd(z),ce=Math.abs(ie)>=i,ze=Math.abs(ke)>=i;L&&(ce||ze)&&L(V,ie,ke,O,z),ce&&(y&&V.deltaX>0&&y(V),T&&V.deltaX<0&&T(V),E&&E(V),N&&V.deltaX<0!=Je<0&&N(V),Je=V.deltaX,O[0]=O[1]=O[2]=0),ze&&(v&&V.deltaY>0&&v(V),A&&V.deltaY<0&&A(V),C&&C(V),q&&V.deltaY<0!=$e<0&&q(V),$e=V.deltaY,z[0]=z[1]=z[2]=0),(ye||Qe)&&(G&&G(V),Qe&&(p&&Qe===1&&p(V),b&&b(V),Qe=0),ye=!1),Xe&&!(Xe=!1)&&Re&&Re(V),Ge&&(se(V),Ge=!1),Ie=0},pe=function(ie,ke,ce){O[ce]+=ie,z[ce]+=ke,V._vx.update(ie),V._vy.update(ke),c?Ie||(Ie=requestAnimationFrame(ee)):ee()},Ae=function(ie,ke){re&&!Te&&(V.axis=Te=Math.abs(ie)>Math.abs(ke)?"x":"y",Xe=!0),Te!=="y"&&(O[2]+=ie,V._vx.update(ie,!0)),Te!=="x"&&(z[2]+=ke,V._vy.update(ke,!0)),c?Ie||(Ie=requestAnimationFrame(ee)):ee()},ge=function(ie){if(!oe(ie,1)){ie=fa(ie,u);var ke=ie.clientX,ce=ie.clientY,ze=ke-V.x,Pe=ce-V.y,Ze=V.isDragging;V.x=ke,V.y=ce,(Ze||(ze||Pe)&&(Math.abs(V.startX-ke)>=s||Math.abs(V.startY-ce)>=s))&&(Qe||(Qe=Ze?2:1),Ze||(V.isDragging=!0),Ae(ze,Pe))}},me=V.onPress=function(le){oe(le,1)||le&&le.button||(V.axis=Te=null,Ee.pause(),V.isPressed=!0,le=fa(le),Je=$e=0,V.startX=V.x=le.clientX,V.startY=V.y=le.clientY,V._vx.reset(),V._vy.reset(),Rn($?o:x,Mi[1],ge,pt,!0),V.deltaX=V.deltaY=0,w&&w(V))},fe=V.onRelease=function(le){if(!oe(le,1)){An($?o:x,Mi[1],ge,!0);var ie=!isNaN(V.y-V.startY),ke=V.isDragging,ce=ke&&(Math.abs(V.x-V.startX)>3||Math.abs(V.y-V.startY)>3),ze=fa(le);!ce&&ie&&(V._vx.reset(),V._vy.reset(),u&&ae&&fn.delayedCall(.08,function(){if(Da()-K>300&&!le.defaultPrevented){if(le.target.click)le.target.click();else if(x.createEvent){var Pe=x.createEvent("MouseEvents");Pe.initMouseEvent("click",!0,!0,Qn,1,ze.screenX,ze.screenY,ze.clientX,ze.clientY,!1,!1,!1,!1,0,null),le.target.dispatchEvent(Pe)}}})),V.isDragging=V.isGesturing=V.isPressed=!1,h&&ke&&!$&&Ee.restart(!0),Qe&&ee(),m&&ke&&m(V),M&&M(V,ce)}},Le=function(ie){return ie.touches&&ie.touches.length>1&&(V.isGesturing=!0)&&j(ie,V.isDragging)},Be=function(){return(V.isGesturing=!1)||D(V)},U=function(ie){if(!oe(ie)){var ke=qe(),ce=mt();pe((ke-F)*De,(ce-Dt)*De,1),F=ke,Dt=ce,h&&Ee.restart(!0)}},de=function(ie){if(!oe(ie)){ie=fa(ie,u),se&&(Ge=!0);var ke=(ie.deltaMode===1?l:ie.deltaMode===2?Qn.innerHeight:1)*g;pe(ie.deltaX*ke,ie.deltaY*ke,0),h&&!$&&Ee.restart(!0)}},te=function(ie){if(!oe(ie)){var ke=ie.clientX,ce=ie.clientY,ze=ke-V.x,Pe=ce-V.y;V.x=ke,V.y=ce,ye=!0,h&&Ee.restart(!0),(ze||Pe)&&Ae(ze,Pe)}},_e=function(ie){V.event=ie,W(V)},xe=function(ie){V.event=ie,B(V)},ne=function(ie){return oe(ie)||fa(ie,u)&&He(V)};Ee=V._dc=fn.delayedCall(f||.25,Q).pause(),V.deltaX=V.deltaY=0,V._vx=Wc(0,50,!0),V._vy=Wc(0,50,!0),V.scrollX=qe,V.scrollY=mt,V.isDragging=V.isGesturing=V.isPressed=!1,Dp(this),V.enable=function(le){return V.isEnabled||(Rn(R?x:o,"scroll",Hc),a.indexOf("scroll")>=0&&Rn(R?x:o,"scroll",U,pt,J),a.indexOf("wheel")>=0&&Rn(o,"wheel",de,pt,J),(a.indexOf("touch")>=0&&Cp||a.indexOf("pointer")>=0)&&(Rn(o,Mi[0],me,pt,J),Rn(x,Mi[2],fe),Rn(x,Mi[3],fe),ae&&Rn(o,"click",ue,!0,!0),He&&Rn(o,"click",ne),j&&Rn(x,"gesturestart",Le),D&&Rn(x,"gestureend",Be),W&&Rn(o,Hr+"enter",_e),B&&Rn(o,Hr+"leave",xe),G&&Rn(o,Hr+"move",te)),V.isEnabled=!0,V.isDragging=V.isGesturing=V.isPressed=ye=Qe=!1,V._vx.reset(),V._vy.reset(),F=qe(),Dt=mt(),le&&le.type&&me(le),he&&he(V)),V},V.disable=function(){V.isEnabled&&(zs.filter(function(le){return le!==V&&La(le.target)}).length||An(R?x:o,"scroll",Hc),V.isPressed&&(V._vx.reset(),V._vy.reset(),An($?o:x,Mi[1],ge,!0)),An(R?x:o,"scroll",U,J),An(o,"wheel",de,J),An(o,Mi[0],me,J),An(x,Mi[2],fe),An(x,Mi[3],fe),An(o,"click",ue,!0),An(o,"click",ne),An(x,"gesturestart",Le),An(x,"gestureend",Be),An(o,Hr+"enter",_e),An(o,Hr+"leave",xe),An(o,Hr+"move",te),V.isEnabled=V.isPressed=V.isDragging=!1,Ve&&Ve(V))},V.kill=V.revert=function(){V.disable();var le=zs.indexOf(V);le>=0&&zs.splice(le,1),ji===V&&(ji=0)},zs.push(V),$&&La(o)&&(ji=V),V.enable(_)},E0(r,[{key:"velocityX",get:function(){return this._vx.getVelocity()}},{key:"velocityY",get:function(){return this._vy.getVelocity()}}]),r})();Wt.version="3.15.0";Wt.create=function(r){return new Wt(r)};Wt.register=Up;Wt.getAll=function(){return zs.slice()};Wt.getById=function(r){return zs.filter(function(e){return e.vars.id===r})[0]};Lp()&&fn.registerPlugin(Wt);var Ce,Us,rt,xt,jn,_t,cf,ml,Ka,Na,Sa,lo,xn,Rl,Xc,Ln,ad,od,Fs,Fp,Hl,Op,Dn,Yc,Bp,kp,_r,qc,uf,Ys,ff,Ia,$c,Wl,co=1,vn=Date.now,Xl=vn(),gi=0,ba=0,ld=function(e,t,n){var i=Zn(e)&&(e.substr(0,6)==="clamp("||e.indexOf("max")>-1);return n["_"+t+"Clamp"]=i,i?e.substr(6,e.length-7):e},cd=function(e,t){return t&&(!Zn(e)||e.substr(0,6)!=="clamp(")?"clamp("+e+")":e},A0=function r(){return ba&&requestAnimationFrame(r)},ud=function(){return Rl=1},fd=function(){return Rl=0},Pi=function(e){return e},ya=function(e){return Math.round(e*1e5)/1e5||0},zp=function(){return typeof window<"u"},Gp=function(){return Ce||zp()&&(Ce=window.gsap)&&Ce.registerPlugin&&Ce},ss=function(e){return!!~cf.indexOf(e)},Vp=function(e){return(e==="Height"?ff:rt["inner"+e])||jn["client"+e]||_t["client"+e]},Hp=function(e){return Rr(e,"getBoundingClientRect")||(ss(e)?function(){return el.width=rt.innerWidth,el.height=ff,el}:function(){return Zi(e)})},R0=function(e,t,n){var i=n.d,s=n.d2,a=n.a;return(a=Rr(e,"getBoundingClientRect"))?function(){return a()[i]}:function(){return(t?Vp(s):e["client"+s])||0}},C0=function(e,t){return!t||~Oi.indexOf(e)?Hp(e):function(){return el}},Ii=function(e,t){var n=t.s,i=t.d2,s=t.d,a=t.a;return Math.max(0,(n="scroll"+i)&&(a=Rr(e,n))?a()-Hp(e)()[s]:ss(e)?(jn[n]||_t[n])-Vp(i):e[n]-e["offset"+i])},uo=function(e,t){for(var n=0;n<Fs.length;n+=3)(!t||~t.indexOf(Fs[n+1]))&&e(Fs[n],Fs[n+1],Fs[n+2])},Zn=function(e){return typeof e=="string"},bn=function(e){return typeof e=="function"},Ea=function(e){return typeof e=="number"},Wr=function(e){return typeof e=="object"},da=function(e,t,n){return e&&e.progress(t?0:1)&&n&&e.pause()},_s=function(e,t,n){if(e.enabled){var i=e._ctx?e._ctx.add(function(){return t(e,n)}):t(e,n);i&&i.totalTime&&(e.callbackAnimation=i)}},xs=Math.abs,Wp="left",Xp="top",df="right",hf="bottom",ns="width",is="height",Ua="Right",Fa="Left",Oa="Top",Ba="Bottom",Zt="padding",ui="margin",na="Width",pf="Height",Jt="px",fi=function(e){return rt.getComputedStyle(e.nodeType===Node.DOCUMENT_NODE?e.scrollingElement:e)},P0=function(e){var t=fi(e).position;e.style.position=t==="absolute"||t==="fixed"?t:"relative"},dd=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},Zi=function(e,t){var n=t&&fi(e)[Xc]!=="matrix(1, 0, 0, 1, 0, 0)"&&Ce.to(e,{x:0,y:0,xPercent:0,yPercent:0,rotation:0,rotationX:0,rotationY:0,scale:1,skewX:0,skewY:0}).progress(1),i=e.getBoundingClientRect?e.getBoundingClientRect():e.scrollingElement.getBoundingClientRect();return n&&n.progress(0).kill(),i},gl=function(e,t){var n=t.d2;return e["offset"+n]||e["client"+n]||0},Yp=function(e){var t=[],n=e.labels,i=e.duration(),s;for(s in n)t.push(n[s]/i);return t},D0=function(e){return function(t){return Ce.utils.snap(Yp(e),t)}},mf=function(e){var t=Ce.utils.snap(e),n=Array.isArray(e)&&e.slice(0).sort(function(i,s){return i-s});return n?function(i,s,a){a===void 0&&(a=.001);var o;if(!s)return t(i);if(s>0){for(i-=a,o=0;o<n.length;o++)if(n[o]>=i)return n[o];return n[o-1]}else for(o=n.length,i+=a;o--;)if(n[o]<=i)return n[o];return n[0]}:function(i,s,a){a===void 0&&(a=.001);var o=t(i);return!s||Math.abs(o-i)<a||o-i<0==s<0?o:t(s<0?i-e:i+e)}},L0=function(e){return function(t,n){return mf(Yp(e))(t,n.direction)}},fo=function(e,t,n,i){return n.split(",").forEach(function(s){return e(t,s,i)})},cn=function(e,t,n,i,s){return e.addEventListener(t,n,{passive:!i,capture:!!s})},on=function(e,t,n,i){return e.removeEventListener(t,n,!!i)},ho=function(e,t,n){n=n&&n.wheelHandler,n&&(e(t,"wheel",n),e(t,"touchmove",n))},hd={startColor:"green",endColor:"red",indent:0,fontSize:"16px",fontWeight:"normal"},po={toggleActions:"play",anticipatePin:0},_l={top:0,left:0,center:.5,bottom:1,right:1},Ko=function(e,t){if(Zn(e)){var n=e.indexOf("="),i=~n?+(e.charAt(n-1)+1)*parseFloat(e.substr(n+1)):0;~n&&(e.indexOf("%")>n&&(i*=t/100),e=e.substr(0,n-1)),e=i+(e in _l?_l[e]*t:~e.indexOf("%")?parseFloat(e)*t/100:parseFloat(e)||0)}return e},mo=function(e,t,n,i,s,a,o,l){var c=s.startColor,u=s.endColor,h=s.fontSize,f=s.indent,d=s.fontWeight,g=xt.createElement("div"),_=ss(n)||Rr(n,"pinType")==="fixed",p=e.indexOf("scroller")!==-1,m=_?_t:n.tagName==="IFRAME"?n.contentDocument.body:n,b=e.indexOf("start")!==-1,w=b?c:u,M="border-color:"+w+";font-size:"+h+";color:"+w+";font-weight:"+d+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return M+="position:"+((p||l)&&_?"fixed;":"absolute;"),(p||l||!_)&&(M+=(i===en?df:hf)+":"+(a+parseFloat(f))+"px;"),o&&(M+="box-sizing:border-box;text-align:left;width:"+o.offsetWidth+"px;"),g._isStart=b,g.setAttribute("class","gsap-marker-"+e+(t?" marker-"+t:"")),g.style.cssText=M,g.innerText=t||t===0?e+"-"+t:e,m.children[0]?m.insertBefore(g,m.children[0]):m.appendChild(g),g._offset=g["offset"+i.op.d2],jo(g,0,i,b),g},jo=function(e,t,n,i){var s={display:"block"},a=n[i?"os2":"p2"],o=n[i?"p2":"os2"];e._isFlipped=i,s[n.a+"Percent"]=i?-100:0,s[n.a]=i?"1px":0,s["border"+a+na]=1,s["border"+o+na]=0,s[n.p]=t+"px",Ce.set(e,s)},nt=[],Zc={},ja,pd=function(){return vn()-gi>34&&(ja||(ja=requestAnimationFrame(Qi)))},vs=function(){(!Dn||!Dn.isPressed||Dn.startX>_t.clientWidth)&&(st.cache++,Dn?ja||(ja=requestAnimationFrame(Qi)):Qi(),gi||os("scrollStart"),gi=vn())},Yl=function(){kp=rt.innerWidth,Bp=rt.innerHeight},Ta=function(e){st.cache++,(e===!0||!xn&&!Op&&!xt.fullscreenElement&&!xt.webkitFullscreenElement&&(!Yc||kp!==rt.innerWidth||Math.abs(rt.innerHeight-Bp)>rt.innerHeight*.25))&&ml.restart(!0)},as={},N0=[],qp=function r(){return on(at,"scrollEnd",r)||Zr(!0)},os=function(e){return as[e]&&as[e].map(function(t){return t()})||N0},$n=[],$p=function(e){for(var t=0;t<$n.length;t+=5)(!e||$n[t+4]&&$n[t+4].query===e)&&($n[t].style.cssText=$n[t+1],$n[t].getBBox&&$n[t].setAttribute("transform",$n[t+2]||""),$n[t+3].uncache=1)},Zp=function(){return st.forEach(function(e){return bn(e)&&++e.cacheID&&(e.rec=e())})},gf=function(e,t){var n;for(Ln=0;Ln<nt.length;Ln++)n=nt[Ln],n&&(!t||n._ctx===t)&&(e?n.kill(1):n.revert(!0,!0));Ia=!0,t&&$p(t),t||os("revert")},Kp=function(e,t){st.cache++,(t||!Nn)&&st.forEach(function(n){return bn(n)&&n.cacheID++&&(n.rec=0)}),Zn(e)&&(rt.history.scrollRestoration=uf=e)},Nn,rs=0,md,I0=function(){if(md!==rs){var e=md=rs;requestAnimationFrame(function(){return e===rs&&Zr(!0)})}},jp=function(){_t.appendChild(Ys),ff=!Dn&&Ys.offsetHeight||rt.innerHeight,_t.removeChild(Ys)},gd=function(e){return Ka(".gsap-marker-start, .gsap-marker-end, .gsap-marker-scroller-start, .gsap-marker-scroller-end").forEach(function(t){return t.style.display=e?"none":"block"})},Zr=function(e,t){if(jn=xt.documentElement,_t=xt.body,cf=[rt,xt,jn,_t],gi&&!e&&!Ia){cn(at,"scrollEnd",qp);return}jp(),Nn=at.isRefreshing=!0,Ia||Zp();var n=os("refreshInit");Fp&&at.sort(),t||gf(),st.forEach(function(i){bn(i)&&(i.smooth&&(i.target.style.scrollBehavior="auto"),i(0))}),nt.slice(0).forEach(function(i){return i.refresh()}),Ia=!1,nt.forEach(function(i){if(i._subPinOffset&&i.pin){var s=i.vars.horizontal?"offsetWidth":"offsetHeight",a=i.pin[s];i.revert(!0,1),i.adjustPinSpacing(i.pin[s]-a),i.refresh()}}),$c=1,gd(!0),nt.forEach(function(i){var s=Ii(i.scroller,i._dir),a=i.vars.end==="max"||i._endClamp&&i.end>s,o=i._startClamp&&i.start>=s;(a||o)&&i.setPositions(o?s-1:i.start,a?Math.max(o?s:i.start+1,s):i.end,!0)}),gd(!1),$c=0,n.forEach(function(i){return i&&i.render&&i.render(-1)}),st.forEach(function(i){bn(i)&&(i.smooth&&requestAnimationFrame(function(){return i.target.style.scrollBehavior="smooth"}),i.rec&&i(i.rec))}),Kp(uf,1),ml.pause(),rs++,Nn=2,Qi(2),nt.forEach(function(i){return bn(i.vars.onRefresh)&&i.vars.onRefresh(i)}),Nn=at.isRefreshing=!1,os("refresh")},Kc=0,Jo=1,ka,Qi=function(e){if(e===2||!Nn&&!Ia){at.isUpdating=!0,ka&&ka.update(0);var t=nt.length,n=vn(),i=n-Xl>=50,s=t&&nt[0].scroll();if(Jo=Kc>s?-1:1,Nn||(Kc=s),i&&(gi&&!Rl&&n-gi>200&&(gi=0,os("scrollEnd")),Sa=Xl,Xl=n),Jo<0){for(Ln=t;Ln-- >0;)nt[Ln]&&nt[Ln].update(0,i);Jo=1}else for(Ln=0;Ln<t;Ln++)nt[Ln]&&nt[Ln].update(0,i);at.isUpdating=!1}ja=0},jc=[Wp,Xp,hf,df,ui+Ba,ui+Ua,ui+Oa,ui+Fa,"display","flexShrink","float","zIndex","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","justifySelf","alignSelf","placeSelf","order"],Qo=jc.concat([ns,is,"boxSizing","max"+na,"max"+pf,"position",ui,Zt,Zt+Oa,Zt+Ua,Zt+Ba,Zt+Fa]),U0=function(e,t,n){qs(n);var i=e._gsap;if(i.spacerIsNative)qs(i.spacerState);else if(e._gsap.swappedIn){var s=t.parentNode;s&&(s.insertBefore(e,t),s.removeChild(t))}e._gsap.swappedIn=!1},ql=function(e,t,n,i){if(!e._gsap.swappedIn){for(var s=jc.length,a=t.style,o=e.style,l;s--;)l=jc[s],a[l]=n[l];a.position=n.position==="absolute"?"absolute":"relative",n.display==="inline"&&(a.display="inline-block"),o[hf]=o[df]="auto",a.flexBasis=n.flexBasis||"auto",a.overflow="visible",a.boxSizing="border-box",a[ns]=gl(e,In)+Jt,a[is]=gl(e,en)+Jt,a[Zt]=o[ui]=o[Xp]=o[Wp]="0",qs(i),o[ns]=o["max"+na]=n[ns],o[is]=o["max"+pf]=n[is],o[Zt]=n[Zt],e.parentNode!==t&&(e.parentNode.insertBefore(t,e),t.appendChild(e)),e._gsap.swappedIn=!0}},F0=/([A-Z])/g,qs=function(e){if(e){var t=e.t.style,n=e.length,i=0,s,a;for((e.t._gsap||Ce.core.getCache(e.t)).uncache=1;i<n;i+=2)a=e[i+1],s=e[i],a?t[s]=a:t[s]&&t.removeProperty(s.replace(F0,"-$1").toLowerCase())}},go=function(e){for(var t=Qo.length,n=e.style,i=[],s=0;s<t;s++)i.push(Qo[s],n[Qo[s]]);return i.t=e,i},O0=function(e,t,n){for(var i=[],s=e.length,a=n?8:0,o;a<s;a+=2)o=e[a],i.push(o,o in t?t[o]:e[a+1]);return i.t=e.t,i},el={left:0,top:0},_d=function(e,t,n,i,s,a,o,l,c,u,h,f,d,g){bn(e)&&(e=e(l)),Zn(e)&&e.substr(0,3)==="max"&&(e=f+(e.charAt(4)==="="?Ko("0"+e.substr(3),n):0));var _=d?d.time():0,p,m,b;if(d&&d.seek(0),isNaN(e)||(e=+e),Ea(e))d&&(e=Ce.utils.mapRange(d.scrollTrigger.start,d.scrollTrigger.end,0,f,e)),o&&jo(o,n,i,!0);else{bn(t)&&(t=t(l));var w=(e||"0").split(" "),M,y,T,A;b=Fn(t,l)||_t,M=Zi(b)||{},(!M||!M.left&&!M.top)&&fi(b).display==="none"&&(A=b.style.display,b.style.display="block",M=Zi(b),A?b.style.display=A:b.style.removeProperty("display")),y=Ko(w[0],M[i.d]),T=Ko(w[1]||"0",n),e=M[i.p]-c[i.p]-u+y+s-T,o&&jo(o,T,i,n-T<20||o._isStart&&T>20),n-=n-T}if(g&&(l[g]=e||-.001,e<0&&(e=0)),a){var v=e+n,E=a._isStart;p="scroll"+i.d2,jo(a,v,i,E&&v>20||!E&&(h?Math.max(_t[p],jn[p]):a.parentNode[p])<=v+1),h&&(c=Zi(o),h&&(a.style[i.op.p]=c[i.op.p]-i.op.m-a._offset+Jt))}return d&&b&&(p=Zi(b),d.seek(f),m=Zi(b),d._caScrollDist=p[i.p]-m[i.p],e=e/d._caScrollDist*f),d&&d.seek(_),d?e:Math.round(e)},B0=/(webkit|moz|length|cssText|inset)/i,xd=function(e,t,n,i){if(e.parentNode!==t){var s=e.style,a,o;if(t===_t){e._stOrig=s.cssText,o=fi(e);for(a in o)!+a&&!B0.test(a)&&o[a]&&typeof s[a]=="string"&&a!=="0"&&(s[a]=o[a]);s.top=n,s.left=i}else s.cssText=e._stOrig;Ce.core.getCache(e).uncache=1,t.appendChild(e)}},Jp=function(e,t,n){var i=t,s=i;return function(a){var o=Math.round(e());return o!==i&&o!==s&&Math.abs(o-i)>3&&Math.abs(o-s)>3&&(a=o,n&&n()),s=i,i=Math.round(a),i}},_o=function(e,t,n){var i={};i[t.p]="+="+n,Ce.set(e,i)},vd=function(e,t){var n=Lr(e,t),i="_scroll"+t.p2,s=function a(o,l,c,u,h){var f=a.tween,d=l.onComplete,g={};c=c||n();var _=Jp(n,c,function(){f.kill(),a.tween=0});return h=u&&h||0,u=u||o-c,f&&f.kill(),l[i]=o,l.inherit=!1,l.modifiers=g,g[i]=function(){return _(c+u*f.ratio+h*f.ratio*f.ratio)},l.onUpdate=function(){st.cache++,a.tween&&Qi()},l.onComplete=function(){a.tween=0,d&&d.call(f)},f=a.tween=Ce.to(e,l),f};return e[i]=n,n.wheelHandler=function(){return s.tween&&s.tween.kill()&&(s.tween=0)},cn(e,"wheel",n.wheelHandler),at.isTouch&&cn(e,"touchmove",n.wheelHandler),s},at=(function(){function r(t,n){Us||r.register(Ce)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),qc(this),this.init(t,n)}var e=r.prototype;return e.init=function(n,i){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),!ba){this.update=this.refresh=this.kill=Pi;return}n=dd(Zn(n)||Ea(n)||n.nodeType?{trigger:n}:n,po);var s=n,a=s.onUpdate,o=s.toggleClass,l=s.id,c=s.onToggle,u=s.onRefresh,h=s.scrub,f=s.trigger,d=s.pin,g=s.pinSpacing,_=s.invalidateOnRefresh,p=s.anticipatePin,m=s.onScrubComplete,b=s.onSnapComplete,w=s.once,M=s.snap,y=s.pinReparent,T=s.pinSpacer,A=s.containerAnimation,v=s.fastScrollEnd,E=s.preventOverlaps,C=n.horizontal||n.containerAnimation&&n.horizontal!==!1?In:en,L=!h&&h!==0,N=Fn(n.scroller||rt),q=Ce.core.getCache(N),W=ss(N),B=("pinType"in n?n.pinType:Rr(N,"pinType")||W&&"fixed")==="fixed",G=[n.onEnter,n.onLeave,n.onEnterBack,n.onLeaveBack],I=L&&n.toggleActions.split(" "),$="markers"in n?n.markers:po.markers,j=W?0:parseFloat(fi(N)["border"+C.p2+na])||0,D=this,se=n.onRefreshInit&&function(){return n.onRefreshInit(D)},he=R0(N,W,C),Ve=C0(N,W),He=0,De=0,J=0,ae=Lr(N,C),re,Re,Ie,Ee,Qe,ye,Ge,Xe,Te,V,Je,$e,pt,qe,mt,F,Dt,We,R,x,O,z,K,ue,oe,Q,ee,pe,Ae,ge,me,fe,Le,Be,U,de,te,_e,xe;if(D._startClamp=D._endClamp=!1,D._dir=C,p*=45,D.scroller=N,D.scroll=A?A.time.bind(A):ae,Ee=ae(),D.vars=n,i=i||n.animation,"refreshPriority"in n&&(Fp=1,n.refreshPriority===-9999&&(ka=D)),q.tweenScroll=q.tweenScroll||{top:vd(N,en),left:vd(N,In)},D.tweenTo=re=q.tweenScroll[C.p],D.scrubDuration=function(ce){Le=Ea(ce)&&ce,Le?fe?fe.duration(ce):fe=Ce.to(i,{ease:"expo",totalProgress:"+=0",inherit:!1,duration:Le,paused:!0,onComplete:function(){return m&&m(D)}}):(fe&&fe.progress(1).kill(),fe=0)},i&&(i.vars.lazy=!1,i._initted&&!D.isReverted||i.vars.immediateRender!==!1&&n.immediateRender!==!1&&i.duration()&&i.render(0,!0,!0),D.animation=i.pause(),i.scrollTrigger=D,D.scrubDuration(h),ge=0,l||(l=i.vars.id)),M&&((!Wr(M)||M.push)&&(M={snapTo:M}),"scrollBehavior"in _t.style&&Ce.set(W?[_t,jn]:N,{scrollBehavior:"auto"}),st.forEach(function(ce){return bn(ce)&&ce.target===(W?xt.scrollingElement||jn:N)&&(ce.smooth=!1)}),Ie=bn(M.snapTo)?M.snapTo:M.snapTo==="labels"?D0(i):M.snapTo==="labelsDirectional"?L0(i):M.directional!==!1?function(ce,ze){return mf(M.snapTo)(ce,vn()-De<500?0:ze.direction)}:Ce.utils.snap(M.snapTo),Be=M.duration||{min:.1,max:2},Be=Wr(Be)?Na(Be.min,Be.max):Na(Be,Be),U=Ce.delayedCall(M.delay||Le/2||.1,function(){var ce=ae(),ze=vn()-De<500,Pe=re.tween;if((ze||Math.abs(D.getVelocity())<10)&&!Pe&&!Rl&&He!==ce){var Ze=(ce-ye)/qe,Yt=i&&!L?i.totalProgress():Ze,it=ze?0:(Yt-me)/(vn()-Sa)*1e3||0,Rt=Ce.utils.clamp(-Ze,1-Ze,xs(it/2)*it/.185),rn=Ze+(M.inertia===!1?0:Rt),Ct,St,lt=M,Tn=lt.onStart,wt=lt.onInterrupt,pn=lt.onComplete;if(Ct=Ie(rn,D),Ea(Ct)||(Ct=rn),St=Math.max(0,Math.round(ye+Ct*qe)),ce<=Ge&&ce>=ye&&St!==ce){if(Pe&&!Pe._initted&&Pe.data<=xs(St-ce))return;M.inertia===!1&&(Rt=Ct-Ze),re(St,{duration:Be(xs(Math.max(xs(rn-Yt),xs(Ct-Yt))*.185/it/.05||0)),ease:M.ease||"power3",data:xs(St-ce),onInterrupt:function(){return U.restart(!0)&&wt&&_s(D,wt)},onComplete:function(){D.update(),He=ae(),i&&!L&&(fe?fe.resetTo("totalProgress",Ct,i._tTime/i._tDur):i.progress(Ct)),ge=me=i&&!L?i.totalProgress():D.progress,b&&b(D),pn&&_s(D,pn)}},ce,Rt*qe,St-ce-Rt*qe),Tn&&_s(D,Tn,re.tween)}}else D.isActive&&He!==ce&&U.restart(!0)}).pause()),l&&(Zc[l]=D),f=D.trigger=Fn(f||d!==!0&&d),xe=f&&f._gsap&&f._gsap.stRevert,xe&&(xe=xe(D)),d=d===!0?f:Fn(d),Zn(o)&&(o={targets:f,className:o}),d&&(g===!1||g===ui||(g=!g&&d.parentNode&&d.parentNode.style&&fi(d.parentNode).display==="flex"?!1:Zt),D.pin=d,Re=Ce.core.getCache(d),Re.spacer?mt=Re.pinState:(T&&(T=Fn(T),T&&!T.nodeType&&(T=T.current||T.nativeElement),Re.spacerIsNative=!!T,T&&(Re.spacerState=go(T))),Re.spacer=We=T||xt.createElement("div"),We.classList.add("pin-spacer"),l&&We.classList.add("pin-spacer-"+l),Re.pinState=mt=go(d)),n.force3D!==!1&&Ce.set(d,{force3D:!0}),D.spacer=We=Re.spacer,Ae=fi(d),ue=Ae[g+C.os2],x=Ce.getProperty(d),O=Ce.quickSetter(d,C.a,Jt),ql(d,We,Ae),Dt=go(d)),$){$e=Wr($)?dd($,hd):hd,V=mo("scroller-start",l,N,C,$e,0),Je=mo("scroller-end",l,N,C,$e,0,V),R=V["offset"+C.op.d2];var ne=Fn(Rr(N,"content")||N);Xe=this.markerStart=mo("start",l,ne,C,$e,R,0,A),Te=this.markerEnd=mo("end",l,ne,C,$e,R,0,A),A&&(_e=Ce.quickSetter([Xe,Te],C.a,Jt)),!B&&!(Oi.length&&Rr(N,"fixedMarkers")===!0)&&(P0(W?_t:N),Ce.set([V,Je],{force3D:!0}),Q=Ce.quickSetter(V,C.a,Jt),pe=Ce.quickSetter(Je,C.a,Jt))}if(A){var le=A.vars.onUpdate,ie=A.vars.onUpdateParams;A.eventCallback("onUpdate",function(){D.update(0,0,1),le&&le.apply(A,ie||[])})}if(D.previous=function(){return nt[nt.indexOf(D)-1]},D.next=function(){return nt[nt.indexOf(D)+1]},D.revert=function(ce,ze){if(!ze)return D.kill(!0);var Pe=ce!==!1||!D.enabled,Ze=xn;Pe!==D.isReverted&&(Pe&&(de=Math.max(ae(),D.scroll.rec||0),J=D.progress,te=i&&i.progress()),Xe&&[Xe,Te,V,Je].forEach(function(Yt){return Yt.style.display=Pe?"none":"block"}),Pe&&(xn=D,D.update(Pe)),d&&(!y||!D.isActive)&&(Pe?U0(d,We,mt):ql(d,We,fi(d),oe)),Pe||D.update(Pe),xn=Ze,D.isReverted=Pe)},D.refresh=function(ce,ze,Pe,Ze){if(!((xn||!D.enabled)&&!ze)){if(d&&ce&&gi){cn(r,"scrollEnd",qp);return}!Nn&&se&&se(D),xn=D,re.tween&&!Pe&&(re.tween.kill(),re.tween=0),fe&&fe.pause(),_&&i&&(i.revert({kill:!1}).invalidate(),i.getChildren?i.getChildren(!0,!0,!1).forEach(function(Me){return Me.vars.immediateRender&&Me.render(0,!0,!0)}):i.vars.immediateRender&&i.render(0,!0,!0)),D.isReverted||D.revert(!0,!0),D._subPinOffset=!1;var Yt=he(),it=Ve(),Rt=A?A.duration():Ii(N,C),rn=qe<=.01||!qe,Ct=0,St=Ze||0,lt=Wr(Pe)?Pe.end:n.end,Tn=n.endTrigger||f,wt=Wr(Pe)?Pe.start:n.start||(n.start===0||!f?0:d?"0 0":"0 100%"),pn=D.pinnedContainer=n.pinnedContainer&&Fn(n.pinnedContainer,D),wn=f&&Math.max(0,nt.indexOf(D))||0,qt=wn,Ft,jt,Ti,hs,sn,zt,si,S,k,Z,H,X,ve;for($&&Wr(Pe)&&(X=Ce.getProperty(V,C.p),ve=Ce.getProperty(Je,C.p));qt-- >0;)zt=nt[qt],zt.end||zt.refresh(0,1)||(xn=D),si=zt.pin,si&&(si===f||si===d||si===pn)&&!zt.isReverted&&(Z||(Z=[]),Z.unshift(zt),zt.revert(!0,!0)),zt!==nt[qt]&&(wn--,qt--);for(bn(wt)&&(wt=wt(D)),wt=ld(wt,"start",D),ye=_d(wt,f,Yt,C,ae(),Xe,V,D,it,j,B,Rt,A,D._startClamp&&"_startClamp")||(d?-.001:0),bn(lt)&&(lt=lt(D)),Zn(lt)&&!lt.indexOf("+=")&&(~lt.indexOf(" ")?lt=(Zn(wt)?wt.split(" ")[0]:"")+lt:(Ct=Ko(lt.substr(2),Yt),lt=Zn(wt)?wt:(A?Ce.utils.mapRange(0,A.duration(),A.scrollTrigger.start,A.scrollTrigger.end,ye):ye)+Ct,Tn=f)),lt=ld(lt,"end",D),Ge=Math.max(ye,_d(lt||(Tn?"100% 0":Rt),Tn,Yt,C,ae()+Ct,Te,Je,D,it,j,B,Rt,A,D._endClamp&&"_endClamp"))||-.001,Ct=0,qt=wn;qt--;)zt=nt[qt]||{},si=zt.pin,si&&zt.start-zt._pinPush<=ye&&!A&&zt.end>0&&(Ft=zt.end-(D._startClamp?Math.max(0,zt.start):zt.start),(si===f&&zt.start-zt._pinPush<ye||si===pn)&&isNaN(wt)&&(Ct+=Ft*(1-zt.progress)),si===d&&(St+=Ft));if(ye+=Ct,Ge+=Ct,D._startClamp&&(D._startClamp+=Ct),D._endClamp&&!Nn&&(D._endClamp=Ge||-.001,Ge=Math.min(Ge,Ii(N,C))),qe=Ge-ye||(ye-=.01)&&.001,rn&&(J=Ce.utils.clamp(0,1,Ce.utils.normalize(ye,Ge,de))),D._pinPush=St,Xe&&Ct&&(Ft={},Ft[C.a]="+="+Ct,pn&&(Ft[C.p]="-="+ae()),Ce.set([Xe,Te],Ft)),d&&!($c&&D.end>=Ii(N,C)))Ft=fi(d),hs=C===en,Ti=ae(),z=parseFloat(x(C.a))+St,!Rt&&Ge>1&&(H=(W?xt.scrollingElement||jn:N).style,H={style:H,value:H["overflow"+C.a.toUpperCase()]},W&&fi(_t)["overflow"+C.a.toUpperCase()]!=="scroll"&&(H.style["overflow"+C.a.toUpperCase()]="scroll")),ql(d,We,Ft),Dt=go(d),jt=Zi(d,!0),S=B&&Lr(N,hs?In:en)(),g?(oe=[g+C.os2,qe+St+Jt],oe.t=We,qt=g===Zt?gl(d,C)+qe+St:0,qt&&(oe.push(C.d,qt+Jt),We.style.flexBasis!=="auto"&&(We.style.flexBasis=qt+Jt)),qs(oe),pn&&nt.forEach(function(Me){Me.pin===pn&&Me.vars.pinSpacing!==!1&&(Me._subPinOffset=!0)}),B&&ae(de)):(qt=gl(d,C),qt&&We.style.flexBasis!=="auto"&&(We.style.flexBasis=qt+Jt)),B&&(sn={top:jt.top+(hs?Ti-ye:S)+Jt,left:jt.left+(hs?S:Ti-ye)+Jt,boxSizing:"border-box",position:"fixed"},sn[ns]=sn["max"+na]=Math.ceil(jt.width)+Jt,sn[is]=sn["max"+pf]=Math.ceil(jt.height)+Jt,sn[ui]=sn[ui+Oa]=sn[ui+Ua]=sn[ui+Ba]=sn[ui+Fa]="0",sn[Zt]=Ft[Zt],sn[Zt+Oa]=Ft[Zt+Oa],sn[Zt+Ua]=Ft[Zt+Ua],sn[Zt+Ba]=Ft[Zt+Ba],sn[Zt+Fa]=Ft[Zt+Fa],F=O0(mt,sn,y),Nn&&ae(0)),i?(k=i._initted,Hl(1),i.render(i.duration(),!0,!0),K=x(C.a)-z+qe+St,ee=Math.abs(qe-K)>1,B&&ee&&F.splice(F.length-2,2),i.render(0,!0,!0),k||i.invalidate(!0),i.parent||i.totalTime(i.totalTime()),Hl(0)):K=qe,H&&(H.value?H.style["overflow"+C.a.toUpperCase()]=H.value:H.style.removeProperty("overflow-"+C.a));else if(f&&ae()&&!A)for(jt=f.parentNode;jt&&jt!==_t;)jt._pinOffset&&(ye-=jt._pinOffset,Ge-=jt._pinOffset),jt=jt.parentNode;Z&&Z.forEach(function(Me){return Me.revert(!1,!0)}),D.start=ye,D.end=Ge,Ee=Qe=Nn?de:ae(),!A&&!Nn&&(Ee<de&&ae(de),D.scroll.rec=0),D.revert(!1,!0),De=vn(),U&&(He=-1,U.restart(!0)),xn=0,i&&L&&(i._initted||te)&&i.progress()!==te&&i.progress(te||0,!0).render(i.time(),!0,!0),(rn||J!==D.progress||A||_||i&&!i._initted)&&(i&&!L&&(i._initted||J||i.vars.immediateRender!==!1)&&i.totalProgress(A&&ye<-.001&&!J?Ce.utils.normalize(ye,Ge,0):J,!0),D.progress=rn||(Ee-ye)/qe===J?0:J),d&&g&&(We._pinOffset=Math.round(D.progress*K)),fe&&fe.invalidate(),isNaN(X)||(X-=Ce.getProperty(V,C.p),ve-=Ce.getProperty(Je,C.p),_o(V,C,X),_o(Xe,C,X-(Ze||0)),_o(Je,C,ve),_o(Te,C,ve-(Ze||0))),rn&&!Nn&&D.update(),u&&!Nn&&!pt&&(pt=!0,u(D),pt=!1)}},D.getVelocity=function(){return(ae()-Qe)/(vn()-Sa)*1e3||0},D.endAnimation=function(){da(D.callbackAnimation),i&&(fe?fe.progress(1):i.paused()?L||da(i,D.direction<0,1):da(i,i.reversed()))},D.labelToScroll=function(ce){return i&&i.labels&&(ye||D.refresh()||ye)+i.labels[ce]/i.duration()*qe||0},D.getTrailing=function(ce){var ze=nt.indexOf(D),Pe=D.direction>0?nt.slice(0,ze).reverse():nt.slice(ze+1);return(Zn(ce)?Pe.filter(function(Ze){return Ze.vars.preventOverlaps===ce}):Pe).filter(function(Ze){return D.direction>0?Ze.end<=ye:Ze.start>=Ge})},D.update=function(ce,ze,Pe){if(!(A&&!Pe&&!ce)){var Ze=Nn===!0?de:D.scroll(),Yt=ce?0:(Ze-ye)/qe,it=Yt<0?0:Yt>1?1:Yt||0,Rt=D.progress,rn,Ct,St,lt,Tn,wt,pn,wn;if(ze&&(Qe=Ee,Ee=A?ae():Ze,M&&(me=ge,ge=i&&!L?i.totalProgress():it)),p&&d&&!xn&&!co&&gi&&(!it&&ye<Ze+(Ze-Qe)/(vn()-Sa)*p?it=1e-4:it===1&&Ge>Ze+(Ze-Qe)/(vn()-Sa)*p&&(it=.9999)),it!==Rt&&D.enabled){if(rn=D.isActive=!!it&&it<1,Ct=!!Rt&&Rt<1,wt=rn!==Ct,Tn=wt||!!it!=!!Rt,D.direction=it>Rt?1:-1,D.progress=it,Tn&&!xn&&(St=it&&!Rt?0:it===1?1:Rt===1?2:3,L&&(lt=!wt&&I[St+1]!=="none"&&I[St+1]||I[St],wn=i&&(lt==="complete"||lt==="reset"||lt in i))),E&&(wt||wn)&&(wn||h||!i)&&(bn(E)?E(D):D.getTrailing(E).forEach(function(Ti){return Ti.endAnimation()})),L||(fe&&!xn&&!co?(fe._dp._time-fe._start!==fe._time&&fe.render(fe._dp._time-fe._start),fe.resetTo?fe.resetTo("totalProgress",it,i._tTime/i._tDur):(fe.vars.totalProgress=it,fe.invalidate().restart())):i&&i.totalProgress(it,!!(xn&&(De||ce)))),d){if(ce&&g&&(We.style[g+C.os2]=ue),!B)O(ya(z+K*it));else if(Tn){if(pn=!ce&&it>Rt&&Ge+1>Ze&&Ze+1>=Ii(N,C),y)if(!ce&&(rn||pn)){var qt=Zi(d,!0),Ft=Ze-ye;xd(d,_t,qt.top+(C===en?Ft:0)+Jt,qt.left+(C===en?0:Ft)+Jt)}else xd(d,We);qs(rn||pn?F:Dt),ee&&it<1&&rn||O(z+(it===1&&!pn?K:0))}}M&&!re.tween&&!xn&&!co&&U.restart(!0),o&&(wt||w&&it&&(it<1||!Wl))&&Ka(o.targets).forEach(function(Ti){return Ti.classList[rn||w?"add":"remove"](o.className)}),a&&!L&&!ce&&a(D),Tn&&!xn?(L&&(wn&&(lt==="complete"?i.pause().totalProgress(1):lt==="reset"?i.restart(!0).pause():lt==="restart"?i.restart(!0):i[lt]()),a&&a(D)),(wt||!Wl)&&(c&&wt&&_s(D,c),G[St]&&_s(D,G[St]),w&&(it===1?D.kill(!1,1):G[St]=0),wt||(St=it===1?1:3,G[St]&&_s(D,G[St]))),v&&!rn&&Math.abs(D.getVelocity())>(Ea(v)?v:2500)&&(da(D.callbackAnimation),fe?fe.progress(1):da(i,lt==="reverse"?1:!it,1))):L&&a&&!xn&&a(D)}if(pe){var jt=A?Ze/A.duration()*(A._caScrollDist||0):Ze;Q(jt+(V._isFlipped?1:0)),pe(jt)}_e&&_e(-Ze/A.duration()*(A._caScrollDist||0))}},D.enable=function(ce,ze){D.enabled||(D.enabled=!0,cn(N,"resize",Ta),W||cn(N,"scroll",vs),se&&cn(r,"refreshInit",se),ce!==!1&&(D.progress=J=0,Ee=Qe=He=ae()),ze!==!1&&D.refresh())},D.getTween=function(ce){return ce&&re?re.tween:fe},D.setPositions=function(ce,ze,Pe,Ze){if(A){var Yt=A.scrollTrigger,it=A.duration(),Rt=Yt.end-Yt.start;ce=Yt.start+Rt*ce/it,ze=Yt.start+Rt*ze/it}D.refresh(!1,!1,{start:cd(ce,Pe&&!!D._startClamp),end:cd(ze,Pe&&!!D._endClamp)},Ze),D.update()},D.adjustPinSpacing=function(ce){if(oe&&ce){var ze=oe.indexOf(C.d)+1;oe[ze]=parseFloat(oe[ze])+ce+Jt,oe[1]=parseFloat(oe[1])+ce+Jt,qs(oe)}},D.disable=function(ce,ze){if(ce!==!1&&D.revert(!0,!0),D.enabled&&(D.enabled=D.isActive=!1,ze||fe&&fe.pause(),de=0,Re&&(Re.uncache=1),se&&on(r,"refreshInit",se),U&&(U.pause(),re.tween&&re.tween.kill()&&(re.tween=0)),!W)){for(var Pe=nt.length;Pe--;)if(nt[Pe].scroller===N&&nt[Pe]!==D)return;on(N,"resize",Ta),W||on(N,"scroll",vs)}},D.kill=function(ce,ze){D.disable(ce,ze),fe&&!ze&&fe.kill(),l&&delete Zc[l];var Pe=nt.indexOf(D);Pe>=0&&nt.splice(Pe,1),Pe===Ln&&Jo>0&&Ln--,Pe=0,nt.forEach(function(Ze){return Ze.scroller===D.scroller&&(Pe=1)}),Pe||Nn||(D.scroll.rec=0),i&&(i.scrollTrigger=null,ce&&i.revert({kill:!1}),ze||i.kill()),Xe&&[Xe,Te,V,Je].forEach(function(Ze){return Ze.parentNode&&Ze.parentNode.removeChild(Ze)}),ka===D&&(ka=0),d&&(Re&&(Re.uncache=1),Pe=0,nt.forEach(function(Ze){return Ze.pin===d&&Pe++}),Pe||(Re.spacer=0)),n.onKill&&n.onKill(D)},nt.push(D),D.enable(!1,!1),xe&&xe(D),i&&i.add&&!qe){var ke=D.update;D.update=function(){D.update=ke,st.cache++,ye||Ge||D.refresh()},Ce.delayedCall(.01,D.update),qe=.01,ye=Ge=0}else D.refresh();d&&I0()},r.register=function(n){return Us||(Ce=n||Gp(),zp()&&window.document&&r.enable(),Us=ba),Us},r.defaults=function(n){if(n)for(var i in n)po[i]=n[i];return po},r.disable=function(n,i){ba=0,nt.forEach(function(a){return a[i?"kill":"disable"](n)}),on(rt,"wheel",vs),on(xt,"scroll",vs),clearInterval(lo),on(xt,"touchcancel",Pi),on(_t,"touchstart",Pi),fo(on,xt,"pointerdown,touchstart,mousedown",ud),fo(on,xt,"pointerup,touchend,mouseup",fd),ml.kill(),uo(on);for(var s=0;s<st.length;s+=3)ho(on,st[s],st[s+1]),ho(on,st[s],st[s+2])},r.enable=function(){if(rt=window,xt=document,jn=xt.documentElement,_t=xt.body,Ce){if(Ka=Ce.utils.toArray,Na=Ce.utils.clamp,qc=Ce.core.context||Pi,Hl=Ce.core.suppressOverwrites||Pi,uf=rt.history.scrollRestoration||"auto",Kc=rt.pageYOffset||0,Ce.core.globals("ScrollTrigger",r),_t){ba=1,Ys=document.createElement("div"),Ys.style.height="100vh",Ys.style.position="absolute",jp(),A0(),Wt.register(Ce),r.isTouch=Wt.isTouch,_r=Wt.isTouch&&/(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent),Yc=Wt.isTouch===1,cn(rt,"wheel",vs),cf=[rt,xt,jn,_t],Ce.matchMedia?(r.matchMedia=function(u){var h=Ce.matchMedia(),f;for(f in u)h.add(f,u[f]);return h},Ce.addEventListener("matchMediaInit",function(){Zp(),gf()}),Ce.addEventListener("matchMediaRevert",function(){return $p()}),Ce.addEventListener("matchMedia",function(){Zr(0,1),os("matchMedia")}),Ce.matchMedia().add("(orientation: portrait)",function(){return Yl(),Yl})):console.warn("Requires GSAP 3.11.0 or later"),Yl(),cn(xt,"scroll",vs);var n=_t.hasAttribute("style"),i=_t.style,s=i.borderTopStyle,a=Ce.core.Animation.prototype,o,l;for(a.revert||Object.defineProperty(a,"revert",{value:function(){return this.time(-.01,!0)}}),i.borderTopStyle="solid",o=Zi(_t),en.m=Math.round(o.top+en.sc())||0,In.m=Math.round(o.left+In.sc())||0,s?i.borderTopStyle=s:i.removeProperty("border-top-style"),n||(_t.setAttribute("style",""),_t.removeAttribute("style")),lo=setInterval(pd,250),Ce.delayedCall(.5,function(){return co=0}),cn(xt,"touchcancel",Pi),cn(_t,"touchstart",Pi),fo(cn,xt,"pointerdown,touchstart,mousedown",ud),fo(cn,xt,"pointerup,touchend,mouseup",fd),Xc=Ce.utils.checkPrefix("transform"),Qo.push(Xc),Us=vn(),ml=Ce.delayedCall(.2,Zr).pause(),Fs=[xt,"visibilitychange",function(){var u=rt.innerWidth,h=rt.innerHeight;xt.hidden?(ad=u,od=h):(ad!==u||od!==h)&&Ta()},xt,"DOMContentLoaded",Zr,rt,"load",Zr,rt,"resize",Ta],uo(cn),nt.forEach(function(u){return u.enable(0,1)}),l=0;l<st.length;l+=3)ho(on,st[l],st[l+1]),ho(on,st[l],st[l+2])}else if(xt){var c=function u(){r.enable(),xt.removeEventListener("DOMContentLoaded",u)};xt.addEventListener("DOMContentLoaded",c)}}},r.config=function(n){"limitCallbacks"in n&&(Wl=!!n.limitCallbacks);var i=n.syncInterval;i&&clearInterval(lo)||(lo=i)&&setInterval(pd,i),"ignoreMobileResize"in n&&(Yc=r.isTouch===1&&n.ignoreMobileResize),"autoRefreshEvents"in n&&(uo(on)||uo(cn,n.autoRefreshEvents||"none"),Op=(n.autoRefreshEvents+"").indexOf("resize")===-1)},r.scrollerProxy=function(n,i){var s=Fn(n),a=st.indexOf(s),o=ss(s);~a&&st.splice(a,o?6:2),i&&(o?Oi.unshift(rt,i,_t,i,jn,i):Oi.unshift(s,i))},r.clearMatchMedia=function(n){nt.forEach(function(i){return i._ctx&&i._ctx.query===n&&i._ctx.kill(!0,!0)})},r.isInViewport=function(n,i,s){var a=(Zn(n)?Fn(n):n).getBoundingClientRect(),o=a[s?ns:is]*i||0;return s?a.right-o>0&&a.left+o<rt.innerWidth:a.bottom-o>0&&a.top+o<rt.innerHeight},r.positionInViewport=function(n,i,s){Zn(n)&&(n=Fn(n));var a=n.getBoundingClientRect(),o=a[s?ns:is],l=i==null?o/2:i in _l?_l[i]*o:~i.indexOf("%")?parseFloat(i)*o/100:parseFloat(i)||0;return s?(a.left+l)/rt.innerWidth:(a.top+l)/rt.innerHeight},r.killAll=function(n){if(nt.slice(0).forEach(function(s){return s.vars.id!=="ScrollSmoother"&&s.kill()}),n!==!0){var i=as.killAll||[];as={},i.forEach(function(s){return s()})}},r})();at.version="3.15.0";at.saveStyles=function(r){return r?Ka(r).forEach(function(e){if(e&&e.style){var t=$n.indexOf(e);t>=0&&$n.splice(t,5),$n.push(e,e.style.cssText,e.getBBox&&e.getAttribute("transform"),Ce.core.getCache(e),qc())}}):$n};at.revert=function(r,e){return gf(!r,e)};at.create=function(r,e){return new at(r,e)};at.refresh=function(r){return r?Ta(!0):(Us||at.register())&&Zr(!0)};at.update=function(r){return++st.cache&&Qi(r===!0?2:0)};at.clearScrollMemory=Kp;at.maxScroll=function(r,e){return Ii(r,e?In:en)};at.getScrollFunc=function(r,e){return Lr(Fn(r),e?In:en)};at.getById=function(r){return Zc[r]};at.getAll=function(){return nt.filter(function(r){return r.vars.id!=="ScrollSmoother"})};at.isScrolling=function(){return!!gi};at.snapDirectional=mf;at.addEventListener=function(r,e){var t=as[r]||(as[r]=[]);~t.indexOf(e)||t.push(e)};at.removeEventListener=function(r,e){var t=as[r],n=t&&t.indexOf(e);n>=0&&t.splice(n,1)};at.batch=function(r,e){var t=[],n={},i=e.interval||.016,s=e.batchMax||1e9,a=function(c,u){var h=[],f=[],d=Ce.delayedCall(i,function(){u(h,f),h=[],f=[]}).pause();return function(g){h.length||d.restart(!0),h.push(g.trigger),f.push(g),s<=h.length&&d.progress(1)}},o;for(o in e)n[o]=o.substr(0,2)==="on"&&bn(e[o])&&o!=="onRefreshInit"?a(o,e[o]):e[o];return bn(s)&&(s=s(),cn(at,"refresh",function(){return s=e.batchMax()})),Ka(r).forEach(function(l){var c={};for(o in n)c[o]=n[o];c.trigger=l,t.push(at.create(c))}),t};var Md=function(e,t,n,i){return t>i?e(i):t<0&&e(0),n>i?(i-t)/(n-t):n<0?t/(t-n):1},$l=function r(e,t){t===!0?e.style.removeProperty("touch-action"):e.style.touchAction=t===!0?"auto":t?"pan-"+t+(Wt.isTouch?" pinch-zoom":""):"none",e===jn&&r(_t,t)},xo={auto:1,scroll:1},k0=function(e){var t=e.event,n=e.target,i=e.axis,s=(t.changedTouches?t.changedTouches[0]:t).target,a=s._gsap||Ce.core.getCache(s),o=vn(),l;if(!a._isScrollT||o-a._isScrollT>2e3){for(;s&&s!==_t&&(s.scrollHeight<=s.clientHeight&&s.scrollWidth<=s.clientWidth||!(xo[(l=fi(s)).overflowY]||xo[l.overflowX]));)s=s.parentNode;a._isScroll=s&&s!==n&&!ss(s)&&(xo[(l=fi(s)).overflowY]||xo[l.overflowX]),a._isScrollT=o}(a._isScroll||i==="x")&&(t.stopPropagation(),t._gsapAllow=!0)},Qp=function(e,t,n,i){return Wt.create({target:e,capture:!0,debounce:!1,lockAxis:!0,type:t,onWheel:i=i&&k0,onPress:i,onDrag:i,onScroll:i,onEnable:function(){return n&&cn(xt,Wt.eventTypes[0],bd,!1,!0)},onDisable:function(){return on(xt,Wt.eventTypes[0],bd,!0)}})},z0=/(input|label|select|textarea)/i,Sd,bd=function(e){var t=z0.test(e.target.tagName);(t||Sd)&&(e._gsapAllow=!0,Sd=t)},G0=function(e){Wr(e)||(e={}),e.preventDefault=e.isNormalizer=e.allowClicks=!0,e.type||(e.type="wheel,touch"),e.debounce=!!e.debounce,e.id=e.id||"normalizer";var t=e,n=t.normalizeScrollX,i=t.momentum,s=t.allowNestedScroll,a=t.onRelease,o,l,c=Fn(e.target)||jn,u=Ce.core.globals().ScrollSmoother,h=u&&u.get(),f=_r&&(e.content&&Fn(e.content)||h&&e.content!==!1&&!h.smooth()&&h.content()),d=Lr(c,en),g=Lr(c,In),_=1,p=(Wt.isTouch&&rt.visualViewport?rt.visualViewport.scale*rt.visualViewport.width:rt.outerWidth)/rt.innerWidth,m=0,b=bn(i)?function(){return i(o)}:function(){return i||2.8},w,M,y=Qp(c,e.type,!0,s),T=function(){return M=!1},A=Pi,v=Pi,E=function(){l=Ii(c,en),v=Na(_r?1:0,l),n&&(A=Na(0,Ii(c,In))),w=rs},C=function(){f._gsap.y=ya(parseFloat(f._gsap.y)+d.offset)+"px",f.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+parseFloat(f._gsap.y)+", 0, 1)",d.offset=d.cacheID=0},L=function(){if(M){requestAnimationFrame(T);var $=ya(o.deltaY/2),j=v(d.v-$);if(f&&j!==d.v+d.offset){d.offset=j-d.v;var D=ya((parseFloat(f&&f._gsap.y)||0)-d.offset);f.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+D+", 0, 1)",f._gsap.y=D+"px",d.cacheID=st.cache,Qi()}return!0}d.offset&&C(),M=!0},N,q,W,B,G=function(){E(),N.isActive()&&N.vars.scrollY>l&&(d()>l?N.progress(1)&&d(l):N.resetTo("scrollY",l))};return f&&Ce.set(f,{y:"+=0"}),e.ignoreCheck=function(I){return _r&&I.type==="touchmove"&&L()||_>1.05&&I.type!=="touchstart"||o.isGesturing||I.touches&&I.touches.length>1},e.onPress=function(){M=!1;var I=_;_=ya((rt.visualViewport&&rt.visualViewport.scale||1)/p),N.pause(),I!==_&&$l(c,_>1.01?!0:n?!1:"x"),q=g(),W=d(),E(),w=rs},e.onRelease=e.onGestureStart=function(I,$){if(d.offset&&C(),!$)B.restart(!0);else{st.cache++;var j=b(),D,se;n&&(D=g(),se=D+j*.05*-I.velocityX/.227,j*=Md(g,D,se,Ii(c,In)),N.vars.scrollX=A(se)),D=d(),se=D+j*.05*-I.velocityY/.227,j*=Md(d,D,se,Ii(c,en)),N.vars.scrollY=v(se),N.invalidate().duration(j).play(.01),(_r&&N.vars.scrollY>=l||D>=l-1)&&Ce.to({},{onUpdate:G,duration:j})}a&&a(I)},e.onWheel=function(){N._ts&&N.pause(),vn()-m>1e3&&(w=0,m=vn())},e.onChange=function(I,$,j,D,se){if(rs!==w&&E(),$&&n&&g(A(D[2]===$?q+(I.startX-I.x):g()+$-D[1])),j){d.offset&&C();var he=se[2]===j,Ve=he?W+I.startY-I.y:d()+j-se[1],He=v(Ve);he&&Ve!==He&&(W+=He-Ve),d(He)}(j||$)&&Qi()},e.onEnable=function(){$l(c,n?!1:"x"),at.addEventListener("refresh",G),cn(rt,"resize",G),d.smooth&&(d.target.style.scrollBehavior="auto",d.smooth=g.smooth=!1),y.enable()},e.onDisable=function(){$l(c,!0),on(rt,"resize",G),at.removeEventListener("refresh",G),y.kill()},e.lockAxis=e.lockAxis!==!1,o=new Wt(e),o.iOS=_r,_r&&!d()&&d(1),_r&&Ce.ticker.add(Pi),B=o._dc,N=Ce.to(o,{ease:"power4",paused:!0,inherit:!1,scrollX:n?"+=0.1":"+=0",scrollY:"+=0.1",modifiers:{scrollY:Jp(d,d(),function(){return N.pause()})},onUpdate:Qi,onComplete:B.vars.onComplete}),o};at.sort=function(r){if(bn(r))return nt.sort(r);var e=rt.pageYOffset||0;return at.getAll().forEach(function(t){return t._sortY=t.trigger?e+t.trigger.getBoundingClientRect().top:t.start+rt.innerHeight}),nt.sort(r||function(t,n){return(t.vars.refreshPriority||0)*-1e6+(t.vars.containerAnimation?1e6:t._sortY)-((n.vars.containerAnimation?1e6:n._sortY)+(n.vars.refreshPriority||0)*-1e6)})};at.observe=function(r){return new Wt(r)};at.normalizeScroll=function(r){if(typeof r>"u")return Dn;if(r===!0&&Dn)return Dn.enable();if(r===!1){Dn&&Dn.kill(),Dn=r;return}var e=r instanceof Wt?r:G0(r);return Dn&&Dn.target===e.target&&Dn.kill(),ss(e.target)&&(Dn=e),e};at.core={_getVelocityProp:Wc,_inputObserver:Qp,_scrollers:st,_proxies:Oi,bridge:{ss:function(){gi||os("scrollStart"),gi=vn()},ref:function(){return xn}}};Gp()&&Ce.registerPlugin(at);Pt.registerPlugin(at);const _f="185",V0=0,yd=1,H0=2,tl=1,W0=2,wa=3,Nr=0,Vn=1,Ki=2,er=0,$s=1,Jc=2,Ed=3,Td=4,X0=5,Yr=100,Y0=101,q0=102,$0=103,Z0=104,K0=200,j0=201,J0=202,Q0=203,Qc=204,eu=205,e_=206,t_=207,n_=208,i_=209,r_=210,s_=211,a_=212,o_=213,l_=214,tu=0,nu=1,iu=2,ia=3,ru=4,su=5,au=6,ou=7,em=0,c_=1,u_=2,Bi=0,tm=1,nm=2,im=3,rm=4,sm=5,am=6,om=7,lm=300,ls=301,ra=302,Zl=303,Kl=304,Cl=306,lu=1e3,Ji=1001,cu=1002,dn=1003,f_=1004,vo=1005,yn=1006,jl=1007,Kr=1008,hi=1009,cm=1010,um=1011,Ja=1012,xf=1013,Gi=1014,Ui=1015,sr=1016,vf=1017,Mf=1018,Qa=1020,fm=35902,dm=35899,hm=1021,pm=1022,bi=1023,ar=1026,jr=1027,mm=1028,Sf=1029,cs=1030,bf=1031,yf=1033,nl=33776,il=33777,rl=33778,sl=33779,uu=35840,fu=35841,du=35842,hu=35843,pu=36196,mu=37492,gu=37496,_u=37488,xu=37489,xl=37490,vu=37491,Mu=37808,Su=37809,bu=37810,yu=37811,Eu=37812,Tu=37813,wu=37814,Au=37815,Ru=37816,Cu=37817,Pu=37818,Du=37819,Lu=37820,Nu=37821,Iu=36492,Uu=36494,Fu=36495,Ou=36283,Bu=36284,vl=36285,ku=36286,d_=3200,wd=0,h_=1,xr="",ci="srgb",Ml="srgb-linear",Sl="linear",vt="srgb",Ms=7680,Ad=519,p_=512,m_=513,g_=514,Ef=515,__=516,x_=517,Tf=518,v_=519,Rd=35044,Cd="300 es",Fi=2e3,bl=2001;function M_(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function yl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function S_(){const r=yl("canvas");return r.style.display="block",r}const Pd={};function Dd(...r){const e="THREE."+r.shift();console.log(e,...r)}function gm(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function Ye(...r){r=gm(r);const e="THREE."+r.shift();{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function ht(...r){r=gm(r);const e="THREE."+r.shift();{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function Zs(...r){const e=r.join(" ");e in Pd||(Pd[e]=!0,Ye(...r))}function b_(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const y_={[tu]:nu,[iu]:au,[ru]:ou,[ia]:su,[nu]:tu,[au]:iu,[ou]:ru,[su]:ia};class ds{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const gn=["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 Ld=1234567;const za=Math.PI/180,eo=180/Math.PI;function oa(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(gn[r&255]+gn[r>>8&255]+gn[r>>16&255]+gn[r>>24&255]+"-"+gn[e&255]+gn[e>>8&255]+"-"+gn[e>>16&15|64]+gn[e>>24&255]+"-"+gn[t&63|128]+gn[t>>8&255]+"-"+gn[t>>16&255]+gn[t>>24&255]+gn[n&255]+gn[n>>8&255]+gn[n>>16&255]+gn[n>>24&255]).toLowerCase()}function ot(r,e,t){return Math.max(e,Math.min(t,r))}function wf(r,e){return(r%e+e)%e}function E_(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function T_(r,e,t){return r!==e?(t-r)/(e-r):0}function Ga(r,e,t){return(1-t)*r+t*e}function w_(r,e,t,n){return Ga(r,e,1-Math.exp(-t*n))}function A_(r,e=1){return e-Math.abs(wf(r,e*2)-e)}function R_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function C_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function P_(r,e){return r+Math.floor(Math.random()*(e-r+1))}function D_(r,e){return r+Math.random()*(e-r)}function L_(r){return r*(.5-Math.random())}function N_(r){r!==void 0&&(Ld=r);let e=Ld+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function I_(r){return r*za}function U_(r){return r*eo}function F_(r){return(r&r-1)===0&&r!==0}function O_(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function B_(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function k_(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),f=a((e-n)/2),d=s((n-e)/2),g=a((n-e)/2);switch(i){case"XYX":r.set(o*u,l*h,l*f,o*c);break;case"YZY":r.set(l*f,o*u,l*h,o*c);break;case"ZXZ":r.set(l*h,l*f,o*u,o*c);break;case"XZX":r.set(o*u,l*g,l*d,o*c);break;case"YXY":r.set(l*d,o*u,l*g,o*c);break;case"ZYZ":r.set(l*g,l*d,o*u,o*c);break;default:Ye("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Os(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Cn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const Or={DEG2RAD:za,RAD2DEG:eo,generateUUID:oa,clamp:ot,euclideanModulo:wf,mapLinear:E_,inverseLerp:T_,lerp:Ga,damp:w_,pingpong:A_,smoothstep:R_,smootherstep:C_,randInt:P_,randFloat:D_,randFloatSpread:L_,seededRandom:N_,degToRad:I_,radToDeg:U_,isPowerOfTwo:F_,ceilPowerOfTwo:O_,floorPowerOfTwo:B_,setQuaternionFromProperEuler:k_,normalize:Cn,denormalize:Os},Pf=class Pf{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ot(this.x,e.x,t.x),this.y=ot(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ot(this.x,e,t),this.y=ot(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ot(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ot(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Pf.prototype.isVector2=!0;let gt=Pf;class la{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3],f=s[a+0],d=s[a+1],g=s[a+2],_=s[a+3];if(h!==_||l!==f||c!==d||u!==g){let p=l*f+c*d+u*g+h*_;p<0&&(f=-f,d=-d,g=-g,_=-_,p=-p);let m=1-o;if(p<.9995){const b=Math.acos(p),w=Math.sin(b);m=Math.sin(m*b)/w,o=Math.sin(o*b)/w,l=l*m+f*o,c=c*m+d*o,u=u*m+g*o,h=h*m+_*o}else{l=l*m+f*o,c=c*m+d*o,u=u*m+g*o,h=h*m+_*o;const b=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=b,c*=b,u*=b,h*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[a],f=s[a+1],d=s[a+2],g=s[a+3];return e[t]=o*g+u*h+l*d-c*f,e[t+1]=l*g+u*f+c*h-o*d,e[t+2]=c*g+u*d+o*f-l*h,e[t+3]=u*g-o*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(i/2),h=o(s/2),f=l(n/2),d=l(i/2),g=l(s/2);switch(a){case"XYZ":this._x=f*u*h+c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h-f*d*g;break;case"YXZ":this._x=f*u*h+c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h+f*d*g;break;case"ZXY":this._x=f*u*h-c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h-f*d*g;break;case"ZYX":this._x=f*u*h-c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h+f*d*g;break;case"YZX":this._x=f*u*h+c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h-f*d*g;break;case"XZY":this._x=f*u*h-c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h+f*d*g;break;default:Ye("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+o+h;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(a-i)*d}else if(n>o&&n>h){const d=2*Math.sqrt(1+n-o-h);this._w=(u-l)/d,this._x=.25*d,this._y=(i+a)/d,this._z=(s+c)/d}else if(o>h){const d=2*Math.sqrt(1+o-n-h);this._w=(s-c)/d,this._x=(i+a)/d,this._y=.25*d,this._z=(l+u)/d}else{const d=2*Math.sqrt(1+h-n-o);this._w=(a-i)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ot(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+i*c-s*l,this._y=i*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-i*o,this._w=a*u-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Df=class Df{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Nd.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Nd.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),u=2*(o*t-s*i),h=2*(s*n-a*t);return this.x=t+l*c+a*h-o*u,this.y=n+l*u+o*c-s*h,this.z=i+l*h+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ot(this.x,e.x,t.x),this.y=ot(this.y,e.y,t.y),this.z=ot(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ot(this.x,e,t),this.y=ot(this.y,e,t),this.z=ot(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ot(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Jl.copy(this).projectOnVector(e),this.sub(Jl)}reflect(e){return this.sub(Jl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ot(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Df.prototype.isVector3=!0;let Y=Df;const Jl=new Y,Nd=new la,Lf=class Lf{constructor(e,t,n,i,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c)}set(e,t,n,i,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],g=n[8],_=i[0],p=i[3],m=i[6],b=i[1],w=i[4],M=i[7],y=i[2],T=i[5],A=i[8];return s[0]=a*_+o*b+l*y,s[3]=a*p+o*w+l*T,s[6]=a*m+o*M+l*A,s[1]=c*_+u*b+h*y,s[4]=c*p+u*w+h*T,s[7]=c*m+u*M+h*A,s[2]=f*_+d*b+g*y,s[5]=f*p+d*w+g*T,s[8]=f*m+d*M+g*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,f=o*l-u*s,d=c*s-a*l,g=t*h+n*f+i*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=h*_,e[1]=(i*c-u*n)*_,e[2]=(o*n-i*a)*_,e[3]=f*_,e[4]=(u*t-i*l)*_,e[5]=(i*s-o*t)*_,e[6]=d*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return Zs("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Ql.makeScale(e,t)),this}rotate(e){return Zs("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Ql.makeRotation(-e)),this}translate(e,t){return Zs("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Ql.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Lf.prototype.isMatrix3=!0;let Ke=Lf;const Ql=new Ke,Id=new Ke().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ud=new Ke().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function z_(){const r={enabled:!0,workingColorSpace:Ml,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===vt&&(i.r=tr(i.r),i.g=tr(i.g),i.b=tr(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===vt&&(i.r=Ks(i.r),i.g=Ks(i.g),i.b=Ks(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===xr?Sl:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Zs("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Zs("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Ml]:{primaries:e,whitePoint:n,transfer:Sl,toXYZ:Id,fromXYZ:Ud,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ci},outputColorSpaceConfig:{drawingBufferColorSpace:ci}},[ci]:{primaries:e,whitePoint:n,transfer:vt,toXYZ:Id,fromXYZ:Ud,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ci}}}),r}const ct=z_();function tr(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Ks(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Ss;class G_{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ss===void 0&&(Ss=yl("canvas")),Ss.width=e.width,Ss.height=e.height;const i=Ss.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ss}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=yl("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=tr(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(tr(t[n]/255)*255):t[n]=tr(t[n]);return{data:t,width:e.width,height:e.height}}else return Ye("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let V_=0;class Af{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:V_++}),this.uuid=oa(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(ec(i[a].image)):s.push(ec(i[a]))}else s=ec(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function ec(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?G_.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(Ye("Texture: Unable to serialize Texture."),{})}let H_=0;const tc=new Y;class Un extends ds{constructor(e=Un.DEFAULT_IMAGE,t=Un.DEFAULT_MAPPING,n=Ji,i=Ji,s=yn,a=Kr,o=bi,l=hi,c=Un.DEFAULT_ANISOTROPY,u=xr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:H_++}),this.uuid=oa(),this.name="",this.source=new Af(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new gt(0,0),this.repeat=new gt(1,1),this.center=new gt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(tc).x}get height(){return this.source.getSize(tc).y}get depth(){return this.source.getSize(tc).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Ye(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Ye(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==lm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case lu:e.x=e.x-Math.floor(e.x);break;case Ji:e.x=e.x<0?0:1;break;case cu:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case lu:e.y=e.y-Math.floor(e.y);break;case Ji:e.y=e.y<0?0:1;break;case cu:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Un.DEFAULT_IMAGE=null;Un.DEFAULT_MAPPING=lm;Un.DEFAULT_ANISOTROPY=1;const Nf=class Nf{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],g=l[9],_=l[2],p=l[6],m=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-_)<.01&&Math.abs(g-p)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+_)<.1&&Math.abs(g+p)<.1&&Math.abs(c+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,M=(d+1)/2,y=(m+1)/2,T=(u+f)/4,A=(h+_)/4,v=(g+p)/4;return w>M&&w>y?w<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(w),i=T/n,s=A/n):M>y?M<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),n=T/i,s=v/i):y<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(y),n=A/s,i=v/s),this.set(n,i,s,t),this}let b=Math.sqrt((p-g)*(p-g)+(h-_)*(h-_)+(f-u)*(f-u));return Math.abs(b)<.001&&(b=1),this.x=(p-g)/b,this.y=(h-_)/b,this.z=(f-u)/b,this.w=Math.acos((c+d+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ot(this.x,e.x,t.x),this.y=ot(this.y,e.y,t.y),this.z=ot(this.z,e.z,t.z),this.w=ot(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ot(this.x,e,t),this.y=ot(this.y,e,t),this.z=ot(this.z,e,t),this.w=ot(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ot(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Nf.prototype.isVector4=!0;let Bt=Nf;class W_ extends ds{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:yn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Bt(0,0,e,t),this.scissorTest=!1,this.viewport=new Bt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},s=new Un(i),a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:yn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new Af(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ki extends W_{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class _m extends Un{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=dn,this.minFilter=dn,this.wrapR=Ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class X_ extends Un{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=dn,this.minFilter=dn,this.wrapR=Ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const El=class El{constructor(e,t,n,i,s,a,o,l,c,u,h,f,d,g,_,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c,u,h,f,d,g,_,p)}set(e,t,n,i,s,a,o,l,c,u,h,f,d,g,_,p){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=u,m[10]=h,m[14]=f,m[3]=d,m[7]=g,m[11]=_,m[15]=p,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 El().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,i=1/bs.setFromMatrixColumn(e,0).length(),s=1/bs.setFromMatrixColumn(e,1).length(),a=1/bs.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*u,d=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+g*c,t[5]=f-_*c,t[9]=-o*l,t[2]=_-f*c,t[6]=g+d*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,d=l*h,g=c*u,_=c*h;t[0]=f+_*o,t[4]=g*o-d,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=d*o-g,t[6]=_+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,d=l*h,g=c*u,_=c*h;t[0]=f-_*o,t[4]=-a*h,t[8]=g+d*o,t[1]=d+g*o,t[5]=a*u,t[9]=_-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,d=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=g*c-d,t[8]=f*c+_,t[1]=l*h,t[5]=_*c+f,t[9]=d*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,d=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-f*h,t[8]=g*h+d,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=d*h+g,t[10]=f-_*h}else if(e.order==="XZY"){const f=a*l,d=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+_,t[5]=a*u,t[9]=d*h-g,t[2]=g*h-d,t[6]=o*u,t[10]=_*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Y_,e,q_)}lookAt(e,t,n){const i=this.elements;return Yn.subVectors(e,t),Yn.lengthSq()===0&&(Yn.z=1),Yn.normalize(),fr.crossVectors(n,Yn),fr.lengthSq()===0&&(Math.abs(n.z)===1?Yn.x+=1e-4:Yn.z+=1e-4,Yn.normalize(),fr.crossVectors(n,Yn)),fr.normalize(),Mo.crossVectors(Yn,fr),i[0]=fr.x,i[4]=Mo.x,i[8]=Yn.x,i[1]=fr.y,i[5]=Mo.y,i[9]=Yn.y,i[2]=fr.z,i[6]=Mo.z,i[10]=Yn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],h=n[5],f=n[9],d=n[13],g=n[2],_=n[6],p=n[10],m=n[14],b=n[3],w=n[7],M=n[11],y=n[15],T=i[0],A=i[4],v=i[8],E=i[12],C=i[1],L=i[5],N=i[9],q=i[13],W=i[2],B=i[6],G=i[10],I=i[14],$=i[3],j=i[7],D=i[11],se=i[15];return s[0]=a*T+o*C+l*W+c*$,s[4]=a*A+o*L+l*B+c*j,s[8]=a*v+o*N+l*G+c*D,s[12]=a*E+o*q+l*I+c*se,s[1]=u*T+h*C+f*W+d*$,s[5]=u*A+h*L+f*B+d*j,s[9]=u*v+h*N+f*G+d*D,s[13]=u*E+h*q+f*I+d*se,s[2]=g*T+_*C+p*W+m*$,s[6]=g*A+_*L+p*B+m*j,s[10]=g*v+_*N+p*G+m*D,s[14]=g*E+_*q+p*I+m*se,s[3]=b*T+w*C+M*W+y*$,s[7]=b*A+w*L+M*B+y*j,s[11]=b*v+w*N+M*G+y*D,s[15]=b*E+w*q+M*I+y*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],g=e[3],_=e[7],p=e[11],m=e[15],b=l*d-c*f,w=o*d-c*h,M=o*f-l*h,y=a*d-c*u,T=a*f-l*u,A=a*h-o*u;return t*(_*b-p*w+m*M)-n*(g*b-p*y+m*T)+i*(g*w-_*y+m*A)-s*(g*M-_*T+p*A)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],u=e[10];return t*(a*u-o*c)-n*(s*u-o*l)+i*(s*c-a*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],g=e[12],_=e[13],p=e[14],m=e[15],b=t*o-n*a,w=t*l-i*a,M=t*c-s*a,y=n*l-i*o,T=n*c-s*o,A=i*c-s*l,v=u*_-h*g,E=u*p-f*g,C=u*m-d*g,L=h*p-f*_,N=h*m-d*_,q=f*m-d*p,W=b*q-w*N+M*L+y*C-T*E+A*v;if(W===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/W;return e[0]=(o*q-l*N+c*L)*B,e[1]=(i*N-n*q-s*L)*B,e[2]=(_*A-p*T+m*y)*B,e[3]=(f*T-h*A-d*y)*B,e[4]=(l*C-a*q-c*E)*B,e[5]=(t*q-i*C+s*E)*B,e[6]=(p*M-g*A-m*w)*B,e[7]=(u*A-f*M+d*w)*B,e[8]=(a*N-o*C+c*v)*B,e[9]=(n*C-t*N-s*v)*B,e[10]=(g*T-_*M+m*b)*B,e[11]=(h*M-u*T-d*b)*B,e[12]=(o*E-a*L-l*v)*B,e[13]=(t*L-n*E+i*v)*B,e[14]=(_*w-g*y-p*b)*B,e[15]=(u*y-h*w+f*b)*B,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,u*o+n,u*l-i*a,0,c*l-i*o,u*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,f=s*c,d=s*u,g=s*h,_=a*u,p=a*h,m=o*h,b=l*c,w=l*u,M=l*h,y=n.x,T=n.y,A=n.z;return i[0]=(1-(_+m))*y,i[1]=(d+M)*y,i[2]=(g-w)*y,i[3]=0,i[4]=(d-M)*T,i[5]=(1-(f+m))*T,i[6]=(p+b)*T,i[7]=0,i[8]=(g+w)*A,i[9]=(p-b)*A,i[10]=(1-(f+_))*A,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let a=bs.set(i[0],i[1],i[2]).length();const o=bs.set(i[4],i[5],i[6]).length(),l=bs.set(i[8],i[9],i[10]).length();s<0&&(a=-a),_i.copy(this);const c=1/a,u=1/o,h=1/l;return _i.elements[0]*=c,_i.elements[1]*=c,_i.elements[2]*=c,_i.elements[4]*=u,_i.elements[5]*=u,_i.elements[6]*=u,_i.elements[8]*=h,_i.elements[9]*=h,_i.elements[10]*=h,t.setFromRotationMatrix(_i),n.x=a,n.y=o,n.z=l,this}makePerspective(e,t,n,i,s,a,o=Fi,l=!1){const c=this.elements,u=2*s/(t-e),h=2*s/(n-i),f=(t+e)/(t-e),d=(n+i)/(n-i);let g,_;if(l)g=s/(a-s),_=a*s/(a-s);else if(o===Fi)g=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===bl)g=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=Fi,l=!1){const c=this.elements,u=2/(t-e),h=2/(n-i),f=-(t+e)/(t-e),d=-(n+i)/(n-i);let g,_;if(l)g=1/(a-s),_=a/(a-s);else if(o===Fi)g=-2/(a-s),_=-(a+s)/(a-s);else if(o===bl)g=-1/(a-s),_=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=h,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=g,c[14]=_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};El.prototype.isMatrix4=!0;let Xt=El;const bs=new Y,_i=new Xt,Y_=new Y(0,0,0),q_=new Y(1,1,1),fr=new Y,Mo=new Y,Yn=new Y,Fd=new Xt,Od=new la;class us{constructor(e=0,t=0,n=0,i=us.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(ot(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ot(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(ot(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ot(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ot(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-ot(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:Ye("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Fd.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Fd,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Od.setFromEuler(this),this.setFromQuaternion(Od,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}us.DEFAULT_ORDER="XYZ";class xm{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let $_=0;const Bd=new Y,ys=new la,Vi=new Xt,So=new Y,ha=new Y,Z_=new Y,K_=new la,kd=new Y(1,0,0),zd=new Y(0,1,0),Gd=new Y(0,0,1),Vd={type:"added"},j_={type:"removed"},Es={type:"childadded",child:null},nc={type:"childremoved",child:null};class Hn extends ds{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:$_++}),this.uuid=oa(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Hn.DEFAULT_UP.clone();const e=new Y,t=new us,n=new la,i=new Y(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Xt},normalMatrix:{value:new Ke}}),this.matrix=new Xt,this.matrixWorld=new Xt,this.matrixAutoUpdate=Hn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xm,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ys.setFromAxisAngle(e,t),this.quaternion.multiply(ys),this}rotateOnWorldAxis(e,t){return ys.setFromAxisAngle(e,t),this.quaternion.premultiply(ys),this}rotateX(e){return this.rotateOnAxis(kd,e)}rotateY(e){return this.rotateOnAxis(zd,e)}rotateZ(e){return this.rotateOnAxis(Gd,e)}translateOnAxis(e,t){return Bd.copy(e).applyQuaternion(this.quaternion),this.position.add(Bd.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(kd,e)}translateY(e){return this.translateOnAxis(zd,e)}translateZ(e){return this.translateOnAxis(Gd,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Vi.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?So.copy(e):So.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ha.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Vi.lookAt(ha,So,this.up):Vi.lookAt(So,ha,this.up),this.quaternion.setFromRotationMatrix(Vi),i&&(Vi.extractRotation(i.matrixWorld),ys.setFromRotationMatrix(Vi),this.quaternion.premultiply(ys.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ht("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Vd),Es.child=e,this.dispatchEvent(Es),Es.child=null):ht("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(j_),nc.child=e,this.dispatchEvent(nc),nc.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Vi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Vi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Vi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Vd),Es.child=e,this.dispatchEvent(Es),Es.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ha,e,Z_),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ha,K_,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,i=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*i,s[13]+=n-s[1]*t-s[5]*n-s[9]*i,s[14]+=i-s[2]*t-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const s=this.children;for(let a=0,o=s.length;a<o;a++)s[a].updateWorldMatrix(!1,!0,n)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),h=a(e.shapes),f=a(e.skeletons),d=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=i,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Hn.DEFAULT_UP=new Y(0,1,0);Hn.DEFAULT_MATRIX_AUTO_UPDATE=!0;Hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class bo extends Hn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const J_={type:"move"};class ic{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new bo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const p=t.getJointPose(_,n),m=this._getHandJoint(c,_);p!==null&&(m.matrix.fromArray(p.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=p.radius),m.visible=p!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,g=.005;c.inputState.pinching&&f>d+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(J_)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new bo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const vm={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},dr={h:0,s:0,l:0},yo={h:0,s:0,l:0};function rc(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class ft{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ci){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ct.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=ct.workingColorSpace){return this.r=e,this.g=t,this.b=n,ct.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=ct.workingColorSpace){if(e=wf(e,1),t=ot(t,0,1),n=ot(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=rc(a,s,e+1/3),this.g=rc(a,s,e),this.b=rc(a,s,e-1/3)}return ct.colorSpaceToWorking(this,i),this}setStyle(e,t=ci){function n(s){s!==void 0&&parseFloat(s)<1&&Ye("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ye("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ye("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ci){const n=vm[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ye("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=tr(e.r),this.g=tr(e.g),this.b=tr(e.b),this}copyLinearToSRGB(e){return this.r=Ks(e.r),this.g=Ks(e.g),this.b=Ks(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ci){return ct.workingToColorSpace(_n.copy(this),e),Math.round(ot(_n.r*255,0,255))*65536+Math.round(ot(_n.g*255,0,255))*256+Math.round(ot(_n.b*255,0,255))}getHexString(e=ci){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ct.workingColorSpace){ct.workingToColorSpace(_n.copy(this),t);const n=_n.r,i=_n.g,s=_n.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case n:l=(i-s)/h+(i<s?6:0);break;case i:l=(s-n)/h+2;break;case s:l=(n-i)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=ct.workingColorSpace){return ct.workingToColorSpace(_n.copy(this),t),e.r=_n.r,e.g=_n.g,e.b=_n.b,e}getStyle(e=ci){ct.workingToColorSpace(_n.copy(this),e);const t=_n.r,n=_n.g,i=_n.b;return e!==ci?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(dr),this.setHSL(dr.h+e,dr.s+t,dr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(dr),e.getHSL(yo);const n=Ga(dr.h,yo.h,t),i=Ga(dr.s,yo.s,t),s=Ga(dr.l,yo.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const _n=new ft;ft.NAMES=vm;class Q_ extends Hn{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 us,this.environmentIntensity=1,this.environmentRotation=new us,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const xi=new Y,Hi=new Y,sc=new Y,Wi=new Y,Ts=new Y,ws=new Y,Hd=new Y,ac=new Y,oc=new Y,lc=new Y,cc=new Bt,uc=new Bt,fc=new Bt;class Si{constructor(e=new Y,t=new Y,n=new Y){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),xi.subVectors(e,t),i.cross(xi);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){xi.subVectors(i,t),Hi.subVectors(n,t),sc.subVectors(e,t);const a=xi.dot(xi),o=xi.dot(Hi),l=xi.dot(sc),c=Hi.dot(Hi),u=Hi.dot(sc),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const f=1/h,d=(c*l-o*u)*f,g=(a*u-o*l)*f;return s.set(1-d-g,g,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Wi)===null?!1:Wi.x>=0&&Wi.y>=0&&Wi.x+Wi.y<=1}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,Wi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Wi.x),l.addScaledVector(a,Wi.y),l.addScaledVector(o,Wi.z),l)}static getInterpolatedAttribute(e,t,n,i,s,a){return cc.setScalar(0),uc.setScalar(0),fc.setScalar(0),cc.fromBufferAttribute(e,t),uc.fromBufferAttribute(e,n),fc.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(cc,s.x),a.addScaledVector(uc,s.y),a.addScaledVector(fc,s.z),a}static isFrontFacing(e,t,n,i){return xi.subVectors(n,t),Hi.subVectors(e,t),xi.cross(Hi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return xi.subVectors(this.c,this.b),Hi.subVectors(this.a,this.b),xi.cross(Hi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Si.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Si.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Si.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Si.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Si.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;Ts.subVectors(i,n),ws.subVectors(s,n),ac.subVectors(e,n);const l=Ts.dot(ac),c=ws.dot(ac);if(l<=0&&c<=0)return t.copy(n);oc.subVectors(e,i);const u=Ts.dot(oc),h=ws.dot(oc);if(u>=0&&h<=u)return t.copy(i);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Ts,a);lc.subVectors(e,s);const d=Ts.dot(lc),g=ws.dot(lc);if(g>=0&&d<=g)return t.copy(s);const _=d*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(ws,o);const p=u*g-d*h;if(p<=0&&h-u>=0&&d-g>=0)return Hd.subVectors(s,i),o=(h-u)/(h-u+(d-g)),t.copy(i).addScaledVector(Hd,o);const m=1/(p+_+f);return a=_*m,o=f*m,t.copy(n).addScaledVector(Ts,a).addScaledVector(ws,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class no{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(vi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(vi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=vi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,vi):vi.fromBufferAttribute(s,a),vi.applyMatrix4(e.matrixWorld),this.expandByPoint(vi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Eo.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Eo.copy(n.boundingBox)),Eo.applyMatrix4(e.matrixWorld),this.union(Eo)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,vi),vi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(pa),To.subVectors(this.max,pa),As.subVectors(e.a,pa),Rs.subVectors(e.b,pa),Cs.subVectors(e.c,pa),hr.subVectors(Rs,As),pr.subVectors(Cs,Rs),Br.subVectors(As,Cs);let t=[0,-hr.z,hr.y,0,-pr.z,pr.y,0,-Br.z,Br.y,hr.z,0,-hr.x,pr.z,0,-pr.x,Br.z,0,-Br.x,-hr.y,hr.x,0,-pr.y,pr.x,0,-Br.y,Br.x,0];return!dc(t,As,Rs,Cs,To)||(t=[1,0,0,0,1,0,0,0,1],!dc(t,As,Rs,Cs,To))?!1:(wo.crossVectors(hr,pr),t=[wo.x,wo.y,wo.z],dc(t,As,Rs,Cs,To))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(vi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Xi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Xi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Xi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Xi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Xi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Xi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Xi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Xi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Xi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Xi=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],vi=new Y,Eo=new no,As=new Y,Rs=new Y,Cs=new Y,hr=new Y,pr=new Y,Br=new Y,pa=new Y,To=new Y,wo=new Y,kr=new Y;function dc(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){kr.fromArray(r,s);const o=i.x*Math.abs(kr.x)+i.y*Math.abs(kr.y)+i.z*Math.abs(kr.z),l=e.dot(kr),c=t.dot(kr),u=n.dot(kr);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const $t=new Y,Ao=new gt;let ex=0;class Mn extends ds{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ex++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Rd,this.updateRanges=[],this.gpuType=Ui,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Ao.fromBufferAttribute(this,t),Ao.applyMatrix3(e),this.setXY(t,Ao.x,Ao.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)$t.fromBufferAttribute(this,t),$t.applyMatrix3(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)$t.fromBufferAttribute(this,t),$t.applyMatrix4(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)$t.fromBufferAttribute(this,t),$t.applyNormalMatrix(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)$t.fromBufferAttribute(this,t),$t.transformDirection(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Os(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Cn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Os(t,this.array)),t}setX(e,t){return this.normalized&&(t=Cn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Os(t,this.array)),t}setY(e,t){return this.normalized&&(t=Cn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Os(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Cn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Os(t,this.array)),t}setW(e,t){return this.normalized&&(t=Cn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Cn(t,this.array),n=Cn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Cn(t,this.array),n=Cn(n,this.array),i=Cn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Cn(t,this.array),n=Cn(n,this.array),i=Cn(i,this.array),s=Cn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Rd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Mm extends Mn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Sm extends Mn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nr extends Mn{constructor(e,t,n){super(new Float32Array(e),t,n)}}const tx=new no,ma=new Y,hc=new Y;class Pl{constructor(e=new Y,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):tx.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ma.subVectors(e,this.center);const t=ma.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ma,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(hc.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ma.copy(e.center).add(hc)),this.expandByPoint(ma.copy(e.center).sub(hc))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let nx=0;const oi=new Xt,pc=new Hn,Ps=new Y,qn=new no,ga=new no,an=new Y;class Ei extends ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:nx++}),this.uuid=oa(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(M_(e)?Sm:Mm)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ke().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return oi.makeRotationFromQuaternion(e),this.applyMatrix4(oi),this}rotateX(e){return oi.makeRotationX(e),this.applyMatrix4(oi),this}rotateY(e){return oi.makeRotationY(e),this.applyMatrix4(oi),this}rotateZ(e){return oi.makeRotationZ(e),this.applyMatrix4(oi),this}translate(e,t,n){return oi.makeTranslation(e,t,n),this.applyMatrix4(oi),this}scale(e,t,n){return oi.makeScale(e,t,n),this.applyMatrix4(oi),this}lookAt(e){return pc.lookAt(e),pc.updateMatrix(),this.applyMatrix4(pc.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ps).negate(),this.translate(Ps.x,Ps.y,Ps.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new nr(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&Ye("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new no);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ht("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];qn.setFromBufferAttribute(s),this.morphTargetsRelative?(an.addVectors(this.boundingBox.min,qn.min),this.boundingBox.expandByPoint(an),an.addVectors(this.boundingBox.max,qn.max),this.boundingBox.expandByPoint(an)):(this.boundingBox.expandByPoint(qn.min),this.boundingBox.expandByPoint(qn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ht('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Pl);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ht("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Y,1/0);return}if(e){const n=this.boundingSphere.center;if(qn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];ga.setFromBufferAttribute(o),this.morphTargetsRelative?(an.addVectors(qn.min,ga.min),qn.expandByPoint(an),an.addVectors(qn.max,ga.max),qn.expandByPoint(an)):(qn.expandByPoint(ga.min),qn.expandByPoint(ga.max))}qn.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)an.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(an));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)an.fromBufferAttribute(o,c),l&&(Ps.fromBufferAttribute(e,c),an.add(Ps)),i=Math.max(i,n.distanceToSquared(an))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&ht('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){ht("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;let a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new Mn(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));const o=[],l=[];for(let v=0;v<n.count;v++)o[v]=new Y,l[v]=new Y;const c=new Y,u=new Y,h=new Y,f=new gt,d=new gt,g=new gt,_=new Y,p=new Y;function m(v,E,C){c.fromBufferAttribute(n,v),u.fromBufferAttribute(n,E),h.fromBufferAttribute(n,C),f.fromBufferAttribute(s,v),d.fromBufferAttribute(s,E),g.fromBufferAttribute(s,C),u.sub(c),h.sub(c),d.sub(f),g.sub(f);const L=1/(d.x*g.y-g.x*d.y);isFinite(L)&&(_.copy(u).multiplyScalar(g.y).addScaledVector(h,-d.y).multiplyScalar(L),p.copy(h).multiplyScalar(d.x).addScaledVector(u,-g.x).multiplyScalar(L),o[v].add(_),o[E].add(_),o[C].add(_),l[v].add(p),l[E].add(p),l[C].add(p))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let v=0,E=b.length;v<E;++v){const C=b[v],L=C.start,N=C.count;for(let q=L,W=L+N;q<W;q+=3)m(e.getX(q+0),e.getX(q+1),e.getX(q+2))}const w=new Y,M=new Y,y=new Y,T=new Y;function A(v){y.fromBufferAttribute(i,v),T.copy(y);const E=o[v];w.copy(E),w.sub(y.multiplyScalar(y.dot(E))).normalize(),M.crossVectors(T,E);const L=M.dot(l[v])<0?-1:1;a.setXYZW(v,w.x,w.y,w.z,L)}for(let v=0,E=b.length;v<E;++v){const C=b[v],L=C.start,N=C.count;for(let q=L,W=L+N;q<W;q+=3)A(e.getX(q+0)),A(e.getX(q+1)),A(e.getX(q+2))}this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Mn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const i=new Y,s=new Y,a=new Y,o=new Y,l=new Y,c=new Y,u=new Y,h=new Y;if(e)for(let f=0,d=e.count;f<d;f+=3){const g=e.getX(f+0),_=e.getX(f+1),p=e.getX(f+2);i.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,p),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,p),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(p,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),u.subVectors(a,s),h.subVectors(i,s),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)an.fromBufferAttribute(e,t),an.normalize(),e.setXYZ(t,an.x,an.y,an.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,h=o.normalized,f=new c.constructor(l.length*u);let d=0,g=0;for(let _=0,p=l.length;_<p;_++){o.isInterleavedBufferAttribute?d=l[_]*o.data.stride+o.offset:d=l[_]*u;for(let m=0;m<u;m++)f[g++]=c[d++]}return new Mn(f,u,h)}if(this.index===null)return Ye("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ei,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=e(f,n);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){const d=c[h];u.push(d.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}let ix=0;class io extends ds{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ix++}),this.uuid=oa(),this.name="",this.type="Material",this.blending=$s,this.side=Nr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Qc,this.blendDst=eu,this.blendEquation=Yr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ft(0,0,0),this.blendAlpha=0,this.depthFunc=ia,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ad,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ms,this.stencilZFail=Ms,this.stencilZPass=Ms,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Ye(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Ye(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector2&&n&&n.isVector2||i&&i.isEuler&&n&&n.isEuler||i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==$s&&(n.blending=this.blending),this.side!==Nr&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Qc&&(n.blendSrc=this.blendSrc),this.blendDst!==eu&&(n.blendDst=this.blendDst),this.blendEquation!==Yr&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ia&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Ad&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ms&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ms&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ms&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new ft().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new gt().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new gt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const Yi=new Y,mc=new Y,Ro=new Y,mr=new Y,gc=new Y,Co=new Y,_c=new Y;class bm{constructor(e=new Y,t=new Y(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Yi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Yi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Yi.copy(this.origin).addScaledVector(this.direction,t),Yi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){mc.copy(e).add(t).multiplyScalar(.5),Ro.copy(t).sub(e).normalize(),mr.copy(this.origin).sub(mc);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ro),o=mr.dot(this.direction),l=-mr.dot(Ro),c=mr.lengthSq(),u=Math.abs(1-a*a);let h,f,d,g;if(u>0)if(h=a*l-o,f=a*o-l,g=s*u,h>=0)if(f>=-g)if(f<=g){const _=1/u;h*=_,f*=_,d=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;else f<=-g?(h=Math.max(0,-(-a*s+o)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=g?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=a>0?-s:s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(mc).addScaledVector(Ro,f),d}intersectSphere(e,t){Yi.subVectors(e.center,this.origin);const n=Yi.dot(this.direction),i=Yi.dot(Yi)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Yi)!==null}intersectTriangle(e,t,n,i,s){gc.subVectors(t,e),Co.subVectors(n,e),_c.crossVectors(gc,Co);let a=this.direction.dot(_c),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;mr.subVectors(this.origin,e);const l=o*this.direction.dot(Co.crossVectors(mr,Co));if(l<0)return null;const c=o*this.direction.dot(gc.cross(mr));if(c<0||l+c>a)return null;const u=-o*mr.dot(_c);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ym extends io{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ft(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 us,this.combine=em,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Wd=new Xt,zr=new bm,Po=new Pl,Xd=new Y,Do=new Y,Lo=new Y,No=new Y,xc=new Y,Io=new Y,Yd=new Y,Uo=new Y;class or extends Hn{constructor(e=new Ei,t=new ym){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){Io.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],h=s[l];u!==0&&(xc.fromBufferAttribute(h,e),a?Io.addScaledVector(xc,u):Io.addScaledVector(xc.sub(t),u))}t.add(Io)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Po.copy(n.boundingSphere),Po.applyMatrix4(s),zr.copy(e.ray).recast(e.near),!(Po.containsPoint(zr.origin)===!1&&(zr.intersectSphere(Po,Xd)===null||zr.origin.distanceToSquared(Xd)>(e.far-e.near)**2))&&(Wd.copy(s).invert(),zr.copy(e.ray).applyMatrix4(Wd),!(n.boundingBox!==null&&zr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,zr)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const p=f[g],m=a[p.materialIndex],b=Math.max(p.start,d.start),w=Math.min(o.count,Math.min(p.start+p.count,d.start+d.count));for(let M=b,y=w;M<y;M+=3){const T=o.getX(M),A=o.getX(M+1),v=o.getX(M+2);i=Fo(this,m,e,n,c,u,h,T,A,v),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=p.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),_=Math.min(o.count,d.start+d.count);for(let p=g,m=_;p<m;p+=3){const b=o.getX(p),w=o.getX(p+1),M=o.getX(p+2);i=Fo(this,a,e,n,c,u,h,b,w,M),i&&(i.faceIndex=Math.floor(p/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const p=f[g],m=a[p.materialIndex],b=Math.max(p.start,d.start),w=Math.min(l.count,Math.min(p.start+p.count,d.start+d.count));for(let M=b,y=w;M<y;M+=3){const T=M,A=M+1,v=M+2;i=Fo(this,m,e,n,c,u,h,T,A,v),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=p.materialIndex,t.push(i))}}else{const g=Math.max(0,d.start),_=Math.min(l.count,d.start+d.count);for(let p=g,m=_;p<m;p+=3){const b=p,w=p+1,M=p+2;i=Fo(this,a,e,n,c,u,h,b,w,M),i&&(i.faceIndex=Math.floor(p/3),t.push(i))}}}}function rx(r,e,t,n,i,s,a,o){let l;if(e.side===Vn?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side===Nr,o),l===null)return null;Uo.copy(o),Uo.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Uo);return c<t.near||c>t.far?null:{distance:c,point:Uo.clone(),object:r}}function Fo(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,Do),r.getVertexPosition(l,Lo),r.getVertexPosition(c,No);const u=rx(r,e,t,n,Do,Lo,No,Yd);if(u){const h=new Y;Si.getBarycoord(Yd,Do,Lo,No,h),i&&(u.uv=Si.getInterpolatedAttribute(i,o,l,c,h,new gt)),s&&(u.uv1=Si.getInterpolatedAttribute(s,o,l,c,h,new gt)),a&&(u.normal=Si.getInterpolatedAttribute(a,o,l,c,h,new Y),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new Y,materialIndex:0};Si.getNormal(Do,Lo,No,f.normal),u.face=f,u.barycoord=h}return u}class sx extends Un{constructor(e=null,t=1,n=1,i,s,a,o,l,c=dn,u=dn,h,f){super(null,a,o,l,c,u,i,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const vc=new Y,ax=new Y,ox=new Ke;class Xr{constructor(e=new Y(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=vc.subVectors(n,t).cross(ax.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){const i=e.delta(vc),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ox.getNormalMatrix(e),i=this.coplanarPoint(vc).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Gr=new Pl,lx=new gt(.5,.5),Oo=new Y;class Em{constructor(e=new Xr,t=new Xr,n=new Xr,i=new Xr,s=new Xr,a=new Xr){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Fi,n=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],u=s[4],h=s[5],f=s[6],d=s[7],g=s[8],_=s[9],p=s[10],m=s[11],b=s[12],w=s[13],M=s[14],y=s[15];if(i[0].setComponents(c-a,d-u,m-g,y-b).normalize(),i[1].setComponents(c+a,d+u,m+g,y+b).normalize(),i[2].setComponents(c+o,d+h,m+_,y+w).normalize(),i[3].setComponents(c-o,d-h,m-_,y-w).normalize(),n)i[4].setComponents(l,f,p,M).normalize(),i[5].setComponents(c-l,d-f,m-p,y-M).normalize();else if(i[4].setComponents(c-l,d-f,m-p,y-M).normalize(),t===Fi)i[5].setComponents(c+l,d+f,m+p,y+M).normalize();else if(t===bl)i[5].setComponents(l,f,p,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Gr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Gr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Gr)}intersectsSprite(e){Gr.center.set(0,0,0);const t=lx.distanceTo(e.center);return Gr.radius=.7071067811865476+t,Gr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Gr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Oo.x=i.normal.x>0?e.max.x:e.min.x,Oo.y=i.normal.y>0?e.max.y:e.min.y,Oo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Oo)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class cx extends io{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ft(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const qd=new Xt,zu=new bm,Bo=new Pl,ko=new Y;class ux extends Hn{constructor(e=new Ei,t=new cx){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Bo.copy(n.boundingSphere),Bo.applyMatrix4(i),Bo.radius+=s,e.ray.intersectsSphere(Bo)===!1)return;qd.copy(i).invert(),zu.copy(e.ray).applyMatrix4(qd);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,a.start),d=Math.min(c.count,a.start+a.count);for(let g=f,_=d;g<_;g++){const p=c.getX(g);ko.fromBufferAttribute(h,p),$d(ko,p,l,i,e,t,this)}}else{const f=Math.max(0,a.start),d=Math.min(h.count,a.start+a.count);for(let g=f,_=d;g<_;g++)ko.fromBufferAttribute(h,g),$d(ko,g,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function $d(r,e,t,n,i,s,a){const o=zu.distanceSqToPoint(r);if(o<t){const l=new Y;zu.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Tm extends Un{constructor(e=[],t=ls,n,i,s,a,o,l,c,u){super(e,t,n,i,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class sa extends Un{constructor(e,t,n=Gi,i,s,a,o=dn,l=dn,c,u=ar,h=1){if(u!==ar&&u!==jr)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:h};super(f,i,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Af(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class fx extends sa{constructor(e,t=Gi,n=ls,i,s,a=dn,o=dn,l,c=ar){const u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,t,n,i,s,a,o,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class wm extends Un{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ro extends Ei{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],h=[];let f=0,d=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,i,a,2),g("x","z","y",1,-1,e,n,-t,i,a,3),g("x","y","z",1,-1,e,t,n,i,s,4),g("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new nr(c,3)),this.setAttribute("normal",new nr(u,3)),this.setAttribute("uv",new nr(h,2));function g(_,p,m,b,w,M,y,T,A,v,E){const C=M/A,L=y/v,N=M/2,q=y/2,W=T/2,B=A+1,G=v+1;let I=0,$=0;const j=new Y;for(let D=0;D<G;D++){const se=D*L-q;for(let he=0;he<B;he++){const Ve=he*C-N;j[_]=Ve*b,j[p]=se*w,j[m]=W,c.push(j.x,j.y,j.z),j[_]=0,j[p]=0,j[m]=T>0?1:-1,u.push(j.x,j.y,j.z),h.push(he/A),h.push(1-D/v),I+=1}}for(let D=0;D<v;D++)for(let se=0;se<A;se++){const he=f+se+B*D,Ve=f+se+B*(D+1),He=f+(se+1)+B*(D+1),De=f+(se+1)+B*D;l.push(he,Ve,De),l.push(Ve,He,De),$+=6}o.addGroup(d,$,E),d+=$,f+=I}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ro(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Dl extends Ei{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,u=l+1,h=e/o,f=t/l,d=[],g=[],_=[],p=[];for(let m=0;m<u;m++){const b=m*f-a;for(let w=0;w<c;w++){const M=w*h-s;g.push(M,-b,0),_.push(0,0,1),p.push(w/o),p.push(1-m/l)}}for(let m=0;m<l;m++)for(let b=0;b<o;b++){const w=b+c*m,M=b+c*(m+1),y=b+1+c*(m+1),T=b+1+c*m;d.push(w,M,T),d.push(M,y,T)}this.setIndex(d),this.setAttribute("position",new nr(g,3)),this.setAttribute("normal",new nr(_,3)),this.setAttribute("uv",new nr(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Dl(e.width,e.height,e.widthSegments,e.heightSegments)}}function aa(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];if(Zd(i))i.isRenderTargetTexture?(Ye("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(Zd(i[0])){const s=[];for(let a=0,o=i.length;a<o;a++)s[a]=i[a].clone();e[t][n]=s}else e[t][n]=i.slice();else e[t][n]=i}}return e}function Pn(r){const e={};for(let t=0;t<r.length;t++){const n=aa(r[t]);for(const i in n)e[i]=n[i]}return e}function Zd(r){return r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)}function dx(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function Am(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ct.workingColorSpace}const hx={clone:aa,merge:Pn};var px=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
3
  }`,mx=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5
- }`;class yi extends no{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=px,this.fragmentShader=mx,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=sa(e.uniforms),this.uniformsGroups=dx(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new dt().setHex(i.value);break;case"v2":this.uniforms[n].value=new mt().fromArray(i.value);break;case"v3":this.uniforms[n].value=new q().fromArray(i.value);break;case"v4":this.uniforms[n].value=new Bt().fromArray(i.value);break;case"m3":this.uniforms[n].value=new Ke().fromArray(i.value);break;case"m4":this.uniforms[n].value=new Xt().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class gx extends yi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class _x extends no{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=d0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class xx extends no{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const ko=new q,zo=new oa,Ai=new q;class Rm extends Hn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Xt,this.projectionMatrix=new Xt,this.projectionMatrixInverse=new Xt,this.coordinateSystem=Fi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(ko,zo,Ai),Ai.x===1&&Ai.y===1&&Ai.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ko,zo,Ai.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(ko,zo,Ai),Ai.x===1&&Ai.y===1&&Ai.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ko,zo,Ai.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const gr=new q,Zd=new mt,jd=new mt;class di extends Rm{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Qa*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ka*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Qa*2*Math.atan(Math.tan(ka*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){gr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(gr.x,gr.y).multiplyScalar(-e/gr.z),gr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(gr.x,gr.y).multiplyScalar(-e/gr.z)}getViewSize(e,t){return this.getViewBounds(e,Zd,jd),t.subVectors(jd,Zd)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ka*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Cm extends Rm{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Ps=-90,Ds=1;class vx extends Hn{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new di(Ps,Ds,e,t);i.layers=this.layers,this.add(i);const s=new di(Ps,Ds,e,t);s.layers=this.layers,this.add(s);const a=new di(Ps,Ds,e,t);a.layers=this.layers,this.add(a);const o=new di(Ps,Ds,e,t);o.layers=this.layers,this.add(o);const l=new di(Ps,Ds,e,t);l.layers=this.layers,this.add(l);const c=new di(Ps,Ds,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Fi)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Sl)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let p=!1;e.isWebGLRenderer===!0?p=e.state.buffers.depth.getReversed():p=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(h,f,d),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class Mx extends di{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Sx{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Ye("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const Nf=class Nf{constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}};Nf.prototype.isMatrix2=!0;let Jd=Nf;function Qd(r,e,t,n){const i=bx(n);switch(t){case hm:return r*e;case mm:return r*e/i.components*i.byteLength;case Mf:return r*e/i.components*i.byteLength;case ls:return r*e*2/i.components*i.byteLength;case Sf:return r*e*2/i.components*i.byteLength;case pm:return r*e*3/i.components*i.byteLength;case bi:return r*e*4/i.components*i.byteLength;case bf:return r*e*4/i.components*i.byteLength;case tl:case nl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case il:case rl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case uu:case du:return Math.max(r,16)*Math.max(e,8)/4;case cu:case fu:return Math.max(r,8)*Math.max(e,8)/2;case hu:case pu:case gu:case _u:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case mu:case _l:case xu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case vu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Mu:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Su:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case bu:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case yu:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Eu:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Tu:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case wu:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Au:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Ru:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Cu:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Pu:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Du:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Lu:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Nu:case Iu:case Uu:return Math.ceil(r/4)*Math.ceil(e/4)*16;case Fu:case Ou:return Math.ceil(r/4)*Math.ceil(e/4)*8;case xl:case Bu:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bx(r){switch(r){case hi:case cm:return{byteLength:1,components:1};case ja:case um:case sr:return{byteLength:2,components:1};case xf:case vf:return{byteLength:2,components:4};case Gi:case _f:case Ui:return{byteLength:4,components:1};case fm:case dm:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${r}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:gf}}));typeof window<"u"&&(window.__THREE__?Ye("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=gf);function Pm(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&r!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r!==null&&r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function yx(r){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,h=c.byteLength,f=r.createBuffer();r.bindBuffer(l,f),r.bufferData(l,c,u),o.onUploadCallback();let d;if(c instanceof Float32Array)d=r.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)d=r.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?d=r.HALF_FLOAT:d=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)d=r.SHORT;else if(c instanceof Uint32Array)d=r.UNSIGNED_INT;else if(c instanceof Int32Array)d=r.INT;else if(c instanceof Int8Array)d=r.BYTE;else if(c instanceof Uint8Array)d=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)d=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:d,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function n(o,l,c){const u=l.array,h=l.updateRanges;if(r.bindBuffer(c,o),h.length===0)r.bufferSubData(c,0,u);else{h.sort((d,g)=>d.start-g.start);let f=0;for(let d=1;d<h.length;d++){const g=h[f],_=h[d];_.start<=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++f,h[f]=_)}h.length=f+1;for(let d=0,g=h.length;d<g;d++){const _=h[d];r.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(r.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:i,remove:s,update:a}}var Ex=`#ifdef USE_ALPHAHASH
5
+ }`;class yi extends io{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=px,this.fragmentShader=mx,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=aa(e.uniforms),this.uniformsGroups=dx(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new ft().setHex(i.value);break;case"v2":this.uniforms[n].value=new gt().fromArray(i.value);break;case"v3":this.uniforms[n].value=new Y().fromArray(i.value);break;case"v4":this.uniforms[n].value=new Bt().fromArray(i.value);break;case"m3":this.uniforms[n].value=new Ke().fromArray(i.value);break;case"m4":this.uniforms[n].value=new Xt().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class gx extends yi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class _x extends io{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=d_,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class xx extends io{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const zo=new Y,Go=new la,Ai=new Y;class Rm extends Hn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Xt,this.projectionMatrix=new Xt,this.projectionMatrixInverse=new Xt,this.coordinateSystem=Fi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(zo,Go,Ai),Ai.x===1&&Ai.y===1&&Ai.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(zo,Go,Ai.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(zo,Go,Ai),Ai.x===1&&Ai.y===1&&Ai.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(zo,Go,Ai.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const gr=new Y,Kd=new gt,jd=new gt;class di extends Rm{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=eo*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(za*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return eo*2*Math.atan(Math.tan(za*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){gr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(gr.x,gr.y).multiplyScalar(-e/gr.z),gr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(gr.x,gr.y).multiplyScalar(-e/gr.z)}getViewSize(e,t){return this.getViewBounds(e,Kd,jd),t.subVectors(jd,Kd)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(za*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Cm extends Rm{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Ds=-90,Ls=1;class vx extends Hn{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new di(Ds,Ls,e,t);i.layers=this.layers,this.add(i);const s=new di(Ds,Ls,e,t);s.layers=this.layers,this.add(s);const a=new di(Ds,Ls,e,t);a.layers=this.layers,this.add(a);const o=new di(Ds,Ls,e,t);o.layers=this.layers,this.add(o);const l=new di(Ds,Ls,e,t);l.layers=this.layers,this.add(l);const c=new di(Ds,Ls,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Fi)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===bl)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let p=!1;e.isWebGLRenderer===!0?p=e.state.buffers.depth.getReversed():p=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),p&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(h,f,d),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class Mx extends di{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Sx{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Ye("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const If=class If{constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}};If.prototype.isMatrix2=!0;let Jd=If;function Qd(r,e,t,n){const i=bx(n);switch(t){case hm:return r*e;case mm:return r*e/i.components*i.byteLength;case Sf:return r*e/i.components*i.byteLength;case cs:return r*e*2/i.components*i.byteLength;case bf:return r*e*2/i.components*i.byteLength;case pm:return r*e*3/i.components*i.byteLength;case bi:return r*e*4/i.components*i.byteLength;case yf:return r*e*4/i.components*i.byteLength;case nl:case il:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case rl:case sl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case fu:case hu:return Math.max(r,16)*Math.max(e,8)/4;case uu:case du:return Math.max(r,8)*Math.max(e,8)/2;case pu:case mu:case _u:case xu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case gu:case xl:case vu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Mu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Su:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case bu:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case yu:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Eu:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Tu:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case wu:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Au:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Ru:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Cu:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Pu:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Du:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Lu:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Nu:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Iu:case Uu:case Fu:return Math.ceil(r/4)*Math.ceil(e/4)*16;case Ou:case Bu:return Math.ceil(r/4)*Math.ceil(e/4)*8;case vl:case ku:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bx(r){switch(r){case hi:case cm:return{byteLength:1,components:1};case Ja:case um:case sr:return{byteLength:2,components:1};case vf:case Mf:return{byteLength:2,components:4};case Gi:case xf:case Ui:return{byteLength:4,components:1};case fm:case dm:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${r}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:_f}}));typeof window<"u"&&(window.__THREE__?Ye("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=_f);function Pm(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&r!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r!==null&&r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function yx(r){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,h=c.byteLength,f=r.createBuffer();r.bindBuffer(l,f),r.bufferData(l,c,u),o.onUploadCallback();let d;if(c instanceof Float32Array)d=r.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)d=r.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?d=r.HALF_FLOAT:d=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)d=r.SHORT;else if(c instanceof Uint32Array)d=r.UNSIGNED_INT;else if(c instanceof Int32Array)d=r.INT;else if(c instanceof Int8Array)d=r.BYTE;else if(c instanceof Uint8Array)d=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)d=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:d,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function n(o,l,c){const u=l.array,h=l.updateRanges;if(r.bindBuffer(c,o),h.length===0)r.bufferSubData(c,0,u);else{h.sort((d,g)=>d.start-g.start);let f=0;for(let d=1;d<h.length;d++){const g=h[f],_=h[d];_.start<=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++f,h[f]=_)}h.length=f+1;for(let d=0,g=h.length;d<g;d++){const _=h[d];r.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(r.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:i,remove:s,update:a}}var Ex=`#ifdef USE_ALPHAHASH
6
6
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7
7
  #endif`,Tx=`#ifdef USE_ALPHAHASH
8
8
  const float ALPHA_HASH_SCALE = 0.05;
@@ -444,7 +444,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
444
444
  return vec4( mix( color0, color1, mipF ), 1.0 );
445
445
  }
446
446
  }
447
- #endif`,Kx=`vec3 transformedNormal = objectNormal;
447
+ #endif`,Zx=`vec3 transformedNormal = objectNormal;
448
448
  #ifdef USE_TANGENT
449
449
  vec3 transformedTangent = objectTangent;
450
450
  #endif
@@ -470,7 +470,7 @@ transformedNormal = normalMatrix * transformedNormal;
470
470
  #endif
471
471
  #ifdef USE_TANGENT
472
472
  transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
473
- #endif`,Zx=`#ifdef USE_DISPLACEMENTMAP
473
+ #endif`,Kx=`#ifdef USE_DISPLACEMENTMAP
474
474
  uniform sampler2D displacementMap;
475
475
  uniform float displacementScale;
476
476
  uniform float displacementBias;
@@ -1640,11 +1640,11 @@ vec3 nonPerturbedNormal = normal;`,Hv=`#ifdef USE_NORMALMAP_OBJECTSPACE
1640
1640
  }
1641
1641
  #endif`,$v=`#ifdef USE_CLEARCOAT
1642
1642
  vec3 clearcoatNormal = nonPerturbedNormal;
1643
- #endif`,Kv=`#ifdef USE_CLEARCOAT_NORMALMAP
1643
+ #endif`,Zv=`#ifdef USE_CLEARCOAT_NORMALMAP
1644
1644
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1645
1645
  clearcoatMapN.xy *= clearcoatNormalScale;
1646
1646
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1647
- #endif`,Zv=`#ifdef USE_CLEARCOATMAP
1647
+ #endif`,Kv=`#ifdef USE_CLEARCOATMAP
1648
1648
  uniform sampler2D clearcoatMap;
1649
1649
  #endif
1650
1650
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -3310,7 +3310,7 @@ void main() {
3310
3310
  #ifdef USE_TRANSMISSION
3311
3311
  vWorldPosition = worldPosition.xyz;
3312
3312
  #endif
3313
- }`,KM=`#define STANDARD
3313
+ }`,ZM=`#define STANDARD
3314
3314
  #ifdef PHYSICAL
3315
3315
  #define IOR
3316
3316
  #define USE_SPECULAR
@@ -3435,7 +3435,7 @@ void main() {
3435
3435
  #include <fog_fragment>
3436
3436
  #include <premultiplied_alpha_fragment>
3437
3437
  #include <dithering_fragment>
3438
- }`,ZM=`#define TOON
3438
+ }`,KM=`#define TOON
3439
3439
  varying vec3 vViewPosition;
3440
3440
  #include <common>
3441
3441
  #include <batching_pars_vertex>
@@ -3668,7 +3668,7 @@ void main() {
3668
3668
  #include <tonemapping_fragment>
3669
3669
  #include <colorspace_fragment>
3670
3670
  #include <fog_fragment>
3671
- }`,Qe={alphahash_fragment:Ex,alphahash_pars_fragment:Tx,alphamap_fragment:wx,alphamap_pars_fragment:Ax,alphatest_fragment:Rx,alphatest_pars_fragment:Cx,aomap_fragment:Px,aomap_pars_fragment:Dx,batching_pars_vertex:Lx,batching_vertex:Nx,begin_vertex:Ix,beginnormal_vertex:Ux,bsdfs:Fx,iridescence_fragment:Ox,bumpmap_pars_fragment:Bx,clipping_planes_fragment:kx,clipping_planes_pars_fragment:zx,clipping_planes_pars_vertex:Gx,clipping_planes_vertex:Vx,color_fragment:Hx,color_pars_fragment:Wx,color_pars_vertex:Xx,color_vertex:Yx,common:qx,cube_uv_reflection_fragment:$x,defaultnormal_vertex:Kx,displacementmap_pars_vertex:Zx,displacementmap_vertex:jx,emissivemap_fragment:Jx,emissivemap_pars_fragment:Qx,colorspace_fragment:ev,colorspace_pars_fragment:tv,envmap_fragment:nv,envmap_common_pars_fragment:iv,envmap_pars_fragment:rv,envmap_pars_vertex:sv,envmap_physical_pars_fragment:gv,envmap_vertex:av,fog_vertex:ov,fog_pars_vertex:lv,fog_fragment:cv,fog_pars_fragment:uv,gradientmap_pars_fragment:fv,lightmap_pars_fragment:dv,lights_lambert_fragment:hv,lights_lambert_pars_fragment:pv,lights_pars_begin:mv,lights_toon_fragment:_v,lights_toon_pars_fragment:xv,lights_phong_fragment:vv,lights_phong_pars_fragment:Mv,lights_physical_fragment:Sv,lights_physical_pars_fragment:bv,lights_fragment_begin:yv,lights_fragment_maps:Ev,lights_fragment_end:Tv,lightprobes_pars_fragment:wv,logdepthbuf_fragment:Av,logdepthbuf_pars_fragment:Rv,logdepthbuf_pars_vertex:Cv,logdepthbuf_vertex:Pv,map_fragment:Dv,map_pars_fragment:Lv,map_particle_fragment:Nv,map_particle_pars_fragment:Iv,metalnessmap_fragment:Uv,metalnessmap_pars_fragment:Fv,morphinstance_vertex:Ov,morphcolor_vertex:Bv,morphnormal_vertex:kv,morphtarget_pars_vertex:zv,morphtarget_vertex:Gv,normal_fragment_begin:Vv,normal_fragment_maps:Hv,normal_pars_fragment:Wv,normal_pars_vertex:Xv,normal_vertex:Yv,normalmap_pars_fragment:qv,clearcoat_normal_fragment_begin:$v,clearcoat_normal_fragment_maps:Kv,clearcoat_pars_fragment:Zv,iridescence_pars_fragment:jv,opaque_fragment:Jv,packing:Qv,premultiplied_alpha_fragment:eM,project_vertex:tM,dithering_fragment:nM,dithering_pars_fragment:iM,roughnessmap_fragment:rM,roughnessmap_pars_fragment:sM,shadowmap_pars_fragment:aM,shadowmap_pars_vertex:oM,shadowmap_vertex:lM,shadowmask_pars_fragment:cM,skinbase_vertex:uM,skinning_pars_vertex:fM,skinning_vertex:dM,skinnormal_vertex:hM,specularmap_fragment:pM,specularmap_pars_fragment:mM,tonemapping_fragment:gM,tonemapping_pars_fragment:_M,transmission_fragment:xM,transmission_pars_fragment:vM,uv_pars_fragment:MM,uv_pars_vertex:SM,uv_vertex:bM,worldpos_vertex:yM,background_vert:EM,background_frag:TM,backgroundCube_vert:wM,backgroundCube_frag:AM,cube_vert:RM,cube_frag:CM,depth_vert:PM,depth_frag:DM,distance_vert:LM,distance_frag:NM,equirect_vert:IM,equirect_frag:UM,linedashed_vert:FM,linedashed_frag:OM,meshbasic_vert:BM,meshbasic_frag:kM,meshlambert_vert:zM,meshlambert_frag:GM,meshmatcap_vert:VM,meshmatcap_frag:HM,meshnormal_vert:WM,meshnormal_frag:XM,meshphong_vert:YM,meshphong_frag:qM,meshphysical_vert:$M,meshphysical_frag:KM,meshtoon_vert:ZM,meshtoon_frag:jM,points_vert:JM,points_frag:QM,shadow_vert:eS,shadow_frag:tS,sprite_vert:nS,sprite_frag:iS},Se={common:{diffuse:{value:new dt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ke},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ke}},envmap:{envMap:{value:null},envMapRotation:{value:new Ke},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ke}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ke}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ke},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ke},normalScale:{value:new mt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ke},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ke}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ke}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ke}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new dt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new q},probesMax:{value:new q},probesResolution:{value:new q}},points:{diffuse:{value:new dt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0},uvTransform:{value:new Ke}},sprite:{diffuse:{value:new dt(16777215)},opacity:{value:1},center:{value:new mt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ke},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0}}},Di={basic:{uniforms:Pn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.fog]),vertexShader:Qe.meshbasic_vert,fragmentShader:Qe.meshbasic_frag},lambert:{uniforms:Pn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new dt(0)},envMapIntensity:{value:1}}]),vertexShader:Qe.meshlambert_vert,fragmentShader:Qe.meshlambert_frag},phong:{uniforms:Pn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new dt(0)},specular:{value:new dt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphong_vert,fragmentShader:Qe.meshphong_frag},standard:{uniforms:Pn([Se.common,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.roughnessmap,Se.metalnessmap,Se.fog,Se.lights,{emissive:{value:new dt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag},toon:{uniforms:Pn([Se.common,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.gradientmap,Se.fog,Se.lights,{emissive:{value:new dt(0)}}]),vertexShader:Qe.meshtoon_vert,fragmentShader:Qe.meshtoon_frag},matcap:{uniforms:Pn([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,{matcap:{value:null}}]),vertexShader:Qe.meshmatcap_vert,fragmentShader:Qe.meshmatcap_frag},points:{uniforms:Pn([Se.points,Se.fog]),vertexShader:Qe.points_vert,fragmentShader:Qe.points_frag},dashed:{uniforms:Pn([Se.common,Se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qe.linedashed_vert,fragmentShader:Qe.linedashed_frag},depth:{uniforms:Pn([Se.common,Se.displacementmap]),vertexShader:Qe.depth_vert,fragmentShader:Qe.depth_frag},normal:{uniforms:Pn([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,{opacity:{value:1}}]),vertexShader:Qe.meshnormal_vert,fragmentShader:Qe.meshnormal_frag},sprite:{uniforms:Pn([Se.sprite,Se.fog]),vertexShader:Qe.sprite_vert,fragmentShader:Qe.sprite_frag},background:{uniforms:{uvTransform:{value:new Ke},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qe.background_vert,fragmentShader:Qe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ke}},vertexShader:Qe.backgroundCube_vert,fragmentShader:Qe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qe.cube_vert,fragmentShader:Qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe.equirect_vert,fragmentShader:Qe.equirect_frag},distance:{uniforms:Pn([Se.common,Se.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qe.distance_vert,fragmentShader:Qe.distance_frag},shadow:{uniforms:Pn([Se.lights,Se.fog,{color:{value:new dt(0)},opacity:{value:1}}]),vertexShader:Qe.shadow_vert,fragmentShader:Qe.shadow_frag}};Di.physical={uniforms:Pn([Di.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ke},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ke},clearcoatNormalScale:{value:new mt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ke},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ke},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ke},sheen:{value:0},sheenColor:{value:new dt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ke},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ke},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ke},transmissionSamplerSize:{value:new mt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ke},attenuationDistance:{value:0},attenuationColor:{value:new dt(0)},specularColor:{value:new dt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ke},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ke},anisotropyVector:{value:new mt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ke}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag};const Go={r:0,b:0,g:0},rS=new Xt,Dm=new Ke;Dm.set(-1,0,0,0,1,0,0,0,1);function sS(r,e,t,n,i,s){const a=new dt(0);let o=i===!0?0:1,l,c,u=null,h=0,f=null;function d(b){let A=b.isScene===!0?b.background:null;if(A&&A.isTexture){const M=b.backgroundBlurriness>0;A=e.get(A,M)}return A}function g(b){let A=!1;const M=d(b);M===null?p(a,o):M&&M.isColor&&(p(M,1),A=!0);const y=r.xr.getEnvironmentBlendMode();y==="additive"?t.buffers.color.setClear(0,0,0,1,s):y==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(r.autoClear||A)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function _(b,A){const M=d(A);M&&(M.isCubeTexture||M.mapping===Rl)?(c===void 0&&(c=new or(new io(1,1,1),new yi({name:"BackgroundCubeMaterial",uniforms:sa(Di.backgroundCube.uniforms),vertexShader:Di.backgroundCube.vertexShader,fragmentShader:Di.backgroundCube.fragmentShader,side:Vn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(y,T,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(rS.makeRotationFromEuler(A.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Dm),c.material.toneMapped=ct.getTransfer(M.colorSpace)!==vt,(u!==M||h!==M.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,u=M,h=M.version,f=r.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new or(new Pl(2,2),new yi({name:"BackgroundMaterial",uniforms:sa(Di.background.uniforms),vertexShader:Di.background.vertexShader,fragmentShader:Di.background.fragmentShader,side:Nr,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,l.material.toneMapped=ct.getTransfer(M.colorSpace)!==vt,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(u!==M||h!==M.version||f!==r.toneMapping)&&(l.material.needsUpdate=!0,u=M,h=M.version,f=r.toneMapping),l.layers.enableAll(),b.unshift(l,l.geometry,l.material,0,0,null))}function p(b,A){b.getRGB(Go,Am(r)),t.buffers.color.setClear(Go.r,Go.g,Go.b,A,s)}function m(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(b,A=1){a.set(b),o=A,p(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(b){o=b,p(a,o)},render:g,addToRenderList:_,dispose:m}}function aS(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=f(null);let s=i,a=!1;function o(L,N,Y,H,O){let z=!1;const I=h(L,H,Y,N);s!==I&&(s=I,c(s.object)),z=d(L,H,Y,O),z&&g(L,H,Y,O),O!==null&&e.update(O,r.ELEMENT_ARRAY_BUFFER),(z||a)&&(a=!1,M(L,N,Y,H),O!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(O).buffer))}function l(){return r.createVertexArray()}function c(L){return r.bindVertexArray(L)}function u(L){return r.deleteVertexArray(L)}function h(L,N,Y,H){const O=H.wireframe===!0;let z=n[N.id];z===void 0&&(z={},n[N.id]=z);const I=L.isInstancedMesh===!0?L.id:0;let W=z[I];W===void 0&&(W={},z[I]=W);let Z=W[Y.id];Z===void 0&&(Z={},W[Y.id]=Z);let D=Z[O];return D===void 0&&(D=f(l()),Z[O]=D),D}function f(L){const N=[],Y=[],H=[];for(let O=0;O<t;O++)N[O]=0,Y[O]=0,H[O]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:Y,attributeDivisors:H,object:L,attributes:{},index:null}}function d(L,N,Y,H){const O=s.attributes,z=N.attributes;let I=0;const W=Y.getAttributes();for(const Z in W)if(W[Z].location>=0){const re=O[Z];let he=z[Z];if(he===void 0&&(Z==="instanceMatrix"&&L.instanceMatrix&&(he=L.instanceMatrix),Z==="instanceColor"&&L.instanceColor&&(he=L.instanceColor)),re===void 0||re.attribute!==he||he&&re.data!==he.data)return!0;I++}return s.attributesNum!==I||s.index!==H}function g(L,N,Y,H){const O={},z=N.attributes;let I=0;const W=Y.getAttributes();for(const Z in W)if(W[Z].location>=0){let re=z[Z];re===void 0&&(Z==="instanceMatrix"&&L.instanceMatrix&&(re=L.instanceMatrix),Z==="instanceColor"&&L.instanceColor&&(re=L.instanceColor));const he={};he.attribute=re,re&&re.data&&(he.data=re.data),O[Z]=he,I++}s.attributes=O,s.attributesNum=I,s.index=H}function _(){const L=s.newAttributes;for(let N=0,Y=L.length;N<Y;N++)L[N]=0}function p(L){m(L,0)}function m(L,N){const Y=s.newAttributes,H=s.enabledAttributes,O=s.attributeDivisors;Y[L]=1,H[L]===0&&(r.enableVertexAttribArray(L),H[L]=1),O[L]!==N&&(r.vertexAttribDivisor(L,N),O[L]=N)}function b(){const L=s.newAttributes,N=s.enabledAttributes;for(let Y=0,H=N.length;Y<H;Y++)N[Y]!==L[Y]&&(r.disableVertexAttribArray(Y),N[Y]=0)}function A(L,N,Y,H,O,z,I){I===!0?r.vertexAttribIPointer(L,N,Y,O,z):r.vertexAttribPointer(L,N,Y,H,O,z)}function M(L,N,Y,H){_();const O=H.attributes,z=Y.getAttributes(),I=N.defaultAttributeValues;for(const W in z){const Z=z[W];if(Z.location>=0){let D=O[W];if(D===void 0&&(W==="instanceMatrix"&&L.instanceMatrix&&(D=L.instanceMatrix),W==="instanceColor"&&L.instanceColor&&(D=L.instanceColor)),D!==void 0){const re=D.normalized,he=D.itemSize,He=e.get(D);if(He===void 0)continue;const Be=He.buffer,Pe=He.type,J=He.bytesPerElement,ae=Pe===r.INT||Pe===r.UNSIGNED_INT||D.gpuType===_f;if(D.isInterleavedBufferAttribute){const se=D.data,we=se.stride,Oe=D.offset;if(se.isInstancedInterleavedBuffer){for(let Ee=0;Ee<Z.locationSize;Ee++)m(Z.location+Ee,se.meshPerAttribute);L.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let Ee=0;Ee<Z.locationSize;Ee++)p(Z.location+Ee);r.bindBuffer(r.ARRAY_BUFFER,Be);for(let Ee=0;Ee<Z.locationSize;Ee++)A(Z.location+Ee,he/Z.locationSize,Pe,re,we*J,(Oe+he/Z.locationSize*Ee)*J,ae)}else{if(D.isInstancedBufferAttribute){for(let se=0;se<Z.locationSize;se++)m(Z.location+se,D.meshPerAttribute);L.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=D.meshPerAttribute*D.count)}else for(let se=0;se<Z.locationSize;se++)p(Z.location+se);r.bindBuffer(r.ARRAY_BUFFER,Be);for(let se=0;se<Z.locationSize;se++)A(Z.location+se,he/Z.locationSize,Pe,re,he*J,he/Z.locationSize*se*J,ae)}}else if(I!==void 0){const re=I[W];if(re!==void 0)switch(re.length){case 2:r.vertexAttrib2fv(Z.location,re);break;case 3:r.vertexAttrib3fv(Z.location,re);break;case 4:r.vertexAttrib4fv(Z.location,re);break;default:r.vertexAttrib1fv(Z.location,re)}}}}b()}function y(){E();for(const L in n){const N=n[L];for(const Y in N){const H=N[Y];for(const O in H){const z=H[O];for(const I in z)u(z[I].object),delete z[I];delete H[O]}}delete n[L]}}function T(L){if(n[L.id]===void 0)return;const N=n[L.id];for(const Y in N){const H=N[Y];for(const O in H){const z=H[O];for(const I in z)u(z[I].object),delete z[I];delete H[O]}}delete n[L.id]}function w(L){for(const N in n){const Y=n[N];for(const H in Y){const O=Y[H];if(O[L.id]===void 0)continue;const z=O[L.id];for(const I in z)u(z[I].object),delete z[I];delete O[L.id]}}}function v(L){for(const N in n){const Y=n[N],H=L.isInstancedMesh===!0?L.id:0,O=Y[H];if(O!==void 0){for(const z in O){const I=O[z];for(const W in I)u(I[W].object),delete I[W];delete O[z]}delete Y[H],Object.keys(Y).length===0&&delete n[N]}}}function E(){C(),a=!0,s!==i&&(s=i,c(s.object))}function C(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:E,resetDefaultState:C,dispose:y,releaseStatesOfGeometry:T,releaseStatesOfObject:v,releaseStatesOfProgram:w,initAttributes:_,enableAttribute:p,disableUnusedAttributes:b}}function oS(r,e,t){let n;function i(l){n=l}function s(l,c){r.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,u){u!==0&&(r.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function o(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let f=0;for(let d=0;d<u;d++)f+=c[d];t.update(f,n,1)}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function lS(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(w){return!(w!==bi&&n.convert(w)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(w){const v=w===sr&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==hi&&n.convert(w)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==Ui&&!v)}function l(w){if(w==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(Ye("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,f=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&f===!1&&Ye("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const d=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),g=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),p=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),m=r.getParameter(r.MAX_VERTEX_ATTRIBS),b=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),A=r.getParameter(r.MAX_VARYING_VECTORS),M=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=r.getParameter(r.MAX_SAMPLES),T=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:b,maxVaryings:A,maxFragmentUniforms:M,maxSamples:y,samples:T}}function cS(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new Wr,o=new Ke,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const d=h.length!==0||f||n!==0||i;return i=f,n=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,d){const g=h.clippingPlanes,_=h.clipIntersection,p=h.clipShadows,m=r.get(h);if(!i||g===null||g.length===0||s&&!p)s?u(null):c();else{const b=s?0:n,A=b*4;let M=m.clippingState||null;l.value=M,M=u(g,f,A,d);for(let y=0;y!==A;++y)M[y]=t[y];m.clippingState=M,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,g){const _=h!==null?h.length:0;let p=null;if(_!==0){if(p=l.value,g!==!0||p===null){const m=d+_*4,b=f.matrixWorldInverse;o.getNormalMatrix(b),(p===null||p.length<m)&&(p=new Float32Array(m));for(let A=0,M=d;A!==_;++A,M+=4)a.copy(h[A]).applyMatrix4(b,o),a.normal.toArray(p,M),p[M+3]=a.constant}l.value=p,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,p}}const Er=4,eh=[.125,.215,.35,.446,.526,.582],Yr=20,uS=256,ga=new Cm,th=new dt;let vc=null,Mc=0,Sc=0,bc=!1;const fS=new q;class nh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,s={}){const{size:a=256,position:o=fS}=s;vc=this._renderer.getRenderTarget(),Mc=this._renderer.getActiveCubeFace(),Sc=this._renderer.getActiveMipmapLevel(),bc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,i,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=sh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=rh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(vc,Mc,Sc),this._renderer.xr.enabled=bc,e.scissorTest=!1,Ls(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===os||e.mapping===ia?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),vc=this._renderer.getRenderTarget(),Mc=this._renderer.getActiveCubeFace(),Sc=this._renderer.getActiveMipmapLevel(),bc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:yn,minFilter:yn,generateMipmaps:!1,type:sr,format:bi,colorSpace:vl,depthBuffer:!1},i=ih(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ih(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=dS(s)),this._blurMaterial=pS(s,e,t),this._ggxMaterial=hS(s,e,t)}return i}_compileMaterial(e){const t=new or(new Ei,e);this._renderer.compile(t,ga)}_sceneToCubeUV(e,t,n,i,s){const l=new di(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,f=h.autoClear,d=h.toneMapping;h.getClearColor(th),h.toneMapping=Bi,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(i),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new or(new io,new ym({name:"PMREM.Background",side:Vn,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,p=_.material;let m=!1;const b=e.background;b?b.isColor&&(p.color.copy(b),e.background=null,m=!0):(p.color.copy(th),m=!0);for(let A=0;A<6;A++){const M=A%3;M===0?(l.up.set(0,c[A],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[A],s.y,s.z)):M===1?(l.up.set(0,0,c[A]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[A],s.z)):(l.up.set(0,c[A],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[A]));const y=this._cubeSize;Ls(i,M*y,A>2?y:0,y,y),h.setRenderTarget(i),m&&h.render(_,l),h.render(e,l)}h.toneMapping=d,h.autoClear=f,e.background=b}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===os||e.mapping===ia;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=sh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=rh());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Ls(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,ga)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const l=a.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),h=Math.sqrt(c*c-u*u),f=0+c*1.25,d=h*f,{_lodMax:g}=this,_=this._sizeLods[n],p=3*_*(n>g-Er?n-g+Er:0),m=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=d,l.mipInt.value=g-t,Ls(s,p,m,3*_,2*_),i.setRenderTarget(s),i.render(o,ga),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=g-n,Ls(e,p,m,3*_,2*_),i.setRenderTarget(e),i.render(o,ga)}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&pt("blur direction must be either latitudinal or longitudinal!");const u=3,h=this._lodMeshes[i];h.material=c;const f=c.uniforms,d=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Yr-1),_=s/g,p=isFinite(s)?1+Math.floor(u*_):Yr;p>Yr&&Ye(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${Yr}`);const m=[];let b=0;for(let w=0;w<Yr;++w){const v=w/_,E=Math.exp(-v*v/2);m.push(E),w===0?b+=E:w<p&&(b+=2*E)}for(let w=0;w<m.length;w++)m[w]=m[w]/b;f.envMap.value=e.texture,f.samples.value=p,f.weights.value=m,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:A}=this;f.dTheta.value=g,f.mipInt.value=A-n;const M=this._sizeLods[i],y=3*M*(i>A-Er?i-A+Er:0),T=4*(this._cubeSize-M);Ls(t,y,T,3*M,2*M),l.setRenderTarget(t),l.render(h,ga)}}function dS(r){const e=[],t=[],n=[];let i=r;const s=r-Er+1+eh.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>r-Er?l=eh[a-r+Er-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,g=6,_=3,p=2,m=1,b=new Float32Array(_*g*d),A=new Float32Array(p*g*d),M=new Float32Array(m*g*d);for(let T=0;T<d;T++){const w=T%3*2/3-1,v=T>2?0:-1,E=[w,v,0,w+2/3,v,0,w+2/3,v+1,0,w,v,0,w+2/3,v+1,0,w,v+1,0];b.set(E,_*g*T),A.set(f,p*g*T);const C=[T,T,T,T,T,T];M.set(C,m*g*T)}const y=new Ei;y.setAttribute("position",new Mn(b,_)),y.setAttribute("uv",new Mn(A,p)),y.setAttribute("faceIndex",new Mn(M,m)),n.push(new or(y,null)),i>Er&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function ih(r,e,t){const n=new ki(r,e,t);return n.texture.mapping=Rl,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ls(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function hS(r,e,t){return new yi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:uS,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Dl(),fragmentShader:`
3671
+ }`,et={alphahash_fragment:Ex,alphahash_pars_fragment:Tx,alphamap_fragment:wx,alphamap_pars_fragment:Ax,alphatest_fragment:Rx,alphatest_pars_fragment:Cx,aomap_fragment:Px,aomap_pars_fragment:Dx,batching_pars_vertex:Lx,batching_vertex:Nx,begin_vertex:Ix,beginnormal_vertex:Ux,bsdfs:Fx,iridescence_fragment:Ox,bumpmap_pars_fragment:Bx,clipping_planes_fragment:kx,clipping_planes_pars_fragment:zx,clipping_planes_pars_vertex:Gx,clipping_planes_vertex:Vx,color_fragment:Hx,color_pars_fragment:Wx,color_pars_vertex:Xx,color_vertex:Yx,common:qx,cube_uv_reflection_fragment:$x,defaultnormal_vertex:Zx,displacementmap_pars_vertex:Kx,displacementmap_vertex:jx,emissivemap_fragment:Jx,emissivemap_pars_fragment:Qx,colorspace_fragment:ev,colorspace_pars_fragment:tv,envmap_fragment:nv,envmap_common_pars_fragment:iv,envmap_pars_fragment:rv,envmap_pars_vertex:sv,envmap_physical_pars_fragment:gv,envmap_vertex:av,fog_vertex:ov,fog_pars_vertex:lv,fog_fragment:cv,fog_pars_fragment:uv,gradientmap_pars_fragment:fv,lightmap_pars_fragment:dv,lights_lambert_fragment:hv,lights_lambert_pars_fragment:pv,lights_pars_begin:mv,lights_toon_fragment:_v,lights_toon_pars_fragment:xv,lights_phong_fragment:vv,lights_phong_pars_fragment:Mv,lights_physical_fragment:Sv,lights_physical_pars_fragment:bv,lights_fragment_begin:yv,lights_fragment_maps:Ev,lights_fragment_end:Tv,lightprobes_pars_fragment:wv,logdepthbuf_fragment:Av,logdepthbuf_pars_fragment:Rv,logdepthbuf_pars_vertex:Cv,logdepthbuf_vertex:Pv,map_fragment:Dv,map_pars_fragment:Lv,map_particle_fragment:Nv,map_particle_pars_fragment:Iv,metalnessmap_fragment:Uv,metalnessmap_pars_fragment:Fv,morphinstance_vertex:Ov,morphcolor_vertex:Bv,morphnormal_vertex:kv,morphtarget_pars_vertex:zv,morphtarget_vertex:Gv,normal_fragment_begin:Vv,normal_fragment_maps:Hv,normal_pars_fragment:Wv,normal_pars_vertex:Xv,normal_vertex:Yv,normalmap_pars_fragment:qv,clearcoat_normal_fragment_begin:$v,clearcoat_normal_fragment_maps:Zv,clearcoat_pars_fragment:Kv,iridescence_pars_fragment:jv,opaque_fragment:Jv,packing:Qv,premultiplied_alpha_fragment:eM,project_vertex:tM,dithering_fragment:nM,dithering_pars_fragment:iM,roughnessmap_fragment:rM,roughnessmap_pars_fragment:sM,shadowmap_pars_fragment:aM,shadowmap_pars_vertex:oM,shadowmap_vertex:lM,shadowmask_pars_fragment:cM,skinbase_vertex:uM,skinning_pars_vertex:fM,skinning_vertex:dM,skinnormal_vertex:hM,specularmap_fragment:pM,specularmap_pars_fragment:mM,tonemapping_fragment:gM,tonemapping_pars_fragment:_M,transmission_fragment:xM,transmission_pars_fragment:vM,uv_pars_fragment:MM,uv_pars_vertex:SM,uv_vertex:bM,worldpos_vertex:yM,background_vert:EM,background_frag:TM,backgroundCube_vert:wM,backgroundCube_frag:AM,cube_vert:RM,cube_frag:CM,depth_vert:PM,depth_frag:DM,distance_vert:LM,distance_frag:NM,equirect_vert:IM,equirect_frag:UM,linedashed_vert:FM,linedashed_frag:OM,meshbasic_vert:BM,meshbasic_frag:kM,meshlambert_vert:zM,meshlambert_frag:GM,meshmatcap_vert:VM,meshmatcap_frag:HM,meshnormal_vert:WM,meshnormal_frag:XM,meshphong_vert:YM,meshphong_frag:qM,meshphysical_vert:$M,meshphysical_frag:ZM,meshtoon_vert:KM,meshtoon_frag:jM,points_vert:JM,points_frag:QM,shadow_vert:eS,shadow_frag:tS,sprite_vert:nS,sprite_frag:iS},Se={common:{diffuse:{value:new ft(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ke},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ke}},envmap:{envMap:{value:null},envMapRotation:{value:new Ke},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ke}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ke}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ke},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ke},normalScale:{value:new gt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ke},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ke}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ke}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ke}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ft(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new Y},probesMax:{value:new Y},probesResolution:{value:new Y}},points:{diffuse:{value:new ft(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0},uvTransform:{value:new Ke}},sprite:{diffuse:{value:new ft(16777215)},opacity:{value:1},center:{value:new gt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ke},alphaMap:{value:null},alphaMapTransform:{value:new Ke},alphaTest:{value:0}}},Di={basic:{uniforms:Pn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.fog]),vertexShader:et.meshbasic_vert,fragmentShader:et.meshbasic_frag},lambert:{uniforms:Pn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new ft(0)},envMapIntensity:{value:1}}]),vertexShader:et.meshlambert_vert,fragmentShader:et.meshlambert_frag},phong:{uniforms:Pn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new ft(0)},specular:{value:new ft(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:et.meshphong_vert,fragmentShader:et.meshphong_frag},standard:{uniforms:Pn([Se.common,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.roughnessmap,Se.metalnessmap,Se.fog,Se.lights,{emissive:{value:new ft(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:et.meshphysical_vert,fragmentShader:et.meshphysical_frag},toon:{uniforms:Pn([Se.common,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.gradientmap,Se.fog,Se.lights,{emissive:{value:new ft(0)}}]),vertexShader:et.meshtoon_vert,fragmentShader:et.meshtoon_frag},matcap:{uniforms:Pn([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,{matcap:{value:null}}]),vertexShader:et.meshmatcap_vert,fragmentShader:et.meshmatcap_frag},points:{uniforms:Pn([Se.points,Se.fog]),vertexShader:et.points_vert,fragmentShader:et.points_frag},dashed:{uniforms:Pn([Se.common,Se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:et.linedashed_vert,fragmentShader:et.linedashed_frag},depth:{uniforms:Pn([Se.common,Se.displacementmap]),vertexShader:et.depth_vert,fragmentShader:et.depth_frag},normal:{uniforms:Pn([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,{opacity:{value:1}}]),vertexShader:et.meshnormal_vert,fragmentShader:et.meshnormal_frag},sprite:{uniforms:Pn([Se.sprite,Se.fog]),vertexShader:et.sprite_vert,fragmentShader:et.sprite_frag},background:{uniforms:{uvTransform:{value:new Ke},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:et.background_vert,fragmentShader:et.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ke}},vertexShader:et.backgroundCube_vert,fragmentShader:et.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:et.cube_vert,fragmentShader:et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:et.equirect_vert,fragmentShader:et.equirect_frag},distance:{uniforms:Pn([Se.common,Se.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:et.distance_vert,fragmentShader:et.distance_frag},shadow:{uniforms:Pn([Se.lights,Se.fog,{color:{value:new ft(0)},opacity:{value:1}}]),vertexShader:et.shadow_vert,fragmentShader:et.shadow_frag}};Di.physical={uniforms:Pn([Di.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ke},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ke},clearcoatNormalScale:{value:new gt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ke},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ke},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ke},sheen:{value:0},sheenColor:{value:new ft(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ke},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ke},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ke},transmissionSamplerSize:{value:new gt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ke},attenuationDistance:{value:0},attenuationColor:{value:new ft(0)},specularColor:{value:new ft(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ke},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ke},anisotropyVector:{value:new gt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ke}}]),vertexShader:et.meshphysical_vert,fragmentShader:et.meshphysical_frag};const Vo={r:0,b:0,g:0},rS=new Xt,Dm=new Ke;Dm.set(-1,0,0,0,1,0,0,0,1);function sS(r,e,t,n,i,s){const a=new ft(0);let o=i===!0?0:1,l,c,u=null,h=0,f=null;function d(b){let w=b.isScene===!0?b.background:null;if(w&&w.isTexture){const M=b.backgroundBlurriness>0;w=e.get(w,M)}return w}function g(b){let w=!1;const M=d(b);M===null?p(a,o):M&&M.isColor&&(p(M,1),w=!0);const y=r.xr.getEnvironmentBlendMode();y==="additive"?t.buffers.color.setClear(0,0,0,1,s):y==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(r.autoClear||w)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function _(b,w){const M=d(w);M&&(M.isCubeTexture||M.mapping===Cl)?(c===void 0&&(c=new or(new ro(1,1,1),new yi({name:"BackgroundCubeMaterial",uniforms:aa(Di.backgroundCube.uniforms),vertexShader:Di.backgroundCube.vertexShader,fragmentShader:Di.backgroundCube.fragmentShader,side:Vn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(y,T,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(rS.makeRotationFromEuler(w.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Dm),c.material.toneMapped=ct.getTransfer(M.colorSpace)!==vt,(u!==M||h!==M.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,u=M,h=M.version,f=r.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new or(new Dl(2,2),new yi({name:"BackgroundMaterial",uniforms:aa(Di.background.uniforms),vertexShader:Di.background.vertexShader,fragmentShader:Di.background.fragmentShader,side:Nr,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.toneMapped=ct.getTransfer(M.colorSpace)!==vt,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(u!==M||h!==M.version||f!==r.toneMapping)&&(l.material.needsUpdate=!0,u=M,h=M.version,f=r.toneMapping),l.layers.enableAll(),b.unshift(l,l.geometry,l.material,0,0,null))}function p(b,w){b.getRGB(Vo,Am(r)),t.buffers.color.setClear(Vo.r,Vo.g,Vo.b,w,s)}function m(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(b,w=1){a.set(b),o=w,p(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(b){o=b,p(a,o)},render:g,addToRenderList:_,dispose:m}}function aS(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=f(null);let s=i,a=!1;function o(L,N,q,W,B){let G=!1;const I=h(L,W,q,N);s!==I&&(s=I,c(s.object)),G=d(L,W,q,B),G&&g(L,W,q,B),B!==null&&e.update(B,r.ELEMENT_ARRAY_BUFFER),(G||a)&&(a=!1,M(L,N,q,W),B!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(B).buffer))}function l(){return r.createVertexArray()}function c(L){return r.bindVertexArray(L)}function u(L){return r.deleteVertexArray(L)}function h(L,N,q,W){const B=W.wireframe===!0;let G=n[N.id];G===void 0&&(G={},n[N.id]=G);const I=L.isInstancedMesh===!0?L.id:0;let $=G[I];$===void 0&&($={},G[I]=$);let j=$[q.id];j===void 0&&(j={},$[q.id]=j);let D=j[B];return D===void 0&&(D=f(l()),j[B]=D),D}function f(L){const N=[],q=[],W=[];for(let B=0;B<t;B++)N[B]=0,q[B]=0,W[B]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:q,attributeDivisors:W,object:L,attributes:{},index:null}}function d(L,N,q,W){const B=s.attributes,G=N.attributes;let I=0;const $=q.getAttributes();for(const j in $)if($[j].location>=0){const se=B[j];let he=G[j];if(he===void 0&&(j==="instanceMatrix"&&L.instanceMatrix&&(he=L.instanceMatrix),j==="instanceColor"&&L.instanceColor&&(he=L.instanceColor)),se===void 0||se.attribute!==he||he&&se.data!==he.data)return!0;I++}return s.attributesNum!==I||s.index!==W}function g(L,N,q,W){const B={},G=N.attributes;let I=0;const $=q.getAttributes();for(const j in $)if($[j].location>=0){let se=G[j];se===void 0&&(j==="instanceMatrix"&&L.instanceMatrix&&(se=L.instanceMatrix),j==="instanceColor"&&L.instanceColor&&(se=L.instanceColor));const he={};he.attribute=se,se&&se.data&&(he.data=se.data),B[j]=he,I++}s.attributes=B,s.attributesNum=I,s.index=W}function _(){const L=s.newAttributes;for(let N=0,q=L.length;N<q;N++)L[N]=0}function p(L){m(L,0)}function m(L,N){const q=s.newAttributes,W=s.enabledAttributes,B=s.attributeDivisors;q[L]=1,W[L]===0&&(r.enableVertexAttribArray(L),W[L]=1),B[L]!==N&&(r.vertexAttribDivisor(L,N),B[L]=N)}function b(){const L=s.newAttributes,N=s.enabledAttributes;for(let q=0,W=N.length;q<W;q++)N[q]!==L[q]&&(r.disableVertexAttribArray(q),N[q]=0)}function w(L,N,q,W,B,G,I){I===!0?r.vertexAttribIPointer(L,N,q,B,G):r.vertexAttribPointer(L,N,q,W,B,G)}function M(L,N,q,W){_();const B=W.attributes,G=q.getAttributes(),I=N.defaultAttributeValues;for(const $ in G){const j=G[$];if(j.location>=0){let D=B[$];if(D===void 0&&($==="instanceMatrix"&&L.instanceMatrix&&(D=L.instanceMatrix),$==="instanceColor"&&L.instanceColor&&(D=L.instanceColor)),D!==void 0){const se=D.normalized,he=D.itemSize,Ve=e.get(D);if(Ve===void 0)continue;const He=Ve.buffer,De=Ve.type,J=Ve.bytesPerElement,ae=De===r.INT||De===r.UNSIGNED_INT||D.gpuType===xf;if(D.isInterleavedBufferAttribute){const re=D.data,Re=re.stride,Ie=D.offset;if(re.isInstancedInterleavedBuffer){for(let Ee=0;Ee<j.locationSize;Ee++)m(j.location+Ee,re.meshPerAttribute);L.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Ee=0;Ee<j.locationSize;Ee++)p(j.location+Ee);r.bindBuffer(r.ARRAY_BUFFER,He);for(let Ee=0;Ee<j.locationSize;Ee++)w(j.location+Ee,he/j.locationSize,De,se,Re*J,(Ie+he/j.locationSize*Ee)*J,ae)}else{if(D.isInstancedBufferAttribute){for(let re=0;re<j.locationSize;re++)m(j.location+re,D.meshPerAttribute);L.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=D.meshPerAttribute*D.count)}else for(let re=0;re<j.locationSize;re++)p(j.location+re);r.bindBuffer(r.ARRAY_BUFFER,He);for(let re=0;re<j.locationSize;re++)w(j.location+re,he/j.locationSize,De,se,he*J,he/j.locationSize*re*J,ae)}}else if(I!==void 0){const se=I[$];if(se!==void 0)switch(se.length){case 2:r.vertexAttrib2fv(j.location,se);break;case 3:r.vertexAttrib3fv(j.location,se);break;case 4:r.vertexAttrib4fv(j.location,se);break;default:r.vertexAttrib1fv(j.location,se)}}}}b()}function y(){E();for(const L in n){const N=n[L];for(const q in N){const W=N[q];for(const B in W){const G=W[B];for(const I in G)u(G[I].object),delete G[I];delete W[B]}}delete n[L]}}function T(L){if(n[L.id]===void 0)return;const N=n[L.id];for(const q in N){const W=N[q];for(const B in W){const G=W[B];for(const I in G)u(G[I].object),delete G[I];delete W[B]}}delete n[L.id]}function A(L){for(const N in n){const q=n[N];for(const W in q){const B=q[W];if(B[L.id]===void 0)continue;const G=B[L.id];for(const I in G)u(G[I].object),delete G[I];delete B[L.id]}}}function v(L){for(const N in n){const q=n[N],W=L.isInstancedMesh===!0?L.id:0,B=q[W];if(B!==void 0){for(const G in B){const I=B[G];for(const $ in I)u(I[$].object),delete I[$];delete B[G]}delete q[W],Object.keys(q).length===0&&delete n[N]}}}function E(){C(),a=!0,s!==i&&(s=i,c(s.object))}function C(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:E,resetDefaultState:C,dispose:y,releaseStatesOfGeometry:T,releaseStatesOfObject:v,releaseStatesOfProgram:A,initAttributes:_,enableAttribute:p,disableUnusedAttributes:b}}function oS(r,e,t){let n;function i(l){n=l}function s(l,c){r.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,u){u!==0&&(r.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function o(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let f=0;for(let d=0;d<u;d++)f+=c[d];t.update(f,n,1)}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function lS(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(A){return!(A!==bi&&n.convert(A)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(A){const v=A===sr&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(A!==hi&&n.convert(A)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==Ui&&!v)}function l(A){if(A==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(Ye("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,f=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&f===!1&&Ye("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const d=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),g=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),p=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),m=r.getParameter(r.MAX_VERTEX_ATTRIBS),b=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),w=r.getParameter(r.MAX_VARYING_VECTORS),M=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=r.getParameter(r.MAX_SAMPLES),T=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:b,maxVaryings:w,maxFragmentUniforms:M,maxSamples:y,samples:T}}function cS(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new Xr,o=new Ke,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const d=h.length!==0||f||n!==0||i;return i=f,n=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,d){const g=h.clippingPlanes,_=h.clipIntersection,p=h.clipShadows,m=r.get(h);if(!i||g===null||g.length===0||s&&!p)s?u(null):c();else{const b=s?0:n,w=b*4;let M=m.clippingState||null;l.value=M,M=u(g,f,w,d);for(let y=0;y!==w;++y)M[y]=t[y];m.clippingState=M,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,g){const _=h!==null?h.length:0;let p=null;if(_!==0){if(p=l.value,g!==!0||p===null){const m=d+_*4,b=f.matrixWorldInverse;o.getNormalMatrix(b),(p===null||p.length<m)&&(p=new Float32Array(m));for(let w=0,M=d;w!==_;++w,M+=4)a.copy(h[w]).applyMatrix4(b,o),a.normal.toArray(p,M),p[M+3]=a.constant}l.value=p,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,p}}const Er=4,eh=[.125,.215,.35,.446,.526,.582],qr=20,uS=256,_a=new Cm,th=new ft;let Mc=null,Sc=0,bc=0,yc=!1;const fS=new Y;class nh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,s={}){const{size:a=256,position:o=fS}=s;Mc=this._renderer.getRenderTarget(),Sc=this._renderer.getActiveCubeFace(),bc=this._renderer.getActiveMipmapLevel(),yc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,i,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=sh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=rh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Mc,Sc,bc),this._renderer.xr.enabled=yc,e.scissorTest=!1,Ns(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ls||e.mapping===ra?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Mc=this._renderer.getRenderTarget(),Sc=this._renderer.getActiveCubeFace(),bc=this._renderer.getActiveMipmapLevel(),yc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:yn,minFilter:yn,generateMipmaps:!1,type:sr,format:bi,colorSpace:Ml,depthBuffer:!1},i=ih(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ih(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=dS(s)),this._blurMaterial=pS(s,e,t),this._ggxMaterial=hS(s,e,t)}return i}_compileMaterial(e){const t=new or(new Ei,e);this._renderer.compile(t,_a)}_sceneToCubeUV(e,t,n,i,s){const l=new di(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],h=this._renderer,f=h.autoClear,d=h.toneMapping;h.getClearColor(th),h.toneMapping=Bi,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(i),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new or(new ro,new ym({name:"PMREM.Background",side:Vn,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,p=_.material;let m=!1;const b=e.background;b?b.isColor&&(p.color.copy(b),e.background=null,m=!0):(p.color.copy(th),m=!0);for(let w=0;w<6;w++){const M=w%3;M===0?(l.up.set(0,c[w],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[w],s.y,s.z)):M===1?(l.up.set(0,0,c[w]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[w],s.z)):(l.up.set(0,c[w],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[w]));const y=this._cubeSize;Ns(i,M*y,w>2?y:0,y,y),h.setRenderTarget(i),m&&h.render(_,l),h.render(e,l)}h.toneMapping=d,h.autoClear=f,e.background=b}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===ls||e.mapping===ra;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=sh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=rh());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Ns(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,_a)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const l=a.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),h=Math.sqrt(c*c-u*u),f=0+c*1.25,d=h*f,{_lodMax:g}=this,_=this._sizeLods[n],p=3*_*(n>g-Er?n-g+Er:0),m=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=d,l.mipInt.value=g-t,Ns(s,p,m,3*_,2*_),i.setRenderTarget(s),i.render(o,_a),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=g-n,Ns(e,p,m,3*_,2*_),i.setRenderTarget(e),i.render(o,_a)}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&ht("blur direction must be either latitudinal or longitudinal!");const u=3,h=this._lodMeshes[i];h.material=c;const f=c.uniforms,d=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*qr-1),_=s/g,p=isFinite(s)?1+Math.floor(u*_):qr;p>qr&&Ye(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${qr}`);const m=[];let b=0;for(let A=0;A<qr;++A){const v=A/_,E=Math.exp(-v*v/2);m.push(E),A===0?b+=E:A<p&&(b+=2*E)}for(let A=0;A<m.length;A++)m[A]=m[A]/b;f.envMap.value=e.texture,f.samples.value=p,f.weights.value=m,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:w}=this;f.dTheta.value=g,f.mipInt.value=w-n;const M=this._sizeLods[i],y=3*M*(i>w-Er?i-w+Er:0),T=4*(this._cubeSize-M);Ns(t,y,T,3*M,2*M),l.setRenderTarget(t),l.render(h,_a)}}function dS(r){const e=[],t=[],n=[];let i=r;const s=r-Er+1+eh.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>r-Er?l=eh[a-r+Er-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,g=6,_=3,p=2,m=1,b=new Float32Array(_*g*d),w=new Float32Array(p*g*d),M=new Float32Array(m*g*d);for(let T=0;T<d;T++){const A=T%3*2/3-1,v=T>2?0:-1,E=[A,v,0,A+2/3,v,0,A+2/3,v+1,0,A,v,0,A+2/3,v+1,0,A,v+1,0];b.set(E,_*g*T),w.set(f,p*g*T);const C=[T,T,T,T,T,T];M.set(C,m*g*T)}const y=new Ei;y.setAttribute("position",new Mn(b,_)),y.setAttribute("uv",new Mn(w,p)),y.setAttribute("faceIndex",new Mn(M,m)),n.push(new or(y,null)),i>Er&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function ih(r,e,t){const n=new ki(r,e,t);return n.texture.mapping=Cl,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ns(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function hS(r,e,t){return new yi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:uS,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Ll(),fragmentShader:`
3672
3672
 
3673
3673
  precision highp float;
3674
3674
  precision highp int;
@@ -3772,7 +3772,7 @@ void main() {
3772
3772
 
3773
3773
  gl_FragColor = vec4(prefilteredColor, 1.0);
3774
3774
  }
3775
- `,blending:er,depthTest:!1,depthWrite:!1})}function pS(r,e,t){const n=new Float32Array(Yr),i=new q(0,1,0);return new yi({name:"SphericalGaussianBlur",defines:{n:Yr,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Dl(),fragmentShader:`
3775
+ `,blending:er,depthTest:!1,depthWrite:!1})}function pS(r,e,t){const n=new Float32Array(qr),i=new Y(0,1,0);return new yi({name:"SphericalGaussianBlur",defines:{n:qr,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Ll(),fragmentShader:`
3776
3776
 
3777
3777
  precision mediump float;
3778
3778
  precision mediump int;
@@ -3832,7 +3832,7 @@ void main() {
3832
3832
  }
3833
3833
 
3834
3834
  }
3835
- `,blending:er,depthTest:!1,depthWrite:!1})}function rh(){return new yi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Dl(),fragmentShader:`
3835
+ `,blending:er,depthTest:!1,depthWrite:!1})}function rh(){return new yi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ll(),fragmentShader:`
3836
3836
 
3837
3837
  precision mediump float;
3838
3838
  precision mediump int;
@@ -3851,7 +3851,7 @@ void main() {
3851
3851
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3852
3852
 
3853
3853
  }
3854
- `,blending:er,depthTest:!1,depthWrite:!1})}function sh(){return new yi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Dl(),fragmentShader:`
3854
+ `,blending:er,depthTest:!1,depthWrite:!1})}function sh(){return new yi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ll(),fragmentShader:`
3855
3855
 
3856
3856
  precision mediump float;
3857
3857
  precision mediump int;
@@ -3867,7 +3867,7 @@ void main() {
3867
3867
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3868
3868
 
3869
3869
  }
3870
- `,blending:er,depthTest:!1,depthWrite:!1})}function Dl(){return`
3870
+ `,blending:er,depthTest:!1,depthWrite:!1})}function Ll(){return`
3871
3871
 
3872
3872
  precision mediump float;
3873
3873
  precision mediump int;
@@ -3957,7 +3957,7 @@ void main() {
3957
3957
  gl_FragColor = texture2D( tEquirect, sampleUV );
3958
3958
 
3959
3959
  }
3960
- `},i=new io(5,5,5),s=new yi({name:"CubemapFromEquirect",uniforms:sa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Vn,blending:er});s.uniforms.tEquirect.value=t;const a=new or(i,s),o=t.minFilter;return t.minFilter===Kr&&(t.minFilter=yn),new vx(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}function mS(r){let e=new WeakMap,t=new WeakMap,n=null;function i(f,d=!1){return f==null?null:d?a(f):s(f)}function s(f){if(f&&f.isTexture){const d=f.mapping;if(d===$l||d===Kl)if(e.has(f)){const g=e.get(f).texture;return o(g,f.mapping)}else{const g=f.image;if(g&&g.height>0){const _=new Lm(g.height);return _.fromEquirectangularTexture(r,f),e.set(f,_),f.addEventListener("dispose",c),o(_.texture,f.mapping)}else return null}}return f}function a(f){if(f&&f.isTexture){const d=f.mapping,g=d===$l||d===Kl,_=d===os||d===ia;if(g||_){let p=t.get(f);const m=p!==void 0?p.texture.pmremVersion:0;if(f.isRenderTargetTexture&&f.pmremVersion!==m)return n===null&&(n=new nh(r)),p=g?n.fromEquirectangular(f,p):n.fromCubemap(f,p),p.texture.pmremVersion=f.pmremVersion,t.set(f,p),p.texture;if(p!==void 0)return p.texture;{const b=f.image;return g&&b&&b.height>0||_&&b&&l(b)?(n===null&&(n=new nh(r)),p=g?n.fromEquirectangular(f):n.fromCubemap(f),p.texture.pmremVersion=f.pmremVersion,t.set(f,p),f.addEventListener("dispose",u),p.texture):null}}}return f}function o(f,d){return d===$l?f.mapping=os:d===Kl&&(f.mapping=ia),f}function l(f){let d=0;const g=6;for(let _=0;_<g;_++)f[_]!==void 0&&d++;return d===g}function c(f){const d=f.target;d.removeEventListener("dispose",c);const g=e.get(d);g!==void 0&&(e.delete(d),g.dispose())}function u(f){const d=f.target;d.removeEventListener("dispose",u);const g=t.get(d);g!==void 0&&(t.delete(d),g.dispose())}function h(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:h}}function gS(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&$s("WebGLRenderer: "+n+" extension not supported."),i}}}function _S(r,e,t,n){const i={},s=new WeakMap;function a(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const g in f.attributes)e.remove(f.attributes[g]);f.removeEventListener("dispose",a),delete i[f.id];const d=s.get(f);d&&(e.remove(d),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(h,f){return i[f.id]===!0||(f.addEventListener("dispose",a),i[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const d in f)e.update(f[d],r.ARRAY_BUFFER)}function c(h){const f=[],d=h.index,g=h.attributes.position;let _=0;if(g===void 0)return;if(d!==null){const b=d.array;_=d.version;for(let A=0,M=b.length;A<M;A+=3){const y=b[A+0],T=b[A+1],w=b[A+2];f.push(y,T,T,w,w,y)}}else{const b=g.array;_=g.version;for(let A=0,M=b.length/3-1;A<M;A+=3){const y=A+0,T=A+1,w=A+2;f.push(y,T,T,w,w,y)}}const p=new(g.count>=65535?Sm:Mm)(f,1);p.version=_;const m=s.get(h);m&&e.remove(m),s.set(h,p)}function u(h){const f=s.get(h);if(f){const d=h.index;d!==null&&f.version<d.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function xS(r,e,t){let n;function i(h){n=h}let s,a;function o(h){s=h.type,a=h.bytesPerElement}function l(h,f){r.drawElements(n,f,s,h*a),t.update(f,n,1)}function c(h,f,d){d!==0&&(r.drawElementsInstanced(n,f,s,h*a,d),t.update(f,n,d))}function u(h,f,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,h,0,d);let _=0;for(let p=0;p<d;p++)_+=f[p];t.update(_,n,1)}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function vS(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:pt("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function MS(r,e,t){const n=new WeakMap,i=new Bt;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0;let f=n.get(o);if(f===void 0||f.count!==h){let E=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",E)};f!==void 0&&f.texture.dispose();const d=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let A=0;d===!0&&(A=1),g===!0&&(A=2),_===!0&&(A=3);let M=o.attributes.position.count*A,y=1;M>e.maxTextureSize&&(y=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const T=new Float32Array(M*y*4*h),w=new _m(T,M,y,h);w.type=Ui,w.needsUpdate=!0;const v=A*4;for(let C=0;C<h;C++){const L=p[C],N=m[C],Y=b[C],H=M*y*4*C;for(let O=0;O<L.count;O++){const z=O*v;d===!0&&(i.fromBufferAttribute(L,O),T[H+z+0]=i.x,T[H+z+1]=i.y,T[H+z+2]=i.z,T[H+z+3]=0),g===!0&&(i.fromBufferAttribute(N,O),T[H+z+4]=i.x,T[H+z+5]=i.y,T[H+z+6]=i.z,T[H+z+7]=0),_===!0&&(i.fromBufferAttribute(Y,O),T[H+z+8]=i.x,T[H+z+9]=i.y,T[H+z+10]=i.z,T[H+z+11]=Y.itemSize===4?i.w:1)}}f={count:h,texture:w,size:new mt(M,y)},n.set(o,f),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let d=0;for(let _=0;_<c.length;_++)d+=c[_];const g=o.morphTargetsRelative?1:1-d;l.getUniforms().setValue(r,"morphTargetBaseInfluence",g),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",f.size)}return{update:s}}function SS(r,e,t,n,i){let s=new WeakMap;function a(c){const u=i.render.frame,h=c.geometry,f=e.get(c,h);if(s.get(f)!==u&&(e.update(f),s.set(f,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,r.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,r.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){const d=c.skeleton;s.get(d)!==u&&(d.update(),s.set(d,u))}return f}function o(){s=new WeakMap}function l(c){const u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}const bS={[tm]:"LINEAR_TONE_MAPPING",[nm]:"REINHARD_TONE_MAPPING",[im]:"CINEON_TONE_MAPPING",[rm]:"ACES_FILMIC_TONE_MAPPING",[am]:"AGX_TONE_MAPPING",[om]:"NEUTRAL_TONE_MAPPING",[sm]:"CUSTOM_TONE_MAPPING"};function yS(r,e,t,n,i,s){const a=new ki(e,t,{type:r,depthBuffer:i,stencilBuffer:s,samples:n?4:0,depthTexture:i?new ra(e,t):void 0}),o=new ki(e,t,{type:sr,depthBuffer:!1,stencilBuffer:!1}),l=new Ei;l.setAttribute("position",new nr([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new nr([0,2,0,0,2,0],2));const c=new gx({uniforms:{tDiffuse:{value:null}},vertexShader:`
3960
+ `},i=new ro(5,5,5),s=new yi({name:"CubemapFromEquirect",uniforms:aa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Vn,blending:er});s.uniforms.tEquirect.value=t;const a=new or(i,s),o=t.minFilter;return t.minFilter===Kr&&(t.minFilter=yn),new vx(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}function mS(r){let e=new WeakMap,t=new WeakMap,n=null;function i(f,d=!1){return f==null?null:d?a(f):s(f)}function s(f){if(f&&f.isTexture){const d=f.mapping;if(d===Zl||d===Kl)if(e.has(f)){const g=e.get(f).texture;return o(g,f.mapping)}else{const g=f.image;if(g&&g.height>0){const _=new Lm(g.height);return _.fromEquirectangularTexture(r,f),e.set(f,_),f.addEventListener("dispose",c),o(_.texture,f.mapping)}else return null}}return f}function a(f){if(f&&f.isTexture){const d=f.mapping,g=d===Zl||d===Kl,_=d===ls||d===ra;if(g||_){let p=t.get(f);const m=p!==void 0?p.texture.pmremVersion:0;if(f.isRenderTargetTexture&&f.pmremVersion!==m)return n===null&&(n=new nh(r)),p=g?n.fromEquirectangular(f,p):n.fromCubemap(f,p),p.texture.pmremVersion=f.pmremVersion,t.set(f,p),p.texture;if(p!==void 0)return p.texture;{const b=f.image;return g&&b&&b.height>0||_&&b&&l(b)?(n===null&&(n=new nh(r)),p=g?n.fromEquirectangular(f):n.fromCubemap(f),p.texture.pmremVersion=f.pmremVersion,t.set(f,p),f.addEventListener("dispose",u),p.texture):null}}}return f}function o(f,d){return d===Zl?f.mapping=ls:d===Kl&&(f.mapping=ra),f}function l(f){let d=0;const g=6;for(let _=0;_<g;_++)f[_]!==void 0&&d++;return d===g}function c(f){const d=f.target;d.removeEventListener("dispose",c);const g=e.get(d);g!==void 0&&(e.delete(d),g.dispose())}function u(f){const d=f.target;d.removeEventListener("dispose",u);const g=t.get(d);g!==void 0&&(t.delete(d),g.dispose())}function h(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:h}}function gS(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Zs("WebGLRenderer: "+n+" extension not supported."),i}}}function _S(r,e,t,n){const i={},s=new WeakMap;function a(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const g in f.attributes)e.remove(f.attributes[g]);f.removeEventListener("dispose",a),delete i[f.id];const d=s.get(f);d&&(e.remove(d),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(h,f){return i[f.id]===!0||(f.addEventListener("dispose",a),i[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const d in f)e.update(f[d],r.ARRAY_BUFFER)}function c(h){const f=[],d=h.index,g=h.attributes.position;let _=0;if(g===void 0)return;if(d!==null){const b=d.array;_=d.version;for(let w=0,M=b.length;w<M;w+=3){const y=b[w+0],T=b[w+1],A=b[w+2];f.push(y,T,T,A,A,y)}}else{const b=g.array;_=g.version;for(let w=0,M=b.length/3-1;w<M;w+=3){const y=w+0,T=w+1,A=w+2;f.push(y,T,T,A,A,y)}}const p=new(g.count>=65535?Sm:Mm)(f,1);p.version=_;const m=s.get(h);m&&e.remove(m),s.set(h,p)}function u(h){const f=s.get(h);if(f){const d=h.index;d!==null&&f.version<d.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function xS(r,e,t){let n;function i(h){n=h}let s,a;function o(h){s=h.type,a=h.bytesPerElement}function l(h,f){r.drawElements(n,f,s,h*a),t.update(f,n,1)}function c(h,f,d){d!==0&&(r.drawElementsInstanced(n,f,s,h*a,d),t.update(f,n,d))}function u(h,f,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,h,0,d);let _=0;for(let p=0;p<d;p++)_+=f[p];t.update(_,n,1)}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function vS(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:ht("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function MS(r,e,t){const n=new WeakMap,i=new Bt;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0;let f=n.get(o);if(f===void 0||f.count!==h){let E=function(){A.dispose(),n.delete(o),o.removeEventListener("dispose",E)};f!==void 0&&f.texture.dispose();const d=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let w=0;d===!0&&(w=1),g===!0&&(w=2),_===!0&&(w=3);let M=o.attributes.position.count*w,y=1;M>e.maxTextureSize&&(y=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const T=new Float32Array(M*y*4*h),A=new _m(T,M,y,h);A.type=Ui,A.needsUpdate=!0;const v=w*4;for(let C=0;C<h;C++){const L=p[C],N=m[C],q=b[C],W=M*y*4*C;for(let B=0;B<L.count;B++){const G=B*v;d===!0&&(i.fromBufferAttribute(L,B),T[W+G+0]=i.x,T[W+G+1]=i.y,T[W+G+2]=i.z,T[W+G+3]=0),g===!0&&(i.fromBufferAttribute(N,B),T[W+G+4]=i.x,T[W+G+5]=i.y,T[W+G+6]=i.z,T[W+G+7]=0),_===!0&&(i.fromBufferAttribute(q,B),T[W+G+8]=i.x,T[W+G+9]=i.y,T[W+G+10]=i.z,T[W+G+11]=q.itemSize===4?i.w:1)}}f={count:h,texture:A,size:new gt(M,y)},n.set(o,f),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let d=0;for(let _=0;_<c.length;_++)d+=c[_];const g=o.morphTargetsRelative?1:1-d;l.getUniforms().setValue(r,"morphTargetBaseInfluence",g),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",f.size)}return{update:s}}function SS(r,e,t,n,i){let s=new WeakMap;function a(c){const u=i.render.frame,h=c.geometry,f=e.get(c,h);if(s.get(f)!==u&&(e.update(f),s.set(f,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,r.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,r.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){const d=c.skeleton;s.get(d)!==u&&(d.update(),s.set(d,u))}return f}function o(){s=new WeakMap}function l(c){const u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}const bS={[tm]:"LINEAR_TONE_MAPPING",[nm]:"REINHARD_TONE_MAPPING",[im]:"CINEON_TONE_MAPPING",[rm]:"ACES_FILMIC_TONE_MAPPING",[am]:"AGX_TONE_MAPPING",[om]:"NEUTRAL_TONE_MAPPING",[sm]:"CUSTOM_TONE_MAPPING"};function yS(r,e,t,n,i,s){const a=new ki(e,t,{type:r,depthBuffer:i,stencilBuffer:s,samples:n?4:0,depthTexture:i?new sa(e,t):void 0}),o=new ki(e,t,{type:sr,depthBuffer:!1,stencilBuffer:!1}),l=new Ei;l.setAttribute("position",new nr([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new nr([0,2,0,0,2,0],2));const c=new gx({uniforms:{tDiffuse:{value:null}},vertexShader:`
3961
3961
  precision highp float;
3962
3962
 
3963
3963
  uniform mat4 modelViewMatrix;
@@ -4003,17 +4003,17 @@ void main() {
4003
4003
  #ifdef SRGB_TRANSFER
4004
4004
  gl_FragColor = sRGBTransferOETF( gl_FragColor );
4005
4005
  #endif
4006
- }`,depthTest:!1,depthWrite:!1}),u=new or(l,c),h=new Cm(-1,1,1,-1,0,1);let f=null,d=null,g=!1,_,p=null,m=[],b=!1;this.setSize=function(A,M){a.setSize(A,M),o.setSize(A,M);for(let y=0;y<m.length;y++){const T=m[y];T.setSize&&T.setSize(A,M)}},this.setEffects=function(A){m=A,b=m.length>0&&m[0].isRenderPass===!0;const M=a.width,y=a.height;for(let T=0;T<m.length;T++){const w=m[T];w.setSize&&w.setSize(M,y)}},this.begin=function(A,M){if(g||A.toneMapping===Bi&&m.length===0)return!1;if(p=M,M!==null){const y=M.width,T=M.height;(a.width!==y||a.height!==T)&&this.setSize(y,T)}return b===!1&&A.setRenderTarget(a),_=A.toneMapping,A.toneMapping=Bi,!0},this.hasRenderPass=function(){return b},this.end=function(A,M){A.toneMapping=_,g=!0;let y=a,T=o;for(let w=0;w<m.length;w++){const v=m[w];if(v.enabled!==!1&&(v.render(A,T,y,M),v.needsSwap!==!1)){const E=y;y=T,T=E}}if(f!==A.outputColorSpace||d!==A.toneMapping){f=A.outputColorSpace,d=A.toneMapping,c.defines={},ct.getTransfer(f)===vt&&(c.defines.SRGB_TRANSFER="");const w=bS[d];w&&(c.defines[w]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=y.texture,A.setRenderTarget(p),A.render(u,h),p=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){a.depthTexture&&a.depthTexture.dispose(),a.dispose(),o.dispose(),l.dispose(),c.dispose()}}const Nm=new Un,zu=new ra(1,1),Im=new _m,Um=new X0,Fm=new Tm,ah=[],oh=[],lh=new Float32Array(16),ch=new Float32Array(9),uh=new Float32Array(4);function la(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=ah[i];if(s===void 0&&(s=new Float32Array(i),ah[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function en(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function tn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Ll(r,e){let t=oh[e];t===void 0&&(t=new Int32Array(e),oh[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function ES(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function TS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(en(t,e))return;r.uniform2fv(this.addr,e),tn(t,e)}}function wS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(en(t,e))return;r.uniform3fv(this.addr,e),tn(t,e)}}function AS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(en(t,e))return;r.uniform4fv(this.addr,e),tn(t,e)}}function RS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(en(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),tn(t,e)}else{if(en(t,n))return;uh.set(n),r.uniformMatrix2fv(this.addr,!1,uh),tn(t,n)}}function CS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(en(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),tn(t,e)}else{if(en(t,n))return;ch.set(n),r.uniformMatrix3fv(this.addr,!1,ch),tn(t,n)}}function PS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(en(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),tn(t,e)}else{if(en(t,n))return;lh.set(n),r.uniformMatrix4fv(this.addr,!1,lh),tn(t,n)}}function DS(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function LS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(en(t,e))return;r.uniform2iv(this.addr,e),tn(t,e)}}function NS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(en(t,e))return;r.uniform3iv(this.addr,e),tn(t,e)}}function IS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(en(t,e))return;r.uniform4iv(this.addr,e),tn(t,e)}}function US(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function FS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(en(t,e))return;r.uniform2uiv(this.addr,e),tn(t,e)}}function OS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(en(t,e))return;r.uniform3uiv(this.addr,e),tn(t,e)}}function BS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(en(t,e))return;r.uniform4uiv(this.addr,e),tn(t,e)}}function kS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(zu.compareFunction=t.isReversedDepthBuffer()?Ef:yf,s=zu):s=Nm,t.setTexture2D(e||s,i)}function zS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Um,i)}function GS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Fm,i)}function VS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Im,i)}function HS(r){switch(r){case 5126:return ES;case 35664:return TS;case 35665:return wS;case 35666:return AS;case 35674:return RS;case 35675:return CS;case 35676:return PS;case 5124:case 35670:return DS;case 35667:case 35671:return LS;case 35668:case 35672:return NS;case 35669:case 35673:return IS;case 5125:return US;case 36294:return FS;case 36295:return OS;case 36296:return BS;case 35678:case 36198:case 36298:case 36306:case 35682:return kS;case 35679:case 36299:case 36307:return zS;case 35680:case 36300:case 36308:case 36293:return GS;case 36289:case 36303:case 36311:case 36292:return VS}}function WS(r,e){r.uniform1fv(this.addr,e)}function XS(r,e){const t=la(e,this.size,2);r.uniform2fv(this.addr,t)}function YS(r,e){const t=la(e,this.size,3);r.uniform3fv(this.addr,t)}function qS(r,e){const t=la(e,this.size,4);r.uniform4fv(this.addr,t)}function $S(r,e){const t=la(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function KS(r,e){const t=la(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function ZS(r,e){const t=la(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function jS(r,e){r.uniform1iv(this.addr,e)}function JS(r,e){r.uniform2iv(this.addr,e)}function QS(r,e){r.uniform3iv(this.addr,e)}function eb(r,e){r.uniform4iv(this.addr,e)}function tb(r,e){r.uniform1uiv(this.addr,e)}function nb(r,e){r.uniform2uiv(this.addr,e)}function ib(r,e){r.uniform3uiv(this.addr,e)}function rb(r,e){r.uniform4uiv(this.addr,e)}function sb(r,e,t){const n=this.cache,i=e.length,s=Ll(t,i);en(n,s)||(r.uniform1iv(this.addr,s),tn(n,s));let a;this.type===r.SAMPLER_2D_SHADOW?a=zu:a=Nm;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,s[o])}function ab(r,e,t){const n=this.cache,i=e.length,s=Ll(t,i);en(n,s)||(r.uniform1iv(this.addr,s),tn(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Um,s[a])}function ob(r,e,t){const n=this.cache,i=e.length,s=Ll(t,i);en(n,s)||(r.uniform1iv(this.addr,s),tn(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Fm,s[a])}function lb(r,e,t){const n=this.cache,i=e.length,s=Ll(t,i);en(n,s)||(r.uniform1iv(this.addr,s),tn(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Im,s[a])}function cb(r){switch(r){case 5126:return WS;case 35664:return XS;case 35665:return YS;case 35666:return qS;case 35674:return $S;case 35675:return KS;case 35676:return ZS;case 5124:case 35670:return jS;case 35667:case 35671:return JS;case 35668:case 35672:return QS;case 35669:case 35673:return eb;case 5125:return tb;case 36294:return nb;case 36295:return ib;case 36296:return rb;case 35678:case 36198:case 36298:case 36306:case 35682:return sb;case 35679:case 36299:case 36307:return ab;case 35680:case 36300:case 36308:case 36293:return ob;case 36289:case 36303:case 36311:case 36292:return lb}}class ub{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=HS(t.type)}}class fb{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=cb(t.type)}}class db{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const yc=/(\w+)(\])?(\[|\.)?/g;function fh(r,e){r.seq.push(e),r.map[e.id]=e}function hb(r,e,t){const n=r.name,i=n.length;for(yc.lastIndex=0;;){const s=yc.exec(n),a=yc.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){fh(t,c===void 0?new ub(o,r,e):new fb(o,r,e));break}else{let h=t.map[o];h===void 0&&(h=new db(o),fh(t,h)),t=h}}}class sl{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);hb(o,l,this)}const i=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):s.push(a);i.length>0&&(this.seq=i.concat(s))}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function dh(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const pb=37297;let mb=0;function gb(r,e){const t=r.split(`
4006
+ }`,depthTest:!1,depthWrite:!1}),u=new or(l,c),h=new Cm(-1,1,1,-1,0,1);let f=null,d=null,g=!1,_,p=null,m=[],b=!1;this.setSize=function(w,M){a.setSize(w,M),o.setSize(w,M);for(let y=0;y<m.length;y++){const T=m[y];T.setSize&&T.setSize(w,M)}},this.setEffects=function(w){m=w,b=m.length>0&&m[0].isRenderPass===!0;const M=a.width,y=a.height;for(let T=0;T<m.length;T++){const A=m[T];A.setSize&&A.setSize(M,y)}},this.begin=function(w,M){if(g||w.toneMapping===Bi&&m.length===0)return!1;if(p=M,M!==null){const y=M.width,T=M.height;(a.width!==y||a.height!==T)&&this.setSize(y,T)}return b===!1&&w.setRenderTarget(a),_=w.toneMapping,w.toneMapping=Bi,!0},this.hasRenderPass=function(){return b},this.end=function(w,M){w.toneMapping=_,g=!0;let y=a,T=o;for(let A=0;A<m.length;A++){const v=m[A];if(v.enabled!==!1&&(v.render(w,T,y,M),v.needsSwap!==!1)){const E=y;y=T,T=E}}if(f!==w.outputColorSpace||d!==w.toneMapping){f=w.outputColorSpace,d=w.toneMapping,c.defines={},ct.getTransfer(f)===vt&&(c.defines.SRGB_TRANSFER="");const A=bS[d];A&&(c.defines[A]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=y.texture,w.setRenderTarget(p),w.render(u,h),p=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){a.depthTexture&&a.depthTexture.dispose(),a.dispose(),o.dispose(),l.dispose(),c.dispose()}}const Nm=new Un,Gu=new sa(1,1),Im=new _m,Um=new X_,Fm=new Tm,ah=[],oh=[],lh=new Float32Array(16),ch=new Float32Array(9),uh=new Float32Array(4);function ca(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=ah[i];if(s===void 0&&(s=new Float32Array(i),ah[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function nn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Nl(r,e){let t=oh[e];t===void 0&&(t=new Int32Array(e),oh[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function ES(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function TS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(tn(t,e))return;r.uniform2fv(this.addr,e),nn(t,e)}}function wS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(tn(t,e))return;r.uniform3fv(this.addr,e),nn(t,e)}}function AS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(tn(t,e))return;r.uniform4fv(this.addr,e),nn(t,e)}}function RS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(tn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),nn(t,e)}else{if(tn(t,n))return;uh.set(n),r.uniformMatrix2fv(this.addr,!1,uh),nn(t,n)}}function CS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(tn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),nn(t,e)}else{if(tn(t,n))return;ch.set(n),r.uniformMatrix3fv(this.addr,!1,ch),nn(t,n)}}function PS(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(tn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),nn(t,e)}else{if(tn(t,n))return;lh.set(n),r.uniformMatrix4fv(this.addr,!1,lh),nn(t,n)}}function DS(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function LS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(tn(t,e))return;r.uniform2iv(this.addr,e),nn(t,e)}}function NS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(tn(t,e))return;r.uniform3iv(this.addr,e),nn(t,e)}}function IS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(tn(t,e))return;r.uniform4iv(this.addr,e),nn(t,e)}}function US(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function FS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(tn(t,e))return;r.uniform2uiv(this.addr,e),nn(t,e)}}function OS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(tn(t,e))return;r.uniform3uiv(this.addr,e),nn(t,e)}}function BS(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(tn(t,e))return;r.uniform4uiv(this.addr,e),nn(t,e)}}function kS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(Gu.compareFunction=t.isReversedDepthBuffer()?Tf:Ef,s=Gu):s=Nm,t.setTexture2D(e||s,i)}function zS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Um,i)}function GS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Fm,i)}function VS(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Im,i)}function HS(r){switch(r){case 5126:return ES;case 35664:return TS;case 35665:return wS;case 35666:return AS;case 35674:return RS;case 35675:return CS;case 35676:return PS;case 5124:case 35670:return DS;case 35667:case 35671:return LS;case 35668:case 35672:return NS;case 35669:case 35673:return IS;case 5125:return US;case 36294:return FS;case 36295:return OS;case 36296:return BS;case 35678:case 36198:case 36298:case 36306:case 35682:return kS;case 35679:case 36299:case 36307:return zS;case 35680:case 36300:case 36308:case 36293:return GS;case 36289:case 36303:case 36311:case 36292:return VS}}function WS(r,e){r.uniform1fv(this.addr,e)}function XS(r,e){const t=ca(e,this.size,2);r.uniform2fv(this.addr,t)}function YS(r,e){const t=ca(e,this.size,3);r.uniform3fv(this.addr,t)}function qS(r,e){const t=ca(e,this.size,4);r.uniform4fv(this.addr,t)}function $S(r,e){const t=ca(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function ZS(r,e){const t=ca(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function KS(r,e){const t=ca(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function jS(r,e){r.uniform1iv(this.addr,e)}function JS(r,e){r.uniform2iv(this.addr,e)}function QS(r,e){r.uniform3iv(this.addr,e)}function eb(r,e){r.uniform4iv(this.addr,e)}function tb(r,e){r.uniform1uiv(this.addr,e)}function nb(r,e){r.uniform2uiv(this.addr,e)}function ib(r,e){r.uniform3uiv(this.addr,e)}function rb(r,e){r.uniform4uiv(this.addr,e)}function sb(r,e,t){const n=this.cache,i=e.length,s=Nl(t,i);tn(n,s)||(r.uniform1iv(this.addr,s),nn(n,s));let a;this.type===r.SAMPLER_2D_SHADOW?a=Gu:a=Nm;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,s[o])}function ab(r,e,t){const n=this.cache,i=e.length,s=Nl(t,i);tn(n,s)||(r.uniform1iv(this.addr,s),nn(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Um,s[a])}function ob(r,e,t){const n=this.cache,i=e.length,s=Nl(t,i);tn(n,s)||(r.uniform1iv(this.addr,s),nn(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Fm,s[a])}function lb(r,e,t){const n=this.cache,i=e.length,s=Nl(t,i);tn(n,s)||(r.uniform1iv(this.addr,s),nn(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Im,s[a])}function cb(r){switch(r){case 5126:return WS;case 35664:return XS;case 35665:return YS;case 35666:return qS;case 35674:return $S;case 35675:return ZS;case 35676:return KS;case 5124:case 35670:return jS;case 35667:case 35671:return JS;case 35668:case 35672:return QS;case 35669:case 35673:return eb;case 5125:return tb;case 36294:return nb;case 36295:return ib;case 36296:return rb;case 35678:case 36198:case 36298:case 36306:case 35682:return sb;case 35679:case 36299:case 36307:return ab;case 35680:case 36300:case 36308:case 36293:return ob;case 36289:case 36303:case 36311:case 36292:return lb}}class ub{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=HS(t.type)}}class fb{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=cb(t.type)}}class db{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const Ec=/(\w+)(\])?(\[|\.)?/g;function fh(r,e){r.seq.push(e),r.map[e.id]=e}function hb(r,e,t){const n=r.name,i=n.length;for(Ec.lastIndex=0;;){const s=Ec.exec(n),a=Ec.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){fh(t,c===void 0?new ub(o,r,e):new fb(o,r,e));break}else{let h=t.map[o];h===void 0&&(h=new db(o),fh(t,h)),t=h}}}class al{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);hb(o,l,this)}const i=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):s.push(a);i.length>0&&(this.seq=i.concat(s))}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function dh(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const pb=37297;let mb=0;function gb(r,e){const t=r.split(`
4007
4007
  `),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
4008
- `)}const hh=new Ke;function _b(r){ct._getMatrix(hh,ct.workingColorSpace,r);const e=`mat3( ${hh.elements.map(t=>t.toFixed(4))} )`;switch(ct.getTransfer(r)){case Ml:return[e,"LinearTransferOETF"];case vt:return[e,"sRGBTransferOETF"];default:return Ye("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function ph(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),s=(r.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
4008
+ `)}const hh=new Ke;function _b(r){ct._getMatrix(hh,ct.workingColorSpace,r);const e=`mat3( ${hh.elements.map(t=>t.toFixed(4))} )`;switch(ct.getTransfer(r)){case Sl:return[e,"LinearTransferOETF"];case vt:return[e,"sRGBTransferOETF"];default:return Ye("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function ph(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),s=(r.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
4009
4009
 
4010
4010
  `+s+`
4011
4011
 
4012
4012
  `+gb(r.getShaderSource(e),o)}else return s}function xb(r,e){const t=_b(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4013
- `)}const vb={[tm]:"Linear",[nm]:"Reinhard",[im]:"Cineon",[rm]:"ACESFilmic",[am]:"AgX",[om]:"Neutral",[sm]:"Custom"};function Mb(r,e){const t=vb[e];return t===void 0?(Ye("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Vo=new q;function Sb(){ct.getLuminanceCoefficients(Vo);const r=Vo.x.toFixed(4),e=Vo.y.toFixed(4),t=Vo.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
4014
- `)}function bb(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(wa).join(`
4013
+ `)}const vb={[tm]:"Linear",[nm]:"Reinhard",[im]:"Cineon",[rm]:"ACESFilmic",[am]:"AgX",[om]:"Neutral",[sm]:"Custom"};function Mb(r,e){const t=vb[e];return t===void 0?(Ye("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ho=new Y;function Sb(){ct.getLuminanceCoefficients(Ho);const r=Ho.x.toFixed(4),e=Ho.y.toFixed(4),t=Ho.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
4014
+ `)}function bb(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Aa).join(`
4015
4015
  `)}function yb(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
4016
- `)}function Eb(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function wa(r){return r!==""}function mh(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function gh(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Tb=/^[ \t]*#include +<([\w\d./]+)>/gm;function Gu(r){return r.replace(Tb,Ab)}const wb=new Map;function Ab(r,e){let t=Qe[e];if(t===void 0){const n=wb.get(e);if(n!==void 0)t=Qe[n],Ye('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return Gu(t)}const Rb=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function _h(r){return r.replace(Rb,Cb)}function Cb(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function xh(r){let e=`precision ${r.precision} float;
4016
+ `)}function Eb(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function Aa(r){return r!==""}function mh(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function gh(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Tb=/^[ \t]*#include +<([\w\d./]+)>/gm;function Vu(r){return r.replace(Tb,Ab)}const wb=new Map;function Ab(r,e){let t=et[e];if(t===void 0){const n=wb.get(e);if(n!==void 0)t=et[n],Ye('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return Vu(t)}const Rb=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function _h(r){return r.replace(Rb,Cb)}function Cb(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function xh(r){let e=`precision ${r.precision} float;
4017
4017
  precision ${r.precision} int;
4018
4018
  precision ${r.precision} sampler2D;
4019
4019
  precision ${r.precision} samplerCube;
@@ -4033,28 +4033,28 @@ void main() {
4033
4033
  `;return r.precision==="highp"?e+=`
4034
4034
  #define HIGH_PRECISION`:r.precision==="mediump"?e+=`
4035
4035
  #define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
4036
- #define LOW_PRECISION`),e}const Pb={[el]:"SHADOWMAP_TYPE_PCF",[Ta]:"SHADOWMAP_TYPE_VSM"};function Db(r){return Pb[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const Lb={[os]:"ENVMAP_TYPE_CUBE",[ia]:"ENVMAP_TYPE_CUBE",[Rl]:"ENVMAP_TYPE_CUBE_UV"};function Nb(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":Lb[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const Ib={[ia]:"ENVMAP_MODE_REFRACTION"};function Ub(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":Ib[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Fb={[em]:"ENVMAP_BLENDING_MULTIPLY",[c0]:"ENVMAP_BLENDING_MIX",[u0]:"ENVMAP_BLENDING_ADD"};function Ob(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":Fb[r.combine]||"ENVMAP_BLENDING_NONE"}function Bb(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function kb(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Db(t),c=Nb(t),u=Ub(t),h=Ob(t),f=Bb(t),d=bb(t),g=yb(s),_=i.createProgram();let p,m,b=t.glslVersion?"#version "+t.glslVersion+`
4037
- `:"";t.isRawShaderMaterial?(p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(wa).join(`
4036
+ #define LOW_PRECISION`),e}const Pb={[tl]:"SHADOWMAP_TYPE_PCF",[wa]:"SHADOWMAP_TYPE_VSM"};function Db(r){return Pb[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const Lb={[ls]:"ENVMAP_TYPE_CUBE",[ra]:"ENVMAP_TYPE_CUBE",[Cl]:"ENVMAP_TYPE_CUBE_UV"};function Nb(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":Lb[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const Ib={[ra]:"ENVMAP_MODE_REFRACTION"};function Ub(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":Ib[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Fb={[em]:"ENVMAP_BLENDING_MULTIPLY",[c_]:"ENVMAP_BLENDING_MIX",[u_]:"ENVMAP_BLENDING_ADD"};function Ob(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":Fb[r.combine]||"ENVMAP_BLENDING_NONE"}function Bb(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function kb(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Db(t),c=Nb(t),u=Ub(t),h=Ob(t),f=Bb(t),d=bb(t),g=yb(s),_=i.createProgram();let p,m,b=t.glslVersion?"#version "+t.glslVersion+`
4037
+ `:"";t.isRawShaderMaterial?(p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Aa).join(`
4038
4038
  `),p.length>0&&(p+=`
4039
- `),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(wa).join(`
4039
+ `),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Aa).join(`
4040
4040
  `),m.length>0&&(m+=`
4041
4041
  `)):(p=[xh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
4042
- `].filter(wa).join(`
4043
- `),m=[xh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Bi?"#define TONE_MAPPING":"",t.toneMapping!==Bi?Qe.tonemapping_pars_fragment:"",t.toneMapping!==Bi?Mb("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Qe.colorspace_pars_fragment,xb("linearToOutputTexel",t.outputColorSpace),Sb(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4044
- `].filter(wa).join(`
4045
- `)),a=Gu(a),a=mh(a,t),a=gh(a,t),o=Gu(o),o=mh(o,t),o=gh(o,t),a=_h(a),o=_h(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
4042
+ `].filter(Aa).join(`
4043
+ `),m=[xh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Bi?"#define TONE_MAPPING":"",t.toneMapping!==Bi?et.tonemapping_pars_fragment:"",t.toneMapping!==Bi?Mb("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",et.colorspace_pars_fragment,xb("linearToOutputTexel",t.outputColorSpace),Sb(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4044
+ `].filter(Aa).join(`
4045
+ `)),a=Vu(a),a=mh(a,t),a=gh(a,t),o=Vu(o),o=mh(o,t),o=gh(o,t),a=_h(a),o=_h(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
4046
4046
  `,p=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4047
4047
  `)+`
4048
- `+p,m=["#define varying in",t.glslVersion===Rd?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Rd?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4048
+ `+p,m=["#define varying in",t.glslVersion===Cd?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Cd?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4049
4049
  `)+`
4050
- `+m);const A=b+p+a,M=b+m+o,y=dh(i,i.VERTEX_SHADER,A),T=dh(i,i.FRAGMENT_SHADER,M);i.attachShader(_,y),i.attachShader(_,T),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.hasPositionAttribute===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function w(L){if(r.debug.checkShaderErrors){const N=i.getProgramInfoLog(_)||"",Y=i.getShaderInfoLog(y)||"",H=i.getShaderInfoLog(T)||"",O=N.trim(),z=Y.trim(),I=H.trim();let W=!0,Z=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(W=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,y,T);else{const D=ph(i,y,"vertex"),re=ph(i,T,"fragment");pt("WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
4050
+ `+m);const w=b+p+a,M=b+m+o,y=dh(i,i.VERTEX_SHADER,w),T=dh(i,i.FRAGMENT_SHADER,M);i.attachShader(_,y),i.attachShader(_,T),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.hasPositionAttribute===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function A(L){if(r.debug.checkShaderErrors){const N=i.getProgramInfoLog(_)||"",q=i.getShaderInfoLog(y)||"",W=i.getShaderInfoLog(T)||"",B=N.trim(),G=q.trim(),I=W.trim();let $=!0,j=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if($=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,y,T);else{const D=ph(i,y,"vertex"),se=ph(i,T,"fragment");ht("WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
4051
4051
 
4052
4052
  Material Name: `+L.name+`
4053
4053
  Material Type: `+L.type+`
4054
4054
 
4055
- Program Info Log: `+O+`
4055
+ Program Info Log: `+B+`
4056
4056
  `+D+`
4057
- `+re)}else O!==""?Ye("WebGLProgram: Program Info Log:",O):(z===""||I==="")&&(Z=!1);Z&&(L.diagnostics={runnable:W,programLog:O,vertexShader:{log:z,prefix:p},fragmentShader:{log:I,prefix:m}})}i.deleteShader(y),i.deleteShader(T),v=new sl(i,_),E=Eb(i,_)}let v;this.getUniforms=function(){return v===void 0&&w(this),v};let E;this.getAttributes=function(){return E===void 0&&w(this),E};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=i.getProgramParameter(_,pb)),C},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=mb++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=y,this.fragmentShader=T,this}let zb=0;class Gb{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const i=this._getShaderCacheForMaterial(e);return i.has(t)===!1&&(i.add(t),t.usedTimes++),i.has(n)===!1&&(i.add(n),n.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Vb(e),t.set(e,n)),n}}class Vb{constructor(e){this.id=zb++,this.code=e,this.usedTimes=0}}function Hb(r){return r===ls||r===_l||r===xl}function Wb(r,e,t,n,i,s){const a=new xm,o=new Gb,l=new Set,c=[],u=new Map,h=n.logarithmicDepthBuffer;let f=n.precision;const d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(v){return l.add(v),v===0?"uv":`uv${v}`}function _(v,E,C,L,N,Y){const H=L.fog,O=N.geometry,z=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?L.environment:null,I=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,W=e.get(v.envMap||z,I),Z=W&&W.mapping===Rl?W.image.height:null,D=d[v.type];v.precision!==null&&(f=n.getMaxPrecision(v.precision),f!==v.precision&&Ye("WebGLProgram.getParameters:",v.precision,"not supported, using",f,"instead."));const re=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,he=re!==void 0?re.length:0;let He=0;O.morphAttributes.position!==void 0&&(He=1),O.morphAttributes.normal!==void 0&&(He=2),O.morphAttributes.color!==void 0&&(He=3);let Be,Pe,J,ae;if(D){const ie=Di[D];Be=ie.vertexShader,Pe=ie.fragmentShader}else{Be=v.vertexShader,Pe=v.fragmentShader;const ie=o.getVertexShaderStage(v),ze=o.getFragmentShaderStage(v);o.update(v,ie,ze),J=ie.id,ae=ze.id}const se=r.getRenderTarget(),we=r.state.buffers.depth.getReversed(),Oe=N.isInstancedMesh===!0,Ee=N.isBatchedMesh===!0,Je=!!v.map,be=!!v.matcap,We=!!W,Te=!!v.aoMap,Ne=!!v.lightMap,$=!!v.bumpMap&&v.wireframe===!1,je=!!v.normalMap,ft=!!v.displacementMap,_t=!!v.emissiveMap,qe=!!v.metalnessMap,at=!!v.roughnessMap,F=v.anisotropy>0,Mt=v.clearcoat>0,Xe=v.dispersion>0,R=v.iridescence>0,x=v.sheen>0,B=v.transmission>0,V=F&&!!v.anisotropyMap,j=Mt&&!!v.clearcoatMap,fe=Mt&&!!v.clearcoatNormalMap,ce=Mt&&!!v.clearcoatRoughnessMap,Q=R&&!!v.iridescenceMap,ee=R&&!!v.iridescenceThicknessMap,me=x&&!!v.sheenColorMap,Ce=x&&!!v.sheenRoughnessMap,ge=!!v.specularMap,pe=!!v.specularColorMap,ue=!!v.specularIntensityMap,Ie=B&&!!v.transmissionMap,ke=B&&!!v.thicknessMap,U=!!v.gradientMap,de=!!v.alphaMap,te=v.alphaTest>0,_e=!!v.alphaHash,xe=!!v.extensions;let ne=Bi;v.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&(ne=r.toneMapping);const oe={shaderID:D,shaderType:v.type,shaderName:v.name,vertexShader:Be,fragmentShader:Pe,defines:v.defines,customVertexShaderID:J,customFragmentShaderID:ae,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:f,batching:Ee,batchingColor:Ee&&N._colorsTexture!==null,instancing:Oe,instancingColor:Oe&&N.instanceColor!==null,instancingMorph:Oe&&N.morphTexture!==null,outputColorSpace:se===null?r.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:ct.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:Je,matcap:be,envMap:We,envMapMode:We&&W.mapping,envMapCubeUVHeight:Z,aoMap:Te,lightMap:Ne,bumpMap:$,normalMap:je,displacementMap:ft,emissiveMap:_t,normalMapObjectSpace:je&&v.normalMapType===h0,normalMapTangentSpace:je&&v.normalMapType===Td,packedNormalMap:je&&v.normalMapType===Td&&Hb(v.normalMap.format),metalnessMap:qe,roughnessMap:at,anisotropy:F,anisotropyMap:V,clearcoat:Mt,clearcoatMap:j,clearcoatNormalMap:fe,clearcoatRoughnessMap:ce,dispersion:Xe,iridescence:R,iridescenceMap:Q,iridescenceThicknessMap:ee,sheen:x,sheenColorMap:me,sheenRoughnessMap:Ce,specularMap:ge,specularColorMap:pe,specularIntensityMap:ue,transmission:B,transmissionMap:Ie,thicknessMap:ke,gradientMap:U,opaque:v.transparent===!1&&v.blending===qs&&v.alphaToCoverage===!1,alphaMap:de,alphaTest:te,alphaHash:_e,combine:v.combine,mapUv:Je&&g(v.map.channel),aoMapUv:Te&&g(v.aoMap.channel),lightMapUv:Ne&&g(v.lightMap.channel),bumpMapUv:$&&g(v.bumpMap.channel),normalMapUv:je&&g(v.normalMap.channel),displacementMapUv:ft&&g(v.displacementMap.channel),emissiveMapUv:_t&&g(v.emissiveMap.channel),metalnessMapUv:qe&&g(v.metalnessMap.channel),roughnessMapUv:at&&g(v.roughnessMap.channel),anisotropyMapUv:V&&g(v.anisotropyMap.channel),clearcoatMapUv:j&&g(v.clearcoatMap.channel),clearcoatNormalMapUv:fe&&g(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ce&&g(v.clearcoatRoughnessMap.channel),iridescenceMapUv:Q&&g(v.iridescenceMap.channel),iridescenceThicknessMapUv:ee&&g(v.iridescenceThicknessMap.channel),sheenColorMapUv:me&&g(v.sheenColorMap.channel),sheenRoughnessMapUv:Ce&&g(v.sheenRoughnessMap.channel),specularMapUv:ge&&g(v.specularMap.channel),specularColorMapUv:pe&&g(v.specularColorMap.channel),specularIntensityMapUv:ue&&g(v.specularIntensityMap.channel),transmissionMapUv:Ie&&g(v.transmissionMap.channel),thicknessMapUv:ke&&g(v.thicknessMap.channel),alphaMapUv:de&&g(v.alphaMap.channel),vertexTangents:!!O.attributes.tangent&&(je||F),vertexNormals:!!O.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!O.attributes.uv&&(Je||de),fog:!!H,useFog:v.fog===!0,fogExp2:!!H&&H.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||O.attributes.normal===void 0&&je===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:we,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:O.attributes.position!==void 0,morphTargets:O.morphAttributes.position!==void 0,morphNormals:O.morphAttributes.normal!==void 0,morphColors:O.morphAttributes.color!==void 0,morphTargetsCount:he,morphTextureStride:He,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numLightProbeGrids:Y.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:v.dithering,shadowMapEnabled:r.shadowMap.enabled&&C.length>0,shadowMapType:r.shadowMap.type,toneMapping:ne,decodeVideoTexture:Je&&v.map.isVideoTexture===!0&&ct.getTransfer(v.map.colorSpace)===vt,decodeVideoTextureEmissive:_t&&v.emissiveMap.isVideoTexture===!0&&ct.getTransfer(v.emissiveMap.colorSpace)===vt,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===Zi,flipSided:v.side===Vn,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:xe&&v.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xe&&v.extensions.multiDraw===!0||Ee)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return oe.vertexUv1s=l.has(1),oe.vertexUv2s=l.has(2),oe.vertexUv3s=l.has(3),l.clear(),oe}function p(v){const E=[];if(v.shaderID?E.push(v.shaderID):(E.push(v.customVertexShaderID),E.push(v.customFragmentShaderID)),v.defines!==void 0)for(const C in v.defines)E.push(C),E.push(v.defines[C]);return v.isRawShaderMaterial===!1&&(m(E,v),b(E,v),E.push(r.outputColorSpace)),E.push(v.customProgramCacheKey),E.join()}function m(v,E){v.push(E.precision),v.push(E.outputColorSpace),v.push(E.envMapMode),v.push(E.envMapCubeUVHeight),v.push(E.mapUv),v.push(E.alphaMapUv),v.push(E.lightMapUv),v.push(E.aoMapUv),v.push(E.bumpMapUv),v.push(E.normalMapUv),v.push(E.displacementMapUv),v.push(E.emissiveMapUv),v.push(E.metalnessMapUv),v.push(E.roughnessMapUv),v.push(E.anisotropyMapUv),v.push(E.clearcoatMapUv),v.push(E.clearcoatNormalMapUv),v.push(E.clearcoatRoughnessMapUv),v.push(E.iridescenceMapUv),v.push(E.iridescenceThicknessMapUv),v.push(E.sheenColorMapUv),v.push(E.sheenRoughnessMapUv),v.push(E.specularMapUv),v.push(E.specularColorMapUv),v.push(E.specularIntensityMapUv),v.push(E.transmissionMapUv),v.push(E.thicknessMapUv),v.push(E.combine),v.push(E.fogExp2),v.push(E.sizeAttenuation),v.push(E.morphTargetsCount),v.push(E.morphAttributeCount),v.push(E.numDirLights),v.push(E.numPointLights),v.push(E.numSpotLights),v.push(E.numSpotLightMaps),v.push(E.numHemiLights),v.push(E.numRectAreaLights),v.push(E.numDirLightShadows),v.push(E.numPointLightShadows),v.push(E.numSpotLightShadows),v.push(E.numSpotLightShadowsWithMaps),v.push(E.numLightProbes),v.push(E.shadowMapType),v.push(E.toneMapping),v.push(E.numClippingPlanes),v.push(E.numClipIntersection),v.push(E.depthPacking)}function b(v,E){a.disableAll(),E.instancing&&a.enable(0),E.instancingColor&&a.enable(1),E.instancingMorph&&a.enable(2),E.matcap&&a.enable(3),E.envMap&&a.enable(4),E.normalMapObjectSpace&&a.enable(5),E.normalMapTangentSpace&&a.enable(6),E.clearcoat&&a.enable(7),E.iridescence&&a.enable(8),E.alphaTest&&a.enable(9),E.vertexColors&&a.enable(10),E.vertexAlphas&&a.enable(11),E.vertexUv1s&&a.enable(12),E.vertexUv2s&&a.enable(13),E.vertexUv3s&&a.enable(14),E.vertexTangents&&a.enable(15),E.anisotropy&&a.enable(16),E.alphaHash&&a.enable(17),E.batching&&a.enable(18),E.dispersion&&a.enable(19),E.batchingColor&&a.enable(20),E.gradientMap&&a.enable(21),E.packedNormalMap&&a.enable(22),E.vertexNormals&&a.enable(23),v.push(a.mask),a.disableAll(),E.fog&&a.enable(0),E.useFog&&a.enable(1),E.flatShading&&a.enable(2),E.logarithmicDepthBuffer&&a.enable(3),E.reversedDepthBuffer&&a.enable(4),E.skinning&&a.enable(5),E.morphTargets&&a.enable(6),E.morphNormals&&a.enable(7),E.morphColors&&a.enable(8),E.premultipliedAlpha&&a.enable(9),E.shadowMapEnabled&&a.enable(10),E.doubleSided&&a.enable(11),E.flipSided&&a.enable(12),E.useDepthPacking&&a.enable(13),E.dithering&&a.enable(14),E.transmission&&a.enable(15),E.sheen&&a.enable(16),E.opaque&&a.enable(17),E.pointsUvs&&a.enable(18),E.decodeVideoTexture&&a.enable(19),E.decodeVideoTextureEmissive&&a.enable(20),E.alphaToCoverage&&a.enable(21),E.numLightProbeGrids>0&&a.enable(22),E.hasPositionAttribute&&a.enable(23),v.push(a.mask)}function A(v){const E=d[v.type];let C;if(E){const L=Di[E];C=hx.clone(L.uniforms)}else C=v.uniforms;return C}function M(v,E){let C=u.get(E);return C!==void 0?++C.usedTimes:(C=new kb(r,E,v,i),c.push(C),u.set(E,C)),C}function y(v){if(--v.usedTimes===0){const E=c.indexOf(v);c[E]=c[c.length-1],c.pop(),u.delete(v.cacheKey),v.destroy()}}function T(v){o.remove(v)}function w(){o.dispose()}return{getParameters:_,getProgramCacheKey:p,getUniforms:A,acquireProgram:M,releaseProgram:y,releaseShaderCache:T,programs:c,dispose:w}}function Xb(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,l){r.get(a)[o]=l}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function Yb(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function vh(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Mh(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(f){let d=0;return f.isInstancedMesh&&(d+=2),f.isSkinnedMesh&&(d+=1),d}function o(f,d,g,_,p,m){let b=r[e];return b===void 0?(b={id:f.id,object:f,geometry:d,material:g,materialVariant:a(f),groupOrder:_,renderOrder:f.renderOrder,z:p,group:m},r[e]=b):(b.id=f.id,b.object=f,b.geometry=d,b.material=g,b.materialVariant=a(f),b.groupOrder=_,b.renderOrder=f.renderOrder,b.z=p,b.group=m),e++,b}function l(f,d,g,_,p,m){const b=o(f,d,g,_,p,m);g.transmission>0?n.push(b):g.transparent===!0?i.push(b):t.push(b)}function c(f,d,g,_,p,m){const b=o(f,d,g,_,p,m);g.transmission>0?n.unshift(b):g.transparent===!0?i.unshift(b):t.unshift(b)}function u(f,d,g){t.length>1&&t.sort(f||Yb),n.length>1&&n.sort(d||vh),i.length>1&&i.sort(d||vh),g&&(t.reverse(),n.reverse(),i.reverse())}function h(){for(let f=e,d=r.length;f<d;f++){const g=r[f];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:l,unshift:c,finish:h,sort:u}}function qb(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new Mh,r.set(n,[a])):i>=s.length?(a=new Mh,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function $b(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new q,color:new dt};break;case"SpotLight":t={position:new q,direction:new q,color:new dt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new q,color:new dt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new q,skyColor:new dt,groundColor:new dt};break;case"RectAreaLight":t={color:new dt,position:new q,halfWidth:new q,halfHeight:new q};break}return r[e.id]=t,t}}}function Kb(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mt,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Zb=0;function jb(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function Jb(r){const e=new $b,t=Kb(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new q);const i=new q,s=new Xt,a=new Xt;function o(c){let u=0,h=0,f=0;for(let E=0;E<9;E++)n.probe[E].set(0,0,0);let d=0,g=0,_=0,p=0,m=0,b=0,A=0,M=0,y=0,T=0,w=0;c.sort(jb);for(let E=0,C=c.length;E<C;E++){const L=c[E],N=L.color,Y=L.intensity,H=L.distance;let O=null;if(L.shadow&&L.shadow.map&&(L.shadow.map.texture.format===ls?O=L.shadow.map.texture:O=L.shadow.map.depthTexture||L.shadow.map.texture),L.isAmbientLight)u+=N.r*Y,h+=N.g*Y,f+=N.b*Y;else if(L.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(L.sh.coefficients[z],Y);w++}else if(L.isDirectionalLight){const z=e.get(L);if(z.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const I=L.shadow,W=t.get(L);W.shadowIntensity=I.intensity,W.shadowBias=I.bias,W.shadowNormalBias=I.normalBias,W.shadowRadius=I.radius,W.shadowMapSize=I.mapSize,n.directionalShadow[d]=W,n.directionalShadowMap[d]=O,n.directionalShadowMatrix[d]=L.shadow.matrix,b++}n.directional[d]=z,d++}else if(L.isSpotLight){const z=e.get(L);z.position.setFromMatrixPosition(L.matrixWorld),z.color.copy(N).multiplyScalar(Y),z.distance=H,z.coneCos=Math.cos(L.angle),z.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),z.decay=L.decay,n.spot[_]=z;const I=L.shadow;if(L.map&&(n.spotLightMap[y]=L.map,y++,I.updateMatrices(L),L.castShadow&&T++),n.spotLightMatrix[_]=I.matrix,L.castShadow){const W=t.get(L);W.shadowIntensity=I.intensity,W.shadowBias=I.bias,W.shadowNormalBias=I.normalBias,W.shadowRadius=I.radius,W.shadowMapSize=I.mapSize,n.spotShadow[_]=W,n.spotShadowMap[_]=O,M++}_++}else if(L.isRectAreaLight){const z=e.get(L);z.color.copy(N).multiplyScalar(Y),z.halfWidth.set(L.width*.5,0,0),z.halfHeight.set(0,L.height*.5,0),n.rectArea[p]=z,p++}else if(L.isPointLight){const z=e.get(L);if(z.color.copy(L.color).multiplyScalar(L.intensity),z.distance=L.distance,z.decay=L.decay,L.castShadow){const I=L.shadow,W=t.get(L);W.shadowIntensity=I.intensity,W.shadowBias=I.bias,W.shadowNormalBias=I.normalBias,W.shadowRadius=I.radius,W.shadowMapSize=I.mapSize,W.shadowCameraNear=I.camera.near,W.shadowCameraFar=I.camera.far,n.pointShadow[g]=W,n.pointShadowMap[g]=O,n.pointShadowMatrix[g]=L.shadow.matrix,A++}n.point[g]=z,g++}else if(L.isHemisphereLight){const z=e.get(L);z.skyColor.copy(L.color).multiplyScalar(Y),z.groundColor.copy(L.groundColor).multiplyScalar(Y),n.hemi[m]=z,m++}}p>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Se.LTC_FLOAT_1,n.rectAreaLTC2=Se.LTC_FLOAT_2):(n.rectAreaLTC1=Se.LTC_HALF_1,n.rectAreaLTC2=Se.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=f;const v=n.hash;(v.directionalLength!==d||v.pointLength!==g||v.spotLength!==_||v.rectAreaLength!==p||v.hemiLength!==m||v.numDirectionalShadows!==b||v.numPointShadows!==A||v.numSpotShadows!==M||v.numSpotMaps!==y||v.numLightProbes!==w)&&(n.directional.length=d,n.spot.length=_,n.rectArea.length=p,n.point.length=g,n.hemi.length=m,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=A,n.pointShadowMap.length=A,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=A,n.spotLightMatrix.length=M+y-T,n.spotLightMap.length=y,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=w,v.directionalLength=d,v.pointLength=g,v.spotLength=_,v.rectAreaLength=p,v.hemiLength=m,v.numDirectionalShadows=b,v.numPointShadows=A,v.numSpotShadows=M,v.numSpotMaps=y,v.numLightProbes=w,n.version=Zb++)}function l(c,u){let h=0,f=0,d=0,g=0,_=0;const p=u.matrixWorldInverse;for(let m=0,b=c.length;m<b;m++){const A=c[m];if(A.isDirectionalLight){const M=n.directional[h];M.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(p),h++}else if(A.isSpotLight){const M=n.spot[d];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(p),M.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(p),d++}else if(A.isRectAreaLight){const M=n.rectArea[g];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(p),a.identity(),s.copy(A.matrixWorld),s.premultiply(p),a.extractRotation(s),M.halfWidth.set(A.width*.5,0,0),M.halfHeight.set(0,A.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),g++}else if(A.isPointLight){const M=n.point[f];M.position.setFromMatrixPosition(A.matrixWorld),M.position.applyMatrix4(p),f++}else if(A.isHemisphereLight){const M=n.hemi[_];M.direction.setFromMatrixPosition(A.matrixWorld),M.direction.transformDirection(p),_++}}}return{setup:o,setupView:l,state:n}}function Sh(r){const e=new Jb(r),t=[],n=[],i=[];function s(f){h.camera=f,t.length=0,n.length=0,i.length=0}function a(f){t.push(f)}function o(f){n.push(f)}function l(f){i.push(f)}function c(){e.setup(t)}function u(f){e.setupView(t,f)}const h={lightsArray:t,shadowsArray:n,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:h,setupLights:c,setupLightsView:u,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function Qb(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new Sh(r),e.set(i,[o])):s>=a.length?(o=new Sh(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const ey=`void main() {
4057
+ `+se)}else B!==""?Ye("WebGLProgram: Program Info Log:",B):(G===""||I==="")&&(j=!1);j&&(L.diagnostics={runnable:$,programLog:B,vertexShader:{log:G,prefix:p},fragmentShader:{log:I,prefix:m}})}i.deleteShader(y),i.deleteShader(T),v=new al(i,_),E=Eb(i,_)}let v;this.getUniforms=function(){return v===void 0&&A(this),v};let E;this.getAttributes=function(){return E===void 0&&A(this),E};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=i.getProgramParameter(_,pb)),C},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=mb++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=y,this.fragmentShader=T,this}let zb=0;class Gb{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const i=this._getShaderCacheForMaterial(e);return i.has(t)===!1&&(i.add(t),t.usedTimes++),i.has(n)===!1&&(i.add(n),n.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Vb(e),t.set(e,n)),n}}class Vb{constructor(e){this.id=zb++,this.code=e,this.usedTimes=0}}function Hb(r){return r===cs||r===xl||r===vl}function Wb(r,e,t,n,i,s){const a=new xm,o=new Gb,l=new Set,c=[],u=new Map,h=n.logarithmicDepthBuffer;let f=n.precision;const d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(v){return l.add(v),v===0?"uv":`uv${v}`}function _(v,E,C,L,N,q){const W=L.fog,B=N.geometry,G=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?L.environment:null,I=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,$=e.get(v.envMap||G,I),j=$&&$.mapping===Cl?$.image.height:null,D=d[v.type];v.precision!==null&&(f=n.getMaxPrecision(v.precision),f!==v.precision&&Ye("WebGLProgram.getParameters:",v.precision,"not supported, using",f,"instead."));const se=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,he=se!==void 0?se.length:0;let Ve=0;B.morphAttributes.position!==void 0&&(Ve=1),B.morphAttributes.normal!==void 0&&(Ve=2),B.morphAttributes.color!==void 0&&(Ve=3);let He,De,J,ae;if(D){const ie=Di[D];He=ie.vertexShader,De=ie.fragmentShader}else{He=v.vertexShader,De=v.fragmentShader;const ie=o.getVertexShaderStage(v),ke=o.getFragmentShaderStage(v);o.update(v,ie,ke),J=ie.id,ae=ke.id}const re=r.getRenderTarget(),Re=r.state.buffers.depth.getReversed(),Ie=N.isInstancedMesh===!0,Ee=N.isBatchedMesh===!0,Qe=!!v.map,ye=!!v.matcap,Ge=!!$,Xe=!!v.aoMap,Te=!!v.lightMap,V=!!v.bumpMap&&v.wireframe===!1,Je=!!v.normalMap,$e=!!v.displacementMap,pt=!!v.emissiveMap,qe=!!v.metalnessMap,mt=!!v.roughnessMap,F=v.anisotropy>0,Dt=v.clearcoat>0,We=v.dispersion>0,R=v.iridescence>0,x=v.sheen>0,O=v.transmission>0,z=F&&!!v.anisotropyMap,K=Dt&&!!v.clearcoatMap,ue=Dt&&!!v.clearcoatNormalMap,oe=Dt&&!!v.clearcoatRoughnessMap,Q=R&&!!v.iridescenceMap,ee=R&&!!v.iridescenceThicknessMap,pe=x&&!!v.sheenColorMap,Ae=x&&!!v.sheenRoughnessMap,ge=!!v.specularMap,me=!!v.specularColorMap,fe=!!v.specularIntensityMap,Le=O&&!!v.transmissionMap,Be=O&&!!v.thicknessMap,U=!!v.gradientMap,de=!!v.alphaMap,te=v.alphaTest>0,_e=!!v.alphaHash,xe=!!v.extensions;let ne=Bi;v.toneMapped&&(re===null||re.isXRRenderTarget===!0)&&(ne=r.toneMapping);const le={shaderID:D,shaderType:v.type,shaderName:v.name,vertexShader:He,fragmentShader:De,defines:v.defines,customVertexShaderID:J,customFragmentShaderID:ae,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:f,batching:Ee,batchingColor:Ee&&N._colorsTexture!==null,instancing:Ie,instancingColor:Ie&&N.instanceColor!==null,instancingMorph:Ie&&N.morphTexture!==null,outputColorSpace:re===null?r.outputColorSpace:re.isXRRenderTarget===!0?re.texture.colorSpace:ct.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:Qe,matcap:ye,envMap:Ge,envMapMode:Ge&&$.mapping,envMapCubeUVHeight:j,aoMap:Xe,lightMap:Te,bumpMap:V,normalMap:Je,displacementMap:$e,emissiveMap:pt,normalMapObjectSpace:Je&&v.normalMapType===h_,normalMapTangentSpace:Je&&v.normalMapType===wd,packedNormalMap:Je&&v.normalMapType===wd&&Hb(v.normalMap.format),metalnessMap:qe,roughnessMap:mt,anisotropy:F,anisotropyMap:z,clearcoat:Dt,clearcoatMap:K,clearcoatNormalMap:ue,clearcoatRoughnessMap:oe,dispersion:We,iridescence:R,iridescenceMap:Q,iridescenceThicknessMap:ee,sheen:x,sheenColorMap:pe,sheenRoughnessMap:Ae,specularMap:ge,specularColorMap:me,specularIntensityMap:fe,transmission:O,transmissionMap:Le,thicknessMap:Be,gradientMap:U,opaque:v.transparent===!1&&v.blending===$s&&v.alphaToCoverage===!1,alphaMap:de,alphaTest:te,alphaHash:_e,combine:v.combine,mapUv:Qe&&g(v.map.channel),aoMapUv:Xe&&g(v.aoMap.channel),lightMapUv:Te&&g(v.lightMap.channel),bumpMapUv:V&&g(v.bumpMap.channel),normalMapUv:Je&&g(v.normalMap.channel),displacementMapUv:$e&&g(v.displacementMap.channel),emissiveMapUv:pt&&g(v.emissiveMap.channel),metalnessMapUv:qe&&g(v.metalnessMap.channel),roughnessMapUv:mt&&g(v.roughnessMap.channel),anisotropyMapUv:z&&g(v.anisotropyMap.channel),clearcoatMapUv:K&&g(v.clearcoatMap.channel),clearcoatNormalMapUv:ue&&g(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&g(v.clearcoatRoughnessMap.channel),iridescenceMapUv:Q&&g(v.iridescenceMap.channel),iridescenceThicknessMapUv:ee&&g(v.iridescenceThicknessMap.channel),sheenColorMapUv:pe&&g(v.sheenColorMap.channel),sheenRoughnessMapUv:Ae&&g(v.sheenRoughnessMap.channel),specularMapUv:ge&&g(v.specularMap.channel),specularColorMapUv:me&&g(v.specularColorMap.channel),specularIntensityMapUv:fe&&g(v.specularIntensityMap.channel),transmissionMapUv:Le&&g(v.transmissionMap.channel),thicknessMapUv:Be&&g(v.thicknessMap.channel),alphaMapUv:de&&g(v.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(Je||F),vertexNormals:!!B.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!B.attributes.uv&&(Qe||de),fog:!!W,useFog:v.fog===!0,fogExp2:!!W&&W.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||B.attributes.normal===void 0&&Je===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:Re,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:B.attributes.position!==void 0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:he,morphTextureStride:Ve,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numLightProbeGrids:q.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:v.dithering,shadowMapEnabled:r.shadowMap.enabled&&C.length>0,shadowMapType:r.shadowMap.type,toneMapping:ne,decodeVideoTexture:Qe&&v.map.isVideoTexture===!0&&ct.getTransfer(v.map.colorSpace)===vt,decodeVideoTextureEmissive:pt&&v.emissiveMap.isVideoTexture===!0&&ct.getTransfer(v.emissiveMap.colorSpace)===vt,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===Ki,flipSided:v.side===Vn,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:xe&&v.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xe&&v.extensions.multiDraw===!0||Ee)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return le.vertexUv1s=l.has(1),le.vertexUv2s=l.has(2),le.vertexUv3s=l.has(3),l.clear(),le}function p(v){const E=[];if(v.shaderID?E.push(v.shaderID):(E.push(v.customVertexShaderID),E.push(v.customFragmentShaderID)),v.defines!==void 0)for(const C in v.defines)E.push(C),E.push(v.defines[C]);return v.isRawShaderMaterial===!1&&(m(E,v),b(E,v),E.push(r.outputColorSpace)),E.push(v.customProgramCacheKey),E.join()}function m(v,E){v.push(E.precision),v.push(E.outputColorSpace),v.push(E.envMapMode),v.push(E.envMapCubeUVHeight),v.push(E.mapUv),v.push(E.alphaMapUv),v.push(E.lightMapUv),v.push(E.aoMapUv),v.push(E.bumpMapUv),v.push(E.normalMapUv),v.push(E.displacementMapUv),v.push(E.emissiveMapUv),v.push(E.metalnessMapUv),v.push(E.roughnessMapUv),v.push(E.anisotropyMapUv),v.push(E.clearcoatMapUv),v.push(E.clearcoatNormalMapUv),v.push(E.clearcoatRoughnessMapUv),v.push(E.iridescenceMapUv),v.push(E.iridescenceThicknessMapUv),v.push(E.sheenColorMapUv),v.push(E.sheenRoughnessMapUv),v.push(E.specularMapUv),v.push(E.specularColorMapUv),v.push(E.specularIntensityMapUv),v.push(E.transmissionMapUv),v.push(E.thicknessMapUv),v.push(E.combine),v.push(E.fogExp2),v.push(E.sizeAttenuation),v.push(E.morphTargetsCount),v.push(E.morphAttributeCount),v.push(E.numDirLights),v.push(E.numPointLights),v.push(E.numSpotLights),v.push(E.numSpotLightMaps),v.push(E.numHemiLights),v.push(E.numRectAreaLights),v.push(E.numDirLightShadows),v.push(E.numPointLightShadows),v.push(E.numSpotLightShadows),v.push(E.numSpotLightShadowsWithMaps),v.push(E.numLightProbes),v.push(E.shadowMapType),v.push(E.toneMapping),v.push(E.numClippingPlanes),v.push(E.numClipIntersection),v.push(E.depthPacking)}function b(v,E){a.disableAll(),E.instancing&&a.enable(0),E.instancingColor&&a.enable(1),E.instancingMorph&&a.enable(2),E.matcap&&a.enable(3),E.envMap&&a.enable(4),E.normalMapObjectSpace&&a.enable(5),E.normalMapTangentSpace&&a.enable(6),E.clearcoat&&a.enable(7),E.iridescence&&a.enable(8),E.alphaTest&&a.enable(9),E.vertexColors&&a.enable(10),E.vertexAlphas&&a.enable(11),E.vertexUv1s&&a.enable(12),E.vertexUv2s&&a.enable(13),E.vertexUv3s&&a.enable(14),E.vertexTangents&&a.enable(15),E.anisotropy&&a.enable(16),E.alphaHash&&a.enable(17),E.batching&&a.enable(18),E.dispersion&&a.enable(19),E.batchingColor&&a.enable(20),E.gradientMap&&a.enable(21),E.packedNormalMap&&a.enable(22),E.vertexNormals&&a.enable(23),v.push(a.mask),a.disableAll(),E.fog&&a.enable(0),E.useFog&&a.enable(1),E.flatShading&&a.enable(2),E.logarithmicDepthBuffer&&a.enable(3),E.reversedDepthBuffer&&a.enable(4),E.skinning&&a.enable(5),E.morphTargets&&a.enable(6),E.morphNormals&&a.enable(7),E.morphColors&&a.enable(8),E.premultipliedAlpha&&a.enable(9),E.shadowMapEnabled&&a.enable(10),E.doubleSided&&a.enable(11),E.flipSided&&a.enable(12),E.useDepthPacking&&a.enable(13),E.dithering&&a.enable(14),E.transmission&&a.enable(15),E.sheen&&a.enable(16),E.opaque&&a.enable(17),E.pointsUvs&&a.enable(18),E.decodeVideoTexture&&a.enable(19),E.decodeVideoTextureEmissive&&a.enable(20),E.alphaToCoverage&&a.enable(21),E.numLightProbeGrids>0&&a.enable(22),E.hasPositionAttribute&&a.enable(23),v.push(a.mask)}function w(v){const E=d[v.type];let C;if(E){const L=Di[E];C=hx.clone(L.uniforms)}else C=v.uniforms;return C}function M(v,E){let C=u.get(E);return C!==void 0?++C.usedTimes:(C=new kb(r,E,v,i),c.push(C),u.set(E,C)),C}function y(v){if(--v.usedTimes===0){const E=c.indexOf(v);c[E]=c[c.length-1],c.pop(),u.delete(v.cacheKey),v.destroy()}}function T(v){o.remove(v)}function A(){o.dispose()}return{getParameters:_,getProgramCacheKey:p,getUniforms:w,acquireProgram:M,releaseProgram:y,releaseShaderCache:T,programs:c,dispose:A}}function Xb(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,l){r.get(a)[o]=l}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function Yb(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function vh(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Mh(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(f){let d=0;return f.isInstancedMesh&&(d+=2),f.isSkinnedMesh&&(d+=1),d}function o(f,d,g,_,p,m){let b=r[e];return b===void 0?(b={id:f.id,object:f,geometry:d,material:g,materialVariant:a(f),groupOrder:_,renderOrder:f.renderOrder,z:p,group:m},r[e]=b):(b.id=f.id,b.object=f,b.geometry=d,b.material=g,b.materialVariant=a(f),b.groupOrder=_,b.renderOrder=f.renderOrder,b.z=p,b.group=m),e++,b}function l(f,d,g,_,p,m){const b=o(f,d,g,_,p,m);g.transmission>0?n.push(b):g.transparent===!0?i.push(b):t.push(b)}function c(f,d,g,_,p,m){const b=o(f,d,g,_,p,m);g.transmission>0?n.unshift(b):g.transparent===!0?i.unshift(b):t.unshift(b)}function u(f,d,g){t.length>1&&t.sort(f||Yb),n.length>1&&n.sort(d||vh),i.length>1&&i.sort(d||vh),g&&(t.reverse(),n.reverse(),i.reverse())}function h(){for(let f=e,d=r.length;f<d;f++){const g=r[f];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:l,unshift:c,finish:h,sort:u}}function qb(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new Mh,r.set(n,[a])):i>=s.length?(a=new Mh,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function $b(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new Y,color:new ft};break;case"SpotLight":t={position:new Y,direction:new Y,color:new ft,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Y,color:new ft,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Y,skyColor:new ft,groundColor:new ft};break;case"RectAreaLight":t={color:new ft,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return r[e.id]=t,t}}}function Zb(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new gt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new gt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new gt,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Kb=0;function jb(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function Jb(r){const e=new $b,t=Zb(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new Y);const i=new Y,s=new Xt,a=new Xt;function o(c){let u=0,h=0,f=0;for(let E=0;E<9;E++)n.probe[E].set(0,0,0);let d=0,g=0,_=0,p=0,m=0,b=0,w=0,M=0,y=0,T=0,A=0;c.sort(jb);for(let E=0,C=c.length;E<C;E++){const L=c[E],N=L.color,q=L.intensity,W=L.distance;let B=null;if(L.shadow&&L.shadow.map&&(L.shadow.map.texture.format===cs?B=L.shadow.map.texture:B=L.shadow.map.depthTexture||L.shadow.map.texture),L.isAmbientLight)u+=N.r*q,h+=N.g*q,f+=N.b*q;else if(L.isLightProbe){for(let G=0;G<9;G++)n.probe[G].addScaledVector(L.sh.coefficients[G],q);A++}else if(L.isDirectionalLight){const G=e.get(L);if(G.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const I=L.shadow,$=t.get(L);$.shadowIntensity=I.intensity,$.shadowBias=I.bias,$.shadowNormalBias=I.normalBias,$.shadowRadius=I.radius,$.shadowMapSize=I.mapSize,n.directionalShadow[d]=$,n.directionalShadowMap[d]=B,n.directionalShadowMatrix[d]=L.shadow.matrix,b++}n.directional[d]=G,d++}else if(L.isSpotLight){const G=e.get(L);G.position.setFromMatrixPosition(L.matrixWorld),G.color.copy(N).multiplyScalar(q),G.distance=W,G.coneCos=Math.cos(L.angle),G.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),G.decay=L.decay,n.spot[_]=G;const I=L.shadow;if(L.map&&(n.spotLightMap[y]=L.map,y++,I.updateMatrices(L),L.castShadow&&T++),n.spotLightMatrix[_]=I.matrix,L.castShadow){const $=t.get(L);$.shadowIntensity=I.intensity,$.shadowBias=I.bias,$.shadowNormalBias=I.normalBias,$.shadowRadius=I.radius,$.shadowMapSize=I.mapSize,n.spotShadow[_]=$,n.spotShadowMap[_]=B,M++}_++}else if(L.isRectAreaLight){const G=e.get(L);G.color.copy(N).multiplyScalar(q),G.halfWidth.set(L.width*.5,0,0),G.halfHeight.set(0,L.height*.5,0),n.rectArea[p]=G,p++}else if(L.isPointLight){const G=e.get(L);if(G.color.copy(L.color).multiplyScalar(L.intensity),G.distance=L.distance,G.decay=L.decay,L.castShadow){const I=L.shadow,$=t.get(L);$.shadowIntensity=I.intensity,$.shadowBias=I.bias,$.shadowNormalBias=I.normalBias,$.shadowRadius=I.radius,$.shadowMapSize=I.mapSize,$.shadowCameraNear=I.camera.near,$.shadowCameraFar=I.camera.far,n.pointShadow[g]=$,n.pointShadowMap[g]=B,n.pointShadowMatrix[g]=L.shadow.matrix,w++}n.point[g]=G,g++}else if(L.isHemisphereLight){const G=e.get(L);G.skyColor.copy(L.color).multiplyScalar(q),G.groundColor.copy(L.groundColor).multiplyScalar(q),n.hemi[m]=G,m++}}p>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Se.LTC_FLOAT_1,n.rectAreaLTC2=Se.LTC_FLOAT_2):(n.rectAreaLTC1=Se.LTC_HALF_1,n.rectAreaLTC2=Se.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=f;const v=n.hash;(v.directionalLength!==d||v.pointLength!==g||v.spotLength!==_||v.rectAreaLength!==p||v.hemiLength!==m||v.numDirectionalShadows!==b||v.numPointShadows!==w||v.numSpotShadows!==M||v.numSpotMaps!==y||v.numLightProbes!==A)&&(n.directional.length=d,n.spot.length=_,n.rectArea.length=p,n.point.length=g,n.hemi.length=m,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=w,n.pointShadowMap.length=w,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=w,n.spotLightMatrix.length=M+y-T,n.spotLightMap.length=y,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=A,v.directionalLength=d,v.pointLength=g,v.spotLength=_,v.rectAreaLength=p,v.hemiLength=m,v.numDirectionalShadows=b,v.numPointShadows=w,v.numSpotShadows=M,v.numSpotMaps=y,v.numLightProbes=A,n.version=Kb++)}function l(c,u){let h=0,f=0,d=0,g=0,_=0;const p=u.matrixWorldInverse;for(let m=0,b=c.length;m<b;m++){const w=c[m];if(w.isDirectionalLight){const M=n.directional[h];M.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(p),h++}else if(w.isSpotLight){const M=n.spot[d];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(p),M.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(p),d++}else if(w.isRectAreaLight){const M=n.rectArea[g];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(p),a.identity(),s.copy(w.matrixWorld),s.premultiply(p),a.extractRotation(s),M.halfWidth.set(w.width*.5,0,0),M.halfHeight.set(0,w.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),g++}else if(w.isPointLight){const M=n.point[f];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(p),f++}else if(w.isHemisphereLight){const M=n.hemi[_];M.direction.setFromMatrixPosition(w.matrixWorld),M.direction.transformDirection(p),_++}}}return{setup:o,setupView:l,state:n}}function Sh(r){const e=new Jb(r),t=[],n=[],i=[];function s(f){h.camera=f,t.length=0,n.length=0,i.length=0}function a(f){t.push(f)}function o(f){n.push(f)}function l(f){i.push(f)}function c(){e.setup(t)}function u(f){e.setupView(t,f)}const h={lightsArray:t,shadowsArray:n,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:h,setupLights:c,setupLightsView:u,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function Qb(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new Sh(r),e.set(i,[o])):s>=a.length?(o=new Sh(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const ey=`void main() {
4058
4058
  gl_Position = vec4( position, 1.0 );
4059
4059
  }`,ty=`uniform sampler2D shadow_pass;
4060
4060
  uniform vec2 resolution;
@@ -4081,7 +4081,7 @@ void main() {
4081
4081
  squared_mean = squared_mean / samples;
4082
4082
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4083
4083
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4084
- }`,ny=[new q(1,0,0),new q(-1,0,0),new q(0,1,0),new q(0,-1,0),new q(0,0,1),new q(0,0,-1)],iy=[new q(0,-1,0),new q(0,-1,0),new q(0,0,1),new q(0,0,-1),new q(0,-1,0),new q(0,-1,0)],bh=new Xt,_a=new q,Ec=new q;function ry(r,e,t){let n=new Em;const i=new mt,s=new mt,a=new Bt,o=new _x,l=new xx,c={},u=t.maxTextureSize,h={[Nr]:Vn,[Vn]:Nr,[Zi]:Zi},f=new yi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new mt},radius:{value:4}},vertexShader:ey,fragmentShader:ty}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const g=new Ei;g.setAttribute("position",new Mn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new or(g,f),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=el;let m=this.type;this.render=function(T,w,v){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||T.length===0)return;this.type===W_&&(Ye("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=el);const E=r.getRenderTarget(),C=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),N=r.state;N.setBlending(er),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);const Y=m!==this.type;Y&&w.traverse(function(H){H.material&&(Array.isArray(H.material)?H.material.forEach(O=>O.needsUpdate=!0):H.material.needsUpdate=!0)});for(let H=0,O=T.length;H<O;H++){const z=T[H],I=z.shadow;if(I===void 0){Ye("WebGLShadowMap:",z,"has no shadow.");continue}if(I.autoUpdate===!1&&I.needsUpdate===!1)continue;i.copy(I.mapSize);const W=I.getFrameExtents();i.multiply(W),s.copy(I.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/W.x),i.x=s.x*W.x,I.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/W.y),i.y=s.y*W.y,I.mapSize.y=s.y));const Z=r.state.buffers.depth.getReversed();if(I.camera._reversedDepth=Z,I.map===null||Y===!0){if(I.map!==null&&(I.map.depthTexture!==null&&(I.map.depthTexture.dispose(),I.map.depthTexture=null),I.map.dispose()),this.type===Ta){if(z.isPointLight){Ye("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}I.map=new ki(i.x,i.y,{format:ls,type:sr,minFilter:yn,magFilter:yn,generateMipmaps:!1}),I.map.texture.name=z.name+".shadowMap",I.map.depthTexture=new ra(i.x,i.y,Ui),I.map.depthTexture.name=z.name+".shadowMapDepth",I.map.depthTexture.format=ar,I.map.depthTexture.compareFunction=null,I.map.depthTexture.minFilter=dn,I.map.depthTexture.magFilter=dn}else z.isPointLight?(I.map=new Lm(i.x),I.map.depthTexture=new fx(i.x,Gi)):(I.map=new ki(i.x,i.y),I.map.depthTexture=new ra(i.x,i.y,Gi)),I.map.depthTexture.name=z.name+".shadowMap",I.map.depthTexture.format=ar,this.type===el?(I.map.depthTexture.compareFunction=Z?Ef:yf,I.map.depthTexture.minFilter=yn,I.map.depthTexture.magFilter=yn):(I.map.depthTexture.compareFunction=null,I.map.depthTexture.minFilter=dn,I.map.depthTexture.magFilter=dn);I.camera.updateProjectionMatrix()}const D=I.map.isWebGLCubeRenderTarget?6:1;for(let re=0;re<D;re++){if(I.map.isWebGLCubeRenderTarget)r.setRenderTarget(I.map,re),r.clear();else{re===0&&(r.setRenderTarget(I.map),r.clear());const he=I.getViewport(re);a.set(s.x*he.x,s.y*he.y,s.x*he.z,s.y*he.w),N.viewport(a)}if(z.isPointLight){const he=I.camera,He=I.matrix,Be=z.distance||he.far;Be!==he.far&&(he.far=Be,he.updateProjectionMatrix()),_a.setFromMatrixPosition(z.matrixWorld),he.position.copy(_a),Ec.copy(he.position),Ec.add(ny[re]),he.up.copy(iy[re]),he.lookAt(Ec),he.updateMatrixWorld(),He.makeTranslation(-_a.x,-_a.y,-_a.z),bh.multiplyMatrices(he.projectionMatrix,he.matrixWorldInverse),I._frustum.setFromProjectionMatrix(bh,he.coordinateSystem,he.reversedDepth)}else I.updateMatrices(z);n=I.getFrustum(),M(w,v,I.camera,z,this.type)}I.isPointLightShadow!==!0&&this.type===Ta&&b(I,v),I.needsUpdate=!1}m=this.type,p.needsUpdate=!1,r.setRenderTarget(E,C,L)};function b(T,w){const v=e.update(_);f.defines.VSM_SAMPLES!==T.blurSamples&&(f.defines.VSM_SAMPLES=T.blurSamples,d.defines.VSM_SAMPLES=T.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new ki(i.x,i.y,{format:ls,type:sr})),f.uniforms.shadow_pass.value=T.map.depthTexture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,r.setRenderTarget(T.mapPass),r.clear(),r.renderBufferDirect(w,null,v,f,_,null),d.uniforms.shadow_pass.value=T.mapPass.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,r.setRenderTarget(T.map),r.clear(),r.renderBufferDirect(w,null,v,d,_,null)}function A(T,w,v,E){let C=null;const L=v.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(L!==void 0)C=L;else if(C=v.isPointLight===!0?l:o,r.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0||w.alphaToCoverage===!0){const N=C.uuid,Y=w.uuid;let H=c[N];H===void 0&&(H={},c[N]=H);let O=H[Y];O===void 0&&(O=C.clone(),H[Y]=O,w.addEventListener("dispose",y)),C=O}if(C.visible=w.visible,C.wireframe=w.wireframe,E===Ta?C.side=w.shadowSide!==null?w.shadowSide:w.side:C.side=w.shadowSide!==null?w.shadowSide:h[w.side],C.alphaMap=w.alphaMap,C.alphaTest=w.alphaToCoverage===!0?.5:w.alphaTest,C.map=w.map,C.clipShadows=w.clipShadows,C.clippingPlanes=w.clippingPlanes,C.clipIntersection=w.clipIntersection,C.displacementMap=w.displacementMap,C.displacementScale=w.displacementScale,C.displacementBias=w.displacementBias,C.wireframeLinewidth=w.wireframeLinewidth,C.linewidth=w.linewidth,v.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const N=r.properties.get(C);N.light=v}return C}function M(T,w,v,E,C){if(T.visible===!1)return;if(T.layers.test(w.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&C===Ta)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,T.matrixWorld);const Y=e.update(T),H=T.material;if(Array.isArray(H)){const O=Y.groups;for(let z=0,I=O.length;z<I;z++){const W=O[z],Z=H[W.materialIndex];if(Z&&Z.visible){const D=A(T,Z,E,C);T.onBeforeShadow(r,T,w,v,Y,D,W),r.renderBufferDirect(v,null,Y,D,T,W),T.onAfterShadow(r,T,w,v,Y,D,W)}}}else if(H.visible){const O=A(T,H,E,C);T.onBeforeShadow(r,T,w,v,Y,O,null),r.renderBufferDirect(v,null,Y,O,T,null),T.onAfterShadow(r,T,w,v,Y,O,null)}}const N=T.children;for(let Y=0,H=N.length;Y<H;Y++)M(N[Y],w,v,E,C)}function y(T){T.target.removeEventListener("dispose",y);for(const v in c){const E=c[v],C=T.target.uuid;C in E&&(E[C].dispose(),delete E[C])}}}function sy(r,e){function t(){let U=!1;const de=new Bt;let te=null;const _e=new Bt(0,0,0,0);return{setMask:function(xe){te!==xe&&!U&&(r.colorMask(xe,xe,xe,xe),te=xe)},setLocked:function(xe){U=xe},setClear:function(xe,ne,oe,ie,ze){ze===!0&&(xe*=ie,ne*=ie,oe*=ie),de.set(xe,ne,oe,ie),_e.equals(de)===!1&&(r.clearColor(xe,ne,oe,ie),_e.copy(de))},reset:function(){U=!1,te=null,_e.set(-1,0,0,0)}}}function n(){let U=!1,de=!1,te=null,_e=null,xe=null;return{setReversed:function(ne){if(de!==ne){const oe=e.get("EXT_clip_control");ne?oe.clipControlEXT(oe.LOWER_LEFT_EXT,oe.ZERO_TO_ONE_EXT):oe.clipControlEXT(oe.LOWER_LEFT_EXT,oe.NEGATIVE_ONE_TO_ONE_EXT),de=ne;const ie=xe;xe=null,this.setClear(ie)}},getReversed:function(){return de},setTest:function(ne){ne?se(r.DEPTH_TEST):we(r.DEPTH_TEST)},setMask:function(ne){te!==ne&&!U&&(r.depthMask(ne),te=ne)},setFunc:function(ne){if(de&&(ne=y0[ne]),_e!==ne){switch(ne){case eu:r.depthFunc(r.NEVER);break;case tu:r.depthFunc(r.ALWAYS);break;case nu:r.depthFunc(r.LESS);break;case na:r.depthFunc(r.LEQUAL);break;case iu:r.depthFunc(r.EQUAL);break;case ru:r.depthFunc(r.GEQUAL);break;case su:r.depthFunc(r.GREATER);break;case au:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}_e=ne}},setLocked:function(ne){U=ne},setClear:function(ne){xe!==ne&&(xe=ne,de&&(ne=1-ne),r.clearDepth(ne))},reset:function(){U=!1,te=null,_e=null,xe=null,de=!1}}}function i(){let U=!1,de=null,te=null,_e=null,xe=null,ne=null,oe=null,ie=null,ze=null;return{setTest:function(le){U||(le?se(r.STENCIL_TEST):we(r.STENCIL_TEST))},setMask:function(le){de!==le&&!U&&(r.stencilMask(le),de=le)},setFunc:function(le,Ge,De){(te!==le||_e!==Ge||xe!==De)&&(r.stencilFunc(le,Ge,De),te=le,_e=Ge,xe=De)},setOp:function(le,Ge,De){(ne!==le||oe!==Ge||ie!==De)&&(r.stencilOp(le,Ge,De),ne=le,oe=Ge,ie=De)},setLocked:function(le){U=le},setClear:function(le){ze!==le&&(r.clearStencil(le),ze=le)},reset:function(){U=!1,de=null,te=null,_e=null,xe=null,ne=null,oe=null,ie=null,ze=null}}}const s=new t,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let u={},h={},f={},d=new WeakMap,g=[],_=null,p=!1,m=null,b=null,A=null,M=null,y=null,T=null,w=null,v=new dt(0,0,0),E=0,C=!1,L=null,N=null,Y=null,H=null,O=null;const z=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let I=!1,W=0;const Z=r.getParameter(r.VERSION);Z.indexOf("WebGL")!==-1?(W=parseFloat(/^WebGL (\d)/.exec(Z)[1]),I=W>=1):Z.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),I=W>=2);let D=null,re={};const he=r.getParameter(r.SCISSOR_BOX),He=r.getParameter(r.VIEWPORT),Be=new Bt().fromArray(he),Pe=new Bt().fromArray(He);function J(U,de,te,_e){const xe=new Uint8Array(4),ne=r.createTexture();r.bindTexture(U,ne),r.texParameteri(U,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(U,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let oe=0;oe<te;oe++)U===r.TEXTURE_3D||U===r.TEXTURE_2D_ARRAY?r.texImage3D(de,0,r.RGBA,1,1,_e,0,r.RGBA,r.UNSIGNED_BYTE,xe):r.texImage2D(de+oe,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,xe);return ne}const ae={};ae[r.TEXTURE_2D]=J(r.TEXTURE_2D,r.TEXTURE_2D,1),ae[r.TEXTURE_CUBE_MAP]=J(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),ae[r.TEXTURE_2D_ARRAY]=J(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),ae[r.TEXTURE_3D]=J(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),se(r.DEPTH_TEST),a.setFunc(na),$(!1),je(bd),se(r.CULL_FACE),Te(er);function se(U){u[U]!==!0&&(r.enable(U),u[U]=!0)}function we(U){u[U]!==!1&&(r.disable(U),u[U]=!1)}function Oe(U,de){return f[U]!==de?(r.bindFramebuffer(U,de),f[U]=de,U===r.DRAW_FRAMEBUFFER&&(f[r.FRAMEBUFFER]=de),U===r.FRAMEBUFFER&&(f[r.DRAW_FRAMEBUFFER]=de),!0):!1}function Ee(U,de){let te=g,_e=!1;if(U){te=d.get(de),te===void 0&&(te=[],d.set(de,te));const xe=U.textures;if(te.length!==xe.length||te[0]!==r.COLOR_ATTACHMENT0){for(let ne=0,oe=xe.length;ne<oe;ne++)te[ne]=r.COLOR_ATTACHMENT0+ne;te.length=xe.length,_e=!0}}else te[0]!==r.BACK&&(te[0]=r.BACK,_e=!0);_e&&r.drawBuffers(te)}function Je(U){return _!==U?(r.useProgram(U),_=U,!0):!1}const be={[Xr]:r.FUNC_ADD,[Y_]:r.FUNC_SUBTRACT,[q_]:r.FUNC_REVERSE_SUBTRACT};be[$_]=r.MIN,be[K_]=r.MAX;const We={[Z_]:r.ZERO,[j_]:r.ONE,[J_]:r.SRC_COLOR,[Jc]:r.SRC_ALPHA,[r0]:r.SRC_ALPHA_SATURATE,[n0]:r.DST_COLOR,[e0]:r.DST_ALPHA,[Q_]:r.ONE_MINUS_SRC_COLOR,[Qc]:r.ONE_MINUS_SRC_ALPHA,[i0]:r.ONE_MINUS_DST_COLOR,[t0]:r.ONE_MINUS_DST_ALPHA,[s0]:r.CONSTANT_COLOR,[a0]:r.ONE_MINUS_CONSTANT_COLOR,[o0]:r.CONSTANT_ALPHA,[l0]:r.ONE_MINUS_CONSTANT_ALPHA};function Te(U,de,te,_e,xe,ne,oe,ie,ze,le){if(U===er){p===!0&&(we(r.BLEND),p=!1);return}if(p===!1&&(se(r.BLEND),p=!0),U!==X_){if(U!==m||le!==C){if((b!==Xr||y!==Xr)&&(r.blendEquation(r.FUNC_ADD),b=Xr,y=Xr),le)switch(U){case qs:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case jc:r.blendFunc(r.ONE,r.ONE);break;case yd:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Ed:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:pt("WebGLState: Invalid blending: ",U);break}else switch(U){case qs:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case jc:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case yd:pt("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Ed:pt("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:pt("WebGLState: Invalid blending: ",U);break}A=null,M=null,T=null,w=null,v.set(0,0,0),E=0,m=U,C=le}return}xe=xe||de,ne=ne||te,oe=oe||_e,(de!==b||xe!==y)&&(r.blendEquationSeparate(be[de],be[xe]),b=de,y=xe),(te!==A||_e!==M||ne!==T||oe!==w)&&(r.blendFuncSeparate(We[te],We[_e],We[ne],We[oe]),A=te,M=_e,T=ne,w=oe),(ie.equals(v)===!1||ze!==E)&&(r.blendColor(ie.r,ie.g,ie.b,ze),v.copy(ie),E=ze),m=U,C=!1}function Ne(U,de){U.side===Zi?we(r.CULL_FACE):se(r.CULL_FACE);let te=U.side===Vn;de&&(te=!te),$(te),U.blending===qs&&U.transparent===!1?Te(er):Te(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.blendColor,U.blendAlpha,U.premultipliedAlpha),a.setFunc(U.depthFunc),a.setTest(U.depthTest),a.setMask(U.depthWrite),s.setMask(U.colorWrite);const _e=U.stencilWrite;o.setTest(_e),_e&&(o.setMask(U.stencilWriteMask),o.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),o.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),_t(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?se(r.SAMPLE_ALPHA_TO_COVERAGE):we(r.SAMPLE_ALPHA_TO_COVERAGE)}function $(U){L!==U&&(U?r.frontFace(r.CW):r.frontFace(r.CCW),L=U)}function je(U){U!==V_?(se(r.CULL_FACE),U!==N&&(U===bd?r.cullFace(r.BACK):U===H_?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):we(r.CULL_FACE),N=U}function ft(U){U!==Y&&(I&&r.lineWidth(U),Y=U)}function _t(U,de,te){U?(se(r.POLYGON_OFFSET_FILL),(H!==de||O!==te)&&(H=de,O=te,a.getReversed()&&(de=-de),r.polygonOffset(de,te))):we(r.POLYGON_OFFSET_FILL)}function qe(U){U?se(r.SCISSOR_TEST):we(r.SCISSOR_TEST)}function at(U){U===void 0&&(U=r.TEXTURE0+z-1),D!==U&&(r.activeTexture(U),D=U)}function F(U,de,te){te===void 0&&(D===null?te=r.TEXTURE0+z-1:te=D);let _e=re[te];_e===void 0&&(_e={type:void 0,texture:void 0},re[te]=_e),(_e.type!==U||_e.texture!==de)&&(D!==te&&(r.activeTexture(te),D=te),r.bindTexture(U,de||ae[U]),_e.type=U,_e.texture=de)}function Mt(){const U=re[D];U!==void 0&&U.type!==void 0&&(r.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function Xe(){try{r.compressedTexImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function R(){try{r.compressedTexImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function x(){try{r.texSubImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function B(){try{r.texSubImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function V(){try{r.compressedTexSubImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function j(){try{r.compressedTexSubImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function fe(){try{r.texStorage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function ce(){try{r.texStorage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function Q(){try{r.texImage2D(...arguments)}catch(U){pt("WebGLState:",U)}}function ee(){try{r.texImage3D(...arguments)}catch(U){pt("WebGLState:",U)}}function me(U){return h[U]!==void 0?h[U]:r.getParameter(U)}function Ce(U,de){h[U]!==de&&(r.pixelStorei(U,de),h[U]=de)}function ge(U){Be.equals(U)===!1&&(r.scissor(U.x,U.y,U.z,U.w),Be.copy(U))}function pe(U){Pe.equals(U)===!1&&(r.viewport(U.x,U.y,U.z,U.w),Pe.copy(U))}function ue(U,de){let te=c.get(de);te===void 0&&(te=new WeakMap,c.set(de,te));let _e=te.get(U);_e===void 0&&(_e=r.getUniformBlockIndex(de,U.name),te.set(U,_e))}function Ie(U,de){const _e=c.get(de).get(U);l.get(de)!==_e&&(r.uniformBlockBinding(de,_e,U.__bindingPointIndex),l.set(de,_e))}function ke(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),r.pixelStorei(r.PACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL),r.pixelStorei(r.PACK_ROW_LENGTH,0),r.pixelStorei(r.PACK_SKIP_PIXELS,0),r.pixelStorei(r.PACK_SKIP_ROWS,0),r.pixelStorei(r.UNPACK_ROW_LENGTH,0),r.pixelStorei(r.UNPACK_IMAGE_HEIGHT,0),r.pixelStorei(r.UNPACK_SKIP_PIXELS,0),r.pixelStorei(r.UNPACK_SKIP_ROWS,0),r.pixelStorei(r.UNPACK_SKIP_IMAGES,0),u={},h={},D=null,re={},f={},d=new WeakMap,g=[],_=null,p=!1,m=null,b=null,A=null,M=null,y=null,T=null,w=null,v=new dt(0,0,0),E=0,C=!1,L=null,N=null,Y=null,H=null,O=null,Be.set(0,0,r.canvas.width,r.canvas.height),Pe.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:se,disable:we,bindFramebuffer:Oe,drawBuffers:Ee,useProgram:Je,setBlending:Te,setMaterial:Ne,setFlipSided:$,setCullFace:je,setLineWidth:ft,setPolygonOffset:_t,setScissorTest:qe,activeTexture:at,bindTexture:F,unbindTexture:Mt,compressedTexImage2D:Xe,compressedTexImage3D:R,texImage2D:Q,texImage3D:ee,pixelStorei:Ce,getParameter:me,updateUBOMapping:ue,uniformBlockBinding:Ie,texStorage2D:fe,texStorage3D:ce,texSubImage2D:x,texSubImage3D:B,compressedTexSubImage2D:V,compressedTexSubImage3D:j,scissor:ge,viewport:pe,reset:ke}}function ay(r,e,t,n,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new mt,u=new WeakMap,h=new Set;let f;const d=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(R,x){return g?new OffscreenCanvas(R,x):bl("canvas")}function p(R,x,B){let V=1;const j=Xe(R);if((j.width>B||j.height>B)&&(V=B/Math.max(j.width,j.height)),V<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const fe=Math.floor(V*j.width),ce=Math.floor(V*j.height);f===void 0&&(f=_(fe,ce));const Q=x?_(fe,ce):f;return Q.width=fe,Q.height=ce,Q.getContext("2d").drawImage(R,0,0,fe,ce),Ye("WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+fe+"x"+ce+")."),Q}else return"data"in R&&Ye("WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),R;return R}function m(R){return R.generateMipmaps}function b(R){r.generateMipmap(R)}function A(R){return R.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?r.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function M(R,x,B,V,j,fe=!1){if(R!==null){if(r[R]!==void 0)return r[R];Ye("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let ce;V&&(ce=e.get("EXT_texture_norm16"),ce||Ye("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let Q=x;if(x===r.RED&&(B===r.FLOAT&&(Q=r.R32F),B===r.HALF_FLOAT&&(Q=r.R16F),B===r.UNSIGNED_BYTE&&(Q=r.R8),B===r.UNSIGNED_SHORT&&ce&&(Q=ce.R16_EXT),B===r.SHORT&&ce&&(Q=ce.R16_SNORM_EXT)),x===r.RED_INTEGER&&(B===r.UNSIGNED_BYTE&&(Q=r.R8UI),B===r.UNSIGNED_SHORT&&(Q=r.R16UI),B===r.UNSIGNED_INT&&(Q=r.R32UI),B===r.BYTE&&(Q=r.R8I),B===r.SHORT&&(Q=r.R16I),B===r.INT&&(Q=r.R32I)),x===r.RG&&(B===r.FLOAT&&(Q=r.RG32F),B===r.HALF_FLOAT&&(Q=r.RG16F),B===r.UNSIGNED_BYTE&&(Q=r.RG8),B===r.UNSIGNED_SHORT&&ce&&(Q=ce.RG16_EXT),B===r.SHORT&&ce&&(Q=ce.RG16_SNORM_EXT)),x===r.RG_INTEGER&&(B===r.UNSIGNED_BYTE&&(Q=r.RG8UI),B===r.UNSIGNED_SHORT&&(Q=r.RG16UI),B===r.UNSIGNED_INT&&(Q=r.RG32UI),B===r.BYTE&&(Q=r.RG8I),B===r.SHORT&&(Q=r.RG16I),B===r.INT&&(Q=r.RG32I)),x===r.RGB_INTEGER&&(B===r.UNSIGNED_BYTE&&(Q=r.RGB8UI),B===r.UNSIGNED_SHORT&&(Q=r.RGB16UI),B===r.UNSIGNED_INT&&(Q=r.RGB32UI),B===r.BYTE&&(Q=r.RGB8I),B===r.SHORT&&(Q=r.RGB16I),B===r.INT&&(Q=r.RGB32I)),x===r.RGBA_INTEGER&&(B===r.UNSIGNED_BYTE&&(Q=r.RGBA8UI),B===r.UNSIGNED_SHORT&&(Q=r.RGBA16UI),B===r.UNSIGNED_INT&&(Q=r.RGBA32UI),B===r.BYTE&&(Q=r.RGBA8I),B===r.SHORT&&(Q=r.RGBA16I),B===r.INT&&(Q=r.RGBA32I)),x===r.RGB&&(B===r.UNSIGNED_SHORT&&ce&&(Q=ce.RGB16_EXT),B===r.SHORT&&ce&&(Q=ce.RGB16_SNORM_EXT),B===r.UNSIGNED_INT_5_9_9_9_REV&&(Q=r.RGB9_E5),B===r.UNSIGNED_INT_10F_11F_11F_REV&&(Q=r.R11F_G11F_B10F)),x===r.RGBA){const ee=fe?Ml:ct.getTransfer(j);B===r.FLOAT&&(Q=r.RGBA32F),B===r.HALF_FLOAT&&(Q=r.RGBA16F),B===r.UNSIGNED_BYTE&&(Q=ee===vt?r.SRGB8_ALPHA8:r.RGBA8),B===r.UNSIGNED_SHORT&&ce&&(Q=ce.RGBA16_EXT),B===r.SHORT&&ce&&(Q=ce.RGBA16_SNORM_EXT),B===r.UNSIGNED_SHORT_4_4_4_4&&(Q=r.RGBA4),B===r.UNSIGNED_SHORT_5_5_5_1&&(Q=r.RGB5_A1)}return(Q===r.R16F||Q===r.R32F||Q===r.RG16F||Q===r.RG32F||Q===r.RGBA16F||Q===r.RGBA32F)&&e.get("EXT_color_buffer_float"),Q}function y(R,x){let B;return R?x===null||x===Gi||x===Ja?B=r.DEPTH24_STENCIL8:x===Ui?B=r.DEPTH32F_STENCIL8:x===ja&&(B=r.DEPTH24_STENCIL8,Ye("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):x===null||x===Gi||x===Ja?B=r.DEPTH_COMPONENT24:x===Ui?B=r.DEPTH_COMPONENT32F:x===ja&&(B=r.DEPTH_COMPONENT16),B}function T(R,x){return m(R)===!0||R.isFramebufferTexture&&R.minFilter!==dn&&R.minFilter!==yn?Math.log2(Math.max(x.width,x.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?x.mipmaps.length:1}function w(R){const x=R.target;x.removeEventListener("dispose",w),E(x),x.isVideoTexture&&u.delete(x),x.isHTMLTexture&&h.delete(x)}function v(R){const x=R.target;x.removeEventListener("dispose",v),L(x)}function E(R){const x=n.get(R);if(x.__webglInit===void 0)return;const B=R.source,V=d.get(B);if(V){const j=V[x.__cacheKey];j.usedTimes--,j.usedTimes===0&&C(R),Object.keys(V).length===0&&d.delete(B)}n.remove(R)}function C(R){const x=n.get(R);r.deleteTexture(x.__webglTexture);const B=R.source,V=d.get(B);delete V[x.__cacheKey],a.memory.textures--}function L(R){const x=n.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),n.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let V=0;V<6;V++){if(Array.isArray(x.__webglFramebuffer[V]))for(let j=0;j<x.__webglFramebuffer[V].length;j++)r.deleteFramebuffer(x.__webglFramebuffer[V][j]);else r.deleteFramebuffer(x.__webglFramebuffer[V]);x.__webglDepthbuffer&&r.deleteRenderbuffer(x.__webglDepthbuffer[V])}else{if(Array.isArray(x.__webglFramebuffer))for(let V=0;V<x.__webglFramebuffer.length;V++)r.deleteFramebuffer(x.__webglFramebuffer[V]);else r.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer&&r.deleteRenderbuffer(x.__webglDepthbuffer),x.__webglMultisampledFramebuffer&&r.deleteFramebuffer(x.__webglMultisampledFramebuffer),x.__webglColorRenderbuffer)for(let V=0;V<x.__webglColorRenderbuffer.length;V++)x.__webglColorRenderbuffer[V]&&r.deleteRenderbuffer(x.__webglColorRenderbuffer[V]);x.__webglDepthRenderbuffer&&r.deleteRenderbuffer(x.__webglDepthRenderbuffer)}const B=R.textures;for(let V=0,j=B.length;V<j;V++){const fe=n.get(B[V]);fe.__webglTexture&&(r.deleteTexture(fe.__webglTexture),a.memory.textures--),n.remove(B[V])}n.remove(R)}let N=0;function Y(){N=0}function H(){return N}function O(R){N=R}function z(){const R=N;return R>=i.maxTextures&&Ye("WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+i.maxTextures),N+=1,R}function I(R){const x=[];return x.push(R.wrapS),x.push(R.wrapT),x.push(R.wrapR||0),x.push(R.magFilter),x.push(R.minFilter),x.push(R.anisotropy),x.push(R.internalFormat),x.push(R.format),x.push(R.type),x.push(R.generateMipmaps),x.push(R.premultiplyAlpha),x.push(R.flipY),x.push(R.unpackAlignment),x.push(R.colorSpace),x.join()}function W(R,x){const B=n.get(R);if(R.isVideoTexture&&F(R),R.isRenderTargetTexture===!1&&R.isExternalTexture!==!0&&R.version>0&&B.__version!==R.version){const V=R.image;if(V===null)Ye("WebGLRenderer: Texture marked for update but no image data found.");else if(V.complete===!1)Ye("WebGLRenderer: Texture marked for update but image is incomplete");else{we(B,R,x);return}}else R.isExternalTexture&&(B.__webglTexture=R.sourceTexture?R.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,B.__webglTexture,r.TEXTURE0+x)}function Z(R,x){const B=n.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&B.__version!==R.version){we(B,R,x);return}else R.isExternalTexture&&(B.__webglTexture=R.sourceTexture?R.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,B.__webglTexture,r.TEXTURE0+x)}function D(R,x){const B=n.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&B.__version!==R.version){we(B,R,x);return}t.bindTexture(r.TEXTURE_3D,B.__webglTexture,r.TEXTURE0+x)}function re(R,x){const B=n.get(R);if(R.isCubeDepthTexture!==!0&&R.version>0&&B.__version!==R.version){Oe(B,R,x);return}t.bindTexture(r.TEXTURE_CUBE_MAP,B.__webglTexture,r.TEXTURE0+x)}const he={[ou]:r.REPEAT,[Ji]:r.CLAMP_TO_EDGE,[lu]:r.MIRRORED_REPEAT},He={[dn]:r.NEAREST,[f0]:r.NEAREST_MIPMAP_NEAREST,[xo]:r.NEAREST_MIPMAP_LINEAR,[yn]:r.LINEAR,[Zl]:r.LINEAR_MIPMAP_NEAREST,[Kr]:r.LINEAR_MIPMAP_LINEAR},Be={[p0]:r.NEVER,[v0]:r.ALWAYS,[m0]:r.LESS,[yf]:r.LEQUAL,[g0]:r.EQUAL,[Ef]:r.GEQUAL,[_0]:r.GREATER,[x0]:r.NOTEQUAL};function Pe(R,x){if(x.type===Ui&&e.has("OES_texture_float_linear")===!1&&(x.magFilter===yn||x.magFilter===Zl||x.magFilter===xo||x.magFilter===Kr||x.minFilter===yn||x.minFilter===Zl||x.minFilter===xo||x.minFilter===Kr)&&Ye("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(R,r.TEXTURE_WRAP_S,he[x.wrapS]),r.texParameteri(R,r.TEXTURE_WRAP_T,he[x.wrapT]),(R===r.TEXTURE_3D||R===r.TEXTURE_2D_ARRAY)&&r.texParameteri(R,r.TEXTURE_WRAP_R,he[x.wrapR]),r.texParameteri(R,r.TEXTURE_MAG_FILTER,He[x.magFilter]),r.texParameteri(R,r.TEXTURE_MIN_FILTER,He[x.minFilter]),x.compareFunction&&(r.texParameteri(R,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(R,r.TEXTURE_COMPARE_FUNC,Be[x.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===dn||x.minFilter!==xo&&x.minFilter!==Kr||x.type===Ui&&e.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||n.get(x).__currentAnisotropy){const B=e.get("EXT_texture_filter_anisotropic");r.texParameterf(R,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,i.getMaxAnisotropy())),n.get(x).__currentAnisotropy=x.anisotropy}}}function J(R,x){let B=!1;R.__webglInit===void 0&&(R.__webglInit=!0,x.addEventListener("dispose",w));const V=x.source;let j=d.get(V);j===void 0&&(j={},d.set(V,j));const fe=I(x);if(fe!==R.__cacheKey){j[fe]===void 0&&(j[fe]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,B=!0),j[fe].usedTimes++;const ce=j[R.__cacheKey];ce!==void 0&&(j[R.__cacheKey].usedTimes--,ce.usedTimes===0&&C(x)),R.__cacheKey=fe,R.__webglTexture=j[fe].texture}return B}function ae(R,x,B){return Math.floor(Math.floor(R/B)/x)}function se(R,x,B,V){const fe=R.updateRanges;if(fe.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,x.width,x.height,B,V,x.data);else{fe.sort((Ce,ge)=>Ce.start-ge.start);let ce=0;for(let Ce=1;Ce<fe.length;Ce++){const ge=fe[ce],pe=fe[Ce],ue=ge.start+ge.count,Ie=ae(pe.start,x.width,4),ke=ae(ge.start,x.width,4);pe.start<=ue+1&&Ie===ke&&ae(pe.start+pe.count-1,x.width,4)===Ie?ge.count=Math.max(ge.count,pe.start+pe.count-ge.start):(++ce,fe[ce]=pe)}fe.length=ce+1;const Q=t.getParameter(r.UNPACK_ROW_LENGTH),ee=t.getParameter(r.UNPACK_SKIP_PIXELS),me=t.getParameter(r.UNPACK_SKIP_ROWS);t.pixelStorei(r.UNPACK_ROW_LENGTH,x.width);for(let Ce=0,ge=fe.length;Ce<ge;Ce++){const pe=fe[Ce],ue=Math.floor(pe.start/4),Ie=Math.ceil(pe.count/4),ke=ue%x.width,U=Math.floor(ue/x.width),de=Ie,te=1;t.pixelStorei(r.UNPACK_SKIP_PIXELS,ke),t.pixelStorei(r.UNPACK_SKIP_ROWS,U),t.texSubImage2D(r.TEXTURE_2D,0,ke,U,de,te,B,V,x.data)}R.clearUpdateRanges(),t.pixelStorei(r.UNPACK_ROW_LENGTH,Q),t.pixelStorei(r.UNPACK_SKIP_PIXELS,ee),t.pixelStorei(r.UNPACK_SKIP_ROWS,me)}}function we(R,x,B){let V=r.TEXTURE_2D;(x.isDataArrayTexture||x.isCompressedArrayTexture)&&(V=r.TEXTURE_2D_ARRAY),x.isData3DTexture&&(V=r.TEXTURE_3D);const j=J(R,x),fe=x.source;t.bindTexture(V,R.__webglTexture,r.TEXTURE0+B);const ce=n.get(fe);if(fe.version!==ce.__version||j===!0){if(t.activeTexture(r.TEXTURE0+B),(typeof ImageBitmap<"u"&&x.image instanceof ImageBitmap)===!1){const te=ct.getPrimaries(ct.workingColorSpace),_e=x.colorSpace===xr?null:ct.getPrimaries(x.colorSpace),xe=x.colorSpace===xr||te===_e?r.NONE:r.BROWSER_DEFAULT_WEBGL;t.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,x.flipY),t.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),t.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,xe)}t.pixelStorei(r.UNPACK_ALIGNMENT,x.unpackAlignment);let ee=p(x.image,!1,i.maxTextureSize);ee=Mt(x,ee);const me=s.convert(x.format,x.colorSpace),Ce=s.convert(x.type);let ge=M(x.internalFormat,me,Ce,x.normalized,x.colorSpace,x.isVideoTexture);Pe(V,x);let pe;const ue=x.mipmaps,Ie=x.isVideoTexture!==!0,ke=ce.__version===void 0||j===!0,U=fe.dataReady,de=T(x,ee);if(x.isDepthTexture)ge=y(x.format===Zr,x.type),ke&&(Ie?t.texStorage2D(r.TEXTURE_2D,1,ge,ee.width,ee.height):t.texImage2D(r.TEXTURE_2D,0,ge,ee.width,ee.height,0,me,Ce,null));else if(x.isDataTexture)if(ue.length>0){Ie&&ke&&t.texStorage2D(r.TEXTURE_2D,de,ge,ue[0].width,ue[0].height);for(let te=0,_e=ue.length;te<_e;te++)pe=ue[te],Ie?U&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,pe.width,pe.height,me,Ce,pe.data):t.texImage2D(r.TEXTURE_2D,te,ge,pe.width,pe.height,0,me,Ce,pe.data);x.generateMipmaps=!1}else Ie?(ke&&t.texStorage2D(r.TEXTURE_2D,de,ge,ee.width,ee.height),U&&se(x,ee,me,Ce)):t.texImage2D(r.TEXTURE_2D,0,ge,ee.width,ee.height,0,me,Ce,ee.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){Ie&&ke&&t.texStorage3D(r.TEXTURE_2D_ARRAY,de,ge,ue[0].width,ue[0].height,ee.depth);for(let te=0,_e=ue.length;te<_e;te++)if(pe=ue[te],x.format!==bi)if(me!==null)if(Ie){if(U)if(x.layerUpdates.size>0){const xe=Qd(pe.width,pe.height,x.format,x.type);for(const ne of x.layerUpdates){const oe=pe.data.subarray(ne*xe/pe.data.BYTES_PER_ELEMENT,(ne+1)*xe/pe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,ne,pe.width,pe.height,1,me,oe)}x.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,pe.width,pe.height,ee.depth,me,pe.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,te,ge,pe.width,pe.height,ee.depth,0,pe.data,0,0);else Ye("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ie?U&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,pe.width,pe.height,ee.depth,me,Ce,pe.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,ge,pe.width,pe.height,ee.depth,0,me,Ce,pe.data)}else{Ie&&ke&&t.texStorage2D(r.TEXTURE_2D,de,ge,ue[0].width,ue[0].height);for(let te=0,_e=ue.length;te<_e;te++)pe=ue[te],x.format!==bi?me!==null?Ie?U&&t.compressedTexSubImage2D(r.TEXTURE_2D,te,0,0,pe.width,pe.height,me,pe.data):t.compressedTexImage2D(r.TEXTURE_2D,te,ge,pe.width,pe.height,0,pe.data):Ye("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ie?U&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,pe.width,pe.height,me,Ce,pe.data):t.texImage2D(r.TEXTURE_2D,te,ge,pe.width,pe.height,0,me,Ce,pe.data)}else if(x.isDataArrayTexture)if(Ie){if(ke&&t.texStorage3D(r.TEXTURE_2D_ARRAY,de,ge,ee.width,ee.height,ee.depth),U)if(x.layerUpdates.size>0){const te=Qd(ee.width,ee.height,x.format,x.type);for(const _e of x.layerUpdates){const xe=ee.data.subarray(_e*te/ee.data.BYTES_PER_ELEMENT,(_e+1)*te/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,_e,ee.width,ee.height,1,me,Ce,xe)}x.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,me,Ce,ee.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,ge,ee.width,ee.height,ee.depth,0,me,Ce,ee.data);else if(x.isData3DTexture)Ie?(ke&&t.texStorage3D(r.TEXTURE_3D,de,ge,ee.width,ee.height,ee.depth),U&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,me,Ce,ee.data)):t.texImage3D(r.TEXTURE_3D,0,ge,ee.width,ee.height,ee.depth,0,me,Ce,ee.data);else if(x.isFramebufferTexture){if(ke)if(Ie)t.texStorage2D(r.TEXTURE_2D,de,ge,ee.width,ee.height);else{let te=ee.width,_e=ee.height;for(let xe=0;xe<de;xe++)t.texImage2D(r.TEXTURE_2D,xe,ge,te,_e,0,me,Ce,null),te>>=1,_e>>=1}}else if(x.isHTMLTexture){if("texElementImage2D"in r){const te=r.canvas;if(te.hasAttribute("layoutsubtree")||te.setAttribute("layoutsubtree","true"),ee.parentNode!==te){te.appendChild(ee),h.add(x),te.onpaint=_e=>{const xe=_e.changedElements;for(const ne of h)xe.includes(ne.image)&&(ne.needsUpdate=!0)},te.requestPaint();return}if(r.texElementImage2D.length===3)r.texElementImage2D(r.TEXTURE_2D,r.RGBA8,ee);else{const xe=r.RGBA,ne=r.RGBA,oe=r.UNSIGNED_BYTE;r.texElementImage2D(r.TEXTURE_2D,0,xe,ne,oe,ee)}r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE)}}else if(ue.length>0){if(Ie&&ke){const te=Xe(ue[0]);t.texStorage2D(r.TEXTURE_2D,de,ge,te.width,te.height)}for(let te=0,_e=ue.length;te<_e;te++)pe=ue[te],Ie?U&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,me,Ce,pe):t.texImage2D(r.TEXTURE_2D,te,ge,me,Ce,pe);x.generateMipmaps=!1}else if(Ie){if(ke){const te=Xe(ee);t.texStorage2D(r.TEXTURE_2D,de,ge,te.width,te.height)}U&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,me,Ce,ee)}else t.texImage2D(r.TEXTURE_2D,0,ge,me,Ce,ee);m(x)&&b(V),ce.__version=fe.version,x.onUpdate&&x.onUpdate(x)}R.__version=x.version}function Oe(R,x,B){if(x.image.length!==6)return;const V=J(R,x),j=x.source;t.bindTexture(r.TEXTURE_CUBE_MAP,R.__webglTexture,r.TEXTURE0+B);const fe=n.get(j);if(j.version!==fe.__version||V===!0){t.activeTexture(r.TEXTURE0+B);const ce=ct.getPrimaries(ct.workingColorSpace),Q=x.colorSpace===xr?null:ct.getPrimaries(x.colorSpace),ee=x.colorSpace===xr||ce===Q?r.NONE:r.BROWSER_DEFAULT_WEBGL;t.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,x.flipY),t.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),t.pixelStorei(r.UNPACK_ALIGNMENT,x.unpackAlignment),t.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ee);const me=x.isCompressedTexture||x.image[0].isCompressedTexture,Ce=x.image[0]&&x.image[0].isDataTexture,ge=[];for(let ne=0;ne<6;ne++)!me&&!Ce?ge[ne]=p(x.image[ne],!0,i.maxCubemapSize):ge[ne]=Ce?x.image[ne].image:x.image[ne],ge[ne]=Mt(x,ge[ne]);const pe=ge[0],ue=s.convert(x.format,x.colorSpace),Ie=s.convert(x.type),ke=M(x.internalFormat,ue,Ie,x.normalized,x.colorSpace),U=x.isVideoTexture!==!0,de=fe.__version===void 0||V===!0,te=j.dataReady;let _e=T(x,pe);Pe(r.TEXTURE_CUBE_MAP,x);let xe;if(me){U&&de&&t.texStorage2D(r.TEXTURE_CUBE_MAP,_e,ke,pe.width,pe.height);for(let ne=0;ne<6;ne++){xe=ge[ne].mipmaps;for(let oe=0;oe<xe.length;oe++){const ie=xe[oe];x.format!==bi?ue!==null?U?te&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,oe,0,0,ie.width,ie.height,ue,ie.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,oe,ke,ie.width,ie.height,0,ie.data):Ye("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,oe,0,0,ie.width,ie.height,ue,Ie,ie.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,oe,ke,ie.width,ie.height,0,ue,Ie,ie.data)}}}else{if(xe=x.mipmaps,U&&de){xe.length>0&&_e++;const ne=Xe(ge[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,_e,ke,ne.width,ne.height)}for(let ne=0;ne<6;ne++)if(Ce){U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,0,0,ge[ne].width,ge[ne].height,ue,Ie,ge[ne].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,ke,ge[ne].width,ge[ne].height,0,ue,Ie,ge[ne].data);for(let oe=0;oe<xe.length;oe++){const ze=xe[oe].image[ne].image;U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,oe+1,0,0,ze.width,ze.height,ue,Ie,ze.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,oe+1,ke,ze.width,ze.height,0,ue,Ie,ze.data)}}else{U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,0,0,ue,Ie,ge[ne]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,ke,ue,Ie,ge[ne]);for(let oe=0;oe<xe.length;oe++){const ie=xe[oe];U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,oe+1,0,0,ue,Ie,ie.image[ne]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,oe+1,ke,ue,Ie,ie.image[ne])}}}m(x)&&b(r.TEXTURE_CUBE_MAP),fe.__version=j.version,x.onUpdate&&x.onUpdate(x)}R.__version=x.version}function Ee(R,x,B,V,j,fe){const ce=s.convert(B.format,B.colorSpace),Q=s.convert(B.type),ee=M(B.internalFormat,ce,Q,B.normalized,B.colorSpace),me=n.get(x),Ce=n.get(B);if(Ce.__renderTarget=x,!me.__hasExternalTextures){const ge=Math.max(1,x.width>>fe),pe=Math.max(1,x.height>>fe);j===r.TEXTURE_3D||j===r.TEXTURE_2D_ARRAY?t.texImage3D(j,fe,ee,ge,pe,x.depth,0,ce,Q,null):t.texImage2D(j,fe,ee,ge,pe,0,ce,Q,null)}t.bindFramebuffer(r.FRAMEBUFFER,R),at(x)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,V,j,Ce.__webglTexture,0,qe(x)):(j===r.TEXTURE_2D||j>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&j<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,V,j,Ce.__webglTexture,fe),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Je(R,x,B){if(r.bindRenderbuffer(r.RENDERBUFFER,R),x.depthBuffer){const V=x.depthTexture,j=V&&V.isDepthTexture?V.type:null,fe=y(x.stencilBuffer,j),ce=x.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;at(x)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,qe(x),fe,x.width,x.height):B?r.renderbufferStorageMultisample(r.RENDERBUFFER,qe(x),fe,x.width,x.height):r.renderbufferStorage(r.RENDERBUFFER,fe,x.width,x.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,ce,r.RENDERBUFFER,R)}else{const V=x.textures;for(let j=0;j<V.length;j++){const fe=V[j],ce=s.convert(fe.format,fe.colorSpace),Q=s.convert(fe.type),ee=M(fe.internalFormat,ce,Q,fe.normalized,fe.colorSpace);at(x)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,qe(x),ee,x.width,x.height):B?r.renderbufferStorageMultisample(r.RENDERBUFFER,qe(x),ee,x.width,x.height):r.renderbufferStorage(r.RENDERBUFFER,ee,x.width,x.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function be(R,x,B){const V=x.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,R),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const j=n.get(x.depthTexture);if(j.__renderTarget=x,(!j.__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)&&(x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0),V){if(j.__webglInit===void 0&&(j.__webglInit=!0,x.depthTexture.addEventListener("dispose",w)),j.__webglTexture===void 0){j.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,j.__webglTexture),Pe(r.TEXTURE_CUBE_MAP,x.depthTexture);const me=s.convert(x.depthTexture.format),Ce=s.convert(x.depthTexture.type);let ge;x.depthTexture.format===ar?ge=r.DEPTH_COMPONENT24:x.depthTexture.format===Zr&&(ge=r.DEPTH24_STENCIL8);for(let pe=0;pe<6;pe++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,ge,x.width,x.height,0,me,Ce,null)}}else W(x.depthTexture,0);const fe=j.__webglTexture,ce=qe(x),Q=V?r.TEXTURE_CUBE_MAP_POSITIVE_X+B:r.TEXTURE_2D,ee=x.depthTexture.format===Zr?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(x.depthTexture.format===ar)at(x)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ee,Q,fe,0,ce):r.framebufferTexture2D(r.FRAMEBUFFER,ee,Q,fe,0);else if(x.depthTexture.format===Zr)at(x)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ee,Q,fe,0,ce):r.framebufferTexture2D(r.FRAMEBUFFER,ee,Q,fe,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function We(R){const x=n.get(R),B=R.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==R.depthTexture){const V=R.depthTexture;if(x.__depthDisposeCallback&&x.__depthDisposeCallback(),V){const j=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,V.removeEventListener("dispose",j)};V.addEventListener("dispose",j),x.__depthDisposeCallback=j}x.__boundDepthTexture=V}if(R.depthTexture&&!x.__autoAllocateDepthBuffer)if(B)for(let V=0;V<6;V++)be(x.__webglFramebuffer[V],R,V);else{const V=R.texture.mipmaps;V&&V.length>0?be(x.__webglFramebuffer[0],R,0):be(x.__webglFramebuffer,R,0)}else if(B){x.__webglDepthbuffer=[];for(let V=0;V<6;V++)if(t.bindFramebuffer(r.FRAMEBUFFER,x.__webglFramebuffer[V]),x.__webglDepthbuffer[V]===void 0)x.__webglDepthbuffer[V]=r.createRenderbuffer(),Je(x.__webglDepthbuffer[V],R,!1);else{const j=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,fe=x.__webglDepthbuffer[V];r.bindRenderbuffer(r.RENDERBUFFER,fe),r.framebufferRenderbuffer(r.FRAMEBUFFER,j,r.RENDERBUFFER,fe)}}else{const V=R.texture.mipmaps;if(V&&V.length>0?t.bindFramebuffer(r.FRAMEBUFFER,x.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,x.__webglFramebuffer),x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=r.createRenderbuffer(),Je(x.__webglDepthbuffer,R,!1);else{const j=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,fe=x.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,fe),r.framebufferRenderbuffer(r.FRAMEBUFFER,j,r.RENDERBUFFER,fe)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function Te(R,x,B){const V=n.get(R);x!==void 0&&Ee(V.__webglFramebuffer,R,R.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),B!==void 0&&We(R)}function Ne(R){const x=R.texture,B=n.get(R),V=n.get(x);R.addEventListener("dispose",v);const j=R.textures,fe=R.isWebGLCubeRenderTarget===!0,ce=j.length>1;if(ce||(V.__webglTexture===void 0&&(V.__webglTexture=r.createTexture()),V.__version=x.version,a.memory.textures++),fe){B.__webglFramebuffer=[];for(let Q=0;Q<6;Q++)if(x.mipmaps&&x.mipmaps.length>0){B.__webglFramebuffer[Q]=[];for(let ee=0;ee<x.mipmaps.length;ee++)B.__webglFramebuffer[Q][ee]=r.createFramebuffer()}else B.__webglFramebuffer[Q]=r.createFramebuffer()}else{if(x.mipmaps&&x.mipmaps.length>0){B.__webglFramebuffer=[];for(let Q=0;Q<x.mipmaps.length;Q++)B.__webglFramebuffer[Q]=r.createFramebuffer()}else B.__webglFramebuffer=r.createFramebuffer();if(ce)for(let Q=0,ee=j.length;Q<ee;Q++){const me=n.get(j[Q]);me.__webglTexture===void 0&&(me.__webglTexture=r.createTexture(),a.memory.textures++)}if(R.samples>0&&at(R)===!1){B.__webglMultisampledFramebuffer=r.createFramebuffer(),B.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let Q=0;Q<j.length;Q++){const ee=j[Q];B.__webglColorRenderbuffer[Q]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,B.__webglColorRenderbuffer[Q]);const me=s.convert(ee.format,ee.colorSpace),Ce=s.convert(ee.type),ge=M(ee.internalFormat,me,Ce,ee.normalized,ee.colorSpace,R.isXRRenderTarget===!0),pe=qe(R);r.renderbufferStorageMultisample(r.RENDERBUFFER,pe,ge,R.width,R.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Q,r.RENDERBUFFER,B.__webglColorRenderbuffer[Q])}r.bindRenderbuffer(r.RENDERBUFFER,null),R.depthBuffer&&(B.__webglDepthRenderbuffer=r.createRenderbuffer(),Je(B.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(fe){t.bindTexture(r.TEXTURE_CUBE_MAP,V.__webglTexture),Pe(r.TEXTURE_CUBE_MAP,x);for(let Q=0;Q<6;Q++)if(x.mipmaps&&x.mipmaps.length>0)for(let ee=0;ee<x.mipmaps.length;ee++)Ee(B.__webglFramebuffer[Q][ee],R,x,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,ee);else Ee(B.__webglFramebuffer[Q],R,x,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0);m(x)&&b(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ce){for(let Q=0,ee=j.length;Q<ee;Q++){const me=j[Q],Ce=n.get(me);let ge=r.TEXTURE_2D;(R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(ge=R.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(ge,Ce.__webglTexture),Pe(ge,me),Ee(B.__webglFramebuffer,R,me,r.COLOR_ATTACHMENT0+Q,ge,0),m(me)&&b(ge)}t.unbindTexture()}else{let Q=r.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(Q=R.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Q,V.__webglTexture),Pe(Q,x),x.mipmaps&&x.mipmaps.length>0)for(let ee=0;ee<x.mipmaps.length;ee++)Ee(B.__webglFramebuffer[ee],R,x,r.COLOR_ATTACHMENT0,Q,ee);else Ee(B.__webglFramebuffer,R,x,r.COLOR_ATTACHMENT0,Q,0);m(x)&&b(Q),t.unbindTexture()}R.depthBuffer&&We(R)}function $(R){const x=R.textures;for(let B=0,V=x.length;B<V;B++){const j=x[B];if(m(j)){const fe=A(R),ce=n.get(j).__webglTexture;t.bindTexture(fe,ce),b(fe),t.unbindTexture()}}}const je=[],ft=[];function _t(R){if(R.samples>0){if(at(R)===!1){const x=R.textures,B=R.width,V=R.height;let j=r.COLOR_BUFFER_BIT;const fe=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ce=n.get(R),Q=x.length>1;if(Q)for(let me=0;me<x.length;me++)t.bindFramebuffer(r.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+me,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,ce.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+me,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,ce.__webglMultisampledFramebuffer);const ee=R.texture.mipmaps;ee&&ee.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,ce.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,ce.__webglFramebuffer);for(let me=0;me<x.length;me++){if(R.resolveDepthBuffer&&(R.depthBuffer&&(j|=r.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&(j|=r.STENCIL_BUFFER_BIT)),Q){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,ce.__webglColorRenderbuffer[me]);const Ce=n.get(x[me]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Ce,0)}r.blitFramebuffer(0,0,B,V,0,0,B,V,j,r.NEAREST),l===!0&&(je.length=0,ft.length=0,je.push(r.COLOR_ATTACHMENT0+me),R.depthBuffer&&R.resolveDepthBuffer===!1&&(je.push(fe),ft.push(fe),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,ft)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,je))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Q)for(let me=0;me<x.length;me++){t.bindFramebuffer(r.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+me,r.RENDERBUFFER,ce.__webglColorRenderbuffer[me]);const Ce=n.get(x[me]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,ce.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+me,r.TEXTURE_2D,Ce,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,ce.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.resolveDepthBuffer===!1&&l){const x=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[x])}}}function qe(R){return Math.min(i.maxSamples,R.samples)}function at(R){const x=n.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function F(R){const x=a.render.frame;u.get(R)!==x&&(u.set(R,x),R.update())}function Mt(R,x){const B=R.colorSpace,V=R.format,j=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||B!==vl&&B!==xr&&(ct.getTransfer(B)===vt?(V!==bi||j!==hi)&&Ye("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):pt("WebGLTextures: Unsupported texture color space:",B)),x}function Xe(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=Y,this.getTextureUnits=H,this.setTextureUnits=O,this.setTexture2D=W,this.setTexture2DArray=Z,this.setTexture3D=D,this.setTextureCube=re,this.rebindTextures=Te,this.setupRenderTarget=Ne,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=_t,this.setupDepthRenderbuffer=We,this.setupFrameBufferTexture=Ee,this.useMultisampledRTT=at,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function oy(r,e){function t(n,i=xr){let s;const a=ct.getTransfer(i);if(n===hi)return r.UNSIGNED_BYTE;if(n===xf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===vf)return r.UNSIGNED_SHORT_5_5_5_1;if(n===fm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===dm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===cm)return r.BYTE;if(n===um)return r.SHORT;if(n===ja)return r.UNSIGNED_SHORT;if(n===_f)return r.INT;if(n===Gi)return r.UNSIGNED_INT;if(n===Ui)return r.FLOAT;if(n===sr)return r.HALF_FLOAT;if(n===hm)return r.ALPHA;if(n===pm)return r.RGB;if(n===bi)return r.RGBA;if(n===ar)return r.DEPTH_COMPONENT;if(n===Zr)return r.DEPTH_STENCIL;if(n===mm)return r.RED;if(n===Mf)return r.RED_INTEGER;if(n===ls)return r.RG;if(n===Sf)return r.RG_INTEGER;if(n===bf)return r.RGBA_INTEGER;if(n===tl||n===nl||n===il||n===rl)if(a===vt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===tl)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===nl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===il)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===rl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===tl)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===nl)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===il)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===rl)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===cu||n===uu||n===fu||n===du)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===cu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===uu)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===fu)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===du)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===hu||n===pu||n===mu||n===gu||n===_u||n===_l||n===xu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===hu||n===pu)return a===vt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===mu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===gu)return s.COMPRESSED_R11_EAC;if(n===_u)return s.COMPRESSED_SIGNED_R11_EAC;if(n===_l)return s.COMPRESSED_RG11_EAC;if(n===xu)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===vu||n===Mu||n===Su||n===bu||n===yu||n===Eu||n===Tu||n===wu||n===Au||n===Ru||n===Cu||n===Pu||n===Du||n===Lu)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===vu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Mu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Su)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===bu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===yu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Eu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Tu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===wu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Au)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ru)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Cu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Pu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Du)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Lu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Nu||n===Iu||n===Uu)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Nu)return a===vt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Iu)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Uu)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Fu||n===Ou||n===xl||n===Bu)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Fu)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ou)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===xl)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Bu)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ja?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const ly=`
4084
+ }`,ny=[new Y(1,0,0),new Y(-1,0,0),new Y(0,1,0),new Y(0,-1,0),new Y(0,0,1),new Y(0,0,-1)],iy=[new Y(0,-1,0),new Y(0,-1,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,-1,0),new Y(0,-1,0)],bh=new Xt,xa=new Y,Tc=new Y;function ry(r,e,t){let n=new Em;const i=new gt,s=new gt,a=new Bt,o=new _x,l=new xx,c={},u=t.maxTextureSize,h={[Nr]:Vn,[Vn]:Nr,[Ki]:Ki},f=new yi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new gt},radius:{value:4}},vertexShader:ey,fragmentShader:ty}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const g=new Ei;g.setAttribute("position",new Mn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new or(g,f),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=tl;let m=this.type;this.render=function(T,A,v){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||T.length===0)return;this.type===W0&&(Ye("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=tl);const E=r.getRenderTarget(),C=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),N=r.state;N.setBlending(er),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);const q=m!==this.type;q&&A.traverse(function(W){W.material&&(Array.isArray(W.material)?W.material.forEach(B=>B.needsUpdate=!0):W.material.needsUpdate=!0)});for(let W=0,B=T.length;W<B;W++){const G=T[W],I=G.shadow;if(I===void 0){Ye("WebGLShadowMap:",G,"has no shadow.");continue}if(I.autoUpdate===!1&&I.needsUpdate===!1)continue;i.copy(I.mapSize);const $=I.getFrameExtents();i.multiply($),s.copy(I.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/$.x),i.x=s.x*$.x,I.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/$.y),i.y=s.y*$.y,I.mapSize.y=s.y));const j=r.state.buffers.depth.getReversed();if(I.camera._reversedDepth=j,I.map===null||q===!0){if(I.map!==null&&(I.map.depthTexture!==null&&(I.map.depthTexture.dispose(),I.map.depthTexture=null),I.map.dispose()),this.type===wa){if(G.isPointLight){Ye("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}I.map=new ki(i.x,i.y,{format:cs,type:sr,minFilter:yn,magFilter:yn,generateMipmaps:!1}),I.map.texture.name=G.name+".shadowMap",I.map.depthTexture=new sa(i.x,i.y,Ui),I.map.depthTexture.name=G.name+".shadowMapDepth",I.map.depthTexture.format=ar,I.map.depthTexture.compareFunction=null,I.map.depthTexture.minFilter=dn,I.map.depthTexture.magFilter=dn}else G.isPointLight?(I.map=new Lm(i.x),I.map.depthTexture=new fx(i.x,Gi)):(I.map=new ki(i.x,i.y),I.map.depthTexture=new sa(i.x,i.y,Gi)),I.map.depthTexture.name=G.name+".shadowMap",I.map.depthTexture.format=ar,this.type===tl?(I.map.depthTexture.compareFunction=j?Tf:Ef,I.map.depthTexture.minFilter=yn,I.map.depthTexture.magFilter=yn):(I.map.depthTexture.compareFunction=null,I.map.depthTexture.minFilter=dn,I.map.depthTexture.magFilter=dn);I.camera.updateProjectionMatrix()}const D=I.map.isWebGLCubeRenderTarget?6:1;for(let se=0;se<D;se++){if(I.map.isWebGLCubeRenderTarget)r.setRenderTarget(I.map,se),r.clear();else{se===0&&(r.setRenderTarget(I.map),r.clear());const he=I.getViewport(se);a.set(s.x*he.x,s.y*he.y,s.x*he.z,s.y*he.w),N.viewport(a)}if(G.isPointLight){const he=I.camera,Ve=I.matrix,He=G.distance||he.far;He!==he.far&&(he.far=He,he.updateProjectionMatrix()),xa.setFromMatrixPosition(G.matrixWorld),he.position.copy(xa),Tc.copy(he.position),Tc.add(ny[se]),he.up.copy(iy[se]),he.lookAt(Tc),he.updateMatrixWorld(),Ve.makeTranslation(-xa.x,-xa.y,-xa.z),bh.multiplyMatrices(he.projectionMatrix,he.matrixWorldInverse),I._frustum.setFromProjectionMatrix(bh,he.coordinateSystem,he.reversedDepth)}else I.updateMatrices(G);n=I.getFrustum(),M(A,v,I.camera,G,this.type)}I.isPointLightShadow!==!0&&this.type===wa&&b(I,v),I.needsUpdate=!1}m=this.type,p.needsUpdate=!1,r.setRenderTarget(E,C,L)};function b(T,A){const v=e.update(_);f.defines.VSM_SAMPLES!==T.blurSamples&&(f.defines.VSM_SAMPLES=T.blurSamples,d.defines.VSM_SAMPLES=T.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new ki(i.x,i.y,{format:cs,type:sr})),f.uniforms.shadow_pass.value=T.map.depthTexture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,r.setRenderTarget(T.mapPass),r.clear(),r.renderBufferDirect(A,null,v,f,_,null),d.uniforms.shadow_pass.value=T.mapPass.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,r.setRenderTarget(T.map),r.clear(),r.renderBufferDirect(A,null,v,d,_,null)}function w(T,A,v,E){let C=null;const L=v.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(L!==void 0)C=L;else if(C=v.isPointLight===!0?l:o,r.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){const N=C.uuid,q=A.uuid;let W=c[N];W===void 0&&(W={},c[N]=W);let B=W[q];B===void 0&&(B=C.clone(),W[q]=B,A.addEventListener("dispose",y)),C=B}if(C.visible=A.visible,C.wireframe=A.wireframe,E===wa?C.side=A.shadowSide!==null?A.shadowSide:A.side:C.side=A.shadowSide!==null?A.shadowSide:h[A.side],C.alphaMap=A.alphaMap,C.alphaTest=A.alphaToCoverage===!0?.5:A.alphaTest,C.map=A.map,C.clipShadows=A.clipShadows,C.clippingPlanes=A.clippingPlanes,C.clipIntersection=A.clipIntersection,C.displacementMap=A.displacementMap,C.displacementScale=A.displacementScale,C.displacementBias=A.displacementBias,C.wireframeLinewidth=A.wireframeLinewidth,C.linewidth=A.linewidth,v.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const N=r.properties.get(C);N.light=v}return C}function M(T,A,v,E,C){if(T.visible===!1)return;if(T.layers.test(A.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&C===wa)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,T.matrixWorld);const q=e.update(T),W=T.material;if(Array.isArray(W)){const B=q.groups;for(let G=0,I=B.length;G<I;G++){const $=B[G],j=W[$.materialIndex];if(j&&j.visible){const D=w(T,j,E,C);T.onBeforeShadow(r,T,A,v,q,D,$),r.renderBufferDirect(v,null,q,D,T,$),T.onAfterShadow(r,T,A,v,q,D,$)}}}else if(W.visible){const B=w(T,W,E,C);T.onBeforeShadow(r,T,A,v,q,B,null),r.renderBufferDirect(v,null,q,B,T,null),T.onAfterShadow(r,T,A,v,q,B,null)}}const N=T.children;for(let q=0,W=N.length;q<W;q++)M(N[q],A,v,E,C)}function y(T){T.target.removeEventListener("dispose",y);for(const v in c){const E=c[v],C=T.target.uuid;C in E&&(E[C].dispose(),delete E[C])}}}function sy(r,e){function t(){let U=!1;const de=new Bt;let te=null;const _e=new Bt(0,0,0,0);return{setMask:function(xe){te!==xe&&!U&&(r.colorMask(xe,xe,xe,xe),te=xe)},setLocked:function(xe){U=xe},setClear:function(xe,ne,le,ie,ke){ke===!0&&(xe*=ie,ne*=ie,le*=ie),de.set(xe,ne,le,ie),_e.equals(de)===!1&&(r.clearColor(xe,ne,le,ie),_e.copy(de))},reset:function(){U=!1,te=null,_e.set(-1,0,0,0)}}}function n(){let U=!1,de=!1,te=null,_e=null,xe=null;return{setReversed:function(ne){if(de!==ne){const le=e.get("EXT_clip_control");ne?le.clipControlEXT(le.LOWER_LEFT_EXT,le.ZERO_TO_ONE_EXT):le.clipControlEXT(le.LOWER_LEFT_EXT,le.NEGATIVE_ONE_TO_ONE_EXT),de=ne;const ie=xe;xe=null,this.setClear(ie)}},getReversed:function(){return de},setTest:function(ne){ne?re(r.DEPTH_TEST):Re(r.DEPTH_TEST)},setMask:function(ne){te!==ne&&!U&&(r.depthMask(ne),te=ne)},setFunc:function(ne){if(de&&(ne=y_[ne]),_e!==ne){switch(ne){case tu:r.depthFunc(r.NEVER);break;case nu:r.depthFunc(r.ALWAYS);break;case iu:r.depthFunc(r.LESS);break;case ia:r.depthFunc(r.LEQUAL);break;case ru:r.depthFunc(r.EQUAL);break;case su:r.depthFunc(r.GEQUAL);break;case au:r.depthFunc(r.GREATER);break;case ou:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}_e=ne}},setLocked:function(ne){U=ne},setClear:function(ne){xe!==ne&&(xe=ne,de&&(ne=1-ne),r.clearDepth(ne))},reset:function(){U=!1,te=null,_e=null,xe=null,de=!1}}}function i(){let U=!1,de=null,te=null,_e=null,xe=null,ne=null,le=null,ie=null,ke=null;return{setTest:function(ce){U||(ce?re(r.STENCIL_TEST):Re(r.STENCIL_TEST))},setMask:function(ce){de!==ce&&!U&&(r.stencilMask(ce),de=ce)},setFunc:function(ce,ze,Pe){(te!==ce||_e!==ze||xe!==Pe)&&(r.stencilFunc(ce,ze,Pe),te=ce,_e=ze,xe=Pe)},setOp:function(ce,ze,Pe){(ne!==ce||le!==ze||ie!==Pe)&&(r.stencilOp(ce,ze,Pe),ne=ce,le=ze,ie=Pe)},setLocked:function(ce){U=ce},setClear:function(ce){ke!==ce&&(r.clearStencil(ce),ke=ce)},reset:function(){U=!1,de=null,te=null,_e=null,xe=null,ne=null,le=null,ie=null,ke=null}}}const s=new t,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let u={},h={},f={},d=new WeakMap,g=[],_=null,p=!1,m=null,b=null,w=null,M=null,y=null,T=null,A=null,v=new ft(0,0,0),E=0,C=!1,L=null,N=null,q=null,W=null,B=null;const G=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let I=!1,$=0;const j=r.getParameter(r.VERSION);j.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(j)[1]),I=$>=1):j.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),I=$>=2);let D=null,se={};const he=r.getParameter(r.SCISSOR_BOX),Ve=r.getParameter(r.VIEWPORT),He=new Bt().fromArray(he),De=new Bt().fromArray(Ve);function J(U,de,te,_e){const xe=new Uint8Array(4),ne=r.createTexture();r.bindTexture(U,ne),r.texParameteri(U,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(U,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let le=0;le<te;le++)U===r.TEXTURE_3D||U===r.TEXTURE_2D_ARRAY?r.texImage3D(de,0,r.RGBA,1,1,_e,0,r.RGBA,r.UNSIGNED_BYTE,xe):r.texImage2D(de+le,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,xe);return ne}const ae={};ae[r.TEXTURE_2D]=J(r.TEXTURE_2D,r.TEXTURE_2D,1),ae[r.TEXTURE_CUBE_MAP]=J(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),ae[r.TEXTURE_2D_ARRAY]=J(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),ae[r.TEXTURE_3D]=J(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),re(r.DEPTH_TEST),a.setFunc(ia),V(!1),Je(yd),re(r.CULL_FACE),Xe(er);function re(U){u[U]!==!0&&(r.enable(U),u[U]=!0)}function Re(U){u[U]!==!1&&(r.disable(U),u[U]=!1)}function Ie(U,de){return f[U]!==de?(r.bindFramebuffer(U,de),f[U]=de,U===r.DRAW_FRAMEBUFFER&&(f[r.FRAMEBUFFER]=de),U===r.FRAMEBUFFER&&(f[r.DRAW_FRAMEBUFFER]=de),!0):!1}function Ee(U,de){let te=g,_e=!1;if(U){te=d.get(de),te===void 0&&(te=[],d.set(de,te));const xe=U.textures;if(te.length!==xe.length||te[0]!==r.COLOR_ATTACHMENT0){for(let ne=0,le=xe.length;ne<le;ne++)te[ne]=r.COLOR_ATTACHMENT0+ne;te.length=xe.length,_e=!0}}else te[0]!==r.BACK&&(te[0]=r.BACK,_e=!0);_e&&r.drawBuffers(te)}function Qe(U){return _!==U?(r.useProgram(U),_=U,!0):!1}const ye={[Yr]:r.FUNC_ADD,[Y0]:r.FUNC_SUBTRACT,[q0]:r.FUNC_REVERSE_SUBTRACT};ye[$0]=r.MIN,ye[Z0]=r.MAX;const Ge={[K0]:r.ZERO,[j0]:r.ONE,[J0]:r.SRC_COLOR,[Qc]:r.SRC_ALPHA,[r_]:r.SRC_ALPHA_SATURATE,[n_]:r.DST_COLOR,[e_]:r.DST_ALPHA,[Q0]:r.ONE_MINUS_SRC_COLOR,[eu]:r.ONE_MINUS_SRC_ALPHA,[i_]:r.ONE_MINUS_DST_COLOR,[t_]:r.ONE_MINUS_DST_ALPHA,[s_]:r.CONSTANT_COLOR,[a_]:r.ONE_MINUS_CONSTANT_COLOR,[o_]:r.CONSTANT_ALPHA,[l_]:r.ONE_MINUS_CONSTANT_ALPHA};function Xe(U,de,te,_e,xe,ne,le,ie,ke,ce){if(U===er){p===!0&&(Re(r.BLEND),p=!1);return}if(p===!1&&(re(r.BLEND),p=!0),U!==X0){if(U!==m||ce!==C){if((b!==Yr||y!==Yr)&&(r.blendEquation(r.FUNC_ADD),b=Yr,y=Yr),ce)switch(U){case $s:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Jc:r.blendFunc(r.ONE,r.ONE);break;case Ed:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Td:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:ht("WebGLState: Invalid blending: ",U);break}else switch(U){case $s:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Jc:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Ed:ht("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Td:ht("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ht("WebGLState: Invalid blending: ",U);break}w=null,M=null,T=null,A=null,v.set(0,0,0),E=0,m=U,C=ce}return}xe=xe||de,ne=ne||te,le=le||_e,(de!==b||xe!==y)&&(r.blendEquationSeparate(ye[de],ye[xe]),b=de,y=xe),(te!==w||_e!==M||ne!==T||le!==A)&&(r.blendFuncSeparate(Ge[te],Ge[_e],Ge[ne],Ge[le]),w=te,M=_e,T=ne,A=le),(ie.equals(v)===!1||ke!==E)&&(r.blendColor(ie.r,ie.g,ie.b,ke),v.copy(ie),E=ke),m=U,C=!1}function Te(U,de){U.side===Ki?Re(r.CULL_FACE):re(r.CULL_FACE);let te=U.side===Vn;de&&(te=!te),V(te),U.blending===$s&&U.transparent===!1?Xe(er):Xe(U.blending,U.blendEquation,U.blendSrc,U.blendDst,U.blendEquationAlpha,U.blendSrcAlpha,U.blendDstAlpha,U.blendColor,U.blendAlpha,U.premultipliedAlpha),a.setFunc(U.depthFunc),a.setTest(U.depthTest),a.setMask(U.depthWrite),s.setMask(U.colorWrite);const _e=U.stencilWrite;o.setTest(_e),_e&&(o.setMask(U.stencilWriteMask),o.setFunc(U.stencilFunc,U.stencilRef,U.stencilFuncMask),o.setOp(U.stencilFail,U.stencilZFail,U.stencilZPass)),pt(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),U.alphaToCoverage===!0?re(r.SAMPLE_ALPHA_TO_COVERAGE):Re(r.SAMPLE_ALPHA_TO_COVERAGE)}function V(U){L!==U&&(U?r.frontFace(r.CW):r.frontFace(r.CCW),L=U)}function Je(U){U!==V0?(re(r.CULL_FACE),U!==N&&(U===yd?r.cullFace(r.BACK):U===H0?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Re(r.CULL_FACE),N=U}function $e(U){U!==q&&(I&&r.lineWidth(U),q=U)}function pt(U,de,te){U?(re(r.POLYGON_OFFSET_FILL),(W!==de||B!==te)&&(W=de,B=te,a.getReversed()&&(de=-de),r.polygonOffset(de,te))):Re(r.POLYGON_OFFSET_FILL)}function qe(U){U?re(r.SCISSOR_TEST):Re(r.SCISSOR_TEST)}function mt(U){U===void 0&&(U=r.TEXTURE0+G-1),D!==U&&(r.activeTexture(U),D=U)}function F(U,de,te){te===void 0&&(D===null?te=r.TEXTURE0+G-1:te=D);let _e=se[te];_e===void 0&&(_e={type:void 0,texture:void 0},se[te]=_e),(_e.type!==U||_e.texture!==de)&&(D!==te&&(r.activeTexture(te),D=te),r.bindTexture(U,de||ae[U]),_e.type=U,_e.texture=de)}function Dt(){const U=se[D];U!==void 0&&U.type!==void 0&&(r.bindTexture(U.type,null),U.type=void 0,U.texture=void 0)}function We(){try{r.compressedTexImage2D(...arguments)}catch(U){ht("WebGLState:",U)}}function R(){try{r.compressedTexImage3D(...arguments)}catch(U){ht("WebGLState:",U)}}function x(){try{r.texSubImage2D(...arguments)}catch(U){ht("WebGLState:",U)}}function O(){try{r.texSubImage3D(...arguments)}catch(U){ht("WebGLState:",U)}}function z(){try{r.compressedTexSubImage2D(...arguments)}catch(U){ht("WebGLState:",U)}}function K(){try{r.compressedTexSubImage3D(...arguments)}catch(U){ht("WebGLState:",U)}}function ue(){try{r.texStorage2D(...arguments)}catch(U){ht("WebGLState:",U)}}function oe(){try{r.texStorage3D(...arguments)}catch(U){ht("WebGLState:",U)}}function Q(){try{r.texImage2D(...arguments)}catch(U){ht("WebGLState:",U)}}function ee(){try{r.texImage3D(...arguments)}catch(U){ht("WebGLState:",U)}}function pe(U){return h[U]!==void 0?h[U]:r.getParameter(U)}function Ae(U,de){h[U]!==de&&(r.pixelStorei(U,de),h[U]=de)}function ge(U){He.equals(U)===!1&&(r.scissor(U.x,U.y,U.z,U.w),He.copy(U))}function me(U){De.equals(U)===!1&&(r.viewport(U.x,U.y,U.z,U.w),De.copy(U))}function fe(U,de){let te=c.get(de);te===void 0&&(te=new WeakMap,c.set(de,te));let _e=te.get(U);_e===void 0&&(_e=r.getUniformBlockIndex(de,U.name),te.set(U,_e))}function Le(U,de){const _e=c.get(de).get(U);l.get(de)!==_e&&(r.uniformBlockBinding(de,_e,U.__bindingPointIndex),l.set(de,_e))}function Be(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),r.pixelStorei(r.PACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL),r.pixelStorei(r.PACK_ROW_LENGTH,0),r.pixelStorei(r.PACK_SKIP_PIXELS,0),r.pixelStorei(r.PACK_SKIP_ROWS,0),r.pixelStorei(r.UNPACK_ROW_LENGTH,0),r.pixelStorei(r.UNPACK_IMAGE_HEIGHT,0),r.pixelStorei(r.UNPACK_SKIP_PIXELS,0),r.pixelStorei(r.UNPACK_SKIP_ROWS,0),r.pixelStorei(r.UNPACK_SKIP_IMAGES,0),u={},h={},D=null,se={},f={},d=new WeakMap,g=[],_=null,p=!1,m=null,b=null,w=null,M=null,y=null,T=null,A=null,v=new ft(0,0,0),E=0,C=!1,L=null,N=null,q=null,W=null,B=null,He.set(0,0,r.canvas.width,r.canvas.height),De.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:re,disable:Re,bindFramebuffer:Ie,drawBuffers:Ee,useProgram:Qe,setBlending:Xe,setMaterial:Te,setFlipSided:V,setCullFace:Je,setLineWidth:$e,setPolygonOffset:pt,setScissorTest:qe,activeTexture:mt,bindTexture:F,unbindTexture:Dt,compressedTexImage2D:We,compressedTexImage3D:R,texImage2D:Q,texImage3D:ee,pixelStorei:Ae,getParameter:pe,updateUBOMapping:fe,uniformBlockBinding:Le,texStorage2D:ue,texStorage3D:oe,texSubImage2D:x,texSubImage3D:O,compressedTexSubImage2D:z,compressedTexSubImage3D:K,scissor:ge,viewport:me,reset:Be}}function ay(r,e,t,n,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new gt,u=new WeakMap,h=new Set;let f;const d=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(R,x){return g?new OffscreenCanvas(R,x):yl("canvas")}function p(R,x,O){let z=1;const K=We(R);if((K.width>O||K.height>O)&&(z=O/Math.max(K.width,K.height)),z<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const ue=Math.floor(z*K.width),oe=Math.floor(z*K.height);f===void 0&&(f=_(ue,oe));const Q=x?_(ue,oe):f;return Q.width=ue,Q.height=oe,Q.getContext("2d").drawImage(R,0,0,ue,oe),Ye("WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+ue+"x"+oe+")."),Q}else return"data"in R&&Ye("WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),R;return R}function m(R){return R.generateMipmaps}function b(R){r.generateMipmap(R)}function w(R){return R.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?r.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function M(R,x,O,z,K,ue=!1){if(R!==null){if(r[R]!==void 0)return r[R];Ye("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let oe;z&&(oe=e.get("EXT_texture_norm16"),oe||Ye("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let Q=x;if(x===r.RED&&(O===r.FLOAT&&(Q=r.R32F),O===r.HALF_FLOAT&&(Q=r.R16F),O===r.UNSIGNED_BYTE&&(Q=r.R8),O===r.UNSIGNED_SHORT&&oe&&(Q=oe.R16_EXT),O===r.SHORT&&oe&&(Q=oe.R16_SNORM_EXT)),x===r.RED_INTEGER&&(O===r.UNSIGNED_BYTE&&(Q=r.R8UI),O===r.UNSIGNED_SHORT&&(Q=r.R16UI),O===r.UNSIGNED_INT&&(Q=r.R32UI),O===r.BYTE&&(Q=r.R8I),O===r.SHORT&&(Q=r.R16I),O===r.INT&&(Q=r.R32I)),x===r.RG&&(O===r.FLOAT&&(Q=r.RG32F),O===r.HALF_FLOAT&&(Q=r.RG16F),O===r.UNSIGNED_BYTE&&(Q=r.RG8),O===r.UNSIGNED_SHORT&&oe&&(Q=oe.RG16_EXT),O===r.SHORT&&oe&&(Q=oe.RG16_SNORM_EXT)),x===r.RG_INTEGER&&(O===r.UNSIGNED_BYTE&&(Q=r.RG8UI),O===r.UNSIGNED_SHORT&&(Q=r.RG16UI),O===r.UNSIGNED_INT&&(Q=r.RG32UI),O===r.BYTE&&(Q=r.RG8I),O===r.SHORT&&(Q=r.RG16I),O===r.INT&&(Q=r.RG32I)),x===r.RGB_INTEGER&&(O===r.UNSIGNED_BYTE&&(Q=r.RGB8UI),O===r.UNSIGNED_SHORT&&(Q=r.RGB16UI),O===r.UNSIGNED_INT&&(Q=r.RGB32UI),O===r.BYTE&&(Q=r.RGB8I),O===r.SHORT&&(Q=r.RGB16I),O===r.INT&&(Q=r.RGB32I)),x===r.RGBA_INTEGER&&(O===r.UNSIGNED_BYTE&&(Q=r.RGBA8UI),O===r.UNSIGNED_SHORT&&(Q=r.RGBA16UI),O===r.UNSIGNED_INT&&(Q=r.RGBA32UI),O===r.BYTE&&(Q=r.RGBA8I),O===r.SHORT&&(Q=r.RGBA16I),O===r.INT&&(Q=r.RGBA32I)),x===r.RGB&&(O===r.UNSIGNED_SHORT&&oe&&(Q=oe.RGB16_EXT),O===r.SHORT&&oe&&(Q=oe.RGB16_SNORM_EXT),O===r.UNSIGNED_INT_5_9_9_9_REV&&(Q=r.RGB9_E5),O===r.UNSIGNED_INT_10F_11F_11F_REV&&(Q=r.R11F_G11F_B10F)),x===r.RGBA){const ee=ue?Sl:ct.getTransfer(K);O===r.FLOAT&&(Q=r.RGBA32F),O===r.HALF_FLOAT&&(Q=r.RGBA16F),O===r.UNSIGNED_BYTE&&(Q=ee===vt?r.SRGB8_ALPHA8:r.RGBA8),O===r.UNSIGNED_SHORT&&oe&&(Q=oe.RGBA16_EXT),O===r.SHORT&&oe&&(Q=oe.RGBA16_SNORM_EXT),O===r.UNSIGNED_SHORT_4_4_4_4&&(Q=r.RGBA4),O===r.UNSIGNED_SHORT_5_5_5_1&&(Q=r.RGB5_A1)}return(Q===r.R16F||Q===r.R32F||Q===r.RG16F||Q===r.RG32F||Q===r.RGBA16F||Q===r.RGBA32F)&&e.get("EXT_color_buffer_float"),Q}function y(R,x){let O;return R?x===null||x===Gi||x===Qa?O=r.DEPTH24_STENCIL8:x===Ui?O=r.DEPTH32F_STENCIL8:x===Ja&&(O=r.DEPTH24_STENCIL8,Ye("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):x===null||x===Gi||x===Qa?O=r.DEPTH_COMPONENT24:x===Ui?O=r.DEPTH_COMPONENT32F:x===Ja&&(O=r.DEPTH_COMPONENT16),O}function T(R,x){return m(R)===!0||R.isFramebufferTexture&&R.minFilter!==dn&&R.minFilter!==yn?Math.log2(Math.max(x.width,x.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?x.mipmaps.length:1}function A(R){const x=R.target;x.removeEventListener("dispose",A),E(x),x.isVideoTexture&&u.delete(x),x.isHTMLTexture&&h.delete(x)}function v(R){const x=R.target;x.removeEventListener("dispose",v),L(x)}function E(R){const x=n.get(R);if(x.__webglInit===void 0)return;const O=R.source,z=d.get(O);if(z){const K=z[x.__cacheKey];K.usedTimes--,K.usedTimes===0&&C(R),Object.keys(z).length===0&&d.delete(O)}n.remove(R)}function C(R){const x=n.get(R);r.deleteTexture(x.__webglTexture);const O=R.source,z=d.get(O);delete z[x.__cacheKey],a.memory.textures--}function L(R){const x=n.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),n.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let z=0;z<6;z++){if(Array.isArray(x.__webglFramebuffer[z]))for(let K=0;K<x.__webglFramebuffer[z].length;K++)r.deleteFramebuffer(x.__webglFramebuffer[z][K]);else r.deleteFramebuffer(x.__webglFramebuffer[z]);x.__webglDepthbuffer&&r.deleteRenderbuffer(x.__webglDepthbuffer[z])}else{if(Array.isArray(x.__webglFramebuffer))for(let z=0;z<x.__webglFramebuffer.length;z++)r.deleteFramebuffer(x.__webglFramebuffer[z]);else r.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer&&r.deleteRenderbuffer(x.__webglDepthbuffer),x.__webglMultisampledFramebuffer&&r.deleteFramebuffer(x.__webglMultisampledFramebuffer),x.__webglColorRenderbuffer)for(let z=0;z<x.__webglColorRenderbuffer.length;z++)x.__webglColorRenderbuffer[z]&&r.deleteRenderbuffer(x.__webglColorRenderbuffer[z]);x.__webglDepthRenderbuffer&&r.deleteRenderbuffer(x.__webglDepthRenderbuffer)}const O=R.textures;for(let z=0,K=O.length;z<K;z++){const ue=n.get(O[z]);ue.__webglTexture&&(r.deleteTexture(ue.__webglTexture),a.memory.textures--),n.remove(O[z])}n.remove(R)}let N=0;function q(){N=0}function W(){return N}function B(R){N=R}function G(){const R=N;return R>=i.maxTextures&&Ye("WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+i.maxTextures),N+=1,R}function I(R){const x=[];return x.push(R.wrapS),x.push(R.wrapT),x.push(R.wrapR||0),x.push(R.magFilter),x.push(R.minFilter),x.push(R.anisotropy),x.push(R.internalFormat),x.push(R.format),x.push(R.type),x.push(R.generateMipmaps),x.push(R.premultiplyAlpha),x.push(R.flipY),x.push(R.unpackAlignment),x.push(R.colorSpace),x.join()}function $(R,x){const O=n.get(R);if(R.isVideoTexture&&F(R),R.isRenderTargetTexture===!1&&R.isExternalTexture!==!0&&R.version>0&&O.__version!==R.version){const z=R.image;if(z===null)Ye("WebGLRenderer: Texture marked for update but no image data found.");else if(z.complete===!1)Ye("WebGLRenderer: Texture marked for update but image is incomplete");else{Re(O,R,x);return}}else R.isExternalTexture&&(O.__webglTexture=R.sourceTexture?R.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,O.__webglTexture,r.TEXTURE0+x)}function j(R,x){const O=n.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&O.__version!==R.version){Re(O,R,x);return}else R.isExternalTexture&&(O.__webglTexture=R.sourceTexture?R.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,O.__webglTexture,r.TEXTURE0+x)}function D(R,x){const O=n.get(R);if(R.isRenderTargetTexture===!1&&R.version>0&&O.__version!==R.version){Re(O,R,x);return}t.bindTexture(r.TEXTURE_3D,O.__webglTexture,r.TEXTURE0+x)}function se(R,x){const O=n.get(R);if(R.isCubeDepthTexture!==!0&&R.version>0&&O.__version!==R.version){Ie(O,R,x);return}t.bindTexture(r.TEXTURE_CUBE_MAP,O.__webglTexture,r.TEXTURE0+x)}const he={[lu]:r.REPEAT,[Ji]:r.CLAMP_TO_EDGE,[cu]:r.MIRRORED_REPEAT},Ve={[dn]:r.NEAREST,[f_]:r.NEAREST_MIPMAP_NEAREST,[vo]:r.NEAREST_MIPMAP_LINEAR,[yn]:r.LINEAR,[jl]:r.LINEAR_MIPMAP_NEAREST,[Kr]:r.LINEAR_MIPMAP_LINEAR},He={[p_]:r.NEVER,[v_]:r.ALWAYS,[m_]:r.LESS,[Ef]:r.LEQUAL,[g_]:r.EQUAL,[Tf]:r.GEQUAL,[__]:r.GREATER,[x_]:r.NOTEQUAL};function De(R,x){if(x.type===Ui&&e.has("OES_texture_float_linear")===!1&&(x.magFilter===yn||x.magFilter===jl||x.magFilter===vo||x.magFilter===Kr||x.minFilter===yn||x.minFilter===jl||x.minFilter===vo||x.minFilter===Kr)&&Ye("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(R,r.TEXTURE_WRAP_S,he[x.wrapS]),r.texParameteri(R,r.TEXTURE_WRAP_T,he[x.wrapT]),(R===r.TEXTURE_3D||R===r.TEXTURE_2D_ARRAY)&&r.texParameteri(R,r.TEXTURE_WRAP_R,he[x.wrapR]),r.texParameteri(R,r.TEXTURE_MAG_FILTER,Ve[x.magFilter]),r.texParameteri(R,r.TEXTURE_MIN_FILTER,Ve[x.minFilter]),x.compareFunction&&(r.texParameteri(R,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(R,r.TEXTURE_COMPARE_FUNC,He[x.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===dn||x.minFilter!==vo&&x.minFilter!==Kr||x.type===Ui&&e.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||n.get(x).__currentAnisotropy){const O=e.get("EXT_texture_filter_anisotropic");r.texParameterf(R,O.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,i.getMaxAnisotropy())),n.get(x).__currentAnisotropy=x.anisotropy}}}function J(R,x){let O=!1;R.__webglInit===void 0&&(R.__webglInit=!0,x.addEventListener("dispose",A));const z=x.source;let K=d.get(z);K===void 0&&(K={},d.set(z,K));const ue=I(x);if(ue!==R.__cacheKey){K[ue]===void 0&&(K[ue]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,O=!0),K[ue].usedTimes++;const oe=K[R.__cacheKey];oe!==void 0&&(K[R.__cacheKey].usedTimes--,oe.usedTimes===0&&C(x)),R.__cacheKey=ue,R.__webglTexture=K[ue].texture}return O}function ae(R,x,O){return Math.floor(Math.floor(R/O)/x)}function re(R,x,O,z){const ue=R.updateRanges;if(ue.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,x.width,x.height,O,z,x.data);else{ue.sort((Ae,ge)=>Ae.start-ge.start);let oe=0;for(let Ae=1;Ae<ue.length;Ae++){const ge=ue[oe],me=ue[Ae],fe=ge.start+ge.count,Le=ae(me.start,x.width,4),Be=ae(ge.start,x.width,4);me.start<=fe+1&&Le===Be&&ae(me.start+me.count-1,x.width,4)===Le?ge.count=Math.max(ge.count,me.start+me.count-ge.start):(++oe,ue[oe]=me)}ue.length=oe+1;const Q=t.getParameter(r.UNPACK_ROW_LENGTH),ee=t.getParameter(r.UNPACK_SKIP_PIXELS),pe=t.getParameter(r.UNPACK_SKIP_ROWS);t.pixelStorei(r.UNPACK_ROW_LENGTH,x.width);for(let Ae=0,ge=ue.length;Ae<ge;Ae++){const me=ue[Ae],fe=Math.floor(me.start/4),Le=Math.ceil(me.count/4),Be=fe%x.width,U=Math.floor(fe/x.width),de=Le,te=1;t.pixelStorei(r.UNPACK_SKIP_PIXELS,Be),t.pixelStorei(r.UNPACK_SKIP_ROWS,U),t.texSubImage2D(r.TEXTURE_2D,0,Be,U,de,te,O,z,x.data)}R.clearUpdateRanges(),t.pixelStorei(r.UNPACK_ROW_LENGTH,Q),t.pixelStorei(r.UNPACK_SKIP_PIXELS,ee),t.pixelStorei(r.UNPACK_SKIP_ROWS,pe)}}function Re(R,x,O){let z=r.TEXTURE_2D;(x.isDataArrayTexture||x.isCompressedArrayTexture)&&(z=r.TEXTURE_2D_ARRAY),x.isData3DTexture&&(z=r.TEXTURE_3D);const K=J(R,x),ue=x.source;t.bindTexture(z,R.__webglTexture,r.TEXTURE0+O);const oe=n.get(ue);if(ue.version!==oe.__version||K===!0){if(t.activeTexture(r.TEXTURE0+O),(typeof ImageBitmap<"u"&&x.image instanceof ImageBitmap)===!1){const te=ct.getPrimaries(ct.workingColorSpace),_e=x.colorSpace===xr?null:ct.getPrimaries(x.colorSpace),xe=x.colorSpace===xr||te===_e?r.NONE:r.BROWSER_DEFAULT_WEBGL;t.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,x.flipY),t.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),t.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,xe)}t.pixelStorei(r.UNPACK_ALIGNMENT,x.unpackAlignment);let ee=p(x.image,!1,i.maxTextureSize);ee=Dt(x,ee);const pe=s.convert(x.format,x.colorSpace),Ae=s.convert(x.type);let ge=M(x.internalFormat,pe,Ae,x.normalized,x.colorSpace,x.isVideoTexture);De(z,x);let me;const fe=x.mipmaps,Le=x.isVideoTexture!==!0,Be=oe.__version===void 0||K===!0,U=ue.dataReady,de=T(x,ee);if(x.isDepthTexture)ge=y(x.format===jr,x.type),Be&&(Le?t.texStorage2D(r.TEXTURE_2D,1,ge,ee.width,ee.height):t.texImage2D(r.TEXTURE_2D,0,ge,ee.width,ee.height,0,pe,Ae,null));else if(x.isDataTexture)if(fe.length>0){Le&&Be&&t.texStorage2D(r.TEXTURE_2D,de,ge,fe[0].width,fe[0].height);for(let te=0,_e=fe.length;te<_e;te++)me=fe[te],Le?U&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,me.width,me.height,pe,Ae,me.data):t.texImage2D(r.TEXTURE_2D,te,ge,me.width,me.height,0,pe,Ae,me.data);x.generateMipmaps=!1}else Le?(Be&&t.texStorage2D(r.TEXTURE_2D,de,ge,ee.width,ee.height),U&&re(x,ee,pe,Ae)):t.texImage2D(r.TEXTURE_2D,0,ge,ee.width,ee.height,0,pe,Ae,ee.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){Le&&Be&&t.texStorage3D(r.TEXTURE_2D_ARRAY,de,ge,fe[0].width,fe[0].height,ee.depth);for(let te=0,_e=fe.length;te<_e;te++)if(me=fe[te],x.format!==bi)if(pe!==null)if(Le){if(U)if(x.layerUpdates.size>0){const xe=Qd(me.width,me.height,x.format,x.type);for(const ne of x.layerUpdates){const le=me.data.subarray(ne*xe/me.data.BYTES_PER_ELEMENT,(ne+1)*xe/me.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,ne,me.width,me.height,1,pe,le)}x.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,me.width,me.height,ee.depth,pe,me.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,te,ge,me.width,me.height,ee.depth,0,me.data,0,0);else Ye("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Le?U&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,me.width,me.height,ee.depth,pe,Ae,me.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,ge,me.width,me.height,ee.depth,0,pe,Ae,me.data)}else{Le&&Be&&t.texStorage2D(r.TEXTURE_2D,de,ge,fe[0].width,fe[0].height);for(let te=0,_e=fe.length;te<_e;te++)me=fe[te],x.format!==bi?pe!==null?Le?U&&t.compressedTexSubImage2D(r.TEXTURE_2D,te,0,0,me.width,me.height,pe,me.data):t.compressedTexImage2D(r.TEXTURE_2D,te,ge,me.width,me.height,0,me.data):Ye("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Le?U&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,me.width,me.height,pe,Ae,me.data):t.texImage2D(r.TEXTURE_2D,te,ge,me.width,me.height,0,pe,Ae,me.data)}else if(x.isDataArrayTexture)if(Le){if(Be&&t.texStorage3D(r.TEXTURE_2D_ARRAY,de,ge,ee.width,ee.height,ee.depth),U)if(x.layerUpdates.size>0){const te=Qd(ee.width,ee.height,x.format,x.type);for(const _e of x.layerUpdates){const xe=ee.data.subarray(_e*te/ee.data.BYTES_PER_ELEMENT,(_e+1)*te/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,_e,ee.width,ee.height,1,pe,Ae,xe)}x.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,pe,Ae,ee.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,ge,ee.width,ee.height,ee.depth,0,pe,Ae,ee.data);else if(x.isData3DTexture)Le?(Be&&t.texStorage3D(r.TEXTURE_3D,de,ge,ee.width,ee.height,ee.depth),U&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,pe,Ae,ee.data)):t.texImage3D(r.TEXTURE_3D,0,ge,ee.width,ee.height,ee.depth,0,pe,Ae,ee.data);else if(x.isFramebufferTexture){if(Be)if(Le)t.texStorage2D(r.TEXTURE_2D,de,ge,ee.width,ee.height);else{let te=ee.width,_e=ee.height;for(let xe=0;xe<de;xe++)t.texImage2D(r.TEXTURE_2D,xe,ge,te,_e,0,pe,Ae,null),te>>=1,_e>>=1}}else if(x.isHTMLTexture){if("texElementImage2D"in r){const te=r.canvas;if(te.hasAttribute("layoutsubtree")||te.setAttribute("layoutsubtree","true"),ee.parentNode!==te){te.appendChild(ee),h.add(x),te.onpaint=_e=>{const xe=_e.changedElements;for(const ne of h)xe.includes(ne.image)&&(ne.needsUpdate=!0)},te.requestPaint();return}if(r.texElementImage2D.length===3)r.texElementImage2D(r.TEXTURE_2D,r.RGBA8,ee);else{const xe=r.RGBA,ne=r.RGBA,le=r.UNSIGNED_BYTE;r.texElementImage2D(r.TEXTURE_2D,0,xe,ne,le,ee)}r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE)}}else if(fe.length>0){if(Le&&Be){const te=We(fe[0]);t.texStorage2D(r.TEXTURE_2D,de,ge,te.width,te.height)}for(let te=0,_e=fe.length;te<_e;te++)me=fe[te],Le?U&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,pe,Ae,me):t.texImage2D(r.TEXTURE_2D,te,ge,pe,Ae,me);x.generateMipmaps=!1}else if(Le){if(Be){const te=We(ee);t.texStorage2D(r.TEXTURE_2D,de,ge,te.width,te.height)}U&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,pe,Ae,ee)}else t.texImage2D(r.TEXTURE_2D,0,ge,pe,Ae,ee);m(x)&&b(z),oe.__version=ue.version,x.onUpdate&&x.onUpdate(x)}R.__version=x.version}function Ie(R,x,O){if(x.image.length!==6)return;const z=J(R,x),K=x.source;t.bindTexture(r.TEXTURE_CUBE_MAP,R.__webglTexture,r.TEXTURE0+O);const ue=n.get(K);if(K.version!==ue.__version||z===!0){t.activeTexture(r.TEXTURE0+O);const oe=ct.getPrimaries(ct.workingColorSpace),Q=x.colorSpace===xr?null:ct.getPrimaries(x.colorSpace),ee=x.colorSpace===xr||oe===Q?r.NONE:r.BROWSER_DEFAULT_WEBGL;t.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,x.flipY),t.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),t.pixelStorei(r.UNPACK_ALIGNMENT,x.unpackAlignment),t.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ee);const pe=x.isCompressedTexture||x.image[0].isCompressedTexture,Ae=x.image[0]&&x.image[0].isDataTexture,ge=[];for(let ne=0;ne<6;ne++)!pe&&!Ae?ge[ne]=p(x.image[ne],!0,i.maxCubemapSize):ge[ne]=Ae?x.image[ne].image:x.image[ne],ge[ne]=Dt(x,ge[ne]);const me=ge[0],fe=s.convert(x.format,x.colorSpace),Le=s.convert(x.type),Be=M(x.internalFormat,fe,Le,x.normalized,x.colorSpace),U=x.isVideoTexture!==!0,de=ue.__version===void 0||z===!0,te=K.dataReady;let _e=T(x,me);De(r.TEXTURE_CUBE_MAP,x);let xe;if(pe){U&&de&&t.texStorage2D(r.TEXTURE_CUBE_MAP,_e,Be,me.width,me.height);for(let ne=0;ne<6;ne++){xe=ge[ne].mipmaps;for(let le=0;le<xe.length;le++){const ie=xe[le];x.format!==bi?fe!==null?U?te&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,le,0,0,ie.width,ie.height,fe,ie.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,le,Be,ie.width,ie.height,0,ie.data):Ye("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,le,0,0,ie.width,ie.height,fe,Le,ie.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,le,Be,ie.width,ie.height,0,fe,Le,ie.data)}}}else{if(xe=x.mipmaps,U&&de){xe.length>0&&_e++;const ne=We(ge[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,_e,Be,ne.width,ne.height)}for(let ne=0;ne<6;ne++)if(Ae){U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,0,0,ge[ne].width,ge[ne].height,fe,Le,ge[ne].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,Be,ge[ne].width,ge[ne].height,0,fe,Le,ge[ne].data);for(let le=0;le<xe.length;le++){const ke=xe[le].image[ne].image;U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,le+1,0,0,ke.width,ke.height,fe,Le,ke.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,le+1,Be,ke.width,ke.height,0,fe,Le,ke.data)}}else{U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,0,0,fe,Le,ge[ne]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,0,Be,fe,Le,ge[ne]);for(let le=0;le<xe.length;le++){const ie=xe[le];U?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,le+1,0,0,fe,Le,ie.image[ne]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ne,le+1,Be,fe,Le,ie.image[ne])}}}m(x)&&b(r.TEXTURE_CUBE_MAP),ue.__version=K.version,x.onUpdate&&x.onUpdate(x)}R.__version=x.version}function Ee(R,x,O,z,K,ue){const oe=s.convert(O.format,O.colorSpace),Q=s.convert(O.type),ee=M(O.internalFormat,oe,Q,O.normalized,O.colorSpace),pe=n.get(x),Ae=n.get(O);if(Ae.__renderTarget=x,!pe.__hasExternalTextures){const ge=Math.max(1,x.width>>ue),me=Math.max(1,x.height>>ue);K===r.TEXTURE_3D||K===r.TEXTURE_2D_ARRAY?t.texImage3D(K,ue,ee,ge,me,x.depth,0,oe,Q,null):t.texImage2D(K,ue,ee,ge,me,0,oe,Q,null)}t.bindFramebuffer(r.FRAMEBUFFER,R),mt(x)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,z,K,Ae.__webglTexture,0,qe(x)):(K===r.TEXTURE_2D||K>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,z,K,Ae.__webglTexture,ue),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Qe(R,x,O){if(r.bindRenderbuffer(r.RENDERBUFFER,R),x.depthBuffer){const z=x.depthTexture,K=z&&z.isDepthTexture?z.type:null,ue=y(x.stencilBuffer,K),oe=x.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;mt(x)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,qe(x),ue,x.width,x.height):O?r.renderbufferStorageMultisample(r.RENDERBUFFER,qe(x),ue,x.width,x.height):r.renderbufferStorage(r.RENDERBUFFER,ue,x.width,x.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,oe,r.RENDERBUFFER,R)}else{const z=x.textures;for(let K=0;K<z.length;K++){const ue=z[K],oe=s.convert(ue.format,ue.colorSpace),Q=s.convert(ue.type),ee=M(ue.internalFormat,oe,Q,ue.normalized,ue.colorSpace);mt(x)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,qe(x),ee,x.width,x.height):O?r.renderbufferStorageMultisample(r.RENDERBUFFER,qe(x),ee,x.width,x.height):r.renderbufferStorage(r.RENDERBUFFER,ee,x.width,x.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function ye(R,x,O){const z=x.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,R),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const K=n.get(x.depthTexture);if(K.__renderTarget=x,(!K.__webglTexture||x.depthTexture.image.width!==x.width||x.depthTexture.image.height!==x.height)&&(x.depthTexture.image.width=x.width,x.depthTexture.image.height=x.height,x.depthTexture.needsUpdate=!0),z){if(K.__webglInit===void 0&&(K.__webglInit=!0,x.depthTexture.addEventListener("dispose",A)),K.__webglTexture===void 0){K.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,K.__webglTexture),De(r.TEXTURE_CUBE_MAP,x.depthTexture);const pe=s.convert(x.depthTexture.format),Ae=s.convert(x.depthTexture.type);let ge;x.depthTexture.format===ar?ge=r.DEPTH_COMPONENT24:x.depthTexture.format===jr&&(ge=r.DEPTH24_STENCIL8);for(let me=0;me<6;me++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ge,x.width,x.height,0,pe,Ae,null)}}else $(x.depthTexture,0);const ue=K.__webglTexture,oe=qe(x),Q=z?r.TEXTURE_CUBE_MAP_POSITIVE_X+O:r.TEXTURE_2D,ee=x.depthTexture.format===jr?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(x.depthTexture.format===ar)mt(x)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ee,Q,ue,0,oe):r.framebufferTexture2D(r.FRAMEBUFFER,ee,Q,ue,0);else if(x.depthTexture.format===jr)mt(x)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ee,Q,ue,0,oe):r.framebufferTexture2D(r.FRAMEBUFFER,ee,Q,ue,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Ge(R){const x=n.get(R),O=R.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==R.depthTexture){const z=R.depthTexture;if(x.__depthDisposeCallback&&x.__depthDisposeCallback(),z){const K=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,z.removeEventListener("dispose",K)};z.addEventListener("dispose",K),x.__depthDisposeCallback=K}x.__boundDepthTexture=z}if(R.depthTexture&&!x.__autoAllocateDepthBuffer)if(O)for(let z=0;z<6;z++)ye(x.__webglFramebuffer[z],R,z);else{const z=R.texture.mipmaps;z&&z.length>0?ye(x.__webglFramebuffer[0],R,0):ye(x.__webglFramebuffer,R,0)}else if(O){x.__webglDepthbuffer=[];for(let z=0;z<6;z++)if(t.bindFramebuffer(r.FRAMEBUFFER,x.__webglFramebuffer[z]),x.__webglDepthbuffer[z]===void 0)x.__webglDepthbuffer[z]=r.createRenderbuffer(),Qe(x.__webglDepthbuffer[z],R,!1);else{const K=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ue=x.__webglDepthbuffer[z];r.bindRenderbuffer(r.RENDERBUFFER,ue),r.framebufferRenderbuffer(r.FRAMEBUFFER,K,r.RENDERBUFFER,ue)}}else{const z=R.texture.mipmaps;if(z&&z.length>0?t.bindFramebuffer(r.FRAMEBUFFER,x.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,x.__webglFramebuffer),x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=r.createRenderbuffer(),Qe(x.__webglDepthbuffer,R,!1);else{const K=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ue=x.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,ue),r.framebufferRenderbuffer(r.FRAMEBUFFER,K,r.RENDERBUFFER,ue)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function Xe(R,x,O){const z=n.get(R);x!==void 0&&Ee(z.__webglFramebuffer,R,R.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),O!==void 0&&Ge(R)}function Te(R){const x=R.texture,O=n.get(R),z=n.get(x);R.addEventListener("dispose",v);const K=R.textures,ue=R.isWebGLCubeRenderTarget===!0,oe=K.length>1;if(oe||(z.__webglTexture===void 0&&(z.__webglTexture=r.createTexture()),z.__version=x.version,a.memory.textures++),ue){O.__webglFramebuffer=[];for(let Q=0;Q<6;Q++)if(x.mipmaps&&x.mipmaps.length>0){O.__webglFramebuffer[Q]=[];for(let ee=0;ee<x.mipmaps.length;ee++)O.__webglFramebuffer[Q][ee]=r.createFramebuffer()}else O.__webglFramebuffer[Q]=r.createFramebuffer()}else{if(x.mipmaps&&x.mipmaps.length>0){O.__webglFramebuffer=[];for(let Q=0;Q<x.mipmaps.length;Q++)O.__webglFramebuffer[Q]=r.createFramebuffer()}else O.__webglFramebuffer=r.createFramebuffer();if(oe)for(let Q=0,ee=K.length;Q<ee;Q++){const pe=n.get(K[Q]);pe.__webglTexture===void 0&&(pe.__webglTexture=r.createTexture(),a.memory.textures++)}if(R.samples>0&&mt(R)===!1){O.__webglMultisampledFramebuffer=r.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let Q=0;Q<K.length;Q++){const ee=K[Q];O.__webglColorRenderbuffer[Q]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,O.__webglColorRenderbuffer[Q]);const pe=s.convert(ee.format,ee.colorSpace),Ae=s.convert(ee.type),ge=M(ee.internalFormat,pe,Ae,ee.normalized,ee.colorSpace,R.isXRRenderTarget===!0),me=qe(R);r.renderbufferStorageMultisample(r.RENDERBUFFER,me,ge,R.width,R.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Q,r.RENDERBUFFER,O.__webglColorRenderbuffer[Q])}r.bindRenderbuffer(r.RENDERBUFFER,null),R.depthBuffer&&(O.__webglDepthRenderbuffer=r.createRenderbuffer(),Qe(O.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ue){t.bindTexture(r.TEXTURE_CUBE_MAP,z.__webglTexture),De(r.TEXTURE_CUBE_MAP,x);for(let Q=0;Q<6;Q++)if(x.mipmaps&&x.mipmaps.length>0)for(let ee=0;ee<x.mipmaps.length;ee++)Ee(O.__webglFramebuffer[Q][ee],R,x,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,ee);else Ee(O.__webglFramebuffer[Q],R,x,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0);m(x)&&b(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(oe){for(let Q=0,ee=K.length;Q<ee;Q++){const pe=K[Q],Ae=n.get(pe);let ge=r.TEXTURE_2D;(R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(ge=R.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(ge,Ae.__webglTexture),De(ge,pe),Ee(O.__webglFramebuffer,R,pe,r.COLOR_ATTACHMENT0+Q,ge,0),m(pe)&&b(ge)}t.unbindTexture()}else{let Q=r.TEXTURE_2D;if((R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(Q=R.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Q,z.__webglTexture),De(Q,x),x.mipmaps&&x.mipmaps.length>0)for(let ee=0;ee<x.mipmaps.length;ee++)Ee(O.__webglFramebuffer[ee],R,x,r.COLOR_ATTACHMENT0,Q,ee);else Ee(O.__webglFramebuffer,R,x,r.COLOR_ATTACHMENT0,Q,0);m(x)&&b(Q),t.unbindTexture()}R.depthBuffer&&Ge(R)}function V(R){const x=R.textures;for(let O=0,z=x.length;O<z;O++){const K=x[O];if(m(K)){const ue=w(R),oe=n.get(K).__webglTexture;t.bindTexture(ue,oe),b(ue),t.unbindTexture()}}}const Je=[],$e=[];function pt(R){if(R.samples>0){if(mt(R)===!1){const x=R.textures,O=R.width,z=R.height;let K=r.COLOR_BUFFER_BIT;const ue=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,oe=n.get(R),Q=x.length>1;if(Q)for(let pe=0;pe<x.length;pe++)t.bindFramebuffer(r.FRAMEBUFFER,oe.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+pe,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,oe.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+pe,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,oe.__webglMultisampledFramebuffer);const ee=R.texture.mipmaps;ee&&ee.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,oe.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,oe.__webglFramebuffer);for(let pe=0;pe<x.length;pe++){if(R.resolveDepthBuffer&&(R.depthBuffer&&(K|=r.DEPTH_BUFFER_BIT),R.stencilBuffer&&R.resolveStencilBuffer&&(K|=r.STENCIL_BUFFER_BIT)),Q){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,oe.__webglColorRenderbuffer[pe]);const Ae=n.get(x[pe]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Ae,0)}r.blitFramebuffer(0,0,O,z,0,0,O,z,K,r.NEAREST),l===!0&&(Je.length=0,$e.length=0,Je.push(r.COLOR_ATTACHMENT0+pe),R.depthBuffer&&R.resolveDepthBuffer===!1&&(Je.push(ue),$e.push(ue),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,$e)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Je))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Q)for(let pe=0;pe<x.length;pe++){t.bindFramebuffer(r.FRAMEBUFFER,oe.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+pe,r.RENDERBUFFER,oe.__webglColorRenderbuffer[pe]);const Ae=n.get(x[pe]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,oe.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+pe,r.TEXTURE_2D,Ae,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,oe.__webglMultisampledFramebuffer)}else if(R.depthBuffer&&R.resolveDepthBuffer===!1&&l){const x=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[x])}}}function qe(R){return Math.min(i.maxSamples,R.samples)}function mt(R){const x=n.get(R);return R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function F(R){const x=a.render.frame;u.get(R)!==x&&(u.set(R,x),R.update())}function Dt(R,x){const O=R.colorSpace,z=R.format,K=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||O!==Ml&&O!==xr&&(ct.getTransfer(O)===vt?(z!==bi||K!==hi)&&Ye("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ht("WebGLTextures: Unsupported texture color space:",O)),x}function We(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=G,this.resetTextureUnits=q,this.getTextureUnits=W,this.setTextureUnits=B,this.setTexture2D=$,this.setTexture2DArray=j,this.setTexture3D=D,this.setTextureCube=se,this.rebindTextures=Xe,this.setupRenderTarget=Te,this.updateRenderTargetMipmap=V,this.updateMultisampleRenderTarget=pt,this.setupDepthRenderbuffer=Ge,this.setupFrameBufferTexture=Ee,this.useMultisampledRTT=mt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function oy(r,e){function t(n,i=xr){let s;const a=ct.getTransfer(i);if(n===hi)return r.UNSIGNED_BYTE;if(n===vf)return r.UNSIGNED_SHORT_4_4_4_4;if(n===Mf)return r.UNSIGNED_SHORT_5_5_5_1;if(n===fm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===dm)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===cm)return r.BYTE;if(n===um)return r.SHORT;if(n===Ja)return r.UNSIGNED_SHORT;if(n===xf)return r.INT;if(n===Gi)return r.UNSIGNED_INT;if(n===Ui)return r.FLOAT;if(n===sr)return r.HALF_FLOAT;if(n===hm)return r.ALPHA;if(n===pm)return r.RGB;if(n===bi)return r.RGBA;if(n===ar)return r.DEPTH_COMPONENT;if(n===jr)return r.DEPTH_STENCIL;if(n===mm)return r.RED;if(n===Sf)return r.RED_INTEGER;if(n===cs)return r.RG;if(n===bf)return r.RG_INTEGER;if(n===yf)return r.RGBA_INTEGER;if(n===nl||n===il||n===rl||n===sl)if(a===vt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===nl)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===il)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===rl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===sl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===nl)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===il)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===rl)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===sl)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===uu||n===fu||n===du||n===hu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===uu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===fu)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===du)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===hu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===pu||n===mu||n===gu||n===_u||n===xu||n===xl||n===vu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===pu||n===mu)return a===vt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===gu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===_u)return s.COMPRESSED_R11_EAC;if(n===xu)return s.COMPRESSED_SIGNED_R11_EAC;if(n===xl)return s.COMPRESSED_RG11_EAC;if(n===vu)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Mu||n===Su||n===bu||n===yu||n===Eu||n===Tu||n===wu||n===Au||n===Ru||n===Cu||n===Pu||n===Du||n===Lu||n===Nu)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Mu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Su)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===bu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===yu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Eu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Tu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===wu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Au)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ru)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Cu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Pu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Du)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Lu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Nu)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Iu||n===Uu||n===Fu)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Iu)return a===vt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Uu)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Fu)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ou||n===Bu||n===vl||n===ku)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ou)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Bu)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===vl)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ku)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Qa?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const ly=`
4085
4085
  void main() {
4086
4086
 
4087
4087
  gl_Position = vec4( position, 1.0 );
@@ -4105,7 +4105,7 @@ void main() {
4105
4105
 
4106
4106
  }
4107
4107
 
4108
- }`;class uy{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new wm(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new yi({vertexShader:ly,fragmentShader:cy,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new or(new Pl(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class fy extends fs{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,f=null,d=null,g=null;const _=typeof XRWebGLBinding<"u",p=new uy,m={},b=t.getContextAttributes();let A=null,M=null;const y=[],T=[],w=new mt;let v=null;const E=new di;E.viewport=new Bt;const C=new di;C.viewport=new Bt;const L=[E,C],N=new Mx;let Y=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let ae=y[J];return ae===void 0&&(ae=new nc,y[J]=ae),ae.getTargetRaySpace()},this.getControllerGrip=function(J){let ae=y[J];return ae===void 0&&(ae=new nc,y[J]=ae),ae.getGripSpace()},this.getHand=function(J){let ae=y[J];return ae===void 0&&(ae=new nc,y[J]=ae),ae.getHandSpace()};function O(J){const ae=T.indexOf(J.inputSource);if(ae===-1)return;const se=y[ae];se!==void 0&&(se.update(J.inputSource,J.frame,c||a),se.dispatchEvent({type:J.type,data:J.inputSource}))}function z(){i.removeEventListener("select",O),i.removeEventListener("selectstart",O),i.removeEventListener("selectend",O),i.removeEventListener("squeeze",O),i.removeEventListener("squeezestart",O),i.removeEventListener("squeezeend",O),i.removeEventListener("end",z),i.removeEventListener("inputsourceschange",I);for(let J=0;J<y.length;J++){const ae=T[J];ae!==null&&(T[J]=null,y[J].disconnect(ae))}Y=null,H=null,p.reset();for(const J in m)delete m[J];e.setRenderTarget(A),d=null,f=null,h=null,i=null,M=null,Pe.stop(),n.isPresenting=!1,e.setPixelRatio(v),e.setSize(w.width,w.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){s=J,n.isPresenting===!0&&Ye("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){o=J,n.isPresenting===!0&&Ye("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(J){c=J},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return h===null&&_&&(h=new XRWebGLBinding(i,t)),h},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(J){if(i=J,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",O),i.addEventListener("selectstart",O),i.addEventListener("selectend",O),i.addEventListener("squeeze",O),i.addEventListener("squeezestart",O),i.addEventListener("squeezeend",O),i.addEventListener("end",z),i.addEventListener("inputsourceschange",I),b.xrCompatible!==!0&&await t.makeXRCompatible(),v=e.getPixelRatio(),e.getSize(w),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let se=null,we=null,Oe=null;b.depth&&(Oe=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,se=b.stencil?Zr:ar,we=b.stencil?Ja:Gi);const Ee={colorFormat:t.RGBA8,depthFormat:Oe,scaleFactor:s};h=this.getBinding(),f=h.createProjectionLayer(Ee),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),M=new ki(f.textureWidth,f.textureHeight,{format:bi,type:hi,depthTexture:new ra(f.textureWidth,f.textureHeight,we,void 0,void 0,void 0,void 0,void 0,void 0,se),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const se={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,se),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new ki(d.framebufferWidth,d.framebufferHeight,{format:bi,type:hi,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Pe.setContext(i),Pe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};function I(J){for(let ae=0;ae<J.removed.length;ae++){const se=J.removed[ae],we=T.indexOf(se);we>=0&&(T[we]=null,y[we].disconnect(se))}for(let ae=0;ae<J.added.length;ae++){const se=J.added[ae];let we=T.indexOf(se);if(we===-1){for(let Ee=0;Ee<y.length;Ee++)if(Ee>=T.length){T.push(se),we=Ee;break}else if(T[Ee]===null){T[Ee]=se,we=Ee;break}if(we===-1)break}const Oe=y[we];Oe&&Oe.connect(se)}}const W=new q,Z=new q;function D(J,ae,se){W.setFromMatrixPosition(ae.matrixWorld),Z.setFromMatrixPosition(se.matrixWorld);const we=W.distanceTo(Z),Oe=ae.projectionMatrix.elements,Ee=se.projectionMatrix.elements,Je=Oe[14]/(Oe[10]-1),be=Oe[14]/(Oe[10]+1),We=(Oe[9]+1)/Oe[5],Te=(Oe[9]-1)/Oe[5],Ne=(Oe[8]-1)/Oe[0],$=(Ee[8]+1)/Ee[0],je=Je*Ne,ft=Je*$,_t=we/(-Ne+$),qe=_t*-Ne;if(ae.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(qe),J.translateZ(_t),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),Oe[10]===-1)J.projectionMatrix.copy(ae.projectionMatrix),J.projectionMatrixInverse.copy(ae.projectionMatrixInverse);else{const at=Je+_t,F=be+_t,Mt=je-qe,Xe=ft+(we-qe),R=We*be/F*at,x=Te*be/F*at;J.projectionMatrix.makePerspective(Mt,Xe,R,x,at,F),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function re(J,ae){ae===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(ae.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(i===null)return;let ae=J.near,se=J.far;p.texture!==null&&(p.depthNear>0&&(ae=p.depthNear),p.depthFar>0&&(se=p.depthFar)),N.near=C.near=E.near=ae,N.far=C.far=E.far=se,(Y!==N.near||H!==N.far)&&(i.updateRenderState({depthNear:N.near,depthFar:N.far}),Y=N.near,H=N.far),N.layers.mask=J.layers.mask|6,E.layers.mask=N.layers.mask&-5,C.layers.mask=N.layers.mask&-3;const we=J.parent,Oe=N.cameras;re(N,we);for(let Ee=0;Ee<Oe.length;Ee++)re(Oe[Ee],we);Oe.length===2?D(N,E,C):N.projectionMatrix.copy(E.projectionMatrix),he(J,N,we)};function he(J,ae,se){se===null?J.matrix.copy(ae.matrixWorld):(J.matrix.copy(se.matrixWorld),J.matrix.invert(),J.matrix.multiply(ae.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(ae.projectionMatrix),J.projectionMatrixInverse.copy(ae.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=Qa*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(f===null&&d===null))return l},this.setFoveation=function(J){l=J,f!==null&&(f.fixedFoveation=J),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=J)},this.hasDepthSensing=function(){return p.texture!==null},this.getDepthSensingMesh=function(){return p.getMesh(N)},this.getCameraTexture=function(J){return m[J]};let He=null;function Be(J,ae){if(u=ae.getViewerPose(c||a),g=ae,u!==null){const se=u.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let we=!1;se.length!==N.cameras.length&&(N.cameras.length=0,we=!0);for(let be=0;be<se.length;be++){const We=se[be];let Te=null;if(d!==null)Te=d.getViewport(We);else{const $=h.getViewSubImage(f,We);Te=$.viewport,be===0&&(e.setRenderTargetTextures(M,$.colorTexture,$.depthStencilTexture),e.setRenderTarget(M))}let Ne=L[be];Ne===void 0&&(Ne=new di,Ne.layers.enable(be),Ne.viewport=new Bt,L[be]=Ne),Ne.matrix.fromArray(We.transform.matrix),Ne.matrix.decompose(Ne.position,Ne.quaternion,Ne.scale),Ne.projectionMatrix.fromArray(We.projectionMatrix),Ne.projectionMatrixInverse.copy(Ne.projectionMatrix).invert(),Ne.viewport.set(Te.x,Te.y,Te.width,Te.height),be===0&&(N.matrix.copy(Ne.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),we===!0&&N.cameras.push(Ne)}const Oe=i.enabledFeatures;if(Oe&&Oe.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){h=n.getBinding();const be=h.getDepthInformation(se[0]);be&&be.isValid&&be.texture&&p.init(be,i.renderState)}if(Oe&&Oe.includes("camera-access")&&_){e.state.unbindTexture(),h=n.getBinding();for(let be=0;be<se.length;be++){const We=se[be].camera;if(We){let Te=m[We];Te||(Te=new wm,m[We]=Te);const Ne=h.getCameraImage(We);Te.sourceTexture=Ne}}}}for(let se=0;se<y.length;se++){const we=T[se],Oe=y[se];we!==null&&Oe!==void 0&&Oe.update(we,ae,c||a)}He&&He(J,ae),ae.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ae}),g=null}const Pe=new Pm;Pe.setAnimationLoop(Be),this.setAnimationLoop=function(J){He=J},this.dispose=function(){}}}const dy=new Xt,Om=new Ke;Om.set(-1,0,0,0,1,0,0,0,1);function hy(r,e){function t(p,m){p.matrixAutoUpdate===!0&&p.updateMatrix(),m.value.copy(p.matrix)}function n(p,m){m.color.getRGB(p.fogColor.value,Am(r)),m.isFog?(p.fogNear.value=m.near,p.fogFar.value=m.far):m.isFogExp2&&(p.fogDensity.value=m.density)}function i(p,m,b,A,M){m.isNodeMaterial?m.uniformsNeedUpdate=!1:m.isMeshBasicMaterial?s(p,m):m.isMeshLambertMaterial?(s(p,m),m.envMap&&(p.envMapIntensity.value=m.envMapIntensity)):m.isMeshToonMaterial?(s(p,m),h(p,m)):m.isMeshPhongMaterial?(s(p,m),u(p,m),m.envMap&&(p.envMapIntensity.value=m.envMapIntensity)):m.isMeshStandardMaterial?(s(p,m),f(p,m),m.isMeshPhysicalMaterial&&d(p,m,M)):m.isMeshMatcapMaterial?(s(p,m),g(p,m)):m.isMeshDepthMaterial?s(p,m):m.isMeshDistanceMaterial?(s(p,m),_(p,m)):m.isMeshNormalMaterial?s(p,m):m.isLineBasicMaterial?(a(p,m),m.isLineDashedMaterial&&o(p,m)):m.isPointsMaterial?l(p,m,b,A):m.isSpriteMaterial?c(p,m):m.isShadowMaterial?(p.color.value.copy(m.color),p.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(p,m){p.opacity.value=m.opacity,m.color&&p.diffuse.value.copy(m.color),m.emissive&&p.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(p.map.value=m.map,t(m.map,p.mapTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,t(m.alphaMap,p.alphaMapTransform)),m.bumpMap&&(p.bumpMap.value=m.bumpMap,t(m.bumpMap,p.bumpMapTransform),p.bumpScale.value=m.bumpScale,m.side===Vn&&(p.bumpScale.value*=-1)),m.normalMap&&(p.normalMap.value=m.normalMap,t(m.normalMap,p.normalMapTransform),p.normalScale.value.copy(m.normalScale),m.side===Vn&&p.normalScale.value.negate()),m.displacementMap&&(p.displacementMap.value=m.displacementMap,t(m.displacementMap,p.displacementMapTransform),p.displacementScale.value=m.displacementScale,p.displacementBias.value=m.displacementBias),m.emissiveMap&&(p.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,p.emissiveMapTransform)),m.specularMap&&(p.specularMap.value=m.specularMap,t(m.specularMap,p.specularMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest);const b=e.get(m),A=b.envMap,M=b.envMapRotation;A&&(p.envMap.value=A,p.envMapRotation.value.setFromMatrix4(dy.makeRotationFromEuler(M)).transpose(),A.isCubeTexture&&A.isRenderTargetTexture===!1&&p.envMapRotation.value.premultiply(Om),p.reflectivity.value=m.reflectivity,p.ior.value=m.ior,p.refractionRatio.value=m.refractionRatio),m.lightMap&&(p.lightMap.value=m.lightMap,p.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,p.lightMapTransform)),m.aoMap&&(p.aoMap.value=m.aoMap,p.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,p.aoMapTransform))}function a(p,m){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,m.map&&(p.map.value=m.map,t(m.map,p.mapTransform))}function o(p,m){p.dashSize.value=m.dashSize,p.totalSize.value=m.dashSize+m.gapSize,p.scale.value=m.scale}function l(p,m,b,A){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.size.value=m.size*b,p.scale.value=A*.5,m.map&&(p.map.value=m.map,t(m.map,p.uvTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,t(m.alphaMap,p.alphaMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest)}function c(p,m){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.rotation.value=m.rotation,m.map&&(p.map.value=m.map,t(m.map,p.mapTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,t(m.alphaMap,p.alphaMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest)}function u(p,m){p.specular.value.copy(m.specular),p.shininess.value=Math.max(m.shininess,1e-4)}function h(p,m){m.gradientMap&&(p.gradientMap.value=m.gradientMap)}function f(p,m){p.metalness.value=m.metalness,m.metalnessMap&&(p.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,p.metalnessMapTransform)),p.roughness.value=m.roughness,m.roughnessMap&&(p.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,p.roughnessMapTransform)),m.envMap&&(p.envMapIntensity.value=m.envMapIntensity)}function d(p,m,b){p.ior.value=m.ior,m.sheen>0&&(p.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),p.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(p.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,p.sheenColorMapTransform)),m.sheenRoughnessMap&&(p.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,p.sheenRoughnessMapTransform))),m.clearcoat>0&&(p.clearcoat.value=m.clearcoat,p.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(p.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,p.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(p.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Vn&&p.clearcoatNormalScale.value.negate())),m.dispersion>0&&(p.dispersion.value=m.dispersion),m.iridescence>0&&(p.iridescence.value=m.iridescence,p.iridescenceIOR.value=m.iridescenceIOR,p.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(p.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,p.iridescenceMapTransform)),m.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),m.transmission>0&&(p.transmission.value=m.transmission,p.transmissionSamplerMap.value=b.texture,p.transmissionSamplerSize.value.set(b.width,b.height),m.transmissionMap&&(p.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,p.transmissionMapTransform)),p.thickness.value=m.thickness,m.thicknessMap&&(p.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=m.attenuationDistance,p.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(p.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(p.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=m.specularIntensity,p.specularColor.value.copy(m.specularColor),m.specularColorMap&&(p.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,p.specularColorMapTransform)),m.specularIntensityMap&&(p.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,p.specularIntensityMapTransform))}function g(p,m){m.matcap&&(p.matcap.value=m.matcap)}function _(p,m){const b=e.get(m).light;p.referencePosition.value.setFromMatrixPosition(b.matrixWorld),p.nearDistance.value=b.shadow.camera.near,p.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function py(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,y){const T=y.program;n.uniformBlockBinding(M,T)}function c(M,y){let T=i[M.id];T===void 0&&(p(M),T=u(M),i[M.id]=T,M.addEventListener("dispose",b));const w=y.program;n.updateUBOMapping(M,w);const v=e.render.frame;s[M.id]!==v&&(f(M),s[M.id]=v)}function u(M){const y=h();M.__bindingPointIndex=y;const T=r.createBuffer(),w=M.__size,v=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,T),r.bufferData(r.UNIFORM_BUFFER,w,v),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,T),T}function h(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return pt("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(M){const y=i[M.id],T=M.uniforms,w=M.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let v=0,E=T.length;v<E;v++){const C=T[v];if(Array.isArray(C))for(let L=0,N=C.length;L<N;L++)d(C[L],v,L,w);else d(C,v,0,w)}r.bindBuffer(r.UNIFORM_BUFFER,null)}function d(M,y,T,w){if(_(M,y,T,w)===!0){const v=M.__offset,E=M.value;if(Array.isArray(E)){let C=0;for(let L=0;L<E.length;L++){const N=E[L],Y=m(N);g(N,M.__data,C),typeof N!="number"&&typeof N!="boolean"&&!N.isMatrix3&&!ArrayBuffer.isView(N)&&(C+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}}else g(E,M.__data,0);r.bufferSubData(r.UNIFORM_BUFFER,v,M.__data)}}function g(M,y,T){typeof M=="number"||typeof M=="boolean"?y[0]=M:M.isMatrix3?(y[0]=M.elements[0],y[1]=M.elements[1],y[2]=M.elements[2],y[3]=0,y[4]=M.elements[3],y[5]=M.elements[4],y[6]=M.elements[5],y[7]=0,y[8]=M.elements[6],y[9]=M.elements[7],y[10]=M.elements[8],y[11]=0):ArrayBuffer.isView(M)?y.set(new M.constructor(M.buffer,M.byteOffset,y.length)):M.toArray(y,T)}function _(M,y,T,w){const v=M.value,E=y+"_"+T;if(w[E]===void 0)return typeof v=="number"||typeof v=="boolean"?w[E]=v:ArrayBuffer.isView(v)?w[E]=v.slice():w[E]=v.clone(),!0;{const C=w[E];if(typeof v=="number"||typeof v=="boolean"){if(C!==v)return w[E]=v,!0}else{if(ArrayBuffer.isView(v))return!0;if(C.equals(v)===!1)return C.copy(v),!0}}return!1}function p(M){const y=M.uniforms;let T=0;const w=16;for(let E=0,C=y.length;E<C;E++){const L=Array.isArray(y[E])?y[E]:[y[E]];for(let N=0,Y=L.length;N<Y;N++){const H=L[N],O=Array.isArray(H.value)?H.value:[H.value];for(let z=0,I=O.length;z<I;z++){const W=O[z],Z=m(W),D=T%w,re=D%Z.boundary,he=D+re;T+=re,he!==0&&w-he<Z.storage&&(T+=w-he),H.__data=new Float32Array(Z.storage/Float32Array.BYTES_PER_ELEMENT),H.__offset=T,T+=Z.storage}}}const v=T%w;return v>0&&(T+=w-v),M.__size=T,M.__cache={},this}function m(M){const y={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(y.boundary=4,y.storage=4):M.isVector2?(y.boundary=8,y.storage=8):M.isVector3||M.isColor?(y.boundary=16,y.storage=12):M.isVector4?(y.boundary=16,y.storage=16):M.isMatrix3?(y.boundary=48,y.storage=48):M.isMatrix4?(y.boundary=64,y.storage=64):M.isTexture?Ye("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(y.boundary=16,y.storage=M.byteLength):Ye("WebGLRenderer: Unsupported uniform value type.",M),y}function b(M){const y=M.target;y.removeEventListener("dispose",b);const T=a.indexOf(y.__bindingPointIndex);a.splice(T,1),r.deleteBuffer(i[y.id]),delete i[y.id],delete s[y.id]}function A(){for(const M in i)r.deleteBuffer(i[M]);a=[],i={},s={}}return{bind:l,update:c,dispose:A}}const my=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Ri=null;function gy(){return Ri===null&&(Ri=new sx(my,16,16,ls,sr),Ri.name="DFG_LUT",Ri.minFilter=yn,Ri.magFilter=yn,Ri.wrapS=Ji,Ri.wrapT=Ji,Ri.generateMipmaps=!1,Ri.needsUpdate=!0),Ri}class _y{constructor(e={}){const{canvas:t=S0(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:f=!1,outputBufferType:d=hi}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;const _=d,p=new Set([bf,Sf,Mf]),m=new Set([hi,Gi,ja,Ja,xf,vf]),b=new Uint32Array(4),A=new Int32Array(4),M=new q;let y=null,T=null;const w=[],v=[];let E=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Bi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const C=this;let L=!1,N=null,Y=null,H=null,O=null;this._outputColorSpace=ci;let z=0,I=0,W=null,Z=-1,D=null;const re=new Bt,he=new Bt;let He=null;const Be=new dt(0);let Pe=0,J=t.width,ae=t.height,se=1,we=null,Oe=null;const Ee=new Bt(0,0,J,ae),Je=new Bt(0,0,J,ae);let be=!1;const We=new Em;let Te=!1,Ne=!1;const $=new Xt,je=new q,ft=new Bt,_t={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let qe=!1;function at(){return W===null?se:1}let F=n;function Mt(S,k){return t.getContext(S,k)}try{const S={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${gf}`),t.addEventListener("webglcontextlost",ze,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",Ge,!1),F===null){const k="webgl2";if(F=Mt(k,S),F===null)throw Mt(k)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(S){throw pt("WebGLRenderer: "+S.message),S}let Xe,R,x,B,V,j,fe,ce,Q,ee,me,Ce,ge,pe,ue,Ie,ke,U,de,te,_e,xe,ne;function oe(){Xe=new gS(F),Xe.init(),_e=new oy(F,Xe),R=new lS(F,Xe,e,_e),x=new sy(F,Xe),R.reversedDepthBuffer&&f&&x.buffers.depth.setReversed(!0),Y=F.createFramebuffer(),H=F.createFramebuffer(),O=F.createFramebuffer(),B=new vS(F),V=new Xb,j=new ay(F,Xe,x,V,R,_e,B),fe=new mS(C),ce=new yx(F),xe=new aS(F,ce),Q=new _S(F,ce,B,xe),ee=new SS(F,Q,ce,xe,B),U=new MS(F,R,j),ue=new cS(V),me=new Wb(C,fe,Xe,R,xe,ue),Ce=new hy(C,V),ge=new qb,pe=new Qb(Xe),ke=new sS(C,fe,x,ee,g,l),Ie=new ry(C,ee,R),ne=new py(F,B,R,x),de=new oS(F,Xe,B),te=new xS(F,Xe,B),B.programs=me.programs,C.capabilities=R,C.extensions=Xe,C.properties=V,C.renderLists=ge,C.shadowMap=Ie,C.state=x,C.info=B}oe(),_!==hi&&(E=new yS(_,t.width,t.height,o,i,s));const ie=new fy(C,F);this.xr=ie,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){const S=Xe.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=Xe.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return se},this.setPixelRatio=function(S){S!==void 0&&(se=S,this.setSize(J,ae,!1))},this.getSize=function(S){return S.set(J,ae)},this.setSize=function(S,k,K=!0){if(ie.isPresenting){Ye("WebGLRenderer: Can't change size while VR device is presenting.");return}J=S,ae=k,t.width=Math.floor(S*se),t.height=Math.floor(k*se),K===!0&&(t.style.width=S+"px",t.style.height=k+"px"),E!==null&&E.setSize(t.width,t.height),this.setViewport(0,0,S,k)},this.getDrawingBufferSize=function(S){return S.set(J*se,ae*se).floor()},this.setDrawingBufferSize=function(S,k,K){J=S,ae=k,se=K,t.width=Math.floor(S*K),t.height=Math.floor(k*K),this.setViewport(0,0,S,k)},this.setEffects=function(S){if(_===hi){pt("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(S){for(let k=0;k<S.length;k++)if(S[k].isOutputPass===!0){Ye("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}E.setEffects(S||[])},this.getCurrentViewport=function(S){return S.copy(re)},this.getViewport=function(S){return S.copy(Ee)},this.setViewport=function(S,k,K,G){S.isVector4?Ee.set(S.x,S.y,S.z,S.w):Ee.set(S,k,K,G),x.viewport(re.copy(Ee).multiplyScalar(se).round())},this.getScissor=function(S){return S.copy(Je)},this.setScissor=function(S,k,K,G){S.isVector4?Je.set(S.x,S.y,S.z,S.w):Je.set(S,k,K,G),x.scissor(he.copy(Je).multiplyScalar(se).round())},this.getScissorTest=function(){return be},this.setScissorTest=function(S){x.setScissorTest(be=S)},this.setOpaqueSort=function(S){we=S},this.setTransparentSort=function(S){Oe=S},this.getClearColor=function(S){return S.copy(ke.getClearColor())},this.setClearColor=function(){ke.setClearColor(...arguments)},this.getClearAlpha=function(){return ke.getClearAlpha()},this.setClearAlpha=function(){ke.setClearAlpha(...arguments)},this.clear=function(S=!0,k=!0,K=!0){let G=0;if(S){let X=!1;if(W!==null){const ve=W.texture.format;X=p.has(ve)}if(X){const ve=W.texture.type,Me=m.has(ve),ye=ke.getClearColor(),Le=ke.getClearAlpha(),Ue=ye.r,Ze=ye.g,et=ye.b;Me?(b[0]=Ue,b[1]=Ze,b[2]=et,b[3]=Le,F.clearBufferuiv(F.COLOR,0,b)):(A[0]=Ue,A[1]=Ze,A[2]=et,A[3]=Le,F.clearBufferiv(F.COLOR,0,A))}else G|=F.COLOR_BUFFER_BIT}k&&(G|=F.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),K&&(G|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),G!==0&&F.clear(G)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(S){S.setRenderer(this),N=S},this.dispose=function(){t.removeEventListener("webglcontextlost",ze,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",Ge,!1),ke.dispose(),ge.dispose(),pe.dispose(),V.dispose(),fe.dispose(),ee.dispose(),xe.dispose(),ne.dispose(),me.dispose(),ie.dispose(),ie.removeEventListener("sessionstart",Pt),ie.removeEventListener("sessionend",bt),lt.stop()};function ze(S){S.preventDefault(),Pd("WebGLRenderer: Context Lost."),L=!0}function le(){Pd("WebGLRenderer: Context Restored."),L=!1;const S=B.autoReset,k=Ie.enabled,K=Ie.autoUpdate,G=Ie.needsUpdate,X=Ie.type;oe(),B.autoReset=S,Ie.enabled=k,Ie.autoUpdate=K,Ie.needsUpdate=G,Ie.type=X}function Ge(S){pt("WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function De(S){const k=S.target;k.removeEventListener("dispose",De),$e(k)}function $e(S){Yt(S),V.remove(S)}function Yt(S){const k=V.get(S).programs;k!==void 0&&(k.forEach(function(K){me.releaseProgram(K)}),S.isShaderMaterial&&me.releaseShaderCache(S))}this.renderBufferDirect=function(S,k,K,G,X,ve){k===null&&(k=_t);const Me=X.isMesh&&X.matrixWorld.determinantAffine()<0,ye=rn(S,k,K,G,X);x.setMaterial(G,Me);let Le=K.index,Ue=1;if(G.wireframe===!0){if(Le=Q.getWireframeAttribute(K),Le===void 0)return;Ue=2}const Ze=K.drawRange,et=K.attributes.position;let Fe=Ze.start*Ue,St=(Ze.start+Ze.count)*Ue;ve!==null&&(Fe=Math.max(Fe,ve.start*Ue),St=Math.min(St,(ve.start+ve.count)*Ue)),Le!==null?(Fe=Math.max(Fe,0),St=Math.min(St,Le.count)):et!=null&&(Fe=Math.max(Fe,0),St=Math.min(St,et.count));const Gt=St-Fe;if(Gt<0||Gt===1/0)return;xe.setup(X,G,ye,K,Le);let Ot,yt=de;if(Le!==null&&(Ot=ce.get(Le),yt=te,yt.setIndex(Ot)),X.isMesh)G.wireframe===!0?(x.setLineWidth(G.wireframeLinewidth*at()),yt.setMode(F.LINES)):yt.setMode(F.TRIANGLES);else if(X.isLine){let mn=G.linewidth;mn===void 0&&(mn=1),x.setLineWidth(mn*at()),X.isLineSegments?yt.setMode(F.LINES):X.isLineLoop?yt.setMode(F.LINE_LOOP):yt.setMode(F.LINE_STRIP)}else X.isPoints?yt.setMode(F.POINTS):X.isSprite&&yt.setMode(F.TRIANGLES);if(X.isBatchedMesh)if(Xe.get("WEBGL_multi_draw"))yt.renderMultiDraw(X._multiDrawStarts,X._multiDrawCounts,X._multiDrawCount);else{const mn=X._multiDrawStarts,Ae=X._multiDrawCounts,Xn=X._multiDrawCount,ht=Le?ce.get(Le).bytesPerElement:1,ai=V.get(G).currentProgram.getUniforms();for(let wi=0;wi<Xn;wi++)ai.setValue(F,"_gl_DrawID",wi),yt.render(mn[wi]/ht,Ae[wi])}else if(X.isInstancedMesh)yt.renderInstances(Fe,Gt,X.count);else if(K.isInstancedBufferGeometry){const mn=K._maxInstanceCount!==void 0?K._maxInstanceCount:1/0,Ae=Math.min(K.instanceCount,mn);yt.renderInstances(Fe,Gt,Ae)}else yt.render(Fe,Gt)};function nt(S,k,K){S.transparent===!0&&S.side===Zi&&S.forceSinglePass===!1?(S.side=Vn,S.needsUpdate=!0,Ft(S,k,K),S.side=Nr,S.needsUpdate=!0,Ft(S,k,K),S.side=Zi):Ft(S,k,K)}this.compile=function(S,k,K=null){K===null&&(K=S),T=pe.get(K),T.init(k),v.push(T),K.traverseVisible(function(X){X.isLight&&X.layers.test(k.layers)&&(T.pushLight(X),X.castShadow&&T.pushShadow(X))}),S!==K&&S.traverseVisible(function(X){X.isLight&&X.layers.test(k.layers)&&(T.pushLight(X),X.castShadow&&T.pushShadow(X))}),T.setupLights();const G=new Set;return S.traverse(function(X){if(!(X.isMesh||X.isPoints||X.isLine||X.isSprite))return;const ve=X.material;if(ve)if(Array.isArray(ve))for(let Me=0;Me<ve.length;Me++){const ye=ve[Me];nt(ye,K,X),G.add(ye)}else nt(ve,K,X),G.add(ve)}),T=v.pop(),G},this.compileAsync=function(S,k,K=null){const G=this.compile(S,k,K);return new Promise(X=>{function ve(){if(G.forEach(function(Me){V.get(Me).currentProgram.isReady()&&G.delete(Me)}),G.size===0){X(S);return}setTimeout(ve,10)}Xe.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Ct=null;function nn(S){Ct&&Ct(S)}function Pt(){lt.stop()}function bt(){lt.start()}const lt=new Pm;lt.setAnimationLoop(nn),typeof self<"u"&&lt.setContext(self),this.setAnimationLoop=function(S){Ct=S,ie.setAnimationLoop(S),S===null?lt.stop():lt.start()},ie.addEventListener("sessionstart",Pt),ie.addEventListener("sessionend",bt),this.render=function(S,k){if(k!==void 0&&k.isCamera!==!0){pt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;N!==null&&N.renderStart(S,k);const K=ie.enabled===!0&&ie.isPresenting===!0,G=E!==null&&(W===null||K)&&E.begin(C,W);if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),ie.enabled===!0&&ie.isPresenting===!0&&(E===null||E.isCompositing()===!1)&&(ie.cameraAutoUpdate===!0&&ie.updateCamera(k),k=ie.getCamera()),S.isScene===!0&&S.onBeforeRender(C,S,k,W),T=pe.get(S,v.length),T.init(k),T.state.textureUnits=j.getTextureUnits(),v.push(T),$.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),We.setFromProjectionMatrix($,Fi,k.reversedDepth),Ne=this.localClippingEnabled,Te=ue.init(this.clippingPlanes,Ne),y=ge.get(S,w.length),y.init(),w.push(y),ie.enabled===!0&&ie.isPresenting===!0){const Me=C.xr.getDepthSensingMesh();Me!==null&&Tn(Me,k,-1/0,C.sortObjects)}Tn(S,k,0,C.sortObjects),y.finish(),C.sortObjects===!0&&y.sort(we,Oe,k.reversedDepth),qe=ie.enabled===!1||ie.isPresenting===!1||ie.hasDepthSensing()===!1,qe&&ke.addToRenderList(y,S),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Te===!0&&ue.beginShadows();const X=T.state.shadowsArray;if(Ie.render(X,S,k),Te===!0&&ue.endShadows(),(G&&E.hasRenderPass())===!1){const Me=y.opaque,ye=y.transmissive;if(T.setupLights(),k.isArrayCamera){const Le=k.cameras;if(ye.length>0)for(let Ue=0,Ze=Le.length;Ue<Ze;Ue++){const et=Le[Ue];pn(Me,ye,S,et)}qe&&ke.render(S);for(let Ue=0,Ze=Le.length;Ue<Ze;Ue++){const et=Le[Ue];At(y,S,et,et.viewport)}}else ye.length>0&&pn(Me,ye,S,k),qe&&ke.render(S),At(y,S,k)}W!==null&&I===0&&(j.updateMultisampleRenderTarget(W),j.updateRenderTargetMipmap(W)),G&&E.end(C),S.isScene===!0&&S.onAfterRender(C,S,k),xe.resetDefaultState(),Z=-1,D=null,v.pop(),v.length>0?(T=v[v.length-1],j.setTextureUnits(T.state.textureUnits),Te===!0&&ue.setGlobalState(C.clippingPlanes,T.state.camera)):T=null,w.pop(),w.length>0?y=w[w.length-1]:y=null,N!==null&&N.renderEnd()};function Tn(S,k,K,G){if(S.visible===!1)return;if(S.layers.test(k.layers)){if(S.isGroup)K=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(k);else if(S.isLightProbeGrid)T.pushLightProbeGrid(S);else if(S.isLight)T.pushLight(S),S.castShadow&&T.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||We.intersectsSprite(S)){G&&ft.setFromMatrixPosition(S.matrixWorld).applyMatrix4($);const Me=ee.update(S),ye=S.material;ye.visible&&y.push(S,Me,ye,K,ft.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||We.intersectsObject(S))){const Me=ee.update(S),ye=S.material;if(G&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),ft.copy(S.boundingSphere.center)):(Me.boundingSphere===null&&Me.computeBoundingSphere(),ft.copy(Me.boundingSphere.center)),ft.applyMatrix4(S.matrixWorld).applyMatrix4($)),Array.isArray(ye)){const Le=Me.groups;for(let Ue=0,Ze=Le.length;Ue<Ze;Ue++){const et=Le[Ue],Fe=ye[et.materialIndex];Fe&&Fe.visible&&y.push(S,Me,Fe,K,ft.z,et)}}else ye.visible&&y.push(S,Me,ye,K,ft.z,null)}}const ve=S.children;for(let Me=0,ye=ve.length;Me<ye;Me++)Tn(ve[Me],k,K,G)}function At(S,k,K,G){const{opaque:X,transmissive:ve,transparent:Me}=S;T.setupLightsView(K),Te===!0&&ue.setGlobalState(C.clippingPlanes,K),G&&x.viewport(re.copy(G)),X.length>0&&wn(X,k,K),ve.length>0&&wn(ve,k,K),Me.length>0&&wn(Me,k,K),x.buffers.depth.setTest(!0),x.buffers.depth.setMask(!0),x.buffers.color.setMask(!0),x.setPolygonOffset(!1)}function pn(S,k,K,G){if((K.isScene===!0?K.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[G.id]===void 0){const Fe=Xe.has("EXT_color_buffer_half_float")||Xe.has("EXT_color_buffer_float");T.state.transmissionRenderTarget[G.id]=new ki(1,1,{generateMipmaps:!0,type:Fe?sr:hi,minFilter:Kr,samples:Math.max(4,R.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ct.workingColorSpace})}const ve=T.state.transmissionRenderTarget[G.id],Me=G.viewport||re;ve.setSize(Me.z*C.transmissionResolutionScale,Me.w*C.transmissionResolutionScale);const ye=C.getRenderTarget(),Le=C.getActiveCubeFace(),Ue=C.getActiveMipmapLevel();C.setRenderTarget(ve),C.getClearColor(Be),Pe=C.getClearAlpha(),Pe<1&&C.setClearColor(16777215,.5),C.clear(),qe&&ke.render(K);const Ze=C.toneMapping;C.toneMapping=Bi;const et=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),T.setupLightsView(G),Te===!0&&ue.setGlobalState(C.clippingPlanes,G),wn(S,K,G),j.updateMultisampleRenderTarget(ve),j.updateRenderTargetMipmap(ve),Xe.has("WEBGL_multisampled_render_to_texture")===!1){let Fe=!1;for(let St=0,Gt=k.length;St<Gt;St++){const Ot=k[St],{object:yt,geometry:mn,material:Ae,group:Xn}=Ot;if(Ae.side===Zi&&yt.layers.test(G.layers)){const ht=Ae.side;Ae.side=Vn,Ae.needsUpdate=!0,qt(yt,K,G,mn,Ae,Xn),Ae.side=ht,Ae.needsUpdate=!0,Fe=!0}}Fe===!0&&(j.updateMultisampleRenderTarget(ve),j.updateRenderTargetMipmap(ve))}C.setRenderTarget(ye,Le,Ue),C.setClearColor(Be,Pe),et!==void 0&&(G.viewport=et),C.toneMapping=Ze}function wn(S,k,K){const G=k.isScene===!0?k.overrideMaterial:null;for(let X=0,ve=S.length;X<ve;X++){const Me=S[X],{object:ye,geometry:Le,group:Ue}=Me;let Ze=Me.material;Ze.allowOverride===!0&&G!==null&&(Ze=G),ye.layers.test(K.layers)&&qt(ye,k,K,Le,Ze,Ue)}}function qt(S,k,K,G,X,ve){S.onBeforeRender(C,k,K,G,X,ve),S.modelViewMatrix.multiplyMatrices(K.matrixWorldInverse,S.matrixWorld),S.normalMatrix.getNormalMatrix(S.modelViewMatrix),X.onBeforeRender(C,k,K,G,S,ve),X.transparent===!0&&X.side===Zi&&X.forceSinglePass===!1?(X.side=Vn,X.needsUpdate=!0,C.renderBufferDirect(K,k,G,X,S,ve),X.side=Nr,X.needsUpdate=!0,C.renderBufferDirect(K,k,G,X,S,ve),X.side=Zi):C.renderBufferDirect(K,k,G,X,S,ve),S.onAfterRender(C,k,K,G,X,ve)}function Ft(S,k,K){k.isScene!==!0&&(k=_t);const G=V.get(S),X=T.state.lights,ve=T.state.shadowsArray,Me=X.state.version,ye=me.getParameters(S,X.state,ve,k,K,T.state.lightProbeGridArray),Le=me.getProgramCacheKey(ye);let Ue=G.programs;G.environment=S.isMeshStandardMaterial||S.isMeshLambertMaterial||S.isMeshPhongMaterial?k.environment:null,G.fog=k.fog;const Ze=S.isMeshStandardMaterial||S.isMeshLambertMaterial&&!S.envMap||S.isMeshPhongMaterial&&!S.envMap;G.envMap=fe.get(S.envMap||G.environment,Ze),G.envMapRotation=G.environment!==null&&S.envMap===null?k.environmentRotation:S.envMapRotation,Ue===void 0&&(S.addEventListener("dispose",De),Ue=new Map,G.programs=Ue);let et=Ue.get(Le);if(et!==void 0){if(G.currentProgram===et&&G.lightsStateVersion===Me)return Ti(S,ye),et}else ye.uniforms=me.getUniforms(S),N!==null&&S.isNodeMaterial&&N.build(S,K,ye),S.onBeforeCompile(ye,C),et=me.acquireProgram(ye,Le),Ue.set(Le,et),G.uniforms=ye.uniforms;const Fe=G.uniforms;return(!S.isShaderMaterial&&!S.isRawShaderMaterial||S.clipping===!0)&&(Fe.clippingPlanes=ue.uniform),Ti(S,ye),G.needsLights=si(S),G.lightsStateVersion=Me,G.needsLights&&(Fe.ambientLightColor.value=X.state.ambient,Fe.lightProbe.value=X.state.probe,Fe.directionalLights.value=X.state.directional,Fe.directionalLightShadows.value=X.state.directionalShadow,Fe.spotLights.value=X.state.spot,Fe.spotLightShadows.value=X.state.spotShadow,Fe.rectAreaLights.value=X.state.rectArea,Fe.ltc_1.value=X.state.rectAreaLTC1,Fe.ltc_2.value=X.state.rectAreaLTC2,Fe.pointLights.value=X.state.point,Fe.pointLightShadows.value=X.state.pointShadow,Fe.hemisphereLights.value=X.state.hemi,Fe.directionalShadowMatrix.value=X.state.directionalShadowMatrix,Fe.spotLightMatrix.value=X.state.spotLightMatrix,Fe.spotLightMap.value=X.state.spotLightMap,Fe.pointShadowMatrix.value=X.state.pointShadowMatrix),G.lightProbeGrid=T.state.lightProbeGridArray.length>0,G.currentProgram=et,G.uniformsList=null,et}function jt(S){if(S.uniformsList===null){const k=S.currentProgram.getUniforms();S.uniformsList=sl.seqWithValue(k.seq,S.uniforms)}return S.uniformsList}function Ti(S,k){const K=V.get(S);K.outputColorSpace=k.outputColorSpace,K.batching=k.batching,K.batchingColor=k.batchingColor,K.instancing=k.instancing,K.instancingColor=k.instancingColor,K.instancingMorph=k.instancingMorph,K.skinning=k.skinning,K.morphTargets=k.morphTargets,K.morphNormals=k.morphNormals,K.morphColors=k.morphColors,K.morphTargetsCount=k.morphTargetsCount,K.numClippingPlanes=k.numClippingPlanes,K.numIntersection=k.numClipIntersection,K.vertexAlphas=k.vertexAlphas,K.vertexTangents=k.vertexTangents,K.toneMapping=k.toneMapping}function ds(S,k){if(S.length===0)return null;if(S.length===1)return S[0].texture!==null?S[0]:null;M.setFromMatrixPosition(k.matrixWorld);for(let K=0,G=S.length;K<G;K++){const X=S[K];if(X.texture!==null&&X.boundingBox.containsPoint(M))return X}return null}function rn(S,k,K,G,X){k.isScene!==!0&&(k=_t),j.resetTextureUnits();const ve=k.fog,Me=G.isMeshStandardMaterial||G.isMeshLambertMaterial||G.isMeshPhongMaterial?k.environment:null,ye=W===null?C.outputColorSpace:W.isXRRenderTarget===!0?W.texture.colorSpace:ct.workingColorSpace,Le=G.isMeshStandardMaterial||G.isMeshLambertMaterial&&!G.envMap||G.isMeshPhongMaterial&&!G.envMap,Ue=fe.get(G.envMap||Me,Le),Ze=G.vertexColors===!0&&!!K.attributes.color&&K.attributes.color.itemSize===4,et=!!K.attributes.tangent&&(!!G.normalMap||G.anisotropy>0),Fe=!!K.morphAttributes.position,St=!!K.morphAttributes.normal,Gt=!!K.morphAttributes.color;let Ot=Bi;G.toneMapped&&(W===null||W.isXRRenderTarget===!0)&&(Ot=C.toneMapping);const yt=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,mn=yt!==void 0?yt.length:0,Ae=V.get(G),Xn=T.state.lights;if(Te===!0&&(Ne===!0||S!==D)){const Rt=S===D&&G.id===Z;ue.setState(G,S,Rt)}let ht=!1;G.version===Ae.__version?(Ae.needsLights&&Ae.lightsStateVersion!==Xn.state.version||Ae.outputColorSpace!==ye||X.isBatchedMesh&&Ae.batching===!1||!X.isBatchedMesh&&Ae.batching===!0||X.isBatchedMesh&&Ae.batchingColor===!0&&X.colorTexture===null||X.isBatchedMesh&&Ae.batchingColor===!1&&X.colorTexture!==null||X.isInstancedMesh&&Ae.instancing===!1||!X.isInstancedMesh&&Ae.instancing===!0||X.isSkinnedMesh&&Ae.skinning===!1||!X.isSkinnedMesh&&Ae.skinning===!0||X.isInstancedMesh&&Ae.instancingColor===!0&&X.instanceColor===null||X.isInstancedMesh&&Ae.instancingColor===!1&&X.instanceColor!==null||X.isInstancedMesh&&Ae.instancingMorph===!0&&X.morphTexture===null||X.isInstancedMesh&&Ae.instancingMorph===!1&&X.morphTexture!==null||Ae.envMap!==Ue||G.fog===!0&&Ae.fog!==ve||Ae.numClippingPlanes!==void 0&&(Ae.numClippingPlanes!==ue.numPlanes||Ae.numIntersection!==ue.numIntersection)||Ae.vertexAlphas!==Ze||Ae.vertexTangents!==et||Ae.morphTargets!==Fe||Ae.morphNormals!==St||Ae.morphColors!==Gt||Ae.toneMapping!==Ot||Ae.morphTargetsCount!==mn||!!Ae.lightProbeGrid!=T.state.lightProbeGridArray.length>0)&&(ht=!0):(ht=!0,Ae.__version=G.version);let ai=Ae.currentProgram;ht===!0&&(ai=Ft(G,k,X),N&&G.isNodeMaterial&&N.onUpdateProgram(G,ai,Ae));let wi=!1,lr=!1,hs=!1;const Et=ai.getUniforms(),Vt=Ae.uniforms;if(x.useProgram(ai.program)&&(wi=!0,lr=!0,hs=!0),G.id!==Z&&(Z=G.id,lr=!0),Ae.needsLights){const Rt=ds(T.state.lightProbeGridArray,X);Ae.lightProbeGrid!==Rt&&(Ae.lightProbeGrid=Rt,lr=!0)}if(wi||D!==S){x.buffers.depth.getReversed()&&S.reversedDepth!==!0&&(S._reversedDepth=!0,S.updateProjectionMatrix()),Et.setValue(F,"projectionMatrix",S.projectionMatrix),Et.setValue(F,"viewMatrix",S.matrixWorldInverse);const ur=Et.map.cameraPosition;ur!==void 0&&ur.setValue(F,je.setFromMatrixPosition(S.matrixWorld)),R.logarithmicDepthBuffer&&Et.setValue(F,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&Et.setValue(F,"isOrthographic",S.isOrthographicCamera===!0),D!==S&&(D=S,lr=!0,hs=!0)}if(Ae.needsLights&&(Xn.state.directionalShadowMap.length>0&&Et.setValue(F,"directionalShadowMap",Xn.state.directionalShadowMap,j),Xn.state.spotShadowMap.length>0&&Et.setValue(F,"spotShadowMap",Xn.state.spotShadowMap,j),Xn.state.pointShadowMap.length>0&&Et.setValue(F,"pointShadowMap",Xn.state.pointShadowMap,j)),X.isSkinnedMesh){Et.setOptional(F,X,"bindMatrix"),Et.setOptional(F,X,"bindMatrixInverse");const Rt=X.skeleton;Rt&&(Rt.boneTexture===null&&Rt.computeBoneTexture(),Et.setValue(F,"boneTexture",Rt.boneTexture,j))}X.isBatchedMesh&&(Et.setOptional(F,X,"batchingTexture"),Et.setValue(F,"batchingTexture",X._matricesTexture,j),Et.setOptional(F,X,"batchingIdTexture"),Et.setValue(F,"batchingIdTexture",X._indirectTexture,j),Et.setOptional(F,X,"batchingColorTexture"),X._colorsTexture!==null&&Et.setValue(F,"batchingColorTexture",X._colorsTexture,j));const cr=K.morphAttributes;if((cr.position!==void 0||cr.normal!==void 0||cr.color!==void 0)&&U.update(X,K,ai),(lr||Ae.receiveShadow!==X.receiveShadow)&&(Ae.receiveShadow=X.receiveShadow,Et.setValue(F,"receiveShadow",X.receiveShadow)),(G.isMeshStandardMaterial||G.isMeshLambertMaterial||G.isMeshPhongMaterial)&&G.envMap===null&&k.environment!==null&&(Vt.envMapIntensity.value=k.environmentIntensity),Vt.dfgLUT!==void 0&&(Vt.dfgLUT.value=gy()),lr){if(Et.setValue(F,"toneMappingExposure",C.toneMappingExposure),Ae.needsLights&&zt(Vt,hs),ve&&G.fog===!0&&Ce.refreshFogUniforms(Vt,ve),Ce.refreshMaterialUniforms(Vt,G,se,ae,T.state.transmissionRenderTarget[S.id]),Ae.needsLights&&Ae.lightProbeGrid){const Rt=Ae.lightProbeGrid;Vt.probesSH.value=Rt.texture,Vt.probesMin.value.copy(Rt.boundingBox.min),Vt.probesMax.value.copy(Rt.boundingBox.max),Vt.probesResolution.value.copy(Rt.resolution)}sl.upload(F,jt(Ae),Vt,j)}if(G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(sl.upload(F,jt(Ae),Vt,j),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&Et.setValue(F,"center",X.center),Et.setValue(F,"modelViewMatrix",X.modelViewMatrix),Et.setValue(F,"normalMatrix",X.normalMatrix),Et.setValue(F,"modelMatrix",X.matrixWorld),G.uniformsGroups!==void 0){const Rt=G.uniformsGroups;for(let ur=0,ps=Rt.length;ur<ps;ur++){const If=Rt[ur];ne.update(If,ai),ne.bind(If,ai)}}return ai}function zt(S,k){S.ambientLightColor.needsUpdate=k,S.lightProbe.needsUpdate=k,S.directionalLights.needsUpdate=k,S.directionalLightShadows.needsUpdate=k,S.pointLights.needsUpdate=k,S.pointLightShadows.needsUpdate=k,S.spotLights.needsUpdate=k,S.spotLightShadows.needsUpdate=k,S.rectAreaLights.needsUpdate=k,S.hemisphereLights.needsUpdate=k}function si(S){return S.isMeshLambertMaterial||S.isMeshToonMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isShadowMaterial||S.isShaderMaterial&&S.lights===!0}this.getActiveCubeFace=function(){return z},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return W},this.setRenderTargetTextures=function(S,k,K){const G=V.get(S);G.__autoAllocateDepthBuffer=S.resolveDepthBuffer===!1,G.__autoAllocateDepthBuffer===!1&&(G.__useRenderToTexture=!1),V.get(S.texture).__webglTexture=k,V.get(S.depthTexture).__webglTexture=G.__autoAllocateDepthBuffer?void 0:K,G.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(S,k){const K=V.get(S);K.__webglFramebuffer=k,K.__useDefaultFramebuffer=k===void 0},this.setRenderTarget=function(S,k=0,K=0){W=S,z=k,I=K;let G=null,X=!1,ve=!1;if(S){const ye=V.get(S);if(ye.__useDefaultFramebuffer!==void 0){x.bindFramebuffer(F.FRAMEBUFFER,ye.__webglFramebuffer),re.copy(S.viewport),he.copy(S.scissor),He=S.scissorTest,x.viewport(re),x.scissor(he),x.setScissorTest(He),Z=-1;return}else if(ye.__webglFramebuffer===void 0)j.setupRenderTarget(S);else if(ye.__hasExternalTextures)j.rebindTextures(S,V.get(S.texture).__webglTexture,V.get(S.depthTexture).__webglTexture);else if(S.depthBuffer){const Ze=S.depthTexture;if(ye.__boundDepthTexture!==Ze){if(Ze!==null&&V.has(Ze)&&(S.width!==Ze.image.width||S.height!==Ze.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");j.setupDepthRenderbuffer(S)}}const Le=S.texture;(Le.isData3DTexture||Le.isDataArrayTexture||Le.isCompressedArrayTexture)&&(ve=!0);const Ue=V.get(S).__webglFramebuffer;S.isWebGLCubeRenderTarget?(Array.isArray(Ue[k])?G=Ue[k][K]:G=Ue[k],X=!0):S.samples>0&&j.useMultisampledRTT(S)===!1?G=V.get(S).__webglMultisampledFramebuffer:Array.isArray(Ue)?G=Ue[K]:G=Ue,re.copy(S.viewport),he.copy(S.scissor),He=S.scissorTest}else re.copy(Ee).multiplyScalar(se).floor(),he.copy(Je).multiplyScalar(se).floor(),He=be;if(K!==0&&(G=Y),x.bindFramebuffer(F.FRAMEBUFFER,G)&&x.drawBuffers(S,G),x.viewport(re),x.scissor(he),x.setScissorTest(He),X){const ye=V.get(S.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+k,ye.__webglTexture,K)}else if(ve){const ye=k;for(let Le=0;Le<S.textures.length;Le++){const Ue=V.get(S.textures[Le]);F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0+Le,Ue.__webglTexture,K,ye)}}else if(S!==null&&K!==0){const ye=V.get(S.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,ye.__webglTexture,K)}Z=-1},this.readRenderTargetPixels=function(S,k,K,G,X,ve,Me,ye=0){if(!(S&&S.isWebGLRenderTarget)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Le=V.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&Me!==void 0&&(Le=Le[Me]),Le){x.bindFramebuffer(F.FRAMEBUFFER,Le);try{const Ue=S.textures[ye],Ze=Ue.format,et=Ue.type;if(S.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+ye),!R.textureFormatReadable(Ze)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!R.textureTypeReadable(et)){pt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=S.width-G&&K>=0&&K<=S.height-X&&F.readPixels(k,K,G,X,_e.convert(Ze),_e.convert(et),ve)}finally{const Ue=W!==null?V.get(W).__webglFramebuffer:null;x.bindFramebuffer(F.FRAMEBUFFER,Ue)}}},this.readRenderTargetPixelsAsync=async function(S,k,K,G,X,ve,Me,ye=0){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Le=V.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&Me!==void 0&&(Le=Le[Me]),Le)if(k>=0&&k<=S.width-G&&K>=0&&K<=S.height-X){x.bindFramebuffer(F.FRAMEBUFFER,Le);const Ue=S.textures[ye],Ze=Ue.format,et=Ue.type;if(S.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+ye),!R.textureFormatReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!R.textureTypeReadable(et))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Fe=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,Fe),F.bufferData(F.PIXEL_PACK_BUFFER,ve.byteLength,F.STREAM_READ),F.readPixels(k,K,G,X,_e.convert(Ze),_e.convert(et),0);const St=W!==null?V.get(W).__webglFramebuffer:null;x.bindFramebuffer(F.FRAMEBUFFER,St);const Gt=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await b0(F,Gt,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,Fe),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,ve),F.deleteBuffer(Fe),F.deleteSync(Gt),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(S,k=null,K=0){const G=Math.pow(2,-K),X=Math.floor(S.image.width*G),ve=Math.floor(S.image.height*G),Me=k!==null?k.x:0,ye=k!==null?k.y:0;j.setTexture2D(S,0),F.copyTexSubImage2D(F.TEXTURE_2D,K,0,0,Me,ye,X,ve),x.unbindTexture()},this.copyTextureToTexture=function(S,k,K=null,G=null,X=0,ve=0){let Me,ye,Le,Ue,Ze,et,Fe,St,Gt;const Ot=S.isCompressedTexture?S.mipmaps[ve]:S.image;if(K!==null)Me=K.max.x-K.min.x,ye=K.max.y-K.min.y,Le=K.isBox3?K.max.z-K.min.z:1,Ue=K.min.x,Ze=K.min.y,et=K.isBox3?K.min.z:0;else{const Vt=Math.pow(2,-X);Me=Math.floor(Ot.width*Vt),ye=Math.floor(Ot.height*Vt),S.isDataArrayTexture?Le=Ot.depth:S.isData3DTexture?Le=Math.floor(Ot.depth*Vt):Le=1,Ue=0,Ze=0,et=0}G!==null?(Fe=G.x,St=G.y,Gt=G.z):(Fe=0,St=0,Gt=0);const yt=_e.convert(k.format),mn=_e.convert(k.type);let Ae;k.isData3DTexture?(j.setTexture3D(k,0),Ae=F.TEXTURE_3D):k.isDataArrayTexture||k.isCompressedArrayTexture?(j.setTexture2DArray(k,0),Ae=F.TEXTURE_2D_ARRAY):(j.setTexture2D(k,0),Ae=F.TEXTURE_2D),x.activeTexture(F.TEXTURE0),x.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,k.flipY),x.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),x.pixelStorei(F.UNPACK_ALIGNMENT,k.unpackAlignment);const Xn=x.getParameter(F.UNPACK_ROW_LENGTH),ht=x.getParameter(F.UNPACK_IMAGE_HEIGHT),ai=x.getParameter(F.UNPACK_SKIP_PIXELS),wi=x.getParameter(F.UNPACK_SKIP_ROWS),lr=x.getParameter(F.UNPACK_SKIP_IMAGES);x.pixelStorei(F.UNPACK_ROW_LENGTH,Ot.width),x.pixelStorei(F.UNPACK_IMAGE_HEIGHT,Ot.height),x.pixelStorei(F.UNPACK_SKIP_PIXELS,Ue),x.pixelStorei(F.UNPACK_SKIP_ROWS,Ze),x.pixelStorei(F.UNPACK_SKIP_IMAGES,et);const hs=S.isDataArrayTexture||S.isData3DTexture,Et=k.isDataArrayTexture||k.isData3DTexture;if(S.isDepthTexture){const Vt=V.get(S),cr=V.get(k),Rt=V.get(Vt.__renderTarget),ur=V.get(cr.__renderTarget);x.bindFramebuffer(F.READ_FRAMEBUFFER,Rt.__webglFramebuffer),x.bindFramebuffer(F.DRAW_FRAMEBUFFER,ur.__webglFramebuffer);for(let ps=0;ps<Le;ps++)hs&&(F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,V.get(S).__webglTexture,X,et+ps),F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,V.get(k).__webglTexture,ve,Gt+ps)),F.blitFramebuffer(Ue,Ze,Me,ye,Fe,St,Me,ye,F.DEPTH_BUFFER_BIT,F.NEAREST);x.bindFramebuffer(F.READ_FRAMEBUFFER,null),x.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else if(X!==0||S.isRenderTargetTexture||V.has(S)){const Vt=V.get(S),cr=V.get(k);x.bindFramebuffer(F.READ_FRAMEBUFFER,H),x.bindFramebuffer(F.DRAW_FRAMEBUFFER,O);for(let Rt=0;Rt<Le;Rt++)hs?F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Vt.__webglTexture,X,et+Rt):F.framebufferTexture2D(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,Vt.__webglTexture,X),Et?F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,cr.__webglTexture,ve,Gt+Rt):F.framebufferTexture2D(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,cr.__webglTexture,ve),X!==0?F.blitFramebuffer(Ue,Ze,Me,ye,Fe,St,Me,ye,F.COLOR_BUFFER_BIT,F.NEAREST):Et?F.copyTexSubImage3D(Ae,ve,Fe,St,Gt+Rt,Ue,Ze,Me,ye):F.copyTexSubImage2D(Ae,ve,Fe,St,Ue,Ze,Me,ye);x.bindFramebuffer(F.READ_FRAMEBUFFER,null),x.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else Et?S.isDataTexture||S.isData3DTexture?F.texSubImage3D(Ae,ve,Fe,St,Gt,Me,ye,Le,yt,mn,Ot.data):k.isCompressedArrayTexture?F.compressedTexSubImage3D(Ae,ve,Fe,St,Gt,Me,ye,Le,yt,Ot.data):F.texSubImage3D(Ae,ve,Fe,St,Gt,Me,ye,Le,yt,mn,Ot):S.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,ve,Fe,St,Me,ye,yt,mn,Ot.data):S.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,ve,Fe,St,Ot.width,Ot.height,yt,Ot.data):F.texSubImage2D(F.TEXTURE_2D,ve,Fe,St,Me,ye,yt,mn,Ot);x.pixelStorei(F.UNPACK_ROW_LENGTH,Xn),x.pixelStorei(F.UNPACK_IMAGE_HEIGHT,ht),x.pixelStorei(F.UNPACK_SKIP_PIXELS,ai),x.pixelStorei(F.UNPACK_SKIP_ROWS,wi),x.pixelStorei(F.UNPACK_SKIP_IMAGES,lr),ve===0&&k.generateMipmaps&&F.generateMipmap(Ae),x.unbindTexture()},this.initRenderTarget=function(S){V.get(S).__webglFramebuffer===void 0&&j.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?j.setTextureCube(S,0):S.isData3DTexture?j.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?j.setTexture2DArray(S,0):j.setTexture2D(S,0),x.unbindTexture()},this.resetState=function(){z=0,I=0,W=null,x.reset(),xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Fi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=ct._getDrawingBufferColorSpace(e),t.unpackColorSpace=ct._getUnpackColorSpace()}}const xy=["claude","opencode","gemini","copilot","codex","antigravity","cursor","kimi"],vy=[{left:88,top:38},{left:73,top:18},{left:27,top:18},{left:12,top:38},{left:9,top:66},{left:24,top:88},{left:76,top:88},{left:91,top:66}],on={tilt:-.5,flatten:.8,swirl:2.6,cameraZ:21,cameraY:8.5,cameraDollyIn:7,cameraPushIn:11,introSeconds:2.4,orbitSpeed:.012,yOffset:-3.9},yh=10.56,My=1.78,Tr={cx:50,cy:52,rx:40,ry:34};function Af(){return vy.map(r=>Math.atan2((Tr.cy-r.top)/Tr.ry,(r.left-Tr.cx)/Tr.rx))}function Rf(r){return{left:Tr.cx+Math.cos(r)*Tr.rx,top:Tr.cy-Math.sin(r)*Tr.ry}}function Sy(r,e){const t=Math.cos(on.tilt),n=(50-e)/50*yh;return{x:(r-50)/50*yh*My,y:(n-on.yOffset)/(on.flatten*t),z:0}}function by(){return Af().map(r=>{const e=Rf(r);return Sy(e.left,e.top)})}function yy({lowPower:r}){return r?{flow:1400,disc:4600,stars:400}:{flow:4200,disc:14e3,stars:1e3}}function Ey(){return Af().map(Rf)}function Eh(r){return .55+(Math.min(88,Math.max(18,r))-18)/70*.8}const Ty=`
4108
+ }`;class uy{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new wm(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new yi({vertexShader:ly,fragmentShader:cy,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new or(new Dl(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class fy extends ds{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,f=null,d=null,g=null;const _=typeof XRWebGLBinding<"u",p=new uy,m={},b=t.getContextAttributes();let w=null,M=null;const y=[],T=[],A=new gt;let v=null;const E=new di;E.viewport=new Bt;const C=new di;C.viewport=new Bt;const L=[E,C],N=new Mx;let q=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let ae=y[J];return ae===void 0&&(ae=new ic,y[J]=ae),ae.getTargetRaySpace()},this.getControllerGrip=function(J){let ae=y[J];return ae===void 0&&(ae=new ic,y[J]=ae),ae.getGripSpace()},this.getHand=function(J){let ae=y[J];return ae===void 0&&(ae=new ic,y[J]=ae),ae.getHandSpace()};function B(J){const ae=T.indexOf(J.inputSource);if(ae===-1)return;const re=y[ae];re!==void 0&&(re.update(J.inputSource,J.frame,c||a),re.dispatchEvent({type:J.type,data:J.inputSource}))}function G(){i.removeEventListener("select",B),i.removeEventListener("selectstart",B),i.removeEventListener("selectend",B),i.removeEventListener("squeeze",B),i.removeEventListener("squeezestart",B),i.removeEventListener("squeezeend",B),i.removeEventListener("end",G),i.removeEventListener("inputsourceschange",I);for(let J=0;J<y.length;J++){const ae=T[J];ae!==null&&(T[J]=null,y[J].disconnect(ae))}q=null,W=null,p.reset();for(const J in m)delete m[J];e.setRenderTarget(w),d=null,f=null,h=null,i=null,M=null,De.stop(),n.isPresenting=!1,e.setPixelRatio(v),e.setSize(A.width,A.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){s=J,n.isPresenting===!0&&Ye("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){o=J,n.isPresenting===!0&&Ye("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(J){c=J},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return h===null&&_&&(h=new XRWebGLBinding(i,t)),h},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(J){if(i=J,i!==null){if(w=e.getRenderTarget(),i.addEventListener("select",B),i.addEventListener("selectstart",B),i.addEventListener("selectend",B),i.addEventListener("squeeze",B),i.addEventListener("squeezestart",B),i.addEventListener("squeezeend",B),i.addEventListener("end",G),i.addEventListener("inputsourceschange",I),b.xrCompatible!==!0&&await t.makeXRCompatible(),v=e.getPixelRatio(),e.getSize(A),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let re=null,Re=null,Ie=null;b.depth&&(Ie=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,re=b.stencil?jr:ar,Re=b.stencil?Qa:Gi);const Ee={colorFormat:t.RGBA8,depthFormat:Ie,scaleFactor:s};h=this.getBinding(),f=h.createProjectionLayer(Ee),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),M=new ki(f.textureWidth,f.textureHeight,{format:bi,type:hi,depthTexture:new sa(f.textureWidth,f.textureHeight,Re,void 0,void 0,void 0,void 0,void 0,void 0,re),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const re={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,re),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new ki(d.framebufferWidth,d.framebufferHeight,{format:bi,type:hi,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),De.setContext(i),De.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};function I(J){for(let ae=0;ae<J.removed.length;ae++){const re=J.removed[ae],Re=T.indexOf(re);Re>=0&&(T[Re]=null,y[Re].disconnect(re))}for(let ae=0;ae<J.added.length;ae++){const re=J.added[ae];let Re=T.indexOf(re);if(Re===-1){for(let Ee=0;Ee<y.length;Ee++)if(Ee>=T.length){T.push(re),Re=Ee;break}else if(T[Ee]===null){T[Ee]=re,Re=Ee;break}if(Re===-1)break}const Ie=y[Re];Ie&&Ie.connect(re)}}const $=new Y,j=new Y;function D(J,ae,re){$.setFromMatrixPosition(ae.matrixWorld),j.setFromMatrixPosition(re.matrixWorld);const Re=$.distanceTo(j),Ie=ae.projectionMatrix.elements,Ee=re.projectionMatrix.elements,Qe=Ie[14]/(Ie[10]-1),ye=Ie[14]/(Ie[10]+1),Ge=(Ie[9]+1)/Ie[5],Xe=(Ie[9]-1)/Ie[5],Te=(Ie[8]-1)/Ie[0],V=(Ee[8]+1)/Ee[0],Je=Qe*Te,$e=Qe*V,pt=Re/(-Te+V),qe=pt*-Te;if(ae.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(qe),J.translateZ(pt),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),Ie[10]===-1)J.projectionMatrix.copy(ae.projectionMatrix),J.projectionMatrixInverse.copy(ae.projectionMatrixInverse);else{const mt=Qe+pt,F=ye+pt,Dt=Je-qe,We=$e+(Re-qe),R=Ge*ye/F*mt,x=Xe*ye/F*mt;J.projectionMatrix.makePerspective(Dt,We,R,x,mt,F),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function se(J,ae){ae===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(ae.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(i===null)return;let ae=J.near,re=J.far;p.texture!==null&&(p.depthNear>0&&(ae=p.depthNear),p.depthFar>0&&(re=p.depthFar)),N.near=C.near=E.near=ae,N.far=C.far=E.far=re,(q!==N.near||W!==N.far)&&(i.updateRenderState({depthNear:N.near,depthFar:N.far}),q=N.near,W=N.far),N.layers.mask=J.layers.mask|6,E.layers.mask=N.layers.mask&-5,C.layers.mask=N.layers.mask&-3;const Re=J.parent,Ie=N.cameras;se(N,Re);for(let Ee=0;Ee<Ie.length;Ee++)se(Ie[Ee],Re);Ie.length===2?D(N,E,C):N.projectionMatrix.copy(E.projectionMatrix),he(J,N,Re)};function he(J,ae,re){re===null?J.matrix.copy(ae.matrixWorld):(J.matrix.copy(re.matrixWorld),J.matrix.invert(),J.matrix.multiply(ae.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(ae.projectionMatrix),J.projectionMatrixInverse.copy(ae.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=eo*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(f===null&&d===null))return l},this.setFoveation=function(J){l=J,f!==null&&(f.fixedFoveation=J),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=J)},this.hasDepthSensing=function(){return p.texture!==null},this.getDepthSensingMesh=function(){return p.getMesh(N)},this.getCameraTexture=function(J){return m[J]};let Ve=null;function He(J,ae){if(u=ae.getViewerPose(c||a),g=ae,u!==null){const re=u.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let Re=!1;re.length!==N.cameras.length&&(N.cameras.length=0,Re=!0);for(let ye=0;ye<re.length;ye++){const Ge=re[ye];let Xe=null;if(d!==null)Xe=d.getViewport(Ge);else{const V=h.getViewSubImage(f,Ge);Xe=V.viewport,ye===0&&(e.setRenderTargetTextures(M,V.colorTexture,V.depthStencilTexture),e.setRenderTarget(M))}let Te=L[ye];Te===void 0&&(Te=new di,Te.layers.enable(ye),Te.viewport=new Bt,L[ye]=Te),Te.matrix.fromArray(Ge.transform.matrix),Te.matrix.decompose(Te.position,Te.quaternion,Te.scale),Te.projectionMatrix.fromArray(Ge.projectionMatrix),Te.projectionMatrixInverse.copy(Te.projectionMatrix).invert(),Te.viewport.set(Xe.x,Xe.y,Xe.width,Xe.height),ye===0&&(N.matrix.copy(Te.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),Re===!0&&N.cameras.push(Te)}const Ie=i.enabledFeatures;if(Ie&&Ie.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){h=n.getBinding();const ye=h.getDepthInformation(re[0]);ye&&ye.isValid&&ye.texture&&p.init(ye,i.renderState)}if(Ie&&Ie.includes("camera-access")&&_){e.state.unbindTexture(),h=n.getBinding();for(let ye=0;ye<re.length;ye++){const Ge=re[ye].camera;if(Ge){let Xe=m[Ge];Xe||(Xe=new wm,m[Ge]=Xe);const Te=h.getCameraImage(Ge);Xe.sourceTexture=Te}}}}for(let re=0;re<y.length;re++){const Re=T[re],Ie=y[re];Re!==null&&Ie!==void 0&&Ie.update(Re,ae,c||a)}Ve&&Ve(J,ae),ae.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ae}),g=null}const De=new Pm;De.setAnimationLoop(He),this.setAnimationLoop=function(J){Ve=J},this.dispose=function(){}}}const dy=new Xt,Om=new Ke;Om.set(-1,0,0,0,1,0,0,0,1);function hy(r,e){function t(p,m){p.matrixAutoUpdate===!0&&p.updateMatrix(),m.value.copy(p.matrix)}function n(p,m){m.color.getRGB(p.fogColor.value,Am(r)),m.isFog?(p.fogNear.value=m.near,p.fogFar.value=m.far):m.isFogExp2&&(p.fogDensity.value=m.density)}function i(p,m,b,w,M){m.isNodeMaterial?m.uniformsNeedUpdate=!1:m.isMeshBasicMaterial?s(p,m):m.isMeshLambertMaterial?(s(p,m),m.envMap&&(p.envMapIntensity.value=m.envMapIntensity)):m.isMeshToonMaterial?(s(p,m),h(p,m)):m.isMeshPhongMaterial?(s(p,m),u(p,m),m.envMap&&(p.envMapIntensity.value=m.envMapIntensity)):m.isMeshStandardMaterial?(s(p,m),f(p,m),m.isMeshPhysicalMaterial&&d(p,m,M)):m.isMeshMatcapMaterial?(s(p,m),g(p,m)):m.isMeshDepthMaterial?s(p,m):m.isMeshDistanceMaterial?(s(p,m),_(p,m)):m.isMeshNormalMaterial?s(p,m):m.isLineBasicMaterial?(a(p,m),m.isLineDashedMaterial&&o(p,m)):m.isPointsMaterial?l(p,m,b,w):m.isSpriteMaterial?c(p,m):m.isShadowMaterial?(p.color.value.copy(m.color),p.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(p,m){p.opacity.value=m.opacity,m.color&&p.diffuse.value.copy(m.color),m.emissive&&p.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(p.map.value=m.map,t(m.map,p.mapTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,t(m.alphaMap,p.alphaMapTransform)),m.bumpMap&&(p.bumpMap.value=m.bumpMap,t(m.bumpMap,p.bumpMapTransform),p.bumpScale.value=m.bumpScale,m.side===Vn&&(p.bumpScale.value*=-1)),m.normalMap&&(p.normalMap.value=m.normalMap,t(m.normalMap,p.normalMapTransform),p.normalScale.value.copy(m.normalScale),m.side===Vn&&p.normalScale.value.negate()),m.displacementMap&&(p.displacementMap.value=m.displacementMap,t(m.displacementMap,p.displacementMapTransform),p.displacementScale.value=m.displacementScale,p.displacementBias.value=m.displacementBias),m.emissiveMap&&(p.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,p.emissiveMapTransform)),m.specularMap&&(p.specularMap.value=m.specularMap,t(m.specularMap,p.specularMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest);const b=e.get(m),w=b.envMap,M=b.envMapRotation;w&&(p.envMap.value=w,p.envMapRotation.value.setFromMatrix4(dy.makeRotationFromEuler(M)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&p.envMapRotation.value.premultiply(Om),p.reflectivity.value=m.reflectivity,p.ior.value=m.ior,p.refractionRatio.value=m.refractionRatio),m.lightMap&&(p.lightMap.value=m.lightMap,p.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,p.lightMapTransform)),m.aoMap&&(p.aoMap.value=m.aoMap,p.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,p.aoMapTransform))}function a(p,m){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,m.map&&(p.map.value=m.map,t(m.map,p.mapTransform))}function o(p,m){p.dashSize.value=m.dashSize,p.totalSize.value=m.dashSize+m.gapSize,p.scale.value=m.scale}function l(p,m,b,w){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.size.value=m.size*b,p.scale.value=w*.5,m.map&&(p.map.value=m.map,t(m.map,p.uvTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,t(m.alphaMap,p.alphaMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest)}function c(p,m){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.rotation.value=m.rotation,m.map&&(p.map.value=m.map,t(m.map,p.mapTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,t(m.alphaMap,p.alphaMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest)}function u(p,m){p.specular.value.copy(m.specular),p.shininess.value=Math.max(m.shininess,1e-4)}function h(p,m){m.gradientMap&&(p.gradientMap.value=m.gradientMap)}function f(p,m){p.metalness.value=m.metalness,m.metalnessMap&&(p.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,p.metalnessMapTransform)),p.roughness.value=m.roughness,m.roughnessMap&&(p.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,p.roughnessMapTransform)),m.envMap&&(p.envMapIntensity.value=m.envMapIntensity)}function d(p,m,b){p.ior.value=m.ior,m.sheen>0&&(p.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),p.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(p.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,p.sheenColorMapTransform)),m.sheenRoughnessMap&&(p.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,p.sheenRoughnessMapTransform))),m.clearcoat>0&&(p.clearcoat.value=m.clearcoat,p.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(p.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,p.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(p.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Vn&&p.clearcoatNormalScale.value.negate())),m.dispersion>0&&(p.dispersion.value=m.dispersion),m.iridescence>0&&(p.iridescence.value=m.iridescence,p.iridescenceIOR.value=m.iridescenceIOR,p.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(p.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,p.iridescenceMapTransform)),m.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),m.transmission>0&&(p.transmission.value=m.transmission,p.transmissionSamplerMap.value=b.texture,p.transmissionSamplerSize.value.set(b.width,b.height),m.transmissionMap&&(p.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,p.transmissionMapTransform)),p.thickness.value=m.thickness,m.thicknessMap&&(p.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=m.attenuationDistance,p.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(p.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(p.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=m.specularIntensity,p.specularColor.value.copy(m.specularColor),m.specularColorMap&&(p.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,p.specularColorMapTransform)),m.specularIntensityMap&&(p.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,p.specularIntensityMapTransform))}function g(p,m){m.matcap&&(p.matcap.value=m.matcap)}function _(p,m){const b=e.get(m).light;p.referencePosition.value.setFromMatrixPosition(b.matrixWorld),p.nearDistance.value=b.shadow.camera.near,p.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function py(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,y){const T=y.program;n.uniformBlockBinding(M,T)}function c(M,y){let T=i[M.id];T===void 0&&(p(M),T=u(M),i[M.id]=T,M.addEventListener("dispose",b));const A=y.program;n.updateUBOMapping(M,A);const v=e.render.frame;s[M.id]!==v&&(f(M),s[M.id]=v)}function u(M){const y=h();M.__bindingPointIndex=y;const T=r.createBuffer(),A=M.__size,v=M.usage;return r.bindBuffer(r.UNIFORM_BUFFER,T),r.bufferData(r.UNIFORM_BUFFER,A,v),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,T),T}function h(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return ht("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(M){const y=i[M.id],T=M.uniforms,A=M.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let v=0,E=T.length;v<E;v++){const C=T[v];if(Array.isArray(C))for(let L=0,N=C.length;L<N;L++)d(C[L],v,L,A);else d(C,v,0,A)}r.bindBuffer(r.UNIFORM_BUFFER,null)}function d(M,y,T,A){if(_(M,y,T,A)===!0){const v=M.__offset,E=M.value;if(Array.isArray(E)){let C=0;for(let L=0;L<E.length;L++){const N=E[L],q=m(N);g(N,M.__data,C),typeof N!="number"&&typeof N!="boolean"&&!N.isMatrix3&&!ArrayBuffer.isView(N)&&(C+=q.storage/Float32Array.BYTES_PER_ELEMENT)}}else g(E,M.__data,0);r.bufferSubData(r.UNIFORM_BUFFER,v,M.__data)}}function g(M,y,T){typeof M=="number"||typeof M=="boolean"?y[0]=M:M.isMatrix3?(y[0]=M.elements[0],y[1]=M.elements[1],y[2]=M.elements[2],y[3]=0,y[4]=M.elements[3],y[5]=M.elements[4],y[6]=M.elements[5],y[7]=0,y[8]=M.elements[6],y[9]=M.elements[7],y[10]=M.elements[8],y[11]=0):ArrayBuffer.isView(M)?y.set(new M.constructor(M.buffer,M.byteOffset,y.length)):M.toArray(y,T)}function _(M,y,T,A){const v=M.value,E=y+"_"+T;if(A[E]===void 0)return typeof v=="number"||typeof v=="boolean"?A[E]=v:ArrayBuffer.isView(v)?A[E]=v.slice():A[E]=v.clone(),!0;{const C=A[E];if(typeof v=="number"||typeof v=="boolean"){if(C!==v)return A[E]=v,!0}else{if(ArrayBuffer.isView(v))return!0;if(C.equals(v)===!1)return C.copy(v),!0}}return!1}function p(M){const y=M.uniforms;let T=0;const A=16;for(let E=0,C=y.length;E<C;E++){const L=Array.isArray(y[E])?y[E]:[y[E]];for(let N=0,q=L.length;N<q;N++){const W=L[N],B=Array.isArray(W.value)?W.value:[W.value];for(let G=0,I=B.length;G<I;G++){const $=B[G],j=m($),D=T%A,se=D%j.boundary,he=D+se;T+=se,he!==0&&A-he<j.storage&&(T+=A-he),W.__data=new Float32Array(j.storage/Float32Array.BYTES_PER_ELEMENT),W.__offset=T,T+=j.storage}}}const v=T%A;return v>0&&(T+=A-v),M.__size=T,M.__cache={},this}function m(M){const y={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(y.boundary=4,y.storage=4):M.isVector2?(y.boundary=8,y.storage=8):M.isVector3||M.isColor?(y.boundary=16,y.storage=12):M.isVector4?(y.boundary=16,y.storage=16):M.isMatrix3?(y.boundary=48,y.storage=48):M.isMatrix4?(y.boundary=64,y.storage=64):M.isTexture?Ye("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(y.boundary=16,y.storage=M.byteLength):Ye("WebGLRenderer: Unsupported uniform value type.",M),y}function b(M){const y=M.target;y.removeEventListener("dispose",b);const T=a.indexOf(y.__bindingPointIndex);a.splice(T,1),r.deleteBuffer(i[y.id]),delete i[y.id],delete s[y.id]}function w(){for(const M in i)r.deleteBuffer(i[M]);a=[],i={},s={}}return{bind:l,update:c,dispose:w}}const my=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Ri=null;function gy(){return Ri===null&&(Ri=new sx(my,16,16,cs,sr),Ri.name="DFG_LUT",Ri.minFilter=yn,Ri.magFilter=yn,Ri.wrapS=Ji,Ri.wrapT=Ji,Ri.generateMipmaps=!1,Ri.needsUpdate=!0),Ri}class _y{constructor(e={}){const{canvas:t=S_(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:f=!1,outputBufferType:d=hi}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=a;const _=d,p=new Set([yf,bf,Sf]),m=new Set([hi,Gi,Ja,Qa,vf,Mf]),b=new Uint32Array(4),w=new Int32Array(4),M=new Y;let y=null,T=null;const A=[],v=[];let E=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Bi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const C=this;let L=!1,N=null,q=null,W=null,B=null;this._outputColorSpace=ci;let G=0,I=0,$=null,j=-1,D=null;const se=new Bt,he=new Bt;let Ve=null;const He=new ft(0);let De=0,J=t.width,ae=t.height,re=1,Re=null,Ie=null;const Ee=new Bt(0,0,J,ae),Qe=new Bt(0,0,J,ae);let ye=!1;const Ge=new Em;let Xe=!1,Te=!1;const V=new Xt,Je=new Y,$e=new Bt,pt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let qe=!1;function mt(){return $===null?re:1}let F=n;function Dt(S,k){return t.getContext(S,k)}try{const S={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${_f}`),t.addEventListener("webglcontextlost",ke,!1),t.addEventListener("webglcontextrestored",ce,!1),t.addEventListener("webglcontextcreationerror",ze,!1),F===null){const k="webgl2";if(F=Dt(k,S),F===null)throw Dt(k)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(S){throw ht("WebGLRenderer: "+S.message),S}let We,R,x,O,z,K,ue,oe,Q,ee,pe,Ae,ge,me,fe,Le,Be,U,de,te,_e,xe,ne;function le(){We=new gS(F),We.init(),_e=new oy(F,We),R=new lS(F,We,e,_e),x=new sy(F,We),R.reversedDepthBuffer&&f&&x.buffers.depth.setReversed(!0),q=F.createFramebuffer(),W=F.createFramebuffer(),B=F.createFramebuffer(),O=new vS(F),z=new Xb,K=new ay(F,We,x,z,R,_e,O),ue=new mS(C),oe=new yx(F),xe=new aS(F,oe),Q=new _S(F,oe,O,xe),ee=new SS(F,Q,oe,xe,O),U=new MS(F,R,K),fe=new cS(z),pe=new Wb(C,ue,We,R,xe,fe),Ae=new hy(C,z),ge=new qb,me=new Qb(We),Be=new sS(C,ue,x,ee,g,l),Le=new ry(C,ee,R),ne=new py(F,O,R,x),de=new oS(F,We,O),te=new xS(F,We,O),O.programs=pe.programs,C.capabilities=R,C.extensions=We,C.properties=z,C.renderLists=ge,C.shadowMap=Le,C.state=x,C.info=O}le(),_!==hi&&(E=new yS(_,t.width,t.height,o,i,s));const ie=new fy(C,F);this.xr=ie,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){const S=We.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=We.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return re},this.setPixelRatio=function(S){S!==void 0&&(re=S,this.setSize(J,ae,!1))},this.getSize=function(S){return S.set(J,ae)},this.setSize=function(S,k,Z=!0){if(ie.isPresenting){Ye("WebGLRenderer: Can't change size while VR device is presenting.");return}J=S,ae=k,t.width=Math.floor(S*re),t.height=Math.floor(k*re),Z===!0&&(t.style.width=S+"px",t.style.height=k+"px"),E!==null&&E.setSize(t.width,t.height),this.setViewport(0,0,S,k)},this.getDrawingBufferSize=function(S){return S.set(J*re,ae*re).floor()},this.setDrawingBufferSize=function(S,k,Z){J=S,ae=k,re=Z,t.width=Math.floor(S*Z),t.height=Math.floor(k*Z),this.setViewport(0,0,S,k)},this.setEffects=function(S){if(_===hi){ht("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(S){for(let k=0;k<S.length;k++)if(S[k].isOutputPass===!0){Ye("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}E.setEffects(S||[])},this.getCurrentViewport=function(S){return S.copy(se)},this.getViewport=function(S){return S.copy(Ee)},this.setViewport=function(S,k,Z,H){S.isVector4?Ee.set(S.x,S.y,S.z,S.w):Ee.set(S,k,Z,H),x.viewport(se.copy(Ee).multiplyScalar(re).round())},this.getScissor=function(S){return S.copy(Qe)},this.setScissor=function(S,k,Z,H){S.isVector4?Qe.set(S.x,S.y,S.z,S.w):Qe.set(S,k,Z,H),x.scissor(he.copy(Qe).multiplyScalar(re).round())},this.getScissorTest=function(){return ye},this.setScissorTest=function(S){x.setScissorTest(ye=S)},this.setOpaqueSort=function(S){Re=S},this.setTransparentSort=function(S){Ie=S},this.getClearColor=function(S){return S.copy(Be.getClearColor())},this.setClearColor=function(){Be.setClearColor(...arguments)},this.getClearAlpha=function(){return Be.getClearAlpha()},this.setClearAlpha=function(){Be.setClearAlpha(...arguments)},this.clear=function(S=!0,k=!0,Z=!0){let H=0;if(S){let X=!1;if($!==null){const ve=$.texture.format;X=p.has(ve)}if(X){const ve=$.texture.type,Me=m.has(ve),be=Be.getClearColor(),Ne=Be.getClearAlpha(),Ue=be.r,je=be.g,tt=be.b;Me?(b[0]=Ue,b[1]=je,b[2]=tt,b[3]=Ne,F.clearBufferuiv(F.COLOR,0,b)):(w[0]=Ue,w[1]=je,w[2]=tt,w[3]=Ne,F.clearBufferiv(F.COLOR,0,w))}else H|=F.COLOR_BUFFER_BIT}k&&(H|=F.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),Z&&(H|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H!==0&&F.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(S){S.setRenderer(this),N=S},this.dispose=function(){t.removeEventListener("webglcontextlost",ke,!1),t.removeEventListener("webglcontextrestored",ce,!1),t.removeEventListener("webglcontextcreationerror",ze,!1),Be.dispose(),ge.dispose(),me.dispose(),z.dispose(),ue.dispose(),ee.dispose(),xe.dispose(),ne.dispose(),pe.dispose(),ie.dispose(),ie.removeEventListener("sessionstart",Ct),ie.removeEventListener("sessionend",St),lt.stop()};function ke(S){S.preventDefault(),Dd("WebGLRenderer: Context Lost."),L=!0}function ce(){Dd("WebGLRenderer: Context Restored."),L=!1;const S=O.autoReset,k=Le.enabled,Z=Le.autoUpdate,H=Le.needsUpdate,X=Le.type;le(),O.autoReset=S,Le.enabled=k,Le.autoUpdate=Z,Le.needsUpdate=H,Le.type=X}function ze(S){ht("WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function Pe(S){const k=S.target;k.removeEventListener("dispose",Pe),Ze(k)}function Ze(S){Yt(S),z.remove(S)}function Yt(S){const k=z.get(S).programs;k!==void 0&&(k.forEach(function(Z){pe.releaseProgram(Z)}),S.isShaderMaterial&&pe.releaseShaderCache(S))}this.renderBufferDirect=function(S,k,Z,H,X,ve){k===null&&(k=pt);const Me=X.isMesh&&X.matrixWorld.determinantAffine()<0,be=sn(S,k,Z,H,X);x.setMaterial(H,Me);let Ne=Z.index,Ue=1;if(H.wireframe===!0){if(Ne=Q.getWireframeAttribute(Z),Ne===void 0)return;Ue=2}const je=Z.drawRange,tt=Z.attributes.position;let Fe=je.start*Ue,Mt=(je.start+je.count)*Ue;ve!==null&&(Fe=Math.max(Fe,ve.start*Ue),Mt=Math.min(Mt,(ve.start+ve.count)*Ue)),Ne!==null?(Fe=Math.max(Fe,0),Mt=Math.min(Mt,Ne.count)):tt!=null&&(Fe=Math.max(Fe,0),Mt=Math.min(Mt,tt.count));const Gt=Mt-Fe;if(Gt<0||Gt===1/0)return;xe.setup(X,H,be,Z,Ne);let Ot,bt=de;if(Ne!==null&&(Ot=oe.get(Ne),bt=te,bt.setIndex(Ot)),X.isMesh)H.wireframe===!0?(x.setLineWidth(H.wireframeLinewidth*mt()),bt.setMode(F.LINES)):bt.setMode(F.TRIANGLES);else if(X.isLine){let mn=H.linewidth;mn===void 0&&(mn=1),x.setLineWidth(mn*mt()),X.isLineSegments?bt.setMode(F.LINES):X.isLineLoop?bt.setMode(F.LINE_LOOP):bt.setMode(F.LINE_STRIP)}else X.isPoints?bt.setMode(F.POINTS):X.isSprite&&bt.setMode(F.TRIANGLES);if(X.isBatchedMesh)if(We.get("WEBGL_multi_draw"))bt.renderMultiDraw(X._multiDrawStarts,X._multiDrawCounts,X._multiDrawCount);else{const mn=X._multiDrawStarts,we=X._multiDrawCounts,Xn=X._multiDrawCount,dt=Ne?oe.get(Ne).bytesPerElement:1,ai=z.get(H).currentProgram.getUniforms();for(let wi=0;wi<Xn;wi++)ai.setValue(F,"_gl_DrawID",wi),bt.render(mn[wi]/dt,we[wi])}else if(X.isInstancedMesh)bt.renderInstances(Fe,Gt,X.count);else if(Z.isInstancedBufferGeometry){const mn=Z._maxInstanceCount!==void 0?Z._maxInstanceCount:1/0,we=Math.min(Z.instanceCount,mn);bt.renderInstances(Fe,Gt,we)}else bt.render(Fe,Gt)};function it(S,k,Z){S.transparent===!0&&S.side===Ki&&S.forceSinglePass===!1?(S.side=Vn,S.needsUpdate=!0,Ft(S,k,Z),S.side=Nr,S.needsUpdate=!0,Ft(S,k,Z),S.side=Ki):Ft(S,k,Z)}this.compile=function(S,k,Z=null){Z===null&&(Z=S),T=me.get(Z),T.init(k),v.push(T),Z.traverseVisible(function(X){X.isLight&&X.layers.test(k.layers)&&(T.pushLight(X),X.castShadow&&T.pushShadow(X))}),S!==Z&&S.traverseVisible(function(X){X.isLight&&X.layers.test(k.layers)&&(T.pushLight(X),X.castShadow&&T.pushShadow(X))}),T.setupLights();const H=new Set;return S.traverse(function(X){if(!(X.isMesh||X.isPoints||X.isLine||X.isSprite))return;const ve=X.material;if(ve)if(Array.isArray(ve))for(let Me=0;Me<ve.length;Me++){const be=ve[Me];it(be,Z,X),H.add(be)}else it(ve,Z,X),H.add(ve)}),T=v.pop(),H},this.compileAsync=function(S,k,Z=null){const H=this.compile(S,k,Z);return new Promise(X=>{function ve(){if(H.forEach(function(Me){z.get(Me).currentProgram.isReady()&&H.delete(Me)}),H.size===0){X(S);return}setTimeout(ve,10)}We.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Rt=null;function rn(S){Rt&&Rt(S)}function Ct(){lt.stop()}function St(){lt.start()}const lt=new Pm;lt.setAnimationLoop(rn),typeof self<"u"&&lt.setContext(self),this.setAnimationLoop=function(S){Rt=S,ie.setAnimationLoop(S),S===null?lt.stop():lt.start()},ie.addEventListener("sessionstart",Ct),ie.addEventListener("sessionend",St),this.render=function(S,k){if(k!==void 0&&k.isCamera!==!0){ht("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;N!==null&&N.renderStart(S,k);const Z=ie.enabled===!0&&ie.isPresenting===!0,H=E!==null&&($===null||Z)&&E.begin(C,$);if(S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),ie.enabled===!0&&ie.isPresenting===!0&&(E===null||E.isCompositing()===!1)&&(ie.cameraAutoUpdate===!0&&ie.updateCamera(k),k=ie.getCamera()),S.isScene===!0&&S.onBeforeRender(C,S,k,$),T=me.get(S,v.length),T.init(k),T.state.textureUnits=K.getTextureUnits(),v.push(T),V.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),Ge.setFromProjectionMatrix(V,Fi,k.reversedDepth),Te=this.localClippingEnabled,Xe=fe.init(this.clippingPlanes,Te),y=ge.get(S,A.length),y.init(),A.push(y),ie.enabled===!0&&ie.isPresenting===!0){const Me=C.xr.getDepthSensingMesh();Me!==null&&Tn(Me,k,-1/0,C.sortObjects)}Tn(S,k,0,C.sortObjects),y.finish(),C.sortObjects===!0&&y.sort(Re,Ie,k.reversedDepth),qe=ie.enabled===!1||ie.isPresenting===!1||ie.hasDepthSensing()===!1,qe&&Be.addToRenderList(y,S),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Xe===!0&&fe.beginShadows();const X=T.state.shadowsArray;if(Le.render(X,S,k),Xe===!0&&fe.endShadows(),(H&&E.hasRenderPass())===!1){const Me=y.opaque,be=y.transmissive;if(T.setupLights(),k.isArrayCamera){const Ne=k.cameras;if(be.length>0)for(let Ue=0,je=Ne.length;Ue<je;Ue++){const tt=Ne[Ue];pn(Me,be,S,tt)}qe&&Be.render(S);for(let Ue=0,je=Ne.length;Ue<je;Ue++){const tt=Ne[Ue];wt(y,S,tt,tt.viewport)}}else be.length>0&&pn(Me,be,S,k),qe&&Be.render(S),wt(y,S,k)}$!==null&&I===0&&(K.updateMultisampleRenderTarget($),K.updateRenderTargetMipmap($)),H&&E.end(C),S.isScene===!0&&S.onAfterRender(C,S,k),xe.resetDefaultState(),j=-1,D=null,v.pop(),v.length>0?(T=v[v.length-1],K.setTextureUnits(T.state.textureUnits),Xe===!0&&fe.setGlobalState(C.clippingPlanes,T.state.camera)):T=null,A.pop(),A.length>0?y=A[A.length-1]:y=null,N!==null&&N.renderEnd()};function Tn(S,k,Z,H){if(S.visible===!1)return;if(S.layers.test(k.layers)){if(S.isGroup)Z=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(k);else if(S.isLightProbeGrid)T.pushLightProbeGrid(S);else if(S.isLight)T.pushLight(S),S.castShadow&&T.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Ge.intersectsSprite(S)){H&&$e.setFromMatrixPosition(S.matrixWorld).applyMatrix4(V);const Me=ee.update(S),be=S.material;be.visible&&y.push(S,Me,be,Z,$e.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||Ge.intersectsObject(S))){const Me=ee.update(S),be=S.material;if(H&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),$e.copy(S.boundingSphere.center)):(Me.boundingSphere===null&&Me.computeBoundingSphere(),$e.copy(Me.boundingSphere.center)),$e.applyMatrix4(S.matrixWorld).applyMatrix4(V)),Array.isArray(be)){const Ne=Me.groups;for(let Ue=0,je=Ne.length;Ue<je;Ue++){const tt=Ne[Ue],Fe=be[tt.materialIndex];Fe&&Fe.visible&&y.push(S,Me,Fe,Z,$e.z,tt)}}else be.visible&&y.push(S,Me,be,Z,$e.z,null)}}const ve=S.children;for(let Me=0,be=ve.length;Me<be;Me++)Tn(ve[Me],k,Z,H)}function wt(S,k,Z,H){const{opaque:X,transmissive:ve,transparent:Me}=S;T.setupLightsView(Z),Xe===!0&&fe.setGlobalState(C.clippingPlanes,Z),H&&x.viewport(se.copy(H)),X.length>0&&wn(X,k,Z),ve.length>0&&wn(ve,k,Z),Me.length>0&&wn(Me,k,Z),x.buffers.depth.setTest(!0),x.buffers.depth.setMask(!0),x.buffers.color.setMask(!0),x.setPolygonOffset(!1)}function pn(S,k,Z,H){if((Z.isScene===!0?Z.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[H.id]===void 0){const Fe=We.has("EXT_color_buffer_half_float")||We.has("EXT_color_buffer_float");T.state.transmissionRenderTarget[H.id]=new ki(1,1,{generateMipmaps:!0,type:Fe?sr:hi,minFilter:Kr,samples:Math.max(4,R.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ct.workingColorSpace})}const ve=T.state.transmissionRenderTarget[H.id],Me=H.viewport||se;ve.setSize(Me.z*C.transmissionResolutionScale,Me.w*C.transmissionResolutionScale);const be=C.getRenderTarget(),Ne=C.getActiveCubeFace(),Ue=C.getActiveMipmapLevel();C.setRenderTarget(ve),C.getClearColor(He),De=C.getClearAlpha(),De<1&&C.setClearColor(16777215,.5),C.clear(),qe&&Be.render(Z);const je=C.toneMapping;C.toneMapping=Bi;const tt=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),T.setupLightsView(H),Xe===!0&&fe.setGlobalState(C.clippingPlanes,H),wn(S,Z,H),K.updateMultisampleRenderTarget(ve),K.updateRenderTargetMipmap(ve),We.has("WEBGL_multisampled_render_to_texture")===!1){let Fe=!1;for(let Mt=0,Gt=k.length;Mt<Gt;Mt++){const Ot=k[Mt],{object:bt,geometry:mn,material:we,group:Xn}=Ot;if(we.side===Ki&&bt.layers.test(H.layers)){const dt=we.side;we.side=Vn,we.needsUpdate=!0,qt(bt,Z,H,mn,we,Xn),we.side=dt,we.needsUpdate=!0,Fe=!0}}Fe===!0&&(K.updateMultisampleRenderTarget(ve),K.updateRenderTargetMipmap(ve))}C.setRenderTarget(be,Ne,Ue),C.setClearColor(He,De),tt!==void 0&&(H.viewport=tt),C.toneMapping=je}function wn(S,k,Z){const H=k.isScene===!0?k.overrideMaterial:null;for(let X=0,ve=S.length;X<ve;X++){const Me=S[X],{object:be,geometry:Ne,group:Ue}=Me;let je=Me.material;je.allowOverride===!0&&H!==null&&(je=H),be.layers.test(Z.layers)&&qt(be,k,Z,Ne,je,Ue)}}function qt(S,k,Z,H,X,ve){S.onBeforeRender(C,k,Z,H,X,ve),S.modelViewMatrix.multiplyMatrices(Z.matrixWorldInverse,S.matrixWorld),S.normalMatrix.getNormalMatrix(S.modelViewMatrix),X.onBeforeRender(C,k,Z,H,S,ve),X.transparent===!0&&X.side===Ki&&X.forceSinglePass===!1?(X.side=Vn,X.needsUpdate=!0,C.renderBufferDirect(Z,k,H,X,S,ve),X.side=Nr,X.needsUpdate=!0,C.renderBufferDirect(Z,k,H,X,S,ve),X.side=Ki):C.renderBufferDirect(Z,k,H,X,S,ve),S.onAfterRender(C,k,Z,H,X,ve)}function Ft(S,k,Z){k.isScene!==!0&&(k=pt);const H=z.get(S),X=T.state.lights,ve=T.state.shadowsArray,Me=X.state.version,be=pe.getParameters(S,X.state,ve,k,Z,T.state.lightProbeGridArray),Ne=pe.getProgramCacheKey(be);let Ue=H.programs;H.environment=S.isMeshStandardMaterial||S.isMeshLambertMaterial||S.isMeshPhongMaterial?k.environment:null,H.fog=k.fog;const je=S.isMeshStandardMaterial||S.isMeshLambertMaterial&&!S.envMap||S.isMeshPhongMaterial&&!S.envMap;H.envMap=ue.get(S.envMap||H.environment,je),H.envMapRotation=H.environment!==null&&S.envMap===null?k.environmentRotation:S.envMapRotation,Ue===void 0&&(S.addEventListener("dispose",Pe),Ue=new Map,H.programs=Ue);let tt=Ue.get(Ne);if(tt!==void 0){if(H.currentProgram===tt&&H.lightsStateVersion===Me)return Ti(S,be),tt}else be.uniforms=pe.getUniforms(S),N!==null&&S.isNodeMaterial&&N.build(S,Z,be),S.onBeforeCompile(be,C),tt=pe.acquireProgram(be,Ne),Ue.set(Ne,tt),H.uniforms=be.uniforms;const Fe=H.uniforms;return(!S.isShaderMaterial&&!S.isRawShaderMaterial||S.clipping===!0)&&(Fe.clippingPlanes=fe.uniform),Ti(S,be),H.needsLights=si(S),H.lightsStateVersion=Me,H.needsLights&&(Fe.ambientLightColor.value=X.state.ambient,Fe.lightProbe.value=X.state.probe,Fe.directionalLights.value=X.state.directional,Fe.directionalLightShadows.value=X.state.directionalShadow,Fe.spotLights.value=X.state.spot,Fe.spotLightShadows.value=X.state.spotShadow,Fe.rectAreaLights.value=X.state.rectArea,Fe.ltc_1.value=X.state.rectAreaLTC1,Fe.ltc_2.value=X.state.rectAreaLTC2,Fe.pointLights.value=X.state.point,Fe.pointLightShadows.value=X.state.pointShadow,Fe.hemisphereLights.value=X.state.hemi,Fe.directionalShadowMatrix.value=X.state.directionalShadowMatrix,Fe.spotLightMatrix.value=X.state.spotLightMatrix,Fe.spotLightMap.value=X.state.spotLightMap,Fe.pointShadowMatrix.value=X.state.pointShadowMatrix),H.lightProbeGrid=T.state.lightProbeGridArray.length>0,H.currentProgram=tt,H.uniformsList=null,tt}function jt(S){if(S.uniformsList===null){const k=S.currentProgram.getUniforms();S.uniformsList=al.seqWithValue(k.seq,S.uniforms)}return S.uniformsList}function Ti(S,k){const Z=z.get(S);Z.outputColorSpace=k.outputColorSpace,Z.batching=k.batching,Z.batchingColor=k.batchingColor,Z.instancing=k.instancing,Z.instancingColor=k.instancingColor,Z.instancingMorph=k.instancingMorph,Z.skinning=k.skinning,Z.morphTargets=k.morphTargets,Z.morphNormals=k.morphNormals,Z.morphColors=k.morphColors,Z.morphTargetsCount=k.morphTargetsCount,Z.numClippingPlanes=k.numClippingPlanes,Z.numIntersection=k.numClipIntersection,Z.vertexAlphas=k.vertexAlphas,Z.vertexTangents=k.vertexTangents,Z.toneMapping=k.toneMapping}function hs(S,k){if(S.length===0)return null;if(S.length===1)return S[0].texture!==null?S[0]:null;M.setFromMatrixPosition(k.matrixWorld);for(let Z=0,H=S.length;Z<H;Z++){const X=S[Z];if(X.texture!==null&&X.boundingBox.containsPoint(M))return X}return null}function sn(S,k,Z,H,X){k.isScene!==!0&&(k=pt),K.resetTextureUnits();const ve=k.fog,Me=H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial?k.environment:null,be=$===null?C.outputColorSpace:$.isXRRenderTarget===!0?$.texture.colorSpace:ct.workingColorSpace,Ne=H.isMeshStandardMaterial||H.isMeshLambertMaterial&&!H.envMap||H.isMeshPhongMaterial&&!H.envMap,Ue=ue.get(H.envMap||Me,Ne),je=H.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,tt=!!Z.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),Fe=!!Z.morphAttributes.position,Mt=!!Z.morphAttributes.normal,Gt=!!Z.morphAttributes.color;let Ot=Bi;H.toneMapped&&($===null||$.isXRRenderTarget===!0)&&(Ot=C.toneMapping);const bt=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,mn=bt!==void 0?bt.length:0,we=z.get(H),Xn=T.state.lights;if(Xe===!0&&(Te===!0||S!==D)){const At=S===D&&H.id===j;fe.setState(H,S,At)}let dt=!1;H.version===we.__version?(we.needsLights&&we.lightsStateVersion!==Xn.state.version||we.outputColorSpace!==be||X.isBatchedMesh&&we.batching===!1||!X.isBatchedMesh&&we.batching===!0||X.isBatchedMesh&&we.batchingColor===!0&&X.colorTexture===null||X.isBatchedMesh&&we.batchingColor===!1&&X.colorTexture!==null||X.isInstancedMesh&&we.instancing===!1||!X.isInstancedMesh&&we.instancing===!0||X.isSkinnedMesh&&we.skinning===!1||!X.isSkinnedMesh&&we.skinning===!0||X.isInstancedMesh&&we.instancingColor===!0&&X.instanceColor===null||X.isInstancedMesh&&we.instancingColor===!1&&X.instanceColor!==null||X.isInstancedMesh&&we.instancingMorph===!0&&X.morphTexture===null||X.isInstancedMesh&&we.instancingMorph===!1&&X.morphTexture!==null||we.envMap!==Ue||H.fog===!0&&we.fog!==ve||we.numClippingPlanes!==void 0&&(we.numClippingPlanes!==fe.numPlanes||we.numIntersection!==fe.numIntersection)||we.vertexAlphas!==je||we.vertexTangents!==tt||we.morphTargets!==Fe||we.morphNormals!==Mt||we.morphColors!==Gt||we.toneMapping!==Ot||we.morphTargetsCount!==mn||!!we.lightProbeGrid!=T.state.lightProbeGridArray.length>0)&&(dt=!0):(dt=!0,we.__version=H.version);let ai=we.currentProgram;dt===!0&&(ai=Ft(H,k,X),N&&H.isNodeMaterial&&N.onUpdateProgram(H,ai,we));let wi=!1,lr=!1,ps=!1;const yt=ai.getUniforms(),Vt=we.uniforms;if(x.useProgram(ai.program)&&(wi=!0,lr=!0,ps=!0),H.id!==j&&(j=H.id,lr=!0),we.needsLights){const At=hs(T.state.lightProbeGridArray,X);we.lightProbeGrid!==At&&(we.lightProbeGrid=At,lr=!0)}if(wi||D!==S){x.buffers.depth.getReversed()&&S.reversedDepth!==!0&&(S._reversedDepth=!0,S.updateProjectionMatrix()),yt.setValue(F,"projectionMatrix",S.projectionMatrix),yt.setValue(F,"viewMatrix",S.matrixWorldInverse);const ur=yt.map.cameraPosition;ur!==void 0&&ur.setValue(F,Je.setFromMatrixPosition(S.matrixWorld)),R.logarithmicDepthBuffer&&yt.setValue(F,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&yt.setValue(F,"isOrthographic",S.isOrthographicCamera===!0),D!==S&&(D=S,lr=!0,ps=!0)}if(we.needsLights&&(Xn.state.directionalShadowMap.length>0&&yt.setValue(F,"directionalShadowMap",Xn.state.directionalShadowMap,K),Xn.state.spotShadowMap.length>0&&yt.setValue(F,"spotShadowMap",Xn.state.spotShadowMap,K),Xn.state.pointShadowMap.length>0&&yt.setValue(F,"pointShadowMap",Xn.state.pointShadowMap,K)),X.isSkinnedMesh){yt.setOptional(F,X,"bindMatrix"),yt.setOptional(F,X,"bindMatrixInverse");const At=X.skeleton;At&&(At.boneTexture===null&&At.computeBoneTexture(),yt.setValue(F,"boneTexture",At.boneTexture,K))}X.isBatchedMesh&&(yt.setOptional(F,X,"batchingTexture"),yt.setValue(F,"batchingTexture",X._matricesTexture,K),yt.setOptional(F,X,"batchingIdTexture"),yt.setValue(F,"batchingIdTexture",X._indirectTexture,K),yt.setOptional(F,X,"batchingColorTexture"),X._colorsTexture!==null&&yt.setValue(F,"batchingColorTexture",X._colorsTexture,K));const cr=Z.morphAttributes;if((cr.position!==void 0||cr.normal!==void 0||cr.color!==void 0)&&U.update(X,Z,ai),(lr||we.receiveShadow!==X.receiveShadow)&&(we.receiveShadow=X.receiveShadow,yt.setValue(F,"receiveShadow",X.receiveShadow)),(H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial)&&H.envMap===null&&k.environment!==null&&(Vt.envMapIntensity.value=k.environmentIntensity),Vt.dfgLUT!==void 0&&(Vt.dfgLUT.value=gy()),lr){if(yt.setValue(F,"toneMappingExposure",C.toneMappingExposure),we.needsLights&&zt(Vt,ps),ve&&H.fog===!0&&Ae.refreshFogUniforms(Vt,ve),Ae.refreshMaterialUniforms(Vt,H,re,ae,T.state.transmissionRenderTarget[S.id]),we.needsLights&&we.lightProbeGrid){const At=we.lightProbeGrid;Vt.probesSH.value=At.texture,Vt.probesMin.value.copy(At.boundingBox.min),Vt.probesMax.value.copy(At.boundingBox.max),Vt.probesResolution.value.copy(At.resolution)}al.upload(F,jt(we),Vt,K)}if(H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(al.upload(F,jt(we),Vt,K),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&yt.setValue(F,"center",X.center),yt.setValue(F,"modelViewMatrix",X.modelViewMatrix),yt.setValue(F,"normalMatrix",X.normalMatrix),yt.setValue(F,"modelMatrix",X.matrixWorld),H.uniformsGroups!==void 0){const At=H.uniformsGroups;for(let ur=0,ms=At.length;ur<ms;ur++){const Uf=At[ur];ne.update(Uf,ai),ne.bind(Uf,ai)}}return ai}function zt(S,k){S.ambientLightColor.needsUpdate=k,S.lightProbe.needsUpdate=k,S.directionalLights.needsUpdate=k,S.directionalLightShadows.needsUpdate=k,S.pointLights.needsUpdate=k,S.pointLightShadows.needsUpdate=k,S.spotLights.needsUpdate=k,S.spotLightShadows.needsUpdate=k,S.rectAreaLights.needsUpdate=k,S.hemisphereLights.needsUpdate=k}function si(S){return S.isMeshLambertMaterial||S.isMeshToonMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isShadowMaterial||S.isShaderMaterial&&S.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return $},this.setRenderTargetTextures=function(S,k,Z){const H=z.get(S);H.__autoAllocateDepthBuffer=S.resolveDepthBuffer===!1,H.__autoAllocateDepthBuffer===!1&&(H.__useRenderToTexture=!1),z.get(S.texture).__webglTexture=k,z.get(S.depthTexture).__webglTexture=H.__autoAllocateDepthBuffer?void 0:Z,H.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(S,k){const Z=z.get(S);Z.__webglFramebuffer=k,Z.__useDefaultFramebuffer=k===void 0},this.setRenderTarget=function(S,k=0,Z=0){$=S,G=k,I=Z;let H=null,X=!1,ve=!1;if(S){const be=z.get(S);if(be.__useDefaultFramebuffer!==void 0){x.bindFramebuffer(F.FRAMEBUFFER,be.__webglFramebuffer),se.copy(S.viewport),he.copy(S.scissor),Ve=S.scissorTest,x.viewport(se),x.scissor(he),x.setScissorTest(Ve),j=-1;return}else if(be.__webglFramebuffer===void 0)K.setupRenderTarget(S);else if(be.__hasExternalTextures)K.rebindTextures(S,z.get(S.texture).__webglTexture,z.get(S.depthTexture).__webglTexture);else if(S.depthBuffer){const je=S.depthTexture;if(be.__boundDepthTexture!==je){if(je!==null&&z.has(je)&&(S.width!==je.image.width||S.height!==je.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");K.setupDepthRenderbuffer(S)}}const Ne=S.texture;(Ne.isData3DTexture||Ne.isDataArrayTexture||Ne.isCompressedArrayTexture)&&(ve=!0);const Ue=z.get(S).__webglFramebuffer;S.isWebGLCubeRenderTarget?(Array.isArray(Ue[k])?H=Ue[k][Z]:H=Ue[k],X=!0):S.samples>0&&K.useMultisampledRTT(S)===!1?H=z.get(S).__webglMultisampledFramebuffer:Array.isArray(Ue)?H=Ue[Z]:H=Ue,se.copy(S.viewport),he.copy(S.scissor),Ve=S.scissorTest}else se.copy(Ee).multiplyScalar(re).floor(),he.copy(Qe).multiplyScalar(re).floor(),Ve=ye;if(Z!==0&&(H=q),x.bindFramebuffer(F.FRAMEBUFFER,H)&&x.drawBuffers(S,H),x.viewport(se),x.scissor(he),x.setScissorTest(Ve),X){const be=z.get(S.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+k,be.__webglTexture,Z)}else if(ve){const be=k;for(let Ne=0;Ne<S.textures.length;Ne++){const Ue=z.get(S.textures[Ne]);F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0+Ne,Ue.__webglTexture,Z,be)}}else if(S!==null&&Z!==0){const be=z.get(S.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,be.__webglTexture,Z)}j=-1},this.readRenderTargetPixels=function(S,k,Z,H,X,ve,Me,be=0){if(!(S&&S.isWebGLRenderTarget)){ht("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ne=z.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&Me!==void 0&&(Ne=Ne[Me]),Ne){x.bindFramebuffer(F.FRAMEBUFFER,Ne);try{const Ue=S.textures[be],je=Ue.format,tt=Ue.type;if(S.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+be),!R.textureFormatReadable(je)){ht("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!R.textureTypeReadable(tt)){ht("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=S.width-H&&Z>=0&&Z<=S.height-X&&F.readPixels(k,Z,H,X,_e.convert(je),_e.convert(tt),ve)}finally{const Ue=$!==null?z.get($).__webglFramebuffer:null;x.bindFramebuffer(F.FRAMEBUFFER,Ue)}}},this.readRenderTargetPixelsAsync=async function(S,k,Z,H,X,ve,Me,be=0){if(!(S&&S.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ne=z.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&Me!==void 0&&(Ne=Ne[Me]),Ne)if(k>=0&&k<=S.width-H&&Z>=0&&Z<=S.height-X){x.bindFramebuffer(F.FRAMEBUFFER,Ne);const Ue=S.textures[be],je=Ue.format,tt=Ue.type;if(S.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+be),!R.textureFormatReadable(je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!R.textureTypeReadable(tt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Fe=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,Fe),F.bufferData(F.PIXEL_PACK_BUFFER,ve.byteLength,F.STREAM_READ),F.readPixels(k,Z,H,X,_e.convert(je),_e.convert(tt),0);const Mt=$!==null?z.get($).__webglFramebuffer:null;x.bindFramebuffer(F.FRAMEBUFFER,Mt);const Gt=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await b_(F,Gt,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,Fe),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,ve),F.deleteBuffer(Fe),F.deleteSync(Gt),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(S,k=null,Z=0){const H=Math.pow(2,-Z),X=Math.floor(S.image.width*H),ve=Math.floor(S.image.height*H),Me=k!==null?k.x:0,be=k!==null?k.y:0;K.setTexture2D(S,0),F.copyTexSubImage2D(F.TEXTURE_2D,Z,0,0,Me,be,X,ve),x.unbindTexture()},this.copyTextureToTexture=function(S,k,Z=null,H=null,X=0,ve=0){let Me,be,Ne,Ue,je,tt,Fe,Mt,Gt;const Ot=S.isCompressedTexture?S.mipmaps[ve]:S.image;if(Z!==null)Me=Z.max.x-Z.min.x,be=Z.max.y-Z.min.y,Ne=Z.isBox3?Z.max.z-Z.min.z:1,Ue=Z.min.x,je=Z.min.y,tt=Z.isBox3?Z.min.z:0;else{const Vt=Math.pow(2,-X);Me=Math.floor(Ot.width*Vt),be=Math.floor(Ot.height*Vt),S.isDataArrayTexture?Ne=Ot.depth:S.isData3DTexture?Ne=Math.floor(Ot.depth*Vt):Ne=1,Ue=0,je=0,tt=0}H!==null?(Fe=H.x,Mt=H.y,Gt=H.z):(Fe=0,Mt=0,Gt=0);const bt=_e.convert(k.format),mn=_e.convert(k.type);let we;k.isData3DTexture?(K.setTexture3D(k,0),we=F.TEXTURE_3D):k.isDataArrayTexture||k.isCompressedArrayTexture?(K.setTexture2DArray(k,0),we=F.TEXTURE_2D_ARRAY):(K.setTexture2D(k,0),we=F.TEXTURE_2D),x.activeTexture(F.TEXTURE0),x.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,k.flipY),x.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),x.pixelStorei(F.UNPACK_ALIGNMENT,k.unpackAlignment);const Xn=x.getParameter(F.UNPACK_ROW_LENGTH),dt=x.getParameter(F.UNPACK_IMAGE_HEIGHT),ai=x.getParameter(F.UNPACK_SKIP_PIXELS),wi=x.getParameter(F.UNPACK_SKIP_ROWS),lr=x.getParameter(F.UNPACK_SKIP_IMAGES);x.pixelStorei(F.UNPACK_ROW_LENGTH,Ot.width),x.pixelStorei(F.UNPACK_IMAGE_HEIGHT,Ot.height),x.pixelStorei(F.UNPACK_SKIP_PIXELS,Ue),x.pixelStorei(F.UNPACK_SKIP_ROWS,je),x.pixelStorei(F.UNPACK_SKIP_IMAGES,tt);const ps=S.isDataArrayTexture||S.isData3DTexture,yt=k.isDataArrayTexture||k.isData3DTexture;if(S.isDepthTexture){const Vt=z.get(S),cr=z.get(k),At=z.get(Vt.__renderTarget),ur=z.get(cr.__renderTarget);x.bindFramebuffer(F.READ_FRAMEBUFFER,At.__webglFramebuffer),x.bindFramebuffer(F.DRAW_FRAMEBUFFER,ur.__webglFramebuffer);for(let ms=0;ms<Ne;ms++)ps&&(F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,z.get(S).__webglTexture,X,tt+ms),F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,z.get(k).__webglTexture,ve,Gt+ms)),F.blitFramebuffer(Ue,je,Me,be,Fe,Mt,Me,be,F.DEPTH_BUFFER_BIT,F.NEAREST);x.bindFramebuffer(F.READ_FRAMEBUFFER,null),x.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else if(X!==0||S.isRenderTargetTexture||z.has(S)){const Vt=z.get(S),cr=z.get(k);x.bindFramebuffer(F.READ_FRAMEBUFFER,W),x.bindFramebuffer(F.DRAW_FRAMEBUFFER,B);for(let At=0;At<Ne;At++)ps?F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Vt.__webglTexture,X,tt+At):F.framebufferTexture2D(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,Vt.__webglTexture,X),yt?F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,cr.__webglTexture,ve,Gt+At):F.framebufferTexture2D(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,cr.__webglTexture,ve),X!==0?F.blitFramebuffer(Ue,je,Me,be,Fe,Mt,Me,be,F.COLOR_BUFFER_BIT,F.NEAREST):yt?F.copyTexSubImage3D(we,ve,Fe,Mt,Gt+At,Ue,je,Me,be):F.copyTexSubImage2D(we,ve,Fe,Mt,Ue,je,Me,be);x.bindFramebuffer(F.READ_FRAMEBUFFER,null),x.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else yt?S.isDataTexture||S.isData3DTexture?F.texSubImage3D(we,ve,Fe,Mt,Gt,Me,be,Ne,bt,mn,Ot.data):k.isCompressedArrayTexture?F.compressedTexSubImage3D(we,ve,Fe,Mt,Gt,Me,be,Ne,bt,Ot.data):F.texSubImage3D(we,ve,Fe,Mt,Gt,Me,be,Ne,bt,mn,Ot):S.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,ve,Fe,Mt,Me,be,bt,mn,Ot.data):S.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,ve,Fe,Mt,Ot.width,Ot.height,bt,Ot.data):F.texSubImage2D(F.TEXTURE_2D,ve,Fe,Mt,Me,be,bt,mn,Ot);x.pixelStorei(F.UNPACK_ROW_LENGTH,Xn),x.pixelStorei(F.UNPACK_IMAGE_HEIGHT,dt),x.pixelStorei(F.UNPACK_SKIP_PIXELS,ai),x.pixelStorei(F.UNPACK_SKIP_ROWS,wi),x.pixelStorei(F.UNPACK_SKIP_IMAGES,lr),ve===0&&k.generateMipmaps&&F.generateMipmap(we),x.unbindTexture()},this.initRenderTarget=function(S){z.get(S).__webglFramebuffer===void 0&&K.setupRenderTarget(S)},this.initTexture=function(S){S.isCubeTexture?K.setTextureCube(S,0):S.isData3DTexture?K.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?K.setTexture2DArray(S,0):K.setTexture2D(S,0),x.unbindTexture()},this.resetState=function(){G=0,I=0,$=null,x.reset(),xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Fi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=ct._getDrawingBufferColorSpace(e),t.unpackColorSpace=ct._getUnpackColorSpace()}}const xy=["claude","opencode","gemini","copilot","codex","antigravity","cursor","kimi"],vy=[{left:88,top:29},{left:73,top:9},{left:27,top:9},{left:12,top:29},{left:9,top:57},{left:24,top:79},{left:76,top:79},{left:91,top:57}],Qt={tilt:-.58,flatten:.72,swirl:2.6,cameraZ:17,cameraY:7,cameraDollyIn:7,cameraPushIn:11,introSeconds:2.4,orbitSpeed:.012,yOffset:-3.9},yh=10.56,My=1.78,Tr={cx:50,cy:43,rx:40,ry:34};function Rf(){return vy.map(r=>Math.atan2((Tr.cy-r.top)/Tr.ry,(r.left-Tr.cx)/Tr.rx))}function Cf(r,e=1){return{left:Tr.cx+Math.cos(r)*Tr.rx*e,top:Tr.cy-Math.sin(r)*Tr.ry*e}}function Sy(r,e){const t=Math.cos(Qt.tilt),n=(50-e)/50*yh;return{x:(r-50)/50*yh*My,y:(n-Qt.yOffset)/(Qt.flatten*t),z:0}}function by(){return Rf().map(r=>{const e=Cf(r);return Sy(e.left,e.top)})}function yy({lowPower:r}){return r?{flow:1400,disc:4600,stars:400}:{flow:4200,disc:14e3,stars:1e3}}function Ey(){return Rf().map(Cf)}function Eh(r){return .35+(Math.min(79,Math.max(9,r))-9)/70*1.15}const Ty=`
4109
4109
  uniform float uTime;
4110
4110
  uniform float uPixelRatio;
4111
4111
  uniform float uSwirl;
@@ -4118,6 +4118,7 @@ void main() {
4118
4118
  uniform vec3 uColorA;
4119
4119
  uniform vec3 uColorB;
4120
4120
  uniform vec3 uColorC;
4121
+ uniform float uProgress;
4121
4122
  attribute float aSeed;
4122
4123
  attribute float aPhase;
4123
4124
  attribute float aSize;
@@ -4215,6 +4216,32 @@ void main() {
4215
4216
  alpha = 0.22 * tw * uIntro;
4216
4217
  }
4217
4218
 
4219
+ // --- COSMIC BIG BANG EXPLOSION ---
4220
+ // Calculate 3D explosion direction based on the local position p
4221
+ // Adding some random spread on Z direction so it expands as a 3D dome/ellipsoid.
4222
+ vec3 explodeDir = normalize(p + vec3(0.0, 0.0, (fract(aSeed * 7.13) - 0.5) * 1.5));
4223
+ // Each particle has its own explosion speed based on aSeed
4224
+ float explodeSpeed = 0.4 + 0.6 * fract(aSeed * 19.87);
4225
+ // Exponential acceleration for the blast wave
4226
+ float expProgress = pow(uProgress, 2.2);
4227
+ float explodeDist = expProgress * 48.0 * explodeSpeed;
4228
+
4229
+ // Displace the particle outward
4230
+ p += explodeDir * explodeDist;
4231
+
4232
+ // Soft neon purple/pink/cyan flash at the start of the explosion
4233
+ // Peaks around uProgress = 0.2, cools down by 0.6
4234
+ float flash = smoothstep(0.0, 0.2, uProgress) * (1.0 - smoothstep(0.2, 0.6, uProgress));
4235
+ vec3 flashColor = mix(uColorA * 1.5, uColorC * 1.6, fract(aSeed * 3.0));
4236
+
4237
+ // Scale particle sizes up moderately during the flash phase to intensify the explosion
4238
+ float sizeMultiplier = 1.0 + flash * 0.8;
4239
+
4240
+ // Individual particle burnout based on uProgress and aSeed (burn out completely by progress = 0.80)
4241
+ float burnOut = smoothstep(0.08 + 0.52 * fract(aSeed * 23.45), 0.80, uProgress);
4242
+ alpha *= (1.0 - burnOut);
4243
+ // ---------------------------------
4244
+
4218
4245
  // Tilt the whole disc around the X axis for depth.
4219
4246
  float c = cos(uTilt);
4220
4247
  float s = sin(uTilt);
@@ -4222,14 +4249,47 @@ void main() {
4222
4249
  p.y += uYOffset;
4223
4250
 
4224
4251
  vec4 mv = modelViewMatrix * vec4(p, 1.0);
4252
+
4253
+ // --- GRAVITATIONAL LENSING WARP (3D BLACK HOLE) IN CAMERA SPACE ---
4254
+ vec3 bh_cam = (modelViewMatrix * vec4(0.0, uYOffset, 0.0, 1.0)).xyz;
4255
+ vec2 toParticle = mv.xy - bh_cam.xy;
4256
+ float r_cam = length(toParticle);
4257
+ float lensGlow = 0.0;
4258
+ if (r_cam > 0.001) {
4259
+ float R_E = 1.35;
4260
+ float R_horizon = 0.65;
4261
+
4262
+ // Fade out particles that fall below the event horizon
4263
+ float horizonFade = smoothstep(0.2, R_horizon, r_cam);
4264
+ alpha *= horizonFade;
4265
+
4266
+ // Point-mass Einstein Ring gravitational lensing formula
4267
+ float r_lensed = 0.5 * (r_cam + sqrt(r_cam * r_cam + 4.0 * R_E * R_E));
4268
+
4269
+ // Shift particles to their lensed coordinates on the screen plane
4270
+ mv.xy = bh_cam.xy + toParticle * (r_lensed / r_cam);
4271
+
4272
+ // Warp Z coordinate forward proportional to the lensing shift
4273
+ mv.z += (r_lensed - r_cam) * 0.35;
4274
+
4275
+ // Calculate gravitational magnification light effect (lensGlow)
4276
+ lensGlow = 1.6 / (r_cam + 0.25);
4277
+ }
4278
+
4225
4279
  gl_Position = projectionMatrix * mv;
4226
4280
  float dist = max(0.001, -mv.z);
4227
4281
  // Exaggerated near-big/far-small: particles low in the frame (near side
4228
4282
  // of the tilted disc) render larger than the far ones behind the copy.
4229
- float depthK = mix(1.45, 0.6, smoothstep(-10.0, 8.0, p.y));
4230
- gl_PointSize = aSize * uPixelRatio * (26.0 / dist) * depthK * (1.0 + glow * 1.7);
4231
-
4232
- vColor = mix(mix(uColorA, uColorB, aSeed), uColorC, clamp(glow, 0.0, 1.0) * 0.85);
4283
+ float depthK = mix(1.85, 0.45, smoothstep(-10.0, 8.0, p.y));
4284
+
4285
+ // Scale particle sizes up based on lensing magnification
4286
+ sizeMultiplier *= 1.0 + clamp(lensGlow - 1.0, 0.0, 3.0) * 0.45;
4287
+ gl_PointSize = aSize * uPixelRatio * (26.0 / dist) * depthK * (1.0 + (glow + lensGlow * 0.35) * 1.7) * sizeMultiplier;
4288
+
4289
+ // Apply lensing color boost: blend into bright hot white/blue light at the Einstein Ring
4290
+ vColor = mix(mix(uColorA, uColorB, aSeed), uColorC, clamp(glow + lensGlow * 0.35, 0.0, 1.0) * 0.85);
4291
+ vColor = mix(vColor, vec3(1.0, 1.0, 1.0) * 1.5, clamp((lensGlow - 1.5) * 0.4, 0.0, 1.0));
4292
+ vColor = mix(vColor, flashColor, flash * 0.95);
4233
4293
  vAlpha = alpha;
4234
4294
  vGlow = glow;
4235
4295
  }
@@ -4249,4 +4309,4 @@ void main() {
4249
4309
  if (a < 0.003) discard;
4250
4310
  gl_FragColor = vec4(vColor, a);
4251
4311
  }
4252
- `;function Ay(){if(typeof window>"u")return!0;const r=window.matchMedia?.("(max-width: 768px)")?.matches,e=(navigator.hardwareConcurrency||8)<=4;return!!(r||e)}function Ry(r,e){const t=e.flow+e.disc+e.stars,n=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=new Float32Array(t),o=new Float32Array(t),l=new Float32Array(t);for(let u=0;u<e.flow;u+=1){const h=u%r.length,f=r[h];n[u*3]=f.x,n[u*3+1]=f.y,n[u*3+2]=f.z,i[u]=Math.random(),s[u]=Math.random(),a[u]=1+Math.random()*1.9,o[u]=1,l[u]=h}for(let u=e.flow;u<e.flow+e.disc;u+=1){const h=Math.random(),f=h<.55?11*(.05+.95*Math.pow(Math.random(),.8)):h<.85?9+Math.random()*3.4:11+Math.random()*3,d=Math.random()*Math.PI*2;n[u*3]=Math.cos(d)*f,n[u*3+1]=Math.sin(d)*f,n[u*3+2]=0,i[u]=Math.random(),s[u]=Math.random(),a[u]=1.1+Math.random()*1.6,o[u]=2,l[u]=0}for(let u=e.flow+e.disc;u<t;u+=1){const h=14+Math.random()*22,f=Math.random()*Math.PI*2;n[u*3]=Math.cos(f)*h,n[u*3+1]=(Math.random()-.5)*16,n[u*3+2]=-8-Math.random()*22,i[u]=Math.random(),s[u]=Math.random(),a[u]=.5+Math.random()*1,o[u]=0,l[u]=0}const c=new Ei;return c.setAttribute("position",new Mn(n,3)),c.setAttribute("aSeed",new Mn(i,1)),c.setAttribute("aPhase",new Mn(s,1)),c.setAttribute("aSize",new Mn(a,1)),c.setAttribute("aFlow",new Mn(o,1)),c.setAttribute("aStream",new Mn(l,1)),c}function Cy({mode:r="full",progressRef:e,className:t=""}){const n=Ve.useRef(null),i=Ve.useRef([]),[s,a]=Ve.useState(!1);Ve.useEffect(()=>{if(r!=="full")return;const c=n.current;if(!c)return;let u;try{u=new _y({antialias:!1,alpha:!0,depth:!1,stencil:!1,powerPreference:"high-performance"})}catch(Te){console.warn("TokenGalaxy: WebGL unavailable, using static fallback.",Te),a(!0);return}const h=Ay(),f=Math.min(window.devicePixelRatio||1,h?1.5:2);u.setPixelRatio(f),u.setClearColor(0,0);const d=u.domElement;d.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block;",c.appendChild(d);const g=new Q0,_=new di(50,1,.1,120);_.position.set(0,0,on.cameraZ);const p=by(),m=Ry(p,yy({lowPower:h})),b={uTime:{value:0},uPixelRatio:{value:f},uSwirl:{value:on.swirl},uFlatten:{value:on.flatten},uTilt:{value:on.tilt},uYOffset:{value:on.yOffset},uIntro:{value:0},uOrbit:{value:0},uAnchors:{value:p.map(Te=>new q(Te.x,Te.y,Te.z))},uGlobalAlpha:{value:0},uColorA:{value:new dt(Nl.accent)},uColorB:{value:new dt(Nl.accentSoft)},uColorC:{value:new dt(Nl.glint)}},A=new yi({vertexShader:Ty,fragmentShader:wy,uniforms:b,transparent:!0,depthTest:!1,depthWrite:!1,blending:jc}),M=new ux(m,A);M.frustumCulled=!1,g.add(M);const y=Af(),T=Math.cos(on.tilt),w=Math.sin(on.tilt),v=new q(0,-w,T),E=new q(0,on.yOffset,0),C=new q(0,T,w),L=new q,N=new q,Y=new q,H=(Te,Ne,$)=>{L.set(Te/50-1,1-Ne/50,.5).unproject(_),N.copy(L).sub(_.position).normalize();const je=v.dot(N);if(Math.abs(je)<1e-6)return $.set(0,0,0);const ft=v.dot(Y.copy(E).sub(_.position))/je;return L.copy(_.position).addScaledVector(N,ft),Y.copy(L).sub(E),$.set(L.x,Y.dot(C)/on.flatten,0)};let O=0,z=0;function I(){const Te=c.clientWidth||1,Ne=c.clientHeight||1;Math.abs(Te-O)<1&&Math.abs(Ne-z)<1||(O=Te,z=Ne,u.setSize(Te,Ne,!1),_.aspect=Te/Ne,_.updateProjectionMatrix())}let W=0;const Z=new ResizeObserver(()=>{cancelAnimationFrame(W),W=requestAnimationFrame(I)});Z.observe(c),I();const D={current:!0},re={current:!1},he=new IntersectionObserver(Te=>{D.current=Te[0]?.isIntersecting??!0},{threshold:0});he.observe(c);const He=()=>{re.current=document.hidden};document.addEventListener("visibilitychange",He,{passive:!0});const Be={x:0,y:0},Pe={x:0,y:0},J=Te=>{Be.x=Te.clientX/window.innerWidth*2-1,Be.y=Te.clientY/window.innerHeight*2-1},ae=window.matchMedia?.("(hover: hover)")?.matches;ae&&window.addEventListener("pointermove",J,{passive:!0});const se=new Sx;let we=0,Oe=0,Ee=0,Je=0,be=0;function We(){if(Je=requestAnimationFrame(We),re.current||!D.current)return;const Te=se.getElapsedTime(),Ne=Math.min(Math.max(Te-Ee,.001),.033);Ee=Te;const $=Math.min(Math.max(e?.current??0,0),1);be+=($-be)*(1-Math.exp(-Ne/.14));const je=be;b.uTime.value=Te,b.uOrbit.value=Te*on.orbitSpeed,we=Math.min(1,we+Ne/.9),Oe=Math.min(1,Oe+Ne/on.introSeconds);const ft=1-Math.pow(1-Oe,3);b.uIntro.value=ft,b.uGlobalAlpha.value=we*(1-Ld.smoothstep(je,.5,.9));const _t=1-Math.exp(-Ne/.22);Pe.x+=(Be.x-Pe.x)*_t,Pe.y+=(Be.y-Pe.y)*_t,_.position.x=Pe.x*1.8,_.position.y=on.cameraY-Pe.y*1.2-je*4.5,_.position.z=on.cameraZ+(1-ft)*on.cameraDollyIn-je*on.cameraPushIn,_.lookAt(0,0,0),u.render(g,_);const qe=we*(1-Ld.smoothstep(je,.32,.75));for(let at=0;at<y.length;at+=1){const F=i.current[at];if(!F)continue;const Mt=Rf(y[at]+b.uOrbit.value);H(Mt.left,Mt.top,b.uAnchors.value[at]);const Xe=Mt.left/100*O,R=Mt.top/100*z,x=Eh(Mt.top),B=Math.min(1,Math.max(0,ft*2.6-at*.22)),V=x*(.6+.4*B);F.style.transform=`translate3d(${Xe.toFixed(1)}px, ${R.toFixed(1)}px, 0) translate(-50%, -50%) scale(${V.toFixed(3)})`,F.style.opacity=String(Math.max(0,qe*B*(.75+.25*x)).toFixed(3))}}return We(),()=>{cancelAnimationFrame(Je),cancelAnimationFrame(W),Z.disconnect(),he.disconnect(),document.removeEventListener("visibilitychange",He),ae&&window.removeEventListener("pointermove",J),g.clear(),m.dispose(),A.dispose(),u.dispose(),u.forceContextLoss(),c.contains(d)&&c.removeChild(d)}},[r]);const o=r!=="full"||s,l=Ey();return P.jsxs("div",{ref:n,className:`pointer-events-none absolute inset-0 overflow-hidden ${t}`,"aria-hidden":"true","data-mode":o?"static":"webgl",children:[P.jsx("div",{className:"absolute left-1/2 top-[68%] h-[34rem] w-[34rem] -translate-x-1/2 -translate-y-1/2 rounded-full opacity-40",style:{background:"radial-gradient(closest-side, var(--lv3-accent-faint), var(--lv3-accent-ghost) 45%, transparent 72%)"}}),o?P.jsx("div",{className:"absolute left-1/2 top-[68%] h-[22rem] w-[52rem] max-w-[92vw] -translate-x-1/2 -translate-y-1/2 rounded-[50%] opacity-50",style:{background:"radial-gradient(ellipse at center, var(--lv3-accent-ghost) 0%, transparent 60%)",boxShadow:"inset 0 0 120px var(--lv3-accent-ghost)"}}):null,xy.map((c,u)=>P.jsxs("div",{ref:h=>{i.current[u]=h},className:"absolute left-0 top-0 hidden sm:flex h-12 w-12 items-center justify-center rounded-full border border-white/20",style:{background:"var(--lv3-orb-surface)",boxShadow:"var(--lv3-orb-shadow)",backdropFilter:"blur(10px) saturate(1.3)",WebkitBackdropFilter:"blur(10px) saturate(1.3)",...o?{left:`${l[u].left}%`,top:`${l[u].top}%`,transform:`translate(-50%, -50%) scale(${Eh(l[u].top).toFixed(2)})`,opacity:.9}:{opacity:0}},children:[o?null:P.jsx("span",{className:"absolute inset-0 animate-ping rounded-full border border-[color:var(--lv3-accent)] opacity-40",style:{animationDuration:`${2.2+u*.35}s`},"aria-hidden":"true"}),P.jsx("span",{className:"absolute left-[16%] top-[8%] h-[32%] w-[52%] rounded-full opacity-80",style:{background:"var(--lv3-orb-highlight)",filter:"blur(1.5px)"},"aria-hidden":"true"}),P.jsx("span",{className:"absolute left-[24%] top-[13%] h-[16%] w-[22%] rounded-full",style:{background:"var(--lv3-orb-glint)"},"aria-hidden":"true"}),P.jsx(Vm,{provider:c,size:19})]},c))]})}function Bm({copy:r,installCommand:e,installCopied:t,onCopyInstallCommand:n,reduceMotion:i}){return P.jsxs("div",{className:"w-full max-w-lg mx-auto",children:[P.jsxs(Dh.div,{whileHover:i?void 0:{scale:1.01,y:-1},transition:{type:"spring",stiffness:400,damping:25},className:"group relative inline-block w-full overflow-hidden rounded-2xl",style:{padding:"1.5px 0"},children:[P.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 bottom-[-11px] right-[-250%] rounded-full animate-star-movement-bottom z-0",style:{background:"radial-gradient(circle, var(--lv3-glint), transparent 10%)",animationDuration:"6s"}}),P.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 top-[-10px] left-[-250%] rounded-full animate-star-movement-top z-0",style:{background:"radial-gradient(circle, var(--lv3-glint), transparent 10%)",animationDuration:"6s"}}),P.jsxs("div",{className:"relative z-[1] flex items-center justify-between w-full bg-oai-black border border-oai-gray-800 rounded-2xl p-1.5 pl-5 shadow-2xl shadow-black/50",children:[P.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[P.jsx("span",{className:"text-oai-gray-600 font-mono select-none","aria-hidden":"true",children:"›"}),P.jsx("code",{className:"font-mono text-sm text-oai-gray-200 overflow-x-auto whitespace-nowrap py-2 [scrollbar-width:none]",children:e?e.split(" ").map((s,a)=>P.jsxs("span",{className:s==="npx"||s==="tokentracker-cli"?"text-white font-medium":s==="--yes"?"text-oai-gray-500":"text-[color:var(--lv3-accent-soft)]",children:[s," "]},a)):null})]}),P.jsx("button",{type:"button",onClick:n,"aria-label":r(t?"landing.install.action.copied":"landing.install.action.copy"),className:"shrink-0 flex h-9 w-9 items-center justify-center text-oai-gray-200 bg-oai-gray-900 border border-oai-gray-700 rounded-lg hover:bg-oai-gray-800 hover:text-white active:scale-95 transition-all duration-200 shadow-sm",children:t?P.jsx(Jm,{className:"h-4 w-4 text-[color:var(--lv3-accent-soft)]","aria-hidden":!0}):P.jsx(Qm,{className:"h-4 w-4 opacity-70","aria-hidden":!0})})]})]}),P.jsx("span",{className:"sr-only","aria-live":"polite",children:t?r("landing.install.action.copied"):""})]})}function Py(){if(typeof navigator>"u")return"other";const e=`${navigator.userAgentData?.platform??""} ${navigator.userAgent??""} ${navigator.platform??""}`.toLowerCase();return e.includes("win")?"windows":e.includes("mac")&&!e.includes("iphone")&&!e.includes("ipad")?"mac":"other"}function Th({className:r}){return P.jsx("svg",{viewBox:"0 0 384 512",className:r,fill:"currentColor","aria-hidden":"true",children:P.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function Dy({className:r}){return P.jsx("svg",{viewBox:"0 0 16 16",className:r,fill:"currentColor","aria-hidden":"true",children:P.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}function wh({className:r}){return P.jsx("svg",{viewBox:"0 0 24 24",className:r,fill:"currentColor","aria-hidden":"true",children:P.jsx("path",{d:"M3 5.46 10.2 4.5v6.92H3V5.46Zm0 13.08 7.2.96v-6.84H3v5.88Zm8.04 1.08L21 21V12.46h-9.96v7.16ZM11.04 4.38 21 3v8.46h-9.96V4.38Z"})})}function km({copy:r,githubLabel:e}){const t=Ve.useMemo(()=>Py(),[]),n={href:Uf,label:r("landing.v2.install.os_macos"),Icon:Th},i={href:Ff,label:r("landing.v2.install.os_windows"),Icon:wh},s=t==="windows"?{href:Ff,label:r("landing.v2.install.win_cta"),Icon:wh}:t==="mac"?{href:Uf,label:r("landing.v2.install.mac_cta"),Icon:Th}:{href:Hm,label:r("landing.v2.install.desktop_cta"),Icon:eg},o=[...(t==="windows"?[n]:t==="mac"?[i]:[n,i]).map(l=>({key:l.href,href:l.href,Icon:l.Icon,label:l.label})),{key:wc,href:wc,Icon:Dy,label:e}];return P.jsx("div",{className:"flex justify-center",children:P.jsxs("div",{className:"flex min-w-[16rem] flex-col items-stretch",children:[P.jsxs("a",{href:s.href,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex h-11 items-center justify-center gap-2 rounded-full bg-white px-7 text-sm font-semibold text-oai-gray-950 shadow-lg shadow-black/30 transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98]",children:[P.jsx(s.Icon,{className:"h-4 w-4"}),s.label]}),P.jsx("div",{className:"mt-3 flex gap-3",children:o.map(l=>P.jsxs("a",{href:l.href,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex h-9 flex-1 items-center justify-center gap-2 rounded-full border border-white/10 bg-oai-black/60 px-3 text-sm font-medium text-oai-gray-200 backdrop-blur-sm transition-colors hover:border-white/25 hover:text-white",children:[P.jsx(l.Icon,{className:"h-4 w-4 shrink-0 text-oai-gray-400 group-hover:text-white"}),P.jsx("span",{className:"truncate",children:l.label})]},l.key))})]})})}const Ly=1800,Ny=250;function Iy(r){return Math.round(r).toLocaleString("en-US")}function zm({value:r,animate:e=!0,durationMs:t=Ly,format:n=Iy,ratePerSec:i=0,className:s}){const a=Number(r)||0,[o,l]=Ve.useState(e?0:a),c=Ve.useRef(null),u=Ve.useRef(e?0:a),[h,f]=Ve.useState(!1);return Ve.useEffect(()=>{u.current=o},[o]),Ve.useEffect(()=>{if(!e)return;const d=c.current;if(!d||typeof IntersectionObserver>"u"){f(!0);return}const g=new IntersectionObserver(_=>f(!!_[0]?.isIntersecting),{threshold:.4});return g.observe(d),()=>g.disconnect()},[e]),Ve.useEffect(()=>{if(!e){l(a);return}if(!h)return;const d=u.current;if(d===a&&!(i>0))return;let g=0;const _=performance.now();let p=_,m=0;const b=i>0&&d>=a;let A=Math.max(d,a);const M=y=>{const T=b?1:Math.min(1,(y-_)/t);if(T<1){const v=1-Math.pow(1-T,4);l(d+(a-d)*v),p=y,g=requestAnimationFrame(M);return}if(!(i>0)){l(a);return}const w=Math.min(y-p,100)/1e3;p=y,A=Math.max(A,a)+i*w,y-m>=Ny&&(m=y,l(A)),g=requestAnimationFrame(M)};return g=requestAnimationFrame(M),()=>cancelAnimationFrame(g)},[e,h,a,t,i]),P.jsx("span",{ref:c,className:s,children:n(o)})}function Uy({copy:r,animate:e,effectsReady:t,stats:n,tokenFallback:i,devsFallback:s,installCommand:a,installCopied:o,onCopyInstallCommand:l,githubLabel:c}){const u=Ve.useRef(null),h=Ve.useRef(null),f=Ve.useRef(null),d=Ve.useRef(0);Ve.useLayoutEffect(()=>{if(!e)return;const b=Dt.context(()=>{st.create({trigger:u.current,start:"top top",end:"bottom bottom",scrub:!0,onUpdate:M=>{d.current=M.progress}});const A=Dt.timeline({defaults:{ease:"none"},scrollTrigger:{trigger:u.current,start:"top top",end:"bottom bottom",scrub:.5}});A.to(h.current,{yPercent:-16,autoAlpha:0,duration:.35},.12),A.to(f.current,{y:-28,scale:.94,autoAlpha:0,duration:.24},.66),A.to({},{duration:.1})},u);return()=>b.revert()},[e]);const g=n.status==="ready"?n.tokenFloor:i,_=n.status==="ready"?n.totalEntries:s,p=g*.004/86400,m=e&&t?"full":"static";return P.jsx("section",{ref:u,className:e?"relative h-[150vh]":"relative",children:P.jsxs("div",{className:e?"sticky top-0 h-[max(100svh,52rem)] overflow-hidden":"relative min-h-[max(100svh,52rem)] overflow-hidden",children:[P.jsx("div",{ref:h,className:"relative z-20 mx-auto flex max-w-3xl flex-col items-center px-4 pt-12 text-center tall:pt-20 xtall:pt-24 sm:px-6 sm:xtall:pt-28",children:P.jsxs(Dh.div,{initial:e?{opacity:0,y:24}:!1,animate:{opacity:1,y:0},transition:{duration:.6},className:"flex flex-col items-center",children:[P.jsxs("p",{className:"mb-3 inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.03] px-4 py-1.5 text-[10px] font-bold uppercase tracking-[0.2em] text-oai-gray-400 tall:mb-5",children:[P.jsxs("span",{className:"relative flex h-1.5 w-1.5","aria-hidden":"true",children:[P.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-[color:var(--lv3-accent)] opacity-75"}),P.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-[color:var(--lv3-accent)]"})]}),r("landing.v3.hero.kicker")]}),P.jsxs("h1",{className:"text-balance text-4xl font-semibold leading-[1.08] tracking-tight text-white sm:text-[2.75rem] sm:tall:text-[3.25rem] sm:xtall:text-6xl lg:xtall:text-[4rem]",children:[r("landing.v2.hero.title_line1"),P.jsx("br",{}),P.jsx("span",{className:"bg-gradient-to-b from-white via-[color:var(--lv3-accent-soft)] to-[color:var(--lv3-accent)] bg-clip-text font-bold tracking-tight text-transparent",style:{WebkitTextStroke:"1px rgba(255, 255, 255, 0.12)"},children:r("landing.v2.hero.title_line2")})]}),P.jsxs("p",{className:"mt-4 max-w-2xl text-base leading-relaxed text-oai-gray-400 xtall:mt-5 sm:tall:text-lg",children:[r("landing.v2.hero.subtagline")," ",r("landing.v2.install.availability")]}),P.jsx("div",{className:"mt-5 w-full xtall:mt-7",children:P.jsx(Bm,{copy:r,installCommand:a,installCopied:o,onCopyInstallCommand:l,reduceMotion:!e})}),P.jsx("div",{className:"mt-4 w-full xtall:mt-5",children:P.jsx(km,{copy:r,githubLabel:c})})]})}),P.jsxs("div",{className:"absolute inset-0 z-0",children:[P.jsx(Cy,{mode:m,progressRef:d}),P.jsx("div",{className:"pointer-events-none absolute left-1/2 top-[68%] z-10 -translate-x-1/2 -translate-y-1/2",children:P.jsxs("div",{ref:f,className:"flex flex-col items-center gap-2",children:[P.jsx("div",{className:"absolute -inset-x-28 -inset-y-12 -z-10",style:{backdropFilter:"blur(9px)",WebkitBackdropFilter:"blur(9px)",background:"radial-gradient(closest-side, var(--lv3-scrim), transparent 76%)",maskImage:"radial-gradient(closest-side, black 55%, transparent 100%)",WebkitMaskImage:"radial-gradient(closest-side, black 55%, transparent 100%)"},"aria-hidden":"true"}),P.jsx("p",{className:"text-[11px] font-bold uppercase tracking-[0.3em] text-oai-gray-300",children:r("landing.v3.hero.stat_label")}),P.jsx("p",{className:"font-mono text-4xl font-bold tabular-nums leading-none text-white sm:tall:text-5xl",style:{textShadow:"0 2px 24px rgba(0, 0, 0, 0.9), 0 0 90px var(--lv3-accent-faint), 0 0 30px var(--lv3-accent-ghost)"},children:P.jsx(zm,{value:g,animate:e,ratePerSec:p,format:b=>Math.round(b).toLocaleString("en-US")})}),P.jsx("p",{className:"font-mono text-sm text-oai-gray-300",children:r("landing.v3.stats.devs_syncing",{count:(Number(_)||0).toLocaleString("en-US")})})]})}),P.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24",style:{background:"linear-gradient(to bottom, transparent, var(--lv3-bg) 85%)"},"aria-hidden":"true"})]})]})})}function Fy({copy:r,animate:e}){const t=Ve.useRef(null),n=Ve.useRef(null);return Ve.useLayoutEffect(()=>{if(!e)return;const i=Dt.context(()=>{Dt.fromTo(n.current,{autoAlpha:0,y:28},{autoAlpha:1,y:0,duration:.8,ease:"power3.out",scrollTrigger:{trigger:t.current,start:"top 85%"}})},t);return()=>i.revert()},[e]),P.jsx("section",{ref:t,className:"relative border-y border-oai-gray-900 bg-oai-gray-950/50 py-12 lg:py-16",children:P.jsx("div",{ref:n,className:"mx-auto max-w-6xl px-4 sm:px-6",children:P.jsxs("div",{className:"flex flex-col justify-between gap-10 md:flex-row md:items-center",children:[P.jsxs("div",{className:"shrink-0 md:max-w-[16rem]",children:[P.jsx("p",{className:"text-sm font-semibold uppercase tracking-wider text-oai-gray-400",children:r("landing.v2.models.title")}),P.jsx("p",{className:"mt-2 text-xs leading-relaxed text-oai-gray-500",children:r("landing.v3.tools.count",{count:Bf.length})})]}),P.jsx("div",{className:"flex justify-center md:justify-end",children:P.jsx(tg,{logos:Bf,columnCount:6})})]})})})}const Tc=["step1","step2","step3","step4"],Oy=[34,58,42,88,66,100,74];function Ho({title:r,children:e,accent:t=!1}){return P.jsxs("div",{className:"flex h-full w-full flex-col overflow-hidden rounded-xl border border-oai-gray-800 bg-[color:var(--lv3-panel)] shadow-2xl shadow-black/40",style:t?{borderColor:"var(--lv3-line)",boxShadow:"0 24px 80px -32px var(--lv3-accent-faint)"}:void 0,children:[P.jsxs("div",{className:"flex items-center gap-2 border-b border-oai-gray-800/80 px-4 py-2.5",children:[P.jsxs("span",{className:"flex gap-1.5","aria-hidden":"true",children:[P.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-700"}),P.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-700"}),P.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-700"})]}),P.jsx("span",{className:"ml-1 font-mono text-[10px] uppercase tracking-widest text-oai-gray-500",children:r})]}),P.jsx("div",{className:"flex flex-1 flex-col justify-center px-5 py-5 font-mono text-xs leading-loose sm:px-6",children:e})]})}function Ah({index:r}){return r===0?P.jsxs(Ho,{title:"terminal",children:[P.jsxs("p",{className:"text-oai-gray-200",children:[P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"$"})," claude ",P.jsx("span",{className:"text-oai-gray-500",children:'"refactor the parser"'})]}),P.jsx("p",{className:"mt-2 text-oai-gray-500",children:"⏺ thinking…"}),P.jsx("p",{className:"text-oai-gray-500",children:"⏺ editing src/lib/rollout.js"}),P.jsx("p",{className:"mt-2 text-oai-gray-300",children:"✓ 3 files changed"})]}):r===1?P.jsxs(Ho,{title:"session log · last turn",children:[P.jsx("p",{className:"text-oai-gray-500",children:'"usage": {'}),P.jsxs("p",{className:"pl-4 text-oai-gray-300",children:['"input_tokens": ',P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"12,482"}),","]}),P.jsxs("p",{className:"pl-4 text-oai-gray-300",children:['"output_tokens": ',P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"3,067"}),","]}),P.jsxs("p",{className:"pl-4 text-oai-gray-300",children:['"cache_read": ',P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"88,214"})]}),P.jsx("p",{className:"text-oai-gray-500",children:"}"})]}):r===2?P.jsxs(Ho,{title:"~/.tokentracker/queue.jsonl",children:[P.jsx("p",{className:"truncate text-oai-gray-500",children:'{"source":"codex","total_tokens":91406…'}),P.jsx("p",{className:"truncate text-oai-gray-500",children:'{"source":"cursor","total_tokens":18220…'}),P.jsxs("p",{className:"truncate text-oai-gray-300",children:['{"source":"claude","total_tokens":',P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"103,763"}),"…"]}),P.jsx("p",{className:"mt-3 text-[10px] uppercase tracking-widest text-[color:var(--lv3-accent-soft)]",children:"▌ appended locally"})]}):P.jsxs(Ho,{title:"localhost:7680",accent:!0,children:[P.jsx("div",{className:"flex h-24 items-end gap-2","aria-hidden":"true",children:Oy.map((e,t)=>P.jsx("span",{className:"lv3-how-bar w-full origin-bottom rounded-sm",style:{height:`${e}%`,background:t===5?"var(--lv3-accent)":"var(--lv3-accent-faint)"}},t))}),P.jsx("p",{className:"mt-4 text-[10px] uppercase tracking-widest text-oai-gray-500",children:"total tokens"}),P.jsx("p",{className:"text-lg font-bold tabular-nums text-white",children:"6,830,736,916"})]})}function Rh({copy:r,stepKey:e,index:t}){return P.jsxs("div",{className:"lv3-how-step flex gap-4",children:[P.jsx("span",{className:"relative mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-oai-gray-700 bg-oai-gray-950 font-mono text-[10px] font-bold text-oai-gray-300","aria-hidden":"true",children:String(t+1).padStart(2,"0")}),P.jsxs("div",{children:[P.jsx("h3",{className:"text-sm font-semibold text-white",children:r(`landing.v3.how.${e}.title`)}),P.jsx("p",{className:"mt-1 text-sm leading-relaxed text-oai-gray-400",children:r(`landing.v3.how.${e}.body`)})]})]})}function By({copy:r,animate:e}){const t=Ve.useRef(null);return Ve.useLayoutEffect(()=>{if(!e)return;const n=Dt.context(()=>{Dt.matchMedia().add("(min-width: 1024px)",()=>{const s=Dt.utils.toArray(".lv3-how-scene"),a=Dt.utils.toArray(".lv3-how-desktop .lv3-how-step");Dt.set(s.slice(1),{autoAlpha:0,y:28}),Dt.set(a.slice(1),{opacity:.35});const o=Dt.timeline({defaults:{ease:"none"},scrollTrigger:{trigger:t.current,pin:!0,scrub:.8,start:"top top",end:"+=240%",anticipatePin:1}});for(let l=1;l<s.length;l+=1)o.to(s[l-1],{autoAlpha:0,y:-24,duration:.62},l),o.fromTo(s[l],{autoAlpha:0,y:24},{autoAlpha:1,y:0,duration:.62},l+.12),o.to(a[l-1],{opacity:.35,duration:.45},l),o.to(a[l],{opacity:1,duration:.45},l+.12);o.fromTo(".lv3-how-bar",{scaleY:.1},{scaleY:1,duration:.5,stagger:.05},s.length-1+.35),o.to(".lv3-how-progress",{scaleY:1,duration:s.length},0),o.to({},{duration:.35})})},t);return()=>n.revert()},[e]),P.jsx("section",{ref:t,className:"relative overflow-hidden bg-oai-gray-950",children:P.jsxs("div",{className:"mx-auto flex min-h-[100vh] max-w-6xl flex-col justify-center px-4 py-20 sm:px-6 lg:py-0",children:[P.jsxs("div",{className:"mb-12 max-w-2xl lg:mb-16",children:[P.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-[color:var(--lv3-accent-soft)]",children:r("landing.v3.how.kicker")}),P.jsx("h2",{className:"mt-4 text-balance text-3xl font-semibold leading-tight tracking-tight text-white sm:text-4xl",children:r("landing.v3.how.title")}),P.jsx("p",{className:"mt-4 text-base leading-relaxed text-oai-gray-400",children:r("landing.v3.how.subtitle")})]}),P.jsxs("div",{className:"lv3-how-desktop hidden grid-cols-12 items-center gap-12 lg:grid",children:[P.jsxs("div",{className:"relative col-span-5 space-y-9 pl-1",children:[P.jsx("span",{className:"absolute bottom-3 left-[17px] top-3 w-px origin-top bg-oai-gray-800","aria-hidden":"true",children:P.jsx("span",{className:"lv3-how-progress block h-full w-full origin-top scale-y-0",style:{background:"linear-gradient(to bottom, var(--lv3-accent), var(--lv3-accent-soft))"}})}),Tc.map((n,i)=>P.jsx(Rh,{copy:r,stepKey:n,index:i},n))]}),P.jsx("div",{className:"relative col-span-7 h-[420px]",children:Tc.map((n,i)=>P.jsx("div",{className:"lv3-how-scene absolute inset-0",children:P.jsx(Ah,{index:i})},n))})]}),P.jsx("div",{className:"space-y-10 lg:hidden",children:Tc.map((n,i)=>P.jsxs("div",{className:"space-y-4",children:[P.jsx(Rh,{copy:r,stepKey:n,index:i}),P.jsx("div",{className:"h-64",children:P.jsx(Ah,{index:i})})]},n))})]})})}function ky({children:r,className:e="",spotlightColor:t="rgba(138, 122, 255, 0.12)",...n}){const i=Ve.useRef(null),[s,a]=Ve.useState({x:0,y:0}),[o,l]=Ve.useState(!1),c=u=>{if(!i.current)return;const h=i.current.getBoundingClientRect();a({x:u.clientX-h.left,y:u.clientY-h.top})};return P.jsxs("div",{ref:i,onPointerMove:c,onPointerEnter:()=>l(!0),onPointerLeave:()=>l(!1),className:Vu("relative overflow-hidden rounded-xl border border-oai-gray-800 bg-[#080808] p-5 shadow-2xl transition-all duration-300",e),...n,children:[P.jsx("div",{className:"pointer-events-none absolute -inset-px rounded-xl opacity-0 transition-opacity duration-300 z-0",style:{opacity:o?1:0,background:`radial-gradient(350px circle at ${s.x}px ${s.y}px, ${t}, transparent 80%)`}}),P.jsx("div",{className:"relative z-10 w-full h-full",children:r})]})}const zy=["limits","heatmap","devices"];function Gy(){return P.jsxs("svg",{viewBox:"0 0 48 24",className:"h-6 w-12",fill:"none","aria-hidden":"true",children:[P.jsx("path",{d:"M2 22 A 22 22 0 0 1 46 22",stroke:"var(--lv3-line)",strokeWidth:"3",strokeLinecap:"round"}),P.jsx("path",{d:"M2 22 A 22 22 0 0 1 32 4.5",stroke:"var(--lv3-accent)",strokeWidth:"3",strokeLinecap:"round"}),P.jsx("circle",{cx:"32",cy:"4.5",r:"2.6",fill:"var(--lv3-accent-soft)"})]})}function Vy(){const r=[.15,.5,.9,.3,.7,.2,1,.45,.6,.25,.8,.35];return P.jsx("div",{className:"grid w-12 grid-cols-6 gap-[3px]","aria-hidden":"true",children:r.map((e,t)=>P.jsx("span",{className:"h-[7px] w-[7px] rounded-[2px]",style:{background:"var(--lv3-accent)",opacity:.15+e*.85}},t))})}function Hy(){return P.jsxs("svg",{viewBox:"0 0 48 24",className:"h-6 w-12",fill:"none",stroke:"var(--lv3-accent-soft)",strokeWidth:"2","aria-hidden":"true",children:[P.jsx("rect",{x:"2",y:"3",width:"24",height:"15",rx:"2"}),P.jsx("path",{d:"M10 21h8",strokeLinecap:"round"}),P.jsx("rect",{x:"33",y:"6",width:"12",height:"16",rx:"2.5",stroke:"var(--lv3-accent)"})]})}const Wy={limits:Gy,heatmap:Vy,devices:Hy};function Xy({copy:r,animate:e,screenshotSrc:t,screenshotAlt:n}){const i=Ve.useRef(null),s=Ve.useRef(null);return Ve.useLayoutEffect(()=>{if(!e)return;const a=Dt.context(()=>{Dt.fromTo(".lv3-cap-card",{autoAlpha:0,y:32},{autoAlpha:1,y:0,duration:.7,stagger:.12,ease:"power3.out",scrollTrigger:{trigger:i.current,start:"top 70%"}}),Dt.fromTo(s.current,{rotateX:16,y:90,autoAlpha:.35},{rotateX:0,y:0,autoAlpha:1,ease:"none",scrollTrigger:{trigger:s.current,start:"top 95%",end:"top 40%",scrub:.5}})},i);return()=>a.revert()},[e]),P.jsx("section",{ref:i,className:"relative border-t border-oai-gray-900 bg-oai-gray-950 py-20 sm:py-28 lg:py-36",children:P.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[P.jsxs("div",{className:"max-w-2xl",children:[P.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-[color:var(--lv3-accent-soft)]",children:r("landing.v3.cap.kicker")}),P.jsx("h2",{className:"mt-4 text-balance text-3xl font-semibold leading-tight tracking-tight text-white sm:text-4xl",children:r("landing.v3.cap.title")}),P.jsx("p",{className:"mt-4 text-base leading-relaxed text-oai-gray-400",children:r("landing.v3.cap.subtitle")})]}),P.jsx("div",{className:"mt-12 grid grid-cols-1 gap-5 sm:grid-cols-3",children:zy.map(a=>{const o=Wy[a];return P.jsxs(ky,{className:"lv3-cap-card p-6",children:[P.jsx(o,{}),P.jsx("h3",{className:"mt-5 text-sm font-semibold text-white",children:r(`landing.v3.cap.${a}.title`)}),P.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-400",children:r(`landing.v3.cap.${a}.body`)})]},a)})}),P.jsx("div",{className:"mt-16 sm:mt-20",style:{perspective:"1400px"},children:P.jsx("div",{ref:s,className:"relative rounded-xl p-[1px] shadow-2xl",style:{transformStyle:"preserve-3d",background:"linear-gradient(to bottom, var(--lv3-line), var(--lv3-accent-ghost) 40%, transparent)",boxShadow:"0 24px 90px -20px var(--lv3-accent-faint), 0 4px 20px rgba(0,0,0,0.4)"},children:P.jsxs("div",{className:"relative overflow-hidden rounded-[11px] bg-oai-gray-950",children:[P.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-20 h-40",style:{background:"linear-gradient(to bottom, var(--lv3-accent-faint) 0%, transparent 100%)",mixBlendMode:"screen"}}),P.jsx("img",{src:t,alt:n,className:"relative z-10 block h-auto w-full object-cover",loading:"lazy",decoding:"async",width:2496,height:1730})]})})})]})})}const Yy=["p1","p2","p3"];function qy(r){if(typeof Intl<"u"&&Intl.Segmenter){const e=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(e.segment(r),({segment:t,isWordLike:n})=>({text:t,isWordLike:!!(n??t.trim())}))}return r.includes(" ")?r.split(/(\s+)/).map(e=>({text:e,isWordLike:!!e.trim()})):Array.from(r).map(e=>({text:e,isWordLike:/[\p{L}\p{N}]/u.test(e)}))}function $y({copy:r,animate:e}){const t=Ve.useRef(null),n=r("landing.v3.privacy.title"),i=qy(n),s=Math.max(0,i.filter(o=>o.isWordLike).length-2);let a=0;return Ve.useLayoutEffect(()=>{if(!e)return;const o=Dt.context(()=>{Dt.fromTo(".lv3-privacy-word",{autoAlpha:0,y:26,rotateX:-35},{autoAlpha:1,y:0,rotateX:0,duration:.7,stagger:.07,ease:"power3.out",scrollTrigger:{trigger:t.current,start:"top 68%"}}),Dt.fromTo(".lv3-privacy-chip",{autoAlpha:0,y:14},{autoAlpha:1,y:0,duration:.5,stagger:.1,delay:.4,ease:"power2.out",scrollTrigger:{trigger:t.current,start:"top 68%"}})},t);return()=>o.revert()},[e,n]),P.jsx("section",{ref:t,className:"relative overflow-hidden border-t border-oai-gray-900 py-24 sm:py-32 lg:py-44",style:{background:"radial-gradient(60rem 30rem at 50% 120%, var(--lv3-accent-ghost), transparent 70%)"},children:P.jsxs("div",{className:"mx-auto max-w-4xl px-4 text-center sm:px-6",style:{perspective:"900px"},children:[P.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.3em] text-[color:var(--lv3-accent-soft)]",children:r("landing.v3.privacy.kicker")}),P.jsx("h2",{className:"mt-6 text-balance text-4xl font-semibold leading-[1.12] tracking-tight text-white sm:text-5xl lg:text-6xl",children:i.map((o,l)=>{const c=o.isWordLike?a++:-1;return P.jsx("span",{className:"lv3-privacy-word inline-block whitespace-pre",children:P.jsx("span",{className:o.isWordLike&&c>=s?"bg-gradient-to-b from-[color:var(--lv3-accent-soft)] to-[color:var(--lv3-accent)] bg-clip-text text-transparent":void 0,children:o.text})},l)})}),P.jsx("p",{className:"mx-auto mt-6 max-w-xl text-base leading-relaxed text-oai-gray-400",children:r("landing.v2.distill.body")}),P.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-3",children:Yy.map(o=>P.jsxs("span",{className:"lv3-privacy-chip inline-flex items-center gap-2 rounded-full border border-oai-gray-800 bg-oai-black px-4 py-2 font-mono text-[11px] uppercase tracking-widest text-oai-gray-300",children:[P.jsx("span",{className:"h-1 w-1 rounded-full bg-[color:var(--lv3-accent)]","aria-hidden":"true"}),r(`landing.v3.privacy.${o}`)]},o))})]})})}function Ky(r){const e=r.match(/([\d.]+)\s*([\d.]+)%?\s*([\d.]+)%?/);return e?{h:parseFloat(e[1]),s:parseFloat(e[2]),l:parseFloat(e[3])}:{h:247,s:100,l:74}}function Zy(r,e){const{h:t,s:n,l:i}=Ky(r),s=`${t}deg ${n}% ${i}%`;return[[0,0,0,1,100,!0],[0,0,1,0,60,!0],[0,0,3,0,50,!0],[0,0,6,0,40,!0],[0,0,15,0,30,!0],[0,0,25,2,20,!0],[0,0,50,2,10,!0],[0,0,1,0,60,!1],[0,0,3,0,50,!1],[0,0,6,0,40,!1],[0,0,15,0,30,!1],[0,0,25,2,20,!1],[0,0,50,2,10,!1]].map(([o,l,c,u,h,f])=>{const d=Math.min(h*e,100);return`${f?"inset ":""}${o}px ${l}px ${c}px ${u}px hsl(${s} / ${d}%)`}).join(", ")}function Gm(r){return 1-Math.pow(1-r,3)}function Ch(r){return r*r*r}function Wo({start:r=0,end:e=100,duration:t=1e3,delay:n=0,ease:i=Gm,onUpdate:s,onEnd:a}){const o=performance.now()+n;function l(){const c=performance.now()-o,u=Math.min(c/t,1);s(r+(e-r)*i(u)),u<1?requestAnimationFrame(l):a&&a()}setTimeout(()=>requestAnimationFrame(l),n)}const jy=["80% 55%","69% 34%","8% 6%","41% 38%","86% 85%","82% 18%","51% 4%"],Jy=[0,1,2,0,1,2,1];function Qy(r){const e=[];for(let t=0;t<7;t++){const n=r[Math.min(Jy[t],r.length-1)];e.push(`radial-gradient(at ${jy[t]}, ${n} 0px, transparent 50%)`)}return e.push(`linear-gradient(${r[0]} 0 100%)`),e}const eE=({children:r,className:e="",edgeSensitivity:t=30,glowColor:n="247 100 74",backgroundColor:i="#09090b",borderRadius:s=16,glowRadius:a=35,glowIntensity:o=1,coneSpread:l=25,animated:c=!1,colors:u=["#8a7aff","#f472b6","#38bdf8"],fillOpacity:h=.45})=>{const f=Ve.useRef(null),[d,g]=Ve.useState(!1),[_,p]=Ve.useState(45),[m,b]=Ve.useState(0),[A,M]=Ve.useState(!1),y=Ve.useCallback(I=>{const{width:W,height:Z}=I.getBoundingClientRect();return[W/2,Z/2]},[]),T=Ve.useCallback((I,W,Z)=>{const[D,re]=y(I),he=W-D,He=Z-re;let Be=1/0,Pe=1/0;return he!==0&&(Be=D/Math.abs(he)),He!==0&&(Pe=re/Math.abs(He)),Math.min(Math.max(1/Math.min(Be,Pe),0),1)},[y]),w=Ve.useCallback((I,W,Z)=>{const[D,re]=y(I),he=W-D,He=Z-re;if(he===0&&He===0)return 0;let Pe=Math.atan2(He,he)*(180/Math.PI)+90;return Pe<0&&(Pe+=360),Pe},[y]),v=Ve.useCallback(I=>{const W=f.current;if(!W)return;const Z=W.getBoundingClientRect(),D=I.clientX-Z.left,re=I.clientY-Z.top;b(T(W,D,re)),p(w(W,D,re))},[T,w]);Ve.useEffect(()=>{if(!c)return;const I=110,W=465;M(!0),p(I),Wo({duration:500,onUpdate:Z=>b(Z/100)}),Wo({ease:Ch,duration:1500,end:50,onUpdate:Z=>{p((W-I)*(Z/100)+I)}}),Wo({ease:Gm,delay:1500,duration:2250,start:50,end:100,onUpdate:Z=>{p((W-I)*(Z/100)+I)}}),Wo({ease:Ch,delay:2500,duration:1500,start:100,end:0,onUpdate:Z=>b(Z/100),onEnd:()=>M(!1)})},[c]);const E=t+20,C=d||A,L=C?Math.max(0,(m*100-E)/(100-E)):0,N=C?Math.max(0,(m*100-t)/(100-t)):0,Y=Qy(u),H=Y.map(I=>`${I} border-box`),O=Y.map(I=>`${I} padding-box`),z=`${_.toFixed(3)}deg`;return P.jsxs("div",{ref:f,onPointerMove:v,onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1),className:Vu("relative grid isolate border border-white/10",e),style:{background:i,borderRadius:`${s}px`,transform:"translate3d(0, 0, 0.01px)",boxShadow:"rgba(0,0,0,0.2) 0 4px 12px, rgba(0,0,0,0.3) 0 16px 48px"},children:[P.jsx("div",{className:"absolute inset-0 rounded-[inherit] -z-[1]",style:{border:"1px solid transparent",background:[`linear-gradient(${i} 0 100%) padding-box`,"linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",...H].join(", "),opacity:L,maskImage:`conic-gradient(from ${z} at center, black ${l}%, transparent ${l+15}%, transparent ${100-l-15}%, black ${100-l}%)`,WebkitMaskImage:`conic-gradient(from ${z} at center, black ${l}%, transparent ${l+15}%, transparent ${100-l-15}%, black ${100-l}%)`,transition:C?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),P.jsx("div",{className:"absolute inset-0 rounded-[inherit] -z-[1]",style:{border:"1px solid transparent",background:O.join(", "),maskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${z} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),WebkitMaskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${z} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),maskComposite:"subtract, add, add, add, add, add",WebkitMaskComposite:"source-out, source-over, source-over, source-over, source-over, source-over",opacity:L*h,mixBlendMode:"soft-light",transition:C?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),P.jsx("span",{className:"absolute pointer-events-none z-[1] rounded-[inherit]",style:{inset:`${-a}px`,maskImage:`conic-gradient(from ${z} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,WebkitMaskImage:`conic-gradient(from ${z} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,opacity:N,mixBlendMode:"plus-lighter",transition:C?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"},children:P.jsx("span",{className:"absolute rounded-[inherit]",style:{inset:`${a}px`,boxShadow:Zy(n,o)}})}),P.jsx("div",{className:"flex flex-col relative overflow-hidden z-[1] w-full h-full",style:{borderRadius:`${Math.max(0,s-1)}px`},children:r})]})};function Ph(r,e){return(r?.display_name||"").trim()||e("landing.v3.leaderboard.anonymous")}function tE({entry:r,rank:e,maxTokens:t,copy:n,animate:i}){const s=e===1,a=Number(r?.total_tokens)||0,o=t>0?Math.max(6,Math.round(a/t*100)):0;return P.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-4 transition-colors hover:bg-white/[0.02] sm:px-5",children:[P.jsxs("div",{className:"flex min-w-0 items-center gap-3.5",children:[P.jsx("span",{className:`w-5 font-mono text-xs font-bold ${s?"text-[color:var(--lv3-accent-soft)]":"text-oai-gray-500"}`,children:String(e).padStart(2,"0")}),r?.avatar_url?P.jsx("img",{src:r.avatar_url,alt:"",width:24,height:24,loading:"lazy",className:"h-6 w-6 shrink-0 rounded-full border border-oai-gray-800 object-cover"}):P.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-oai-gray-800 bg-oai-gray-900 font-mono text-[10px] font-bold text-oai-gray-400","aria-hidden":"true",children:Ph(r,n).charAt(0).toUpperCase()}),P.jsx("span",{className:`truncate text-sm tracking-wide ${s?"font-bold text-white":"font-semibold text-oai-gray-200"}`,children:Ph(r,n)})]}),P.jsxs("div",{className:"flex shrink-0 items-center gap-5",children:[P.jsx("span",{className:"hidden h-[2px] w-16 overflow-hidden rounded-full bg-oai-gray-900 sm:block","aria-hidden":"true",children:P.jsx("span",{className:"block h-full rounded-full",style:{width:`${o}%`,background:s?"var(--lv3-accent)":ln.line}})}),P.jsx("span",{className:`font-mono text-sm leading-none tabular-nums ${s?"font-semibold text-white":"font-medium text-oai-gray-300"}`,children:P.jsx(zm,{value:a,animate:i,format:l=>Lh(Math.round(l))})})]})]})}function nE(){return P.jsxs("div",{className:"flex items-center justify-between px-4 py-4 sm:px-5",children:[P.jsxs("div",{className:"flex items-center gap-3.5",children:[P.jsx("span",{className:"h-3 w-5 animate-pulse rounded bg-white/10"}),P.jsx("span",{className:"h-6 w-6 animate-pulse rounded-full bg-white/10"}),P.jsx("span",{className:"h-3 w-28 animate-pulse rounded bg-white/10"})]}),P.jsx("span",{className:"h-3 w-16 animate-pulse rounded bg-white/10"})]})}function iE({copy:r,animate:e,stats:t,tokenFallback:n,devsFallback:i}){const s=Ve.useRef(null);Ve.useLayoutEffect(()=>{if(!e)return;const h=Dt.context(()=>{Dt.fromTo(".lv3-lb-col",{autoAlpha:0,y:30},{autoAlpha:1,y:0,duration:.75,stagger:.14,ease:"power3.out",scrollTrigger:{trigger:s.current,start:"top 75%"}})},s);return()=>h.revert()},[e]);const a=t.status==="ready",o=a?t.top:[],l=o.length&&Number(o[0]?.total_tokens)||0,c=a?t.totalEntries:i,u=a?t.tokenFloor:n;return P.jsx("section",{ref:s,className:"relative border-t border-oai-gray-900 bg-oai-gray-950 py-16 sm:py-24 lg:py-32",children:P.jsx("div",{className:"relative z-10 mx-auto max-w-6xl px-4 sm:px-6",children:P.jsxs("div",{className:"grid grid-cols-1 items-center gap-10 sm:gap-12 lg:grid-cols-12 lg:gap-8",children:[P.jsxs("div",{className:"lv3-lb-col space-y-6 text-left lg:col-span-5",children:[P.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-oai-gray-800 bg-oai-black px-3 py-1 text-[10px] font-bold uppercase tracking-widest text-oai-gray-400",children:[P.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":"true",children:[P.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-[color:var(--lv3-accent)] opacity-75"}),P.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-[color:var(--lv3-accent)]"})]}),r("landing.v2.leaderboard.kicker")]}),P.jsx("h2",{className:"text-balance text-3xl font-semibold leading-tight tracking-tight text-white sm:text-4xl",children:r("landing.v2.leaderboard.title")}),P.jsx("p",{className:"text-base leading-relaxed text-oai-gray-400",children:r("landing.v2.leaderboard.subtitle")}),P.jsx("div",{className:"pt-4",children:P.jsx(Ns,{to:"/leaderboard",className:"inline-flex h-9 items-center justify-center whitespace-nowrap rounded-[8px] bg-white px-6 text-xs font-bold text-oai-gray-950 shadow-sm transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98] select-none",children:r("landing.v2.leaderboard.view_more")})})]}),P.jsx("div",{className:"lv3-lb-col w-full lg:col-span-7",children:P.jsxs(eE,{edgeSensitivity:30,glowColor:"138 122 255",backgroundColor:ln.panel,borderRadius:16,glowRadius:35,glowIntensity:1,coneSpread:25,animated:!1,colors:[ln.accent,ln.accentSoft,ln.glint],className:"w-full",children:[P.jsxs("div",{className:"flex select-none items-center justify-between border-b border-oai-gray-800/80 bg-white/[0.025] px-4 py-3 text-[10px] font-bold uppercase tracking-widest text-oai-gray-500 sm:px-5",children:[P.jsx("span",{children:r("landing.v3.leaderboard.panel_title")}),P.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[color:var(--lv3-accent-soft)]",children:[P.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-[color:var(--lv3-accent)]","aria-hidden":"true"}),r("landing.v3.leaderboard.live")]})]}),P.jsx("div",{className:"divide-y divide-oai-gray-800/60",children:a?o.map((h,f)=>P.jsx(tE,{entry:h,rank:f+1,maxTokens:l,copy:r,animate:e},h?.user_id||f)):[0,1,2].map(h=>P.jsx(nE,{},h))}),P.jsxs("div",{className:"flex select-none items-center justify-between border-t border-oai-gray-800/80 bg-black/[0.15] px-4 py-2.5 font-mono text-[9px] uppercase tracking-widest text-oai-gray-500 sm:px-5",children:[P.jsx("span",{children:r("landing.v3.stats.devs_syncing",{count:(Number(c)||0).toLocaleString("en-US")})}),P.jsx("span",{children:r("landing.v3.leaderboard.tokens_synced",{count:`${Lh(Number(u)||0)}+`})})]})]})})]})})})}const rE=Array.from({length:46},(r,e)=>({left:(e*37.7+11)%100,top:(e*53.9+7)%86,size:1+e%3,delay:e%7*.7,duration:2.6+e%5*.8,dim:e%3===0}));function sE({copy:r,animate:e,installCommand:t,installCopied:n,onCopyInstallCommand:i,githubLabel:s}){const a=Ve.useRef(null);return Ve.useLayoutEffect(()=>{if(!e)return;const o=Dt.context(()=>{Dt.fromTo(".lv3-dl-inner",{autoAlpha:0,y:36},{autoAlpha:1,y:0,duration:.8,ease:"power3.out",scrollTrigger:{trigger:a.current,start:"top 72%"}}),Dt.fromTo(".lv3-dl-horizon",{opacity:.2,scaleX:.7},{opacity:1,scaleX:1,ease:"none",scrollTrigger:{trigger:a.current,start:"top 90%",end:"bottom bottom",scrub:.5}})},a);return()=>o.revert()},[e]),P.jsxs("section",{ref:a,className:"relative overflow-hidden border-t border-oai-gray-900 bg-oai-gray-950 py-24 sm:py-32",children:[P.jsx("style",{children:"@keyframes lv3-twinkle { 0%, 100% { opacity: 0.12; } 50% { opacity: 0.9; } }"}),P.jsx("div",{className:"pointer-events-none absolute inset-0","aria-hidden":"true",children:rE.map((o,l)=>P.jsx("span",{className:`absolute rounded-full ${o.dim?"bg-[color:var(--lv3-accent-soft)]":"bg-white"}`,style:{left:`${o.left}%`,top:`${o.top}%`,width:o.size,height:o.size,opacity:o.dim?.35:.5,...e?{animation:`lv3-twinkle ${o.duration}s ease-in-out ${o.delay}s infinite`}:{}}},l))}),P.jsx("div",{className:"pointer-events-none absolute -left-32 top-4 h-[26rem] w-[26rem] rounded-full opacity-30",style:{background:"radial-gradient(closest-side, var(--lv3-accent-ghost), transparent 70%)"},"aria-hidden":"true"}),P.jsx("div",{className:"pointer-events-none absolute -right-40 bottom-10 h-[30rem] w-[30rem] rounded-full opacity-30",style:{background:"radial-gradient(closest-side, var(--lv3-accent-ghost), transparent 70%)"},"aria-hidden":"true"}),P.jsx("svg",{className:"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 opacity-[0.14]",width:"920",height:"440",viewBox:"0 0 920 440",fill:"none","aria-hidden":"true",children:P.jsx("ellipse",{cx:"460",cy:"220",rx:"450",ry:"205",stroke:"var(--lv3-accent-soft)",strokeWidth:"1",strokeDasharray:"2 7"})}),P.jsx("div",{className:"lv3-dl-horizon pointer-events-none absolute inset-x-0 bottom-[-14rem] h-[24rem]",style:{background:"radial-gradient(50% 100% at 50% 100%, var(--lv3-accent-faint), transparent 70%)"},"aria-hidden":"true"}),P.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-px",style:{background:"linear-gradient(90deg, transparent, var(--lv3-accent) 35%, var(--lv3-accent-soft) 50%, var(--lv3-accent) 65%, transparent)",opacity:.5},"aria-hidden":"true"}),P.jsxs("div",{className:"lv3-dl-inner relative z-10 mx-auto flex max-w-3xl flex-col items-center px-4 text-center sm:px-6",children:[P.jsx("h2",{className:"text-balance text-3xl font-semibold leading-tight tracking-tight text-white sm:text-5xl",children:r("landing.v3.download.title")}),P.jsx("p",{className:"mt-4 max-w-xl text-base leading-relaxed text-oai-gray-400",children:r("landing.v3.download.subtitle")}),P.jsx("div",{className:"mt-9 w-full",children:P.jsx(Bm,{copy:r,installCommand:t,installCopied:n,onCopyInstallCommand:i,reduceMotion:!e})}),P.jsx("div",{className:"mt-6 w-full",children:P.jsx(km,{copy:r,githubLabel:s})})]})]})}function aE({copy:r,reduceMotion:e,screenshotMode:t,effectsReady:n,signInUrl:i,signUpUrl:s,installCommand:a,installCopied:o,onCopyInstallCommand:l}){const c=!e&&!t,[u,h]=Ve.useState(!1);Ve.useEffect(()=>{const M=()=>h(window.scrollY>10);return window.addEventListener("scroll",M,{passive:!0}),()=>window.removeEventListener("scroll",M)},[]);const f=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),{signedIn:d,loading:g}=Wm(),{openLoginModal:_}=Xm(),p=jm(),m=Number(r("landing.v3.stats.fallback_tokens"))||0,b=Number(r("landing.v3.stats.fallback_devs"))||0,A=r("landing.cta.secondary");return P.jsxs("div",{className:"relative min-h-screen bg-[color:var(--lv3-bg)] text-oai-white font-oai antialiased dark",style:ig,children:[P.jsx("header",{className:Vu("sticky top-0 z-50 transition-all duration-300",u?"bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-900":"bg-transparent border-b border-transparent"),children:P.jsxs("div",{className:"mx-auto flex h-14 max-w-7xl items-center justify-between px-4 sm:px-6",children:[P.jsxs("div",{className:"flex items-center gap-3 sm:gap-5",children:[P.jsxs(Ns,{to:s||"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",children:[P.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),P.jsx("span",{className:"whitespace-nowrap text-sm font-semibold uppercase tracking-wide text-white",children:"Token Tracker"})]}),P.jsx("div",{className:"hidden sm:block",children:P.jsx(Zm,{})})]}),P.jsxs("div",{className:"flex items-center justify-end gap-3 sm:gap-5 md:gap-6",children:[P.jsx(Ns,{to:"/leaderboard",className:"hidden select-none text-sm font-medium text-oai-gray-400 outline-none transition-colors duration-200 hover:text-white focus-visible:underline sm:inline",children:r("nav.leaderboard")}),!d&&!g&&P.jsx(Ns,{to:kf(),className:"hidden select-none text-sm font-medium text-oai-gray-400 outline-none transition-colors duration-200 hover:text-white focus-visible:underline sm:inline",children:r("landing.v2.cta.primary")}),P.jsx("div",{className:"flex items-center gap-2.5 sm:gap-3.5",children:g?P.jsx("div",{className:"h-8 w-16 animate-pulse rounded-[8px] bg-white/10","aria-hidden":!0}):d?P.jsxs(P.Fragment,{children:[P.jsx(Ns,{to:kf(),className:"inline-flex h-8 select-none items-center justify-center rounded-[8px] bg-white px-3.5 text-xs font-bold text-oai-gray-950 shadow-sm transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98]",children:r("landing.v2.cta.primary")}),P.jsx(Ym,{})]}):P.jsx("button",{type:"button",onClick:_,className:"inline-flex h-8 min-w-[80px] select-none items-center justify-center rounded-[8px] bg-white px-3.5 text-xs font-bold text-oai-gray-950 shadow-sm transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98]",children:r("header.auth.sign_in_aria")})})]})]})}),P.jsxs("main",{className:"-mt-14",children:[P.jsx(Uy,{copy:r,animate:c,effectsReady:n,stats:p,tokenFallback:m,devsFallback:b,installCommand:a,installCopied:o,onCopyInstallCommand:l,githubLabel:A}),P.jsx(Xy,{copy:r,animate:c,screenshotSrc:"/dashboard-dark.png",screenshotAlt:r("landing.screenshot.alt")}),P.jsx(Fy,{copy:r,animate:c}),P.jsx(By,{copy:r,animate:c}),P.jsx($y,{copy:r,animate:c}),P.jsx(iE,{copy:r,animate:c,stats:p,tokenFallback:m,devsFallback:b}),P.jsx(sE,{copy:r,animate:c,installCommand:a,installCopied:o,onCopyInstallCommand:l,githubLabel:A})]}),P.jsx("footer",{className:"border-t border-oai-gray-900 bg-oai-gray-950 py-12",children:P.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col items-center justify-between gap-6 px-4 text-sm text-oai-gray-400 sm:flex-row sm:px-6",children:[P.jsx("p",{children:r("landing.v2.footer.line")}),P.jsxs("div",{className:"flex items-center gap-6",children:[P.jsx("a",{href:qm,className:"font-medium text-oai-gray-400 transition-colors hover:text-white",target:"_blank",rel:"noopener noreferrer",children:r("landing.v2.nav.status")}),P.jsx("a",{href:wc,className:"font-medium text-oai-gray-400 transition-colors hover:text-white",target:"_blank",rel:"noopener noreferrer",children:r("landing.v2.nav.github")}),f&&P.jsxs(Ns,{to:i,className:"font-medium text-[color:var(--lv3-accent-soft)] transition-colors hover:text-white",children:[r("landing.cta.primary")," →"]})]})]})})]})}function oE({prefersReducedMotion:r,screenshotMode:e}){return!(e||r)}function lE(){return Ve.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function cE(r=0,e=!0){const[t,n]=Ve.useState(()=>!e);return Ve.useEffect(()=>{if(!e){n(!0);return}let i=null,s=null;const a=()=>n(!0);return typeof window<"u"&&"requestIdleCallback"in window?(s=window.requestIdleCallback(a,{timeout:r||200}),()=>{typeof window.cancelIdleCallback=="function"&&s!=null&&window.cancelIdleCallback(s)}):(i=window.setTimeout(a,r),()=>{i!=null&&window.clearTimeout(i)})},[r,e]),t}function xE({signInUrl:r,signUpUrl:e}){const t=lE(),n=Ve.useMemo(()=>typeof window>"u"?!1:$m(window.location.search),[]),i=oE({prefersReducedMotion:t,screenshotMode:n}),s=cE(250,i),a="tokentracker.dashboard.from_landing.v1";Ve.useEffect(()=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(a,"1")}catch{}},[a]);const o=Of("landing.install.command"),[l,c]=Ve.useState(!1),u=Ve.useRef(null);Ve.useEffect(()=>()=>{u.current!=null&&window.clearTimeout(u.current)},[]);const h=async()=>{await Km(o)&&(u.current!=null&&window.clearTimeout(u.current),c(!0),u.current=window.setTimeout(()=>{c(!1),u.current=null},2e3))};return P.jsx(aE,{copy:Of,reduceMotion:t,screenshotMode:n,effectsReady:s,signInUrl:r,signUpUrl:e,installCommand:o,installCopied:l,onCopyInstallCommand:h})}export{xE as LandingPage};
4312
+ `;function Ay(){if(typeof window>"u")return!0;const r=window.matchMedia?.("(max-width: 768px)")?.matches,e=(navigator.hardwareConcurrency||8)<=4;return!!(r||e)}function Ry(r,e){const t=e.flow+e.disc+e.stars,n=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=new Float32Array(t),o=new Float32Array(t),l=new Float32Array(t);for(let u=0;u<e.flow;u+=1){const h=u%r.length,f=r[h];n[u*3]=f.x,n[u*3+1]=f.y,n[u*3+2]=f.z,i[u]=Math.random(),s[u]=Math.random(),a[u]=1+Math.random()*1.9,o[u]=1,l[u]=h}for(let u=e.flow;u<e.flow+e.disc;u+=1){const h=Math.random(),f=h<.55?11*(.05+.95*Math.pow(Math.random(),.8)):h<.85?9+Math.random()*3.4:11+Math.random()*3,d=Math.random()*Math.PI*2;n[u*3]=Math.cos(d)*f,n[u*3+1]=Math.sin(d)*f,n[u*3+2]=0,i[u]=Math.random(),s[u]=Math.random(),a[u]=1.1+Math.random()*1.6,o[u]=2,l[u]=0}for(let u=e.flow+e.disc;u<t;u+=1){const h=14+Math.random()*22,f=Math.random()*Math.PI*2;n[u*3]=Math.cos(f)*h,n[u*3+1]=(Math.random()-.5)*16,n[u*3+2]=-8-Math.random()*22,i[u]=Math.random(),s[u]=Math.random(),a[u]=.5+Math.random()*1,o[u]=0,l[u]=0}const c=new Ei;return c.setAttribute("position",new Mn(n,3)),c.setAttribute("aSeed",new Mn(i,1)),c.setAttribute("aPhase",new Mn(s,1)),c.setAttribute("aSize",new Mn(a,1)),c.setAttribute("aFlow",new Mn(o,1)),c.setAttribute("aStream",new Mn(l,1)),c}function Cy({mode:r="full",progressRef:e,className:t=""}){const n=Oe.useRef(null),i=Oe.useRef([]),s=Oe.useRef(null),[a,o]=Oe.useState(!1);Oe.useEffect(()=>{if(r!=="full")return;const u=n.current;if(!u)return;let h;try{h=new _y({antialias:!1,alpha:!0,depth:!1,stencil:!1,powerPreference:"high-performance"})}catch(Te){console.warn("TokenGalaxy: WebGL unavailable, using static fallback.",Te),o(!0);return}const f=Ay(),d=Math.min(window.devicePixelRatio||1,f?1.5:2);h.setPixelRatio(d),h.setClearColor(0,0);const g=h.domElement;g.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block;",u.appendChild(g);const _=new Q_,p=new di(62,1,.1,120);p.position.set(0,0,Qt.cameraZ);const m=by(),b=Ry(m,yy({lowPower:f})),w={uTime:{value:0},uPixelRatio:{value:d},uSwirl:{value:Qt.swirl},uFlatten:{value:Qt.flatten},uTilt:{value:Qt.tilt},uYOffset:{value:Qt.yOffset},uIntro:{value:0},uOrbit:{value:0},uAnchors:{value:m.map(Te=>new Y(Te.x,Te.y,Te.z))},uGlobalAlpha:{value:0},uProgress:{value:0},uColorA:{value:new ft(Il.accent)},uColorB:{value:new ft(Il.accentSoft)},uColorC:{value:new ft(Il.glint)}},M=new yi({vertexShader:Ty,fragmentShader:wy,uniforms:w,transparent:!0,depthTest:!1,depthWrite:!1,blending:Jc}),y=new ux(b,M);y.frustumCulled=!1,_.add(y);const T=Rf(),A=Math.cos(Qt.tilt),v=Math.sin(Qt.tilt),E=new Y(0,-v,A),C=new Y(0,Qt.yOffset,0),L=new Y(0,A,v),N=new Y,q=new Y,W=new Y,B=(Te,V,Je)=>{N.set(Te/50-1,1-V/50,.5).unproject(p),q.copy(N).sub(p.position).normalize();const $e=E.dot(q);if(Math.abs($e)<1e-6)return Je.set(0,0,0);const pt=E.dot(W.copy(C).sub(p.position))/$e;return N.copy(p.position).addScaledVector(q,pt),W.copy(N).sub(C),Je.set(N.x,W.dot(L)/Qt.flatten,0)};let G=0,I=0;function $(){const Te=u.clientWidth||1,V=u.clientHeight||1;if(Math.abs(Te-G)<1&&Math.abs(V-I)<1)return;G=Te,I=V,h.setSize(Te,V,!1),p.aspect=Te/V,p.updateProjectionMatrix();const Je=window.innerHeight||1;V>Je&&(p.projectionMatrix.elements[9]=-(V-Je)/V,p.projectionMatrixInverse.copy(p.projectionMatrix).invert())}let j=0;const D=new ResizeObserver(()=>{cancelAnimationFrame(j),j=requestAnimationFrame($)});D.observe(u),$();const se={current:!0},he={current:!1},Ve=new IntersectionObserver(Te=>{se.current=Te[0]?.isIntersecting??!0},{threshold:0});Ve.observe(u);const He=()=>{he.current=document.hidden};document.addEventListener("visibilitychange",He,{passive:!0});const De={x:0,y:0},J={x:0,y:0},ae=Te=>{De.x=Te.clientX/window.innerWidth*2-1,De.y=Te.clientY/window.innerHeight*2-1},re=window.matchMedia?.("(hover: hover)")?.matches;re&&window.addEventListener("pointermove",ae,{passive:!0});const Re=new Sx;let Ie=0,Ee=0,Qe=0,ye=0,Ge=0;function Xe(){if(ye=requestAnimationFrame(Xe),he.current||!se.current)return;const Te=Re.getElapsedTime(),V=Math.min(Math.max(Te-Qe,.001),.033);Qe=Te;const Je=Math.min(Math.max(e?.current??0,0),1);Ge+=(Je-Ge)*(1-Math.exp(-V/.14));const $e=Ge;w.uTime.value=Te,w.uOrbit.value=Te*Qt.orbitSpeed,w.uProgress.value=$e,Ie=Math.min(1,Ie+V/.9),Ee=Math.min(1,Ee+V/Qt.introSeconds);const pt=1-Math.pow(1-Ee,3);w.uIntro.value=pt,w.uGlobalAlpha.value=Ie*(1-Or.smoothstep($e,.55,.8));const qe=1-Math.exp(-V/.22);J.x+=(De.x-J.x)*qe,J.y+=(De.y-J.y)*qe,p.position.x=J.x*1.8,p.position.y=Qt.cameraY-J.y*1.2-$e*4.5,p.position.z=Qt.cameraZ+(1-pt)*Qt.cameraDollyIn-$e*Qt.cameraPushIn;const mt=window.innerHeight||1,F=new Y(0,Qt.yOffset,0);F.applyMatrix4(p.matrixWorldInverse);const Dt=1-2*(.68*mt/I);if(p.projectionMatrix.elements[9]=p.projectionMatrix.elements[5]*F.y/-F.z-Dt,p.projectionMatrixInverse.copy(p.projectionMatrix).invert(),p.lookAt(0,0,0),h.render(_,p),s.current){const O=Or.smoothstep($e,0,.25)*(1-Or.smoothstep($e,.25,.65)),z=1-Or.smoothstep($e,.35,.75),K=1+$e*1.2,ue=.4*Ie*z*(1+O*1.5);s.current.style.transform=`translate3d(-50%, -50%, 0) scale(${K.toFixed(3)})`,s.current.style.opacity=String(ue.toFixed(3))}const We=1+Math.pow($e,1.8)*1.5,R=Ie*(1-Or.smoothstep($e,.25,.7)),x=Or.smoothstep($e,0,.2)*(1-Or.smoothstep($e,.2,.6));for(let O=0;O<T.length;O+=1){const z=i.current[O];if(!z)continue;const K=T[O]+w.uOrbit.value,ue=Cf(K,We);B(ue.left,ue.top,w.uAnchors.value[O]);const oe=ue.left/100*G,Q=ue.top/100*I,ee=Eh(ue.top),pe=Math.min(1,Math.max(0,pt*2.6-O*.22)),Ae=ee*(.6+.4*pe)*(1-$e*.3);z.style.transform=`translate3d(${oe.toFixed(1)}px, ${Q.toFixed(1)}px, 0) translate(-50%, -50%) scale(${Ae.toFixed(3)})`,z.style.opacity=String(Math.max(0,R*pe*(.75+.25*ee)).toFixed(3));const ge=1+x*1.4,me=1+x*.6;z.style.filter=`brightness(${ge.toFixed(2)}) saturate(${me.toFixed(2)})`;const fe=(12+x*28).toFixed(0),Le=(.3+x*.6).toFixed(2);z.style.boxShadow=`0 0 ${fe}px rgba(168, 85, 247, ${Le})`}}return Xe(),()=>{cancelAnimationFrame(ye),cancelAnimationFrame(j),D.disconnect(),Ve.disconnect(),document.removeEventListener("visibilitychange",He),re&&window.removeEventListener("pointermove",ae),_.clear(),b.dispose(),M.dispose(),h.dispose(),h.forceContextLoss(),u.contains(g)&&u.removeChild(g)}},[r]);const l=r!=="full"||a,c=Ey();return P.jsxs("div",{ref:n,className:`pointer-events-none absolute inset-0 overflow-hidden ${t}`,"aria-hidden":"true","data-mode":l?"static":"webgl",children:[P.jsx("div",{ref:s,className:"absolute left-1/2 top-[68vh] h-[28rem] w-[28rem] -translate-x-1/2 -translate-y-1/2 rounded-full opacity-45",style:{background:"radial-gradient(circle, var(--lv3-bg) 6%, rgba(138, 122, 255, 0.28) 18%, rgba(138, 122, 255, 0.05) 45%, transparent 68%)"}}),l?P.jsx("div",{className:"absolute left-1/2 top-[68vh] h-[22rem] w-[52rem] max-w-[92vw] -translate-x-1/2 -translate-y-1/2 rounded-[50%] opacity-50",style:{background:"radial-gradient(ellipse at center, var(--lv3-accent-ghost) 0%, transparent 60%)",boxShadow:"inset 0 0 120px var(--lv3-accent-ghost)"}}):null,xy.map((u,h)=>P.jsxs("div",{ref:f=>{i.current[h]=f},className:"absolute left-0 top-0 hidden sm:flex h-12 w-12 items-center justify-center rounded-full border border-white/20",style:{background:"var(--lv3-orb-surface)",boxShadow:"var(--lv3-orb-shadow)",backdropFilter:"blur(10px) saturate(1.3)",WebkitBackdropFilter:"blur(10px) saturate(1.3)",...l?{left:`${c[h].left}%`,top:`${c[h].top}%`,transform:`translate(-50%, -50%) scale(${Eh(c[h].top).toFixed(2)})`,opacity:.9}:{opacity:0}},children:[l?null:P.jsx("span",{className:"absolute inset-0 animate-ping rounded-full border border-[color:var(--lv3-accent)] opacity-40",style:{animationDuration:`${2.2+h*.35}s`},"aria-hidden":"true"}),P.jsx("span",{className:"absolute left-[16%] top-[8%] h-[32%] w-[52%] rounded-full opacity-80",style:{background:"var(--lv3-orb-highlight)",filter:"blur(1.5px)"},"aria-hidden":"true"}),P.jsx("span",{className:"absolute left-[24%] top-[13%] h-[16%] w-[22%] rounded-full",style:{background:"var(--lv3-orb-glint)"},"aria-hidden":"true"}),P.jsx(Vm,{provider:u,size:19})]},u))]})}function Bm({copy:r,installCommand:e,installCopied:t,onCopyInstallCommand:n,reduceMotion:i}){return P.jsxs("div",{className:"w-full max-w-lg mx-auto",children:[P.jsxs(Dh.div,{whileHover:i?void 0:{scale:1.01,y:-1},transition:{type:"spring",stiffness:400,damping:25},className:"group relative inline-block w-full overflow-hidden rounded-2xl",style:{padding:"1.5px 0"},children:[P.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 bottom-[-11px] right-[-250%] rounded-full animate-star-movement-bottom z-0",style:{background:"radial-gradient(circle, var(--lv3-glint), transparent 10%)",animationDuration:"6s"}}),P.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 top-[-10px] left-[-250%] rounded-full animate-star-movement-top z-0",style:{background:"radial-gradient(circle, var(--lv3-glint), transparent 10%)",animationDuration:"6s"}}),P.jsxs("div",{className:"relative z-[1] flex items-center justify-between w-full bg-oai-black border border-oai-gray-800 rounded-2xl p-1.5 pl-5 shadow-2xl shadow-black/50",children:[P.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[P.jsx("span",{className:"text-oai-gray-600 font-mono select-none","aria-hidden":"true",children:"›"}),P.jsx("code",{className:"font-mono text-sm text-oai-gray-200 overflow-x-auto whitespace-nowrap py-2 [scrollbar-width:none]",children:e?e.split(" ").map((s,a)=>P.jsxs("span",{className:s==="npx"||s==="tokentracker-cli"?"text-white font-medium":s==="--yes"?"text-oai-gray-500":"text-[color:var(--lv3-accent-soft)]",children:[s," "]},a)):null})]}),P.jsx("button",{type:"button",onClick:n,"aria-label":r(t?"landing.install.action.copied":"landing.install.action.copy"),className:"shrink-0 flex h-9 w-9 items-center justify-center text-oai-gray-200 bg-oai-gray-900 border border-oai-gray-700 rounded-lg hover:bg-oai-gray-800 hover:text-white active:scale-95 transition-all duration-200 shadow-sm",children:t?P.jsx(Jm,{className:"h-4 w-4 text-[color:var(--lv3-accent-soft)]","aria-hidden":!0}):P.jsx(Qm,{className:"h-4 w-4 opacity-70","aria-hidden":!0})})]})]}),P.jsx("span",{className:"sr-only","aria-live":"polite",children:t?r("landing.install.action.copied"):""})]})}function Py(){if(typeof navigator>"u")return"other";const e=`${navigator.userAgentData?.platform??""} ${navigator.userAgent??""} ${navigator.platform??""}`.toLowerCase();return e.includes("win")?"windows":e.includes("mac")&&!e.includes("iphone")&&!e.includes("ipad")?"mac":"other"}function Th({className:r}){return P.jsx("svg",{viewBox:"0 0 384 512",className:r,fill:"currentColor","aria-hidden":"true",children:P.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function Dy({className:r}){return P.jsx("svg",{viewBox:"0 0 16 16",className:r,fill:"currentColor","aria-hidden":"true",children:P.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}function wh({className:r}){return P.jsx("svg",{viewBox:"0 0 24 24",className:r,fill:"currentColor","aria-hidden":"true",children:P.jsx("path",{d:"M3 5.46 10.2 4.5v6.92H3V5.46Zm0 13.08 7.2.96v-6.84H3v5.88Zm8.04 1.08L21 21V12.46h-9.96v7.16ZM11.04 4.38 21 3v8.46h-9.96V4.38Z"})})}function km({copy:r,githubLabel:e}){const t=Oe.useMemo(()=>Py(),[]),n={href:Ff,label:r("landing.v2.install.os_macos"),Icon:Th},i={href:Of,label:r("landing.v2.install.os_windows"),Icon:wh},s=t==="windows"?{href:Of,label:r("landing.v2.install.win_cta"),Icon:wh}:t==="mac"?{href:Ff,label:r("landing.v2.install.mac_cta"),Icon:Th}:{href:Hm,label:r("landing.v2.install.desktop_cta"),Icon:eg},o=[...(t==="windows"?[n]:t==="mac"?[i]:[n,i]).map(l=>({key:l.href,href:l.href,Icon:l.Icon,label:l.label})),{key:Ac,href:Ac,Icon:Dy,label:e}];return P.jsx("div",{className:"flex justify-center",children:P.jsxs("div",{className:"flex min-w-[16rem] flex-col items-stretch",children:[P.jsxs("a",{href:s.href,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex h-11 items-center justify-center gap-2 rounded-full bg-white px-7 text-sm font-semibold text-oai-gray-950 shadow-lg shadow-black/30 transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98]",children:[P.jsx(s.Icon,{className:"h-4 w-4"}),s.label]}),P.jsx("div",{className:"mt-3 flex gap-3",children:o.map(l=>P.jsxs("a",{href:l.href,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex h-9 flex-1 items-center justify-center gap-2 rounded-full border border-white/10 bg-oai-black/60 px-3 text-sm font-medium text-oai-gray-200 backdrop-blur-sm transition-colors hover:border-white/25 hover:text-white",children:[P.jsx(l.Icon,{className:"h-4 w-4 shrink-0 text-oai-gray-400 group-hover:text-white"}),P.jsx("span",{className:"truncate",children:l.label})]},l.key))})]})})}const Ly=1800,Ny=250;function Iy(r){return Math.round(r).toLocaleString("en-US")}function zm({value:r,animate:e=!0,durationMs:t=Ly,format:n=Iy,ratePerSec:i=0,className:s}){const a=Number(r)||0,[o,l]=Oe.useState(e?0:a),c=Oe.useRef(null),u=Oe.useRef(e?0:a),[h,f]=Oe.useState(!1);return Oe.useEffect(()=>{u.current=o},[o]),Oe.useEffect(()=>{if(!e)return;const d=c.current;if(!d||typeof IntersectionObserver>"u"){f(!0);return}const g=new IntersectionObserver(_=>f(!!_[0]?.isIntersecting),{threshold:.4});return g.observe(d),()=>g.disconnect()},[e]),Oe.useEffect(()=>{if(!e){l(a);return}if(!h)return;const d=u.current;if(d===a&&!(i>0))return;let g=0;const _=performance.now();let p=_,m=0;const b=i>0&&d>=a;let w=Math.max(d,a);const M=y=>{const T=b?1:Math.min(1,(y-_)/t);if(T<1){const v=1-Math.pow(1-T,4);l(d+(a-d)*v),p=y,g=requestAnimationFrame(M);return}if(!(i>0)){l(a);return}const A=Math.min(y-p,100)/1e3;p=y,w=Math.max(w,a)+i*A,y-m>=Ny&&(m=y,l(w)),g=requestAnimationFrame(M)};return g=requestAnimationFrame(M),()=>cancelAnimationFrame(g)},[e,h,a,t,i]),P.jsx("span",{ref:c,className:s,children:n(o)})}function Uy({copy:r,animate:e,effectsReady:t,stats:n,tokenFallback:i,devsFallback:s,installCommand:a,installCopied:o,onCopyInstallCommand:l,githubLabel:c}){const u=Oe.useRef(null),h=Oe.useRef(null),f=Oe.useRef(null),d=Oe.useRef(0);Oe.useLayoutEffect(()=>{if(!e)return;const b=Pt.context(()=>{at.create({trigger:u.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:M=>{d.current=M.progress}});const w=Pt.timeline({defaults:{ease:"none"},scrollTrigger:{trigger:u.current,start:"top top",end:"bottom top",scrub:.5}});w.to(h.current,{yPercent:-16,autoAlpha:0,duration:.3},.08),w.to(f.current,{y:-28,scale:.94,autoAlpha:0,duration:.22},.45),w.to({},{duration:.1})},u);return()=>b.revert()},[e]);const g=n.status==="ready"?n.tokenFloor:i,_=n.status==="ready"?n.totalEntries:s,p=g*.004/86400,m=e&&t?"full":"static";return P.jsx("section",{ref:u,className:"relative",children:P.jsxs("div",{className:"relative min-h-[max(100svh,52rem)]",children:[P.jsx("div",{ref:h,className:"relative z-20 mx-auto flex max-w-3xl flex-col items-center px-4 pt-28 text-center tall:pt-48 xtall:pt-56 sm:px-6 sm:pt-36 sm:xtall:pt-60",children:P.jsxs(Dh.div,{initial:e?{opacity:0,y:24}:!1,animate:{opacity:1,y:0},transition:{duration:.6},className:"flex flex-col items-center",children:[P.jsxs("p",{className:"mb-3 inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.03] px-4 py-1.5 text-[10px] font-bold uppercase tracking-[0.2em] text-oai-gray-400 tall:mb-5",children:[P.jsxs("span",{className:"relative flex h-1.5 w-1.5","aria-hidden":"true",children:[P.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-[color:var(--lv3-accent)] opacity-75"}),P.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-[color:var(--lv3-accent)]"})]}),r("landing.v3.hero.kicker")]}),P.jsxs("h1",{className:"text-balance text-4xl font-semibold leading-[1.08] tracking-tight text-white sm:text-[2.75rem] sm:tall:text-[3.25rem] sm:xtall:text-6xl lg:xtall:text-[4rem]",children:[r("landing.v2.hero.title_line1"),P.jsx("br",{}),P.jsx("span",{className:"bg-gradient-to-b from-white via-[color:var(--lv3-accent-soft)] to-[color:var(--lv3-accent)] bg-clip-text font-bold tracking-tight text-transparent",style:{WebkitTextStroke:"1px rgba(255, 255, 255, 0.12)"},children:r("landing.v2.hero.title_line2")})]}),P.jsx("div",{className:"mt-8 sm:mt-10 w-full xtall:mt-12",children:P.jsx(Bm,{copy:r,installCommand:a,installCopied:o,onCopyInstallCommand:l,reduceMotion:!e})}),P.jsx("div",{className:"mt-4 w-full xtall:mt-5",children:P.jsx(km,{copy:r,githubLabel:c})})]})}),P.jsxs("div",{className:e?"absolute inset-x-0 top-0 bottom-[-40vh] z-0":"absolute inset-0 z-0",children:[P.jsx(Cy,{mode:m,progressRef:d}),P.jsx("div",{className:"pointer-events-none absolute left-1/2 top-[68vh] z-10 -translate-x-1/2 -translate-y-1/2",children:P.jsxs("div",{ref:f,className:"flex flex-col items-center gap-2",children:[P.jsx("div",{className:"absolute -inset-x-28 -inset-y-12 -z-10",style:{backdropFilter:"blur(9px)",WebkitBackdropFilter:"blur(9px)",background:"radial-gradient(closest-side, var(--lv3-scrim), transparent 76%)",maskImage:"radial-gradient(closest-side, black 55%, transparent 100%)",WebkitMaskImage:"radial-gradient(closest-side, black 55%, transparent 100%)"},"aria-hidden":"true"}),P.jsx("p",{className:"text-[11px] font-bold uppercase tracking-[0.3em] text-oai-gray-300",children:r("landing.v3.hero.stat_label")}),P.jsx("p",{className:"font-mono text-4xl font-bold tabular-nums leading-none text-white sm:tall:text-5xl",style:{textShadow:"0 2px 24px rgba(0, 0, 0, 0.9), 0 0 90px var(--lv3-accent-faint), 0 0 30px var(--lv3-accent-ghost)"},children:P.jsx(zm,{value:g,animate:e,ratePerSec:p,format:b=>Math.round(b).toLocaleString("en-US")})}),P.jsx("p",{className:"font-mono text-sm text-oai-gray-300",children:r("landing.v3.stats.devs_syncing",{count:(Number(_)||0).toLocaleString("en-US")})})]})}),P.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24",style:{background:"linear-gradient(to bottom, transparent, var(--lv3-bg) 85%)"},"aria-hidden":"true"})]})]})})}function Fy({copy:r,animate:e}){const t=Oe.useRef(null),n=Oe.useRef(null);return Oe.useLayoutEffect(()=>{if(!e)return;const i=Pt.context(()=>{Pt.fromTo(n.current,{autoAlpha:0,y:28},{autoAlpha:1,y:0,duration:.8,ease:"power3.out",scrollTrigger:{trigger:t.current,start:"top 85%"}})},t);return()=>i.revert()},[e]),P.jsx("section",{ref:t,className:"relative border-y border-oai-gray-900 bg-oai-gray-950/50 py-12 lg:py-16",children:P.jsx("div",{ref:n,className:"mx-auto max-w-6xl px-4 sm:px-6",children:P.jsxs("div",{className:"flex flex-col justify-between gap-10 md:flex-row md:items-center",children:[P.jsxs("div",{className:"shrink-0 md:max-w-[16rem]",children:[P.jsx("p",{className:"text-sm font-semibold uppercase tracking-wider text-oai-gray-400",children:r("landing.v2.models.title")}),P.jsx("p",{className:"mt-2 text-xs leading-relaxed text-oai-gray-500",children:r("landing.v3.tools.count",{count:kf.length})})]}),P.jsx("div",{className:"flex justify-center md:justify-end",children:P.jsx(tg,{logos:kf,columnCount:6})})]})})})}const wc=["step1","step2","step3","step4"],Oy=[34,58,42,88,66,100,74];function Wo({title:r,children:e,accent:t=!1}){return P.jsxs("div",{className:"flex h-full w-full flex-col overflow-hidden rounded-xl border border-oai-gray-800 bg-[color:var(--lv3-panel)] shadow-2xl shadow-black/40",style:t?{borderColor:"var(--lv3-line)",boxShadow:"0 24px 80px -32px var(--lv3-accent-faint)"}:void 0,children:[P.jsxs("div",{className:"flex items-center gap-2 border-b border-oai-gray-800/80 px-4 py-2.5",children:[P.jsxs("span",{className:"flex gap-1.5","aria-hidden":"true",children:[P.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-700"}),P.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-700"}),P.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-700"})]}),P.jsx("span",{className:"ml-1 font-mono text-[10px] uppercase tracking-widest text-oai-gray-500",children:r})]}),P.jsx("div",{className:"flex flex-1 flex-col justify-center px-5 py-5 font-mono text-xs leading-loose sm:px-6",children:e})]})}function Ah({index:r}){return r===0?P.jsxs(Wo,{title:"terminal",children:[P.jsxs("p",{className:"text-oai-gray-200",children:[P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"$"})," claude ",P.jsx("span",{className:"text-oai-gray-500",children:'"refactor the parser"'})]}),P.jsx("p",{className:"mt-2 text-oai-gray-500",children:"⏺ thinking…"}),P.jsx("p",{className:"text-oai-gray-500",children:"⏺ editing src/lib/rollout.js"}),P.jsx("p",{className:"mt-2 text-oai-gray-300",children:"✓ 3 files changed"})]}):r===1?P.jsxs(Wo,{title:"session log · last turn",children:[P.jsx("p",{className:"text-oai-gray-500",children:'"usage": {'}),P.jsxs("p",{className:"pl-4 text-oai-gray-300",children:['"input_tokens": ',P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"12,482"}),","]}),P.jsxs("p",{className:"pl-4 text-oai-gray-300",children:['"output_tokens": ',P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"3,067"}),","]}),P.jsxs("p",{className:"pl-4 text-oai-gray-300",children:['"cache_read": ',P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"88,214"})]}),P.jsx("p",{className:"text-oai-gray-500",children:"}"})]}):r===2?P.jsxs(Wo,{title:"~/.tokentracker/queue.jsonl",children:[P.jsx("p",{className:"truncate text-oai-gray-500",children:'{"source":"codex","total_tokens":91406…'}),P.jsx("p",{className:"truncate text-oai-gray-500",children:'{"source":"cursor","total_tokens":18220…'}),P.jsxs("p",{className:"truncate text-oai-gray-300",children:['{"source":"claude","total_tokens":',P.jsx("span",{className:"text-[color:var(--lv3-accent-soft)]",children:"103,763"}),"…"]}),P.jsx("p",{className:"mt-3 text-[10px] uppercase tracking-widest text-[color:var(--lv3-accent-soft)]",children:"▌ appended locally"})]}):P.jsxs(Wo,{title:"localhost:7680",accent:!0,children:[P.jsx("div",{className:"flex h-24 items-end gap-2","aria-hidden":"true",children:Oy.map((e,t)=>P.jsx("span",{className:"lv3-how-bar w-full origin-bottom rounded-sm",style:{height:`${e}%`,background:t===5?"var(--lv3-accent)":"var(--lv3-accent-faint)"}},t))}),P.jsx("p",{className:"mt-4 text-[10px] uppercase tracking-widest text-oai-gray-500",children:"total tokens"}),P.jsx("p",{className:"text-lg font-bold tabular-nums text-white",children:"6,830,736,916"})]})}function Rh({copy:r,stepKey:e,index:t}){return P.jsxs("div",{className:"lv3-how-step flex gap-4",children:[P.jsx("span",{className:"relative mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-oai-gray-700 bg-oai-gray-950 font-mono text-[10px] font-bold text-oai-gray-300","aria-hidden":"true",children:String(t+1).padStart(2,"0")}),P.jsxs("div",{children:[P.jsx("h3",{className:"text-sm font-semibold text-white",children:r(`landing.v3.how.${e}.title`)}),P.jsx("p",{className:"mt-1 text-sm leading-relaxed text-oai-gray-400",children:r(`landing.v3.how.${e}.body`)})]})]})}function By({copy:r,animate:e}){const t=Oe.useRef(null);return Oe.useLayoutEffect(()=>{if(!e)return;const n=Pt.context(()=>{Pt.matchMedia().add("(min-width: 1024px)",()=>{const s=Pt.utils.toArray(".lv3-how-scene"),a=Pt.utils.toArray(".lv3-how-desktop .lv3-how-step");Pt.set(s.slice(1),{autoAlpha:0,y:28}),Pt.set(a.slice(1),{opacity:.35});const o=Pt.timeline({defaults:{ease:"none"},scrollTrigger:{trigger:t.current,pin:!0,scrub:.8,start:"top top",end:"+=240%",anticipatePin:1}});for(let l=1;l<s.length;l+=1)o.to(s[l-1],{autoAlpha:0,y:-24,duration:.62},l),o.fromTo(s[l],{autoAlpha:0,y:24},{autoAlpha:1,y:0,duration:.62},l+.12),o.to(a[l-1],{opacity:.35,duration:.45},l),o.to(a[l],{opacity:1,duration:.45},l+.12);o.fromTo(".lv3-how-bar",{scaleY:.1},{scaleY:1,duration:.5,stagger:.05},s.length-1+.35),o.to(".lv3-how-progress",{scaleY:1,duration:s.length},0),o.to({},{duration:.35})})},t);return()=>n.revert()},[e]),P.jsx("section",{ref:t,className:"relative overflow-hidden bg-oai-gray-950",children:P.jsxs("div",{className:"mx-auto flex min-h-[100vh] max-w-6xl flex-col justify-center px-4 py-20 sm:px-6 lg:py-0",children:[P.jsxs("div",{className:"mb-12 max-w-2xl lg:mb-16",children:[P.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-[color:var(--lv3-accent-soft)]",children:r("landing.v3.how.kicker")}),P.jsx("h2",{className:"mt-4 text-balance text-3xl font-semibold leading-tight tracking-tight text-white sm:text-4xl",children:r("landing.v3.how.title")}),P.jsx("p",{className:"mt-4 text-base leading-relaxed text-oai-gray-400",children:r("landing.v3.how.subtitle")})]}),P.jsxs("div",{className:"lv3-how-desktop hidden grid-cols-12 items-center gap-12 lg:grid",children:[P.jsxs("div",{className:"relative col-span-5 space-y-9 pl-1",children:[P.jsx("span",{className:"absolute bottom-3 left-[17px] top-3 w-px origin-top bg-oai-gray-800","aria-hidden":"true",children:P.jsx("span",{className:"lv3-how-progress block h-full w-full origin-top scale-y-0",style:{background:"linear-gradient(to bottom, var(--lv3-accent), var(--lv3-accent-soft))"}})}),wc.map((n,i)=>P.jsx(Rh,{copy:r,stepKey:n,index:i},n))]}),P.jsx("div",{className:"relative col-span-7 h-[420px]",children:wc.map((n,i)=>P.jsx("div",{className:"lv3-how-scene absolute inset-0",children:P.jsx(Ah,{index:i})},n))})]}),P.jsx("div",{className:"space-y-10 lg:hidden",children:wc.map((n,i)=>P.jsxs("div",{className:"space-y-4",children:[P.jsx(Rh,{copy:r,stepKey:n,index:i}),P.jsx("div",{className:"h-64",children:P.jsx(Ah,{index:i})})]},n))})]})})}function ky({children:r,className:e="",spotlightColor:t="rgba(138, 122, 255, 0.12)",...n}){const i=Oe.useRef(null),[s,a]=Oe.useState({x:0,y:0}),[o,l]=Oe.useState(!1),c=u=>{if(!i.current)return;const h=i.current.getBoundingClientRect();a({x:u.clientX-h.left,y:u.clientY-h.top})};return P.jsxs("div",{ref:i,onPointerMove:c,onPointerEnter:()=>l(!0),onPointerLeave:()=>l(!1),className:Hu("relative overflow-hidden rounded-xl border border-oai-gray-800 bg-[#080808] p-5 shadow-2xl transition-all duration-300",e),...n,children:[P.jsx("div",{className:"pointer-events-none absolute -inset-px rounded-xl opacity-0 transition-opacity duration-300 z-0",style:{opacity:o?1:0,background:`radial-gradient(350px circle at ${s.x}px ${s.y}px, ${t}, transparent 80%)`}}),P.jsx("div",{className:"relative z-10 w-full h-full",children:r})]})}const zy=["limits","heatmap","devices"];function Gy(){return P.jsxs("svg",{viewBox:"0 0 48 24",className:"h-6 w-12",fill:"none","aria-hidden":"true",children:[P.jsx("path",{d:"M2 22 A 22 22 0 0 1 46 22",stroke:"var(--lv3-line)",strokeWidth:"3",strokeLinecap:"round"}),P.jsx("path",{d:"M2 22 A 22 22 0 0 1 32 4.5",stroke:"var(--lv3-accent)",strokeWidth:"3",strokeLinecap:"round"}),P.jsx("circle",{cx:"32",cy:"4.5",r:"2.6",fill:"var(--lv3-accent-soft)"})]})}function Vy(){const r=[.15,.5,.9,.3,.7,.2,1,.45,.6,.25,.8,.35];return P.jsx("div",{className:"grid w-12 grid-cols-6 gap-[3px]","aria-hidden":"true",children:r.map((e,t)=>P.jsx("span",{className:"h-[7px] w-[7px] rounded-[2px]",style:{background:"var(--lv3-accent)",opacity:.15+e*.85}},t))})}function Hy(){return P.jsxs("svg",{viewBox:"0 0 48 24",className:"h-6 w-12",fill:"none",stroke:"var(--lv3-accent-soft)",strokeWidth:"2","aria-hidden":"true",children:[P.jsx("rect",{x:"2",y:"3",width:"24",height:"15",rx:"2"}),P.jsx("path",{d:"M10 21h8",strokeLinecap:"round"}),P.jsx("rect",{x:"33",y:"6",width:"12",height:"16",rx:"2.5",stroke:"var(--lv3-accent)"})]})}const Wy={limits:Gy,heatmap:Vy,devices:Hy};function Xy({copy:r,animate:e,screenshotSrc:t,screenshotAlt:n}){const i=Oe.useRef(null),s=Oe.useRef(null);return Oe.useLayoutEffect(()=>{if(!e)return;const a=Pt.context(()=>{Pt.fromTo(".lv3-cap-header",{y:160,autoAlpha:0},{y:0,autoAlpha:1,ease:"power1.out",scrollTrigger:{trigger:i.current,start:"top bottom",end:"top 25%",scrub:.5}}),Pt.fromTo(".lv3-cap-card",{autoAlpha:0,y:110},{autoAlpha:1,y:0,ease:"power1.out",stagger:.1,scrollTrigger:{trigger:i.current,start:"top 85%",end:"top 15%",scrub:.5}}),Pt.fromTo(s.current,{rotateX:16,y:90,autoAlpha:.35},{rotateX:0,y:0,autoAlpha:1,ease:"none",scrollTrigger:{trigger:s.current,start:"top 95%",end:"top 40%",scrub:.5}})},i);return()=>a.revert()},[e]),P.jsxs("section",{ref:i,className:"relative bg-transparent py-20 sm:py-28 lg:py-36",children:[P.jsx("div",{className:"pointer-events-none absolute -top-40 left-1/2 h-80 w-[60rem] -translate-x-1/2 rounded-[50%] opacity-20",style:{background:"radial-gradient(ellipse at center, var(--lv3-accent), transparent 65%)",filter:"blur(120px)"},"aria-hidden":"true"}),P.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[P.jsxs("div",{className:"max-w-2xl lv3-cap-header",children:[P.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-[color:var(--lv3-accent-soft)]",children:r("landing.v3.cap.kicker")}),P.jsx("h2",{className:"mt-4 text-balance text-3xl font-semibold leading-tight tracking-tight text-white sm:text-4xl",children:r("landing.v3.cap.title")}),P.jsx("p",{className:"mt-4 text-base leading-relaxed text-oai-gray-400",children:r("landing.v3.cap.subtitle")})]}),P.jsx("div",{className:"mt-12 grid grid-cols-1 gap-5 sm:grid-cols-3",children:zy.map(a=>{const o=Wy[a];return P.jsxs(ky,{className:"lv3-cap-card p-6",children:[P.jsx(o,{}),P.jsx("h3",{className:"mt-5 text-sm font-semibold text-white",children:r(`landing.v3.cap.${a}.title`)}),P.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-400",children:r(`landing.v3.cap.${a}.body`)})]},a)})}),P.jsx("div",{className:"mt-16 sm:mt-20",style:{perspective:"1400px"},children:P.jsx("div",{ref:s,className:"relative rounded-xl p-[1px] shadow-2xl",style:{transformStyle:"preserve-3d",background:"linear-gradient(to bottom, var(--lv3-line), var(--lv3-accent-ghost) 40%, transparent)",boxShadow:"0 24px 90px -20px var(--lv3-accent-faint), 0 4px 20px rgba(0,0,0,0.4)"},children:P.jsxs("div",{className:"relative overflow-hidden rounded-[11px] bg-oai-gray-950",children:[P.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-20 h-40",style:{background:"linear-gradient(to bottom, var(--lv3-accent-faint) 0%, transparent 100%)",mixBlendMode:"screen"}}),P.jsx("img",{src:t,alt:n,className:"relative z-10 block h-auto w-full object-cover",loading:"lazy",decoding:"async",width:2496,height:1730})]})})})]})]})}const Yy=["p1","p2","p3"];function qy(r){if(typeof Intl<"u"&&Intl.Segmenter){const e=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(e.segment(r),({segment:t,isWordLike:n})=>({text:t,isWordLike:!!(n??t.trim())}))}return r.includes(" ")?r.split(/(\s+)/).map(e=>({text:e,isWordLike:!!e.trim()})):Array.from(r).map(e=>({text:e,isWordLike:/[\p{L}\p{N}]/u.test(e)}))}function $y({copy:r,animate:e}){const t=Oe.useRef(null),n=r("landing.v3.privacy.title"),i=qy(n),s=Math.max(0,i.filter(o=>o.isWordLike).length-2);let a=0;return Oe.useLayoutEffect(()=>{if(!e)return;const o=Pt.context(()=>{Pt.fromTo(".lv3-privacy-word",{autoAlpha:0,y:26,rotateX:-35},{autoAlpha:1,y:0,rotateX:0,duration:.7,stagger:.07,ease:"power3.out",scrollTrigger:{trigger:t.current,start:"top 68%"}}),Pt.fromTo(".lv3-privacy-chip",{autoAlpha:0,y:14},{autoAlpha:1,y:0,duration:.5,stagger:.1,delay:.4,ease:"power2.out",scrollTrigger:{trigger:t.current,start:"top 68%"}})},t);return()=>o.revert()},[e,n]),P.jsx("section",{ref:t,className:"relative overflow-hidden border-t border-oai-gray-900 py-24 sm:py-32 lg:py-44",style:{background:"radial-gradient(60rem 30rem at 50% 120%, var(--lv3-accent-ghost), transparent 70%)"},children:P.jsxs("div",{className:"mx-auto max-w-4xl px-4 text-center sm:px-6",style:{perspective:"900px"},children:[P.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.3em] text-[color:var(--lv3-accent-soft)]",children:r("landing.v3.privacy.kicker")}),P.jsx("h2",{className:"mt-6 text-balance text-4xl font-semibold leading-[1.12] tracking-tight text-white sm:text-5xl lg:text-6xl",children:i.map((o,l)=>{const c=o.isWordLike?a++:-1;return P.jsx("span",{className:"lv3-privacy-word inline-block whitespace-pre",children:P.jsx("span",{className:o.isWordLike&&c>=s?"bg-gradient-to-b from-[color:var(--lv3-accent-soft)] to-[color:var(--lv3-accent)] bg-clip-text text-transparent":void 0,children:o.text})},l)})}),P.jsx("p",{className:"mx-auto mt-6 max-w-xl text-base leading-relaxed text-oai-gray-400",children:r("landing.v2.distill.body")}),P.jsx("div",{className:"mt-10 flex flex-wrap items-center justify-center gap-3",children:Yy.map(o=>P.jsxs("span",{className:"lv3-privacy-chip inline-flex items-center gap-2 rounded-full border border-oai-gray-800 bg-oai-black px-4 py-2 font-mono text-[11px] uppercase tracking-widest text-oai-gray-300",children:[P.jsx("span",{className:"h-1 w-1 rounded-full bg-[color:var(--lv3-accent)]","aria-hidden":"true"}),r(`landing.v3.privacy.${o}`)]},o))})]})})}function Zy(r){const e=r.match(/([\d.]+)\s*([\d.]+)%?\s*([\d.]+)%?/);return e?{h:parseFloat(e[1]),s:parseFloat(e[2]),l:parseFloat(e[3])}:{h:247,s:100,l:74}}function Ky(r,e){const{h:t,s:n,l:i}=Zy(r),s=`${t}deg ${n}% ${i}%`;return[[0,0,0,1,100,!0],[0,0,1,0,60,!0],[0,0,3,0,50,!0],[0,0,6,0,40,!0],[0,0,15,0,30,!0],[0,0,25,2,20,!0],[0,0,50,2,10,!0],[0,0,1,0,60,!1],[0,0,3,0,50,!1],[0,0,6,0,40,!1],[0,0,15,0,30,!1],[0,0,25,2,20,!1],[0,0,50,2,10,!1]].map(([o,l,c,u,h,f])=>{const d=Math.min(h*e,100);return`${f?"inset ":""}${o}px ${l}px ${c}px ${u}px hsl(${s} / ${d}%)`}).join(", ")}function Gm(r){return 1-Math.pow(1-r,3)}function Ch(r){return r*r*r}function Xo({start:r=0,end:e=100,duration:t=1e3,delay:n=0,ease:i=Gm,onUpdate:s,onEnd:a}){const o=performance.now()+n;function l(){const c=performance.now()-o,u=Math.min(c/t,1);s(r+(e-r)*i(u)),u<1?requestAnimationFrame(l):a&&a()}setTimeout(()=>requestAnimationFrame(l),n)}const jy=["80% 55%","69% 34%","8% 6%","41% 38%","86% 85%","82% 18%","51% 4%"],Jy=[0,1,2,0,1,2,1];function Qy(r){const e=[];for(let t=0;t<7;t++){const n=r[Math.min(Jy[t],r.length-1)];e.push(`radial-gradient(at ${jy[t]}, ${n} 0px, transparent 50%)`)}return e.push(`linear-gradient(${r[0]} 0 100%)`),e}const eE=({children:r,className:e="",edgeSensitivity:t=30,glowColor:n="247 100 74",backgroundColor:i="#09090b",borderRadius:s=16,glowRadius:a=35,glowIntensity:o=1,coneSpread:l=25,animated:c=!1,colors:u=["#8a7aff","#f472b6","#38bdf8"],fillOpacity:h=.45})=>{const f=Oe.useRef(null),[d,g]=Oe.useState(!1),[_,p]=Oe.useState(45),[m,b]=Oe.useState(0),[w,M]=Oe.useState(!1),y=Oe.useCallback(I=>{const{width:$,height:j}=I.getBoundingClientRect();return[$/2,j/2]},[]),T=Oe.useCallback((I,$,j)=>{const[D,se]=y(I),he=$-D,Ve=j-se;let He=1/0,De=1/0;return he!==0&&(He=D/Math.abs(he)),Ve!==0&&(De=se/Math.abs(Ve)),Math.min(Math.max(1/Math.min(He,De),0),1)},[y]),A=Oe.useCallback((I,$,j)=>{const[D,se]=y(I),he=$-D,Ve=j-se;if(he===0&&Ve===0)return 0;let De=Math.atan2(Ve,he)*(180/Math.PI)+90;return De<0&&(De+=360),De},[y]),v=Oe.useCallback(I=>{const $=f.current;if(!$)return;const j=$.getBoundingClientRect(),D=I.clientX-j.left,se=I.clientY-j.top;b(T($,D,se)),p(A($,D,se))},[T,A]);Oe.useEffect(()=>{if(!c)return;const I=110,$=465;M(!0),p(I),Xo({duration:500,onUpdate:j=>b(j/100)}),Xo({ease:Ch,duration:1500,end:50,onUpdate:j=>{p(($-I)*(j/100)+I)}}),Xo({ease:Gm,delay:1500,duration:2250,start:50,end:100,onUpdate:j=>{p(($-I)*(j/100)+I)}}),Xo({ease:Ch,delay:2500,duration:1500,start:100,end:0,onUpdate:j=>b(j/100),onEnd:()=>M(!1)})},[c]);const E=t+20,C=d||w,L=C?Math.max(0,(m*100-E)/(100-E)):0,N=C?Math.max(0,(m*100-t)/(100-t)):0,q=Qy(u),W=q.map(I=>`${I} border-box`),B=q.map(I=>`${I} padding-box`),G=`${_.toFixed(3)}deg`;return P.jsxs("div",{ref:f,onPointerMove:v,onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1),className:Hu("relative grid isolate border border-white/10",e),style:{background:i,borderRadius:`${s}px`,transform:"translate3d(0, 0, 0.01px)",boxShadow:"rgba(0,0,0,0.2) 0 4px 12px, rgba(0,0,0,0.3) 0 16px 48px"},children:[P.jsx("div",{className:"absolute inset-0 rounded-[inherit] -z-[1]",style:{border:"1px solid transparent",background:[`linear-gradient(${i} 0 100%) padding-box`,"linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",...W].join(", "),opacity:L,maskImage:`conic-gradient(from ${G} at center, black ${l}%, transparent ${l+15}%, transparent ${100-l-15}%, black ${100-l}%)`,WebkitMaskImage:`conic-gradient(from ${G} at center, black ${l}%, transparent ${l+15}%, transparent ${100-l-15}%, black ${100-l}%)`,transition:C?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),P.jsx("div",{className:"absolute inset-0 rounded-[inherit] -z-[1]",style:{border:"1px solid transparent",background:B.join(", "),maskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${G} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),WebkitMaskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${G} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),maskComposite:"subtract, add, add, add, add, add",WebkitMaskComposite:"source-out, source-over, source-over, source-over, source-over, source-over",opacity:L*h,mixBlendMode:"soft-light",transition:C?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),P.jsx("span",{className:"absolute pointer-events-none z-[1] rounded-[inherit]",style:{inset:`${-a}px`,maskImage:`conic-gradient(from ${G} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,WebkitMaskImage:`conic-gradient(from ${G} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,opacity:N,mixBlendMode:"plus-lighter",transition:C?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"},children:P.jsx("span",{className:"absolute rounded-[inherit]",style:{inset:`${a}px`,boxShadow:Ky(n,o)}})}),P.jsx("div",{className:"flex flex-col relative overflow-hidden z-[1] w-full h-full",style:{borderRadius:`${Math.max(0,s-1)}px`},children:r})]})};function Ph(r,e){return(r?.display_name||"").trim()||e("landing.v3.leaderboard.anonymous")}function tE({entry:r,rank:e,maxTokens:t,copy:n,animate:i}){const s=e===1,a=Number(r?.total_tokens)||0,o=t>0?Math.max(6,Math.round(a/t*100)):0;return P.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-4 transition-colors hover:bg-white/[0.02] sm:px-5",children:[P.jsxs("div",{className:"flex min-w-0 items-center gap-3.5",children:[P.jsx("span",{className:`w-5 font-mono text-xs font-bold ${s?"text-[color:var(--lv3-accent-soft)]":"text-oai-gray-500"}`,children:String(e).padStart(2,"0")}),r?.avatar_url?P.jsx("img",{src:r.avatar_url,alt:"",width:24,height:24,loading:"lazy",className:"h-6 w-6 shrink-0 rounded-full border border-oai-gray-800 object-cover"}):P.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-oai-gray-800 bg-oai-gray-900 font-mono text-[10px] font-bold text-oai-gray-400","aria-hidden":"true",children:Ph(r,n).charAt(0).toUpperCase()}),P.jsx("span",{className:`truncate text-sm tracking-wide ${s?"font-bold text-white":"font-semibold text-oai-gray-200"}`,children:Ph(r,n)})]}),P.jsxs("div",{className:"flex shrink-0 items-center gap-5",children:[P.jsx("span",{className:"hidden h-[2px] w-16 overflow-hidden rounded-full bg-oai-gray-900 sm:block","aria-hidden":"true",children:P.jsx("span",{className:"block h-full rounded-full",style:{width:`${o}%`,background:s?"var(--lv3-accent)":ln.line}})}),P.jsx("span",{className:`font-mono text-sm leading-none tabular-nums ${s?"font-semibold text-white":"font-medium text-oai-gray-300"}`,children:P.jsx(zm,{value:a,animate:i,format:l=>Lh(Math.round(l))})})]})]})}function nE(){return P.jsxs("div",{className:"flex items-center justify-between px-4 py-4 sm:px-5",children:[P.jsxs("div",{className:"flex items-center gap-3.5",children:[P.jsx("span",{className:"h-3 w-5 animate-pulse rounded bg-white/10"}),P.jsx("span",{className:"h-6 w-6 animate-pulse rounded-full bg-white/10"}),P.jsx("span",{className:"h-3 w-28 animate-pulse rounded bg-white/10"})]}),P.jsx("span",{className:"h-3 w-16 animate-pulse rounded bg-white/10"})]})}function iE({copy:r,animate:e,stats:t,tokenFallback:n,devsFallback:i}){const s=Oe.useRef(null);Oe.useLayoutEffect(()=>{if(!e)return;const h=Pt.context(()=>{Pt.fromTo(".lv3-lb-col",{autoAlpha:0,y:30},{autoAlpha:1,y:0,duration:.75,stagger:.14,ease:"power3.out",scrollTrigger:{trigger:s.current,start:"top 75%"}})},s);return()=>h.revert()},[e]);const a=t.status==="ready",o=a?t.top:[],l=o.length&&Number(o[0]?.total_tokens)||0,c=a?t.totalEntries:i,u=a?t.tokenFloor:n;return P.jsx("section",{ref:s,className:"relative border-t border-oai-gray-900 bg-oai-gray-950 py-16 sm:py-24 lg:py-32",children:P.jsx("div",{className:"relative z-10 mx-auto max-w-6xl px-4 sm:px-6",children:P.jsxs("div",{className:"grid grid-cols-1 items-center gap-10 sm:gap-12 lg:grid-cols-12 lg:gap-8",children:[P.jsxs("div",{className:"lv3-lb-col space-y-6 text-left lg:col-span-5",children:[P.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-oai-gray-800 bg-oai-black px-3 py-1 text-[10px] font-bold uppercase tracking-widest text-oai-gray-400",children:[P.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":"true",children:[P.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-[color:var(--lv3-accent)] opacity-75"}),P.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-[color:var(--lv3-accent)]"})]}),r("landing.v2.leaderboard.kicker")]}),P.jsx("h2",{className:"text-balance text-3xl font-semibold leading-tight tracking-tight text-white sm:text-4xl",children:r("landing.v2.leaderboard.title")}),P.jsx("p",{className:"text-base leading-relaxed text-oai-gray-400",children:r("landing.v2.leaderboard.subtitle")}),P.jsx("div",{className:"pt-4",children:P.jsx(Is,{to:"/leaderboard",className:"inline-flex h-9 items-center justify-center whitespace-nowrap rounded-[8px] bg-white px-6 text-xs font-bold text-oai-gray-950 shadow-sm transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98] select-none",children:r("landing.v2.leaderboard.view_more")})})]}),P.jsx("div",{className:"lv3-lb-col w-full lg:col-span-7",children:P.jsxs(eE,{edgeSensitivity:30,glowColor:"138 122 255",backgroundColor:ln.panel,borderRadius:16,glowRadius:35,glowIntensity:1,coneSpread:25,animated:!1,colors:[ln.accent,ln.accentSoft,ln.glint],className:"w-full",children:[P.jsxs("div",{className:"flex select-none items-center justify-between border-b border-oai-gray-800/80 bg-white/[0.025] px-4 py-3 text-[10px] font-bold uppercase tracking-widest text-oai-gray-500 sm:px-5",children:[P.jsx("span",{children:r("landing.v3.leaderboard.panel_title")}),P.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[color:var(--lv3-accent-soft)]",children:[P.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-[color:var(--lv3-accent)]","aria-hidden":"true"}),r("landing.v3.leaderboard.live")]})]}),P.jsx("div",{className:"divide-y divide-oai-gray-800/60",children:a?o.map((h,f)=>P.jsx(tE,{entry:h,rank:f+1,maxTokens:l,copy:r,animate:e},h?.user_id||f)):[0,1,2].map(h=>P.jsx(nE,{},h))}),P.jsxs("div",{className:"flex select-none items-center justify-between border-t border-oai-gray-800/80 bg-black/[0.15] px-4 py-2.5 font-mono text-[9px] uppercase tracking-widest text-oai-gray-500 sm:px-5",children:[P.jsx("span",{children:r("landing.v3.stats.devs_syncing",{count:(Number(c)||0).toLocaleString("en-US")})}),P.jsx("span",{children:r("landing.v3.leaderboard.tokens_synced",{count:`${Lh(Number(u)||0)}+`})})]})]})})]})})})}const rE=Array.from({length:46},(r,e)=>({left:(e*37.7+11)%100,top:(e*53.9+7)%86,size:1+e%3,delay:e%7*.7,duration:2.6+e%5*.8,dim:e%3===0}));function sE({copy:r,animate:e,installCommand:t,installCopied:n,onCopyInstallCommand:i,githubLabel:s}){const a=Oe.useRef(null);return Oe.useLayoutEffect(()=>{if(!e)return;const o=Pt.context(()=>{Pt.fromTo(".lv3-dl-inner",{autoAlpha:0,y:36},{autoAlpha:1,y:0,duration:.8,ease:"power3.out",scrollTrigger:{trigger:a.current,start:"top 72%"}}),Pt.fromTo(".lv3-dl-horizon",{opacity:.2,scaleX:.7},{opacity:1,scaleX:1,ease:"none",scrollTrigger:{trigger:a.current,start:"top 90%",end:"bottom bottom",scrub:.5}})},a);return()=>o.revert()},[e]),P.jsxs("section",{ref:a,className:"relative overflow-hidden border-t border-oai-gray-900 bg-oai-gray-950 py-24 sm:py-32",children:[P.jsx("style",{children:"@keyframes lv3-twinkle { 0%, 100% { opacity: 0.12; } 50% { opacity: 0.9; } }"}),P.jsx("div",{className:"pointer-events-none absolute inset-0","aria-hidden":"true",children:rE.map((o,l)=>P.jsx("span",{className:`absolute rounded-full ${o.dim?"bg-[color:var(--lv3-accent-soft)]":"bg-white"}`,style:{left:`${o.left}%`,top:`${o.top}%`,width:o.size,height:o.size,opacity:o.dim?.35:.5,...e?{animation:`lv3-twinkle ${o.duration}s ease-in-out ${o.delay}s infinite`}:{}}},l))}),P.jsx("div",{className:"pointer-events-none absolute -left-32 top-4 h-[26rem] w-[26rem] rounded-full opacity-30",style:{background:"radial-gradient(closest-side, var(--lv3-accent-ghost), transparent 70%)"},"aria-hidden":"true"}),P.jsx("div",{className:"pointer-events-none absolute -right-40 bottom-10 h-[30rem] w-[30rem] rounded-full opacity-30",style:{background:"radial-gradient(closest-side, var(--lv3-accent-ghost), transparent 70%)"},"aria-hidden":"true"}),P.jsx("svg",{className:"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 opacity-[0.14]",width:"920",height:"440",viewBox:"0 0 920 440",fill:"none","aria-hidden":"true",children:P.jsx("ellipse",{cx:"460",cy:"220",rx:"450",ry:"205",stroke:"var(--lv3-accent-soft)",strokeWidth:"1",strokeDasharray:"2 7"})}),P.jsx("div",{className:"lv3-dl-horizon pointer-events-none absolute inset-x-0 bottom-[-14rem] h-[24rem]",style:{background:"radial-gradient(50% 100% at 50% 100%, var(--lv3-accent-faint), transparent 70%)"},"aria-hidden":"true"}),P.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-px",style:{background:"linear-gradient(90deg, transparent, var(--lv3-accent) 35%, var(--lv3-accent-soft) 50%, var(--lv3-accent) 65%, transparent)",opacity:.5},"aria-hidden":"true"}),P.jsxs("div",{className:"lv3-dl-inner relative z-10 mx-auto flex max-w-3xl flex-col items-center px-4 text-center sm:px-6",children:[P.jsx("h2",{className:"text-balance text-3xl font-semibold leading-tight tracking-tight text-white sm:text-5xl",children:r("landing.v3.download.title")}),P.jsx("p",{className:"mt-4 max-w-xl text-base leading-relaxed text-oai-gray-400",children:r("landing.v3.download.subtitle")}),P.jsx("div",{className:"mt-9 w-full",children:P.jsx(Bm,{copy:r,installCommand:t,installCopied:n,onCopyInstallCommand:i,reduceMotion:!e})}),P.jsx("div",{className:"mt-6 w-full",children:P.jsx(km,{copy:r,githubLabel:s})})]})]})}function aE({copy:r,reduceMotion:e,screenshotMode:t,effectsReady:n,signInUrl:i,signUpUrl:s,installCommand:a,installCopied:o,onCopyInstallCommand:l}){const c=!e&&!t,[u,h]=Oe.useState(!1);Oe.useEffect(()=>{const M=()=>h(window.scrollY>10);return window.addEventListener("scroll",M,{passive:!0}),()=>window.removeEventListener("scroll",M)},[]);const f=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),{signedIn:d,loading:g}=Wm(),{openLoginModal:_}=Xm(),p=jm(),m=Number(r("landing.v3.stats.fallback_tokens"))||0,b=Number(r("landing.v3.stats.fallback_devs"))||0,w=r("landing.cta.secondary");return P.jsxs("div",{className:"relative min-h-screen bg-[color:var(--lv3-bg)] text-oai-white font-oai antialiased dark",style:ig,children:[P.jsx("header",{className:Hu("sticky top-0 z-50 transition-all duration-300",u?"bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-900":"bg-transparent border-b border-transparent"),children:P.jsxs("div",{className:"mx-auto flex h-14 max-w-7xl items-center justify-between px-4 sm:px-6",children:[P.jsxs("div",{className:"flex items-center gap-3 sm:gap-5",children:[P.jsxs(Is,{to:s||"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",children:[P.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),P.jsx("span",{className:"whitespace-nowrap text-sm font-semibold uppercase tracking-wide text-white",children:"Token Tracker"})]}),P.jsx("div",{className:"hidden sm:block",children:P.jsx(Km,{})})]}),P.jsxs("div",{className:"flex items-center justify-end gap-3 sm:gap-5 md:gap-6",children:[P.jsx(Is,{to:"/leaderboard",className:"hidden select-none text-sm font-medium text-oai-gray-400 outline-none transition-colors duration-200 hover:text-white focus-visible:underline sm:inline",children:r("nav.leaderboard")}),!d&&!g&&P.jsx(Is,{to:zf(),className:"hidden select-none text-sm font-medium text-oai-gray-400 outline-none transition-colors duration-200 hover:text-white focus-visible:underline sm:inline",children:r("landing.v2.cta.primary")}),P.jsx("div",{className:"flex items-center gap-2.5 sm:gap-3.5",children:g?P.jsx("div",{className:"h-8 w-16 animate-pulse rounded-[8px] bg-white/10","aria-hidden":!0}):d?P.jsxs(P.Fragment,{children:[P.jsx(Is,{to:zf(),className:"inline-flex h-8 select-none items-center justify-center rounded-[8px] bg-white px-3.5 text-xs font-bold text-oai-gray-950 shadow-sm transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98]",children:r("landing.v2.cta.primary")}),P.jsx(Ym,{})]}):P.jsx("button",{type:"button",onClick:_,className:"inline-flex h-8 min-w-[80px] select-none items-center justify-center rounded-[8px] bg-white px-3.5 text-xs font-bold text-oai-gray-950 shadow-sm transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98]",children:r("header.auth.sign_in_aria")})})]})]})}),P.jsxs("main",{className:"-mt-14",children:[P.jsx(Uy,{copy:r,animate:c,effectsReady:n,stats:p,tokenFallback:m,devsFallback:b,installCommand:a,installCopied:o,onCopyInstallCommand:l,githubLabel:w}),P.jsx(Xy,{copy:r,animate:c,screenshotSrc:"/dashboard-dark.png",screenshotAlt:r("landing.screenshot.alt")}),P.jsx(Fy,{copy:r,animate:c}),P.jsx(By,{copy:r,animate:c}),P.jsx($y,{copy:r,animate:c}),P.jsx(iE,{copy:r,animate:c,stats:p,tokenFallback:m,devsFallback:b}),P.jsx(sE,{copy:r,animate:c,installCommand:a,installCopied:o,onCopyInstallCommand:l,githubLabel:w})]}),P.jsx("footer",{className:"border-t border-oai-gray-900 bg-oai-gray-950 py-12",children:P.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col items-center justify-between gap-6 px-4 text-sm text-oai-gray-400 sm:flex-row sm:px-6",children:[P.jsx("p",{children:r("landing.v2.footer.line")}),P.jsxs("div",{className:"flex items-center gap-6",children:[P.jsx("a",{href:qm,className:"font-medium text-oai-gray-400 transition-colors hover:text-white",target:"_blank",rel:"noopener noreferrer",children:r("landing.v2.nav.status")}),P.jsx("a",{href:Ac,className:"font-medium text-oai-gray-400 transition-colors hover:text-white",target:"_blank",rel:"noopener noreferrer",children:r("landing.v2.nav.github")}),f&&P.jsxs(Is,{to:i,className:"font-medium text-[color:var(--lv3-accent-soft)] transition-colors hover:text-white",children:[r("landing.cta.primary")," →"]})]})]})})]})}function oE({prefersReducedMotion:r,screenshotMode:e}){return!(e||r)}function lE(){return Oe.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function cE(r=0,e=!0){const[t,n]=Oe.useState(()=>!e);return Oe.useEffect(()=>{if(!e){n(!0);return}let i=null,s=null;const a=()=>n(!0);return typeof window<"u"&&"requestIdleCallback"in window?(s=window.requestIdleCallback(a,{timeout:r||200}),()=>{typeof window.cancelIdleCallback=="function"&&s!=null&&window.cancelIdleCallback(s)}):(i=window.setTimeout(a,r),()=>{i!=null&&window.clearTimeout(i)})},[r,e]),t}function xE({signInUrl:r,signUpUrl:e}){const t=lE(),n=Oe.useMemo(()=>typeof window>"u"?!1:$m(window.location.search),[]),i=oE({prefersReducedMotion:t,screenshotMode:n}),s=cE(250,i),a="tokentracker.dashboard.from_landing.v1";Oe.useEffect(()=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(a,"1")}catch{}},[a]);const o=Bf("landing.install.command"),[l,c]=Oe.useState(!1),u=Oe.useRef(null);Oe.useEffect(()=>()=>{u.current!=null&&window.clearTimeout(u.current)},[]);const h=async()=>{await Zm(o)&&(u.current!=null&&window.clearTimeout(u.current),c(!0),u.current=window.setTimeout(()=>{c(!1),u.current=null},2e3))};return P.jsx(aE,{copy:Bf,reduceMotion:t,screenshotMode:n,effectsReady:s,signInUrl:r,signUpUrl:e,installCommand:o,installCopied:l,onCopyInstallCommand:h})}export{xE as LandingPage};