PageSourceSearch

https://abbas-mesolitica-lerobot-arena.hf.space/_app/immutable/nodes/2.CS95ZcEj.js

js abbas-mesolitica-lerobot-arena.hf.space collected 2026-10-03 16:36:13 UTC 1,298,854 bytes, 4,972 lines download raw bytes

1var VT=Object.defineProperty;var GT=Object.getPrototypeOf;var HT=Reflect.get;var I_=r=>{throw TypeError(r)};var WT=(r,e,t)=>e in r?VT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ae=(r,e,t)=>WT(r,typeof e!="symbol"?e+"":e,t),eg=(r,e,t)=>e.has(r)||I_("Cannot "+t);var J=(r,e,t)=>(eg(r,e,"read from private field"),t?t.call(r):e.get(r)),Fe=(r,e,t)=>e.has(r)?I_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),gt=(r,e,t,n)=>(eg(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),un=(r,e,t)=>(eg(r,e,"access private method"),t);var D_=(r,e,t,n)=>({set _(i){gt(r,e,i,t)},get _(){return J(r,e,n)}}),L_=(r,e,t)=>HT(GT(r),t,e);import{j as bf,k as jT,l as XT,n as th,b as p1,o as Yr,c as tt,a as re,f as je,p as Ys,m as qT,u as YT,i as $T,t as Yn,s as gn,g as nm,d as Ts}from"../chunks/C53HeOtB.js";import{A as ZT,B as bi,C as Ql,D as m1,E as F0,F as k_,H as JT,G as Ll,I as KT,J as kf,K as _v,M as tg,N as la,O as QT,P as eA,Q as tA,f as nA,R as fu,U as iA,m as U_,S as rA,T as Al,k as En,V as pu,W as sA,X as Jc,Y as oA,Z as aA,_ as lA,$ as cA,a0 as g1,a1 as v1,a2 as uA,a3 as y1,a4 as dA,a5 as hA,a6 as _1,w as wi,a7 as fA,a8 as pA,x as jt,a9 as x1,aa as mA,ab as gA,ac as vA,ad as yA,t as B0,ae as z0,af as _A,u as Un,ag as N_,a as Pn,ah as xA,g as C,ai as bA,aj as wA,h as Pt,ak as Uf,s as Be,al as mo,am as SA,an as MA,ao as zs,ap as O_,aq as F_,ar as B_,z as b1,q as cr,n as Si,j as Ve,p as vt,b as Ie,e as yt,i as qe,r as We,c as Le,as as w1,at as S1,au as M1,v as mr,l as EA,av as TA,aw as AA,ax as Nt,y as Dn,ay as CA,o as V0,az as RA}from"../chunks/DJJ9xc3E.js";import{B as G0,r as Wt,i as Dt,b as ti,s as pn,p as ae,c as Qe,a as So,d as im}from"../chunks/DfTBdSwa.js";import{f as zt,e as qr,i as Mo,g as In,h as PA,d as nh,s as gr,c as da,j as wf,k as Cr,l as IA,m as DA,r as Nf,a as z_,n as LA}from"../chunks/CPZn2izG.js";function kA(){return Symbol(ZT)}const V_=0,G_=1,UA=2;function H0(r,e,t,n,i){bi&&Ql();var s=m1(),o=iA,a=s?fu(o):U_(o,!1,!1),l=s?fu(o):U_(o,!1,!1),c=new G0(r);F0(()=>{var u=la,d=e(),h=!1;let f=bi&&k_(d)===(r.data===JT);if(f&&(Ll(KT()),kf(!1)),k_(d)){var p=rA(),m=!1;const g=v=>{if(!h){m=!0,p(!1),la===u&&u.deactivate(),QT.ensure();try{v()}finally{eA(!1),tA||nA()}}};d.then(v=>{g(()=>{tg(a,v),c.ensure(G_,n&&(y=>n(y,a)))})},v=>{g(()=>{if(tg(l,v),c.ensure(UA,i&&(y=>i(y,l))),!i)throw l.v})}),bi?c.ensure(V_,t):_v(()=>{m||g(()=>{c.ensure(V_,t)})})}else tg(a,d),c.ensure(G_,n&&(g=>n(g,a)));return f&&kf(!0),()=>{h=!0}})}const NA=Symbol("NaN");function OA(r,e,t){bi&&Ql();var n=new G0(r),i=!m1();F0(()=>{var s=e();s!==s&&(s=NA),i&&s!==null&&typeof s=="object"&&(s={}),n.ensure(s,t)})}function Od(r,e,t=!1,n=!1,i=!1,s=!1){var o=r,a="";if(t){var l=r;bi&&(o=Ll(Al(l)))}En(()=>{var c=pu;if(a===(a=e()??"")){bi&&Ql();return}if(t&&!bi){c.nodes=null,l.innerHTML=a,a!==""&&bf(Al(l),l.lastChild);return}if(c.nodes!==null&&(sA(c.nodes.start,c.nodes.end),c.nodes=null),a!==""){if(bi){Jc.data;for(var u=Ql(),d=u;u!==null&&(u.nodeType!==oA||u.data!=="");)d=u,u=aA(u);if(u===null)throw lA(),cA;bf(Jc,d),o=Ll(u);return}var h=n?v1:i?uA:void 0,f=g1(n?"svg":i?"math":"template",h);f.innerHTML=a;var p=n||i?f:f.content;if(bf(Al(p),p.lastChild),n||i)for(;Al(p);)o.before(Al(p));else o.before(p)}})}const FA=()=>performance.now(),ls={tick:r=>requestAnimationFrame(r),now:()=>FA(),tasks:new Set};function E1(){const r=ls.now();ls.tasks.forEach(e=>{e.c(r)||(ls.tasks.delete(e),e.f())}),ls.tasks.size!==0&&ls.tick(E1)}function T1(r){let e;return ls.tasks.size===0&&ls.tick(E1),{promise:new Promise(t=>{ls.tasks.add(e={c:r,f:t})}),abort(){ls.tasks.delete(e)}}}function H_(r,e){x1(()=>{r.dispatchEvent(new CustomEvent(e))})}function BA(r){if(r==="float")return"cssFloat";if(r==="offset")return"cssOffset";if(r.startsWith("--"))return r;const e=r.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function W_(r){const e={},t=r.split(";");for(const n of t){const[i,s]=n.split(":");if(!i||s===void 0)break;const o=BA(i.trim());e[o]=s.trim()}return e}const zA=r=>r;function j_(r,e,t,n){var g;var i=(r&fA)!==0,s="in",o,a=e.inert,l=e.style.overflow,c,u;function d(){return x1(()=>o??(o=t()(e,(n==null?void 0:n())??{},{direction:s})))}var h={is_global:i,in(){e.inert=a,c==null||c.abort(),c=A1(e,d(),u,1,()=>{H_(e,"introstart")},()=>{H_(e,"introend"),c==null||c.abort(),c=o=void 0,e.style.overflow=l})},out(v){{v==null||v(),o=void 0;return}},stop:()=>{c==null||c.abort()}},f=pu;if(((g=f.nodes).t??(g.t=[])).push(h),jT){var p=i;if(!p){for(var m=f.parent;m&&(m.f&y1)!==0;)for(;(m=m.parent)&&(m.f&dA)===0;);p=!m||(m.f&hA)!==0}p&&_1(()=>{wi(()=>h.in())})}}function A1(r,e,t,n,i,s){var o=!1;if(pA(e)){var a;return _v(()=>{if(!o){var p=e({direction:"in"});a=A1(r,p,t,n,i,s)}}),{abort:()=>{o=!0,a==null||a.abort()},deactivate:()=>a.deactivate(),reset:()=>a.reset(),t:()=>a.t()}}if(!(e!=null&&e.duration)&&!(e!=null&&e.delay))return i(),s(),{abort:jt,deactivate:jt,reset:jt,t:()=>n};const{delay:l=0,css:c,tick:u,easing:d=zA}=e;var h,f=()=>1-n;return _v(()=>{if(!o){var p=[];if(u&&u(0,1),c){var m=W_(c(0,1));p.push(m,m)}h=r.animate(p,{duration:l,fill:"forwards"}),h.onfinish=()=>{h.cancel(),i();var g=1-n,v=n-g,y=e.duration*Math.abs(v),_=[];
1if(y>0){var x=!1;if(c)for(var T=Math.ceil(y/16.666666666666668),b=0;b<=T;b+=1){var M=g+v*d(b/T),E=W_(c(M,1-M));_.push(E),x||(x=E.overflow==="hidden")}x&&(r.style.overflow="hidden"),f=()=>{var S=h.currentTime;return g+v*d(S/y)},u&&T1(()=>{if(h.playState!=="running")return!1;var S=f();return u(S,1-S),!0})}h=r.animate(_,{duration:y,fill:"forwards"}),h.onfinish=()=>{f=()=>n,u==null||u(n,1-n),s()}}}}),{abort:()=>{o=!0,h&&(h.cancel(),h.effect=null,h.onfinish=jt)},deactivate:()=>{s=jt},reset:()=>{},t:()=>f()}}function W0(r,e,t,n,i,s){let o=bi;bi&&Ql();var a=null;bi&&Jc.nodeType===mA&&(a=Jc,Ql());var l=bi?Jc:r,c=new G0(l,!1);F0(()=>{const u=e()||null;var d=t||u==="svg"?v1:void 0;if(u===null){c.ensure(null,null),th(!0);return}return c.ensure(u,h=>{if(u){if(a=bi?a:g1(u,d),bf(a,a),n){var f=null;bi&&XT(u)&&a.append(f=document.createComment(""));var p=bi?Al(a):a.appendChild(gA());bi&&(p===null?kf(!1):Ll(p)),n(a,p),f==null||f.remove()}pu.nodes.end=a,h.before(a)}bi&&Ll(h)}),th(!0),()=>{u&&th(!1)}},y1),vA(()=>{th(!0)}),o&&(kf(!0),Ll(l))}function VA(r,e,t){_1(()=>{var n=wi(()=>e(r,t==null?void 0:t())||{});if(n!=null&&n.destroy)return()=>n.destroy()})}function Of(r,e,t=e){var n=new WeakSet;yA(r,"input",async i=>{var s=i?r.defaultValue:r.value;if(s=ng(r)?ig(s):s,t(s),la!==null&&n.add(la),await B0(),s!==(s=e())){var o=r.selectionStart,a=r.selectionEnd,l=r.value.length;if(r.value=s??"",a!==null){var c=r.value.length;o===a&&a===l&&c>l?(r.selectionStart=c,r.selectionEnd=c):(r.selectionStart=o,r.selectionEnd=Math.min(a,c))}}}),(bi&&r.defaultValue!==r.value||wi(e)==null&&r.value)&&(t(ng(r)?ig(r.value):r.value),la!==null&&n.add(la)),z0(()=>{var i=e();if(r===document.activeElement){var s=la;if(n.has(s))return}ng(r)&&i===ig(r.value)||r.type==="date"&&!i&&!r.value||i!==r.value&&(r.value=i??"")})}function ng(r){var e=r.type;return e==="number"||e==="range"}function ig(r){return r===""?null:+r}function GA(r=!1){const e=_A,t=e.l.u;if(!t)return;let n=()=>bA(e.s);if(r){let i=0,s={};const o=wA(()=>{let a=!1;const l=e.s;for(const c in l)l[c]!==s[c]&&(s[c]=l[c],a=!0);return a&&i++,i});n=()=>C(o)}t.b.length&&Un(()=>{X_(e,n),N_(t.b)}),Pn(()=>{const i=wi(()=>t.m.map(xA));return()=>{for(const s of i)typeof s=="function"&&s()}}),t.a.length&&Pn(()=>{X_(e,n),N_(t.a)})}function X_(r,e){if(r.l.s)for(const t of r.l.s)C(t);e()}var HA=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],WA=["difference","intersection","symmetricDifference","union"],q_=!1,Fl,Vr,vo,Np,cc,C1,R1;const Op=class Op extends Set{constructor(t){super();Fe(this,cc);Fe(this,Fl,new Map);Fe(this,Vr,Pt(0));Fe(this,vo,Pt(0));Fe(this,Np,Uf||-1);if(t){for(var n of t)super.add(n);J(this,vo).v=super.size}q_||un(this,cc,R1).call(this)}has(t){var n=super.has(t),i=J(this,Fl),s=i.get(t);if(s===void 0){if(!n)return C(J(this,Vr)),!1;s=un(this,cc,C1).call(this,!0),i.set(t,s)}return C(s),n}add(t){return super.has(t)||(super.add(t),Be(J(this,vo),super.size),mo(J(this,Vr))),this}delete(t){var n=super.delete(t),i=J(this,Fl),s=i.get(t);return s!==void 0&&(i.delete(t),Be(s,!1)),n&&(Be(J(this,vo),super.size),mo(J(this,Vr))),n}clear(){if(super.size!==0){super.clear();var t=J(this,Fl);for(var n of t.values())Be(n,!1);t.clear(),Be(J(this,vo),0),mo(J(this,Vr))}}keys(){return this.values()}values(){return C(J(this,Vr)),super.values()}entries(){return C(J(this,Vr)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return C(J(this,vo))}};Fl=new WeakMap,Vr=new WeakMap,vo=new WeakMap,Np=new WeakMap,cc=new WeakSet,C1=function(t){return Uf===J(this,Np)?Pt(t):fu(t)},R1=function(){q_=!0;var t=Op.prototype,n=Set.prototype;for(const i of HA)t[i]=function(...s){return C(J(this,Vr)),n[i].apply(this,s)};for(const i of WA)t[i]=function(...s){C(J(this,Vr));var o=n[i].apply(this,s);return new Op(o)}};let xv=Op;var rs,ss,Cs,Fp,Xr,jc,Sf;const u_=class u_ extends Map{constructor(t){super();Fe(this,Xr);Fe(this,rs,new Map);Fe(this,ss,Pt(0));Fe(this,Cs,Pt(0));Fe(this,Fp,Uf||-1);if(t){for(var[n,i]of t)super.set(n,i);J(this,Cs).v=super.size}}has(t){var n=J(this,rs),i=n.get(t);if(i===void 0)if(super.has(t))i=un(this,Xr,jc).call(this,0),n.set(t,i);else return C(J(this,ss)),!1;return C(i),!0}forEach(t,n){un(this,Xr,Sf).call(this),super.forEach(t,n)}get(t){var n=J(this,rs),i=n.get(t);if(i===void 0)if(super.has(t))i=un(this,Xr,jc).call(this,0),n.set(t,i);else{C(J(this,ss));return}return C(i),super.get(t)}getOrInsert(t,n){return super.has(t)||this.set(t,n),this.get(t)}getOrInsertComputed(t,n){return super.has(t)||this.set(t,n(t)),this.get(t)}set(t,n){var d;var i=J(this,rs),s=i.get(t),o=super.get(t),a=super.set(t,n),l=J(this,ss);if(s===void 0)s=un(this,Xr,jc).call(this,0),i.set(t,s),Be(J(this,Cs),super.size),mo(l);else if(o!==n){mo(s);var c=l.reactions===null?null:new Set(l.reactions),u=c===null||!((d=s.reactions)!=null&&d.every(h=>c.has(h)));u&&mo(l)}return a}delete(t){var n=J(this,rs),i=n.get(t),s=super.delete(t);return i!==void 0&&(n.delete(t),Be(i,-1)),s&&(Be(J(this,Cs),super.size),mo(J(this,ss))),s}clear(){if(super.size!==0){super.clear();var t=J(this,rs);Be(J(this,Cs),0);for(var n of t.values())Be(n,-1);mo(J(this,ss)),t.clear()}}keys(){return C(J(this,ss)),super.keys()}values(){return un(this,Xr,Sf).call(this),super.values()}entries(){return un(this,Xr,Sf).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return C(J(this,Cs)),super.size}};rs=new WeakMap,ss=new WeakMap,Cs=new WeakMap,Fp=new WeakMap,Xr=new WeakSet,jc=function(t){return Uf===J(this,Fp)?Pt(t):fu(t)},Sf=function(){C(J(this,ss));var t=J(this,rs);if(J(this,Cs).v!==t.size){for(var n of L_(u_.prototype,this,"keys").call(this))if(!t.has(n)){var i=un(this,Xr,jc).call(this,0);t.set(n,i)}}for([,i]of J(this,rs))C(i)};let Ff=u_;var Y_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,jA=/\n/g,XA=/^\s*/,qA=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,YA=/^:\s*/,$A=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ZA=/^[;\s]*/,JA=/^\s+|\s+$/g,KA=`
2`,$_="/",Z_="*",ca="",QA="comment",eC="declaration";function tC(r,e){if(typeof r!="string")throw new TypeError("First argument must be a string");if(!r)return[];e=e||{};var t=1,n=1;function i(p){var m=p.match(jA);m&&(t+=m.length);var g=p.lastIndexOf(KA);n=~g?p.length-g:n+p.length}function s(){var p={line:t,column:n};return function(m){return m.position=new o(p),c(),m}}function o(p){this.start=p,this.end={line:t,column:n},this.source=e.source}o.prototype.content=r;function a(p){var m=new Error(e.source+":"+t+":"+n+": "+p);if(m.reason=p,m.filename=e.source,m.line=t,m.column=n,m.source=r,!e.silent)throw m}function l(p){var m=p.exec(r);if(m){var g=m[0];return i(g),r=r.slice(g.length),m}}function c(){l(XA)}function u(p){var m;for(p=p||[];m=d();)m!==!1&&p.push(m);return p}function d(){var p=s();if(!($_!=r.charAt(0)||Z_!=r.charAt(1))){for(var m=2;ca!=r.charAt(m)&&(Z_!=r.charAt(m)||$_!=r.charAt(m+1));)++m;if(m+=2,ca===r.charAt(m-1))return a("End of comment missing");var g=r.slice(2,m-2);return n+=2,i(g),r=r.slice(m),n+=2,p({type:QA,comment:g})}}function h(){var p=s(),m=l(qA);if(m){if(d(),!l(YA))return a("property missing ':'");
2var g=l($A),v=p({type:eC,property:J_(m[0].replace(Y_,ca)),value:g?J_(g[0].replace(Y_,ca)):ca});return l(ZA),v}}function f(){var p=[];u(p);for(var m;m=h();)m!==!1&&(p.push(m),u(p));return p}return c(),f()}function J_(r){return r?r.replace(JA,ca):ca}function nC(r,e){let t=null;if(!r||typeof r!="string")return t;const n=tC(r),i=typeof e=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?e(o,a,s):a&&(t=t||{},t[o]=a)}),t}function mu(r,e){var t=pu,n=F_,i=r();const s=zs(i,o=>{var a=i!==r(),l,c=F_,u=pu;O_(n),B_(t);try{l=b1(()=>{z0(()=>{const d=r();a&&o(d)})})}finally{O_(c),B_(u)}return a=!0,l});return e?{set:e,update:o=>e(o(r())),subscribe:s.subscribe}:{subscribe:s.subscribe}}function Xa(r){let e;const t=p1(i=>{let s=!1;const o=r.subscribe(a=>{e=a,s&&i()});return s=!0,o});function n(){return SA()?(t(),e):MA(r)}return"set"in r?{get current(){return n()},set current(i){r.set(i)}}:{get current(){return n()}}}/**
3 * @license
4 * Copyright 2010-2025 Three.js Authors
5 * SPDX-License-Identifier: MIT
6 */const Fd="177",yr={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ha={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},P1=0,bv=1,I1=2,iC=3,rC=0,j0=1,Bf=2,is=3,ms=0,Fi=1,si=2,Gs=0,Ia=1,wv=2,Sv=3,Mv=4,D1=5,go=100,L1=101,k1=102,U1=103,N1=104,O1=200,F1=201,B1=202,z1=203,zf=204,Vf=205,V1=206,G1=207,H1=208,W1=209,j1=210,X1=211,q1=212,Y1=213,$1=214,Gf=0,Hf=1,Wf=2,Oa=3,jf=4,Xf=5,qf=6,Yf=7,Bd=0,Z1=1,J1=2,hs=0,K1=1,Q1=2,eS=3,tS=4,nS=5,X0=6,iS=7,Ev="attached",rS="detached",rm=300,Ws=301,Eo=302,gu=303,vu=304,dc=306,Gr=1e3,or=1001,yu=1002,Ii=1003,q0=1004,sC=1004,Cl=1005,oC=1005,ei=1006,Kc=1007,aC=1007,Hr=1008,lC=1008,$r=1009,Y0=1010,$0=1011,ec=1012,sm=1013,js=1014,ar=1015,hc=1016,om=1017,am=1018,tc=1020,Z0=35902,J0=1021,K0=1022,qi=1023,nc=1026,ic=1027,lm=1028,zd=1029,Q0=1030,cm=1031,cC=1032,um=1033,Qc=33776,eu=33777,tu=33778,nu=33779,$f=35840,Zf=35841,Jf=35842,Kf=35843,Qf=36196,ep=37492,tp=37496,np=37808,ip=37809,rp=37810,sp=37811,op=37812,ap=37813,lp=37814,cp=37815,up=37816,dp=37817,hp=37818,fp=37819,pp=37820,mp=37821,iu=36492,gp=36494,vp=36495,ey=36283,yp=36284,_p=36285,xp=36286,sS=2200,oS=2201,aS=2202,_u=2300,bp=2301,Mf=2302,fa=2400,pa=2401,xu=2402,dm=2500,ty=2501,uC=0,dC=1,hC=2,lS=3200,ny=3201,fC=3202,pC=3203,Ao=0,cS=1,Fs="",Ln="srgb",Fa="srgb-linear",bu="linear",Mn="srgb",mC=0,oa=7680,gC=7681,vC=7682,yC=7683,_C=34055,xC=34056,bC=5386,wC=512,SC=513,MC=514,EC=515,TC=516,AC=517,CC=518,Tv=519,uS=512,dS=513,hS=514,iy=515,fS=516,pS=517,mS=518,gS=519,wu=35044,RC=35048,PC=35040,IC=35045,DC=35049,LC=35041,kC=35046,UC=35050,NC=35042,OC="100",Av="300 es",Rr=2e3,Su=2001,FC={COMPUTE:"compute",RENDER:"render"},BC={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},zC={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FLAT_FIRST:"flat first",FLAT_EITHER:"flat either"};class vs{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,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const Li=["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 K_=1234567;const Da=Math.PI/180,rc=180/Math.PI;function _r(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Li[r&255]+Li[r>>8&255]+Li[r>>16&255]+Li[r>>24&255]+"-"+Li[e&255]+Li[e>>
vendor: 4,608 bytes, line 6
68&255]+"-"+Li[e>>16&15|64]+Li[e>>24&255]+"-"+Li[t&63|128]+Li[t>>8&255]+"-"+Li[t>>16&255]+Li[t>>24&255]+Li[n&255]+Li[n>>8&255]+Li[n>>16&255]+Li[n>>24&255]).toLowerCase()}function $t(r,e,t){return Math.max(e,Math.min(t,r))}function ry(r,e){return(r%e+e)%e}function VC(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function GC(r,e,t){return r!==e?(t-r)/(e-r):0}function ru(r,e,t){return(1-t)*r+t*e}function HC(r,e,t,n){return ru(r,e,1-Math.exp(-t*n))}function WC(r,e=1){return e-Math.abs(ry(r,e*2)-e)}function jC(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function XC(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function qC(r,e){return r+Math.floor(Math.random()*(e-r+1))}function YC(r,e){return r+Math.random()*(e-r)}function $C(r){return r*(.5-Math.random())}function ZC(r){r!==void 0&&(K_=r);let e=K_+=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 JC(r){return r*Da}function KC(r){return r*rc}function QC(r){return(r&r-1)===0&&r!==0}function e2(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function t2(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function n2(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),d=s((e-n)/2),h=o((e-n)/2),f=s((n-e)/2),p=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*d,l*h,a*c);break;case"YZY":r.set(l*h,a*u,l*d,a*c);break;case"ZXZ":r.set(l*d,l*h,a*u,a*c);break;case"XZX":r.set(a*u,l*p,l*f,a*c);break;case"YXY":r.set(l*f,a*u,l*p,a*c);break;case"ZYZ":r.set(l*p,l*f,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Xi(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("Invalid component type.")}}function Jt(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("Invalid component type.")}}const cs={DEG2RAD:Da,RAD2DEG:rc,generateUUID:_r,clamp:$t,euclideanModulo:ry,mapLinear:VC,inverseLerp:GC,lerp:ru,damp:HC,pingpong:WC,smoothstep:jC,smootherstep:XC,randInt:qC,randFloat:YC,randFloatSpread:$C,seededRandom:ZC,degToRad:JC,radToDeg:KC,isPowerOfTwo:QC,ceilPowerOfTwo:e2,floorPowerOfTwo:t2,setQuaternionFromProperEuler:n2,normalize:Jt,denormalize:Xi};class Ue{constructor(e=0,t=0){Ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,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=$t(this.x,e.x,t.x),this.y=$t(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=$t(this.x,e,t),this.y=$t(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($t(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}
vendor: 4,578 bytes, line 6
6round(){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($t(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,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class $n{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,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],d=n[i+3];const h=s[o+0],f=s[o+1],p=s[o+2],m=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d;return}if(a===1){e[t+0]=h,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(d!==m||l!==h||c!==f||u!==p){let g=1-a;const v=l*h+c*f+u*p+d*m,y=v>=0?1:-1,_=1-v*v;if(_>Number.EPSILON){const T=Math.sqrt(_),b=Math.atan2(T,v*y);g=Math.sin(g*b)/T,a=Math.sin(a*b)/T}const x=a*y;if(l=l*g+h*x,c=c*g+f*x,u=u*g+p*x,d=d*g+m*x,g===1-a){const T=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=T,c*=T,u*=T,d*=T}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],d=s[o],h=s[o+1],f=s[o+2],p=s[o+3];return e[t]=a*p+u*d+l*f-c*h,e[t+1]=l*p+u*h+c*d-a*f,e[t+2]=c*p+u*f+a*h-l*d,e[t+3]=u*p-a*d-l*h-c*f,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,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),d=a(s/2),h=l(n/2),f=l(i/2),p=l(s/2);switch(o){case"XYZ":this._x=h*u*d+c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d-h*f*p;break;case"YXZ":this._x=h*u*d+c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d+h*f*p;break;case"ZXY":this._x=h*u*d-c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d-h*f*p;break;case"ZYX":this._x=h*u*d-c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d+h*f*p;break;case"YZX":this._x=h*u*d+c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d-h*f*p;break;case"XZY":this._x=h*u*d-c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d+h*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}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],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],d=t[10],h=n+a+d;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(o-i)*f}else if(n>a&&n>d){const f=2*Math.sqrt(1+n-a-d);this._w=(u-l)/f,this._x=.25*f,this._y=(i+o)/f,this._z=(s+c)/f}else if(a>d){const f=2*Math.sqrt(1+a-n-d);this._w=(s-c)/f,this._x=(i+o)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+d-n-a);this._w=(o-i)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>
vendor: 6,066 bytes, line 6
6Math.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($t(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,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const f=1-t;return this._w=f*o+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),d=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*d+this._w*h,this._x=n*d+this._x*h,this._y=i*d+this._y*h,this._z=s*d+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),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}}class V{constructor(e=0,t=0,n=0){V.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Q_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Q_.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,o=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])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*n),u=2*(a*t-s*i),d=2*(s*n-o*t);return this.x=t+l*c+o*d-a*u,this.y=n+l*u+a*c-s*d,this.z=i+l*d+s*u-o*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=$t(this.x,e.x,t.x),this.y=$t(this.y,e.y,t.y),this.z=$t(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=$t(this.x,e,t),this.y=$t(this.y,e,t),this.z=$t(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($t(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}
vendor: 4,278 bytes, line 6
6round(){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,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,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 rg.copy(this).projectOnVector(e),this.sub(rg)}reflect(e){return this.sub(rg.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($t(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}}const rg=new V,Q_=new $n;class Yt{constructor(e,t,n,i,s,o,a,l,c){Yt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,l,c)}set(e,t,n,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,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,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],d=n[7],h=n[2],f=n[5],p=n[8],m=i[0],g=i[3],v=i[6],y=i[1],_=i[4],x=i[7],T=i[2],b=i[5],M=i[8];return s[0]=o*m+a*y+l*T,s[3]=o*g+a*_+l*b,s[6]=o*v+a*x+l*M,s[1]=c*m+u*y+d*T,s[4]=c*g+u*_+d*b,s[7]=c*v+u*x+d*M,s[2]=h*m+f*y+p*T,s[5]=h*g+f*_+p*b,s[8]=
vendor: 4,992 bytes, line 6
6h*v+f*x+p*M,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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=u*o-a*c,h=a*l-u*s,f=c*s-o*l,p=t*d+n*h+i*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=d*m,e[1]=(i*c-u*n)*m,e[2]=(a*n-i*o)*m,e[3]=h*m,e[4]=(u*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=f*m,e[7]=(n*l-c*t)*m,e[8]=(o*t-n*s)*m,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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(sg.makeScale(e,t)),this}rotate(e){return this.premultiply(sg.makeRotation(-e)),this}translate(e,t){return this.premultiply(sg.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)}}const sg=new Yt;function vS(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const i2={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Rl(r,e){return new i2[r](e)}function Mu(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function yS(){const r=Mu("canvas");return r.style.display="block",r}const ex={};function kl(r){r in ex||(ex[r]=!0,console.warn(r))}function r2(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)})}function s2(r){const e=r.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function o2(r){const e=r.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const tx=new Yt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),nx=new Yt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function a2(){const r={enabled:!0,workingColorSpace:Fa,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Mn&&(i.r=Hs(i.r),i.g=Hs(i.g),i.b=Hs(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Mn&&(i.r=Ul(i.r),i.g=Ul(i.g),i.b=Ul(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===Fs?bu:this.spaces[i].transfer},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,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].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 kl("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return kl("THREE.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({[Fa]:{primaries:e,whitePoint:n,transfer:bu,toXYZ:tx,fromXYZ:nx,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ln},outputColorSpaceConfig:{drawingBufferColorSpace:Ln}},[Ln]:{primaries:e,whitePoint:n,transfer:Mn,toXYZ:tx,fromXYZ:nx,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ln}}}),r}
vendor: 25,488 bytes, line 6
6const rn=a2();function Hs(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Ul(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let nl;class _S{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{nl===void 0&&(nl=Mu("canvas")),nl.width=e.width,nl.height=e.height;const i=nl.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=nl}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=Mu("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 o=0;o<s.length;o++)s[o]=Hs(s[o]/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(Hs(t[n]/255)*255):t[n]=Hs(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let l2=0;class wo{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:l2++}),this.uuid=_r(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(og(i[o].image)):s.push(og(i[o]))}else s=og(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function og(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?_S.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let c2=0;const ag=new V;class Wn extends vs{constructor(e=Wn.DEFAULT_IMAGE,t=Wn.DEFAULT_MAPPING,n=or,i=or,s=ei,o=Hr,a=qi,l=$r,c=Wn.DEFAULT_ANISOTROPY,u=Fs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:c2++}),this.uuid=_r(),this.name="",this.source=new wo(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ue(0,0),this.repeat=new Ue(1,1),this.center=new Ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Yt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(ag).x}get height(){return this.source.getSize(ag).y}get depth(){return this.source.getSize(ag).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.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,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!==rm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Gr:e.x=e.x-Math.floor(e.x);break;case or:e.x=e.x<0?0:1;break;case yu: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 Gr:e.y=e.y-Math.floor(e.y);break;case or:e.y=e.y<0?0:1;break;case yu: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++}}Wn.DEFAULT_IMAGE=null;Wn.DEFAULT_MAPPING=rm;Wn.DEFAULT_ANISOTROPY=1;class Kt{constructor(e=0,t=0,n=0,i=1){Kt.prototype.isVector4=!0,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("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[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],d=l[8],h=l[1],f=l[5],p=l[9],m=l[2],g=l[6],v=l[10];if(Math.abs(u-h)<.01&&Math.abs(d-m)<.01&&Math.abs(p-g)<.01){if(Math.abs(u+h)<.1&&Math.abs(d+m)<.1&&Math.abs(p+g)<.1&&Math.abs(c+f+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,x=(f+1)/2,T=(v+1)/2,b=(u+h)/4,M=(d+m)/4,E=(p+g)/4;return _>x&&_>T?_<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(_),i=b/n,s=M/n):x>T?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=b/i,s=E/i):T<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(T),n=M/s,i=E/s),this.set(n,i,s,t),this}let y=Math.sqrt((g-p)*(g-p)+(d-m)*(d-m)+(h-u)*(h-u));return Math.abs(y)<.001&&(y=1),this.x=(g-p)/y,this.y=(d-m)/y,this.z=(h-u)/y,this.w=Math.acos((c+f+v-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=$t(this.x,e.x,t.x),this.y=$t(this.y,e.y,t.y),this.z=$t(this.z,e.z,t.z),this.w=$t(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=$t(this.x,e,t),this.y=$t(this.y,e,t),this.z=$t(this.z,e,t),this.w=$t(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar($t(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class sy extends vs{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ei,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Kt(0,0,e,t),this.scissorTest=!1,this.viewport=new Kt(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new Wn(i);this.textures=[];const o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:ei,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].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 wo(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}dispose(){this.dispatchEvent({type:"dispose"})}}class gs extends sy{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class hm extends Wn{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=Ii,this.minFilter=Ii,this.wrapR=or,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class u2 extends gs{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new hm(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class fm extends Wn{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=Ii,this.minFilter=Ii,this.wrapR=or,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class d2 extends gs{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new fm(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class jn{constructor(e=new V(1/0,1/0,1/0),t=new V(-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(Fr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Fr.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=Fr.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 o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Fr):Fr.fromBufferAttribute(s,o),Fr.applyMatrix4(e.matrixWorld),this.expandByPoint(Fr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ih.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ih.copy(n.boundingBox)),ih.applyMatrix4(e.matrixWorld),this.union(ih)}const i=e.children;for(let s=0,o=i.length;s<o;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,Fr),Fr.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(Ec),rh.subVectors(this.max,Ec),il.subVectors(e.a,Ec),rl.subVectors(e.b,Ec),sl.subVectors(e.c,Ec),io.subVectors(rl,il),ro.subVectors(sl,rl),No.subVectors(il,sl);let t=[0,-io.z,io.y,0,-ro.z,ro.y,0,-No.z,No.y,io.z,0,-io.x,ro.z,0,-ro.x,No.z,0,-No.x,-io.y,io.x,0,-ro.y,ro.x,0,-No.y,No.x,0];return!lg(t,il,rl,sl,rh)||(t=[1,0,0,0,1,0,0,0,1],!lg(t,il,rl,sl,rh))?!1:(sh.crossVectors(io,ro),t=[sh.x,sh.y,sh.z],lg(t,il,rl,sl,rh))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Fr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Fr).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:(ys[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ys[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ys[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ys[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ys[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ys[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ys[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ys[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ys),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 ys=[new V,new V,new V,new V,new V,new V,new V,new V],Fr=new V,ih=new jn,il=new V,rl=new V,sl=new V,io=new V,ro=new V,No=new V,Ec=new V,rh=new V,sh=new V,Oo=new V;function lg(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Oo.fromArray(r,s);const a=i.x*Math.abs(Oo.x)+i.y*Math.abs(Oo.y)+i.z*Math.abs(Oo.z),l=e.dot(Oo),c=t.dot(Oo),u=n.dot(Oo);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const h2=new jn,Tc=new V,cg=new V;class Zn{constructor(e=new V,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):h2.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;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;Tc.subVectors(e,this.center);const t=Tc.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Tc,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):(cg.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Tc.copy(e.center).add(cg)),this.expandByPoint(Tc.copy(e.center).sub(cg))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const _s=new V,ug=new V,oh=new V,so=new V,dg=new V,ah=new V,hg=new V;class $s{constructor(e=new V,t=new V(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,_s)),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=_s.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(_s.copy(this.origin).addScaledVector(this.direction,t),_s.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){ug.copy(e).add(t).multiplyScalar(.5),oh.copy(t).sub(e).normalize(),so.copy(this.origin).sub(ug);const s=e.distanceTo(t)*.5,o=-this.direction.dot(oh),a=so.dot(this.direction),l=-so.dot(oh),c=so.lengthSq(),u=Math.abs(1-o*o);let d,h,f,p;if(u>0)if(d=o*l-a,h=o*a-l,p=s*u,d>=0)if(h>=-p)if(h<=p){const m=1/u;d*=m,h*=m,f=d*(d+o*h+2*a)+h*(o*d+h+2*l)+c}else h=s,d=Math.max(0,-(o*h+a)),f=-d*d+h*(h+2*l)+c;else h=-s,d=Math.max(0,-(o*h+a)),f=-d*d+h*(h+2*l)+c;else h<=-p?(d=Math.max(0,-(-o*s+a)),h=d>0?-s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c):h<=p?(d=0,h=Math.min(Math.max(-s,-l),s),f=h*(h+2*l)+c):(d=Math.max(0,-(o*s+a)),h=d>0?s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c);else h=o>0?-s:s,d=Math.max(0,-(o*h+a)),f=-d*d+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(ug).addScaledVector(oh,h),f}intersectSphere(e,t){_s.subVectors(e.center,this.origin);const n=_s.dot(this.direction),i=_s.dot(_s)-n*n,s=e.radius*e.radiu
vendor: 15,251 bytes, line 6
6s;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,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,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o<i||isNaN(i))&&(i=o),d>=0?(a=(e.min.z-h.z)*d,l=(e.max.z-h.z)*d):(a=(e.max.z-h.z)*d,l=(e.min.z-h.z)*d),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,_s)!==null}intersectTriangle(e,t,n,i,s){dg.subVectors(t,e),ah.subVectors(n,e),hg.crossVectors(dg,ah);let o=this.direction.dot(hg),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;so.subVectors(this.origin,e);const l=a*this.direction.dot(ah.crossVectors(so,ah));if(l<0)return null;const c=a*this.direction.dot(dg.cross(so));if(c<0||l+c>o)return null;const u=-a*so.dot(hg);return u<0?null:this.at(u/o,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 St{constructor(e,t,n,i,s,o,a,l,c,u,d,h,f,p,m,g){St.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,l,c,u,d,h,f,p,m,g)}set(e,t,n,i,s,o,a,l,c,u,d,h,f,p,m,g){const v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=s,v[5]=o,v[9]=a,v[13]=l,v[2]=c,v[6]=u,v[10]=d,v[14]=h,v[3]=f,v[7]=p,v[11]=m,v[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new St().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/ol.setFromMatrixColumn(e,0).length(),s=1/ol.setFromMatrixColumn(e,1).length(),o=1/ol.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]*o,t[9]=n[9]*o,t[10]=n[10]*o,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,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const h=o*u,f=o*d,p=a*u,m=a*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=f+p*c,t[5]=h-m*c,t[9]=-a*l,t[2]=m-h*c,t[6]=p+f*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,f=l*d,p=c*u,m=c*d;t[0]=h+m*a,t[4]=p*a-f,t[8]=o*c,t[1]=o*d,t[5]=o*u,t[9]=-a,t[2]=f*a-p,t[6]=m+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,f=l*d,p=c*u,m=c*d;t[0]=h-m*a,t[4]=-o*d,t[8]=p+f*a,t[1]=f+p*a,t[5]=o*u,t[9]=m-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,f=o*d,p=a*u,m=a*d;t[0]=l*u,t[4]=p*c-f,t[8]=h*c+m,t[1]=l*d,t[5]=m*c+h,t[9]=f*c-p,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,f=o*c,p=a*l,m=a*c;t[0]=l*u,t[4]=m-h*d,t[8]=p*d+f,t[1]=d,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=f*d+p,t[10]=h-m*d}else if(e.order==="XZY"){const h=o*l,f=o*c,p=a*l,m=a*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=h*d+m,t[5]=o*u,t[9]=f*d-p,t[2]=p*d-f,t[6]=a*u,t[10]=m*d+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(f2,e,p2)}lookAt(e,t,n){const i=this.elements;return fr.subVectors(e,t),fr.lengthSq()===0&&(fr.z=1),fr.normalize(),oo.crossVectors(n,fr),oo.lengthSq()===0&&(Math.abs(n.z)===1?fr.x+=1e-4:fr.z+=1e-4,fr.normalize(),oo.crossVectors(n,fr)),oo.normalize(),lh.crossVectors(fr,oo),i[0]=oo.x,i[4]=lh.x,i[8]=fr.x,i[1]=oo.y,i[5]=lh.y,i[9]=fr.y,i[2]=oo.z,i[6]=lh.z,i[10]=fr.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,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],d=n[5],h=n[9],f=n[13],p=n[2],m=n[6],g=n[10],v=n[14],y=n[3],_=n[7],x=n[11],T=n[15],b=i[0],M=i[4],E=i[8],S=i[12],w=i[1],D=i[5],R=i[9],k=i[13],N=i[2],H=i[6],P=i[10],ee=i[14],X=i[3],Q=i[7],Y=i[11],z=i[15];return s[0]=o*b+a*w+l*N+c*X,s[4]=o*M+a*D+l*H+c*Q,s[8]=o*E+a*R+l*P+c*Y,s[12]=o*S+a*k+l*ee+c*z,s[1]=u*b+d*w+h*N+f*X,s[5]=u*M+d*D+h*H+f*Q,s[9]=u*E+d*R+h*P+f*Y,s[13]=u*S+d*k+h*ee+f*z,s[2]=p*b+m*w+g*N+v*X,s[6]=p*M+m*D+g*H+v*Q,s[10]=p*E+m*R+g*P+v*Y,s[14]=p*S+m*k+g*ee+v*z,s[3]=y*b+_*w+x*N+T*X,s[7]=y*M+_*D+x*H+T*Q,s[11]=y*E+_*R+x*P+T*Y,s[15]=y*S+_*k+x*ee+T*z,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],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],d=e[6],h=e[10],f=e[14],p=e[3],m=e[7],g=e[11],v=e[15];return p*(+s*l*d-i*c*d-s*a*h+n*c*h+i*a*f-n*l*f)+m*(+t*l*f-t*c*h+s*o*h-i*o*f+i*c*u-s*l*u)+g*(+t*c*d-t*a*f-s*o*d+n*o*f+s*a*u-n*c*u)+v*(-i*a*u-t*l*d+t*a*h+i*o*d-n*o*h+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const 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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],p=e[12],m=e[13],g=e[14],v=e[15],y=d*g*c-m*h*c+m*l*f-a*g*f-d*l*v+a*h*v,_=p*h*c-u*g*c-p*l*f+o*g*f+u*l*v-o*h*v,x=u*m*c-p*d*c+p*a*f-o*m*f-u*a*v+o*d*v,T=p*d*l-u*m*l-p*a*h+o*m*h+u*a*g-o*d*g,b=t*y+n*_+i*x+s*T;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/b;return e[0]=y*M,e[1]=(m*h*s-d*g*s-m*i*f+n*g*f+d*i*v-n*h*v)*M,e[2]=(a*g*s-m*l*s+m*i*c-n*g*c-a*i*v+n*l*v)*M,e[3]=(d*l*s-a*h*s-d*i*c+n*h*c+a*i*f-n*l*f)*M,e[4]=_*M,e[5]=(u*g*s-p*h*s+p*i*f-t*g*f-u*i*v+t*h*v)*M,e[6]=(p*l*s-o*g*s-p*i*c+t*g*c+o*i*v-t*l*v)*M,e[7]=(o*h*s-u*l*s+u*i*c-t*h*c-o*i*f+t*l*f)*M,e[8]=x*M,e[9]=(p*d*s-u*m*s-p*n*f+t*m*f+u*n*v-t*d*v)*M,e[10]=(o*m*s-p*a*s+p*n*c-t*m*c-o*n*v+t*a*v)*M,e[11]=(u*a*s-o*d*s-u*n*c+t*d*c+o*n*f-t*a*f)*M,e[12]=T*M,e[13]=(u*m*i-p*d*i+p*n*h-t*m*h-u*n*g+t*d*g)*M,e[14]=(p*a*i-o*m*i-p*n*l+t*m*l+o*n*g-t*a*g)*M,e[15]=(o*d*i-u*a*i+u*n*l-t*d*l-o*n*h+t*a*h)*M,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,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,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,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,d=a+a,h=s*c,f=s*u,p=s*d,m=o*u,g=o*d,v=a*d,y=l*c,_=l*u,x=l*d,T=n.x,b=n.y,M=n.z;return i[0]=(1-(m+v))*T,i[1]=(f+x)*T,i[2]=(p-_)*T,i[3]=0,i[4]=(f-x)*b,i[5]=(1-(h+v))*b,i[6]=(g+y)*b,i[7]=0,i[8]=(p+_)*M,i[9]=(g-y)*M,i[10]=(1-(h+m))*M,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;let s=ol.set(i[0],i[1],i[2]).length();const o=ol.set(i[4],i[5],i[6]).length(),a=ol.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Br.copy(this);const c=1/s,u=1/o,d=1/a;return Br.elements[0]*=c,Br.elements[1]*=c,Br.elements[2]*=c,Br.elements[4]*=u,Br.elements[5]*=u,Br.elements[6]*=u,Br.elements[8]*=d,Br.elements[9]*=d,Br.elements[10]*=d,t.setFromRotationMatrix(Br),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=Rr){const l=this.elements,c=2*s/(t-e),u=2*s/(n-i),d=(t+e)/(t-e),h=(n+i)/(n-i);let f,p;if(a===Rr)f=-(o+s)/(o-s),p=-2*o*s/(o-s);else if(a===Su)f=-o/(o-s),p=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=p,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=Rr){const l=this.elements,c=1/(t-e),u=1/(n-i),d=1/(o-s),h=(t+e)*c,f=(n+i)*u;let p,m;if(a===Rr)p=(o+s)*d,m=-2*d;else if(a===Su)p=s*d,m=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=m,l[14]=-p,l[3]=0,l[7]=0,l[11]=0,l[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}}const ol=new V,Br=new St,f2=new V(0,0,0),p2=new V(1,1,1),oo=new V,lh=new V,fr=new V,ix=new St,rx=new $n;class xr{constructor(e=0,t=0,n=0,i=xr.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],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],d=i[2],h=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin($t(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-$t(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin($t(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-$t(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin($t(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-$t(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ix.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ix,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return rx.setFromEuler(this),this.setFromQuaternion(rx,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}}xr.DEFAULT_ORDER="XYZ";class pm{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 m2=0;const sx=new V,al=new $n,xs=new St,ch=new V,Ac=new V,g2=new V,v2=new $n,ox=new V(1,0,0),ax=new V(0,1,0),lx=new V(0,0,1),cx={type:"added"},y2={type:"removed"},ll={type:"childadded",child:null},fg={type:"childremoved",child:null};class an extends vs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:m2++}),this.uuid=_r(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=an.DEFAULT_UP.clone();const e=new V,t=new xr,n=new $n,i=new V(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),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 St},normalMatrix:{value:new Yt}}),this.matrix=new St,this.matrixWorld=new St,this.matrixAutoUpdate=an.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=an.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new pm,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 4,289 bytes, line 6
6setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return al.setFromAxisAngle(e,t),this.quaternion.multiply(al),this}rotateOnWorldAxis(e,t){return al.setFromAxisAngle(e,t),this.quaternion.premultiply(al),this}rotateX(e){return this.rotateOnAxis(ox,e)}rotateY(e){return this.rotateOnAxis(ax,e)}rotateZ(e){return this.rotateOnAxis(lx,e)}translateOnAxis(e,t){return sx.copy(e).applyQuaternion(this.quaternion),this.position.add(sx.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ox,e)}translateY(e){return this.translateOnAxis(ax,e)}translateZ(e){return this.translateOnAxis(lx,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(xs.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ch.copy(e):ch.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ac.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xs.lookAt(Ac,ch,this.up):xs.lookAt(ch,Ac,this.up),this.quaternion.setFromRotationMatrix(xs),i&&(xs.extractRotation(i.matrixWorld),al.setFromRotationMatrix(xs),this.quaternion.premultiply(al.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(cx),ll.child=e,this.dispatchEvent(ll),ll.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(y2),fg.child=e,this.dispatchEvent(fg),fg.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),xs.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),xs.multiply(e.parent.matrixWorld)),e.applyMatrix4(xs),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(cx),ll.child=e,this.dispatchEvent(ll),ll.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 o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,o=i.length;s<o;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(Ac,e,g2),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ac,v2,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),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){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 7,551 bytes, line 6
6):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const 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),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.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),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(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),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(a,l){return a[l.uuid]===void 0&&(a[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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}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 a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),d=o(e.shapes),h=o(e.skeletons),f=o(e.animations),p=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),d.length>0&&(n.shapes=d),h.length>0&&(n.skeletons=h),f.length>0&&(n.animations=f),p.length>0&&(n.nodes=p)}return n.object=i,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}an.DEFAULT_UP=new V(0,1,0);an.DEFAULT_MATRIX_AUTO_UPDATE=!0;an.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const zr=new V,bs=new V,pg=new V,ws=new V,cl=new V,ul=new V,ux=new V,mg=new V,gg=new V,vg=new V,yg=new Kt,_g=new Kt,xg=new Kt;class sr{constructor(e=new V,t=new V,n=new V){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),zr.subVectors(e,t),i.cross(zr);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){zr.subVectors(i,t),bs.subVectors(n,t),pg.subVectors(e,t);const o=zr.dot(zr),a=zr.dot(bs),l=zr.dot(pg),c=bs.dot(bs),u=bs.dot(pg),d=o*c-a*a;if(d===0)return s.set(0,0,0),null;const h=1/d,f=(c*l-a*u)*h,p=(o*u-a*l)*h;return s.set(1-f-p,p,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,ws)===null?!1:ws.x>=0&&ws.y>=0&&ws.x+ws.y<=1}static getInterpolation(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,ws)===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,ws.x),l.addScaledVector(o,ws.y),l.addScaledVector(a,ws.z),l)}static getInterpolatedAttribute(e,t,n,i,s,o){return yg.setScalar(0),_g.setScalar(0),xg.setScalar(0),yg.fromBufferAttribute(e,t),_g.fromBufferAttribute(e,n),xg.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(yg,s.x),o.addScaledVector(_g,s.y),o.addScaledVector(xg,s.z),o}static isFrontFacing(e,t,n,i){return zr.subVectors(n,t),bs.subVectors(e,t),zr.cross(bs).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 zr.subVectors(this.c,this.b),bs.subVectors(this.a,this.b),zr.cross(bs).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return sr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return sr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return sr.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return sr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return sr.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 o,a;cl.subVectors(i,n),ul.subVectors(s,n),mg.subVectors(e,n);const l=cl.dot(mg),c=ul.dot(mg);if(l<=0&&c<=0)return t.copy(n);gg.subVectors(e,i);const u=cl.dot(gg),d=ul.dot(gg);
vendor: 7,536 bytes, line 6
6if(u>=0&&d<=u)return t.copy(i);const h=l*d-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(cl,o);vg.subVectors(e,s);const f=cl.dot(vg),p=ul.dot(vg);if(p>=0&&f<=p)return t.copy(s);const m=f*c-l*p;if(m<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(n).addScaledVector(ul,a);const g=u*p-f*d;if(g<=0&&d-u>=0&&f-p>=0)return ux.subVectors(s,i),a=(d-u)/(d-u+(f-p)),t.copy(i).addScaledVector(ux,a);const v=1/(g+m+h);return o=m*v,a=h*v,t.copy(n).addScaledVector(cl,o).addScaledVector(ul,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const xS={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},ao={h:0,s:0,l:0},uh={h:0,s:0,l:0};function bg(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 st{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=Ln){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=rn.workingColorSpace){return this.r=e,this.g=t,this.b=n,rn.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=rn.workingColorSpace){if(e=ry(e,1),t=$t(t,0,1),n=$t(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=bg(o,s,e+1/3),this.g=bg(o,s,e),this.b=bg(o,s,e-1/3)}return rn.colorSpaceToWorking(this,i),this}setStyle(e,t=Ln){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ln){const n=xS[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Hs(e.r),this.g=Hs(e.g),this.b=Hs(e.b),this}copyLinearToSRGB(e){return this.r=Ul(e.r),this.g=Ul(e.g),this.b=Ul(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ln){return rn.workingToColorSpace(ki.copy(this),e),Math.round($t(ki.r*255,0,255))*65536+Math.round($t(ki.g*255,0,255))*256+Math.round($t(ki.b*255,0,255))}getHexString(e=Ln){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=rn.workingColorSpace){rn.workingToColorSpace(ki.copy(this),t);const n=ki.r,i=ki.g,s=ki.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const d=o-a;switch(c=u<=.5?d/(o+a):d/(2-o-a),o){case n:l=(i-s)/d+(i<s?6:0);break;case i:l=(s-n)/d+2;break;case s:l=(n-i)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=rn.workingColorSpace){return rn.workingToColorSpace(ki.copy(this),t),e.r=ki.r,e.g=ki.g,e.b=ki.b,e}getStyle(e=Ln){rn.workingToColorSpace(ki.copy(this),e);const t=ki.r,n=ki.g,i=ki.b;return e!==Ln?`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(ao),this.setHSL(ao.h+e,ao.s+t,ao.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}
vendor: 2,655 bytes, line 6
6lerpColors(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(ao),e.getHSL(uh);const n=ru(ao.h,uh.h,t),i=ru(ao.s,uh.s,t),s=ru(ao.l,uh.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 ki=new st;st.NAMES=xS;let _2=0;class Mi extends vs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_2++}),this.uuid=_r(),this.name="",this.type="Material",this.blending=Ia,this.side=ms,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zf,this.blendDst=Vf,this.blendEquation=go,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new st(0,0,0),this.blendAlpha=0,this.depthFunc=Oa,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Tv,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=oa,this.stencilZFail=oa,this.stencilZPass=oa,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):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"}};
vendor: 8,832 bytes, line 6
6n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ia&&(n.blending=this.blending),this.side!==ms&&(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!==zf&&(n.blendSrc=this.blendSrc),this.blendDst!==Vf&&(n.blendDst=this.blendDst),this.blendEquation!==go&&(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!==Oa&&(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!==Tv&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==oa&&(n.stencilFail=this.stencilFail),this.stencilZFail!==oa&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==oa&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const 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.clipSh
vendor: 6,357 bytes, line 6
6adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Bi extends Mi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new st(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 xr,this.combine=Bd,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 Bs=x2();function x2(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function Qi(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=$t(r,-65504,65504),Bs.floatView[0]=r;const e=Bs.uint32View[0],t=e>>23&511;return Bs.baseTable[t]+((e&8388607)>>Bs.shiftTable[t])}function Xc(r){const e=r>>10;return Bs.uint32View[0]=Bs.mantissaTable[Bs.offsetTable[e]+(r&1023)]+Bs.exponentTable[e],Bs.floatView[0]}class b2{static toHalfFloat(e){return Qi(e)}static fromHalfFloat(e){return Xc(e)}}const ii=new V,dh=new Ue;let w2=0;class Zt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:w2++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=wu,this.updateRanges=[],this.gpuType=ar,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++)dh.fromBufferAttribute(this,t),dh.applyMatrix3(e),this.setXY(t,dh.x,dh.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ii.fromBufferAttribute(this,t),ii.applyMatrix3(e),this.setXYZ(t,ii.x,ii.y,ii.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ii.fromBufferAttribute(this,t),ii.applyMatrix4(e),this.setXYZ(t,ii.x,ii.y,ii.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ii.fromBufferAttribute(this,t),ii.applyNormalMatrix(e),this.setXYZ(t,ii.x,ii.y,ii.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ii.fromBufferAttribute(this,t),ii.transformDirection(e),this.setXYZ(t,ii.x,ii.y,ii.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=Xi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Jt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Xi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Xi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Jt(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=Xi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Jt(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=Xi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(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=Jt(t,this.array),n=Jt(n,this.array),i=Jt(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=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array),s=Jt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}
vendor: 8,921 bytes, line 6
6onUpload(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!==wu&&(e.usage=this.usage),e}}class S2 extends Zt{constructor(e,t,n){super(new Int8Array(e),t,n)}}class M2 extends Zt{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class E2 extends Zt{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class T2 extends Zt{constructor(e,t,n){super(new Int16Array(e),t,n)}}class oy extends Zt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class A2 extends Zt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class ay extends Zt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class C2 extends Zt{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Xc(this.array[e*this.itemSize]);return this.normalized&&(t=Xi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize]=Qi(t),this}getY(e){let t=Xc(this.array[e*this.itemSize+1]);return this.normalized&&(t=Xi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize+1]=Qi(t),this}getZ(e){let t=Xc(this.array[e*this.itemSize+2]);return this.normalized&&(t=Xi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize+2]=Qi(t),this}getW(e){let t=Xc(this.array[e*this.itemSize+3]);return this.normalized&&(t=Xi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Jt(t,this.array)),this.array[e*this.itemSize+3]=Qi(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array)),this.array[e+0]=Qi(t),this.array[e+1]=Qi(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array)),this.array[e+0]=Qi(t),this.array[e+1]=Qi(n),this.array[e+2]=Qi(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array),s=Jt(s,this.array)),this.array[e+0]=Qi(t),this.array[e+1]=Qi(n),this.array[e+2]=Qi(i),this.array[e+3]=Qi(s),this}}class ot extends Zt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let R2=0;const Mr=new St,wg=new an,dl=new V,pr=new jn,Cc=new jn,vi=new V;class Ht extends vs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:R2++}),this.uuid=_r(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(vS(e)?ay:oy)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Yt().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}applyQuaternion(e){return Mr.makeRotationFromQuaternion(e),this.applyMatrix4(Mr),this}rotateX(e){return Mr.makeRotationX(e),this.applyMatrix4(Mr),this}rotateY(e){return Mr.makeRotationY(e),this.applyMatrix4(Mr),this}rotateZ(e){return Mr.makeRotationZ(e),this.applyMatrix4(Mr),this}translate(e,t,n){return Mr.makeTranslation(e,t,n),this.applyMatrix4(Mr),this}scale(e,t,n){return Mr.makeScale(e,t,n),this.applyMatrix4(Mr),this}lookAt(e){return wg.lookAt(e),wg.updateMatrix(),this.applyMatrix4(wg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(dl).negate(),this.translate(dl.x,dl.y,dl.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 o=e[i];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new ot(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&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new jn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new V(-1/0,-1/0,-1/0),new V(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];pr.setFromBufferAttribute(s),this.morphTargetsRelative?(vi.addVectors(this.boundingBox.min,pr.min),this.boundingBox.expandByPoint(vi),vi.addVectors(this.boundingBox.max,pr.max),this.boundingBox.expandByPoint(vi)):(this.boundingBox.expandByPoint(pr.min),this.boundingBox.expandByPoint(pr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new V,1/0);return}if(e){const n=this.boundingSphere.center;if(pr.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];Cc.setFromBufferAttribute(a),this.morphTargetsRelative?(vi.addVectors(pr.min,Cc.min),pr.expandByPoint(vi),vi.addVectors(pr.max,Cc.max),pr.expandByPoint(vi)):(pr.expandByPoint(Cc.min),pr.expandByPoint(Cc.max))}pr.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)vi.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(vi));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)vi.fromBufferAttribute(a,c),l&&(dl.fromBufferAttribute(e,c),vi.add(dl)),i=Math.max(i,n.distanceToSquared(vi))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Zt(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let E=0;E<n.count;E++)a[E]=new V,l[E]=new V;const c=new V,u=new V,d=new V,h=new Ue,f=new Ue,p=new Ue,m=new V,g=new V;function v(E,S,w){c.fromBufferAttribute(n,E),u.fromBufferAttribute(n,S),d.fromBufferAttribute(n,w),h.fromBufferAttribute(s,E),f.fromBufferAttribute(s,S),p.fromBufferAttribute(s,w),u.sub(c),d.sub(c),f.sub(h),p.sub(h);const D=1/(f.x*p.y-p.x*f.y);isFinite(D)&&(m.copy(u).multiplyScalar(p.y).addScaledVector(d,-f.y).multiplyScalar(D),g.copy(d).multiplyScalar(f.x).addScaledVector(u,-p.x).multiplyScalar(D),a[E].add(m),a[S].add(m),a[w].add(m),l[E].add(g),l[S].add(g),l[w].add(g))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let E=0,S=y.length;E<S;++E){const w=y[E],D=w.start,R=w.count;for(let k=D,N=D+R;k<N;k+=3)v(e.getX(k+0),e.getX(k+1),e.getX(k+2))}const _=new V,x=new V,T=new V,b=new V;function M(E){T.fromBufferAttribute(i,E),b.copy(T);const S=a[E];_.copy(S),_.sub(T.multiplyScalar(T.dot(S))).normalize(),x.crossVectors(b,S);const D=x.dot(l[E])<0?-1:1;o.setXYZW(E,_.x,_.y,_.z,D)}for(let E=0,S=y.length;E<S;++E){const w=y[E],D=w.start,R=w.count;for(let k=D,N=D+R;k<N;k+=3)M(e.getX(k+0)),M(e.getX(k+1)),M(e.getX(k+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Zt(new Float32Array(t.count*3),3),this.setAttribute("normal",n
vendor: 6,273 bytes, line 6
6);else for(let h=0,f=n.count;h<f;h++)n.setXYZ(h,0,0,0);const i=new V,s=new V,o=new V,a=new V,l=new V,c=new V,u=new V,d=new V;if(e)for(let h=0,f=e.count;h<f;h+=3){const p=e.getX(h+0),m=e.getX(h+1),g=e.getX(h+2);i.fromBufferAttribute(t,p),s.fromBufferAttribute(t,m),o.fromBufferAttribute(t,g),u.subVectors(o,s),d.subVectors(i,s),u.cross(d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),a.add(u),l.add(u),c.add(u),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)i.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),o.fromBufferAttribute(t,h+2),u.subVectors(o,s),d.subVectors(i,s),u.cross(d),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)vi.fromBufferAttribute(e,t),vi.normalize(),e.setXYZ(t,vi.x,vi.y,vi.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,d=a.normalized,h=new c.constructor(l.length*u);let f=0,p=0;for(let m=0,g=l.length;m<g;m++){a.isInterleavedBufferAttribute?f=l[m]*a.data.stride+a.offset:f=l[m]*u;for(let v=0;v<u;v++)h[p++]=c[f++]}return new Zt(h,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ht,n=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,n);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,d=c.length;u<d;u++){const h=c[u],f=e(h,n);l.push(f)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,h=c.length;d<h;d++){const f=c[d];u.push(f.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.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=[],d=s[c];for(let h=0,f=d.length;h<f;h++)u.push(d[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const d=o[c];this.addGroup(d.start,d.count,d.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const dx=new St,Fo=new $s,hh=new Zn,hx=new V,fh=new V,ph=new V,mh=new V,Sg=new V,gh=new V,fx=new V,vh=new V;class fn extends an{constructor(e=new Ht,t=new Bi){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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){gh.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],d=s[l];u!==0&&(Sg.fromBufferAttribute(d,e),o?gh.addScaledVector(Sg,u):gh.addScaledVector(Sg.sub(t),u))}t.add(gh)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),hh.copy(n.boundingSphere),hh.applyMatrix4(s),Fo.copy(e.ray).recast(e.near),!(hh.containsPoint(Fo.origin)===!1&&(Fo.intersectSphere(hh,hx)===null||Fo.origin.distanceToSquared(hx)>(e.far-e.near)**2))&&(dx.copy(s).invert(),Fo.copy(e.ray).applyMatrix4(dx),!(n.boundingBox!==null&&Fo.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Fo)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,h=s.groups,f=s.drawRange;if(a!==null)if(Array.isArray(o))for(let p=0,m=h.length;p<m;p++){const g=h[p],v=o[g.materialIndex],y=Math.max(g.start,f.start),_=Math.min(a.count,Math.min(g.start+g.count,f.start+f.count));for(let x=y,T=_;x<T;x+=3){const b=a.getX(x),M=a.getX(x+1),E=a.getX(x+2);i=yh(this,v,e,n,c,u,d,b,M,E),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const p=Math.max(0,f.start),m=Math.min(a.count,f.start+f.count);for(let g=p,v=m;g<v;g+=3){const y=a.getX(g),_=a.getX(g+1),x=a.getX(g+2);
vendor: 7,056 bytes, lines 6-10
6i=yh(this,o,e,n,c,u,d,y,_,x),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let p=0,m=h.length;p<m;p++){const g=h[p],v=o[g.materialIndex],y=Math.max(g.start,f.start),_=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let x=y,T=_;x<T;x+=3){const b=x,M=x+1,E=x+2;i=yh(this,v,e,n,c,u,d,b,M,E),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const p=Math.max(0,f.start),m=Math.min(l.count,f.start+f.count);for(let g=p,v=m;g<v;g+=3){const y=g,_=g+1,x=g+2;i=yh(this,o,e,n,c,u,d,y,_,x),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function P2(r,e,t,n,i,s,o,a){let l;if(e.side===Fi?l=n.intersectTriangle(o,s,i,!0,a):l=n.intersectTriangle(i,s,o,e.side===ms,a),l===null)return null;vh.copy(a),vh.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(vh);return c<t.near||c>t.far?null:{distance:c,point:vh.clone(),object:r}}function yh(r,e,t,n,i,s,o,a,l,c){r.getVertexPosition(a,fh),r.getVertexPosition(l,ph),r.getVertexPosition(c,mh);const u=P2(r,e,t,n,fh,ph,mh,fx);if(u){const d=new V;sr.getBarycoord(fx,fh,ph,mh,d),i&&(u.uv=sr.getInterpolatedAttribute(i,a,l,c,d,new Ue)),s&&(u.uv1=sr.getInterpolatedAttribute(s,a,l,c,d,new Ue)),o&&(u.normal=sr.getInterpolatedAttribute(o,a,l,c,d,new V),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new V,materialIndex:0};sr.getNormal(fh,ph,mh,h.normal),u.face=h,u.barycoord=d}return u}class qa extends Ht{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],d=[];let h=0,f=0;p("z","y","x",-1,-1,n,t,e,o,s,0),p("z","y","x",1,-1,n,t,-e,o,s,1),p("x","z","y",1,1,e,n,t,i,o,2),p("x","z","y",1,-1,e,n,-t,i,o,3),p("x","y","z",1,-1,e,t,n,i,s,4),p("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new ot(c,3)),this.setAttribute("normal",new ot(u,3)),this.setAttribute("uv",new ot(d,2));function p(m,g,v,y,_,x,T,b,M,E,S){const w=x/M,D=T/E,R=x/2,k=T/2,N=b/2,H=M+1,P=E+1;let ee=0,X=0;const Q=new V;for(let Y=0;Y<P;Y++){const z=Y*D-k;for(let K=0;K<H;K++){const te=K*w-R;Q[m]=te*y,Q[g]=z*_,Q[v]=N,c.push(Q.x,Q.y,Q.z),Q[m]=0,Q[g]=0,Q[v]=b>0?1:-1,u.push(Q.x,Q.y,Q.z),d.push(K/M),d.push(1-Y/E),ee+=1}}for(let Y=0;Y<E;Y++)for(let z=0;z<M;z++){const K=h+z+H*Y,te=h+z+H*(Y+1),O=h+(z+1)+H*(Y+1),U=h+(z+1)+H*Y;l.push(K,te,U),l.push(te,O,U),X+=6}a.addGroup(f,X,S),f+=X,h+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qa(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function sc(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Hi(r){const e={};for(let t=0;t<r.length;t++){const n=sc(r[t]);for(const i in n)e[i]=n[i]}return e}function I2(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function bS(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:rn.workingColorSpace}const Vd={clone:sc,merge:Hi};var D2=`void main() {
7	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
8}`,L2=`void main() {
9	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
10}`;class Dr extends Mi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=D2,this.fragmentShader=L2,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=sc(e.uniforms),this.uniformsGroups=I2(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}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}}let mm=class extends an{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new St,this.projectionMatrix=new St,this.projectionMatrixInverse=new St,this.coordinateSystem=Rr}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};const lo=new V,px=new Ue,mx=new Ue;class Qn extends mm{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=rc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Da*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,156 bytes, line 10
10getEffectiveFOV(){return rc*2*Math.atan(Math.tan(Da*.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){lo.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(lo.x,lo.y).multiplyScalar(-e/lo.z),lo.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(lo.x,lo.y).multiplyScalar(-e/lo.z)}getViewSize(e,t){return this.getViewBounds(e,px,mx),t.subVectors(mx,px)}setViewOffset(e,t,n,i,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Da*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const hl=-90,fl=1;class wS extends an{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Qn(hl,fl,e,t);i.layers=this.layers,this.add(i);const s=new Qn(hl,fl,e,t);s.layers=this.layers,this.add(s);const o=new Qn(hl,fl,e,t);o.layers=this.layers,this.add(o);const a=new Qn(hl,fl,e,t);a.layers=this.layers,this.add(a);const l=new Qn(hl,fl,e,t);l.layers=this.layers,this.add(l);const c=new Qn(hl,fl,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Rr)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),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Su)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),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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,o,a,l,c,u]=this.children,d=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,o),e.setRenderTarget(n,2,i),e.render(t,a),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(d,h,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Gd extends Wn{constructor(e=[],t=Ws,n,i,s,o,a,l,c,u){super(e,t,n,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class SS extends gs{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Gd(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 30,186 bytes, lines 10-45
10=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
11
12				varying vec3 vWorldDirection;
13
14				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
15
16					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
17
18				}
19
20				void main() {
21
22					vWorldDirection = transformDirection( position, modelMatrix );
23
24					#include <begin_vertex>
25					#include <project_vertex>
26
27				}
28			`,fragmentShader:`
29
30				uniform sampler2D tEquirect;
31
32				varying vec3 vWorldDirection;
33
34				#include <common>
35
36				void main() {
37
38					vec3 direction = normalize( vWorldDirection );
39
40					vec2 sampleUV = equirectUv( direction );
41
42					gl_FragColor = texture2D( tEquirect, sampleUV );
43
44				}
45			`},i=new qa(5,5,5),s=new Dr({name:"CubemapFromEquirect",uniforms:sc(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Fi,blending:Gs});s.uniforms.tEquirect.value=t;const o=new fn(i,s),a=t.minFilter;return t.minFilter===Hr&&(t.minFilter=ei),new wS(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}class Pr extends an{constructor(){super(),this.isGroup=!0,this.type="Group"}}const k2={type:"move"};class Ef{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Pr,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 Pr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new V,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new V),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Pr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new V,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new V),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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const m of e.hand.values()){const g=t.getJointPose(m,n),v=this._getHandJoint(c,m);g!==null&&(v.matrix.fromArray(g.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=g.radius),v.visible=g!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),f=.02,p=.005;c.inputState.pinching&&h>f+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=f-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(k2)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Pr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class gm{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new st(e),this.density=t}clone(){return new gm(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class vm{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new st(e),this.near=t,this.far=n}clone(){return new vm(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Hd extends an{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 xr,this.environmentIntensity=1,this.environmentRotation=new xr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ym{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=wu,this.updateRanges=[],this.version=0,this.uuid=_r()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_r()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=_r()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Gi=new V;class vr{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Gi.fromBufferAttribute(this,t),Gi.applyMatrix4(e),this.setXYZ(t,Gi.x,Gi.y,Gi.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Gi.fromBufferAttribute(this,t),Gi.applyNormalMatrix(e),this.setXYZ(t,Gi.x,Gi.y,Gi.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Gi.fromBufferAttribute(this,t),Gi.transformDirection(e),this.setXYZ(t,Gi.x,Gi.y,Gi.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Xi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Jt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Jt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Xi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Xi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Xi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Xi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Jt(t,this.array),n=Jt(n,this.array),i=Jt(i,this.array),s=Jt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Zt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new vr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class fc extends Mi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new st(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let pl;const Rc=new V,ml=new V,gl=new V,vl=new Ue,Pc=new Ue,MS=new St,_h=new V,Ic=new V,xh=new V,gx=new Ue,Mg=new Ue,vx=new Ue;class Wd extends an{constructor(e=new fc){if(super(),this.isSprite=!0,this.type="Sprite",pl===void 0){pl=new Ht;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new ym(t,5);pl.setIndex([0,1,2,0,2,3]),pl.setAttribute("position",new vr(n,3,0,!1)),pl.setAttribute("uv",new vr(n,2,3,!1))}this.geometry=pl,this.material=e,this.center=new Ue(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ml.setFromMatrixScale(this.matrixWorld),MS.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),gl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ml.multiplyScalar(-gl.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;bh(_h.set(-.5,-.5,0),gl,o,ml,i,s),bh(Ic.set(.5,-.5,0),gl,o,ml,i,s),bh(xh.set(.5,.5,0),gl,o,ml,i,s),gx.set(0,0),Mg.set(1,0),vx.set(1,1);let a=e.ray.intersectTriangle(_h,Ic,xh,!1,Rc);if(a===null&&(bh(Ic.set(-.5,.5,0),gl,o,ml,i,s),Mg.set(0,1),a=e.ray.intersectTriangle(_h,xh,Ic,!1,Rc),a===null))return;const l=e.ray.origin.distanceTo(Rc);l<e.near||l>e.far||t.push({distance:l,point:Rc.clone(),uv:sr.getInterpolation(Rc,_h,Ic,xh,gx,Mg,vx,new Ue),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function bh(r,e,t,n,i,s){vl.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Pc.x=s*vl.x-i*vl.y,Pc.y=i*vl.x+s*vl.y):Pc.copy(vl),r.copy(e),r.x+=Pc.x,r.y+=Pc.y,r.applyMatrix4(MS)}const wh=new V,yx=new V;class ES extends an{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){wh.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(wh);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){wh.setFromMatrixPosition(e.matrixWorld),yx.setFromMatrixPosition(this.matrixWorld);const n=wh.distanceTo(yx)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const _x=new V,xx=new Kt,bx=new Kt,U2=new V,wx=new St,Sh=new V,Eg=new Zn,Sx=new St,Tg=new $s;class ly extends fn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ev,this.bindMatrix=new St,this.bindMatrixInverse=new St,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new jn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Sh),this.boundingBox.expandByPoint(Sh)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Zn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Sh),this.boundingSphere.expandByPoint(Sh)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Eg.copy(this.boundingSphere),Eg.applyMatrix4(i),e.ray.intersectsSphere(Eg)!==!1&&(Sx.copy(i).invert(),Tg.copy(e.ray).applyMatrix4(Sx),!(this.boundingBox!==null&&Tg.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Tg)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Kt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ev?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===rS?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;xx.fromBufferAttribute(i.attributes.skinIndex,e),bx.fromBufferAttribute(i.attributes.skinWeight,e),_x.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=bx.getComponent(s);if(o!==0){const a=xx.getComponent(s);wx.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(U2.copy(_x).applyMatrix4(wx),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class _m extends an{constructor(){super(),this.isBone=!0,this.type="Bone"}}class fs extends Wn{constructor(e=null,t=1,n=1,i,s,o,a,l,c=Ii,u=Ii,d,h){super(null,o,a,l,c,u,i,s,d,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Mx=new St,N2=new St;class jd{constructor(e=[],t=[]){this.uuid=_r(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new St)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new St;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:N2;Mx.multiplyMatrices(a,t[s]),Mx.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new jd(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new fs(t,e,e,qi,ar);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new _m),this.bones.push(o),this.boneInverses.push(new St().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Ba extends Zt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const yl=new St,Ex=new St,Mh=[],Tx=new jn,O2=new St,Dc=new fn,Lc=new Zn;class TS extends fn{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ba(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,O2)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new jn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,yl),Tx.copy(e.boundingBox).applyMatrix4(yl),this.boundingBox.union(Tx)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Zn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,yl),Lc.copy(e.boundingSphere).applyMatrix4(yl),this.boundingSphere.union(Lc)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,o=e*s+1;for(let a=0;a<n.length;a++)n[a]=i[o+a]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Dc.geometry=this.geometry,Dc.material=this.material,Dc.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Lc.copy(this.boundingSphere),Lc.applyMatrix4(n),e.ray.intersectsSphere(Lc)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,yl),Ex.multiplyMatrices(n,yl),Dc.matrixWorld=Ex,Dc.raycast(e,Mh);for(let o=0,a=Mh.length;o<a;o++){const l=Mh[o];l.instanceId=s,l.object=this,t.push(l)}Mh.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ba(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new fs(new Float32Array(i*this.count),i,this.count,lm,ar));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<n.length;c++)o+=n[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=i*e;s[l]=a,s.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Ag=new V,F2=new V,B2=new Yt;class as{constructor(e=new V(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=Ag.subVectors(n,t).cross(F2.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){const n=e.delta(Ag),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||B2.getNormalMatrix(e),i=this.coplanarPoint(Ag).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 Bo=new Zn,Eh=new V;class pc{constructor(e=new as,t=new as,n=new as,i=new as,s=new as,o=new as){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),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=Rr){const n=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],d=i[6],h=i[7],f=i[8],p=i[9],m=i[10],g=i[11],v=i[12],y=i[13],_=i[14],x=i[15];if(n[0].setComponents(l-s,h-c,g-f,x-v).normalize(),n[1].setComponents(l+s,h+c,g+f,x+v).normalize(),n[2].setComponents(l+o,h+u,g+p,x+y).normalize(),n[3].setComponents(l-o,h-u,g-p,x-y).normalize(),n[4].setComponents(l-a,h-d,g-m,x-_).normalize(),t===Rr)n[5].setComponents(l+a,h+d,g+m,x+_).normalize();else if(t===Su)n[5].setComponents(a,d,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(),Bo.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Bo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Bo)}intersectsSprite(e){return Bo.center.set(0,0,0),Bo.radius=.7071067811865476,Bo.applyMatrix4(e.matrixWorld),this.intersectsSphere(Bo)}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(Eh.x=i.normal.x>0?e.max.x:e.min.x,Eh.y=i.normal.y>0?e.max.y:e.min.y,Eh.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Eh)<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)}}const Kr=new St,Qr=new pc;class xm{constructor(){this.coordinateSystem=Rr}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Kr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Qr.setFromProjectionMatrix(Kr,this.coordinateSystem),Qr.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Kr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Qr.setFromProjectionMatrix(Kr,this.coordinateSystem),Qr.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Kr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Qr.setFromProjectionMatrix(Kr,this.coordinateSystem),Qr.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Kr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Qr.setFromProjectionMatrix(Kr,this.coordinateSystem),Qr.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Kr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Qr.setFromProjectionMatrix(Kr,this.coordinateSystem),Qr.containsPoint(e))return!0}return!1}clone(){return new xm}}function Cg(r,e){return r-e}function z2(r,e){return r.z-e.z}function V2(r,e){return e.z-r.z}class G2{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const a=s[this.index];o.push(a),this.index++,a.start=e,a.count=t,a.z=n,a.index=i}reset(){this.list.length=0,this.index=0}}const Zi=new St,H2=new st(1,1,1),Ax=new pc,W2=new xm,Th=new jn,zo=new Zn,kc=new V,Cx=new V,j2=new V,Rg=new G2,
45Ui=new fn,Ah=[];function X2(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let o=0;o<n;o++)e.setComponent(s+t,o,r.getComponent(s,o))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function Vo(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class AS extends fn{constructor(e,t,n=t*2,i){super(new Ht,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new fs(t,e,e,qi,ar);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new fs(t,e,e,zd,js);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new fs(t,e,e,qi,ar);
45n.colorSpace=rn.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,u=new a.constructor(n*l),d=new Zt(u,l,c);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Zt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new jn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,Zi),this.getBoundingBoxAt(s,Th).applyMatrix4(Zi),e.union(Th)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Zn);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,Zi),this.getBoundingSphereAt(s,zo).applyMatrix4(Zi),e.union(zo)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Cg),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;Zi.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(H2.toArray(o.image.data,i*4),o.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?o.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Cg),l=this._availableGeometryIds.shift(),s[l]=i):(l=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(l,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(i&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const u in n.attributes){const d=t.getAttribute(u),h=n.getAttribute(u);X2(d,h,l);const f=d.itemSize;
45for(let p=d.count,m=c;p<m;p++){const g=l+p;for(let v=0;v<f;v++)h.setComponent(g,v,0)}h.needsUpdate=!0,h.addUpdateRange(l*f,c*f)}if(i){const u=a.indexStart,d=a.reservedIndexCount;a.indexCount=t.getIndex().count;for(let h=0;h<o.count;h++)s.setX(u+h,l+o.getX(h));for(let h=o.count,f=d;h<f;h++)s.setX(u+h,l);s.needsUpdate=!0,s.addUpdateRange(u,a.reservedIndexCount)}return a.start=i?a.indexStart:a.vertexStart,a.count=i?a.indexCount:a.vertexCount,a.boundingBox=null,t.boundingBox!==null&&(a.boundingBox=t.boundingBox.clone()),a.boundingSphere=null,t.boundingSphere!==null&&(a.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((o,a)=>a).sort((o,a)=>n[o].vertexStart-n[a].vertexStart),s=this.geometry;for(let o=0,a=n.length;o<a;o++){const l=i[o],c=n[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==t){const{indexStart:u,vertexStart:d,reservedIndexCount:h}=c,f=s.index,p=f.array,m=e-d;for(let g=u;g<u+h;g++)p[g]=p[g]+m;f.array.copyWithin(t,u,u+h),f.addUpdateRange(t,h),c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:u,reservedVertexCount:d}=c,h=s.attributes;for(const f in h){const p=h[f],{array:m,itemSize:g}=p;m.copyWithin(e*g,u*g,(u+d)*g),p.addUpdateRange(e*g,d*g)}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart,this._nextIndexStart=s.index?c.indexStart+c.reservedIndexCount:0,this._nextVertexStart=c.vertexStart+c.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new jn,o=n.index,a=n.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let u=l;o&&(u=o.getX(u)),s.expandByPoint(kc.fromBufferAttribute(a,u))}i.boundingBox=s}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new Zn;this.getBoundingBoxAt(e,Th),Th.getCenter(s.center);const o=n.index,a=n.attributes.position;let l=0;for(let c=i.start,u=i.start+i.count;c<u;c++){let d=c;o&&(d=o.getX(d)),kc.fromBufferAttribute(a,d),l=Math.max(l,s.center.distanceToSquared(kc))}s.radius=Math.sqrt(l),i.boundingSphere=s}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(Cg);t[t.length-1]===n.length;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);Vo(this._multiDrawCounts,i),Vo(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,l=this._colorsTexture;o.dispose(),this._initIndirectTexture(),Vo(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),Vo(a.image.data,this._matricesTexture.image.data),l&&(l.dis
45pose(),this._initColorsTexture(),Vo(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...n.map(a=>a.vertexStart+a.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Ht,this._initializeGeometry(s));const o=this.geometry;s.index&&Vo(s.index.array,o.index.array);for(const a in s.attributes)Vo(s.attributes[a].array,o.attributes[a].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;Ui.material=this.material,Ui.geometry.index=o.index,Ui.geometry.attributes=o.attributes,Ui.geometry.boundingBox===null&&(Ui.geometry.boundingBox=new jn),Ui.geometry.boundingSphere===null&&(Ui.geometry.boundingSphere=new Zn);for(let a=0,l=n.length;a<l;a++){if(!n[a].visible||!n[a].active)continue;const c=n[a].geometryIndex,u=i[c];Ui.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(a,Ui.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,Ui.geometry.boundingBox),this.getBoundingSphereAt(c,Ui.geometry.boundingSphere),Ui.raycast(e,Ah);for(let d=0,h=Ah.length;d<h;d++){const f=Ah[d];f.object=this,f.batchId=a,t.push(f)}Ah.length=0}Ui.material=null,Ui.geometry.index=null,Ui.geometry.attributes={},Ui.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,u=this._multiDrawCounts,d=this._geometryInfo,h=this.perObjectFrustumCulled,f=this._indirectTexture,p=f.image.data,m=n.isArrayCamera?W2:Ax;h&&!n.isArrayCamera&&(Zi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Ax.setFromProjectionMatrix(Zi,e.coordinateSystem));let g=0;if(this.sortObjects){Zi.copy(this.matrixWorld).invert(),kc.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Zi),Cx.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Zi);for(let _=0,x=l.length;_<x;_++)if(l[_].visible&&l[_].active){const T=l[_].geometryIndex;this.getMatrixAt(_,Zi),this.getBoundingSphereAt(T,zo).applyMatrix4(Zi);let b=!1;if(h&&(b=!m.intersectsSphere(zo,n)),!b){const M=d[T],E=j2.subVectors(zo.center,kc).dot(Cx);Rg.push(M.start,M.count,E,_)}}const v=Rg.list,y=this.customSort;y===null?v.sort(s.transparent?V2:z2):y.call(this,v,n);for(let _=0,x=v.length;_<x;_++){const T=v[_];c[g]=T.start*a,u[g]=T.count,p[g]=T.index,g++}Rg.reset()}else for(let v=0,y=l.length;v<y;v++)if(l[v].visible&&l[v].active){const _=l[v].geometryIndex;let x=!1;if(h&&(this.getMatrixAt(v,Zi),this.getBoundingSphereAt(_,zo).applyMatrix4(Zi),x=!m.intersectsSphere(zo,n)),!x){const T=d[_];c[g]=T.start*a,u[g]=T.count,p[g]=v,g++}}f.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class ai extends Mi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new st(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const wp=new V,Sp=new V,Rx=new St,Uc=new $s,Ch=new Zn,Pg=new V,Px=new V;class Xs extends an{constructor(e=new Ht,t=new ai){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)wp.fromBufferAttribute(t,i-1),Sp.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=wp.distanceTo(Sp);e.setAttribute("lineDistance",new ot(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ch.copy(n.boundingSphere),Ch.applyMatrix4(i),Ch.radius+=s,e.ray.intersectsSphere(Ch)===!1)return;
vendor: 6,319 bytes, line 45
45Rx.copy(i).invert(),Uc.copy(e.ray).applyMatrix4(Rx);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,h=n.attributes.position;if(u!==null){const f=Math.max(0,o.start),p=Math.min(u.count,o.start+o.count);for(let m=f,g=p-1;m<g;m+=c){const v=u.getX(m),y=u.getX(m+1),_=Rh(this,e,Uc,l,v,y,m);_&&t.push(_)}if(this.isLineLoop){const m=u.getX(p-1),g=u.getX(f),v=Rh(this,e,Uc,l,m,g,p-1);v&&t.push(v)}}else{const f=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let m=f,g=p-1;m<g;m+=c){const v=Rh(this,e,Uc,l,m,m+1,m);v&&t.push(v)}if(this.isLineLoop){const m=Rh(this,e,Uc,l,p-1,f,p-1);m&&t.push(m)}}}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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Rh(r,e,t,n,i,s,o){const a=r.geometry.attributes.position;if(wp.fromBufferAttribute(a,i),Sp.fromBufferAttribute(a,s),t.distanceSqToSegment(wp,Sp,Pg,Px)>n)return;Pg.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(Pg);if(!(c<e.near||c>e.far))return{distance:c,point:Px.clone().applyMatrix4(r.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:r}}const Ix=new V,Dx=new V;class br extends Xs{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Ix.fromBufferAttribute(t,i),Dx.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Ix.distanceTo(Dx);e.setAttribute("lineDistance",new ot(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class CS extends Xs{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}let ma=class extends Mi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new st(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 Lx=new St,Cv=new $s,Ph=new Zn,Ih=new V;class su extends an{constructor(e=new Ht,t=new ma){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,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ph.copy(n.boundingSphere),Ph.applyMatrix4(i),Ph.radius+=s,e.ray.intersectsSphere(Ph)===!1)return;Lx.copy(i).invert(),Cv.copy(e.ray).applyMatrix4(Lx);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,d=n.attributes.position;if(c!==null){const h=Math.max(0,o.start),f=Math.min(c.count,o.start+o.count);for(let p=h,m=f;p<m;p++){const g=c.getX(p);Ih.fromBufferAttribute(d,g),kx(Ih,g,l,i,e,t,this)}}else{const h=Math.max(0,o.start),f=Math.min(d.count,o.start+o.count);for(let p=h,m=f;p<m;p++)Ih.fromBufferAttribute(d,p),kx(Ih,p,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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function kx(r,e,t,n,i,s,o){const a=Cv.distanceSqToPoint(r);if(a<t){const l=new V;Cv.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(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class RS extends Wn{constructor(e,t,n,i,s=ei,o=ei,a,l,c){super(e,t,n,i,s,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class q2 extends RS{constructor(e,t,n,i,s,o,a,l){super({},e,t,n,i,s,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class Y2 extends Wn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ii,this.minFilter=Ii,this.generateMipmaps=!1,this.needsUpdate=!0}}class bm extends Wn{constructor(e,t,n,i,s,o,a,l,c,u,d,h){super(null,o,a,l,c,u,i,s,d,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class $2 extends bm{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=or,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Z2 extends bm{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Ws),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class PS extends Wn{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class cy extends Wn{constructor(e,t,n=js,i,s,o,a=Ii,l=Ii,c,u=nc,d=1){if(u!==nc&&u!==ic)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:d};super(h,i,s,o,a,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 wo(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 wm extends Ht{constructor(e=1,t=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
45s:e,height:t,capSegments:n,radialSegments:i,heightSegments:s},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const o=[],a=[],l=[],c=[],u=t/2,d=Math.PI/2*e,h=t,f=2*d+h,p=n*2+s,m=i+1,g=new V,v=new V;for(let y=0;y<=p;y++){let _=0,x=0,T=0,b=0;if(y<=n){const S=y/n,w=S*Math.PI/2;x=-u-e*Math.cos(w),T=e*Math.sin(w),b=-e*Math.cos(w),_=S*d}else if(y<=n+s){const S=(y-n)/s;x=-u+S*t,T=e,b=0,_=d+S*h}else{const S=(y-n-s)/n,w=S*Math.PI/2;x=u+e*Math.sin(w),T=e*Math.cos(w),b=e*Math.sin(w),_=d+h+S*d}const M=Math.max(0,Math.min(1,_/f));let E=0;y===0?E=.5/i:y===p&&(E=-.5/i);for(let S=0;S<=i;S++){const w=S/i,D=w*Math.PI*2,R=Math.sin(D),k=Math.cos(D);v.x=-T*k,v.y=x,v.z=T*R,a.push(v.x,v.y,v.z),g.set(-T*k,b,T*R),g.normalize(),l.push(g.x,g.y,g.z),c.push(w+E,M)}if(y>0){const S=(y-1)*m;for(let w=0;w<i;w++){const D=S+w,R=S+w+1,k=y*m+w,N=y*m+w+1;o.push(D,R,k),o.push(R,N,k)}}}this.setIndex(o),this.setAttribute("position",new ot(a,3)),this.setAttribute("normal",new ot(l,3)),this.setAttribute("uv",new ot(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wm(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Sm extends Ht{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new V,u=new Ue;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let d=0,h=3;d<=t;d++,h+=3){const f=n+d/t*i;c.x=e*Math.cos(f),c.y=e*Math.sin(f),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[h]/e+1)/2,u.y=(o[h+1]/e+1)/2,l.push(u.x,u.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new ot(o,3)),this.setAttribute("normal",new ot(a,3)),this.setAttribute("uv",new ot(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sm(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xd extends Ht{constructor(e=1,t=1,n=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],d=[],h=[],f=[];let p=0;const m=[],g=n/2;let v=0;y(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new ot(d,3)),this.setAttribute("normal",new ot(h,3)),this.setAttribute("uv",new ot(f,2));function y(){const x=new V,T=new V;let b=0;const M=(t-e)/n;for(let E=0;E<=s;E++){const S=[],w=E/s,D=w*(t-e)+e;for(let R=0;R<=i;R++){const k=R/i,N=k*l+a,H=Math.sin(N),P=Math.cos(N);T.x=D*H,T.y=-w*n+g,T.z=D*P,d.push(T.x,T.y,T.z),x.set(H,M,P).normalize(),h.push(x.x,x.y,x.z),f.push(k,1-w),S.push(p++)}m.push(S)}for(let E=0;E<i;E++)for(let S=0;S<s;S++){const w=m[S][E],D=m[S+1][E],R=m[S+1][E+1],k=m[S][E+1];(e>0||S!==0)&&(u.push(w,D,k),b+=3),(t>0||S!==s-1)&&(u.push(D,R,k),b+=3)}c.addGroup(v,b,0),v+=b}function _(x){const T=p,b=new Ue,M=new V;let E=0;const S=x===!0?e:t,w=x===!0?1:-1;for(let R=1;R<=i;R++)d.push(0,g*w,0),h.push(0,w,0),f.push(.5,.5),p++;const D=p;for(let R=0;R<=i;R++){const N=R/i*l+a,H=Math.cos(N),P=Math.sin(N);M.x=S*P,M.y=g*w,M.z=S*H,d.push(M.x,M.y,M.z),h.push(0,w,0),b.x=H*.5+.5,b.y=P*.5*w+.5,f.push(b.x,b.y),p++}for(let R=0;R<i;R++){const k=T+R,N=D+R;x===!0?u.push(N,N+1,k):u.push(N+1,N,k),E+=3}c.addGroup(v,E,x===!0?1:2),v+=E}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xd(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class qd extends Xd{constructor(e=1,t=1,n=32,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a),this.type="C
45oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new qd(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Co extends Ht{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];a(i),c(n),u(),this.setAttribute("position",new ot(s,3)),this.setAttribute("normal",new ot(s.slice(),3)),this.setAttribute("uv",new ot(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(y){const _=new V,x=new V,T=new V;for(let b=0;b<t.length;b+=3)f(t[b+0],_),f(t[b+1],x),f(t[b+2],T),l(_,x,T,y)}function l(y,_,x,T){const b=T+1,M=[];for(let E=0;E<=b;E++){M[E]=[];const S=y.clone().lerp(x,E/b),w=_.clone().lerp(x,E/b),D=b-E;for(let R=0;R<=D;R++)R===0&&E===b?M[E][R]=S:M[E][R]=S.clone().lerp(w,R/D)}for(let E=0;E<b;E++)for(let S=0;S<2*(b-E)-1;S++){const w=Math.floor(S/2);S%2===0?(h(M[E][w+1]),h(M[E+1][w]),h(M[E][w])):(h(M[E][w+1]),h(M[E+1][w+1]),h(M[E+1][w]))}}function c(y){const _=new V;for(let x=0;x<s.length;x+=3)_.x=s[x+0],_.y=s[x+1],_.z=s[x+2],_.normalize().multiplyScalar(y),s[x+0]=_.x,s[x+1]=_.y,s[x+2]=_.z}function u(){const y=new V;for(let _=0;_<s.length;_+=3){y.x=s[_+0],y.y=s[_+1],y.z=s[_+2];const x=g(y)/2/Math.PI+.5,T=v(y)/Math.PI+.5;o.push(x,1-T)}p(),d()}function d(){for(let y=0;y<o.length;y+=6){const _=o[y+0],x=o[y+2],T=o[y+4],b=Math.max(_,x,T),M=Math.min(_,x,T);b>.9&&M<.1&&(_<.2&&(o[y+0]+=1),x<.2&&(o[y+2]+=1),T<.2&&(o[y+4]+=1))}}function h(y){s.push(y.x,y.y,y.z)}function f(y,_){const x=y*3;_.x=e[x+0],_.y=e[x+1],_.z=e[x+2]}function p(){const y=new V,_=new V,x=new V,T=new V,b=new Ue,M=new Ue,E=new Ue;for(let S=0,w=0;S<s.length;S+=9,w+=6){y.set(s[S+0],s[S+1],s[S+2]),_.set(s[S+3],s[S+4],s[S+5]),x.set(s[S+6],s[S+7],s[S+8]),b.set(o[w+0],o[w+1]),M.set(o[w+2],o[w+3]),E.set(o[w+4],o[w+5]),T.copy(y).add(_).add(x).divideScalar(3);const D=g(T);m(b,w+0,y,D),m(M,w+2,_,D),m(E,w+4,x,D)}}function m(y,_,x,T){T<0&&y.x===1&&(o[_]=y.x-1),x.x===0&&x.z===0&&(o[_]=T/2/Math.PI+.5)}function g(y){return Math.atan2(y.z,-y.x)}function v(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Co(e.vertices,e.indices,e.radius,e.details)}}class Mm extends Co{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 8,386 bytes, line 45
4519,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Mm(e.radius,e.detail)}}const Dh=new V,Lh=new V,Ig=new V,kh=new sr;class IS extends Ht{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(Da*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),h={},f=[];for(let p=0;p<l;p+=3){o?(c[0]=o.getX(p),c[1]=o.getX(p+1),c[2]=o.getX(p+2)):(c[0]=p,c[1]=p+1,c[2]=p+2);const{a:m,b:g,c:v}=kh;if(m.fromBufferAttribute(a,c[0]),g.fromBufferAttribute(a,c[1]),v.fromBufferAttribute(a,c[2]),kh.getNormal(Ig),d[0]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,d[1]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,d[2]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.z*i)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let y=0;y<3;y++){const _=(y+1)%3,x=d[y],T=d[_],b=kh[u[y]],M=kh[u[_]],E=`${x}_${T}`,S=`${T}_${x}`;S in h&&h[S]?(Ig.dot(h[S].normal)<=s&&(f.push(b.x,b.y,b.z),f.push(M.x,M.y,M.z)),h[S]=null):E in h||(h[E]={index0:c[y],index1:c[_],normal:Ig.clone()})}}for(const p in h)if(h[p]){const{index0:m,index1:g}=h[p];Dh.fromBufferAttribute(a,m),Lh.fromBufferAttribute(a,g),f.push(Dh.x,Dh.y,Dh.z),f.push(Lh.x,Lh.y,Lh.z)}this.setAttribute("position",new ot(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Zr{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(s-1);const u=n[i],h=n[i+1]-u,f=(o-u)/h;return(i+f)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new Ue:new V);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new V,i=[],s=[],o=[],a=new V,l=new St;for(let f=0;f<=e;f++){const p=f/e;i[f]=this.getTangentAt(p,new V)}s[0]=new V,o[0]=new V;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),d=Math.abs(i[0].y),h=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),h<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(i[f-1],i[f]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos($t(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(a,p))}o[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos($t(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(f=-f);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],f*p)),o[p].crossVectors(i[p],s[p])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Em extends Zr{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Ue){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),h=l-this.aX,f=c-this.aY;l=h*u-f*d+this.aX,c=h*d+f*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class DS extends Em{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function uy(){let r=0,e=0,t=0,n=0;function i(s,o,a,l){r=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,d){let h=(o-s)/c-(a-s)/(c+u)+(a-o)/u,f=(a-o)/u-(l-o)/(u+d)+(l-a)/d;h*=u,f*=u,i(o,a,h,f)},calc:function(s){const o=s*s,a=o*s;return r+e*s+t*o+n*a}}}const Uh=new V,Dg=new uy,Lg=new uy,kg=new uy;class LS extends Zr{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new V){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%s]:(Uh.subVectors(i[0],i[1]).add(i[0]),c=Uh);const d=i[a%s],h=i[(a+1)%s];if(this.closed||a+2<s?u=i[(a+2)%s]:(Uh.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=Uh),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let p=Math.pow(c.distanceToSquared(d),f),m=Math.pow(d.distanceToSquared(h),f),g=Math.pow(h.distanceToSquared(u),f);m<1e-4&&(m=1),p<1e-4&&(p=m),g<1e-4&&(g=m),Dg.initNonuniformCatmullRom(c.x,d.x,h.x,u.x,p,m,g),Lg.initNonuniformCatmullRom(c.y,d.y,h.y,u.y,p,m,g),kg.initNonuniformCatmullRom(c.z,d.z,h.z,u.z,p,m,g)}else this.curveType==="catmullrom"&&(Dg.initCatmullRom(c.x,d.x,h.x,u.x,this.tension),Lg.initCatmullRom(c.y,d.y,h.y,u.y,this.tension),kg.initCatmullRom(c.z,d.z,h.z,u.z,this.tension));return n.set(Dg.calc(l),Lg.calc(l),kg.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new V().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Ux(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,a=r*r,l=r*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*r+t}function J2(r,e){const t=1-r;return t*t*e}function K2(r,e){return 2*(1-r)*r*e}function Q2(r,e){return r*r*e}function ou(r,e,t,n){return J2(r,e)+K2(r,t)+Q2(r,n)}function eR(r,e){const t=1-r;return t*t*t*e}function tR(r,e){const t=1-r;return 3*t*t*r*e}function nR(r,e){return 3*(1-r)*r*r*e}function iR(r,e){return r*r*r*e}
vendor: 10,341 bytes, line 45
45function au(r,e,t,n,i){return eR(r,e)+tR(r,t)+nR(r,n)+iR(r,i)}class dy extends Zr{constructor(e=new Ue,t=new Ue,n=new Ue,i=new Ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Ue){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(au(e,i.x,s.x,o.x,a.x),au(e,i.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class kS extends Zr{constructor(e=new V,t=new V,n=new V,i=new V){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new V){const n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(au(e,i.x,s.x,o.x,a.x),au(e,i.y,s.y,o.y,a.y),au(e,i.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class hy extends Zr{constructor(e=new Ue,t=new Ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Ue){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Ue){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class US extends Zr{constructor(e=new V,t=new V){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new V){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new V){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class fy extends Zr{constructor(e=new Ue,t=new Ue,n=new Ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Ue){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(ou(e,i.x,s.x,o.x),ou(e,i.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class py extends Zr{constructor(e=new V,t=new V,n=new V){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new V){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(ou(e,i.x,s.x,o.x),ou(e,i.y,s.y,o.y),ou(e,i.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class my extends Zr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Ue){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],u=i[o>i.length-2?i.length-1:o+1],d=i[o>i.length-3?i.length-1:o+2];return n.set(Ux(a,l.x,c.x,u.x,d.x),Ux(a,l.y,c.y,u.y,d.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new Ue().fromArray(i))}return this}}var Mp=Object.freeze({__proto__:null,ArcCurve:DS,CatmullRomCurve3:LS,CubicBezierCurve:dy,CubicBezierCurve3:kS,EllipseCurve:Em,LineCurve:hy,LineCurve3:US,QuadraticBezierCurve:fy,QuadraticBezierCurve3:py,SplineCurve:my});class NS extends Zr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Mp[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Mp[i.type]().fromJSON(i))}return this}}class Ep extends NS{constructor(e){super(),this.type="Path",this.currentPoint=new Ue,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new hy(this.currentPoint.clone(),new Ue(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new fy(this.currentPoint.clone(),new Ue(e,t),new Ue(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const a=new dy(this.currentPoint.clone(),new Ue(e,t),new Ue(n,i),new Ue(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new my(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,i,s,o,a,l),this}absellipse(e,t,n,i,s,o,a,l){const c=new Em(e,t,n,i,s,o,a,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class La extends Ep{constructor(e){super(e),this.uuid=_r(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Ep().fromJSON(i))}return this}}function rR(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=OS(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=cR(r,e,s,t)),r.length>80*t){a=1/0,l=1/0;let u=-1/0,d=-1/0;for(let h=t;h<i;h+=t){const f=r[h],p=r[h+1];f<a&&(a=f),p<l&&(l=p),f>u&&(u=f),p>d&&(d=p)}c=Math.max(u-a,d-l),c=c!==0?32767/c:0}return Eu(s,o,t,a,l,c,0),o}function OS(r,e,t,n,i){let s;if(i===xR(r,e,t,n)>0)for(let o=e;o<t;o+=n)s=Nx(o/n|0,r[o],r[o+1],s);else for(let o=t-n;o>=e;o-=n)s=Nx(o/n|0,r[o],r[o+1],s);return s&&oc(s,s.next)&&(Au(s),s=s.next),s}function za(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(oc(t,t.next)||Gn(t.prev,t,t.next)===0)){if(Au(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Eu(r,e,t,n,i,s,o){if(!r)return;!o&&s&&pR(r,n,i,s);let a=r;for(;r.prev!==r.next;){const l=r.prev,c=r.next;if(s?oR(r,n,i,s):sR(r)){e.push(l.i,r.i,c.i),Au(r),r=c.next,a=c.next;continue}if(r=c,r===a){o?o===1?(r=aR(za(r),e),Eu(r,e,t,n,i,s,2)):o===2&&lR(r,e,t,n,i,s):Eu(za(r),e,t,n,i,s,1);break}}}function sR(r){const e=r.prev,t=r,n=r.next;
vendor: 1,695 bytes, line 45
45if(Gn(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(i,s,o),d=Math.min(a,l,c),h=Math.max(i,s,o),f=Math.max(a,l,c);let p=n.next;for(;p!==e;){if(p.x>=u&&p.x<=h&&p.y>=d&&p.y<=f&&qc(i,a,s,l,o,c,p.x,p.y)&&Gn(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function oR(r,e,t,n){const i=r.prev,s=r,o=r.next;if(Gn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,u=i.y,d=s.y,h=o.y,f=Math.min(a,l,c),p=Math.min(u,d,h),m=Math.max(a,l,c),g=Math.max(u,d,h),v=Rv(f,p,e,t,n),y=Rv(m,g,e,t,n);let _=r.prevZ,x=r.nextZ;for(;_&&_.z>=v&&x&&x.z<=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==i&&_!==o&&qc(a,u,l,d,c,h,_.x,_.y)&&Gn(_.prev,_,_.next)>=0||(_=_.prevZ,x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==i&&x!==o&&qc(a,u,l,d,c,h,x.x,x.y)&&Gn(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;_&&_.z>=v;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==i&&_!==o&&qc(a,u,l,d,c,h,_.x,_.y)&&Gn(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==i&&x!==o&&qc(a,u,l,d,c,h,x.x,x.y)&&Gn(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function aR(r,e){let t=r;do{const n=t.prev,i=t.next.next;!oc(n,i)&&BS(n,t,t.next,i)&&Tu(n,i)&&Tu(i,n)&&(e.push(n.i,t.i,i.i),Au(t),Au(t.next),t=r=i),t=t.next}while(t!==r);return za(t)}function lR(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&vR(o,a)){let l=zS(o,a);o=za(o,o.next),l=za(l,l.next),Eu(o,e,t,n,i,s,0),Eu(l,e,t,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function cR(r,e,t,n){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*n,l=s<o-1?e[s+1]*n:r.length,c=OS(r,a,l,n,!1);c===c.next&&(c.steiner=!0),i.push(gR(c))}i.sort(uR);for(let s=0;s<i.length;s++)t=dR(i[s],t);return t}function uR(r,e){let t=r.x-e.x;
45if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function dR(r,e){const t=hR(r,e);if(!t)return e;const n=zS(t,r);return za(n,n.next),za(t,t.next)}function hR(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;if(oc(r,t))return t;do{if(oc(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const d=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s&&(s=d,o=t.x<t.next.x?t:t.next,d===n))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&FS(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)){const d=Math.abs(i-t.y)/(n-t.x);Tu(t,r)&&(d<u||d===u&&(t.x>o.x||t.x===o.x&&fR(o,t)))&&(o=t,u=d)}t=t.next}while(t!==a);return o}function fR(r,e){return Gn(r.prev,r,e.prev)<0&&Gn(e.next,r,r.next)<0}function pR(r,e,t,n){let i=r;do i.z===0&&(i.z=Rv(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,mR(i)}function mR(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(i=n,n=n.nextZ,a--):(i=o,o=o.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=o}s.nextZ=null,t*=2}while(e>1);return r}function Rv(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function gR(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function FS(r,e,t,n,i,s,o,a){return(i-o)*(e-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(n-a)}function qc(r,e,t,n,i,s,o,a){return!(r===o&&e===a)&&FS(r,e,t,n,i,s,o,a)}function vR(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!yR(r,e)&&(Tu(r,e)&&Tu(e,r)&&_R(r,e)&&(Gn(r.prev,r,e.prev)||Gn(r,e.prev,e))||oc(r,e)&&Gn(r.prev,r,r.next)>0&&Gn(e.prev,e,e.next)>0)}function Gn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function oc(r,e){return r.x===e.x&&r.y===e.y}function BS(r,e,t,n){const i=Oh(Gn(r,e,t)),s=Oh(Gn(r,e,n)),o=Oh(Gn(t,n,r)),a=Oh(Gn(t,n,e));return!!(i!==s&&o!==a||i===0&&Nh(r,t,e)||s===0&&Nh(r,n,e)||o===0&&Nh(t,r,n)||a===0&&Nh(t,e,n))}function Nh(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Oh(r){return r>0?1:r<0?-1:0}function yR(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&BS(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Tu(r,e){return Gn(r.prev,r,r.next)<0?Gn(r,e,r.next)>=0&&Gn(r,r.prev,e)>=0:Gn(r,e,r.prev)<0||Gn(r,r.next,e)<0}function _R(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function zS(r,e){const t=Pv(r.i,r.x,r.y),n=Pv(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Nx(r,e,t,n){const i=Pv(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Au(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Pv(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function xR(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class bR{static triangulate(e,t,n=2){return rR(e,t,n)}}class Wr{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return Wr.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];Ox(e),Fx(n,e);let o=e.length;t.forEach(Ox);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,Fx(n,t[l]);const a=bR.triangulate(n,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function Ox(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Fx(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Tm extends Ht{constructor(e=new La([new Ue(.5,.5),new Ue(-.5,.5),new Ue(-.5,-.5),new Ue(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new ot(i,3)),this.setAttribute("uv",new ot(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let h=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:f-.1,m=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const v=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:wR;let _,x=!1,T,b,M,E;v&&(_=v.getSpacedPoints(u),x=!0,h=!1,T=v.computeFrenetFrames(u,!1),b=new V,M=new V,E=new V),h||(g=0,f=0,p=0,m=0);const S=a.extractPoints(c);let w=S.shape;const D=S.holes;if(!Wr.isClockWise(w)){w=w.reverse();for(let F=0,pe=D.length;F<pe;F++){const me=D[F];Wr.isClockWise(me)&&(D[F]=me.reverse())}}function k(F){const me=10000000000000001e-36;let be=F[0];for(let se=1;se<=F.length;se++){const Se=se%F.length,he=F[Se],le=he.x-be.x,He=he.y-be.y,B=le*le+He*He,A=Math.max(Math.abs(he.x),Math.abs(he.y),Math.abs(be.x),Math.abs(be.y)),ne=me*A*A;if(B<=ne){F.splice(Se,1),se--;continue}be=he}}k(w),D.forEach(k);const N=D.length,H=w;for(let F=0;F<N;F++){const pe=D[F];w=w.concat(pe)}function P(F,pe,me){return pe||console.error("THREE.ExtrudeGeometry: vec does not exist"),F.clone().addScaledVector(pe,me)}const ee=w.length;function X(F,pe,me){let be,se,Se;const he=F.x-pe.x,le=F.y-pe.y,He=me.x-F.x,B=me.y-F.y,A=he*he+le*le,ne=he*B-le*He;if(Math.abs(ne)>Number.EPSILON){const ge=Math.sqrt(A),ue=Math.sqrt(He*He+B*B),ce=pe.x-le/ge,Ne=pe.y+he/ge,De=me.x-B/ue,$e=me.y+He/ue,Je=((De-ce)*B-($e-Ne)*He)/(he*B-le*He);be=ce+he*Je-F.x,se=Ne+le*Je-F.y;const Ee=be*be+se*se;if(Ee<=2)return new Ue(be,se);Se=Math.sqrt(Ee/2)}else{let ge=!1;he>Number.EPSILON?He>Number.EPSILON&&(ge=!0):he<-Number.EPSILON?He<-Number.EPSILON&&(ge=!0):Math.sign(le)===Math.sign(B)&&(ge=!0),ge?(be=-le,se=he,Se=Math.sqrt(A)):(be=he,se=le,Se=Math.sqrt(A/2))}return new Ue(be/Se,se/Se)}const Q=[];for(let F=0,pe=H.length,me=pe-1,be=F+1;F<pe;F++,me++,be++)me===pe&&(me=0),be===pe&&(be=0),Q[F]=X(H[F],H[me],H[be]);const Y=[];let z,K=Q.concat();for(let F=0,pe=N;F<pe;F++){const me=D[F];z=[];for(let be=0,se=me.length,Se=se-1,he=be+1;be<se;be++,Se++,he++)Se===se&&(Se=0),he===se&&(he=0),z[be]=X(me[be],me[Se],me[he]);Y.push(z),K=K.concat(z)}let te;if(g===0)te=Wr.triangulateShape(H,D);else{const F=[],pe=[];for(let me=0;me<g;me++){const be=me/g,se=f*Math.cos(be*Math.PI/2),Se=p*Math.sin(be*Math.PI/2)+m;for(let he=0,le=H.length;he<le;he++){const He=P(H[he],Q[he],Se);de(He.x,He.y,-se),be===0&&F.push(He)}for(let he=0,le=N;he<le;he++){const He=D[he];z=Y[he];const B=[];for(let A=0,ne=He.length;A<ne;A++){const ge=P(He[A],z[A],Se);de(ge.x,ge.y,-se),be===0&&B.push(ge)}be===0&&pe.push(B)}}te=Wr.triangulateShape(F,pe)}const O=te.length,U=p+m;for(let F=0;F<ee;F++){const pe=h?P(w[F],K[F],U):w[F];
vendor: 41,227 bytes, line 45
45x?(M.copy(T.normals[0]).multiplyScalar(pe.x),b.copy(T.binormals[0]).multiplyScalar(pe.y),E.copy(_[0]).add(M).add(b),de(E.x,E.y,E.z)):de(pe.x,pe.y,0)}for(let F=1;F<=u;F++)for(let pe=0;pe<ee;pe++){const me=h?P(w[pe],K[pe],U):w[pe];x?(M.copy(T.normals[F]).multiplyScalar(me.x),b.copy(T.binormals[F]).multiplyScalar(me.y),E.copy(_[F]).add(M).add(b),de(E.x,E.y,E.z)):de(me.x,me.y,d/u*F)}for(let F=g-1;F>=0;F--){const pe=F/g,me=f*Math.cos(pe*Math.PI/2),be=p*Math.sin(pe*Math.PI/2)+m;for(let se=0,Se=H.length;se<Se;se++){const he=P(H[se],Q[se],be);de(he.x,he.y,d+me)}for(let se=0,Se=D.length;se<Se;se++){const he=D[se];z=Y[se];for(let le=0,He=he.length;le<He;le++){const B=P(he[le],z[le],be);x?de(B.x,B.y+_[u-1].y,_[u-1].x+me):de(B.x,B.y,d+me)}}}W(),j();function W(){const F=i.length/3;if(h){let pe=0,me=ee*pe;for(let be=0;be<O;be++){const se=te[be];ye(se[2]+me,se[1]+me,se[0]+me)}pe=u+g*2,me=ee*pe;for(let be=0;be<O;be++){const se=te[be];ye(se[0]+me,se[1]+me,se[2]+me)}}else{for(let pe=0;pe<O;pe++){const me=te[pe];ye(me[2],me[1],me[0])}for(let pe=0;pe<O;pe++){const me=te[pe];ye(me[0]+ee*u,me[1]+ee*u,me[2]+ee*u)}}n.addGroup(F,i.length/3-F,0)}function j(){const F=i.length/3;let pe=0;ie(H,pe),pe+=H.length;for(let me=0,be=D.length;me<be;me++){const se=D[me];ie(se,pe),pe+=se.length}n.addGroup(F,i.length/3-F,1)}function ie(F,pe){let me=F.length;for(;--me>=0;){const be=me;let se=me-1;se<0&&(se=F.length-1);for(let Se=0,he=u+g*2;Se<he;Se++){const le=ee*Se,He=ee*(Se+1),B=pe+be+le,A=pe+se+le,ne=pe+se+He,ge=pe+be+He;we(B,A,ne,ge)}}}function de(F,pe,me){l.push(F),l.push(pe),l.push(me)}function ye(F,pe,me){_e(F),_e(pe),_e(me);const be=i.length/3,se=y.generateTopUV(n,i,be-3,be-2,be-1);Re(se[0]),Re(se[1]),Re(se[2])}function we(F,pe,me,be){_e(F),_e(pe),_e(be),_e(pe),_e(me),_e(be);const se=i.length/3,Se=y.generateSideWallUV(n,i,se-6,se-3,se-2,se-1);Re(Se[0]),Re(Se[1]),Re(Se[3]),Re(Se[1]),Re(Se[2]),Re(Se[3])}function _e(F){i.push(l[F*3+0]),i.push(l[F*3+1]),i.push(l[F*3+2])}function Re(F){s.push(F.x),s.push(F.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return SR(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Mp[i.type]().fromJSON(i)),new Tm(n,e.options)}}const wR={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[i*3],u=e[i*3+1];return[new Ue(s,o),new Ue(a,l),new Ue(c,u)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],d=e[n*3+2],h=e[i*3],f=e[i*3+1],p=e[i*3+2],m=e[s*3],g=e[s*3+1],v=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Ue(o,1-l),new Ue(c,1-d),new Ue(h,1-p),new Ue(m,1-v)]:[new Ue(a,1-l),new Ue(u,1-d),new Ue(f,1-p),new Ue(g,1-v)]}};function SR(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Am extends Co{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Am(e.radius,e.detail)}}class Cm extends Ht{constructor(e=[new Ue(0,-.5),new Ue(.5,0),new Ue(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=$t(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,d=new V,h=new Ue,f=new V,p=new V,m=new V;let g=0,v=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,f.x=v*1,f.y=-g,f.z=v*0,m.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case e.length-1:l.push(m.x,m.y,m.z);break;default:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,f.x=v*1,f.y=-g,f.z=v*0,p.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),l.push(f.x,f.y,f.z),m.copy(p)}for(let y=0;y<=t;y++){const _=n+y*u*i,x=Math.sin(_),T=Math.cos(_);for(let b=0;b<=e.length-1;b++){d.x=e[b].x*x,d.y=e[b].y,d.z=e[b].x*T,o.push(d.x,d.y,d.z),h.x=y/t,h.y=b/(e.length-1),a.push(h.x,h.y);const M=l[3*b+0]*x,E=l[3*b+1],S=l[3*b+0]*T;c.push(M,E,S)}}for(let y=0;y<t;y++)for(let _=0;_<e.length-1;_++){const x=_+y*e.length,T=x,b=x+e.length,M=x+e.length+1,E=x+1;s.push(T,b,E),s.push(M,E,b)}this.setIndex(s),this.setAttribute("position",new ot(o,3)),this.setAttribute("uv",new ot(a,2)),this.setAttribute("normal",new ot(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cm(e.points,e.segments,e.phiStart,e.phiLength)}}class Yd extends Co{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Yd(e.radius,e.detail)}}class Zs extends Ht{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,o=t/2,a=Math.floor(n),l=Math.floor(i),c=a+1,u=l+1,d=e/a,h=t/l,f=[],p=[],m=[],g=[];for(let v=0;v<u;v++){const y=v*h-o;for(let _=0;_<c;_++){const x=_*d-s;p.push(x,-y,0),m.push(0,0,1),g.push(_/a),g.push(1-v/l)}}for(let v=0;v<l;v++)for(let y=0;y<a;y++){const _=y+c*v,x=y+c*(v+1),T=y+1+c*(v+1),b=y+1+c*v;f.push(_,x,b),f.push(x,T,b)}this.setIndex(f),this.setAttribute("position",new ot(p,3)),this.setAttribute("normal",new ot(m,3)),this.setAttribute("uv",new ot(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zs(e.width,e.height,e.widthSegments,e.heightSegments)}}class Rm extends Ht{constructor(e=.5,t=1,n=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],l=[],c=[],u=[];let d=e;const h=(t-e)/i,f=new V,p=new Ue;for(let m=0;m<=i;m++){for(let g=0;g<=n;g++){const v=s+g/n*o;f.x=d*Math.cos(v),f.y=d*Math.sin(v),l.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,u.push(p.x,p.y)}d+=h}for(let m=0;m<i;m++){const g=m*(n+1);for(let v=0;v<n;v++){const y=v+g,_=y,x=y+n+1,T=y+n+2,b=y+1;a.push(_,x,b),a.push(x,T,b)}}this.setIndex(a),this.setAttribute("position",new ot(l,3)),this.setAttribute("normal",new ot(c,3)),this.setAttribute("uv",new ot(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rm(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Pm extends Ht{constructor(e=new La([new Ue(0,.5),new Ue(-.5,-.5),new Ue(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new ot(i,3)),this.setAttribute("normal",new ot(s,3)),this.setAttribute("uv",new ot(o,2));function c(u){const d=i.length/3,h=u.extractPoints(t);let f=h.shape;const p=h.holes;Wr.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,v=p.length;g<v;g++){const y=p[g];Wr.isClockWise(y)===!0&&(p[g]=y.reverse())}const m=Wr.triangulateShape(f,p);for(let g=0,v=p.length;g<v;g++){const y=p[g];f=f.concat(y)}for(let g=0,v=f.length;g<v;g++){const y=f[g];i.push(y.x,y.y,0),s.push(0,0,1),o.push(y.x,y.y)}for(let g=0,v=m.length;g<v;g++){const y=m[g],_=y[0]+d,x=y[1]+d,T=y[2]+d;n.push(_,x,T),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return MR(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new Pm(n,e.curveSegments)}}function MR(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class mc extends Ht{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let c=0;const u=[],d=new V,h=new V,f=[],p=[],m=[],g=[];for(let v=0;v<=n;v++){const y=[],_=v/n;let x=0;v===0&&o===0?x=.5/t:v===n&&l===Math.PI&&(x=-.5/t);for(let T=0;T<=t;T++){const b=T/t;d.x=-e*Math.cos(i+b*s)*Math.sin(o+_*a),d.y=e*Math.cos(o+_*a),d.z=e*Math.sin(i+b*s)*Math.sin(o+_*a),p.push(d.x,d.y,d.z),h.copy(d).normalize(),m.push(h.x,h.y,h.z),g.push(b+x,1-_),y.push(c++)}u.push(y)}for(let v=0;v<n;v++)for(let y=0;y<t;y++){const _=u[v][y+1],x=u[v][y],T=u[v+1][y],b=u[v+1][y+1];(v!==0||o>0)&&f.push(_,x,b),(v!==n-1||l<Math.PI)&&f.push(x,T,b)}this.setIndex(f),this.setAttribute("position",new ot(p,3)),this.setAttribute("normal",new ot(m,3)),this.setAttribute("uv",new ot(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new mc(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Im extends Co{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Im(e.radius,e.detail)}}class Dm extends Ht{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],u=new V,d=new V,h=new V;for(let f=0;f<=n;f++)for(let p=0;p<=i;p++){const m=p/i*s,g=f/n*Math.PI*2;d.x=(e+t*Math.cos(g))*Math.cos(m),d.y=(e+t*Math.cos(g))*Math.sin(m),d.z=t*Math.sin(g),a.push(d.x,d.y,d.z),u.x=e*Math.cos(m),u.y=e*Math.sin(m),h.subVectors(d,u).normalize(),l.push(h.x,h.y,h.z),c.push(p/i),c.push(f/n)}for(let f=1;f<=n;f++)for(let p=1;p<=i;p++){const m=(i+1)*f+p-1,g=(i+1)*(f-1)+p-1,v=(i+1)*(f-1)+p,y=(i+1)*f+p;o.push(m,g,y),o.push(g,v,y)}this.setIndex(o),this.setAttribute("position",new ot(a,3)),this.setAttribute("normal",new ot(l,3)),this.setAttribute("uv",new ot(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Dm(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Lm extends Ht{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],l=[],c=[],u=[],d=new V,h=new V,f=new V,p=new V,m=new V,g=new V,v=new V;for(let _=0;_<=n;++_){const x=_/n*s*Math.PI*2;y(x,s,o,e,f),y(x+.01,s,o,e,p),g.subVectors(p,f),v.addVectors(p,f),m.crossVectors(g,v),v.crossVectors(m,g),m.normalize(),v.normalize();for(let T=0;T<=i;++T){const b=T/i*Math.PI*2,M=-t*Math.cos(b),E=t*Math.sin(b);d.x=f.x+(M*v.x+E*m.x),d.y=f.y+(M*v.y+E*m.y),d.z=f.z+(M*v.z+E*m.z),l.push(d.x,d.y,d.z),h.subVectors(d,f).normalize(),c.push(h.x,h.y,h.z),u.push(_/n),u.push(T/i)}}for(let _=1;_<=n;_++)for(let x=1;x<=i;x++){const T=(i+1)*(_-1)+(x-1),b=(i+1)*_+(x-1),M=(i+1)*_+x,E=(i+1)*(_-1)+x;a.push(T,b,E),a.push(b,M,E)}this.setIndex(a),this.setAttribute("position",new ot(l,3)),this.setAttribute("normal",new ot(c,3)),this.setAttribute("uv",new ot(u,2));function y(_,x,T,b,M){const E=Math.cos(_),S=Math.sin(_),w=T/x*_,D=Math.cos(w);M.x=b*(2+D)*.5*E,M.y=b*(2+D)*S*.5,M.z=b*Math.sin(w)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Lm(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class km extends Ht{constructor(e=new py(new V(-1,-1,0),new V(-1,1,0),new V(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new V,l=new V,c=new Ue;let u=new V;const d=[],h=[],f=[],p=[];m(),this.setIndex(p),this.setAttribute("position",new ot(d,3)),this.setAttribute("normal",new ot(h,3)),this.setAttribute("uv",new ot(f,2));function m(){for(let _=0;_<t;_++)g(_);g(s===!1?t:0),y(),v()}function g(_){u=e.getPointAt(_/t,u);const x=o.normals[_],T=o.binormals[_];for(let b=0;b<=i;b++){const M=b/i*Math.PI*2,E=Math.sin(M),S=-Math.cos(M);l.x=S*x.x+E*T.x,l.y=S*x.y+E*T.y,l.z=S*x.z+E*T.z,l.normalize(),h.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,d.push(a.x,a.y,a.z)}}function v(){for(let _=1;_<=t;_++)for(let x=1;x<=i;x++){const T=(i+1)*(_-1)+(x-1),b=(i+1)*_+(x-1),M=(i+1)*_+x,E=(i+1)*(_-1)+x;p.push(T,b,E),p.push(b,M,E)}}function y(){for(let _=0;_<=t;_++)for(let x=0;x<=i;x++)c.x=_/t,c.y=x/i,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new km(new Mp[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class gy extends Ht{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new V,s=new V;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const d=l[c],h=d.start,f=d.count;for(let p=h,m=h+f;p<m;p+=3)for(let g=0;g<3;g++){const v=a.getX(p+g),y=a.getX(p+(g+1)%3);i.fromBufferAttribute(o,v),s.fromBufferAttribute(o,y),Bx(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,d=3*a+(c+1)%3;i.fromBufferAttribute(o,u),s.fromBufferAttribute(o,d),Bx(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new ot(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Bx(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var zx=Object.freeze({__proto__:null,BoxGeometry:qa,CapsuleGeometry:wm,CircleGeometry:Sm,ConeGeometry:qd,CylinderGeometry:Xd,DodecahedronGeometry:Mm,EdgesGeometry:IS,ExtrudeGeometry:Tm,IcosahedronGeometry:Am,LatheGeometry:Cm,OctahedronGeometry:Yd,PlaneGeometry:Zs,PolyhedronGeometry:Co,RingGeometry:Rm,ShapeGeometry:Pm,SphereGeometry:mc,TetrahedronGeometry:Im,TorusGeometry:Dm,TorusKnotGeometry:Lm,TubeGeometry:km,WireframeGeometry:gy});class VS extends Mi{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new st(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class GS extends Dr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class vy extends Mi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new st(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new st(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ao,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class HS extends vy{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return $t(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new st(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new st(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new st(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Cu extends Mi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new st(16777215),this.specular=new st(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new st(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ao,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xr,this.combine=Bd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class WS extends Mi{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new st(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new st(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ao,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class jS extends Mi{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ao,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class yy extends Mi{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new st(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new st(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ao,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new xr,this.combine=Bd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Um extends Mi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=lS,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 Nm extends Mi{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}}class XS extends Mi{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new st(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ao,this.normalScale=new Ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class qS extends ai{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function ga(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function YS(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function $S(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function Iv(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i}function _y(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push(...o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function ER(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),d=[],h=[];for(let f=0;f<c.times.length;++f){const p=c.times[f]*i;if(!(p<t||p>=n)){d.push(c.times[f]);for(let m=0;m<u;++m)h.push(c.values[f*u+m])}}d.length!==0&&(c.times=ga(d,c.times.constructor),c.values=ga(h,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function TR(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(v){return v.name===a.name&&v.ValueTypeName===l});if(c===void 0)continue;let u=0;const d=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=d/3);let h=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=f/3);const p=a.times.length-1;let m;if(s<=a.times[0]){const v=u,y=d-u;m=a.values.slice(v,y)}else if(s>=a.times[p]){const v=p*d+u,y=v+d-u;m=a.values.slice(v,y)}else{const v=a.createInterpolant(),y=u,_=d-u;v.evaluate(s),m=v.resultBuffer.slice(y,_)}l==="quaternion"&&new $n().fromArray(m).normalize().conjugate().toArray(m);const g=c.times.length;for(let v=0;v<g;++v){const y=v*f+h;if(l==="quaternion")$n.multiplyQuaternionsFlat(c.values,y,m,0,c.values,y);else{const _=f-h*2;for(let x=0;x<_;++x)c.values[y+x]-=m[x]}}}return r.blendMode=ty,r}class AR{static convertArray(e,t){return ga(e,t)}static isTypedArray(e){return YS(e)}static getKeyframeOrder(e){return $S(e)}static sortedArray(e,t,n){return Iv(e,t,n)}static flattenJSON(e,t,n,i){_y(e,t,n,i)}static subclip(e,t,n,i,s=30){return ER(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return TR(e,t,n,i)}}class $d{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class ZS extends $d{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:fa,endingEnd:fa}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case pa:s=e,a=2*t-n;break;case xu:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case pa:o=e,l=2*n-t;break;case xu:o=1,l=n+i[1]-i[0];break;default:o=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,d=this._offsetNext,h=this._weightPrev,f=this._weightNext,p=(n-t)/(i-t),m=p*p,g=m*p,v=-h*g+2*h*m-h*p,y=(1+h)*g+(-1.5-2*h)*m+(-.5+h)*p+1,_=(-1-f)*g+(1.5+f)*m+.5*p,x=f*g-f*m;for(let T=0;T!==a;++T)s[T]=v*o[u+T]+y*o[c+T]+_*o[l+T]+x*o[d+T];return s}}class xy extends $d{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(i-t),d=1-u;for(let h=0;h!==a;++h)s[h]=o[c+h]*d+o[l+h]*u;return s}}class JS extends $d{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class kr{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ga(t,this.TimeBufferType),this.values=ga(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ga(e.times,Array),values:ga(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new JS(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new xy(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ZS(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case _u:t=this.InterpolantFactoryMethodDiscrete;break;case bp:t=this.InterpolantFactoryMethodLinear;break;case Mf:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return _u;case this.InterpolantFactoryMethodLinear:return bp;case this.InterpolantFactoryMethodSmooth:return Mf}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&YS(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Mf,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{const d=a*n,h=d-n,f=d+n;for(let p=0;p!==n;++p){const m=t[d+p];if(m!==t[h+p]||m!==t[f+p]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const d=a*n,h=o*n;for(let f=0;f!==n;++f)t[h+f]=t[d+f]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}kr.prototype.ValueTypeName="";kr.prototype.TimeBufferType=Float32Array;kr.prototype.ValueBufferType=Float32Array;kr.prototype.DefaultInterpolation=bp;class Ya extends kr{constructor(e,t,n){super(e,t,n)}}Ya.prototype.ValueTypeName="bool";Ya.prototype.ValueBufferType=Array;Ya.prototype.DefaultInterpolation=_u;Ya.prototype.InterpolantFactoryMethodLinear=void 0;Ya.prototype.InterpolantFactoryMethodSmooth=void 0;class by extends kr{constructor(e,t,n,i){super(e,t,n,i)}}by.prototype.ValueTypeName="color";class Ru extends kr{constructor(e,t,n,i){super(e,t,n,i)}}Ru.prototype.ValueTypeName="number";class KS extends $d{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)$n.slerpFlat(s,0,o,c-a,o,c,l);return s}}class gc extends kr{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new KS(this.times,this.values,this.getValueSize(),e)}}gc.prototype.ValueTypeName="quaternion";gc.prototype.InterpolantFactoryMethodSmooth=void 0;class $a extends kr{constructor(e,t,n){super(e,t,n)}}$a.prototype.ValueTypeName="string";$a.prototype.ValueBufferType=Array;$a.prototype.DefaultInterpolation=_u;$a.prototype.InterpolantFactoryMethodLinear=void 0;$a.prototype.InterpolantFactoryMethodSmooth=void 0;class Va extends kr{constructor(e,t,n,i){super(e,t,n,i)}}Va.prototype.ValueTypeName="vector";class Ga{constructor(e="",t=-1,n=[],i=dm){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=_r(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(RR(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(kr.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=$S(l);l=Iv(l,1,u),c=Iv(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Ru(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const d=u[1];let h=i[d];h||(i[d]=h=[]),h.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(d,h,f,p,m){if(f.length!==0){const g=[],v=[];_y(f,g,v,p),g.length!==0&&m.push(new d(h,g,v))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const h=c[d].keys;if(!(!h||h.length===0))if(h[0].morphTargets){const f={};let p;for(p=0;p<h.length;p++)if(h[p].morphTargets)for(let m=0;m<h[p].morphTargets.length;m++)f[h[p].morphTargets[m]]=-1;for(const m in f){const g=[],v=[];for(let y=0;y!==h[p].morphTargets.length;++y){const _=h[p];g.push(_.time),v.push(_.morphTarget===m?1:0)}i.push(new Ru(".morphTargetInfluence["+m+"]",g,v))}l=f.length*o}else{const f=".bones["+t[d].name+"]";n(Va,f+".position",h,"pos",i),n(gc,f+".quaternion",h,"rot",i),n(Va,f+".scale",h,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];
vendor: 4,301 bytes, line 45
45t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function CR(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ru;case"vector":case"vector2":case"vector3":case"vector4":return Va;case"color":return by;case"quaternion":return gc;case"bool":case"boolean":return Ya;case"string":return $a}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function RR(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=CR(r.type);if(r.times===void 0){const t=[],n=[];_y(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Vs={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class wy{constructor(e,t,n){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,d){return c.push(u,d),this},this.removeHandler=function(u){const d=c.indexOf(u);return d!==-1&&c.splice(d,2),this},this.getHandler=function(u){for(let d=0,h=c.length;d<h;d+=2){const f=c[d],p=c[d+1];if(f.global&&(f.lastIndex=0),f.test(u))return p}return null}}}const Za=new wy;class Ei{constructor(e){this.manager=e!==void 0?e:Za,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Ei.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ss={};class PR extends Error{constructor(e,t){super(e),this.response=t}}class Lr extends Ei{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Vs.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ss[e]!==void 0){Ss[e].push({onLoad:t,onProgress:n,onError:i});return}Ss[e]=[],Ss[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=Ss[e],d=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=h?parseInt(h):0,p=f!==0;let m=0;const g=new ReadableStream({start(v){y();function y(){d.read().then(({done:_,value:x})=>{if(_)v.close();else{m+=x.byteLength;const T=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:f});for(let b=0,M=u.length;b<M;b++){const E=u[b];E.onProgress&&E.onProgress(T)}v.enqueue(x),y()}},_=>{v.error(_)})}}});return new Response(g)}else throw new PR(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>
vendor: 9,458 bytes, line 45
45new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a==="")return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),h=d&&d[1]?d[1].toLowerCase():void 0,f=new TextDecoder(h);return c.arrayBuffer().then(p=>f.decode(p))}}}).then(c=>{Vs.add(e,c);const u=Ss[e];delete Ss[e];for(let d=0,h=u.length;d<h;d++){const f=u[d];f.onLoad&&f.onLoad(c)}}).catch(c=>{const u=Ss[e];if(u===void 0)throw this.manager.itemError(e),c;delete Ss[e];for(let d=0,h=u.length;d<h;d++){const f=u[d];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class IR extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Lr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Ga.parse(e[n]);t.push(i)}return t}}class DR extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],a=new bm,l=new Lr(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(d){l.load(e[d],function(h){const f=s.parse(h,!0);o[d]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(a.minFilter=ei),a.image=o,a.format=f.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let d=0,h=e.length;d<h;++d)u(d);else l.load(e,function(d){const h=s.parse(d,!0);if(h.isCubemap){const f=h.mipmaps.length/h.mipmapCount;for(let p=0;p<f;p++){o[p]={mipmaps:[]};for(let m=0;m<h.mipmapCount;m++)o[p].mipmaps.push(h.mipmaps[p*h.mipmapCount+m]),o[p].format=h.format,o[p].width=h.width,o[p].height=h.height}a.image=o}else a.image.width=h.width,a.image.height=h.height,a.mipmaps=h.mipmaps;h.mipmapCount===1&&(a.minFilter=ei),a.format=h.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class Pu extends Ei{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Vs.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Mu("img");function l(){u(),Vs.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(d){u(),i&&i(d),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class LR extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=new Gd;s.colorSpace=Ln;const o=new Pu(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class QS extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new fs,a=new Lr(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(i!==void 0)i(u);else{console.error(u);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:or,o.wrapT=c.wrapT!==void 0?c.wrapT:or,o.magFilter=c.magFilter!==void 0?c.magFilter:ei,o.minFilter=c.minFilter!==void 0?c.minFilter:ei,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=Hr),c.mipmapCount===1&&(o.minFilter=ei),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},n,i),o}}class eM extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=new Wn,o=new Pu(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class Ro extends an{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new st(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class tM extends Ro{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(an.DEFAULT_UP),this.updateMatrix(),this.groundColor=new st(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Ug=new St,Vx=new V,Gx=new V;class Sy{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ue(512,512),this.mapType=$r,this.map=null,this.mapPass=null,this.matrix=new St,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new pc,this._frameExtents=new Ue(1,1),this._viewportCount=1,this._viewports=[new Kt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Vx.setFromMatrixPosition(e.matrixWorld),t.position.copy(Vx),Gx.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Gx),t.updateMatrixWorld(),Ug.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ug),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Ug)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class kR extends Sy{constructor(){super(new Qn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=rc*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class My extends Ro{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(an.DEFAULT_UP),this.updateMatrix(),this.target=new an,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new kR}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Hx=new St,Nc=new V,Ng=new V;class UR extends Sy{constructor(){super(new Qn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ue(4,2),this._viewportCount=6,this._viewports=[new Kt(2,1,1,1),new Kt(0,1,1,1),new Kt(3,1,1,1),new Kt(1,1,1,1),new Kt(3,0,1,1),new Kt(1,0,1,1)],this._cubeDirections=[new V(1,0,0),new V(-1,0,0),new V(0,0,1),new V(0,0,-1),new V(0,1,0),new V(0,-1,0)],this._cubeUps=[new V(0,1,0),new V(0,1,0),new V(0,1,0),new V(0,1,0),new V(0,0,1),new V(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Nc.setFromMatrixPosition(e.matrixWorld),n.position.copy(Nc),Ng.copy(n.position),Ng.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Ng),n.updateMatrixWorld(),i.makeTranslation(-Nc.x,-Nc.y,-Nc.z),Hx.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Hx)}}class Ey extends Ro{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new UR}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Ja extends mm{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
45phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,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,o){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=o,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,o=n+e,a=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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class NR extends Sy{constructor(){super(new Ja(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Ty extends Ro{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(an.DEFAULT_UP),this.updateMatrix(),this.target=new an,this.shadow=new NR}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Ay extends Ro{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class nM extends Ro{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class iM{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new V)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class rM extends Ro{constructor(e=new iM,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}
vendor: 19,551 bytes, line 45
45class Om extends Ei{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new Lr(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new st().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new st().setHex(o.value);break;case"v2":i.uniforms[s].value=new Ue().fromArray(o.value);break;case"v3":i.uniforms[s].value=new V().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Kt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Yt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new St().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Ue().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Ue().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Om.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:VS,SpriteMaterial:fc,RawShaderMaterial:GS,ShaderMaterial:Dr,PointsMaterial:ma,MeshPhysicalMaterial:HS,MeshStandardMaterial:vy,MeshPhongMaterial:Cu,MeshToonMaterial:WS,MeshNormalMaterial:jS,MeshLambertMaterial:yy,MeshDepthMaterial:Um,MeshDistanceMaterial:Nm,MeshBasicMaterial:Bi,MeshMatcapMaterial:XS,LineDashedMaterial:qS,LineBasicMaterial:ai,Material:Mi};return new t[e]}}class Tp{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Fm extends Ht{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class sM extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Lr(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(f,p){if(t[p]!==void 0)return t[p];const g=f.interleavedBuffers[p],v=s(f,g.buffer),y=Rl(g.type,v),_=new ym(y,g.stride);return _.uuid=g.uuid,t[p]=_,_}function s(f,p){if(n[p]!==void 0)return n[p];const g=f.arrayBuffers[p],v=new Uint32Array(g).buffer;return n[p]=v,v}const o=e.isInstancedBufferGeometry?new Fm:new Ht,a=e.data.index;if(a!==void 0){const f=Rl(a.type,a.array);o.setIndex(new Zt(f,1))}const l=e.data.attributes;for(const f in l){const p=l[f];let m;if(p.isInterleavedBufferAttribute){const g=i(e.data,p.data);m=new vr(g,p.itemSize,p.offset,p.normalized)}else{const g=Rl(p.type,p.array),v=p.isInstancedBufferAttribute?Ba:Zt;m=new v(g,p.itemSize,p.normalized)}p.name!==void 0&&(m.name=p.name),p.usage!==void 0&&m.setUsage(p.usage),o.setAttribute(f,m)}const c=e.data.morphAttributes;if(c)for(const f in c){const p=c[f],m=[];for(let g=0,v=p.length;g<v;g++){const y=p[g];let _;if(y.isInterleavedBufferAttribute){const x=i(e.data,y.data);_=new vr(x,y.itemSize,y.offset,y.normalized)}else{const x=Rl(y.type,y.array);_=new Zt(x,y.itemSize,y.normalized)}y.name!==void 0&&(_.name=y.name),m.push(_)}o.morphAttributes[f]=m}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let f=0,p=d.length;f!==p;++f){const m=d[f];o.addGroup(m.start,m.count,m.materialIndex)}const h=e.data.boundingSphere;return h!==void 0&&(o.boundingSphere=new Zn().fromJSON(h)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class OR extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?Tp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Lr(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(d){i!==void 0&&i(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?Tp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Lr(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,n),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),this.bindLightTargets(c),t!==void 0){let d=!1;for(const h in o)if(o[h].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new La().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new jd().fromJSON(e[s],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new sM;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;default:l.type in zx?a=zx[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new Om;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=Ga.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return o(u)}else return l.data?{data:Rl(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new wy(t);s=new Pu(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const d=e[c],h=d.url;if(Array.isArray(h)){const f=[];for(let p=0,m=h.length;p<m;p++){const g=h[p],v=a(g);v!==null&&(v instanceof HTMLImageElement?f.push(v):f.push(new fs(v.data,v.width,v.height)))}i[d.uuid]=new wo(f)}else{const f=a(d.url);i[d.uuid]=new wo(f)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(l)}else return o.data?{data:Rl(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Pu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const u=[];for(let d=0,h=c.length;d<h;d++){const f=c[d],p=await s(f);p!==null&&(p instanceof HTMLImageElement?u.push(p):u.push(new fs(p.data,p.width,p.height)))}n[l.uuid]=new wo(u)}else{const u=await s(l.url);n[l.uuid]=new wo(u)}}}return n}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],c=l.data;let u;Array.isArray(c)?(u=new Gd,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new fs:u=new Wn,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=n(a.mapping,FR)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=n(a.wrap[0],Wx),u.wrapT=n(a.wrap[1],Wx)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=n(a.minFilter,jx)),a.magFilter!==void 0&&(u.magFilter=n(a.magFilter,jx)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),i[a.uuid]=u}return i}parseObject(e,t,n,i,s){let o;function a(h){return t[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",h),t[h]}function l(h){if(h!==void 0){if(Array.isArray(h)){const f=[];for(let p=0,m=h.length;p<m;p++){const g=h[p];n[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),f.push(n[g])}return f}return n[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",h),n[h]}}function c(h){return i[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",h),i[h]}let u,d;switch(e.type){case"Scene":o=new Hd,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new st(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new vm(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new gm(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new Qn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Ja(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Ay(e.color,e.intensity);break;case"DirectionalLight":o=new Ty(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new Ey(e.color,e.intensity,e.distance,e.decay);break;
45case"RectAreaLight":o=new nM(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new My(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new tM(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new rM().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),d=l(e.material),o=new ly(u,d),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),d=l(e.material),o=new fn(u,d);break;case"InstancedMesh":u=a(e.geometry),d=l(e.material);const h=e.count,f=e.instanceMatrix,p=e.instanceColor;o=new TS(u,d,h),o.instanceMatrix=new Ba(new Float32Array(f.array),16),p!==void 0&&(o.instanceColor=new Ba(new Float32Array(p.array),p.itemSize));break;case"BatchedMesh":u=a(e.geometry),d=l(e.material),o=new AS(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(m=>{let g=null,v=null;return m.boundingBox!==void 0&&(g=new jn().fromJSON(m.boundingBox)),m.boundingSphere!==void 0&&(v=new Zn().fromJSON(m.boundingSphere)),{...m,boundingBox:g,boundingSphere:v}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=c(e.matricesTexture.uuid),o._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new Zn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new jn().fromJSON(e.boundingBox));break;case"LOD":o=new ES;break;case"Line":o=new Xs(a(e.geometry),l(e.material));break;case"LineLoop":o=new CS(a(e.geometry),l(e.material));break;case"LineSegments":o=new br(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new su(a(e.geometry),l(e.material));break;case"Sprite":o=new Wd(l(e.material));break;case"Group":o=new Pr;break;case"Bone":o=new _m;break;default:o=new an}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const h=e.children;for(let f=0;f<h.length;f++)o.add(this.parseObject(h[f],t,n,i,s))}if(e.animations!==void 0){const h=e.animations;for(let f=0;f<h.length;f++){const p=h[f];o.animations.push(s[p])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const h=e.levels;for(let f=0;f<h.length;f++){const p=h[f],m=o.getObjectByProperty("uuid",p.object);m!==void 0&&o.addLevel(m,p.distance,p.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new an}})}}const FR={UVMapping:rm,CubeReflectionMapping:Ws,CubeRefractionMapping:Eo,EquirectangularReflectionMapping:gu,EquirectangularRefractionMapping:vu,CubeUVReflectionMapping:dc},Wx={RepeatWrapping:Gr,ClampToEdgeWrapping:or,MirroredRepeatWrapping:yu},jx={NearestFilter:Ii,NearestMipmapNearestFilter:q0,NearestMipmapLinearFilter:Cl,LinearFilter:ei,LinearMipmapNearestFilter:Kc,LinearMipmapLinearFilter:Hr},Og=new WeakMap;
vendor: 6,881 bytes, line 45
45class BR extends Ei{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Vs.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{if(Og.has(o)===!0)i&&i(Og.get(o)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Vs.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Og.set(l,c),Vs.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Vs.add(e,l),s.manager.itemStart(e)}}let Fh;class Cy{static getContext(){return Fh===void 0&&(Fh=new(window.AudioContext||window.webkitAudioContext)),Fh}static setContext(e){Fh=e}}class zR extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Lr(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);Cy.getContext().decodeAudioData(c,function(d){t(d)}).catch(a)}catch(c){a(c)}},n,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const Xx=new St,qx=new St,Go=new St;class VR{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Qn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Qn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Go.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(Da*t.fov*.5)/t.zoom;let a,l;qx.elements[12]=-i,Xx.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,Go.elements[0]=2*t.near/(l-a),Go.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Go),a=-o*t.aspect-s,l=o*t.aspect-s,Go.elements[0]=2*t.near/(l-a),Go.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Go)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(qx),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Xx)}}class oM extends Qn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Ry{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Yx(),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=Yx();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Yx(){return performance.now()}const Ho=new V,Fg=new $n,GR=new V,Wo=new V,jo=new V;class HR extends an{constructor(){super(),this.type="AudioListener",this.context=Cy.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ry}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ho,Fg,GR),Wo.set(0,0,-1).applyQuaternion(Fg),jo.set(0,1,0).applyQuaternion(Fg),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ho.x,n),t.positionY.linearRampToValueAtTime(Ho.y,n),t.positionZ.linearRampToValueAtTime(Ho.z,n),t.forwardX.linearRampToValueAtTime(Wo.x,n),t.forwardY.linearRampToValueAtTime(Wo.y,n),t.forwardZ.linearRampToValueAtTime(Wo.z,n),t.upX.linearRampToValueAtTime(jo.x,n),t.upY.linearRampToValueAtTime(jo.y,n),t.upZ.linearRampToValueAtTime(jo.z,n)}else t.setPosition(Ho.x,Ho.y,Ho.z),t.setOrientation(Wo.x,Wo.y,Wo.z,jo.x,jo.y,jo.z)}}class aM extends an{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}
vendor: 4,122 bytes, line 45
45pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const Xo=new V,$x=new $n,WR=new V,qo=new V;class jR extends aM{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl
vendor: 15,344 bytes, line 45
45===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Xo,$x,WR),qo.set(0,0,1).applyQuaternion($x);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Xo.x,n),t.positionY.linearRampToValueAtTime(Xo.y,n),t.positionZ.linearRampToValueAtTime(Xo.z,n),t.orientationX.linearRampToValueAtTime(qo.x,n),t.orientationY.linearRampToValueAtTime(qo.y,n),t.orientationZ.linearRampToValueAtTime(qo.z,n)}else t.setPosition(Xo.x,Xo.y,Xo.z),t.setOrientation(qo.x,qo.y,qo.z)}}class XR{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class lM{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){$n.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;$n.multiplyQuaternionsFlat(e,o,e,t,e,n),$n.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Py="\\[\\]\\.:\\/",qR=new RegExp("["+Py+"]","g"),Iy="[^"+Py+"]",YR="[^"+Py.replace("\\.","")+"]",$R=/((?:WC+[\/:])*)/.source.replace("WC",Iy),ZR=/(WCOD+)?/.source.replace("WCOD",YR),JR=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Iy),KR=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Iy),QR=new RegExp("^"+$R+ZR+JR+KR+"$"),eP=["material","materials","bones","map"];class tP{constructor(e,t,n){const i=n||mn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class mn{constructor(e,t,n){this.path=t,this.parsedPath=n||mn.parseTrackName(t),this.node=mn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new mn.Composite(e,t,n):new mn(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(qR,"")}static parseTrackName(e){const t=QR.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);eP.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=mn.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}mn.Composite=tP;mn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};mn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};mn.prototype.GetterByBindingType=[mn.prototype._getValue_direct,mn.prototype._getValue_array,mn.prototype._getValue_arrayElement,mn.prototype._getValue_toArray];mn.prototype.SetterByBindingTypeAndVersioning=[[mn.prototype._setValue_direct,mn.prototype._setValue_direct_setNeedsUpdate,mn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[mn.prototype._setValue_array,mn.prototype._setValue_array_setNeedsUpdate,mn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[mn.prototype._setValue_arrayElement,mn.prototype._setValue_arrayElement_setNeedsUpdate,mn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[mn.prototype._setValue_fromArray,mn.prototype._setValue_fromArray_setNeedsUpdate,mn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class nP{constructor(){this.isAnimationObjectGroup=!0,this.uuid=_r(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,d=arguments.length;u!==d;++u){const h=arguments[u],f=h.uuid;let p=t[f];if(p===void 0){p=l++,t[f]=p,e.push(h);for(let m=0,g=o;m!==g;++m)s[m].push(new mn(h,n[m],i[m]))}else if(p<c){a=e[p];const m=--c,g=e[m];t[g.uuid]=p,e[p]=g,t[f]=m,e[m]=h;for(let v=0,y=o;v!==y;++v){const _=s[v],x=_[m];let T=_[p];_[p]=x,T===void 0&&(T=new mn(h,n[v],i[v])),_[m]=T}}else e[p]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const d=s++,h=e[d];t[h.uuid]=u,e[u]=h,t[c]=d,e[d]=l;for(let f=0,p=i;f!==p;++f){const m=n[f],g=m[d],v=m[u];m[u]=g,m[d]=v}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d<s){const h=--s,f=e[h],p=--o,m=e[p];t[f.uuid]=d,e[d]=f,t[m.uuid]=h,e[h]=m,e.pop();for(let g=0,v=i;g!==v;++g){const y=n[g],_=y[h],x=y[p];y[d]=_,y[h]=x,y.pop()}}else{const h=--o,f=e[h];h>0&&(t[f.uuid]=d),e[d]=f,e.pop();for(let p=0,m=i;p!==m;++p){const g=n[p];g[d]=g[h],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,d=new Array(c);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(d);for(let h=u,f=l.length;h!==f;++h){const p=l[h];d[h]=new mn(p,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}class cM{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:fa,endingEnd:fa};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=oS,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}
vendor: 5,869 bytes, line 45
45fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case ty:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case dm:default:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===aS;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===sS){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=pa,i.endingEnd=pa):(e?i.endingStart=this.zeroSlopeAtStart?pa:fa:i.endingStart=xu,t?i.endingEnd=this.zeroSlopeAtEnd?pa:fa:i.endingEnd=xu)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=n,this}}const iP=new Float32Array(1);class rP extends vs{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let d=0;d!==s;++d){const h=i[d],f=h.name;let p=u[f];if(p!==void 0)++p.referenceCount,o[d]=p;else{if(p=o[d],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,f));continue}const m=t&&t._propertyBindings[d].binding.parsedPath;p=new lM(mn.create(n,f,m),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,f),o[d]=p}a[d].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let o=s[t];
vendor: 6,441 bytes, line 45
45if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const d=a.actionByRoot,h=(e._localRoot||this._root).uuid;delete d[h],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,a=o[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new xy(new Float32Array(2),new Float32Array(2),1,iP),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?Ga.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=dm),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===n)return d;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new cM(this,o,t,n);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?Ga.findByName(n,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=u,t[u]=d,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class sP extends sy{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new fm(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Dy{constructor(e){this.value=e}clone(){return new Dy(this.value.clone===void 0?this.value:this.value.clone())}}let oP=0;class aP extends vs{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:oP++}),this.name="",this.usage=wu,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Ap extends ym{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class lP{constructor(e,t,n,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Zx=new St;class Bm{constructor(e,t,n=0,i=1/0){this.ray=new $s(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new pm,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: 
45Unsupported camera type: "+t.type)}setFromXRController(e){return Zx.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Zx),this}intersectObject(e,t=!0,n=[]){return Dv(e,this,n,t),n.sort(Jx),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Dv(e[i],this,n,t);return n.sort(Jx),n}}function Jx(r,e){return r.distance-e.distance}function Dv(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let o=0,a=s.length;o<a;o++)Dv(s[o],e,t,!0)}}class Cp{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=$t(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos($t(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class cP{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Ly{constructor(e,t,n,i){Ly.prototype.isMatrix2=!0,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}}const Kx=new Ue;class uP{constructor(e=new Ue(1/0,1/0),t=new Ue(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),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=Kx.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(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}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}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}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))}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}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Kx).distanceTo(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}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)}}const Qx=new V,Bh=new V;class uM{constructor(e=new V,t=new V){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Qx.subVectors(e,this.start),Bh.subVectors(this.end,this.start);const n=Bh.dot(Bh);let s=Bh.dot(Qx)/n;return t&&(s=$t(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
vendor: 13,619 bytes, line 45
45applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const eb=new V;class dP extends an{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Ht,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new ot(i,3));const s=new ai({fog:!1,toneMapped:!1});this.cone=new br(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),eb.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(eb),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const co=new V,zh=new St,Bg=new St;class hP extends br{constructor(e){const t=dM(e),n=new Ht,i=[],s=[],o=new st(0,0,1),a=new st(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}n.setAttribute("position",new ot(i,3)),n.setAttribute("color",new ot(s,3));const l=new ai({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Bg.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(zh.multiplyMatrices(Bg,a.matrixWorld),co.setFromMatrixPosition(zh),i.setXYZ(o,co.x,co.y,co.z),zh.multiplyMatrices(Bg,a.parent.matrixWorld),co.setFromMatrixPosition(zh),i.setXYZ(o+1,co.x,co.y,co.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function dM(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...dM(r.children[t]));return e}class fP extends fn{constructor(e,t,n){const i=new mc(t,4,2),s=new Bi({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const pP=new V,tb=new st,nb=new st;class mP extends an{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Yd(t);i.rotateY(Math.PI*.5),this.material=new Bi({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new Zt(o,3)),this.add(new fn(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");tb.copy(this.light.color),nb.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?tb:nb;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(pP.setFromMatrixPosition(this.light.matrixWorld).negate())}}class gP extends br{constructor(e=10,t=10,n=4473924,i=8947848){n=new st(n),i=new st(i);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let h=0,f=0,p=-a;h<=t;h++,p+=o){l.push(-a,0,p,a,0,p),l.push(p,0,-a,p,0,a);const m=h===s?n:i;m.toArray(c,f),f+=3,m.toArray(c,f),f+=3,m.toArray(c,f),f+=3,m.toArray(c,f),f+=3}const u=new Ht;u.setAttribute("position",new ot(l,3)),u.setAttribute("color",new ot(c,3));const d=new ai({vertexColors:!0,toneMapped:!1});super(u,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class vP extends br{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new st(s),o=new st(o);const a=[],l=[];if(t>1)for(let d=0;d<t;d++){const h=d/t*(Math.PI*2),f=Math.sin(h)*e,p=Math.cos(h)*e;a.push(0,0,0),a.push(f,0,p);const m=d&1?s:o;l.push(m.r,m.g,m.b),l.push(m.r,m.g,m.b)}for(let d=0;d<n;d++){const h=d&1?s:o,f=e-e/n*d;for(let p=0;p<i;p++){let m=p/i*(Math.PI*2),g=Math.sin(m)*f,v=Math.cos(m)*f;a.push(g,0,v),l.push(h.r,h.g,h.b),m=(p+1)/i*(Math.PI*2),g=Math.sin(m)*f,v=Math.cos(m)*f,a.push(g,0,v),l.push(h.r,h.g,h.b)}}const c=new Ht;c.setAttribute("position",new ot(a,3)),c.setAttribute("color",new ot(l,3));const u=new ai({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const ib=new V,Vh=new V,rb=new V;class yP extends an{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new Ht;i.setAttribute("position",new ot([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new ai({fog:!1,toneMapped:!1});this.lightPlane=new Xs(i,s),this.add(this.lightPlane),i=new Ht,i.setAttribute("position",new ot([0,0,0,0,0,1],3)),this.targetLine=new Xs(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),ib.setFromMatrixPosition(this.light.matrixWorld),Vh.setFromMatrixPosition(this.light.target.matrixWorld),rb.subVectors(Vh,ib),this.lightPlane.lookAt(Vh),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Vh),this.targetLine.scale.z=rb.length()}}const Gh=new V,qn=new mm;class _P extends br{constructor(e){const t=new Ht,n=new ai({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(p,m){l(p),l(m)}function l(p){i.push(0,0,0),s.push(0,0,0),o[p]===void 0&&(o[p]=[]),o[p].push(i.length/3-1)}t.setAttribute("position",new ot(i,3)),t.setAttribute("color",new ot(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new st(16755200),u=new st(16711680),d=new st(43775),h=new st(16777215),f=new st(3355443);this.setColors(c,u,d,h,f)}setColors(e,t,n,i,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;qn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const s=this.camera.coordinateSystem===Rr?-1:0;Kn("c",t,e,qn,0,0,s),Kn("t",t,e,qn,0,0,1),Kn("n1",t,e,qn,-1,-1,s),Kn("n2",t,e,qn,n,-1,s),Kn("n3",t,e,qn,-1,i,s),Kn("n4",t,e,qn,n,i,s),Kn("f1",t,e,qn,-1,-1,1),Kn("f2",t,e,qn,n,-1,1),Kn("f3",t,e,qn,-1,i,1),Kn("f4",t,e,qn,n,i,1),Kn("u1",t,e,qn,n*.7,i*1.1,s),Kn("u2",t,e,qn,-1*.7,i*1.1,s),Kn("u3",t,e,qn,0,i*2,s),Kn("cf1",t,e,qn,-1,0,1),Kn("cf2",t,e,qn,n,0,1),Kn("cf3",t,e,qn,0,-1,1),Kn("cf4",t,e,qn,0,i,1),Kn("cn1",t,e,qn,-1,0,s),Kn("cn2",t,e,qn,n,0,s),Kn("cn3",t,e,qn,0,-1,s),Kn("cn4",t,e,qn,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Kn(r,e,t,n,i,s,o){Gh.set(i,s,o).unproject(n);const a=e[r];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Gh.x,Gh.y,Gh.z)}}const Hh=new jn;class xP extends br{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new Ht;s.setIndex(new Zt(n,1)),s.setAttribute("position",new Zt(i,3)),super(s,new ai({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Hh.setFromObject(this.object),Hh.isEmpty())return;const e=Hh.min,t=Hh.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class bP extends br{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ht;s.setIndex(new Zt(n,1)),s.setAttribute("position",new ot(i,3)),super(s,new ai({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class wP extends Xs{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new Ht;o.setAttribute("position",new ot(s,3)),o.computeBoundingSphere(),super(o,new ai({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Ht;l.setAttribute("position",new ot(a,3)),l.computeBoundingSphere(),this.add(new fn(l,new Bi({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const sb=new V;let Wh,zg;class SP extends an{constructor(e=new V(0,0,1),t=new V(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",Wh===void 0&&(Wh=new Ht,Wh.setAttribute("position",new ot([0,0,0,0,1,0],3)),zg=new qd(.5,1,5,1),zg.translate(0,-.5,0)),this.position.copy(t),this.line=new Xs(Wh,new ai({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new fn(zg,new Bi({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{sb.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(sb,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class MP extends br{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Ht;i.setAttribute("position",new ot(t,3)),i.setAttribute("color",new ot(n,3));const s=new ai({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}
45setColors(e,t,n){const i=new st,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class EP{constructor(){this.type="ShapePath",this.color=new st,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ep,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(v){const y=[];for(let _=0,x=v.length;_<x;_++){const T=v[_],b=new La;b.curves=T.curves,y.push(b)}return y}function n(v,y){const _=y.length;let x=!1;for(let T=_-1,b=0;b<_;T=b++){let M=y[T],E=y[b],S=E.x-M.x,w=E.y-M.y;if(Math.abs(w)>Number.EPSILON){if(w<0&&(M=y[b],S=-S,E=y[T],w=-w),v.y<M.y||v.y>E.y)continue;if(v.y===M.y){if(v.x===M.x)return!0}else{const D=w*(v.x-M.x)-S*(v.y-M.y);if(D===0)return!0;if(D<0)continue;x=!x}}else{if(v.y!==M.y)continue;if(E.x<=v.x&&v.x<=M.x||M.x<=v.x&&v.x<=E.x)return!0}}return x}const i=Wr.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new La,l.curves=a.curves,c.push(l),c;let u=!i(s[0].getPoints());u=e?!u:u;const d=[],h=[];let f=[],p=0,m;h[p]=void 0,f[p]=[];for(let v=0,y=s.length;v<y;v++)a=s[v],m=a.getPoints(),o=i(m),o=e?!o:o,o?(!u&&h[p]&&p++,h[p]={s:new La,p:m},h[p].s.curves=a.curves,u&&p++,f[p]=[]):f[p].push({h:a,p:m[0]});if(!h[0])return t(s);if(h.length>1){let v=!1,y=0;for(let _=0,x=h.length;_<x;_++)d[_]=[];for(let _=0,x=h.length;_<x;_++){const T=f[_];for(let b=0;b<T.length;b++){const M=T[b];let E=!0;for(let S=0;S<h.length;S++)n(M.p,h[S].p)&&(_!==S&&y++,E?(E=!1,d[S].push(M)):v=!0);E&&d[_].push(M)}}y>0&&v===!1&&(f=d)}let g;for(let v=0,y=h.length;v<y;v++){l=h[v].s,c.push(l),g=f[v];for(let _=0,x=g.length;_<x;_++)l.holes.push(g[_].h)}return c}}class ky extends vs{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function TP(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function AP(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function CP(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Lv(r,e,t,n){const i=RP(n);switch(t){case J0:return r*e;case lm:return r*e/i.components*i.byteLength;case zd:return r*e/i.components*i.byteLength;case Q0:return r*e*2/i.components*i.byteLength;case cm:return r*e*2/i.components*i.byteLength;case K0:return r*e*3/i.components*i.byteLength;case qi:return r*e*4/i.components*i.byteLength;case um:return r*e*4/i.components*i.byteLength;case Qc:case eu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case tu:case nu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Zf:case Kf:return Math.max(r,16)*Math.max(e,8)/4;case $f:case Jf:return Math.max(r,8)*Math.max(e,8)/2;case Qf:case ep:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case tp:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case np:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case ip:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case rp:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case sp:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case op:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case ap:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case lp:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case cp:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case up:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case dp:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case hp:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case fp:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case pp:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case mp:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case iu:case gp:case vp:return Math.ceil(r/4)*Math.ceil(e/4)*16;case ey:case yp:return Math.ceil(r/4)*Math.ceil(e/4)*8;case _p:case xp:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}
vendor: 5,237 bytes, lines 45-108
45function RP(r){switch(r){case $r:case Y0:return{byteLength:1,components:1};case ec:case $0:case hc:return{byteLength:2,components:1};case om:case am:return{byteLength:2,components:4};case js:case sm:case ar:return{byteLength:4,components:1};case Z0:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class PP{static contain(e,t){return TP(e,t)}static cover(e,t){return AP(e,t)}static fill(e){return CP(e)}static getByteLength(e,t,n,i){return Lv(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Fd}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Fd);/**
46 * @license
47 * Copyright 2010-2025 Three.js Authors
48 * SPDX-License-Identifier: MIT
49 */function hM(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function IP(r){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,d=c.byteLength,h=r.createBuffer();r.bindBuffer(l,h),r.bufferData(l,c,u),a.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:d}}function n(a,l,c){const u=l.array,d=l.updateRanges;if(r.bindBuffer(c,a),d.length===0)r.bufferSubData(c,0,u);else{d.sort((f,p)=>f.start-p.start);let h=0;for(let f=1;f<d.length;f++){const p=d[h],m=d[f];m.start<=p.start+p.count+1?p.count=Math.max(p.count,m.start+m.count-p.start):(++h,d[h]=m)}d.length=h+1;for(let f=0,p=d.length;f<p;f++){const m=d[f];r.bufferSubData(c,m.start*u.BYTES_PER_ELEMENT,u,m.start,m.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(r.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.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,a,l),c.version=a.version}}return{get:i,remove:s,update:o}}var DP=`#ifdef USE_ALPHAHASH
50	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
51#endif`,LP=`#ifdef USE_ALPHAHASH
52	const float ALPHA_HASH_SCALE = 0.05;
53	float hash2D( vec2 value ) {
54		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
55	}
56	float hash3D( vec3 value ) {
57		return hash2D( vec2( hash2D( value.xy ), value.z ) );
58	}
59	float getAlphaHashThreshold( vec3 position ) {
60		float maxDeriv = max(
61			length( dFdx( position.xyz ) ),
62			length( dFdy( position.xyz ) )
63		);
64		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
65		vec2 pixScales = vec2(
66			exp2( floor( log2( pixScale ) ) ),
67			exp2( ceil( log2( pixScale ) ) )
68		);
69		vec2 alpha = vec2(
70			hash3D( floor( pixScales.x * position.xyz ) ),
71			hash3D( floor( pixScales.y * position.xyz ) )
72		);
73		float lerpFactor = fract( log2( pixScale ) );
74		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
75		float a = min( lerpFactor, 1.0 - lerpFactor );
76		vec3 cases = vec3(
77			x * x / ( 2.0 * a * ( 1.0 - a ) ),
78			( x - 0.5 * a ) / ( 1.0 - a ),
79			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
80		);
81		float threshold = ( x < ( 1.0 - a ) )
82			? ( ( x < a ) ? cases.x : cases.y )
83			: cases.z;
84		return clamp( threshold , 1.0e-6, 1.0 );
85	}
86#endif`,kP=`#ifdef USE_ALPHAMAP
87	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
88#endif`,UP=`#ifdef USE_ALPHAMAP
89	uniform sampler2D alphaMap;
90#endif`,NP=`#ifdef USE_ALPHATEST
91	#ifdef ALPHA_TO_COVERAGE
92	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
93	if ( diffuseColor.a == 0.0 ) discard;
94	#else
95	if ( diffuseColor.a < alphaTest ) discard;
96	#endif
97#endif`,OP=`#ifdef USE_ALPHATEST
98	uniform float alphaTest;
99#endif`,FP=`#ifdef USE_AOMAP
100	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
101	reflectedLight.indirectDiffuse *= ambientOcclusion;
102	#if defined( USE_CLEARCOAT ) 
103		clearcoatSpecularIndirect *= ambientOcclusion;
104	#endif
105	#if defined( USE_SHEEN ) 
106		sheenSpecularIndirect *= ambientOcclusion;
107	#endif
108	#if defined( USE_ENVMAP ) && defined( STANDARD )
109		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
110		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
111	#endif
112#endif`,BP=`#ifdef USE_AOMAP
113	uniform sampler2D aoMap;
114	uniform float aoMapIntensity;
115#endif`,zP=`#ifdef USE_BATCHING
116	#if ! defined( GL_ANGLE_multi_draw )
117	#define gl_DrawID _gl_DrawID
118	uniform int _gl_DrawID;
119	#endif
120	uniform highp sampler2D batchingTexture;
121	uniform highp usampler2D batchingIdTexture;
122	mat4 getBatchingMatrix( const in float i ) {
123		int size = textureSize( batchingTexture, 0 ).x;
124		int j = int( i ) * 4;
125		int x = j % size;
126		int y = j / size;
127		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
128		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
129		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
130		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
131		return mat4( v1, v2, v3, v4 );
132	}
133	float getIndirectIndex( const in int i ) {
134		int size = textureSize( batchingIdTexture, 0 ).x;
135		int x = i % size;
136		int y = i / size;
137		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
138	}
139#endif
140#ifdef USE_BATCHING_COLOR
141	uniform sampler2D batchingColorTexture;
142	vec3 getBatchingColor( const in float i ) {
143		int size = textureSize( batchingColorTexture, 0 ).x;
144		int j = int( i );
145		int x = j % size;
146		int y = j / size;
147		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
148	}
149#endif`,VP=`#ifdef USE_BATCHING
150	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
151#endif`,GP=`vec3 transformed = vec3( position );
152#ifdef USE_ALPHAHASH
153	vPosition = vec3( position );
154#endif`,HP=`vec3 objectNormal = vec3( normal );
155#ifdef USE_TANGENT
156	vec3 objectTangent = vec3( tangent.xyz );
157#endif`,WP=`float G_BlinnPhong_Implicit( ) {
158	return 0.25;
159}
160float D_BlinnPhong( const in float shininess, const in float dotNH ) {
161	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
162}
163vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
164	vec3 halfDir = normalize( lightDir + viewDir );
165	float dotNH = saturate( dot( normal, halfDir ) );
166	float dotVH = saturate( dot( viewDir, halfDir ) );
167	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
168	float G = G_BlinnPhong_Implicit( );
169	float D = D_BlinnPhong( shininess, dotNH );
170	return F * ( G * D );
171} // validated`,jP=`#ifdef USE_IRIDESCENCE
172	const mat3 XYZ_TO_REC709 = mat3(
173		 3.2404542, -0.9692660,  0.0556434,
174		-1.5371385,  1.8760108, -0.2040259,
175		-0.4985314,  0.0415560,  1.0572252
176	);
177	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
178		vec3 sqrtF0 = sqrt( fresnel0 );
179		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
180	}
181	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
182		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
183	}
184	float IorToFresnel0( float transmittedIor, float incidentIor ) {
185		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
186	}
187	vec3 evalSensitivity( float OPD, vec3 shift ) {
188		float phase = 2.0 * PI * OPD * 1.0e-9;
189		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
190		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
191		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
192		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
193		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
194		xyz /= 1.0685e-7;
195		vec3 rgb = XYZ_TO_REC709 * xyz;
196		return rgb;
197	}
198	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
199		vec3 I;
200		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
201		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
202		float cosTheta2Sq = 1.0 - sinTheta2Sq;
203		if ( cosTheta2Sq < 0.0 ) {
204			return vec3( 1.0 );
205		}
206		float cosTheta2 = sqrt( cosTheta2Sq );
207		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
208		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
209		float T121 = 1.0 - R12;
210		float phi12 = 0.0;
211		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
212		float phi21 = PI - phi12;
213		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
214		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
215		vec3 phi23 = vec3( 0.0 );
216		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
217		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
218		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
219		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
220		vec3 phi = vec3( phi21 ) + phi23;
221		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
222		vec3 r123 = sqrt( R123 );
223		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
224		vec3 C0 = R12 + Rs;
225		I = C0;
226		vec3 Cm = Rs - T121;
227		for ( int m = 1; m <= 2; ++ m ) {
228			Cm *= r123;
229			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
230			I += Cm * Sm;
231		}
232		return max( I, vec3( 0.0 ) );
233	}
234#endif`,XP=`#ifdef USE_BUMPMAP
235	uniform sampler2D bumpMap;
236	uniform float bumpScale;
237	vec2 dHdxy_fwd() {
238		vec2 dSTdx = dFdx( vBumpMapUv );
239		vec2 dSTdy = dFdy( vBumpMapUv );
240		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
241		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
242		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
243		return vec2( dBx, dBy );
244	}
245	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
246		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
247		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
248		vec3 vN = surf_norm;
249		vec3 R1 = cross( vSigmaY, vN );
250		vec3 R2 = cross( vN, vSigmaX );
251		float fDet = dot( vSigmaX, R1 ) * faceDirection;
252		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
253		return normalize( abs( fDet ) * surf_norm - vGrad );
254	}
255#endif`,qP=`#if NUM_CLIPPING_PLANES > 0
256	vec4 plane;
257	#ifdef ALPHA_TO_COVERAGE
258		float distanceToPlane, distanceGradient;
259		float clipOpacity = 1.0;
260		#pragma unroll_loop_start
261		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
262			plane = clippingPlanes[ i ];
263			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
264			distanceGradient = fwidth( distanceToPlane ) / 2.0;
265			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
266			if ( clipOpacity == 0.0 ) discard;
267		}
268		#pragma unroll_loop_end
269		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
270			float unionClipOpacity = 1.0;
271			#pragma unroll_loop_start
272			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
273				plane = clippingPlanes[ i ];
274				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
275				distanceGradient = fwidth( distanceToPlane ) / 2.0;
276				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
277			}
278			#pragma unroll_loop_end
279			clipOpacity *= 1.0 - unionClipOpacity;
280		#endif
281		diffuseColor.a *= clipOpacity;
282		if ( diffuseColor.a == 0.0 ) discard;
283	#else
284		#pragma unroll_loop_start
285		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
286			plane = clippingPlanes[ i ];
287			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
288		}
289		#pragma unroll_loop_end
290		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
291			bool clipped = true;
292			#pragma unroll_loop_start
293			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
294				plane = clippingPlanes[ i ];
295				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
296			}
297			#pragma unroll_loop_end
298			if ( clipped ) discard;
299		#endif
300	#endif
301#endif`,YP=`#if NUM_CLIPPING_PLANES > 0
302	varying vec3 vClipPosition;
303	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
304#endif`,$P=`#if NUM_CLIPPING_PLANES > 0
305	varying vec3 vClipPosition;
306#endif`,ZP=`#if NUM_CLIPPING_PLANES > 0
307	vClipPosition = - mvPosition.xyz;
308#endif`,JP=`#if defined( USE_COLOR_ALPHA )
309	diffuseColor *= vColor;
310#elif defined( USE_COLOR )
311	diffuseColor.rgb *= vColor;
312#endif`,KP=`#if defined( USE_COLOR_ALPHA )
313	varying vec4 vColor;
314#elif defined( USE_COLOR )
315	varying vec3 vColor;
316#endif`,QP=`#if defined( USE_COLOR_ALPHA )
317	varying vec4 vColor;
318#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
319	varying vec3 vColor;
320#endif`,eI=`#if defined( USE_COLOR_ALPHA )
321	vColor = vec4( 1.0 );
322#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
323	vColor = vec3( 1.0 );
324#endif
325#ifdef USE_COLOR
326	vColor *= color;
327#endif
328#ifdef USE_INSTANCING_COLOR
329	vColor.xyz *= instanceColor.xyz;
330#endif
331#ifdef USE_BATCHING_COLOR
332	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
333	vColor.xyz *= batchingColor.xyz;
334#endif`,tI=`#define PI 3.141592653589793
335#define PI2 6.283185307179586
336#define PI_HALF 1.5707963267948966
337#define RECIPROCAL_PI 0.3183098861837907
338#define RECIPROCAL_PI2 0.15915494309189535
339#define EPSILON 1e-6
340#ifndef saturate
341#define saturate( a ) clamp( a, 0.0, 1.0 )
342#endif
343#define whiteComplement( a ) ( 1.0 - saturate( a ) )
344float pow2( const in float x ) { return x*x; }
345vec3 pow2( const in vec3 x ) { return x*x; }
346float pow3( const in float x ) { return x*x*x; }
347float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
348float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
349float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
350highp float rand( const in vec2 uv ) {
351	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
352	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
353	return fract( sin( sn ) * c );
354}
355#ifdef HIGH_PRECISION
356	float precisionSafeLength( vec3 v ) { return length( v ); }
357#else
358	float precisionSafeLength( vec3 v ) {
359		float maxComponent = max3( abs( v ) );
360		return length( v / maxComponent ) * maxComponent;
361	}
362#endif
363struct IncidentLight {
364	vec3 color;
365	vec3 direction;
366	bool visible;
367};
368struct ReflectedLight {
369	vec3 directDiffuse;
370	vec3 directSpecular;
371	vec3 indirectDiffuse;
372	vec3 indirectSpecular;
373};
374#ifdef USE_ALPHAHASH
375	varying vec3 vPosition;
376#endif
377vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
378	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
379}
380vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
381	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
382}
383mat3 transposeMat3( const in mat3 m ) {
384	mat3 tmp;
385	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
386	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
387	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
388	return tmp;
389}
390bool isPerspectiveMatrix( mat4 m ) {
391	return m[ 2 ][ 3 ] == - 1.0;
392}
393vec2 equirectUv( in vec3 dir ) {
394	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
395	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
396	return vec2( u, v );
397}
398vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
399	return RECIPROCAL_PI * diffuseColor;
400}
401vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
402	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
403	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
404}
405float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
406	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
407	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
408} // validated`,nI=`#ifdef ENVMAP_TYPE_CUBE_UV
409	#define cubeUV_minMipLevel 4.0
410	#define cubeUV_minTileSize 16.0
411	float getFace( vec3 direction ) {
412		vec3 absDirection = abs( direction );
413		float face = - 1.0;
414		if ( absDirection.x > absDirection.z ) {
415			if ( absDirection.x > absDirection.y )
416				face = direction.x > 0.0 ? 0.0 : 3.0;
417			else
418				face = direction.y > 0.0 ? 1.0 : 4.0;
419		} else {
420			if ( absDirection.z > absDirection.y )
421				face = direction.z > 0.0 ? 2.0 : 5.0;
422			else
423				face = direction.y > 0.0 ? 1.0 : 4.0;
424		}
425		return face;
426	}
427	vec2 getUV( vec3 direction, float face ) {
428		vec2 uv;
429		if ( face == 0.0 ) {
430			uv = vec2( direction.z, direction.y ) / abs( direction.x );
431		} else if ( face == 1.0 ) {
432			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
433		} else if ( face == 2.0 ) {
434			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
435		} else if ( face == 3.0 ) {
436			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
437		} else if ( face == 4.0 ) {
438			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
439		} else {
440			uv = vec2( direction.x, direction.y ) / abs( direction.z );
441		}
442		return 0.5 * ( uv + 1.0 );
443	}
444	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
445		float face = getFace( direction );
446		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
447		mipInt = max( mipInt, cubeUV_minMipLevel );
448		float faceSize = exp2( mipInt );
449		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
450		if ( face > 2.0 ) {
451			uv.y += faceSize;
452			face -= 3.0;
453		}
454		uv.x += face * faceSize;
455		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
456		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
457		uv.x *= CUBEUV_TEXEL_WIDTH;
458		uv.y *= CUBEUV_TEXEL_HEIGHT;
459		#ifdef texture2DGradEXT
460			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
461		#else
462			return texture2D( envMap, uv ).rgb;
463		#endif
464	}
465	#define cubeUV_r0 1.0
466	#define cubeUV_m0 - 2.0
467	#define cubeUV_r1 0.8
468	#define cubeUV_m1 - 1.0
469	#define cubeUV_r4 0.4
470	#define cubeUV_m4 2.0
471	#define cubeUV_r5 0.305
472	#define cubeUV_m5 3.0
473	#define cubeUV_r6 0.21
474	#define cubeUV_m6 4.0
475	float roughnessToMip( float roughness ) {
476		float mip = 0.0;
477		if ( roughness >= cubeUV_r1 ) {
478			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
479		} else if ( roughness >= cubeUV_r4 ) {
480			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
481		} else if ( roughness >= cubeUV_r5 ) {
482			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
483		} else if ( roughness >= cubeUV_r6 ) {
484			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
485		} else {
486			mip = - 2.0 * log2( 1.16 * roughness );		}
487		return mip;
488	}
489	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
490		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
491		float mipF = fract( mip );
492		float mipInt = floor( mip );
493		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
494		if ( mipF == 0.0 ) {
495			return vec4( color0, 1.0 );
496		} else {
497			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
498			return vec4( mix( color0, color1, mipF ), 1.0 );
499		}
500	}
501#endif`,iI=`vec3 transformedNormal = objectNormal;
502#ifdef USE_TANGENT
503	vec3 transformedTangent = objectTangent;
504#endif
505#ifdef USE_BATCHING
506	mat3 bm = mat3( batchingMatrix );
507	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
508	transformedNormal = bm * transformedNormal;
509	#ifdef USE_TANGENT
510		transformedTangent = bm * transformedTangent;
511	#endif
512#endif
513#ifdef USE_INSTANCING
514	mat3 im = mat3( instanceMatrix );
515	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
516	transformedNormal = im * transformedNormal;
517	#ifdef USE_TANGENT
518		transformedTangent = im * transformedTangent;
519	#endif
520#endif
521transformedNormal = normalMatrix * transformedNormal;
522#ifdef FLIP_SIDED
523	transformedNormal = - transformedNormal;
524#endif
525#ifdef USE_TANGENT
526	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
527	#ifdef FLIP_SIDED
528		transformedTangent = - transformedTangent;
529	#endif
530#endif`,rI=`#ifdef USE_DISPLACEMENTMAP
531	uniform sampler2D displacementMap;
532	uniform float displacementScale;
533	uniform float displacementBias;
534#endif`,sI=`#ifdef USE_DISPLACEMENTMAP
535	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
535placementBias );
536#endif`,oI=`#ifdef USE_EMISSIVEMAP
537	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
538	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
539		emissiveColor = sRGBTransferEOTF( emissiveColor );
540	#endif
541	totalEmissiveRadiance *= emissiveColor.rgb;
542#endif`,aI=`#ifdef USE_EMISSIVEMAP
543	uniform sampler2D emissiveMap;
544#endif`,lI="gl_FragColor = linearToOutputTexel( gl_FragColor );",cI=`vec4 LinearTransferOETF( in vec4 value ) {
545	return value;
546}
547vec4 sRGBTransferEOTF( in vec4 value ) {
548	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
549}
550vec4 sRGBTransferOETF( in vec4 value ) {
551	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
552}`,uI=`#ifdef USE_ENVMAP
553	#ifdef ENV_WORLDPOS
554		vec3 cameraToFrag;
555		if ( isOrthographic ) {
556			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
557		} else {
558			cameraToFrag = normalize( vWorldPosition - cameraPosition );
559		}
560		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
561		#ifdef ENVMAP_MODE_REFLECTION
562			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
563		#else
564			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
565		#endif
566	#else
567		vec3 reflectVec = vReflect;
568	#endif
569	#ifdef ENVMAP_TYPE_CUBE
570		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
571	#else
572		vec4 envColor = vec4( 0.0 );
573	#endif
574	#ifdef ENVMAP_BLENDING_MULTIPLY
575		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
576	#elif defined( ENVMAP_BLENDING_MIX )
577		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
578	#elif defined( ENVMAP_BLENDING_ADD )
579		outgoingLight += envColor.xyz * specularStrength * reflectivity;
580	#endif
581#endif`,dI=`#ifdef USE_ENVMAP
582	uniform float envMapIntensity;
583	uniform float flipEnvMap;
584	uniform mat3 envMapRotation;
585	#ifdef ENVMAP_TYPE_CUBE
586		uniform samplerCube envMap;
587	#else
588		uniform sampler2D envMap;
589	#endif
590	
591#endif`,hI=`#ifdef USE_ENVMAP
592	uniform float reflectivity;
593	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
594		#define ENV_WORLDPOS
595	#endif
596	#ifdef ENV_WORLDPOS
597		varying vec3 vWorldPosition;
598		uniform float refractionRatio;
599	#else
600		varying vec3 vReflect;
601	#endif
602#endif`,fI=`#ifdef USE_ENVMAP
603	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
604		#define ENV_WORLDPOS
605	#endif
606	#ifdef ENV_WORLDPOS
607		
608		varying vec3 vWorldPosition;
609	#else
610		varying vec3 vReflect;
611		uniform float refractionRatio;
612	#endif
613#endif`,pI=`#ifdef USE_ENVMAP
614	#ifdef ENV_WORLDPOS
615		vWorldPosition = worldPosition.xyz;
616	#else
617		vec3 cameraToVertex;
618		if ( isOrthographic ) {
619			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
620		} else {
621			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
622		}
623		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
624		#ifdef ENVMAP_MODE_REFLECTION
625			vReflect = reflect( cameraToVertex, worldNormal );
626		#else
627			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
628		#endif
629	#endif
630#endif`,mI=`#ifdef USE_FOG
631	vFogDepth = - mvPosition.z;
632#endif`,gI=`#ifdef USE_FOG
633	varying float vFogDepth;
634#endif`,vI=`#ifdef USE_FOG
635	#ifdef FOG_EXP2
636		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
637	#else
638		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
639	#endif
640	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
641#endif`,yI=`#ifdef USE_FOG
642	uniform vec3 fogColor;
643	varying float vFogDepth;
644	#ifdef FOG_EXP2
645		uniform float fogDensity;
646	#else
647		uniform float fogNear;
648		uniform float fogFar;
649	#endif
650#endif`,_I=`#ifdef USE_GRADIENTMAP
651	uniform sampler2D gradientMap;
652#endif
653vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
654	float dotNL = dot( normal, lightDirection );
655	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
656	#ifdef USE_GRADIENTMAP
657		return vec3( texture2D( gradientMap, coord ).r );
658	#else
659		vec2 fw = fwidth( coord ) * 0.5;
660		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
661	#endif
662}`,xI=`#ifdef USE_LIGHTMAP
663	uniform sampler2D lightMap;
664	uniform float lightMapIntensity;
665#endif`,bI=`LambertMaterial material;
666material.diffuseColor = diffuseColor.rgb;
667material.specularStrength = specularStrength;`,wI=`varying vec3 vViewPosition;
668struct LambertMaterial {
669	vec3 diffuseColor;
670	float specularStrength;
671};
672void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
673	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
674	vec3 irradiance = dotNL * directLight.color;
675	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
676}
677void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
678	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
679}
680#define RE_Direct				RE_Direct_Lambert
681#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,SI=`uniform bool receiveShadow;
682uniform vec3 ambientLightColor;
683#if defined( USE_LIGHT_PROBES )
684	uniform vec3 lightProbe[ 9 ];
685#endif
686vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
687	float x = normal.x, y = normal.y, z = normal.z;
688	vec3 result = shCoefficients[ 0 ] * 0.886227;
689	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
690	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
691	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
692	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
693	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
694	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
695	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
696	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
697	return result;
698}
699vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
700	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
701	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
702	return irradiance;
703}
704vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
705	vec3 irradiance = ambientLightColor;
706	return irradiance;
707}
708float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
709	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
710	if ( cutoffDistance > 0.0 ) {
711		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
712	}
713	return distanceFalloff;
714}
715float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
716	return smoothstep( coneCosine, penumbraCosine, angleCosine );
717}
718#if NUM_DIR_LIGHTS > 0
719	struct DirectionalLight {
720		vec3 direction;
721		vec3 color;
722	};
723	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
724	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
725		light.color = directionalLight.color;
726		light.direction = directionalLight.direction;
727		light.visible = true;
728	}
729#endif
730#if NUM_POINT_LIGHTS > 0
731	struct PointLight {
732		vec3 position;
733		vec3 color;
734		float distance;
735		float decay;
736	};
737	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
738	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
739		vec3 lVector = pointLight.position - geometryPosition;
740		light.direction = normalize( lVector );
741		float lightDistance = length( lVector );
742		light.color = pointLight.color;
743		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
744		light.visible = ( light.color != vec3( 0.0 ) );
745	}
746#endif
747#if NUM_SPOT_LIGHTS > 0
748	struct SpotLight {
749		vec3 position;
750		vec3 direction;
751		vec3 color;
752		float distance;
753		float decay;
754		float coneCos;
755		float penumbraCos;
756	};
757	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
758	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
759		vec3 lVector = spotLight.position - geometryPosition;
760		light.direction = normalize( lVector );
761		float angleCos = dot( light.direction, spotLight.direction );
762		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
763		if ( spotAttenuation > 0.0 ) {
764			float lightDistance = length( lVector );
765			light.color = spotLight.color * spotAttenuation;
766			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
767			light.visible = ( light.color != vec3( 0.0 ) );
768		} else {
769			light.color = vec3( 0.0 );
770			light.visible = false;
771		}
772	}
773#endif
774#if NUM_RECT_AREA_LIGHTS > 0
775	struct RectAreaLight {
776		vec3 color;
777		vec3 position;
778		vec3 halfWidth;
779		vec3 halfHeight;
780	};
781	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
782	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
783#endif
784#if NUM_HEMI_LIGHTS > 0
785	struct HemisphereLight {
786		vec3 direction;
787		vec3 skyColor;
788		vec3 groundColor;
789	};
790	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
791	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
792		float dotNL = dot( normal, hemiLight.direction );
793		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
794		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
795		return irradiance;
796	}
797#endif`,MI=`#ifdef USE_ENVMAP
798	vec3 getIBLIrradiance( const in vec3 normal ) {
799		#ifdef ENVMAP_TYPE_CUBE_UV
800			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
801			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
802			return PI * envMapColor.rgb * envMapIntensity;
803		#else
804			return vec3( 0.0 );
805		#endif
806	}
807	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
808		#ifdef ENVMAP_TYPE_CUBE_UV
809			vec3 reflectVec = reflect( - viewDir, normal );
810			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
811			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
812			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
813			return envMapColor.rgb * envMapIntensity;
814		#else
815			return vec3( 0.0 );
816		#endif
817	}
818	#ifdef USE_ANISOTROPY
819		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
820			#ifdef ENVMAP_TYPE_CUBE_UV
821				vec3 bentNormal = cross( bitangent, viewDir );
822				bentNormal = normalize( cross( bentNormal, bitangent ) );
823				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
824				return getIBLRadiance( viewDir, bentNormal, roughness );
825			#else
826				return vec3( 0.0 );
827			#endif
828		}
829	#endif
830#endif`,EI=`ToonMaterial material;
831material.diffuseColor = diffuseColor.rgb;`,TI=`varying vec3 vViewPosition;
832struct ToonMaterial {
833	vec3 diffuseColor;
834};
835void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
836	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
837	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
838}
839void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
840	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
841}
842#define RE_Direct				RE_Direct_Toon
843#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,AI=`BlinnPhongMaterial material;
844material.diffuseColor = diffuseColor.rgb;
845material.specularColor = specular;
846material.specularShininess = shininess;
847material.specularStrength = specularStrength;`,CI=`varying vec3 vViewPosition;
848struct BlinnPhongMaterial {
849	vec3 diffuseColor;
850	vec3 specularColor;
851	float specularShininess;
852	float specularStrength;
853};
854void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
855	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
856	vec3 irradiance = dotNL * directLight.color;
857	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
858	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
859}
860void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
861	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
862}
863#define RE_Direct				RE_Direct_BlinnPhong
864#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,RI=`PhysicalMaterial material;
865material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
866vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
867float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
868material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
869material.roughness = min( material.roughness, 1.0 );
870#ifdef IOR
871	material.ior = ior;
872	#ifdef USE_SPECULAR
873		float specularIntensityFactor = specularIntensity;
874		vec3 specularColorFactor = specularColor;
875		#ifdef USE_SPECULAR_COLORMAP
876			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
877		#endif
878		#ifdef USE_SPECULAR_INTENSITYMAP
879			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
880		#endif
881		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
882	#else
883		float specularIntensityFactor = 1.0;
884		vec3 specularColorFactor = vec3( 1.0 );
885		material.specularF90 = 1.0;
886	#endif
887	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
888#else
889	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
890	material.specularF90 = 1.0;
891#endif
892#ifdef USE_CLEARCOAT
893	material.clearcoat = clearcoat;
894	material.clearcoatRoughness = clearcoatRoughness;
895	material.clearcoatF0 = vec3( 0.04 );
896	material.clearcoatF90 = 1.0;
897	#ifdef USE_CLEARCOATMAP
898		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
899	#endif
900	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
901		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
902	#endif
903	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
904	material.clearcoatRoughness += geometryRoughness;
905	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
906#endif
907#ifdef USE_DISPERSION
908	material.dispersion = dispersion;
909#endif
910#ifdef USE_IRIDESCENCE
911	material.iridescence = iridescence;
912	material.iridescenceIOR = iridescenceIOR;
913	#ifdef USE_IRIDESCENCEMAP
914		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
915	#endif
916	#ifdef USE_IRIDESCENCE_THICKNESSMAP
917		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
918	#else
919		material.iridescenceThickness = iridescenceThicknessMaximum;
920	#endif
921#endif
922#ifdef USE_SHEEN
923	material.sheenColor = sheenColor;
924	#ifdef USE_SHEEN_COLORMAP
925		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
926	#endif
927	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
928	#ifdef USE_SHEEN_ROUGHNESSMAP
929		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
930	#endif
931#endif
932#ifdef USE_ANISOTROPY
933	#ifdef USE_ANISOTROPYMAP
934		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
935		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
936		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
937	#else
938		vec2 anisotropyV = anisotropyVector;
939	#endif
940	material.anisotropy = length( anisotropyV );
941	if( material.anisotropy == 0.0 ) {
942		anisotropyV = vec2( 1.0, 0.0 );
943	} else {
944		anisotropyV /= material.anisotropy;
945		material.anisotropy = saturate( material.anisotropy );
946	}
947	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
948	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
949	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
950#endif`,P
vendor: 14,688 bytes, lines 950-1251
950I=`struct PhysicalMaterial {
951	vec3 diffuseColor;
952	float roughness;
953	vec3 specularColor;
954	float specularF90;
955	float dispersion;
956	#ifdef USE_CLEARCOAT
957		float clearcoat;
958		float clearcoatRoughness;
959		vec3 clearcoatF0;
960		float clearcoatF90;
961	#endif
962	#ifdef USE_IRIDESCENCE
963		float iridescence;
964		float iridescenceIOR;
965		float iridescenceThickness;
966		vec3 iridescenceFresnel;
967		vec3 iridescenceF0;
968	#endif
969	#ifdef USE_SHEEN
970		vec3 sheenColor;
971		float sheenRoughness;
972	#endif
973	#ifdef IOR
974		float ior;
975	#endif
976	#ifdef USE_TRANSMISSION
977		float transmission;
978		float transmissionAlpha;
979		float thickness;
980		float attenuationDistance;
981		vec3 attenuationColor;
982	#endif
983	#ifdef USE_ANISOTROPY
984		float anisotropy;
985		float alphaT;
986		vec3 anisotropyT;
987		vec3 anisotropyB;
988	#endif
989};
990vec3 clearcoatSpecularDirect = vec3( 0.0 );
991vec3 clearcoatSpecularIndirect = vec3( 0.0 );
992vec3 sheenSpecularDirect = vec3( 0.0 );
993vec3 sheenSpecularIndirect = vec3(0.0 );
994vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
995    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
996    float x2 = x * x;
997    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
998    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
999}
1000float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1001	float a2 = pow2( alpha );
1002	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1003	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1004	return 0.5 / max( gv + gl, EPSILON );
1005}
1006float D_GGX( const in float alpha, const in float dotNH ) {
1007	float a2 = pow2( alpha );
1008	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1009	return RECIPROCAL_PI * a2 / pow2( denom );
1010}
1011#ifdef USE_ANISOTROPY
1012	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
1013		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1014		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1015		float v = 0.5 / ( gv + gl );
1016		return saturate(v);
1017	}
1018	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1019		float a2 = alphaT * alphaB;
1020		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1021		highp float v2 = dot( v, v );
1022		float w2 = a2 / v2;
1023		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1024	}
1025#endif
1026#ifdef USE_CLEARCOAT
1027	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1028		vec3 f0 = material.clearcoatF0;
1029		float f90 = material.clearcoatF90;
1030		float roughness = material.clearcoatRoughness;
1031		float alpha = pow2( roughness );
1032		vec3 halfDir = normalize( lightDir + viewDir );
1033		float dotNL = saturate( dot( normal, lightDir ) );
1034		float dotNV = saturate( dot( normal, viewDir ) );
1035		float dotNH = saturate( dot( normal, halfDir ) );
1036		float dotVH = saturate( dot( viewDir, halfDir ) );
1037		vec3 F = F_Schlick( f0, f90, dotVH );
1038		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1039		float D = D_GGX( alpha, dotNH );
1040		return F * ( V * D );
1041	}
1042#endif
1043vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1044	vec3 f0 = material.specularColor;
1045	float f90 = material.specularF90;
1046	float roughness = material.roughness;
1047	float alpha = pow2( roughness );
1048	vec3 halfDir = normalize( lightDir + viewDir );
1049	float dotNL = saturate( dot( normal, lightDir ) );
1050	float dotNV = saturate( dot( normal, viewDir ) );
1051	float dotNH = saturate( dot( normal, halfDir ) );
1052	float dotVH = saturate( dot( viewDir, halfDir ) );
1053	vec3 F = F_Schlick( f0, f90, dotVH );
1054	#ifdef USE_IRIDESCENCE
1055		F = mix( F, material.iridescenceFresnel, material.iridescence );
1056	#endif
1057	#ifdef USE_ANISOTROPY
1058		float dotTL = dot( material.anisotropyT, lightDir );
1059		float dotTV = dot( material.anisotropyT, viewDir );
1060		float dotTH = dot( material.anisotropyT, halfDir );
1061		float dotBL = dot( material.anisotropyB, lightDir );
1062		float dotBV = dot( material.anisotropyB, viewDir );
1063		float dotBH = dot( material.anisotropyB, halfDir );
1064		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1065		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1066	#else
1067		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1068		float D = D_GGX( alpha, dotNH );
1069	#endif
1070	return F * ( V * D );
1071}
1072vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1073	const float LUT_SIZE = 64.0;
1074	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1075	const float LUT_BIAS = 0.5 / LUT_SIZE;
1076	float dotNV = saturate( dot( N, V ) );
1077	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1078	uv = uv * LUT_SCALE + LUT_BIAS;
1079	return uv;
1080}
1081float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1082	float l = length( f );
1083	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1084}
1085vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1086	float x = dot( v1, v2 );
1087	float y = abs( x );
1088	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1089	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1090	float v = a / b;
1091	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1092	return cross( v1, v2 ) * theta_sintheta;
1093}
1094vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1095	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1096	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1097	vec3 lightNormal = cross( v1, v2 );
1098	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1099	vec3 T1, T2;
1100	T1 = normalize( V - N * dot( V, N ) );
1101	T2 = - cross( N, T1 );
1102	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1103	vec3 coords[ 4 ];
1104	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1105	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1106	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1107	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1108	coords[ 0 ] = normalize( coords[ 0 ] );
1109	coords[ 1 ] = normalize( coords[ 1 ] );
1110	coords[ 2 ] = normalize( coords[ 2 ] );
1111	coords[ 3 ] = normalize( coords[ 3 ] );
1112	vec3 vectorFormFactor = vec3( 0.0 );
1113	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1114	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1115	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1116	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1117	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1118	return vec3( result );
1119}
1120#if defined( USE_SHEEN )
1121float D_Charlie( float roughness, float dotNH ) {
1122	float alpha = pow2( roughness );
1123	float invAlpha = 1.0 / alpha;
1124	float cos2h = dotNH * dotNH;
1125	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1126	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1127}
1128float V_Neubelt( float dotNV, float dotNL ) {
1129	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1130}
1131vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1132	vec3 halfDir = normalize( lightDir + viewDir );
1133	float dotNL = saturate( dot( normal, lightDir ) );
1134	float dotNV = saturate( dot( normal, viewDir ) );
1135	float dotNH = saturate( dot( normal, halfDir ) );
1136	float D = D_Charlie( sheenRoughness, dotNH );
1137	float V = V_Neubelt( dotNV, dotNL );
1138	return sheenColor * ( D * V );
1139}
1140#endif
1141float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1142	float dotNV = saturate( dot( normal, viewDir ) );
1143	float r2 = roughness * roughness;
1144	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1145	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1146	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1147	return saturate( DG * RECIPROCAL_PI );
1148}
1149vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1150	float dotNV = saturate( dot( normal, viewDir ) );
1151	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1152	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1153	vec4 r = roughness * c0 + c1;
1154	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1155	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1156	return fab;
1157}
1158vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1159	vec2 fab = DFGApprox( normal, viewDir, roughness );
1160	return specularColor * fab.x + specularF90 * fab.y;
1161}
1162#ifdef USE_IRIDESCENCE
1163void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1164#else
1165void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1166#endif
1167	vec2 fab = DFGApprox( normal, viewDir, roughness );
1168	#ifdef USE_IRIDESCENCE
1169		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1170	#else
1171		vec3 Fr = specularColor;
1172	#endif
1173	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1174	float Ess = fab.x + fab.y;
1175	float Ems = 1.0 - Ess;
1176	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1177	singleScatter += FssEss;
1178	multiScatter += Fms * Ems;
1179}
1180#if NUM_RECT_AREA_LIGHTS > 0
1181	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1182		vec3 normal = geometryNormal;
1183		vec3 viewDir = geometryViewDir;
1184		vec3 position = geometryPosition;
1185		vec3 lightPos = rectAreaLight.position;
1186		vec3 halfWidth = rectAreaLight.halfWidth;
1187		vec3 halfHeight = rectAreaLight.halfHeight;
1188		vec3 lightColor = rectAreaLight.color;
1189		float roughness = material.roughness;
1190		vec3 rectCoords[ 4 ];
1191		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1192		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1193		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1194		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1195		vec4 t1 = texture2D( ltc_1, uv );
1196		vec4 t2 = texture2D( ltc_2, uv );
1197		mat3 mInv = mat3(
1198			vec3( t1.x, 0, t1.y ),
1199			vec3(    0, 1,    0 ),
1200			vec3( t1.z, 0, t1.w )
1201		);
1202		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1203		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1204		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1205	}
1206#endif
1207void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1208	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1209	vec3 irradiance = dotNL * directLight.color;
1210	#ifdef USE_CLEARCOAT
1211		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1212		vec3 ccIrradiance = dotNLcc * directLight.color;
1213		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1214	#endif
1215	#ifdef USE_SHEEN
1216		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1217	#endif
1218	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1219	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1220}
1221void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1222	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1223}
1224void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1225	#ifdef USE_CLEARCOAT
1226		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1227	#endif
1228	#ifdef USE_SHEEN
1229		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1230	#endif
1231	vec3 singleScattering = vec3( 0.0 );
1232	vec3 multiScattering = vec3( 0.0 );
1233	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1234	#ifdef USE_IRIDESCENCE
1235		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1236	#else
1237		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1238	#endif
1239	vec3 totalScattering = singleScattering + multiScattering;
1240	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1241	reflectedLight.indirectSpecular += radiance * singleScattering;
1242	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1243	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1244}
1245#define RE_Direct				RE_Direct_Physical
1246#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1247#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1248#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1249float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1250	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1251}`,
1251II=`
1252vec3 geometryPosition = - vViewPosition;
1253vec3 geometryNormal = normal;
1254vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1255vec3 geometryClearcoatNormal = vec3( 0.0 );
1256#ifdef USE_CLEARCOAT
1257	geometryClearcoatNormal = clearcoatNormal;
1258#endif
1259#ifdef USE_IRIDESCENCE
1260	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1261	if ( material.iridescenceThickness == 0.0 ) {
1262		material.iridescence = 0.0;
1263	} else {
1264		material.iridescence = saturate( material.iridescence );
1265	}
1266	if ( material.iridescence > 0.0 ) {
1267		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1268		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1269	}
1270#endif
1271IncidentLight directLight;
1272#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1273	PointLight pointLight;
1274	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1275	PointLightShadow pointLightShadow;
1276	#endif
1277	#pragma unroll_loop_start
1278	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1279		pointLight = pointLights[ i ];
1280		getPointLightInfo( pointLight, geometryPosition, directLight );
1281		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1282		pointLightShadow = pointLightShadows[ i ];
1283		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1284		#endif
1285		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1286	}
1287	#pragma unroll_loop_end
1288#endif
1289#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1290	SpotLight spotLight;
1291	vec4 spotColor;
1292	vec3 spotLightCoord;
1293	bool inSpotLightMap;
1294	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1295	SpotLightShadow spotLightShadow;
1296	#endif
1297	#pragma unroll_loop_start
1298	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1299		spotLight = spotLights[ i ];
1300		getSpotLightInfo( spotLight, geometryPosition, directLight );
1301		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1302		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1303		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1304		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1305		#else
1306		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1307		#endif
1308		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1309			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1310			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1311			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1312			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1313		#endif
1314		#undef SPOT_LIGHT_MAP_INDEX
1315		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1316		spotLightShadow = spotLightShadows[ i ];
1317		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1318		#endif
1319		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1320	}
1321	#pragma unroll_loop_end
1322#endif
1323#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1324	DirectionalLight directionalLight;
1325	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1326	DirectionalLightShadow directionalLightShadow;
1327	#endif
1328	#pragma unroll_loop_start
1329	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1330		directionalLight = directionalLights[ i ];
1331		getDirectionalLightInfo( directionalLight, directLight );
1332		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1333		directionalLightShadow = directionalLightShadows[ i ];
1334		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1335		#endif
1336		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1337	}
1338	#pragma unroll_loop_end
1339#endif
1340#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1341	RectAreaLight rectAreaLight;
1342	#pragma unroll_loop_start
1343	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1344		rectAreaLight = rectAreaLights[ i ];
1345		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1346	}
1347	#pragma unroll_loop_end
1348#endif
1349#if defined( RE_IndirectDiffuse )
1350	vec3 iblIrradiance = vec3( 0.0 );
1351	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1352	#if defined( USE_LIGHT_PROBES )
1353		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1354	#endif
1355	#if ( NUM_HEMI_LIGHTS > 0 )
1356		#pragma unroll_loop_start
1357		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1358			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1359		}
1360		#pragma unroll_loop_end
1361	#endif
1362#endif
1363#if defined( RE_IndirectSpecular )
1364	vec3 radiance = vec3( 0.0 );
1365	vec3 clearcoatRadiance = vec3( 0.0 );
1366#endif`,DI=`#if defined( RE_IndirectDiffuse )
1367	#ifdef USE_LIGHTMAP
1368		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1369		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1370		irradiance += lightMapIrradiance;
1371	#endif
1372	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1373		iblIrradiance += getIBLIrradiance( geometryNormal );
1374	#endif
1375#endif
1376#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1377	#ifdef USE_ANISOTROPY
1378		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1379	#else
1380		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1381	#endif
1382	#ifdef USE_CLEARCOAT
1383		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1384	#endif
1385#endif`,LI=`#if defined( RE_IndirectDiffuse )
1386	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1387#endif
1388#if defined( RE_IndirectSpecular )
1389	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1390#endif`,kI=`#if defined( USE_LOGDEPTHBUF )
1391	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1392#endif`,UI=`#if defined( USE_LOGDEPTHBUF )
1393	uniform float logDepthBufFC;
1394	varying float vFragDepth;
1395	varying float vIsPerspective;
1396#endif`,NI=`#ifdef USE_LOGDEPTHBUF
1397	varying float vFragDepth;
1398	varying float vIsPerspective;
1399#endif`,OI=`#ifdef USE_LOGDEPTHBUF
1400	vFragDepth = 1.0 + gl_Position.w;
1401	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1402#endif`,FI=`#ifdef USE_MAP
1403	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1404	#ifdef DECODE_VIDEO_TEXTURE
1405		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1406	#endif
1407	diffuseColor *= sampledDiffuseColor;
1408#endif`,BI=`#ifdef USE_MAP
1409	uniform sampler2D map;
1410#endif`,zI=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1411	#if defined( USE_POINTS_UV )
1412		vec2 uv = vUv;
1413	#else
1414		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1415	#endif
1416#endif
1417#ifdef USE_MAP
1418	diffuseColor *= texture2D( map, uv );
1419#endif
1420#ifdef USE_ALPHAMAP
1421	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1422#endif`,VI=`#if defined( USE_POINTS_UV )
1423	varying vec2 vUv;
1424#else
1425	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1426		uniform mat3 uvTransform;
1427	#endif
1428#endif
1429#ifdef USE_MAP
1430	uniform sampler2D map;
1431#endif
1432#ifdef USE_ALPHAMAP
1433	uniform sampler2D alphaMap;
1434#endif`,GI=`float metalnessFactor = metalness;
1435#ifdef USE_METALNESSMAP
1436	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1437	metalnessFactor *= texelMetalness.b;
1438#endif`,HI=`#ifdef USE_METALNESSMAP
1439	uniform sampler2D metalnessMap;
1440#endif`,WI=`#ifdef USE_INSTANCING_MORPH
1441	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1442	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1443	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1444		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1445	}
1446#endif`,jI=`#if defined( USE_MORPHCOLORS )
1447	vColor *= morphTargetBaseInfluence;
1448	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1449		#if defined( USE_COLOR_ALPHA )
1450			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1451		#elif defined( USE_COLOR )
1452			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1453		#endif
1454	}
1455#endif`,XI=`#ifdef USE_MORPHNORMALS
1456	objectNormal *= morphTargetBaseInfluence;
1457	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1458		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1459	}
1460#endif`,qI=`#ifdef USE_MORPHTARGETS
1461	#ifndef USE_INSTANCING_MORPH
1462		uniform float morphTargetBaseInfluence;
1463		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1464	#endif
1465	uniform sampler2DArray morphTargetsTexture;
1466	uniform ivec2 morphTargetsTextureSize;
1467	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1468		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1469		int y = texelIndex / morphTargetsTextureSize.x;
1470		int x = texelIndex - y * morphTargetsTextureSize.x;
1471		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1472		return texelFetch( morphTargetsTexture, morphUV, 0 );
1473	}
1474#endif`,YI=`#ifdef USE_MORPHTARGETS
1475	transformed *= morphTargetBaseInfluence;
1476	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1477		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1478	}
1479#endif`,$I=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1480#ifdef FLAT_SHADED
1481	vec3 fdx = dFdx( vViewPosition );
1482	vec3 fdy = dFdy( vViewPosition );
1483	vec3 normal = normalize( cross( fdx, fdy ) );
1484#else
1485	vec3 normal = normalize( vNormal );
1486	#ifdef DOUBLE_SIDED
1487		normal *= faceDirection;
1488	#endif
1489#endif
1490#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1491	#ifdef USE_TANGENT
1492		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1493	#else
1494		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1495		#if defined( USE_NORMALMAP )
1496			vNormalMapUv
1497		#elif defined( USE_CLEARCOAT_NORMALMAP )
1498			vClearcoatNormalMapUv
1499		#else
1500			vUv
1501		#endif
1502		);
1503	#endif
1504	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1505		tbn[0] *= faceDirection;
1506		tbn[1] *= faceDirection;
1507	#endif
1508#endif
1509#ifdef USE_CLEARCOAT_NORMALMAP
1510	#ifdef USE_TANGENT
1511		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1512	#else
1513		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1514	#endif
1515	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1516		tbn2[0] *= faceDirection;
1517		tbn2[1] *= faceDirection;
1518	#endif
1519#endif
1520vec3 nonPerturbedNormal = normal;`,ZI=`#ifdef USE_NORMALMAP_OBJECTSPACE
1521	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1522	#ifdef FLIP_SIDED
1523		normal = - normal;
1524	#endif
1525	#ifdef DOUBLE_SIDED
1526		normal = normal * faceDirection;
1527	#endif
1528	normal = normalize( normalMatrix * normal );
1529#elif defined( USE_NORMALMAP_TANGENTSPACE )
1530	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1531	mapN.xy *= normalScale;
1532	normal = normalize( tbn * mapN );
1533#elif defined( USE_BUMPMAP )
1534	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1535#endif`,JI=`#ifndef FLAT_SHADED
1536	varying vec3 vNormal;
1537	#ifdef USE_TANGENT
1538		varying vec3 vTangent;
1539		varying vec3 vBitangent;
1540	#endif
1541#endif`,KI=`#ifndef FLAT_SHADED
1542	varying vec3 vNormal;
1543	#ifdef USE_TANGENT
1544		varying vec3 vTangent;
1545		varying vec3 vBitangent;
1546	#endif
1547#endif`,QI=`#ifndef FLAT_SHADED
1548	vNormal = normalize( transformedNormal );
1549	#ifdef USE_TANGENT
1550		vTangent = normalize( transformedTangent );
1551		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1552	#endif
1553#endif`,e3=`#ifdef USE_NORMALMAP
1554	uniform sampler2D normalMap;
1555	uniform vec2 normalScale;
1556#endif
1557#ifdef USE_NORMALMAP_OBJECTSPACE
1558	uniform mat3 normalMatrix;
1559#endif
1560#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1561	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1562		vec3 q0 = dFdx( eye_pos.xyz );
1563		vec3 q1 = dFdy( eye_pos.xyz );
1564		vec2 st0 = dFdx( uv.st );
1565		vec2 st1 = dFdy( uv.st );
1566		vec3 N = surf_norm;
1567		vec3 q1perp = cross( q1, N );
1568		vec3 q0perp = cross( N, q0 );
1569		vec3 T = q1perp * st0.x + q0perp * st1.x;
1570		vec3 B = q1perp * st0.y + q0perp * st1.y;
1571		float det = max( dot( T, T ), dot( B, B ) );
1572		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1573		return mat3( T * scale, B * scale, N );
1574	}
1575#endif`,t3=`#ifdef USE_CLEARCOAT
1576	vec3 clearcoatNormal = nonPerturbedNormal;
1577#endif`,n3=`#ifdef USE_CLEARCOAT_NORMALMAP
1578	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1579	clearcoatMapN.xy *= clearcoatNormalScale;
1580	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1581#endif`,i3=`#ifdef USE_CLEARCOATMAP
1582	uniform sampler2D clearcoatMap;
1583#endif
1584#ifdef USE_CLEARCOAT_NORMALMAP
1585	uniform sampler2D clearcoatNormalMap;
1586	uniform vec2 clearcoatNormalScale;
1587#endif
1588#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1589	uniform sampler2D clearcoatRoughnessMap;
1590#endif`,r3=`#ifdef USE_IRIDESCENCEMAP
1591	uniform sampler2D iridescenceMap;
1592#endif
1593#ifdef USE_IRIDESCENCE_THICKNESSMAP
1594	uniform sampler2D iridescenceThicknessMap;
1595#endif`,s3=`#ifdef OPAQUE
1596diffuseColor.a = 1.0;
1597#endif
1598#ifdef USE_TRANSMISSION
1599diffuseColor.a *= material.transmissionAlpha;
1600#endif
1601gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,o3=`vec3 packNormalToRGB( const in vec3 normal ) {
1602	return normalize( normal ) * 0.5 + 0.5;
1603}
1604vec3 unpackRGBToNormal( const in vec3 rgb ) {
1605	return 2.0 * rgb.xyz - 1.0;
1606}
1607const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1608const float Inv255 = 1. / 255.;
1609const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1610const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1611const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1612const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1613vec4 packDepthToRGBA( const in float v ) {
1614	if( v <= 0.0 )
1615		return vec4( 0., 0., 0., 0. );
1616	if( v >= 1.0 )
1617		return vec4( 1., 1., 1., 1. );
1618	float vuf;
1619	float af = modf( v * PackFactors.a, vuf );
1620	float bf = modf( vuf * ShiftRight8, vuf );
1621	float gf = modf( vuf * ShiftRight8, vuf );
1622	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1623}
1624vec3 packDepthToRGB( const in float v ) {
1625	if( v <= 0.0 )
1626		return vec3( 0., 0., 0. );
1627	if( v >= 1.0 )
1628		return vec3( 1., 1., 1. );
1629	float vuf;
1630	float bf = modf( v * PackFactors.b, vuf );
1631	float gf = modf( vuf * ShiftRight8, vuf );
1632	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1633}
1634vec2 packDepthToRG( const in float v ) {
1635	if( v <= 0.0 )
1636		return vec2( 0., 0. );
1637	if( v >= 1.0 )
1638		return vec2( 1., 1. );
1639	float vuf;
1640	float gf = modf( v * 256., vuf );
1641	return vec2( vuf * Inv255, gf );
1642}
1643float unpackRGBAToDepth( const in vec4 v ) {
1644	return dot( v, UnpackFactors4 );
1645}
1646float unpackRGBToDepth( const in vec3 v ) {
1647	return dot( v, UnpackFactors3 );
1648}
1649float unpackRGToDepth( const in vec2 v ) {
1650	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1651}
1652vec4 pack2HalfToRGBA( const in vec2 v ) {
1653	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1654	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1655}
1656vec2 unpackRGBATo2Half( const in vec4 v ) {
1657	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1658}
1659float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1660	return ( viewZ + near ) / ( near - far );
1661}
1662float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1663	return depth * ( near - far ) - near;
1664}
1665float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1666	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1667}
1668float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1669	return ( near * far ) / ( ( far - near ) * depth - far );
1670}`,a3=`#ifdef PREMULTIPLIED_ALPHA
1671	gl_FragColor.rgb *= gl_FragColor.a;
1672#endif`,l3=`vec4 mvPosition = vec4( transformed, 1.0 );
1673#ifdef USE_BATCHING
1674	mvPosition = batchingMatrix * mvPosition;
1675#endif
1676#ifdef USE_INSTANCING
1677	mvPosition = instanceMatrix * mvPosition;
1678#endif
1679mvPosition = modelViewMatrix * mvPosition;
1680gl_Position = projectionMatrix * mvPosition;`,c3=`#ifdef DITHERING
1681	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1682#endif`,u3=`#ifdef DITHERING
1683	vec3 dithering( vec3 color ) {
1684		float grid_position = rand( gl_FragCoord.xy );
1685		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1686		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1687		return color + dither_shift_RGB;
1688	}
1689#endif`,d3=`float roughnessFactor = roughness;
1690#ifdef USE_ROUGHNESSMAP
1691	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1692	roughnessFactor *= texelRoughness.g;
1693#endif`,h3=`#ifdef USE_ROUGHNESSMAP
1694	uniform sampler2D roughnessMap;
1695#endif`,f3=
vendor: 8,887 bytes, lines 1695-1881
1695`#if NUM_SPOT_LIGHT_COORDS > 0
1696	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1697#endif
1698#if NUM_SPOT_LIGHT_MAPS > 0
1699	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1700#endif
1701#ifdef USE_SHADOWMAP
1702	#if NUM_DIR_LIGHT_SHADOWS > 0
1703		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1704		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1705		struct DirectionalLightShadow {
1706			float shadowIntensity;
1707			float shadowBias;
1708			float shadowNormalBias;
1709			float shadowRadius;
1710			vec2 shadowMapSize;
1711		};
1712		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1713	#endif
1714	#if NUM_SPOT_LIGHT_SHADOWS > 0
1715		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1716		struct SpotLightShadow {
1717			float shadowIntensity;
1718			float shadowBias;
1719			float shadowNormalBias;
1720			float shadowRadius;
1721			vec2 shadowMapSize;
1722		};
1723		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1724	#endif
1725	#if NUM_POINT_LIGHT_SHADOWS > 0
1726		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1727		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1728		struct PointLightShadow {
1729			float shadowIntensity;
1730			float shadowBias;
1731			float shadowNormalBias;
1732			float shadowRadius;
1733			vec2 shadowMapSize;
1734			float shadowCameraNear;
1735			float shadowCameraFar;
1736		};
1737		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1738	#endif
1739	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1740		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1741	}
1742	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1743		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1744	}
1745	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1746		float occlusion = 1.0;
1747		vec2 distribution = texture2DDistribution( shadow, uv );
1748		float hard_shadow = step( compare , distribution.x );
1749		if (hard_shadow != 1.0 ) {
1750			float distance = compare - distribution.x ;
1751			float variance = max( 0.00000, distribution.y * distribution.y );
1752			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
1753		}
1754		return occlusion;
1755	}
1756	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1757		float shadow = 1.0;
1758		shadowCoord.xyz /= shadowCoord.w;
1759		shadowCoord.z += shadowBias;
1760		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1761		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1762		if ( frustumTest ) {
1763		#if defined( SHADOWMAP_TYPE_PCF )
1764			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1765			float dx0 = - texelSize.x * shadowRadius;
1766			float dy0 = - texelSize.y * shadowRadius;
1767			float dx1 = + texelSize.x * shadowRadius;
1768			float dy1 = + texelSize.y * shadowRadius;
1769			float dx2 = dx0 / 2.0;
1770			float dy2 = dy0 / 2.0;
1771			float dx3 = dx1 / 2.0;
1772			float dy3 = dy1 / 2.0;
1773			shadow = (
1774				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1775				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1776				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1777				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1778				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1779				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1780				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1781				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1782				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1783				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1784				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1785				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1786				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1787				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1788				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1789				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1790				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1791			) * ( 1.0 / 17.0 );
1792		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1793			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1794			float dx = texelSize.x;
1795			float dy = texelSize.y;
1796			vec2 uv = shadowCoord.xy;
1797			vec2 f = fract( uv * shadowMapSize + 0.5 );
1798			uv -= f * texelSize;
1799			shadow = (
1800				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1801				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1802				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1803				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1804				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1805					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1806					 f.x ) +
1807				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1808					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1809					 f.x ) +
1810				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1811					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1812					 f.y ) +
1813				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1814					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1815					 f.y ) +
1816				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1817						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1818						  f.x ),
1819					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1820						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1821						  f.x ),
1822					 f.y )
1823			) * ( 1.0 / 9.0 );
1824		#elif defined( SHADOWMAP_TYPE_VSM )
1825			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1826		#else
1827			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1828		#endif
1829		}
1830		return mix( 1.0, shadow, shadowIntensity );
1831	}
1832	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1833		vec3 absV = abs( v );
1834		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1835		absV *= scaleToCube;
1836		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1837		vec2 planar = v.xy;
1838		float almostATexel = 1.5 * texelSizeY;
1839		float almostOne = 1.0 - almostATexel;
1840		if ( absV.z >= almostOne ) {
1841			if ( v.z > 0.0 )
1842				planar.x = 4.0 - v.x;
1843		} else if ( absV.x >= almostOne ) {
1844			float signX = sign( v.x );
1845			planar.x = v.z * signX + 2.0 * signX;
1846		} else if ( absV.y >= almostOne ) {
1847			float signY = sign( v.y );
1848			planar.x = v.x + 2.0 * signY + 2.0;
1849			planar.y = v.z * signY - 2.0;
1850		}
1851		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1852	}
1853	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1854		float shadow = 1.0;
1855		vec3 lightToPosition = shadowCoord.xyz;
1856		
1857		float lightToPositionLength = length( lightToPosition );
1858		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
1859			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
1860			vec3 bd3D = normalize( lightToPosition );
1861			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1862			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1863				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1864				shadow = (
1865					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1866					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1867					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1868					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1869					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1870					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1871					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1872					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1873					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1874				) * ( 1.0 / 9.0 );
1875			#else
1876				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1877			#endif
1878		}
1879		return mix( 1.0, shadow, shadowIntensity );
1880	}
1881#endif`,
1881p3=`#if NUM_SPOT_LIGHT_COORDS > 0
1882	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1883	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1884#endif
1885#ifdef USE_SHADOWMAP
1886	#if NUM_DIR_LIGHT_SHADOWS > 0
1887		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1888		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1889		struct DirectionalLightShadow {
1890			float shadowIntensity;
1891			float shadowBias;
1892			float shadowNormalBias;
1893			float shadowRadius;
1894			vec2 shadowMapSize;
1895		};
1896		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1897	#endif
1898	#if NUM_SPOT_LIGHT_SHADOWS > 0
1899		struct SpotLightShadow {
1900			float shadowIntensity;
1901			float shadowBias;
1902			float shadowNormalBias;
1903			float shadowRadius;
1904			vec2 shadowMapSize;
1905		};
1906		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1907	#endif
1908	#if NUM_POINT_LIGHT_SHADOWS > 0
1909		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1910		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1911		struct PointLightShadow {
1912			float shadowIntensity;
1913			float shadowBias;
1914			float shadowNormalBias;
1915			float shadowRadius;
1916			vec2 shadowMapSize;
1917			float shadowCameraNear;
1918			float shadowCameraFar;
1919		};
1920		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1921	#endif
1922#endif`,m3=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1923	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1924	vec4 shadowWorldPosition;
1925#endif
1926#if defined( USE_SHADOWMAP )
1927	#if NUM_DIR_LIGHT_SHADOWS > 0
1928		#pragma unroll_loop_start
1929		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1930			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1931			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1932		}
1933		#pragma unroll_loop_end
1934	#endif
1935	#if NUM_POINT_LIGHT_SHADOWS > 0
1936		#pragma unroll_loop_start
1937		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1938			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1939			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1940		}
1941		#pragma unroll_loop_end
1942	#endif
1943#endif
1944#if NUM_SPOT_LIGHT_COORDS > 0
1945	#pragma unroll_loop_start
1946	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1947		shadowWorldPosition = worldPosition;
1948		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1949			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1950		#endif
1951		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1952	}
1953	#pragma unroll_loop_end
1954#endif`,g3=`float getShadowMask() {
1955	float shadow = 1.0;
1956	#ifdef USE_SHADOWMAP
1957	#if NUM_DIR_LIGHT_SHADOWS > 0
1958	DirectionalLightShadow directionalLight;
1959	#pragma unroll_loop_start
1960	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1961		directionalLight = directionalLightShadows[ i ];
1962		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1963	}
1964	#pragma unroll_loop_end
1965	#endif
1966	#if NUM_SPOT_LIGHT_SHADOWS > 0
1967	SpotLightShadow spotLight;
1968	#pragma unroll_loop_start
1969	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1970		spotLight = spotLightShadows[ i ];
1971		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1972	}
1973	#pragma unroll_loop_end
1974	#endif
1975	#if NUM_POINT_LIGHT_SHADOWS > 0
1976	PointLightShadow pointLight;
1977	#pragma unroll_loop_start
1978	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1979		pointLight = pointLightShadows[ i ];
1980		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1981	}
1982	#pragma unroll_loop_end
1983	#endif
1984	#endif
1985	return shadow;
1986}`,v3=`#ifdef USE_SKINNING
1987	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1988	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1989	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1990	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1991#endif`,y3=`#ifdef USE_SKINNING
1992	uniform mat4 bindMatrix;
1993	uniform mat4 bindMatrixInverse;
1994	uniform highp sampler2D boneTexture;
1995	mat4 getBoneMatrix( const in float i ) {
1996		int size = textureSize( boneTexture, 0 ).x;
1997		int j = int( i ) * 4;
1998		int x = j % size;
1999		int y = j / size;
2000		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2001		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2002		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2003		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2004		return mat4( v1, v2, v3, v4 );
2005	}
2006#endif`,_3=`#ifdef USE_SKINNING
2007	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2008	vec4 skinned = vec4( 0.0 );
2009	skinned += boneMatX * skinVertex * skinWeight.x;
2010	skinned += boneMatY * skinVertex * skinWeight.y;
2011	skinned += boneMatZ * skinVertex * skinWeight.z;
2012	skinned += boneMatW * skinVertex * skinWeight.w;
2013	transformed = ( bindMatrixInverse * skinned ).xyz;
2014#endif`,x3=`#ifdef USE_SKINNING
2015	mat4 skinMatrix = mat4( 0.0 );
2016	skinMatrix += skinWeight.x * boneMatX;
2017	skinMatrix += skinWeight.y * boneMatY;
2018	skinMatrix += skinWeight.z * boneMatZ;
2019	skinMatrix += skinWeight.w * boneMatW;
2020	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2021	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2022	#ifdef USE_TANGENT
2023		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2024	#endif
2025#endif`,b3=`float specularStrength;
2026#ifdef USE_SPECULARMAP
2027	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2028	specularStrength = texelSpecular.r;
2029#else
2030	specularStrength = 1.0;
2031#endif`,w3=`#ifdef USE_SPECULARMAP
2032	uniform sampler2D specularMap;
2033#endif`,S3=`#if defined( TONE_MAPPING )
2034	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2035#endif`,M3=`#ifndef saturate
2036#define saturate( a ) clamp( a, 0.0, 1.0 )
2037#endif
2038uniform float toneMappingExposure;
2039vec3 LinearToneMapping( vec3 color ) {
2040	return saturate( toneMappingExposure * color );
2041}
2042vec3 ReinhardToneMapping( vec3 color ) {
2043	color *= toneMappingExposure;
2044	return saturate( color / ( vec3( 1.0 ) + color ) );
2045}
2046vec3 CineonToneMapping( vec3 color ) {
2047	color *= toneMappingExposure;
2048	color = max( vec3( 0.0 ), color - 0.004 );
2049	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2050}
2051vec3 RRTAndODTFit( vec3 v ) {
2052	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2053	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2054	return a / b;
2055}
2056vec3 ACESFilmicToneMapping( vec3 color ) {
2057	const mat3 ACESInputMat = mat3(
2058		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2059		vec3( 0.04823, 0.01566, 0.83777 )
2060	);
2061	const mat3 ACESOutputMat = mat3(
2062		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2063		vec3( -0.07367, -0.00605,  1.07602 )
2064	);
2065	color *= toneMappingExposure / 0.6;
2066	color = ACESInputMat * color;
2067	color = RRTAndODTFit( color );
2068	color = ACESOutputMat * color;
2069	return saturate( color );
2070}
2071const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2072	vec3( 1.6605, - 0.1246, - 0.0182 ),
2073	vec3( - 0.5876, 1.1329, - 0.1006 ),
2074	vec3( - 0.0728, - 0.0083, 1.1187 )
2075);
2076const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2077	vec3( 0.6274, 0.0691, 0.0164 ),
2078	vec3( 0.3293, 0.9195, 0.0880 ),
2079	vec3( 0.0433, 0.0113, 0.8956 )
2080);
2081vec3 agxDefaultContrastApprox( vec3 x ) {
2082	vec3 x2 = x * x;
2083	vec3 x4 = x2 * x2;
2084	return + 15.5 * x4 * x2
2085		- 40.14 * x4 * x
2086		+ 31.96 * x4
2087		- 6.868 * x2 * x
2088		+ 0.4298 * x2
2089		+ 0.1191 * x
2090		- 0.00232;
2091}
2092vec3 AgXToneMapping( vec3 color ) {
2093	const mat3 AgXInsetMatrix = mat3(
2094		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2095		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2096		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2097	);
2098	const mat3 AgXOutsetMatrix = mat3(
2099		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2100		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2101		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2102	);
2103	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2104	color *= toneMappingExposure;
2105	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2106	color = AgXInsetMatrix * color;
2107	color = max( color, 1e-10 );	color = log2( color );
2108	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2109	color = clamp( color, 0.0, 1.0 );
2110	color = agxDefaultContrastApprox( color );
2111	color = AgXOutsetMatrix * color;
2112	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2113	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2114	color = clamp( color, 0.0, 1.0 );
2115	return color;
2116}
2117vec3 NeutralToneMapping( vec3 color ) {
2118	const float StartCompression = 0.8 - 0.04;
2119	const float Desaturation = 0.15;
2120	color *= toneMappingExposure;
2121	float x = min( color.r, min( color.g, color.b ) );
2122	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2123	color -= offset;
2124	float peak = max( color.r, max( color.g, color.b ) );
2125	if ( peak < StartCompression ) return color;
2126	float d = 1. - StartCompression;
2127	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2128	color *= newPeak / peak;
2129	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2130	return mix( color, vec3( newPeak ), g );
2131}
2132vec3 CustomToneMapping( vec3 color ) { return color; }`,E3=`#ifdef USE_TRANSMISSION
2133	material.transmission = transmission;
2134	material.transmissionAlpha = 1.0;
2135	material.thickness = thickness;
2136	material.attenuationDistance = attenuationDistance;
2137	material.attenuationColor = attenuationColor;
2138	#ifdef USE_TRANSMISSIONMAP
2139		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2140	#endif
2141	#ifdef USE_THICKNESSMAP
2142		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2143	#endif
2144	vec3 pos = vWorldPosition;
2145	vec3 v = normalize( cameraPosition - pos );
2146	vec3 n = inverseTransformDirection( normal, viewMatrix );
2147	vec4 transmitted = getIBLVolumeRefraction(
2148		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2149		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2150		material.attenuationColor, material.attenuationDistance );
2151	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2152	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2153#endif`,T3=`#ifdef USE_TRANSMISSION
2154	uniform float transmission;
2155	uniform float thickness;
2156	uniform float attenuationDistance;
2157	uniform vec3 attenuationColor;
2158	#ifdef USE_TRANSMISSIONMAP
2159		uniform sampler2D transmissionMap;
2160	#endif
2161	#ifdef USE_THICKNESSMAP
2162		uniform sampler2D thicknessMap;
2163	#endif
2164	uniform vec2 transmissionSamplerSize;
2165	uniform sampler2D transmissionSamplerMap;
2166	uniform mat4 modelMatrix;
2167	uniform mat4 projectionMatrix;
2168	varying vec3 vWorldPosition;
2169	float w0( float a ) {
2170		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2171	}
2172	float w1( float a ) {
2173		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2174	}
2175	float w2( float a ){
2176		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2177	}
2178	float w3( float a ) {
2179		return ( 1.0 / 6.0 ) * ( a * a * a );
2180	}
2181	float g0( float a ) {
2182		return w0( a ) + w1( a );
2183	}
2184	float g1( float a ) {
2185		return w2( a ) + w3( a );
2186	}
2187	float h0( float a ) {
2188		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2189	}
2190	float h1( float a ) {
2191		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2192	}
2193	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2194		uv = uv * texelSize.zw + 0.5;
2195		vec2 iuv = floor( uv );
2196		vec2 fuv = fract( uv );
2197		float g0x = g0( fuv.x );
2198		float g1x = g1( fuv.x );
2199		float h0x = h0( fuv.x );
2200		float h1x = h1( fuv.x );
2201		float h0y = h0( fuv.y );
2202		float h1y = h1( fuv.y );
2203		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2204		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2205		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2206		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2207		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2208			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2209	}
2210	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2211		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2212		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2213		vec2 fLodSizeInv = 1.0 / fLodSize;
2214		vec2 cLodSizeInv = 1.0 / cLodSize;
2215		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2216		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2217		return mix( fSample, cSample, fract( lod ) );
2218	}
2219	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2220		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2221		vec3 modelScale;
2222		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2223		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2224		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2225		return normalize( refractionVector ) * thickness * modelScale;
2226	}
2227	float applyIorToRoughness( const in float roughness, const in float ior ) {
2228		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2229	}
2230	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2231		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2232		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2233	}
2234	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2235		if ( isinf( attenuationDistance ) ) {
2236			return vec3( 1.0 );
2237		} else {
2238			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2239			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2240		}
2241	}
2242	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2243		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2244		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2245		const in vec3 attenuationColor, const in float attenuationDistance ) {
2246		vec4 transmittedLight;
2247		vec3 transmittance;
2248		#ifdef USE_DISPERSION
2249			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2250			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2251			for ( int i = 0; i < 3; i ++ ) {
2252				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2253				vec3 refractedRayExit = position + transmissionRay;
2254				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2255				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2256				refractionCoords += 1.0;
2257				refractionCoords /= 2.0;
2258				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2259				transmittedLight[ i ] = transmissionSample[ i ];
2260				transmittedLight.a += transmissionSample.a;
2261				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2262			}
2263			transmittedLight.a /= 3.0;
2264		#else
2265			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2266			vec3 refractedRayExit = position + transmissionRay;
2267			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2268			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2269			refractionCoords += 1.0;
2270			refractionCoords /= 2.0;
2271			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2272			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2273		#endif
2274		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2275		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2276		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2277		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2278	}
2279#endif`,A3=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2280	varying vec2 vUv;
2281#endif
2282#ifdef USE_MAP
2283	varying vec2 vMapUv;
2284#endif
2285#ifdef USE_ALPHAMAP
2286	varying vec2 vAlphaMapUv;
2287#endif
2288#ifdef USE_LIGHTMAP
2289	varying vec2 vLightMapUv;
2290#endif
2291#ifdef USE_AOMAP
2292	varying vec2 vAoMapUv;
2293#endif
2294#ifdef USE_BUMPMAP
2295	varying vec2 vBumpMapUv;
2296#endif
2297#ifdef USE_NORMALMAP
2298	varying vec2 vNormalMapUv;
2299#endif
2300#ifdef USE_EMISSIVEMAP
2301	varying vec2 vEmissiveMapUv;
2302#endif
2303#ifdef USE_METALNESSMAP
2304	varying vec2 vMetalnessMapUv;
2305#endif
2306#ifdef USE_ROUGHNESSMAP
2307	varying vec2 vRoughnessMapUv;
2308#endif
2309#ifdef USE_ANISOTROPYMAP
2310	varying vec2 vAnisotropyMapUv;
2311#endif
2312#ifdef USE_CLEARCOATMAP
2313	varying vec2 vClearcoatMapUv;
2314#endif
2315#ifdef USE_CLEARCOAT_NORMALMAP
2316	varying vec2 vClearcoatNormalMapUv;
2317#endif
2318#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2319	varying vec2 vClearcoatRoughnessMapUv;
2320#endif
2321#ifdef USE_IRIDESCENCEMAP
2322	varying vec2 vIridescenceMapUv;
2323#endif
2324#ifdef USE_IRIDESCENCE_THICKNESSMAP
2325	varying vec2 vIridescenceThicknessMapUv;
2326#endif
2327#ifdef USE_SHEEN_COLORMAP
2328	varying vec2 vSheenColorMapUv;
2329#endif
2330#ifdef USE_SHEEN_ROUGHNESSMAP
2331	varying vec2 vSheenRoughnessMapUv;
2332#endif
2333#ifdef USE_SPECULARMAP
2334	varying vec2 vSpecularMapUv;
2335#endif
2336#ifdef USE_SPECULAR_COLORMAP
2337	varying vec2 vSpecularColorMapUv;
2338#endif
2339#ifdef USE_SPECULAR_INTENSITYMAP
2340	varying vec2 vSpecularIntensityMapUv;
2341#endif
2342#ifdef USE_TRANSMISSIONMAP
2343	uniform mat3 transmissionMapTransform;
2344	varying vec2 vTransmissionMapUv;
2345#endif
2346#ifdef USE_THICKNESSMAP
2347	uniform mat3 thicknessMapTransform;
2348	varying vec2 vThicknessMapUv;
2349#endif`,C3=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2350	varying vec2 vUv;
2351#endif
2352#ifdef USE_MAP
2353	uniform mat3 mapTransform;
2354	varying vec2 vMapUv;
2355#endif
2356#ifdef USE_ALPHAMAP
2357	uniform mat3 alphaMapTransform;
2358	varying vec2 vAlphaMapUv;
2359#endif
2360#ifdef USE_LIGHTMAP
2361	uniform mat3 lightMapTransform;
2362	varying vec2 vLightMapUv;
2363#endif
2364#ifdef USE_AOMAP
2365	uniform mat3 aoMapTransform;
2366	varying vec2 vAoMapUv;
2367#endif
2368#ifdef USE_BUMPMAP
2369	uniform mat3 bumpMapTransform;
2370	varying vec2 vBumpMapUv;
2371#endif
2372#ifdef USE_NORMALMAP
2373	uniform mat3 normalMapTransform;
2374	varying vec2 vNormalMapUv;
2375#endif
2376#ifdef USE_DISPLACEMENTMAP
2377	uniform mat3 displacementMapTransform;
2378	varying vec2 vDisplacementMapUv;
2379#endif
2380#ifdef USE_EMISSIVEMAP
2381	uniform mat3 emissiveMapTransform;
2382	varying vec2 vEmissiveMapUv;
2383#endif
2384#ifdef USE_METALNESSMAP
2385	uniform mat3 metalnessMapTransform;
2386	varying vec2 vMetalnessMapUv;
2387#endif
2388#ifdef USE_ROUGHNESSMAP
2389	uniform mat3 roughnessMapTransform;
2390	varying vec2 vRoughnessMapUv;
2391#endif
2392#ifdef USE_ANISOTROPYMAP
2393	uniform mat3 anisotropyMapTransform;
2394	varying vec2 vAnisotropyMapUv;
2395#endif
2396#ifdef USE_CLEARCOATMAP
2397	uniform mat3 clearcoatMapTransform;
2398	varying vec2 vClearcoatMapUv;
2399#endif
2400#ifdef USE_CLEARCOAT_NORMALMAP
2401	uniform mat3 clearcoatNormalMapTransform;
2402	varying vec2 vClearcoatNormalMapUv;
2403#endif
2404#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2405	uniform mat3 clearcoatRoughnessMapTransform;
2406	varying vec2 vClearcoatRoughnessMapUv;
2407#endif
2408#ifdef USE_SHEEN_COLORMAP
2409	uniform mat3 sheenColorMapTransform;
2410	varying vec2 vSheenColorMapUv;
2411#endif
2412#ifdef USE_SHEEN_ROUGHNESSMAP
2413	uniform mat3 sheenRoughnessMapTransform;
2414	varying vec2 vSheenRoughnessMapUv;
2415#endif
2416#ifdef USE_IRIDESCENCEMAP
2417	uniform mat3 iridescenceMapTransform;
2418	varying vec2 vIridescenceMapUv;
2419#endif
2420#ifdef USE_IRIDESCENCE_THICKNESSMAP
2421	uniform mat3 iridescenceThicknessMapTransform;
2422	varying vec2 vIridescenceThicknessMapUv;
2423#endif
2424#ifdef USE_SPECULARMAP
2425	uniform mat3 specularMapTransform;
2426	varying vec2 vSpecularMapUv;
2427#endif
2428#ifdef USE_SPECULAR_COLORMAP
2429	uniform mat3 specularColorMapTransform;
2430	varying vec2 vSpecularColorMapUv;
2431#endif
2432#ifdef USE_SPECULAR_INTENSITYMAP
2433	uniform mat3 specularIntensityMapTransform;
2434	varying vec2 vSpecularIntensityMapUv;
2435#endif
2436#ifdef USE_TRANSMISSIONMAP
2437	uniform mat3 transmissionMapTransform;
2438	varying vec2 vTransmissionMapUv;
2439#endif
2440#ifdef USE_THICKNESSMAP
2441	uniform mat3 thicknessMapTransform;
2442	varying vec2 vThicknessMapUv;
2443#endif`,R3=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2444	vUv = vec3( uv, 1 ).xy;
2445#endif
2446#ifdef USE_MAP
2447	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2448#endif
2449#ifdef USE_ALPHAMAP
2450	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2451#endif
2452#ifdef USE_LIGHTMAP
2453	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2454#endif
2455#ifdef USE_AOMAP
2456	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2457#endif
2458#ifdef USE_BUMPMAP
2459	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2460#endif
2461#ifdef USE_NORMALMAP
2462	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2463#endif
2464#ifdef USE_DISPLACEMENTMAP
2465	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2466#endif
2467#ifdef USE_EMISSIVEMAP
2468	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2469#endif
2470#ifdef USE_METALNESSMAP
2471	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2472#endif
2473#ifdef USE_ROUGHNESSMAP
2474	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2475#endif
2476#ifdef USE_ANISOTROPYMAP
2477	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2478#endif
2479#ifdef USE_CLEARCOATMAP
2480	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2481#endif
2482#ifdef USE_CLEARCOAT_NORMALMAP
2483	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2484#endif
2485#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2486	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2487#endif
2488#ifdef USE_IRIDESCENCEMAP
2489	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2490#endif
2491#ifdef USE_IRIDESCENCE_THICKNESSMAP
2492	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2493#endif
2494#ifdef USE_SHEEN_COLORMAP
2495	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2496#endif
2497#ifdef USE_SHEEN_ROUGHNESSMAP
2498	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2499#endif
2500#ifdef USE_SPECULARMAP
2501	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2502#endif
2503#ifdef USE_SPECULAR_COLORMAP
2504	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2505#endif
2506#ifdef USE_SPECULAR_INTENSITYMAP
2507	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2508#endif
2509#ifdef USE_TRANSMISSIONMAP
2510	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2511#endif
2512#ifdef USE_THICKNESSMAP
2513	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2514#endif`,P3=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2515	vec4 worldPosition = vec4( transformed, 1.0 );
2516	#ifdef USE_BATCHING
2517		worldPosition = batchingMatrix * worldPosition;
2518	#endif
2519	#ifdef USE_INSTANCING
2520		worldPosition = instanceMatrix * worldPosition;
2521	#endif
2522	worldPosition = modelMatrix * worldPosition;
2523#endif`;const I3=`varying vec2 vUv;
2524uniform mat3 uvTransform;
2525void main() {
2526	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2527	gl_Position = vec4( position.xy, 1.0, 1.0 );
2528}`,D3=`uniform sampler2D t2D;
2529uniform float backgroundIntensity;
2530varying vec2 vUv;
2531void main() {
2532	vec4 texColor = texture2D( t2D, vUv );
2533	#ifdef DECODE_VIDEO_TEXTURE
2534		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
2535	#endif
2536	texColor.rgb *= backgroundIntensity;
2537	gl_FragColor = texColor;
2538	#include <tonemapping_fragment>
2539	#include <colorspace_fragment>
2540}`,L3=`varying vec3 vWorldDirection;
2541#include <common>
2542void main() {
2543	vWorldDirection = transformDirection( position, modelMatrix );
2544	#include <begin_vertex>
2545	#include <project_vertex>
2546	gl_Position.z = gl_Position.w;
2547}`,k3=`#ifdef ENVMAP_TYPE_CUBE
2548	uniform samplerCube envMap;
2549#elif defined( ENVMAP_TYPE_CUBE_UV )
2550	uniform sampler2D envMap;
2551#endif
2552uniform float flipEnvMap;
2553uniform float backgroundBlurriness;
2554uniform float backgroundIntensity;
2555uniform mat3 backgroundRotation;
2556varying vec3 vWorldDirection;
2557#include <cube_uv_reflection_fragment>
2558void main() {
2559	#ifdef ENVMAP_TYPE_CUBE
2560		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2561	#elif defined( ENVMAP_TYPE_CUBE_UV )
2562		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2563	#else
2564		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2565	#endif
2566	texColor.rgb *= backgroundIntensity;
2567	gl_FragColor = texColor;
2568	#include <tonemapping_fragment>
2569	#include <colorspace_fragment>
2570}`,U3=`varying vec3 vWorldDirection;
2571#include <common>
2572void main() {
2573	vWorldDirection = transformDirection( position, modelMatrix );
2574	#include <begin_vertex>
2575	#include <project_vertex>
2576	gl_Position.z = gl_Position.w;
2577}`,N3=`uniform samplerCube tCube;
2578uniform float tFlip;
2579uniform float opacity;
2580varying vec3 vWorldDirection;
2581void main() {
2582	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2583	gl_FragColor = texColor;
2584	gl_FragColor.a *= opacity;
2585	#include <tonemapping_fragment>
2586	#include <colorspace_fragment>
2587}`,O3=`#include <common>
2588#include <batching_pars_vertex>
2589#include <uv_pars_vertex>
2590#include <displacementmap_pars_vertex>
2591#include <morphtarget_pars_vertex>
2592#include <skinning_pars_vertex>
2593#include <logdepthbuf_pars_vertex>
2594#include <clipping_planes_pars_vertex>
2595varying vec2 vHighPrecisionZW;
2596void main() {
2597	#include <uv_vertex>
2598	#include <batching_vertex>
2599	#include <skinbase_vertex>
2600	#include <morphinstance_vertex>
2601	#ifdef USE_DISPLACEMENTMAP
2602		#include <beginnormal_vertex>
2603		#include <morphnormal_vertex>
2604		#include <skinnormal_vertex>
2605	#endif
2606	#include <begin_vertex>
2607	#include <morphtarget_vertex>
2608	#include <skinning_vertex>
2609	#include <displacementmap_vertex>
2610	#include <project_vertex>
2611	#include <logdepthbuf_vertex>
2612	#include <clipping_planes_vertex>
2613	vHighPrecisionZW = gl_Position.zw;
2614}`,F3=`#if DEPTH_PACKING == 3200
2615	uniform float opacity;
2616#endif
2617#include <common>
2618#include <packing>
2619#include <uv_pars_fragment>
2620#include <map_pars_fragment>
2621#include <alphamap_pars_fragment>
2622#include <alphatest_pars_fragment>
2623#include <alphahash_pars_fragment>
2624#include <logdepthbuf_pars_fragment>
2625#include <clipping_planes_pars_fragment>
2626varying vec2 vHighPrecisionZW;
2627void main() {
2628	vec4 diffuseColor = vec4( 1.0 );
2629	#include <clipping_planes_fragment>
2630	#if DEPTH_PACKING == 3200
2631		diffuseColor.a = opacity;
2632	#endif
2633	#include <map_fragment>
2634	#include <alphamap_fragment>
2635	#include <alphatest_fragment>
2636	#include <alphahash_fragment>
2637	#include <logdepthbuf_fragment>
2638	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2639	#if DEPTH_PACKING == 3200
2640		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2641	#elif DEPTH_PACKING == 3201
2642		gl_FragColor = packDepthToRGBA( fragCoordZ );
2643	#elif DEPTH_PACKING == 3202
2644		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2645	#elif DEPTH_PACKING == 3203
2646		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2647	#endif
2648}`,B3=`#define DISTANCE
2649varying vec3 vWorldPosition;
2650#include <common>
2651#include <batching_pars_vertex>
2652#include <uv_pars_vertex>
2653#include <displacementmap_pars_vertex>
2654#include <morphtarget_pars_vertex>
2655#include <skinning_pars_vertex>
2656#include <clipping_planes_pars_vertex>
2657void main() {
2658	#include <uv_vertex>
2659	#include <batching_vertex>
2660	#include <skinbase_vertex>
2661	#include <morphinstance_vertex>
2662	#ifdef USE_DISPLACEMENTMAP
2663		#include <beginnormal_vertex>
2664		#include <morphnormal_vertex>
2665		#include <skinnormal_vertex>
2666	#endif
2667	#include <begin_vertex>
2668	#include <morphtarget_vertex>
2669	#include <skinning_vertex>
2670	#include <displacementmap_vertex>
2671	#include <project_vertex>
2672	#include <worldpos_vertex>
2673	#include <clipping_planes_vertex>
2674	vWorldPosition = worldPosition.xyz;
2675}`,z3=`#define DISTANCE
2676uniform vec3 referencePosition;
2677uniform float nearDistance;
2678uniform float farDistance;
2679varying vec3 vWorldPosition;
2680#include <common>
2681#include <packing>
2682#include <uv_pars_fragment>
2683#include <map_pars_fragment>
2684#include <alphamap_pars_fragment>
2685#include <alphatest_pars_fragment>
2686#include <alphahash_pars_fragment>
2687#include <clipping_planes_pars_fragment>
2688void main () {
2689	vec4 diffuseColor = vec4( 1.0 );
2690	#include <clipping_planes_fragment>
2691	#include <map_fragment>
2692	#include <alphamap_fragment>
2693	#include <alphatest_fragment>
2694	#include <alphahash_fragment>
2695	float dist = length( vWorldPosition - referencePosition );
2696	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2697	dist = saturate( dist );
2698	gl_FragColor = packDepthToRGBA( dist );
2699}`,V3=`varying vec3 vWorldDirection;
2700#include <common>
2701void main() {
2702	vWorldDirection = transformDirection( position, modelMatrix );
2703	#include <begin_vertex>
2704	#include <project_vertex>
2705}`,G3=`uniform sampler2D tEquirect;
2706varying vec3 vWorldDirection;
2707#include <common>
2708void main() {
2709	vec3 direction = normalize( vWorldDirection );
2710	vec2 sampleUV = equirectUv( direction );
2711	gl_FragColor = texture2D( tEquirect, sampleUV );
2712	#include <tonemapping_fragment>
2713	#include <colorspace_fragment>
2714}`,H3=`uniform float scale;
2715attribute float lineDistance;
2716varying float vLineDistance;
2717#include <common>
2718#include <uv_pars_vertex>
2719#include <color_pars_vertex>
2720#include <fog_pars_vertex>
2721#include <morphtarget_pars_vertex>
2722#include <logdepthbuf_pars_vertex>
2723#include <clipping_planes_pars_vertex>
2724void main() {
2725	vLineDistance = scale * lineDistance;
2726	#include <uv_vertex>
2727	#include <color_vertex>
2728	#include <morphinstance_vertex>
2729	#include <morphcolor_vertex>
2730	#include <begin_vertex>
2731	#include <morphtarget_vertex>
2732	#include <project_vertex>
2733	#include <logdepthbuf_vertex>
2734	#include <clipping_planes_vertex>
2735	#include <fog_vertex>
2736}`,W3=`uniform vec3 diffuse;
2737uniform float opacity;
2738uniform float dashSize;
2739uniform float totalSize;
2740varying float vLineDistance;
2741#include <common>
2742#include <color_pars_fragment>
2743#include <uv_pars_fragment>
2744#include <map_pars_fragment>
2745#include <fog_pars_fragment>
2746#include <logdepthbuf_pars_fragment>
2747#include <clipping_planes_pars_fragment>
2748void main() {
2749	vec4 diffuseColor = vec4( diffuse, opacity );
2750	#include <clipping_planes_fragment>
2751	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2752		discard;
2753	}
2754	vec3 outgoingLight = vec3( 0.0 );
2755	#include <logdepthbuf_fragment>
2756	#include <map_fragment>
2757	#include <color_fragment>
2758	outgoingLight = diffuseColor.rgb;
2759	#include <opaque_fragment>
2760	#include <tonemapping_fragment>
2761	#include <colorspace_fragment>
2762	#include <fog_fragment>
2763	#include <premultiplied_alpha_fragment>
2764}`,j3=`#include <common>
2765#include <batching_pars_vertex>
2766#include <uv_pars_vertex>
2767#include <envmap_pars_vertex>
2768#include <color_pars_vertex>
2769#include <fog_pars_vertex>
2770#include <morphtarget_pars_vertex>
2771#include <skinning_pars_vertex>
2772#include <logdepthbuf_pars_vertex>
2773#include <clipping_planes_pars_vertex>
2774void main() {
2775	#include <uv_vertex>
2776	#include <color_vertex>
2777	#include <morphinstance_vertex>
2778	#include <morphcolor_vertex>
2779	#include <batching_vertex>
2780	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2781		#include <beginnormal_vertex>
2782		#include <morphnormal_vertex>
2783		#include <skinbase_vertex>
2784		#include <skinnormal_vertex>
2785		#include <defaultnormal_vertex>
2786	#endif
2787	#include <begin_vertex>
2788	#include <morphtarget_vertex>
2789	#include <skinning_vertex>
2790	#include <project_vertex>
2791	#include <logdepthbuf_vertex>
2792	#include <clipping_planes_vertex>
2793	#include <worldpos_vertex>
2794	#include <envmap_vertex>
2795	#include <fog_vertex>
2796}`,X3=`uniform vec3 diffuse;
2797uniform float opacity;
2798#ifndef FLAT_SHADED
2799	varying vec3 vNormal;
2800#endif
2801#include <common>
2802#include <dithering_pars_fragment>
2803#include <color_pars_fragment>
2804#include <uv_pars_fragment>
2805#include <map_pars_fragment>
2806#include <alphamap_pars_fragment>
2807#include <alphatest_pars_fragment>
2808#include <alphahash_pars_fragment>
2809#include <aomap_pars_fragment>
2810#include <lightmap_pars_fragment>
2811#include <envmap_common_pars_fragment>
2812#include <envmap_pars_fragment>
2813#include <fog_pars_fragment>
2814#include <specularmap_pars_fragment>
2815#include <logdepthbuf_pars_fragment>
2816#include <clipping_planes_pars_fragment>
2817void main() {
2818	vec4 diffuseColor = vec4( diffuse, opacity );
2819	#include <clipping_planes_fragment>
2820	#include <logdepthbuf_fragment>
2821	#include <map_fragment>
2822	#include <color_fragment>
2823	#include <alphamap_fragment>
2824	#include <alphatest_fragment>
2825	#include <alphahash_fragment>
2826	#include <specularmap_fragment>
2827	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2828	#ifdef USE_LIGHTMAP
2829		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2830		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2831	#else
2832		reflectedLight.indirectDiffuse += vec3( 1.0 );
2833	#endif
2834	#include <aomap_fragment>
2835	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2836	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2837	#include <envmap_fragment>
2838	#include <opaque_fragment>
2839	#include <tonemapping_fragment>
2840	#include <colorspace_fragment>
2841	#include <fog_fragment>
2842	#include <premultiplied_alpha_fragment>
2843	#include <dithering_fragment>
2844}`,q3=`#define LAMBERT
2845varying vec3 vViewPosition;
2846#include <common>
2847#include <batching_pars_vertex>
2848#include <uv_pars_vertex>
2849#include <displacementmap_pars_vertex>
2850#include <envmap_pars_vertex>
2851#include <color_pars_vertex>
2852#include <fog_pars_vertex>
2853#include <normal_pars_vertex>
2854#include <morphtarget_pars_vertex>
2855#include <skinning_pars_vertex>
2856#include <shadowmap_pars_vertex>
2857#include <logdepthbuf_pars_vertex>
2858#include <clipping_planes_pars_vertex>
2859void main() {
2860	#include <uv_vertex>
2861	#include <color_vertex>
2862	#include <morphinstance_vertex>
2863	#include <morphcolor_vertex>
2864	#include <batching_vertex>
2865	#include <beginnormal_vertex>
2866	#include <morphnormal_vertex>
2867	#include <skinbase_vertex>
2868	#include <skinnormal_vertex>
2869	#include <defaultnormal_vertex>
2870	#include <normal_vertex>
2871	#include <begin_vertex>
2872	#include <morphtarget_vertex>
2873	#include <skinning_vertex>
2874	#include <displacementmap_vertex>
2875	#include <project_vertex>
2876	#include <logdepthbuf_vertex>
2877	#include <clipping_planes_vertex>
2878	vViewPosition = - mvPosition.xyz;
2879	#include <worldpos_vertex>
2880	#include <envmap_vertex>
2881	#include <shadowmap_vertex>
2882	#include <fog_vertex>
2883}`,Y3=`#define LAMBERT
2884uniform vec3 diffuse;
2885uniform vec3 emissive;
2886uniform float opacity;
2887#include <common>
2888#include <packing>
2889#include <dithering_pars_fragment>
2890#include <color_pars_fragment>
2891#include <uv_pars_fragment>
2892#include <map_pars_fragment>
2893#include <alphamap_pars_fragment>
2894#include <alphatest_pars_fragment>
2895#include <alphahash_pars_fragment>
2896#include <aomap_pars_fragment>
2897#include <lightmap_pars_fragment>
2898#include <emissivemap_pars_fragment>
2899#include <envmap_common_pars_fragment>
2900#include <envmap_pars_fragment>
2901#include <fog_pars_fragment>
2902#include <bsdfs>
2903#include <lights_pars_begin>
2904#include <normal_pars_fragment>
2905#include <lights_lambert_pars_fragment>
2906#include <shadowmap_pars_fragment>
2907#include <bumpmap_pars_fragment>
2908#include <normalmap_pars_fragment>
2909#include <specularmap_pars_fragment>
2910#include <logdepthbuf_pars_fragment>
2911#include <clipping_planes_pars_fragment>
2912void main() {
2913	vec4 diffuseColor = vec4( diffuse, opacity );
2914	#include <clipping_planes_fragment>
2915	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2916	vec3 totalEmissiveRadiance = emissive;
2917	#include <logdepthbuf_fragment>
2918	#include <map_fragment>
2919	#include <color_fragment>
2920	#include <alphamap_fragment>
2921	#include <alphatest_fragment>
2922	#include <alphahash_fragment>
2923	#include <specularmap_fragment>
2924	#include <normal_fragment_begin>
2925	#include <normal_fragment_maps>
2926	#include <emissivemap_fragment>
2927	#include <lights_lambert_fragment>
2928	#include <lights_fragment_begin>
2929	#include <lights_fragment_maps>
2930	#include <lights_fragment_end>
2931	#include <aomap_fragment>
2932	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2933	#include <envmap_fragment>
2934	#include <opaque_fragment>
2935	#include <tonemapping_fragment>
2936	#include <colorspace_fragment>
2937	#include <fog_fragment>
2938	#include <premultiplied_alpha_fragment>
2939	#include <dithering_fragment>
2940}`,$3=`#define MATCAP
2941varying vec3 vViewPosition;
2942#include <common>
2943#include <batching_pars_vertex>
2944#include <uv_pars_vertex>
2945#include <color_pars_vertex>
2946#include <displacementmap_pars_vertex>
2947#include <fog_pars_vertex>
2948#include <normal_pars_vertex>
2949#include <morphtarget_pars_vertex>
2950#include <skinning_pars_vertex>
2951#include <logdepthbuf_pars_vertex>
2952#include <clipping_planes_pars_vertex>
2953void main() {
2954	#include <uv_vertex>
2955	#include <color_vertex>
2956	#include <morphinstance_vertex>
2957	#include <morphcolor_vertex>
2958	#include <batching_vertex>
2959	#include <beginnormal_vertex>
2960	#include <morphnormal_vertex>
2961	#include <skinbase_vertex>
2962	#include <skinnormal_vertex>
2963	#include <defaultnormal_vertex>
2964	#include <normal_vertex>
2965	#include <begin_vertex>
2966	#include <morphtarget_vertex>
2967	#include <skinning_vertex>
2968	#include <displacementmap_vertex>
2969	#include <project_vertex>
2970	#include <logdepthbuf_vertex>
2971	#include <clipping_planes_vertex>
2972	#include <fog_vertex>
2973	vViewPosition = - mvPosition.xyz;
2974}`,Z3=`#define MATCAP
2975uniform vec3 diffuse;
2976uniform float opacity;
2977uniform sampler2D matcap;
2978varying vec3 vViewPosition;
2979#include <common>
2980#include <dithering_pars_fragment>
2981#include <color_pars_fragment>
2982#include <uv_pars_fragment>
2983#include <map_pars_fragment>
2984#include <alphamap_pars_fragment>
2985#include <alphatest_pars_fragment>
2986#include <alphahash_pars_fragment>
2987#include <fog_pars_fragment>
2988#include <normal_pars_fragment>
2989#include <bumpmap_pars_fragment>
2990#include <normalmap_pars_fragment>
2991#include <logdepthbuf_pars_fragment>
2992#include <clipping_planes_pars_fragment>
2993void main() {
2994	ve
2994c4 diffuseColor = vec4( diffuse, opacity );
2995	#include <clipping_planes_fragment>
2996	#include <logdepthbuf_fragment>
2997	#include <map_fragment>
2998	#include <color_fragment>
2999	#include <alphamap_fragment>
3000	#include <alphatest_fragment>
3001	#include <alphahash_fragment>
3002	#include <normal_fragment_begin>
3003	#include <normal_fragment_maps>
3004	vec3 viewDir = normalize( vViewPosition );
3005	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3006	vec3 y = cross( viewDir, x );
3007	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3008	#ifdef USE_MATCAP
3009		vec4 matcapColor = texture2D( matcap, uv );
3010	#else
3011		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3012	#endif
3013	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3014	#include <opaque_fragment>
3015	#include <tonemapping_fragment>
3016	#include <colorspace_fragment>
3017	#include <fog_fragment>
3018	#include <premultiplied_alpha_fragment>
3019	#include <dithering_fragment>
3020}`,J3=`#define NORMAL
3021#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3022	varying vec3 vViewPosition;
3023#endif
3024#include <common>
3025#include <batching_pars_vertex>
3026#include <uv_pars_vertex>
3027#include <displacementmap_pars_vertex>
3028#include <normal_pars_vertex>
3029#include <morphtarget_pars_vertex>
3030#include <skinning_pars_vertex>
3031#include <logdepthbuf_pars_vertex>
3032#include <clipping_planes_pars_vertex>
3033void main() {
3034	#include <uv_vertex>
3035	#include <batching_vertex>
3036	#include <beginnormal_vertex>
3037	#include <morphinstance_vertex>
3038	#include <morphnormal_vertex>
3039	#include <skinbase_vertex>
3040	#include <skinnormal_vertex>
3041	#include <defaultnormal_vertex>
3042	#include <normal_vertex>
3043	#include <begin_vertex>
3044	#include <morphtarget_vertex>
3045	#include <skinning_vertex>
3046	#include <displacementmap_vertex>
3047	#include <project_vertex>
3048	#include <logdepthbuf_vertex>
3049	#include <clipping_planes_vertex>
3050#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3051	vViewPosition = - mvPosition.xyz;
3052#endif
3053}`,K3=`#define NORMAL
3054uniform float opacity;
3055#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3056	varying vec3 vViewPosition;
3057#endif
3058#include <packing>
3059#include <uv_pars_fragment>
3060#include <normal_pars_fragment>
3061#include <bumpmap_pars_fragment>
3062#include <normalmap_pars_fragment>
3063#include <logdepthbuf_pars_fragment>
3064#include <clipping_planes_pars_fragment>
3065void main() {
3066	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3067	#include <clipping_planes_fragment>
3068	#include <logdepthbuf_fragment>
3069	#include <normal_fragment_begin>
3070	#include <normal_fragment_maps>
3071	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3072	#ifdef OPAQUE
3073		gl_FragColor.a = 1.0;
3074	#endif
3075}`,Q3=`#define PHONG
3076varying vec3 vViewPosition;
3077#include <common>
3078#include <batching_pars_vertex>
3079#include <uv_pars_vertex>
3080#include <displacementmap_pars_vertex>
3081#include <envmap_pars_vertex>
3082#include <color_pars_vertex>
3083#include <fog_pars_vertex>
3084#include <normal_pars_vertex>
3085#include <morphtarget_pars_vertex>
3086#include <skinning_pars_vertex>
3087#include <shadowmap_pars_vertex>
3088#include <logdepthbuf_pars_vertex>
3089#include <clipping_planes_pars_vertex>
3090void main() {
3091	#include <uv_vertex>
3092	#include <color_vertex>
3093	#include <morphcolor_vertex>
3094	#include <batching_vertex>
3095	#include <beginnormal_vertex>
3096	#include <morphinstance_vertex>
3097	#include <morphnormal_vertex>
3098	#include <skinbase_vertex>
3099	#include <skinnormal_vertex>
3100	#include <defaultnormal_vertex>
3101	#include <normal_vertex>
3102	#include <begin_vertex>
3103	#include <morphtarget_vertex>
3104	#include <skinning_vertex>
3105	#include <displacementmap_vertex>
3106	#include <project_vertex>
3107	#include <logdepthbuf_vertex>
3108	#include <clipping_planes_vertex>
3109	vViewPosition = - mvPosition.xyz;
3110	#include <worldpos_vertex>
3111	#include <envmap_vertex>
3112	#include <shadowmap_vertex>
3113	#include <fog_vertex>
3114}`,eD=`#define PHONG
3115uniform vec3 diffuse;
3116uniform vec3 emissive;
3117uniform vec3 specular;
3118uniform float shininess;
3119uniform float opacity;
3120#include <common>
3121#include <packing>
3122#include <dithering_pars_fragment>
3123#include <color_pars_fragment>
3124#include <uv_pars_fragment>
3125#include <map_pars_fragment>
3126#include <alphamap_pars_fragment>
3127#include <alphatest_pars_fragment>
3128#include <alphahash_pars_fragment>
3129#include <aomap_pars_fragment>
3130#include <lightmap_pars_fragment>
3131#include <emissivemap_pars_fragment>
3132#include <envmap_common_pars_fragment>
3133#include <envmap_pars_fragment>
3134#include <fog_pars_fragment>
3135#include <bsdfs>
3136#include <lights_pars_begin>
3137#include <normal_pars_fragment>
3138#include <lights_phong_pars_fragment>
3139#include <shadowmap_pars_fragment>
3140#include <bumpmap_pars_fragment>
3141#include <normalmap_pars_fragment>
3142#include <specularmap_pars_fragment>
3143#include <logdepthbuf_pars_fragment>
3144#include <clipping_planes_pars_fragment>
3145void main() {
3146	vec4 diffuseColor = vec4( diffuse, opacity );
3147	#include <clipping_planes_fragment>
3148	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3149	vec3 totalEmissiveRadiance = emissive;
3150	#include <logdepthbuf_fragment>
3151	#include <map_fragment>
3152	#include <color_fragment>
3153	#include <alphamap_fragment>
3154	#include <alphatest_fragment>
3155	#include <alphahash_fragment>
3156	#include <specularmap_fragment>
3157	#include <normal_fragment_begin>
3158	#include <normal_fragment_maps>
3159	#include <emissivemap_fragment>
3160	#include <lights_phong_fragment>
3161	#include <lights_fragment_begin>
3162	#include <lights_fragment_maps>
3163	#include <lights_fragment_end>
3164	#include <aomap_fragment>
3165	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3166	#include <envmap_fragment>
3167	#include <opaque_fragment>
3168	#include <tonemapping_fragment>
3169	#include <colorspace_fragment>
3170	#include <fog_fragment>
3171	#include <premultiplied_alpha_fragment>
3172	#include <dithering_fragment>
3173}`,tD=`#define STANDARD
3174varying vec3 vViewPosition;
3175#ifdef USE_TRANSMISSION
3176	varying vec3 vWorldPosition;
3177#endif
3178#include <common>
3179#include <batching_pars_vertex>
3180#include <uv_pars_vertex>
3181#include <displacementmap_pars_vertex>
3182#include <color_pars_vertex>
3183#include <fog_pars_vertex>
3184#include <normal_pars_vertex>
3185#include <morphtarget_pars_vertex>
3186#include <skinning_pars_vertex>
3187#include <shadowmap_pars_vertex>
3188#include <logdepthbuf_pars_vertex>
3189#include <clipping_planes_pars_vertex>
3190void main() {
3191	#include <uv_vertex>
3192	#include <color_vertex>
3193	#include <morphinstance_vertex>
3194	#include <morphcolor_vertex>
3195	#include <batching_vertex>
3196	#include <beginnormal_vertex>
3197	#include <morphnormal_vertex>
3198	#include <skinbase_vertex>
3199	#include <skinnormal_vertex>
3200	#include <defaultnormal_vertex>
3201	#include <normal_vertex>
3202	#include <begin_vertex>
3203	#include <morphtarget_vertex>
3204	#include <skinning_vertex>
3205	#include <displacementmap_vertex>
3206	#include <project_vertex>
3207	#include <logdepthbuf_vertex>
3208	#include <clipping_planes_vertex>
3209	vViewPosition = - mvPosition.xyz;
3210	#include <worldpos_vertex>
3211	#include <shadowmap_vertex>
3212	#include <fog_vertex>
3213#ifdef USE_TRANSMISSION
3214	vWorldPosition = worldPosition.xyz;
3215#endif
3216}`,nD=`#define STANDARD
3217#ifdef PHYSICAL
3218	#define IOR
3219	#define USE_SPECULAR
3220#endif
3221uniform vec3 diffuse;
3222uniform vec3 emissive;
3223uniform float roughness;
3224uniform float metalness;
3225uniform float opacity;
3226#ifdef IOR
3227	uniform float ior;
3228#endif
3229#ifdef USE_SPECULAR
3230	uniform float specularIntensity;
3231	uniform vec3 specularColor;
3232	#ifdef USE_SPECULAR_COLORMAP
3233		uniform sampler2D specularColorMap;
3234	#endif
3235	#ifdef USE_SPECULAR_INTENSITYMAP
3236		uniform sampler2D specularIntensityMap;
3237	#endif
3238#endif
3239#ifdef USE_CLEARCOAT
3240	uniform float clearcoat;
3241	uniform float clearcoatRoughness;
3242#endif
3243#ifdef USE_DISPERSION
3244	uniform float dispersion;
3245#endif
3246#ifdef USE_IRIDESCENCE
3247	uniform float iridescence;
3248	uniform float iridescenceIOR;
3249	uniform float iridescenceThicknessMinimum;
3250	uniform float iridescenceThicknessMaximum;
3251#endif
3252#ifdef USE_SHEEN
3253	uniform vec3 sheenColor;
3254	uniform float sheenRoughness;
3255	#ifdef USE_SHEEN_COLORMAP
3256		uniform sampler2D sheenColorMap;
3257	#endif
3258	#ifdef USE_SHEEN_ROUGHNESSMAP
3259		uniform sampler2D sheenRoughnessMap;
3260	#endif
3261#endif
3262#ifdef USE_ANISOTROPY
3263	uniform vec2 anisotropyVector;
3264	#ifdef USE_ANISOTROPYMAP
3265		uniform sampler2D anisotropyMap;
3266	#endif
3267#endif
3268varying vec3 vViewPosition;
3269#include <common>
3270#include <packing>
3271#include <dithering_pars_fragment>
3272#include <color_pars_fragment>
3273#include <uv_pars_fragment>
3274#include <map_pars_fragment>
3275#include <alphamap_pars_fragment>
3276#include <alphatest_pars_fragment>
3277#include <alphahash_pars_fragment>
3278#include <aomap_pars_fragment>
3279#include <lightmap_pars_fragment>
3280#include <emissivemap_pars_fragment>
3281#include <iridescence_fragment>
3282#include <cube_uv_reflection_fragment>
3283#include <envmap_common_pars_fragment>
3284#include <envmap_physical_pars_fragment>
3285#include <fog_pars_fragment>
3286#include <lights_pars_begin>
3287#include <normal_pars_fragment>
3288#include <lights_physical_pars_fragment>
3289#include <transmission_pars_fragment>
3290#include <shadowmap_pars_fragment>
3291#include <bumpmap_pars_fragment>
3292#include <normalmap_pars_fragment>
3293#include <clearcoat_pars_fragment>
3294#include <iridescence_pars_fragment>
3295#include <roughnessmap_pars_fragment>
3296#include <metalnessmap_pars_fragment>
3297#include <logdepthbuf_pars_fragment>
3298#include <clipping_planes_pars_fragment>
3299void main() {
3300	vec4 diffuseColor = vec4( diffuse, opacity );
3301	#include <clipping_planes_fragment>
3302	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3303	vec3 totalEmissiveRadiance = emissive;
3304	#include <logdepthbuf_fragment>
3305	#include <map_fragment>
3306	#include <color_fragment>
3307	#include <alphamap_fragment>
3308	#include <alphatest_fragment>
3309	#include <alphahash_fragment>
3310	#include <roughnessmap_fragment>
3311	#include <metalnessmap_fragment>
3312	#include <normal_fragment_begin>
3313	#include <normal_fragment_maps>
3314	#include <clearcoat_normal_fragment_begin>
3315	#include <clearcoat_normal_fragment_maps>
3316	#include <emissivemap_fragment>
3317	#include <lights_physical_fragment>
3318	#include <lights_fragment_begin>
3319	#include <lights_fragment_maps>
3320	#include <lights_fragment_end>
3321	#include <aomap_fragment>
3322	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3323	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3324	#include <transmission_fragment>
3325	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3326	#ifdef USE_SHEEN
3327		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3328		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3329	#endif
3330	#ifdef USE_CLEARCOAT
3331		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3332		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3333		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3334	#endif
3335	#include <opaque_fragment>
3336	#include <tonemapping_fragment>
3337	#include <colorspace_fragment>
3338	#include <fog_fragment>
3339	#include <premultiplied_alpha_fragment>
3340	#include <dithering_fragment>
3341}`,iD=`#define TOON
3342varying vec3 vViewPosition;
3343#include <common>
3344#include <batching_pars_vertex>
3345#include <uv_pars_vertex>
3346#include <displacementmap_pars_vertex>
3347#include <color_pars_vertex>
3348#include <fog_pars_vertex>
3349#include <normal_pars_vertex>
3350#include <morphtarget_pars_vertex>
3351#include <skinning_pars_vertex>
3352#include <shadowmap_pars_vertex>
3353#include <logdepthbuf_pars_vertex>
3354#include <clipping_planes_pars_vertex>
3355void main() {
3356	#include <uv_vertex>
3357	#include <color_vertex>
3358	#include <morphinstance_vertex>
3359	#include <morphcolor_vertex>
3360	#include <batching_vertex>
3361	#include <beginnormal_vertex>
3362	#include <morphnormal_vertex>
3363	#include <skinbase_vertex>
3364	#include <skinnormal_vertex>
3365	#include <defaultnormal_vertex>
3366	#include <normal_vertex>
3367	#include <begin_vertex>
3368	#include <morphtarget_vertex>
3369	#include <skinning_vertex>
3370	#include <displacementmap_vertex>
3371	#include <project_vertex>
3372	#include <logdepthbuf_vertex>
3373	#include <clipping_planes_vertex>
3374	vViewPosition = - mvPosition.xyz;
3375	#include <worldpos_vertex>
3376	#include <shadowmap_vertex>
3377	#include <fog_vertex>
3378}`,rD=`#define TOON
3379uniform vec3 diffuse;
3380uniform vec3 emissive;
3381uniform float opacity;
3382#include <common>
3383#include <packing>
3384#include <dithering_pars_fragment>
3385#include <color_pars_fragment>
3386#include <uv_pars_fragment>
3387#include <map_pars_fragment>
3388#include <alphamap_pars_fragment>
3389#include <alphatest_pars_fragment>
3390#include <alphahash_pars_fragment>
3391#include <aomap_pars_fragment>
3392#include <lightmap_pars_fragment>
3393#include <emissivemap_pars_fragment>
3394#include <gradientmap_pars_fragment>
3395#include <fog_pars_fragment>
3396#include <bsdfs>
3397#include <lights_pars_begin>
3398#include <normal_pars_fragment>
3399#include <lights_toon_pars_fragment>
3400#include <shadowmap_pars_fragment>
3401#include <bumpmap_pars_fragment>
3402#include <normalmap_pars_fragment>
3403#include <logdepthbuf_pars_fragment>
3404#include <clipping_planes_pars_fragment>
3405void main() {
3406	vec4 diffuseColor = vec4( diffuse, opacity );
3407	#include <clipping_planes_fragment>
3408	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3409	vec3 totalEmissiveRadiance = emissive;
3410	#include <logdepthbuf_fragment>
3411	#include <map_fragment>
3412	#include <color_fragment>
3413	#include <alphamap_fragment>
3414	#include <alphatest_fragment>
3415	#include <alphahash_fragment>
3416	#include <normal_fragment_begin>
3417	#include <normal_fragment_maps>
3418	#include <emissivemap_fragment>
3419	#include <lights_toon_fragment>
3420	#include <lights_fragment_begin>
3421	#include <lights_fragment_maps>
3422	#include <lights_fragment_end>
3423	#include <aomap_fragment>
3424	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3425	#include <opaque_fragment>
3426	#include <tonemapping_fragment>
3427	#include <colorspace_fragment>
3428	#include <fog_fragment>
3429	#include <premultiplied_alpha_fragment>
3430	#include <dithering_fragment>
3431}`,sD=`uniform float size;
3432uniform float scale;
3433#include <common>
3434#include <color_pars_vertex>
3435#include <fog_pars_vertex>
3436#include <morphtarget_pars_vertex>
3437#include <logdepthbuf_pars_vertex>
3438#include <clipping_planes_pars_vertex>
3439#ifdef USE_POINTS_UV
3440	varying vec2 vUv;
3441	uniform mat3 uvTransform;
3442#endif
3443void main() {
3444	#ifdef USE_POINTS_UV
3445		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3446	#endif
3447	#include <color_vertex>
3448	#include <morphinstance_vertex>
3449	#include <morphcolor_vertex>
3450	#include <begin_vertex>
3451	#include <morphtarget_vertex>
3452	#include <project_vertex>
3453	gl_PointSize = size;
3454	#ifdef USE_SIZEATTENUATION
3455		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3456		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3457	#endif
3458	#include <logdepthbuf_vertex>
3459	#include <clipping_planes_vertex>
3460	#include <worldpos_vertex>
3461	#include <fog_vertex>
3462}`,oD=`uniform vec3 diffuse;
3463uniform float opacity;
3464#include <common>
3465#include <color_pars_fragment>
3466#include <map_particle_pars_fragment>
3467#include <alphatest_pars_fragment>
3468#include <alphahash_pars_fragment>
3469#include <fog_pars_fragment>
3470#include <logdepthbuf_pars_fragment>
3471#include <clipping_planes_pars_fragment>
3472void main() {
3473	vec4 diffuseColor = vec4( diffuse, opacity );
3474	#include <clipping_planes_fragment>
3475	vec3 outgoingLight = vec3( 0.0 );
3476	#include <logdepthbuf_fragment>
3477	#include <map_particle_fragment>
3478	#include <color_fragment>
3479	#include <alphatest_fragment>
3480	#include <alphahash_fragment>
3481	outgoingLight = diffuseColor.rgb;
3482	#include <opaque_fragment>
3483	#include <tonemapping_fragment>
3484	#include <colorspace_fragment>
3485	#include <fog_fragment>
3486	#include <premultiplied_alpha_fragment>
3487}`,aD=`#include <common>
3488#include <batching_pars_vertex>
3489#include <fog_pars_vertex>
3490#include <morphtarget_pars_vertex>
3491#include <skinning_pars_vertex>
3492#include <logdepthbuf_pars_vertex>
3493#include <shadowmap_pars_vertex>
3494void main() {
3495	#include <batching_vertex>
3496	#include <beginnormal_vertex>
3497	#include <morphinstance_vertex>
3498	#include <morphnormal_vertex>
3499	#include <skinbase_vertex>
3500	#include <skinnormal_vertex>
3501	#include <defaultnormal_vertex>
3502	#include <begin_vertex>
3503	#include <morphtarget_vertex>
3504	#include <skinning_vertex>
3505	#include <project_vertex>
3506	#include <logdepthbuf_vertex>
3507	#include <worldpos_vertex>
3508	#include <shadowmap_vertex>
3509	#include <fog_vertex>
3510}`,lD=`uniform vec3 color;
3511uniform float opacity;
3512#include <common>
3513#include <packing>
3514#include <fog_pars_fragment>
3515#include <bsdfs>
3516#include <lights_pars_begin>
3517#include <logdepthbuf_pars_fragment>
3518#include <shadowmap_pars_fragment>
3519#include <shadowmask_pars_fragment>
3520void main() {
3521	#include <logdepthbuf_fragment>
3522	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3523	#include <tonemapping_fragment>
3524	#include <colorspace_fragment>
3525	#include <fog_fragment>
3526}`,cD=`uniform float rotation;
3527uniform vec2 center;
3528#include <common>
3529#include <uv_pars_vertex>
3530#include <fog_pars_vertex>
3531#include <logdepthbuf_pars_vertex>
3532#include <clipping_planes_pars_vertex>
3533void main() {
3534	#include <uv_vertex>
3535	vec4 mvPosition = modelViewMatrix[ 3 ];
3536	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3537	#ifndef USE_SIZEATTENUATION
3538		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3539		if ( isPerspective ) scale *= - mvPosition.z;
3540	#endif
3541	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3542	vec2 rotatedPosition;
3543	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3544	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3545	mvPosition.xy += rotatedPosition;
3546	gl_Position = projectionMatrix * mvPosition;
3547	#include <logdepthbuf_vertex>
3548	#include <clipping_planes_vertex>
3549	#include <fog_vertex>
3550}`,uD=`uniform vec3 diffuse;
3551uniform float opacity;
3552#include <common>
3553#include <uv_pars_fragment>
3554#include <map_pars_fragment>
3555#include <alphamap_pars_fragment>
3556#include <alphatest_pars_fragment>
3557#include <alphahash_pars_fragment>
3558#include <fog_pars_fragment>
3559#include <logdepthbuf_pars_fragment>
3560#include <clipping_planes_pars_fragment>
3561void main() {
3562	vec4 diffuseColor = vec4( diffuse, opacity );
3563	#include <clipping_planes_fragment>
3564	vec3 outgoingLight = vec3( 0.0 );
3565	#include <logdepthbuf_fragment>
3566	#include <map_fragment>
3567	#include <alphamap_fragment>
3568	#include <alphatest_fragment>
3569	#include <alphahash_fragment>
3570	outgoingLight = diffuseColor.rgb;
3571	#include <opaque_fragment>
3572	#include <tonemapping_fragment>
3573	#include <colorspace_fragment>
3574	#include <fog_fragment>
3575}`,Ft={alphahash_fragment:DP,alphahash_pars_fragment:LP,alphamap_fragment:kP,alphamap_pars_fragment:UP,alphatest_fragment:NP,alphatest_pars_fragment:OP,aomap_fragment:FP,aomap_pars_fragment:BP,batching_pars_vertex:zP,batching_vertex:VP,begin_vertex:GP,beginnormal_vertex:HP,bsdfs:WP,iridescence_fragment:jP,bumpmap_pars_fragment:XP,clipping_planes_fragment:qP,clipping_planes_pars_fragment:YP,clipping_planes_pars_vertex:$P,clipping_planes_vertex:ZP,color_fragment:JP,color_pars_fragment:KP,color_pars_vertex:QP,color_vertex:eI,common:tI,cube_uv_reflection_fragment:nI,defaultnormal_vertex:iI,displacementmap_pars_vertex:rI,displacementmap_vertex:sI,emissivemap_fragment:oI,emissivemap_pars_fragment:aI,colorspace_fragment:lI,colorspace_pars_fragment:cI,envmap_fragment:uI,envmap_common_pars_fragment:dI,envmap_pars_fragment:hI,envmap_pars_vertex:fI,envmap_physical_pars_fragment:MI,envmap_vertex:pI,fog_vertex:mI,fog_pars_vertex:gI,fog_fragment:vI,fog_pars_fragment:yI,gradientmap_pars_fragment:_I,lightmap_pars_fragment:xI,lights_lambert_fragment:bI,lights_lambert_pars_fragment:wI,lights_pars_begin:SI,lights_toon_fragment:EI,lights_toon_pars_fragment:TI,lights_phong_fragment:AI,lights_phong_pars_fragment:CI,lights_physical_fragment:RI,lights_physical_pars_fragment:PI,lights_fragment_begin:II,lights_fragment_maps:DI,lights_fragment_end:LI,logdepthbuf_fragment:kI,logdepthbuf_pars_fragment:UI,logdepthbuf_pars_vertex:NI,logdepthbuf_vertex:OI,map_fragment:FI,map_pars_fragment:BI,map_particle_fragment:zI,map_particle_pars_fragment:VI,metalnessmap_fragment:GI,metalnessmap_pars_fragment:HI,morphinstance_vertex:WI,morphcolor_vertex:jI,morphnormal_vertex:XI,morphtarget_pars_vertex:qI,morphtarget_vertex:YI,normal_fragment_begin:$I,normal_fragment_maps:ZI,normal_pars_fragment:JI,normal_pars_vertex:KI,normal_vertex:QI,normalmap_pars_fragment:e3,clearcoat_normal_fragment_begin:t3,clearcoat_normal_fragment_maps:n3,clearcoat_pars_fragment:i3,iridescence_pars_fragment:r3,opaque_fragment:s3,packing:o3,premultiplied_alpha_fragment:a3,project_vertex:l3,dithering_fragment:c3,dithering_pars_fragment:u3,roughnessmap_fragment:d3,roughnessmap_pars_fragment:h3,shadowmap_pars_fragment:f3,shadowmap_pars_vertex:p3,shadowmap_vertex:m3,shadowmask_pars_fragment:g3,skinbase_vertex:v3,skinning_pars_vertex:y3,skinning_vertex:_3,skinnormal_vertex:x3,specularmap_fragment:b3,specularmap_pars_fragment:w3,tonemapping_fragment:S3,tonemapping_pars_fragment:M3,transmission_fragment:E3,transmission_pars_fragment:T3,uv_pars_fragment:A3,uv_pars_vertex:C3,uv_vertex:R3,worldpos_vertex:P3,background_vert:I3,background_frag:D3,backgroundCube_vert:L3,backgroundCube_frag:k3,cube_vert:U3,cube_frag:N3,depth_vert:O3,depth_frag:F3,distanceRGBA_vert:B3,distanceRGBA_frag:z3,equirect_vert:V3,equirect_frag:G3,linedashed_vert:H3,linedashed_frag:W3,meshbasic_vert:j3,meshbasic_frag:X3,meshlambert_vert:q3,meshlambert_frag:Y3,meshmatcap_vert:$3,meshmatcap_frag:Z3,meshnormal_vert:J3,meshnormal_frag:K3,meshphong_vert:Q3,meshphong_frag:eD,meshphysical_vert:tD,meshphysical_frag:nD,meshtoon_vert:iD,meshtoon_frag:rD,points_vert:sD,points_frag:oD,shadow_vert:aD,shadow_frag:lD,sprite_vert:cD,sprite_frag:uD},lt={common:{diffuse:{value:new st(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Yt},alphaMap:{value:null},alphaMapTransform:{value:new Yt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Yt}},envmap:{envMap:{value:null},envMapRotation:{value:new Yt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Yt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Yt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Yt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Yt},normalScale:{value:new Ue(1,1)}}
vendor: 4,814 bytes, line 3575
3575,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Yt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Yt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Yt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Yt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new st(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new st(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Yt},alphaTest:{value:0},uvTransform:{value:new Yt}},sprite:{diffuse:{value:new st(16777215)},opacity:{value:1},center:{value:new Ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Yt},alphaMap:{value:null},alphaMapTransform:{value:new Yt},alphaTest:{value:0}}},ji={basic:{uniforms:Hi([lt.common,lt.specularmap,lt.envmap,lt.aomap,lt.lightmap,lt.fog]),vertexShader:Ft.meshbasic_vert,fragmentShader:Ft.meshbasic_frag},lambert:{uniforms:Hi([lt.common,lt.specularmap,lt.envmap,lt.aomap,lt.lightmap,lt.emissivemap,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.fog,lt.lights,{emissive:{value:new st(0)}}]),vertexShader:Ft.meshlambert_vert,fragmentShader:Ft.meshlambert_frag},phong:{uniforms:Hi([lt.common,lt.specularmap,lt.envmap,lt.aomap,lt.lightmap,lt.emissivemap,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.fog,lt.lights,{emissive:{value:new st(0)},specular:{value:new st(1118481)},shininess:{value:30}}]),vertexShader:Ft.meshphong_vert,fragmentShader:Ft.meshphong_frag},standard:{uniforms:Hi([lt.common,lt.envmap,lt.aomap,lt.lightmap,lt.emissivemap,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.roughnessmap,lt.metalnessmap,lt.fog,lt.lights,{emissive:{value:new st(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ft.meshphysical_vert,fragmentShader:Ft.meshphysical_frag},toon:{uniforms:Hi([lt.common,lt.aomap,lt.lightmap,lt.emissivemap,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.gradientmap,lt.fog,lt.lights,{emissive:{value:new st(0)}}]),vertexShader:Ft.meshtoon_vert,fragmentShader:Ft.meshtoon_frag},matcap:{uniforms:Hi([lt.common,lt.bumpmap,lt.normalmap,lt.displacementmap,lt.fog,{matcap:{value:null}}]),vertexShader:Ft.meshmatcap_vert,fragmentShader:Ft.meshmatcap_frag},points:{uniforms:Hi([lt.points,lt.fog]),vertexShader:Ft.points_vert,fragmentShader:Ft.points_frag},dashed:{uniforms:Hi([lt.common,lt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ft.linedashed_vert,fragmentShader:Ft.linedashed_frag},depth:{uniforms:Hi([lt.common,lt.displacementmap]),vertexShader:Ft.depth_vert,fragmentShader:Ft.depth_frag},normal:{uniforms:Hi([lt.common,lt.bumpmap,lt.normalmap,lt.displacementmap,{opacity:{value:1}}]),vertexShader:Ft.meshnormal_vert,fragmentShader:Ft.meshnormal_frag},sprite:{uniforms:Hi([lt.sprite,lt.fog]),vertexShader:Ft.sprite_vert,fragmentShader:Ft.sprite_frag},background:{uniforms:{uvTransform:{value:new Yt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ft.background_vert,fragmentShader:Ft.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Yt}},vertexShader:Ft.backgroundCube_vert,fragmentShader:Ft.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ft.cube_vert,fragmentShader:Ft.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ft.equirect_vert,fragmentShader:Ft.equirect_frag}
vendor: 8,397 bytes, line 3575
3575,distanceRGBA:{uniforms:Hi([lt.common,lt.displacementmap,{referencePosition:{value:new V},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ft.distanceRGBA_vert,fragmentShader:Ft.distanceRGBA_frag},shadow:{uniforms:Hi([lt.lights,lt.fog,{color:{value:new st(0)},opacity:{value:1}}]),vertexShader:Ft.shadow_vert,fragmentShader:Ft.shadow_frag}};ji.physical={uniforms:Hi([ji.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Yt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Yt},clearcoatNormalScale:{value:new Ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Yt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Yt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Yt},sheen:{value:0},sheenColor:{value:new st(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Yt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Yt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Yt},transmissionSamplerSize:{value:new Ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Yt},attenuationDistance:{value:0},attenuationColor:{value:new st(0)},specularColor:{value:new st(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Yt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Yt},anisotropyVector:{value:new Ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Yt}}]),vertexShader:Ft.meshphysical_vert,fragmentShader:Ft.meshphysical_frag};const jh={r:0,b:0,g:0},Yo=new xr,dD=new St;function hD(r,e,t,n,i,s,o){const a=new st(0);let l=s===!0?0:1,c,u,d=null,h=0,f=null;function p(_){let x=_.isScene===!0?_.background:null;return x&&x.isTexture&&(x=(_.backgroundBlurriness>0?t:e).get(x)),x}function m(_){let x=!1;const T=p(_);T===null?v(a,l):T&&T.isColor&&(v(T,1),x=!0);const b=r.xr.getEnvironmentBlendMode();b==="additive"?n.buffers.color.setClear(0,0,0,1,o):b==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function g(_,x){const T=p(x);T&&(T.isCubeTexture||T.mapping===dc)?(u===void 0&&(u=new fn(new qa(1,1,1),new Dr({name:"BackgroundCubeMaterial",uniforms:sc(ji.backgroundCube.uniforms),vertexShader:ji.backgroundCube.vertexShader,fragmentShader:ji.backgroundCube.fragmentShader,side:Fi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,M,E){this.matrixWorld.copyPosition(E.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),Yo.copy(x.backgroundRotation),Yo.x*=-1,Yo.y*=-1,Yo.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Yo.y*=-1,Yo.z*=-1),u.material.uniforms.envMap.value=T,u.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(dD.makeRotationFromEuler(Yo)),u.material.toneMapped=rn.getTransfer(T.colorSpace)!==Mn,(d!==T||h!==T.version||f!==r.toneMapping)&&(u.material.needsUpdate=!0,d=T,h=T.version,f=r.toneMapping),u.layers.enableAll(),_.unshift(u,u.geometry,u.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new fn(new Zs(2,2),new Dr({name:"BackgroundMaterial",uniforms:sc(ji.background.uniforms),vertexShader:ji.background.vertexShader,fragmentShader:ji.background.fragmentShader,side:ms,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=rn.getTransfer(T.colorSpace)!==Mn,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(d!==T||h!==T.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,d=T,h=T.version,f=r.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null))}function v(_,x){_.getRGB(jh,bS(r)),n.buffers.color.setClear(jh.r,jh.g,jh.b,x,o)}function y(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(_,x=1){a.set(_),l=x,v(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(_){l=_,v(a,l)},render:m,addToRenderList:g,dispose:y}}function fD(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=h(null);let s=i,o=!1;function a(w,D,R,k,N){let H=!1;const P=d(k,R,D);s!==P&&(s=P,c(s.object)),H=f(w,k,R,N),H&&p(w,k,R,N),N!==null&&e.update(N,r.ELEMENT_ARRAY_BUFFER),(H||o)&&(o=!1,x(w,D,R,k),N!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return r.createVertexArray()}function c(w){return r.bindVertexArray(w)}function u(w){return r.deleteVertexArray(w)}function d(w,D,R){const k=R.wireframe===!0;let N=n[w.id];N===void 0&&(N={},n[w.id]=N);let H=N[D.id];H===void 0&&(H={},N[D.id]=H);let P=H[k];return P===void 0&&(P=h(l()),H[k]=P),P}function h(w){const D=[],R=[],k=[];for(let N=0;N<t;N++)D[N]=0,R[N]=0,k[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:D,enabledAttributes:R,attributeDivisors:k,object:w,attributes:{},index:null}}function f(w,D,R,k){const N=s.attributes,H=D.attributes;let P=0;const ee=R.getAttributes();for(const X in ee)if(ee[X].location>=0){const Y=N[X];let z=H[X];if(z===void 0&&(X==="instanceMatrix"&&w.instanceMatrix&&(z=w.instanceMatrix),X==="instanceColor"&&w.instanceColor&&(z=w.instanceColor)),Y===void 0||Y.attribute!==z||z&&Y.data!==z.data)return!0;P++}return s.attributesNum!==P||s.index!==k}function p(w,D,R,k){const N={},H=D.attributes;let P=0;const ee=R.getAttributes();for(const X in ee)if(ee[X].location>=0){let Y=H[X];Y===void 0&&(X==="instanceMatrix"&&w.instanceMatrix&&(Y=w.instanceMatrix),X==="instanceColor"&&w.instanceColor&&(Y=w.instanceColor));const z={};z.attribute=Y,Y&&Y.data&&(z.data=Y.data),N[X]=z,P++}s.attributes=N,s.attributesNum=P,s.index=k}function m(){const w=s.newAttributes;for(let D=0,R=w.length;D<R;D++)w[D]=0}function g(w){v(w,0)}function v(w,D){const R=s.newAttributes,k=s.enabledAttributes,N=s.attributeDivisors;R[w]=1,k[w]===0&&(r.enableVertexAttribArray(w),k[w]=1),N[w]!==D&&(r.vertexAttribDivisor(w,D),N[w]=D)}function y(){const w=s.newAttributes,D=s.enabledAttributes;for(let R=0,k=D.length;R<k;R++)D[R]!==w[R]&&(r.disableVertexAttribArray(R),D[R]=0)}function _(w,D,R,k,N,H,P){P===!0?r.vertexAttribIPointer(w,D,R,N,H):r.vertexAttribPointer(w,D,R,k,N,H)}function x(w,D,R,k){m();const N=k.attributes,H=R.getAttributes(),P=D.defaultAttributeValues;for(const ee in H){const X=H[ee];if(X.location>=0){let Q=N[ee];if(Q===void 0&&(ee==="instanceMatrix"&&w.instanceMatrix&&(Q=w.instanceMatrix),ee==="instanceColor"&&w.instanceColor&&(Q=w.instanceColor)),Q!==void 0){const Y=Q.normalized,z=Q.itemSize,K=e.get(Q);if(K===void 0)continue;const te=K.buffer,O=K.type,U=K.bytesPerElement,W=O===r.INT||O===r.UNSIGNED_INT||Q.gpuType===sm;if(Q.isInterleavedBufferAttribute){const j=Q.data,ie=j.stride,de=Q.offset;if(j.isInstancedInterleavedBuffer){for(let ye=0;ye<X.locationSize;ye++)v(X.location+ye,j.meshPerAttribute);w.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=j.meshPerAttribute*j.count)}else for(let ye=0;ye<X.locationSize;ye++)g(X.location+ye);r.bindBuffer(r.ARRAY_BUFFER,te);for(let ye=0;ye<X.locationSize;ye++)_(X.location+ye,z/X.locationSize,O,Y,ie*U,(de+z/X.locationSize*ye)*U,W)}else{if(Q.isInstancedBufferAttribute){for(let j=0;j<X.locationSize;j++)v(X.location+j,Q.meshPerAttribute);w.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=Q.meshPerAttribute*Q.count)}
vendor: 1,602 bytes, line 3575
3575else for(let j=0;j<X.locationSize;j++)g(X.location+j);r.bindBuffer(r.ARRAY_BUFFER,te);for(let j=0;j<X.locationSize;j++)_(X.location+j,z/X.locationSize,O,Y,z*U,z/X.locationSize*j*U,W)}}else if(P!==void 0){const Y=P[ee];if(Y!==void 0)switch(Y.length){case 2:r.vertexAttrib2fv(X.location,Y);break;case 3:r.vertexAttrib3fv(X.location,Y);break;case 4:r.vertexAttrib4fv(X.location,Y);break;default:r.vertexAttrib1fv(X.location,Y)}}}}y()}function T(){E();for(const w in n){const D=n[w];for(const R in D){const k=D[R];for(const N in k)u(k[N].object),delete k[N];delete D[R]}delete n[w]}}function b(w){if(n[w.id]===void 0)return;const D=n[w.id];for(const R in D){const k=D[R];for(const N in k)u(k[N].object),delete k[N];delete D[R]}delete n[w.id]}function M(w){for(const D in n){const R=n[D];if(R[w.id]===void 0)continue;const k=R[w.id];for(const N in k)u(k[N].object),delete k[N];delete R[w.id]}}function E(){S(),o=!0,s!==i&&(s=i,c(s.object))}function S(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:E,resetDefaultState:S,dispose:T,releaseStatesOfGeometry:b,releaseStatesOfProgram:M,initAttributes:m,enableAttribute:g,disableUnusedAttributes:y}}function pD(r,e,t){let n;function i(c){n=c}function s(c,u){r.drawArrays(n,c,u),t.update(u,n,1)}function o(c,u,d){d!==0&&(r.drawArraysInstanced(n,c,u,d),t.update(u,n,d))}function a(c,u,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,u,0,d);let f=0;for(let p=0;p<d;p++)f+=u[p];t.update(f,n,1)}function l(c,u,d,h){if(d===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let p=0;p<c.length;p++)o(c[p],u[p],h[p]);
vendor: 12,567 bytes, lines 3575-3650
3575else{f.multiDrawArraysInstancedWEBGL(n,c,0,u,0,h,0,d);let p=0;for(let m=0;m<d;m++)p+=u[m]*h[m];t.update(p,n,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function mD(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const M=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(M.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(M){return!(M!==qi&&n.convert(M)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(M){const E=M===hc&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(M!==$r&&n.convert(M)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&M!==ar&&!E)}function l(M){if(M==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";M="mediump"}return M==="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&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=t.logarithmicDepthBuffer===!0,h=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),v=r.getParameter(r.MAX_VERTEX_ATTRIBS),y=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),_=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),T=p>0,b=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,reverseDepthBuffer:h,maxTextures:f,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:g,maxAttributes:v,maxVertexUniforms:y,maxVaryings:_,maxFragmentUniforms:x,vertexTextures:T,maxSamples:b}}function gD(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new as,a=new Yt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,h){const f=d.length!==0||h||n!==0||i;return i=h,n=d.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,h){t=u(d,h,0)},this.setState=function(d,h,f){const p=d.clippingPlanes,m=d.clipIntersection,g=d.clipShadows,v=r.get(d);if(!i||p===null||p.length===0||s&&!g)s?u(null):c();else{const y=s?0:n,_=y*4;let x=v.clippingState||null;l.value=x,x=u(p,h,_,f);for(let T=0;T!==_;++T)x[T]=t[T];v.clippingState=x,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(d,h,f,p){const m=d!==null?d.length:0;let g=null;if(m!==0){if(g=l.value,p!==!0||g===null){const v=f+m*4,y=h.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length<v)&&(g=new Float32Array(v));for(let _=0,x=f;_!==m;++_,x+=4)o.copy(d[_]).applyMatrix4(y,a),o.normal.toArray(g,x),g[x+3]=o.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,g}}function vD(r){let e=new WeakMap;function t(o,a){return a===gu?o.mapping=Ws:a===vu&&(o.mapping=Eo),o}function n(o){if(o&&o.isTexture){const a=o.mapping;if(a===gu||a===vu)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new SS(l.height);return c.fromEquirectangularTexture(r,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Pl=4,ob=[.125,.215,.35,.446,.526,.582],ua=20,Vg=new Ja,ab=new st;let Gg=null,Hg=0,Wg=0,jg=!1;const aa=(1+Math.sqrt(5))/2,_l=1/aa,lb=[new V(-aa,_l,0),new V(aa,_l,0),new V(-_l,0,aa),new V(_l,0,aa),new V(0,aa,-_l),new V(0,aa,_l),new V(-1,1,-1),new V(1,1,-1),new V(-1,1,1),new V(1,1,1)],yD=new V;class kv{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100,s={}){const{size:o=256,position:a=yD}=s;Gg=this._renderer.getRenderTarget(),Hg=this._renderer.getActiveCubeFace(),Wg=this._renderer.getActiveMipmapLevel(),jg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,i,l,a),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=db(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ub(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Gg,Hg,Wg),this._renderer.xr.enabled=jg,e.scissorTest=!1,Xh(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ws||e.mapping===Eo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Gg=this._renderer.getRenderTarget(),Hg=this._renderer.getActiveCubeFace(),Wg=this._renderer.getActiveMipmapLevel(),jg=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:ei,minFilter:ei,generateMipmaps:!1,type:hc,format:qi,colorSpace:Fa,depthBuffer:!1},i=cb(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=cb(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=_D(s)),this._blurMaterial=xD(s,e,t)}return i}_compileMaterial(e){const t=new fn(this._lodPlanes[0],e);this._renderer.compile(t,Vg)}_sceneToCubeUV(e,t,n,i,s){const l=new Qn(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],d=this._renderer,h=d.autoClear,f=d.toneMapping;d.getClearColor(ab),d.toneMapping=hs,d.autoClear=!1;const p=new Bi({name:"PMREM.Background",side:Fi,depthWrite:!1,depthTest:!1}),m=new fn(new qa,p);let g=!1;const v=e.background;v?v.isColor&&(p.color.copy(v),e.background=null,g=!0):(p.color.copy(ab),g=!0);for(let y=0;y<6;y++){const _=y%3;_===0?(l.up.set(0,c[y],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[y],s.y,s.z)):_===1?(l.up.set(0,0,c[y]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[y],s.z)):(l.up.set(0,c[y],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[y]));const x=this._cubeSize;Xh(i,_*x,y>2?x:0,x,x),d.setRenderTarget(i),g&&d.render(m,l),d.render(e,l)}m.geometry.dispose(),m.material.dispose(),d.toneMapping=f,d.autoClear=h,e.background=v}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Ws||e.mapping===Eo;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=db()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ub());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new fn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Xh(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Vg)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),a=lb[(i-s-1)%lb.length];this._blur(e,s-1,s,o,a)}t.autoClear=n}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,d=new fn(this._lodPlanes[i],c),h=c.uniforms,f=this._sizeLods[n]-1,p=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*ua-1),m=s/p,g=isFinite(s)?1+Math.floor(u*m):ua;g>ua&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${ua}`);const v=[];let y=0;for(let M=0;M<ua;++M){const E=M/m,S=Math.exp(-E*E/2);v.push(S),M===0?y+=S:M<g&&(y+=2*S)}for(let M=0;M<v.length;M++)v[M]=v[M]/y;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=v,h.latitudinal.value=o==="latitudinal",a&&(h.poleAxis.value=a);const{_lodMax:_}=this;h.dTheta.value=p,h.mipInt.value=_-n;const x=this._sizeLods[i],T=3*x*(i>_-Pl?i-_+Pl:0),b=4*(this._cubeSize-x);Xh(t,T,b,3*x,2*x),l.setRenderTarget(t),l.render(d,Vg)}}function _D(r){const e=[],t=[],n=[];let i=r;const s=r-Pl+1+ob.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);t.push(a);let l=1/a;o>r-Pl?l=ob[o-r+Pl-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,d=1+c,h=[u,u,d,u,d,d,u,u,d,d,u,d],f=6,p=6,m=3,g=2,v=1,y=new Float32Array(m*p*f),_=new Float32Array(g*p*f),x=new Float32Array(v*p*f);for(let b=0;b<f;b++){const M=b%3*2/3-1,E=b>2?0:-1,S=[M,E,0,M+2/3,E,0,M+2/3,E+1,0,M,E,0,M+2/3,E+1,0,M,E+1,0];y.set(S,m*p*b),_.set(h,g*p*b);const w=[b,b,b,b,b,b];x.set(w,v*p*b)}const T=new Ht;T.setAttribute("position",new Zt(y,m)),T.setAttribute("uv",new Zt(_,g)),T.setAttribute("faceIndex",new Zt(x,v)),e.push(T),i>Pl&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function cb(r,e,t){const n=new gs(r,e,t);return n.texture.mapping=dc,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Xh(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function xD(r,e,t){const n=new Float32Array(ua),i=new V(0,1,0);return new Dr({name:"SphericalGaussianBlur",defines:{n:ua,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:Uy(),fragmentShader:`
3576
3577			precision mediump float;
3578			precision mediump int;
3579
3580			varying vec3 vOutputDirection;
3581
3582			uniform sampler2D envMap;
3583			uniform int samples;
3584			uniform float weights[ n ];
3585			uniform bool latitudinal;
3586			uniform float dTheta;
3587			uniform float mipInt;
3588			uniform vec3 poleAxis;
3589
3590			#define ENVMAP_TYPE_CUBE_UV
3591			#include <cube_uv_reflection_fragment>
3592
3593			vec3 getSample( float theta, vec3 axis ) {
3594
3595				float cosTheta = cos( theta );
3596				// Rodrigues' axis-angle rotation
3597				vec3 sampleDirection = vOutputDirection * cosTheta
3598					+ cross( axis, vOutputDirection ) * sin( theta )
3599					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3600
3601				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3602
3603			}
3604
3605			void main() {
3606
3607				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3608
3609				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3610
3611					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3612
3613				}
3614
3615				axis = normalize( axis );
3616
3617				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3618				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3619
3620				for ( int i = 1; i < n; i++ ) {
3621
3622					if ( i >= samples ) {
3623
3624						break;
3625
3626					}
3627
3628					float theta = dTheta * float( i );
3629					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3630					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3631
3632				}
3633
3634			}
3635		`,blending:Gs,depthTest:!1,depthWrite:!1})}function ub(){return new Dr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Uy(),fragmentShader:`
3636
3637			precision mediump float;
3638			precision mediump int;
3639
3640			varying vec3 vOutputDirection;
3641
3642			uniform sampler2D envMap;
3643
3644			#include <common>
3645
3646			void main() {
3647
3648				vec3 outputDirection = normalize( vOutputDirection );
3649				vec2 uv = equirectUv( outputDirection );
3650
3651				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3652
3653			}
3654		`,blending:Gs,depthTest:!1,depthWrite:!1})}function db(){return new Dr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Uy(),fragmentShader:`
3655
3656			precision mediump float;
3657			precision mediump int;
3658
3659			uniform float flipEnvMap;
3660
3661			varying vec3 vOutputDirection;
3662
3663			uniform samplerCube envMap;
3664
3665			void main() {
3666
3667				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3668
3669			}
3670		`,blending:Gs,depthTest:!1,depthWrite:!1})}function Uy(){return`
3671
3672		precision mediump float;
3673		precision mediump int;
3674
3675		attribute float faceIndex;
3676
3677		varying vec3 vOutputDirection;
3678
3679		// RH coordinate system; PMREM face-indexing convention
3680		vec3 getDirection( vec2 uv, float face ) {
3681
3682			uv = 2.0 * uv - 1.0;
3683
3684			vec3 direction = vec3( uv, 1.0 );
3685
3686			if ( face == 0.0 ) {
3687
3688				direction = direction.zyx; // ( 1, v, u ) pos x
3689
3690			} else if ( face == 1.0 ) {
3691
3692				direction = direction.xzy;
3693				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3694
3695			} else if ( face == 2.0 ) {
3696
3697				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3698
3699			} else if ( face == 3.0 ) {
3700
3701				direction = direction.zyx;
3702				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3703
3704			} else if ( face == 4.0 ) {
3705
3706				direction = direction.xzy;
3707				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3708
3709			} else if ( face == 5.0 ) {
3710
3711				direction.z *= -1.0; // ( u, v, -1 ) neg z
3712
3713			}
3714
3715			return direction;
3716
3717		}
3718
3719		void main() {
3720
3721			vOutputDirection = getDirection( uv, faceIndex );
3722			gl_Position = vec4( position, 1.0 );
3723
3724		}
3725	`}function bD(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===gu||l===vu,u=l===Ws||l===Eo;if(c||u){let d=e.get(a);const h=d!==void 0?d.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return t===null&&(t=new kv(r)),d=c?t.fromEquirectangular(a,d):t.fromCubemap(a,d),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),d.texture;if(d!==void 0)return d.texture;{const f=a.image;return c&&f&&f.height>0||u&&f&&i(f)?(t===null&&(t=new kv(r)),d=c?t.fromEquirectangular(a):t.fromCubemap(a),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),a.addEventListener("dispose",s),d.texture):null}}}return a}function i(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function wD(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default: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&&kl("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function SD(r,e,t,n){const i={},s=new WeakMap;function o(d){const h=d.target;h.index!==null&&e.remove(h.index);for(const p in h.attributes)e.remove(h.attributes[p]);h.removeEventListener("dispose",o),delete i[h.id];const f=s.get(h);f&&(e.remove(f),s.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function a(d,h){return i[h.id]===!0||(h.addEventListener("dispose",o),i[h.id]=!0,t.memory.geometries++),h}function l(d){const h=d.attributes;for(const f in h)e.update(h[f],r.ARRAY_BUFFER)}function c(d){const h=[],f=d.index,p=d.attributes.position;let m=0;if(f!==null){const y=f.array;m=f.version;for(let _=0,x=y.length;_<x;_+=3){const T=y[_+0],b=y[_+1],M=y[_+2];h.push(T,b,b,M,M,T)}}else if(p!==void 0){const y=p.array;m=p.version;for(let _=0,x=y.length/3-1;_<x;_+=3){const T=_+0,b=_+1,M=_+2;h.push(T,b,b,M,M,T)}}else return;const g=new(vS(h)?ay:oy)(h,1);g.version=m;const v=s.get(d);v&&e.remove(v),s.set(d,g)}function u(d){const h=s.get(d);if(h){const f=d.index;f!==null&&h.version<f.version&&c(d)}else c(d);return s.get(d)}return{get:a,update:l,getWireframeAttribute:u}}function MD(r,e,t){let n;function i(h){n=h}let s,o;function a(h){s=h.type,o=h.bytesPerElement}function l(h,f){r.drawElements(n,f,s,h*o),t.update(f,n,1)}function c(h,f,p){p!==0&&(r.drawElementsInstanced(n,f,s,h*o,p),t.update(f,n,p))}function u(h,f,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,h,0,p);let g=0;for(let v=0;v<p;v++)g+=f[v];t.update(g,n,1)}function d(h,f,p,m){if(p===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let v=0;v<h.length;v++)c(h[v]/o,f[v],m[v]);
vendor: 17,414 bytes, lines 3725-3760
3725else{g.multiDrawElementsInstancedWEBGL(n,f,0,s,h,0,m,0,p);let v=0;for(let y=0;y<p;y++)v+=f[y]*m[y];t.update(v,n,1)}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=d}function ED(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=a*(s/3);break;case r.LINES:t.lines+=a*(s/2);break;case r.LINE_STRIP:t.lines+=a*(s-1);break;case r.LINE_LOOP:t.lines+=a*s;break;case r.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);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 TD(r,e,t){const n=new WeakMap,i=new Kt;function s(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,d=u!==void 0?u.length:0;let h=n.get(a);if(h===void 0||h.count!==d){let S=function(){M.dispose(),n.delete(a),a.removeEventListener("dispose",S)};h!==void 0&&h.texture.dispose();const f=a.morphAttributes.position!==void 0,p=a.morphAttributes.normal!==void 0,m=a.morphAttributes.color!==void 0,g=a.morphAttributes.position||[],v=a.morphAttributes.normal||[],y=a.morphAttributes.color||[];let _=0;f===!0&&(_=1),p===!0&&(_=2),m===!0&&(_=3);let x=a.attributes.position.count*_,T=1;x>e.maxTextureSize&&(T=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);const b=new Float32Array(x*T*4*d),M=new hm(b,x,T,d);M.type=ar,M.needsUpdate=!0;const E=_*4;for(let w=0;w<d;w++){const D=g[w],R=v[w],k=y[w],N=x*T*4*w;for(let H=0;H<D.count;H++){const P=H*E;f===!0&&(i.fromBufferAttribute(D,H),b[N+P+0]=i.x,b[N+P+1]=i.y,b[N+P+2]=i.z,b[N+P+3]=0),p===!0&&(i.fromBufferAttribute(R,H),b[N+P+4]=i.x,b[N+P+5]=i.y,b[N+P+6]=i.z,b[N+P+7]=0),m===!0&&(i.fromBufferAttribute(k,H),b[N+P+8]=i.x,b[N+P+9]=i.y,b[N+P+10]=i.z,b[N+P+11]=k.itemSize===4?i.w:1)}}h={count:d,texture:M,size:new Ue(x,T)},n.set(a,h),a.addEventListener("dispose",S)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",o.morphTexture,t);else{let f=0;for(let m=0;m<c.length;m++)f+=c[m];const p=a.morphTargetsRelative?1:1-f;l.getUniforms().setValue(r,"morphTargetBaseInfluence",p),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",h.size)}return{update:s}}function AD(r,e,t,n){let i=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,d=e.get(l,u);if(i.get(d)!==c&&(e.update(d),i.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),i.get(l)!==c&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const h=l.skeleton;i.get(h)!==c&&(h.update(),i.set(h,c))}return d}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}const fM=new Wn,hb=new cy(1,1),pM=new hm,mM=new fm,gM=new Gd,fb=[],pb=[],mb=new Float32Array(16),gb=new Float32Array(9),vb=new Float32Array(4);function vc(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=fb[i];if(s===void 0&&(s=new Float32Array(i),fb[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function di(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 hi(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function zm(r,e){let t=pb[e];t===void 0&&(t=new Int32Array(e),pb[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function CD(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function RD(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(di(t,e))return;r.uniform2fv(this.addr,e),hi(t,e)}}function PD(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(di(t,e))return;r.uniform3fv(this.addr,e),hi(t,e)}}function ID(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(di(t,e))return;r.uniform4fv(this.addr,e),hi(t,e)}}function DD(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(di(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),hi(t,e)}else{if(di(t,n))return;vb.set(n),r.uniformMatrix2fv(this.addr,!1,vb),hi(t,n)}}function LD(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(di(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),hi(t,e)}else{if(di(t,n))return;gb.set(n),r.uniformMatrix3fv(this.addr,!1,gb),hi(t,n)}}function kD(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(di(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),hi(t,e)}else{if(di(t,n))return;mb.set(n),r.uniformMatrix4fv(this.addr,!1,mb),hi(t,n)}}function UD(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function ND(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(di(t,e))return;r.uniform2iv(this.addr,e),hi(t,e)}}function OD(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(di(t,e))return;r.uniform3iv(this.addr,e),hi(t,e)}}function FD(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(di(t,e))return;r.uniform4iv(this.addr,e),hi(t,e)}}function BD(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function zD(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(di(t,e))return;r.uniform2uiv(this.addr,e),hi(t,e)}}function VD(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(di(t,e))return;r.uniform3uiv(this.addr,e),hi(t,e)}}function GD(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(di(t,e))return;r.uniform4uiv(this.addr,e),hi(t,e)}}function HD(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?(hb.compareFunction=iy,s=hb):s=fM,t.setTexture2D(e||s,i)}function WD(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||mM,i)}function jD(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||gM,i)}function XD(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||pM,i)}function qD(r){switch(r){case 5126:return CD;case 35664:return RD;case 35665:return PD;case 35666:return ID;case 35674:return DD;case 35675:return LD;case 35676:return kD;case 5124:case 35670:return UD;case 35667:case 35671:return ND;case 35668:case 35672:return OD;case 35669:case 35673:return FD;case 5125:return BD;case 36294:return zD;case 36295:return VD;case 36296:return GD;case 35678:case 36198:case 36298:case 36306:case 35682:return HD;case 35679:case 36299:case 36307:return WD;case 35680:case 36300:case 36308:case 36293:return jD;case 36289:case 36303:case 36311:case 36292:return XD}}function YD(r,e){r.uniform1fv(this.addr,e)}function $D(r,e){const t=vc(e,this.size,2);r.uniform2fv(this.addr,t)}function ZD(r,e){const t=vc(e,this.size,3);r.uniform3fv(this.addr,t)}function JD(r,e){const t=vc(e,this.size,4);r.uniform4fv(this.addr,t)}function KD(r,e){const t=vc(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function QD(r,e){const t=vc(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function eL(r,e){const t=vc(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function tL(r,e){r.uniform1iv(this.addr,e)}function nL(r,e){r.uniform2iv(this.addr,e)}function iL(r,e){r.uniform3iv(this.addr,e)}function rL(r,e){r.uniform4iv(this.addr,e)}function sL(r,e){r.uniform1uiv(this.addr,e)}function oL(r,e){r.uniform2uiv(this.addr,e)}function aL(r,e){r.uniform3uiv(this.addr,e)}function lL(r,e){r.uniform4uiv(this.addr,e)}function cL(r,e,t){const n=this.cache,i=e.length,s=zm(t,i);di(n,s)||(r.uniform1iv(this.addr,s),hi(n,s));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||fM,s[o])}function uL(r,e,t){const n=this.cache,i=e.length,s=zm(t,i);di(n,s)||(r.uniform1iv(this.addr,s),hi(n,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||mM,s[o])}function dL(r,e,t){const n=this.cache,i=e.length,s=zm(t,i);di(n,s)||(r.uniform1iv(this.addr,s),hi(n,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||gM,s[o])}function hL(r,e,t){const n=this.cache,i=e.length,s=zm(t,i);di(n,s)||(r.uniform1iv(this.addr,s),hi(n,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||pM,s[o])}function fL(r){switch(r){case 5126:return YD;case 35664:return $D;case 35665:return ZD;case 35666:return JD;case 35674:return KD;case 35675:return QD;case 35676:return eL;case 5124:case 35670:return tL;case 35667:case 35671:return nL;case 35668:case 35672:return iL;case 35669:case 35673:return rL;case 5125:return sL;case 36294:return oL;case 36295:return aL;case 36296:return lL;case 35678:case 36198:case 36298:case 36306:case 35682:return cL;case 35679:case 36299:case 36307:return uL;case 35680:case 36300:case 36308:case 36293:return dL;case 36289:case 36303:case 36311:case 36292:return hL}}class pL{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=qD(t.type)}}class mL{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=fL(t.type)}}class gL{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,t[a.id],n)}}}const Xg=/(\w+)(\])?(\[|\.)?/g;function yb(r,e){r.seq.push(e),r.map[e.id]=e}function vL(r,e,t){const n=r.name,i=n.length;for(Xg.lastIndex=0;;){const s=Xg.exec(n),o=Xg.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){yb(t,c===void 0?new pL(a,r,e):new mL(a,r,e));break}else{let d=t.map[a];d===void 0&&(d=new gL(a),yb(t,d)),t=d}}}class Tf{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),o=e.getUniformLocation(t,s.name);vL(s,o,this)}}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,o=t.length;s!==o;++s){const a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in t&&n.push(o)}return n}}function _b(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const yL=37297;let _L=0;function xL(r,e){const t=r.split(`
3726`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=i;o<s;o++){const a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(`
3727`)}const xb=new Yt;function bL(r){rn._getMatrix(xb,rn.workingColorSpace,r);const e=`mat3( ${xb.elements.map(t=>t.toFixed(4))} )`;switch(rn.getTransfer(r)){case bu:return[e,"LinearTransferOETF"];case Mn:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function bb(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
3728
3729`+i+`
3730
3731`+xL(r.getShaderSource(e),o)}else return i}function wL(r,e){const t=bL(e);return[`vec4 ${r}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3732`)}function SL(r,e){let t;switch(e){case K1:t="Linear";break;case Q1:t="Reinhard";break;case eS:t="Cineon";break;case tS:t="ACESFilmic";break;case X0:t="AgX";break;case iS:t="Neutral";break;case nS:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const qh=new V;function ML(){rn.getLuminanceCoefficients(qh);const r=qh.x.toFixed(4),e=qh.y.toFixed(4),t=qh.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
3733`)}function EL(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Yc).join(`
3734`)}function TL(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3735`)}function AL(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),o=s.name;let a=1;s.type===r.FLOAT_MAT2&&(a=2),s.type===r.FLOAT_MAT3&&(a=3),s.type===r.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:r.getAttribLocation(e,o),locationSize:a}}return t}function Yc(r){return r!==""}function wb(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 Sb(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const CL=/^[ \t]*#include +<([\w\d./]+)>/gm;function Uv(r){return r.replace(CL,PL)}const RL=new Map;function PL(r,e){let t=Ft[e];if(t===void 0){const n=RL.get(e);if(n!==void 0)t=Ft[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Uv(t)}const IL=/#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 Mb(r){return r.replace(IL,DL)}function DL(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 Eb(r){let e=`precision ${r.precision} float;
3736	precision ${r.precision} int;
3737	precision ${r.precision} sampler2D;
3738	precision ${r.precision} samplerCube;
3739	precision ${r.precision} sampler3D;
3740	precision ${r.precision} sampler2DArray;
3741	precision ${r.precision} sampler2DShadow;
3742	precision ${r.precision} samplerCubeShadow;
3743	precision ${r.precision} sampler2DArrayShadow;
3744	precision ${r.precision} isampler2D;
3745	precision ${r.precision} isampler3D;
3746	precision ${r.precision} isamplerCube;
3747	precision ${r.precision} isampler2DArray;
3748	precision ${r.precision} usampler2D;
3749	precision ${r.precision} usampler3D;
3750	precision ${r.precision} usamplerCube;
3751	precision ${r.precision} usampler2DArray;
3752	`;return r.precision==="highp"?e+=`
3753#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
3754#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
3755#define LOW_PRECISION`),e}function LL(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===j0?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===Bf?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===is&&(e="SHADOWMAP_TYPE_VSM"),e}function kL(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Ws:case Eo:e="ENVMAP_TYPE_CUBE";break;case dc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function UL(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Eo:e="ENVMAP_MODE_REFRACTION";break}return e}function NL(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case Bd:e="ENVMAP_BLENDING_MULTIPLY";break;case Z1:e="ENVMAP_BLENDING_MIX";break;case J1:e="ENVMAP_BLENDING_ADD";break}return e}function OL(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 FL(r,e,t,n){const i=r.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=LL(t),c=kL(t),u=UL(t),d=NL(t),h=OL(t),f=EL(t),p=TL(s),m=i.createProgram();let g,v,y=t.glslVersion?"#version "+t.glslVersion+`
3756`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Yc).join(`
3757`),g.length>0&&(g+=`
3758`),v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Yc).join(`
3759`),v.length>0&&(v+=`
3760`)):(g=[Eb(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionCl
vendor: 6,454 bytes, lines 3760-3762
3760ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
3761`].filter(Yc).join(`
3762`),v=[Eb(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,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 "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.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_IR
3762IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==hs?"#define TONE_MAPPING":"",t.toneMapping!==hs?Ft.tonemapping_pars_fragment:"",t.toneMapping!==hs?SL("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ft.colorspace_pars_fragment,wL("linearToOutputTexel",t.outputColorSpace),ML(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3763`].filter(Yc).join(`
3764`)),o=Uv(o),o=wb(o,t),o=Sb(o,t),a=Uv(a),a=wb(a,t),a=Sb(a,t),o=Mb(o),a=Mb(a),t.isRawShaderMaterial!==!0&&(y=`#version 300 es
3765`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3766`)+`
3767`+g,v=["#define varying in",t.glslVersion===Av?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Av?"":"#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(`
3768`)+`
3769`+v);const _=y+g+o,x=y+v+a,T=_b(i,i.VERTEX_SHADER,_),b=_b(i,i.FRAGMENT_SHADER,x);i.attachShader(m,T),i.attachShader(m,b),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m);function M(D){if(r.debug.checkShaderErrors){const R=i.getProgramInfoLog(m).trim(),k=i.getShaderInfoLog(T).trim(),N=i.getShaderInfoLog(b).trim();let H=!0,P=!0;if(i.getProgramParameter(m,i.LINK_STATUS)===!1)if(H=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,m,T,b);else{const ee=bb(i,T,"vertex"),X=bb(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,i.VALIDATE_STATUS)+`
3770
3771Material Name: `+D.name+`
3772Material Type: `+D.type+`
3773
3774Program Info Log: `+R+`
3775`+ee+`
3776`+X)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(k===""||N==="")&&(P=!1);P&&(D.diagnostics={runnable:H,programLog:R,vertexShader:{log:k,prefix:g},fragmentShader:{log:N,prefix:v}})}i.deleteShader(T),i.deleteShader(b),E=new Tf(i,m),S=AL(i,m)}let E;this.getUniforms=function(){return E===void 0&&M(this),E};let S;this.getAttributes=function(){return S===void 0&&M(this),S};let w=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return w===!1&&(w=i.getProgramParameter(m,yL)),w},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=_L++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=T,this.fragmentShader=b,this}let BL=0;class zL{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new VL(e),t.set(e,n)),n}}class VL{constructor(e){this.id=BL++,this.code=e,this.usedTimes=0}}function GL(r,e,t,n,i,s,o){const a=new pm,l=new zL,c=new Set,u=[],d=i.logarithmicDepthBuffer,h=i.vertexTextures;let f=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(S){return c.add(S),S===0?"uv":`uv${S}`}function g(S,w,D,R,k){const N=R.fog,H=k.geometry,P=S.isMeshStandardMaterial?R.environment:null,ee=(S.isMeshStandardMaterial?t:e).get(S.envMap||P),X=ee&&ee.mapping===dc?ee.image.height:null,Q=p[S.type];S.precision!==null&&(f=i.getMaxPrecision(S.precision),f!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",f,"instead."));const Y=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,z=Y!==void 0?Y.length:0;let K=0;H.morphAttributes.position!==void 0&&(K=1),H.morphAttributes.normal!==void 0&&(K=2),H.morphAttributes.color!==void 0&&(K=3);let te,O,U,W;
vendor: 23,553 bytes, lines 3776-3804
3776if(Q){const ft=ji[Q];te=ft.vertexShader,O=ft.fragmentShader}else te=S.vertexShader,O=S.fragmentShader,l.update(S),U=l.getVertexShaderID(S),W=l.getFragmentShaderID(S);const j=r.getRenderTarget(),ie=r.state.buffers.depth.getReversed(),de=k.isInstancedMesh===!0,ye=k.isBatchedMesh===!0,we=!!S.map,_e=!!S.matcap,Re=!!ee,F=!!S.aoMap,pe=!!S.lightMap,me=!!S.bumpMap,be=!!S.normalMap,se=!!S.displacementMap,Se=!!S.emissiveMap,he=!!S.metalnessMap,le=!!S.roughnessMap,He=S.anisotropy>0,B=S.clearcoat>0,A=S.dispersion>0,ne=S.iridescence>0,ge=S.sheen>0,ue=S.transmission>0,ce=He&&!!S.anisotropyMap,Ne=B&&!!S.clearcoatMap,De=B&&!!S.clearcoatNormalMap,$e=B&&!!S.clearcoatRoughnessMap,Je=ne&&!!S.iridescenceMap,Ee=ne&&!!S.iridescenceThicknessMap,Ge=ge&&!!S.sheenColorMap,Ye=ge&&!!S.sheenRoughnessMap,it=!!S.specularMap,Ze=!!S.specularColorMap,ht=!!S.specularIntensityMap,oe=ue&&!!S.transmissionMap,Oe=ue&&!!S.thicknessMap,ke=!!S.gradientMap,Xe=!!S.alphaMap,Me=S.alphaTest>0,Ce=!!S.alphaHash,nt=!!S.extensions;let ct=hs;S.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(ct=r.toneMapping);const dt={shaderID:Q,shaderType:S.type,shaderName:S.name,vertexShader:te,fragmentShader:O,defines:S.defines,customVertexShaderID:U,customFragmentShaderID:W,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:f,batching:ye,batchingColor:ye&&k._colorsTexture!==null,instancing:de,instancingColor:de&&k.instanceColor!==null,instancingMorph:de&&k.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:j===null?r.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:Fa,alphaToCoverage:!!S.alphaToCoverage,map:we,matcap:_e,envMap:Re,envMapMode:Re&&ee.mapping,envMapCubeUVHeight:X,aoMap:F,lightMap:pe,bumpMap:me,normalMap:be,displacementMap:h&&se,emissiveMap:Se,normalMapObjectSpace:be&&S.normalMapType===cS,normalMapTangentSpace:be&&S.normalMapType===Ao,metalnessMap:he,roughnessMap:le,anisotropy:He,anisotropyMap:ce,clearcoat:B,clearcoatMap:Ne,clearcoatNormalMap:De,clearcoatRoughnessMap:$e,dispersion:A,iridescence:ne,iridescenceMap:Je,iridescenceThicknessMap:Ee,sheen:ge,sheenColorMap:Ge,sheenRoughnessMap:Ye,specularMap:it,specularColorMap:Ze,specularIntensityMap:ht,transmission:ue,transmissionMap:oe,thicknessMap:Oe,gradientMap:ke,opaque:S.transparent===!1&&S.blending===Ia&&S.alphaToCoverage===!1,alphaMap:Xe,alphaTest:Me,alphaHash:Ce,combine:S.combine,mapUv:we&&m(S.map.channel),aoMapUv:F&&m(S.aoMap.channel),lightMapUv:pe&&m(S.lightMap.channel),bumpMapUv:me&&m(S.bumpMap.channel),normalMapUv:be&&m(S.normalMap.channel),displacementMapUv:se&&m(S.displacementMap.channel),emissiveMapUv:Se&&m(S.emissiveMap.channel),metalnessMapUv:he&&m(S.metalnessMap.channel),roughnessMapUv:le&&m(S.roughnessMap.channel),anisotropyMapUv:ce&&m(S.anisotropyMap.channel),clearcoatMapUv:Ne&&m(S.clearcoatMap.channel),clearcoatNormalMapUv:De&&m(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:$e&&m(S.clearcoatRoughnessMap.channel),iridescenceMapUv:Je&&m(S.iridescenceMap.channel),iridescenceThicknessMapUv:Ee&&m(S.iridescenceThicknessMap.channel),sheenColorMapUv:Ge&&m(S.sheenColorMap.channel),sheenRoughnessMapUv:Ye&&m(S.sheenRoughnessMap.channel),specularMapUv:it&&m(S.specularMap.channel),specularColorMapUv:Ze&&m(S.specularColorMap.channel),specularIntensityMapUv:ht&&m(S.specularIntensityMap.channel),transmissionMapUv:oe&&m(S.transmissionMap.channel),thicknessMapUv:Oe&&m(S.thicknessMap.channel),alphaMapUv:Xe&&m(S.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(be||He),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!H.attributes.uv&&(we||Xe),fog:!!N,useFog:S.fog===!0,fogExp2:!!N&&N.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:ie,skinning:k.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:z,morphTextureStride:K,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:S.dithering,shadowMapEnabled:r.shadowMap.enabled&&D.length>0,shadowMapType:r.shadowMap.type,toneMapping:ct,decodeVideoTexture:we&&S.map.isVideoTexture===!0&&rn.getTransfer(S.map.colorSpace)===Mn,decodeVideoTextureEmissive:Se&&S.emissiveMap.isVideoTexture===!0&&rn.getTransfer(S.emissiveMap.colorSpace)===Mn,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===si,flipSided:S.side===Fi,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:nt&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(nt&&S.extensions.multiDraw===!0||ye)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return dt.vertexUv1s=c.has(1),dt.vertexUv2s=c.has(2),dt.vertexUv3s=c.has(3),c.clear(),dt}function v(S){const w=[];if(S.shaderID?w.push(S.shaderID):(w.push(S.customVertexShaderID),w.push(S.customFragmentShaderID)),S.defines!==void 0)for(const D in S.defines)w.push(D),w.push(S.defines[D]);return S.isRawShaderMaterial===!1&&(y(w,S),_(w,S),w.push(r.outputColorSpace)),w.push(S.customProgramCacheKey),w.join()}function y(S,w){S.push(w.precision),S.push(w.outputColorSpace),S.push(w.envMapMode),S.push(w.envMapCubeUVHeight),S.push(w.mapUv),S.push(w.alphaMapUv),S.push(w.lightMapUv),S.push(w.aoMapUv),S.push(w.bumpMapUv),S.push(w.normalMapUv),S.push(w.displacementMapUv),S.push(w.emissiveMapUv),S.push(w.metalnessMapUv),S.push(w.roughnessMapUv),S.push(w.anisotropyMapUv),S.push(w.clearcoatMapUv),S.push(w.clearcoatNormalMapUv),S.push(w.clearcoatRoughnessMapUv),S.push(w.iridescenceMapUv),S.push(w.iridescenceThicknessMapUv),S.push(w.sheenColorMapUv),S.push(w.sheenRoughnessMapUv),S.push(w.specularMapUv),S.push(w.specularColorMapUv),S.push(w.specularIntensityMapUv),S.push(w.transmissionMapUv),S.push(w.thicknessMapUv),S.push(w.combine),S.push(w.fogExp2),S.push(w.sizeAttenuation),S.push(w.morphTargetsCount),S.push(w.morphAttributeCount),S.push(w.numDirLights),S.push(w.numPointLights),S.push(w.numSpotLights),S.push(w.numSpotLightMaps),S.push(w.numHemiLights),S.push(w.numRectAreaLights),S.push(w.numDirLightShadows),S.push(w.numPointLightShadows),S.push(w.numSpotLightShadows),S.push(w.numSpotLightShadowsWithMaps),S.push(w.numLightProbes),S.push(w.shadowMapType),S.push(w.toneMapping),S.push(w.numClippingPlanes),S.push(w.numClipIntersection),S.push(w.depthPacking)}function _(S,w){a.disableAll(),w.supportsVertexTextures&&a.enable(0),w.instancing&&a.enable(1),w.instancingColor&&a.enable(2),w.instancingMorph&&a.enable(3),w.matcap&&a.enable(4),w.envMap&&a.enable(5),w.normalMapObjectSpace&&a.enable(6),w.normalMapTangentSpace&&a.enable(7),w.clearcoat&&a.enable(8),w.iridescence&&a.enable(9),w.alphaTest&&a.enable(10),w.vertexColors&&a.enable(11),w.vertexAlphas&&a.enable(12),w.vertexUv1s&&a.enable(13),w.vertexUv2s&&a.enable(14),w.vertexUv3s&&a.enable(15),w.vertexTangents&&a.enable(16),w.anisotropy&&a.enable(17),w.alphaHash&&a.enable(18),w.batching&&a.enable(19),w.dispersion&&a.enable(20),w.batchingColor&&a.enable(21),S.push(a.mask),a.disableAll(),w.fog&&a.enable(0),w.useFog&&a.enable(1),w.flatShading&&a.enable(2),w.logarithmicDepthBuffer&&a.enable(3),w.reverseDepthBuffer&&a.enable(4),w.skinning&&a.enable(5),w.morphTargets&&a.enable(6),w.morphNormals&&a.enable(7),w.morphColors&&a.enable(8),w.premultipliedAlpha&&a.enable(9),w.shadowMapEnabled&&a.enable(10),w.doubleSided&&a.enable(11),w.flipSided&&a.enable(12),w.useDepthPacking&&a.enable(13),w.dithering&&a.enable(14),w.transmission&&a.enable(15),w.sheen&&a.enable(16),w.opaque&&a.enable(17),w.pointsUvs&&a.enable(18),w.decodeVideoTexture&&a.enable(19),w.decodeVideoTextureEmissive&&a.enable(20),w.alphaToCoverage&&a.enable(21),S.push(a.mask)}function x(S){const w=p[S.type];let D;if(w){const R=ji[w];D=Vd.clone(R.uniforms)}else D=S.uniforms;return D}function T(S,w){let D;for(let R=0,k=u.length;R<k;R++){const N=u[R];if(N.cacheKey===w){D=N,++D.usedTimes;break}}return D===void 0&&(D=new FL(r,w,S,s),u.push(D)),D}function b(S){if(--S.usedTimes===0){const w=u.indexOf(S);u[w]=u[u.length-1],u.pop(),S.destroy()}}function M(S){l.remove(S)}function E(){l.dispose()}return{getParameters:g,getProgramCacheKey:v,getUniforms:x,acquireProgram:T,releaseProgram:b,releaseShaderCache:M,programs:u,dispose:E}}function HL(){let r=new WeakMap;function e(o){return r.has(o)}function t(o){let a=r.get(o);return a===void 0&&(a={},r.set(o,a)),a}function n(o){r.delete(o)}function i(o,a,l){r.get(o)[a]=l}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function WL(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.z!==e.z?r.z-e.z:r.id-e.id}function Tb(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 Ab(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(d,h,f,p,m,g){let v=r[e];return v===void 0?(v={id:d.id,object:d,geometry:h,material:f,groupOrder:p,renderOrder:d.renderOrder,z:m,group:g},r[e]=v):(v.id=d.id,v.object=d,v.geometry=h,v.material=f,v.groupOrder=p,v.renderOrder=d.renderOrder,v.z=m,v.group=g),e++,v}function a(d,h,f,p,m,g){const v=o(d,h,f,p,m,g);f.transmission>0?n.push(v):f.transparent===!0?i.push(v):t.push(v)}function l(d,h,f,p,m,g){const v=o(d,h,f,p,m,g);f.transmission>0?n.unshift(v):f.transparent===!0?i.unshift(v):t.unshift(v)}function c(d,h){t.length>1&&t.sort(d||WL),n.length>1&&n.sort(h||Tb),i.length>1&&i.sort(h||Tb)}function u(){for(let d=e,h=r.length;d<h;d++){const f=r[d];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:a,unshift:l,finish:u,sort:c}}function jL(){let r=new WeakMap;function e(n,i){const s=r.get(n);let o;return s===void 0?(o=new Ab,r.set(n,[o])):i>=s.length?(o=new Ab,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function XL(){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 V,color:new st};break;case"SpotLight":t={position:new V,direction:new V,color:new st,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new V,color:new st,distance:0,decay:0};break;case"HemisphereLight":t={direction:new V,skyColor:new st,groundColor:new st};break;case"RectAreaLight":t={color:new st,position:new V,halfWidth:new V,halfHeight:new V};break}return r[e.id]=t,t}}}function qL(){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 Ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let YL=0;function $L(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function ZL(r){const e=new XL,t=qL(),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 V);const i=new V,s=new St,o=new St;function a(c){let u=0,d=0,h=0;for(let S=0;S<9;S++)n.probe[S].set(0,0,0);let f=0,p=0,m=0,g=0,v=0,y=0,_=0,x=0,T=0,b=0,M=0;c.sort($L);for(let S=0,w=c.length;S<w;S++){const D=c[S],R=D.color,k=D.intensity,N=D.distance,H=D.shadow&&D.shadow.map?D.shadow.map.texture:null;if(D.isAmbientLight)u+=R.r*k,d+=R.g*k,h+=R.b*k;else if(D.isLightProbe){for(let P=0;P<9;P++)n.probe[P].addScaledVector(D.sh.coefficients[P],k);M++}else if(D.isDirectionalLight){const P=e.get(D);if(P.color.copy(D.color).multiplyScalar(D.intensity),D.castShadow){const ee=D.shadow,X=t.get(D);X.shadowIntensity=ee.intensity,X.shadowBias=ee.bias,X.shadowNormalBias=ee.normalBias,X.shadowRadius=ee.radius,X.shadowMapSize=ee.mapSize,n.directionalShadow[f]=X,n.directionalShadowMap[f]=H,n.directionalShadowMatrix[f]=D.shadow.matrix,y++}n.directional[f]=P,f++}else if(D.isSpotLight){const P=e.get(D);P.position.setFromMatrixPosition(D.matrixWorld),P.color.copy(R).multiplyScalar(k),P.distance=N,P.coneCos=Math.cos(D.angle),P.penumbraCos=Math.cos(D.angle*(1-D.penumbra)),P.decay=D.decay,n.spot[m]=P;const ee=D.shadow;if(D.map&&(n.spotLightMap[T]=D.map,T++,ee.updateMatrices(D),D.castShadow&&b++),n.spotLightMatrix[m]=ee.matrix,D.castShadow){const X=t.get(D);X.shadowIntensity=ee.intensity,X.shadowBias=ee.bias,X.shadowNormalBias=ee.normalBias,X.shadowRadius=ee.radius,X.shadowMapSize=ee.mapSize,n.spotShadow[m]=X,n.spotShadowMap[m]=H,x++}m++}else if(D.isRectAreaLight){const P=e.get(D);P.color.copy(R).multiplyScalar(k),P.halfWidth.set(D.width*.5,0,0),P.halfHeight.set(0,D.height*.5,0),n.rectArea[g]=P,g++}else if(D.isPointLight){const P=e.get(D);if(P.color.copy(D.color).multiplyScalar(D.intensity),P.distance=D.distance,P.decay=D.decay,D.castShadow){const ee=D.shadow,X=t.get(D);X.shadowIntensity=ee.intensity,X.shadowBias=ee.bias,X.shadowNormalBias=ee.normalBias,X.shadowRadius=ee.radius,X.shadowMapSize=ee.mapSize,X.shadowCameraNear=ee.camera.near,X.shadowCameraFar=ee.camera.far,n.pointShadow[p]=X,n.pointShadowMap[p]=H,n.pointShadowMatrix[p]=D.shadow.matrix,_++}n.point[p]=P,p++}else if(D.isHemisphereLight){const P=e.get(D);P.skyColor.copy(D.color).multiplyScalar(k),P.groundColor.copy(D.groundColor).multiplyScalar(k),n.hemi[v]=P,v++}}g>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=lt.LTC_FLOAT_1,n.rectAreaLTC2=lt.LTC_FLOAT_2):(n.rectAreaLTC1=lt.LTC_HALF_1,n.rectAreaLTC2=lt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=d,n.ambient[2]=h;const E=n.hash;(E.directionalLength!==f||E.pointLength!==p||E.spotLength!==m||E.rectAreaLength!==g||E.hemiLength!==v||E.numDirectionalShadows!==y||E.numPointShadows!==_||E.numSpotShadows!==x||E.numSpotMaps!==T||E.numLightProbes!==M)&&(n.directional.length=f,n.spot.length=m,n.rectArea.length=g,n.point.length=p,n.hemi.length=v,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=_,n.pointShadowMap.length=_,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=_,n.spotLightMatrix.length=x+T-b,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=b,n.numLightProbes=M,E.directionalLength=f,E.pointLength=p,E.spotLength=m,E.rectAreaLength=g,E.hemiLength=v,E.numDirectionalShadows=y,E.numPointShadows=_,E.numSpotShadows=x,E.numSpotMaps=T,E.numLightProbes=M,n.version=YL++)}function l(c,u){let d=0,h=0,f=0,p=0,m=0;const g=u.matrixWorldInverse;for(let v=0,y=c.length;v<y;v++){const _=c[v];if(_.isDirectionalLight){const x=n.directional[d];x.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(g),d++}else if(_.isSpotLight){const x=n.spot[f];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(g),x.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(g),f++}else if(_.isRectAreaLight){const x=n.rectArea[p];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(g),o.identity(),s.copy(_.matrixWorld),s.premultiply(g),o.extractRotation(s),x.halfWidth.set(_.width*.5,0,0),x.halfHeight.set(0,_.height*.5,0),x.halfWidth.applyMatrix4(o),x.halfHeight.applyMatrix4(o),p++}else if(_.isPointLight){const x=n.point[h];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(g),h++}else if(_.isHemisphereLight){const x=n.hemi[m];x.direction.setFromMatrixPosition(_.matrixWorld),x.direction.transformDirection(g),m++}}}return{setup:a,setupView:l,state:n}}function Cb(r){const e=new ZL(r),t=[],n=[];function i(u){c.camera=u,t.length=0,n.length=0}function s(u){t.push(u)}function o(u){n.push(u)}function a(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:a,setupLightsView:l,pushLight:s,pushShadow:o}}function JL(r){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new Cb(r),e.set(i,[a])):s>=o.length?(a=new Cb(r),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}const KL=`void main() {
3777	gl_Position = vec4( position, 1.0 );
3778}`,QL=`uniform sampler2D shadow_pass;
3779uniform vec2 resolution;
3780uniform float radius;
3781#include <packing>
3782void main() {
3783	const float samples = float( VSM_SAMPLES );
3784	float mean = 0.0;
3785	float squared_mean = 0.0;
3786	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3787	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3788	for ( float i = 0.0; i < samples; i ++ ) {
3789		float uvOffset = uvStart + i * uvStride;
3790		#ifdef HORIZONTAL_PASS
3791			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3792			mean += distribution.x;
3793			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3794		#else
3795			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3796			mean += depth;
3797			squared_mean += depth * depth;
3798		#endif
3799	}
3800	mean = mean / samples;
3801	squared_mean = squared_mean / samples;
3802	float std_dev = sqrt( squared_mean - mean * mean );
3803	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3804}`;function ek(r,e,t){let n=new pc;const i=new Ue,s=new Ue,o=new Kt,a=new Um({depthPacking:ny}),l=new Nm,c={},u=t.maxTextureSize,d={[ms]:Fi,[Fi]:ms,[si]:si},h=new Dr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ue},radius:{value:4}},vertexShader:KL,fragmentShader:QL}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const p=new Ht;p.setAttribute("position",new Zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new fn(p,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=j0;let v=this.type;this.render=function(b,M,E){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const S=r.getRenderTarget(),w=r.getActiveCubeFace(),D=r.getActiveMipmapLevel(),R=r.state;R.setBlending(Gs),R.buffers.color.setClear(1,1,1,1),R.buffers.depth.setTest(!0),R.setScissorTest(!1);const k=v!==is&&this.type===is,N=v===is&&this.type!==is;for(let H=0,P=b.length;H<P;H++){const ee=b[H],X=ee.shadow;if(X===void 0){console.warn("THREE.WebGLShadowMap:",ee,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;i.copy(X.mapSize);const Q=X.getFrameExtents();if(i.multiply(Q),s.copy(X.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/Q.x),i.x=s.x*Q.x,X.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/Q.y),i.y=s.y*Q.y,X.mapSize.y=s.y)),X.map===null||k===!0||N===!0){const z=this.type!==is?{minFilter:Ii,magFilter:Ii}:{};X.map!==null&&X.map.dispose(),X.map=new gs(i.x,i.y,z),X.map.texture.name=ee.name+".shadowMap",X.camera.updateProjectionMatrix()}r.setRenderTarget(X.map),r.clear();const Y=X.getViewportCount();for(let z=0;z<Y;z++){const K=X.getViewport(z);o.set(s.x*K.x,s.y*K.y,s.x*K.z,s.y*K.w),R.viewport(o),X.updateMatrices(ee,z),n=X.getFrustum(),x(M,E,X.camera,ee,this.type)}X.isPointLightShadow!==!0&&this.type===is&&y(X,E),X.needsUpdate=!1}v=this.type,g.needsUpdate=!1,r.setRenderTarget(S,w,D)};function y(b,M){const E=e.update(m);h.defines.VSM_SAMPLES!==b.blurSamples&&(h.defines.VSM_SAMPLES=b.blurSamples,f.defines.VSM_SAMPLES=b.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new gs(i.x,i.y)),h.uniforms.shadow_pass.value=b.map.texture,h.uniforms.resolution.value=b.mapSize,h.uniforms.radius.value=b.radius,r.setRenderTarget(b.mapPass),r.clear(),r.renderBufferDirect(M,null,E,h,m,null),f.uniforms.shadow_pass.value=b.mapPass.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,r.setRenderTarget(b.map),r.clear(),r.renderBufferDirect(M,null,E,f,m,null)}function _(b,M,E,S){let w=null;const D=E.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(D!==void 0)w=D;else if(w=E.isPointLight===!0?l:a,r.localClippingEnabled&&M.clipShadows===!0&&Array.isArray(M.clippingPlanes)&&M.clippingPlanes.length!==0||M.displacementMap&&M.displacementScale!==0||M.alphaMap&&M.alphaTest>0||M.map&&M.alphaTest>0||M.alphaToCoverage===!0){const R=w.uuid,k=M.uuid;let N=c[R];N===void 0&&(N={},c[R]=N);let H=N[k];H===void 0&&(H=w.clone(),N[k]=H,M.addEventListener("dispose",T)),w=H}if(w.visible=M.visible,w.wireframe=M.wireframe,S===is?w.side=M.shadowSide!==null?M.shadowSide:M.side:w.side=M.shadowSide!==null?M.shadowSide:d[M.side],w.alphaMap=M.alphaMap,w.alphaTest=M.alphaToCoverage===!0?.5:M.alphaTest,w.map=M.map,w.clipShadows=M.clipShadows,w.clippingPlanes=M.clippingPlanes,w.clipIntersection=M.clipIntersection,w.displacementMap=M.displacementMap,w.displacementScale=M.displacementScale,w.displacementBias=M.displacementBias,w.wireframeLinewidth=M.wireframeLinewidth,w.linewidth=M.linewidth,E.isPointLight===!0&&w.isMeshDistanceMaterial===!0){const R=r.properties.get(w);R.light=E}return w}function x(b,M,E,S,w){if(b.visible===!1)return;if(b.layers.test(M.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&w===is)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(E.matrixWorldInverse,b.matrixWorld);const k=e.update(b),N=b.material;if(Array.isArray(N)){const H=k.groups;for(let P=0,ee=H.length;P<ee;P++){const X=H[P],Q=N[X.materialIndex];if(Q&&Q.visible){const Y=_(b,Q,S,w);b.onBeforeShadow(r,b,M,E,k,Y,X),r.renderBufferDirect(E,null,k,Y,b,X),b.onAfterShadow(r,b,M,E,k,Y,X)}}}else if(N.visible){const H=_(b,N,S,w);b.onBeforeShadow(r,b,M,E,k,H,null),r.renderBufferDirect(E,null,k,H,b,null),b.onAfterShadow(r,b,M,E,k,H,null)}}const R=b.children;for(let k=0,N=R.length;k<N;k++)x(R[k],M,E,S,w)}function T(b){b.target.removeEventListener("dispose",T);for(const E in c){const S=c[E],w=b.target.uuid;w in S&&(S[w].dispose(),delete S[w])}}}const tk={[Gf]:Hf,[Wf]:qf,[jf]:Yf,[Oa]:Xf,[Hf]:Gf,[qf]:Wf,[Yf]:jf,[Xf]:Oa};function nk(r,e){function t(){let oe=!1;const Oe=new Kt;let ke=null;const Xe=new Kt(0,0,0,0);return{setMask:function(Me){ke!==Me&&!oe&&(r.colorMask(Me,Me,Me,Me),ke=Me)},setLocked:function(Me){oe=Me},setClear:function(Me,Ce,nt,ct,dt){dt===!0&&(Me*=ct,Ce*=ct,nt*=ct),Oe.
vendor: 5,424 bytes, line 3804
3804set(Me,Ce,nt,ct),Xe.equals(Oe)===!1&&(r.clearColor(Me,Ce,nt,ct),Xe.copy(Oe))},reset:function(){oe=!1,ke=null,Xe.set(-1,0,0,0)}}}function n(){let oe=!1,Oe=!1,ke=null,Xe=null,Me=null;return{setReversed:function(Ce){if(Oe!==Ce){const nt=e.get("EXT_clip_control");Ce?nt.clipControlEXT(nt.LOWER_LEFT_EXT,nt.ZERO_TO_ONE_EXT):nt.clipControlEXT(nt.LOWER_LEFT_EXT,nt.NEGATIVE_ONE_TO_ONE_EXT),Oe=Ce;const ct=Me;Me=null,this.setClear(ct)}},getReversed:function(){return Oe},setTest:function(Ce){Ce?j(r.DEPTH_TEST):ie(r.DEPTH_TEST)},setMask:function(Ce){ke!==Ce&&!oe&&(r.depthMask(Ce),ke=Ce)},setFunc:function(Ce){if(Oe&&(Ce=tk[Ce]),Xe!==Ce){switch(Ce){case Gf:r.depthFunc(r.NEVER);break;case Hf:r.depthFunc(r.ALWAYS);break;case Wf:r.depthFunc(r.LESS);break;case Oa:r.depthFunc(r.LEQUAL);break;case jf:r.depthFunc(r.EQUAL);break;case Xf:r.depthFunc(r.GEQUAL);break;case qf:r.depthFunc(r.GREATER);break;case Yf:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}Xe=Ce}},setLocked:function(Ce){oe=Ce},setClear:function(Ce){Me!==Ce&&(Oe&&(Ce=1-Ce),r.clearDepth(Ce),Me=Ce)},reset:function(){oe=!1,ke=null,Xe=null,Me=null,Oe=!1}}}function i(){let oe=!1,Oe=null,ke=null,Xe=null,Me=null,Ce=null,nt=null,ct=null,dt=null;return{setTest:function(ft){oe||(ft?j(r.STENCIL_TEST):ie(r.STENCIL_TEST))},setMask:function(ft){Oe!==ft&&!oe&&(r.stencilMask(ft),Oe=ft)},setFunc:function(ft,qt,sn){(ke!==ft||Xe!==qt||Me!==sn)&&(r.stencilFunc(ft,qt,sn),ke=ft,Xe=qt,Me=sn)},setOp:function(ft,qt,sn){(Ce!==ft||nt!==qt||ct!==sn)&&(r.stencilOp(ft,qt,sn),Ce=ft,nt=qt,ct=sn)},setLocked:function(ft){oe=ft},setClear:function(ft){dt!==ft&&(r.clearStencil(ft),dt=ft)},reset:function(){oe=!1,Oe=null,ke=null,Xe=null,Me=null,Ce=null,nt=null,ct=null,dt=null}}}const s=new t,o=new n,a=new i,l=new WeakMap,c=new WeakMap;let u={},d={},h=new WeakMap,f=[],p=null,m=!1,g=null,v=null,y=null,_=null,x=null,T=null,b=null,M=new st(0,0,0),E=0,S=!1,w=null,D=null,R=null,k=null,N=null;const H=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let P=!1,ee=0;const X=r.getParameter(r.VERSION);X.indexOf("WebGL")!==-1?(ee=parseFloat(/^WebGL (\d)/.exec(X)[1]),P=ee>=1):X.indexOf("OpenGL ES")!==-1&&(ee=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),P=ee>=2);let Q=null,Y={};const z=r.getParameter(r.SCISSOR_BOX),K=r.getParameter(r.VIEWPORT),te=new Kt().fromArray(z),O=new Kt().fromArray(K);function U(oe,Oe,ke,Xe){const Me=new Uint8Array(4),Ce=r.createTexture();r.bindTexture(oe,Ce),r.texParameteri(oe,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(oe,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let nt=0;nt<ke;nt++)oe===r.TEXTURE_3D||oe===r.TEXTURE_2D_ARRAY?r.texImage3D(Oe,0,r.RGBA,1,1,Xe,0,r.RGBA,r.UNSIGNED_BYTE,Me):r.texImage2D(Oe+nt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Me);return Ce}const W={};W[r.TEXTURE_2D]=U(r.TEXTURE_2D,r.TEXTURE_2D,1),W[r.TEXTURE_CUBE_MAP]=U(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),W[r.TEXTURE_2D_ARRAY]=U(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),W[r.TEXTURE_3D]=U(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),j(r.DEPTH_TEST),o.setFunc(Oa),me(!1),be(bv),j(r.CULL_FACE),F(Gs);function j(oe){u[oe]!==!0&&(r.enable(oe),u[oe]=!0)}function ie(oe){u[oe]!==!1&&(r.disable(oe),u[oe]=!1)}function de(oe,Oe){return d[oe]!==Oe?(r.bindFramebuffer(oe,Oe),d[oe]=Oe,oe===r.DRAW_FRAMEBUFFER&&(d[r.FRAMEBUFFER]=Oe),oe===r.FRAMEBUFFER&&(d[r.DRAW_FRAMEBUFFER]=Oe),!0):!1}function ye(oe,Oe){let ke=f,Xe=!1;if(oe){ke=h.get(Oe),ke===void 0&&(ke=[],h.set(Oe,ke));const Me=oe.textures;if(ke.length!==Me.length||ke[0]!==r.COLOR_ATTACHMENT0){for(let Ce=0,nt=Me.length;Ce<nt;Ce++)ke[Ce]=r.COLOR_ATTACHMENT0+Ce;ke.length=Me.length,Xe=!0}}else ke[0]!==r.BACK&&(ke[0]=r.BACK,Xe=!0);Xe&&r.drawBuffers(ke)}function we(oe){return p!==oe?(r.useProgram(oe),p=oe,!0):!1}const _e={[go]:r.FUNC_ADD,[L1]:r.FUNC_SUBTRACT,[k1]:r.FUNC_REVERSE_SUBTRACT};_e[U1]=r.MIN,_e[N1]=r.MAX;const Re={[O1]:r.ZERO,[F1]:r.ONE,[B1]:r.SRC_COLOR,[zf]:r.SRC_ALPHA,[j1]:r.SRC_ALPHA_SATURATE,[H1]:r.DST_COLOR,[V1]:r.DST_ALPHA,[z1]:r.ONE_MINUS_SRC_COLOR,[Vf]:r.ONE_MINUS_SRC_ALPHA,[W1]:r.ONE_MINUS_DST_COLOR,[G1]:r.ONE_MINUS_DST_ALPHA,[X1]:r.CONSTANT_COLOR,[q1]:r.ONE_MINUS_CONSTANT_COLOR,[Y1]:r.CONSTANT_ALPHA,[$1]:r.ONE_MINUS_CONSTANT_ALPHA};function F(oe,Oe,ke,Xe,Me,Ce,nt,ct,dt,ft){if(oe===Gs){m===!0&&(ie(r.BLEND),m=!1);return}if(m===!1&&(j(r.BLEND),m=!0),oe!==D1){if(oe!==g||ft!==S){if((v!==go||x!==go)&&(r.blendEquation(r.FUNC_ADD),v=go,x=go),ft)switch(oe){case Ia:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case wv:r.blendFunc(r.ONE,r.ONE);break;case Sv:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Mv:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",oe);break}else switch(oe){case Ia:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case wv:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Sv:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Mv:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",oe);break}y=null,_=null,T=null,b=null,M.set(0,0,0),E=0,g=oe,S=ft}return}Me=Me||Oe,Ce=Ce||ke,nt=nt||Xe,(Oe!==v||Me!==x)&&(r.blendEquationSeparate(_e[Oe],_e[Me]),v=Oe,x=Me),(ke!==y||Xe!==_||Ce!==T||nt!==b)&&(r.blendFuncSeparate(Re[ke],Re[Xe],Re[Ce],Re[nt]),y=ke,_=Xe,T=Ce,b=nt),(ct.equals(M)===!1||dt!==E)&&(r.blendColor
vendor: 5,304 bytes, line 3804
3804(ct.r,ct.g,ct.b,dt),M.copy(ct),E=dt),g=oe,S=!1}function pe(oe,Oe){oe.side===si?ie(r.CULL_FACE):j(r.CULL_FACE);let ke=oe.side===Fi;Oe&&(ke=!ke),me(ke),oe.blending===Ia&&oe.transparent===!1?F(Gs):F(oe.blending,oe.blendEquation,oe.blendSrc,oe.blendDst,oe.blendEquationAlpha,oe.blendSrcAlpha,oe.blendDstAlpha,oe.blendColor,oe.blendAlpha,oe.premultipliedAlpha),o.setFunc(oe.depthFunc),o.setTest(oe.depthTest),o.setMask(oe.depthWrite),s.setMask(oe.colorWrite);const Xe=oe.stencilWrite;a.setTest(Xe),Xe&&(a.setMask(oe.stencilWriteMask),a.setFunc(oe.stencilFunc,oe.stencilRef,oe.stencilFuncMask),a.setOp(oe.stencilFail,oe.stencilZFail,oe.stencilZPass)),Se(oe.polygonOffset,oe.polygonOffsetFactor,oe.polygonOffsetUnits),oe.alphaToCoverage===!0?j(r.SAMPLE_ALPHA_TO_COVERAGE):ie(r.SAMPLE_ALPHA_TO_COVERAGE)}function me(oe){w!==oe&&(oe?r.frontFace(r.CW):r.frontFace(r.CCW),w=oe)}function be(oe){oe!==P1?(j(r.CULL_FACE),oe!==D&&(oe===bv?r.cullFace(r.BACK):oe===I1?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):ie(r.CULL_FACE),D=oe}function se(oe){oe!==R&&(P&&r.lineWidth(oe),R=oe)}function Se(oe,Oe,ke){oe?(j(r.POLYGON_OFFSET_FILL),(k!==Oe||N!==ke)&&(r.polygonOffset(Oe,ke),k=Oe,N=ke)):ie(r.POLYGON_OFFSET_FILL)}function he(oe){oe?j(r.SCISSOR_TEST):ie(r.SCISSOR_TEST)}function le(oe){oe===void 0&&(oe=r.TEXTURE0+H-1),Q!==oe&&(r.activeTexture(oe),Q=oe)}function He(oe,Oe,ke){ke===void 0&&(Q===null?ke=r.TEXTURE0+H-1:ke=Q);let Xe=Y[ke];Xe===void 0&&(Xe={type:void 0,texture:void 0},Y[ke]=Xe),(Xe.type!==oe||Xe.texture!==Oe)&&(Q!==ke&&(r.activeTexture(ke),Q=ke),r.bindTexture(oe,Oe||W[oe]),Xe.type=oe,Xe.texture=Oe)}function B(){const oe=Y[Q];oe!==void 0&&oe.type!==void 0&&(r.bindTexture(oe.type,null),oe.type=void 0,oe.texture=void 0)}function A(){try{r.compressedTexImage2D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function ne(){try{r.compressedTexImage3D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function ge(){try{r.texSubImage2D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function ue(){try{r.texSubImage3D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function ce(){try{r.compressedTexSubImage2D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function Ne(){try{r.compressedTexSubImage3D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function De(){try{r.texStorage2D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function $e(){try{r.texStorage3D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function Je(){try{r.texImage2D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function Ee(){try{r.texImage3D(...arguments)}catch(oe){console.error("THREE.WebGLState:",oe)}}function Ge(oe){te.equals(oe)===!1&&(r.scissor(oe.x,oe.y,oe.z,oe.w),te.copy(oe))}function Ye(oe){O.equals(oe)===!1&&(r.viewport(oe.x,oe.y,oe.z,oe.w),O.copy(oe))}function it(oe,Oe){let ke=c.get(Oe);ke===void 0&&(ke=new WeakMap,c.set(Oe,ke));let Xe=ke.get(oe);Xe===void 0&&(Xe=r.getUniformBlockIndex(Oe,oe.name),ke.set(oe,Xe))}function Ze(oe,Oe){const Xe=c.get(Oe).get(oe);l.get(Oe)!==Xe&&(r.uniformBlockBinding(Oe,Xe,oe.__bindingPointIndex),l.set(Oe,Xe))}function ht(){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),o.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),u={},Q=null,Y={},d={},h=new WeakMap,f=[],p=null,m=!1,g=null,v=null,y=null,_=null,x=null,T=null,b=null,M=new st(0,0,0),E=0,S=!1,w=null,D=null,R=null,k=null,N=null,te.set(0,0,r.canvas.width,r.canvas.height),O.set(0,0,r.canvas.width,r.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:j,disable:ie,bindFramebuffer:de,drawBuffers:ye,useProgram:we,setBlending:F,setMaterial:pe,setFlipSided:me,setCullFace:be,setLineWidth:se,setPolygonOffset:Se,setScissorTest:he,activeTexture:le,bindTexture:He,unbindTexture:B,compressedTexImage2D:A,compressedTexImage3D:ne,texImage2D:Je,texImage3D:Ee,updateUBOMapping:it,uniformBlockBinding:Ze,texStorage2D:De,texStorage3D:$e,texSubImage2D:ge,texSubImage3D:ue,compressedTexSubImage2D:ce,compressedTexSubImage3D:Ne,scissor:Ge,viewport:Ye,reset:ht}}function ik(r,e,t,n,i,s,o){const a=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 Ue,u=new WeakMap;let d;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(B,A){return f?new OffscreenCanvas(B,A):Mu("canvas")}
vendor: 4,626 bytes, line 3804
3804function m(B,A,ne){let ge=1;const ue=He(B);if((ue.width>ne||ue.height>ne)&&(ge=ne/Math.max(ue.width,ue.height)),ge<1)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap||typeof VideoFrame<"u"&&B instanceof VideoFrame){const ce=Math.floor(ge*ue.width),Ne=Math.floor(ge*ue.height);d===void 0&&(d=p(ce,Ne));const De=A?p(ce,Ne):d;return De.width=ce,De.height=Ne,De.getContext("2d").drawImage(B,0,0,ce,Ne),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ue.width+"x"+ue.height+") to ("+ce+"x"+Ne+")."),De}else return"data"in B&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ue.width+"x"+ue.height+")."),B;return B}function g(B){return B.generateMipmaps}function v(B){r.generateMipmap(B)}function y(B){return B.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:B.isWebGL3DRenderTarget?r.TEXTURE_3D:B.isWebGLArrayRenderTarget||B.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function _(B,A,ne,ge,ue=!1){if(B!==null){if(r[B]!==void 0)return r[B];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let ce=A;if(A===r.RED&&(ne===r.FLOAT&&(ce=r.R32F),ne===r.HALF_FLOAT&&(ce=r.R16F),ne===r.UNSIGNED_BYTE&&(ce=r.R8)),A===r.RED_INTEGER&&(ne===r.UNSIGNED_BYTE&&(ce=r.R8UI),ne===r.UNSIGNED_SHORT&&(ce=r.R16UI),ne===r.UNSIGNED_INT&&(ce=r.R32UI),ne===r.BYTE&&(ce=r.R8I),ne===r.SHORT&&(ce=r.R16I),ne===r.INT&&(ce=r.R32I)),A===r.RG&&(ne===r.FLOAT&&(ce=r.RG32F),ne===r.HALF_FLOAT&&(ce=r.RG16F),ne===r.UNSIGNED_BYTE&&(ce=r.RG8)),A===r.RG_INTEGER&&(ne===r.UNSIGNED_BYTE&&(ce=r.RG8UI),ne===r.UNSIGNED_SHORT&&(ce=r.RG16UI),ne===r.UNSIGNED_INT&&(ce=r.RG32UI),ne===r.BYTE&&(ce=r.RG8I),ne===r.SHORT&&(ce=r.RG16I),ne===r.INT&&(ce=r.RG32I)),A===r.RGB_INTEGER&&(ne===r.UNSIGNED_BYTE&&(ce=r.RGB8UI),ne===r.UNSIGNED_SHORT&&(ce=r.RGB16UI),ne===r.UNSIGNED_INT&&(ce=r.RGB32UI),ne===r.BYTE&&(ce=r.RGB8I),ne===r.SHORT&&(ce=r.RGB16I),ne===r.INT&&(ce=r.RGB32I)),A===r.RGBA_INTEGER&&(ne===r.UNSIGNED_BYTE&&(ce=r.RGBA8UI),ne===r.UNSIGNED_SHORT&&(ce=r.RGBA16UI),ne===r.UNSIGNED_INT&&(ce=r.RGBA32UI),ne===r.BYTE&&(ce=r.RGBA8I),ne===r.SHORT&&(ce=r.RGBA16I),ne===r.INT&&(ce=r.RGBA32I)),A===r.RGB&&ne===r.UNSIGNED_INT_5_9_9_9_REV&&(ce=r.RGB9_E5),A===r.RGBA){const Ne=ue?bu:rn.getTransfer(ge);ne===r.FLOAT&&(ce=r.RGBA32F),ne===r.HALF_FLOAT&&(ce=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(ce=Ne===Mn?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(ce=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(ce=r.RGB5_A1)}return(ce===r.R16F||ce===r.R32F||ce===r.RG16F||ce===r.RG32F||ce===r.RGBA16F||ce===r.RGBA32F)&&e.get("EXT_color_buffer_float"),ce}function x(B,A){let ne;return B?A===null||A===js||A===tc?ne=r.DEPTH24_STENCIL8:A===ar?ne=r.DEPTH32F_STENCIL8:A===ec&&(ne=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):A===null||A===js||A===tc?ne=r.DEPTH_COMPONENT24:A===ar?ne=r.DEPTH_COMPONENT32F:A===ec&&(ne=r.DEPTH_COMPONENT16),ne}function T(B,A){return g(B)===!0||B.isFramebufferTexture&&B.minFilter!==Ii&&B.minFilter!==ei?Math.log2(Math.max(A.width,A.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?A.mipmaps.length:1}function b(B){const A=B.target;A.removeEventListener("dispose",b),E(A),A.isVideoTexture&&u.delete(A)}function M(B){const A=B.target;A.removeEventListener("dispose",M),w(A)}function E(B){const A=n.get(B);if(A.__webglInit===void 0)return;const ne=B.source,ge=h.get(ne);if(ge){const ue=ge[A.__cacheKey];ue.usedTimes--,ue.usedTimes===0&&S(B),Object.keys(ge).length===0&&h.delete(ne)}n.remove(B)}function S(B){const A=n.get(B);r.deleteTexture(A.__webglTexture);const ne=B.source,ge=h.get(ne);delete ge[A.__cacheKey],o.memory.textures--}function w(B){const A=n.get(B);if(B.depthTexture&&(B.depthTexture.dispose(),n.remove(B.depthTexture)),B.isWebGLCubeRenderTarget)for(let ge=0;ge<6;ge++){if(Array.isArray(A.__webglFramebuffer[ge]))for(let ue=0;ue<A.__webglFramebuffer[ge].length;ue++)r.deleteFramebuffer(A.__webglFramebuffer[ge][ue]);else r.deleteFramebuffer(A.__webglFramebuffer[ge]);A.__webglDepthbuffer&&r.deleteRenderbuffer(A.__webglDepthbuffer[ge])}else{if(Array.isArray(A.__webglFramebuffer))for(let ge=0;ge<A.__webglFramebuffer.length;ge++)r.deleteFramebuffer(A.__webglFramebuffer[ge]);else r.deleteFramebuffer(A.__webglFramebuffer);if(A.__webglDepthbuffer&&r.deleteRenderbuffer(A.__webglDepthbuffer),A.__webglMultisampledFramebuffer&&r.deleteFramebuffer(A.__webglMultisampledFramebuffer),A.__webglColorRen
vendor: 5,286 bytes, line 3804
3804derbuffer)for(let ge=0;ge<A.__webglColorRenderbuffer.length;ge++)A.__webglColorRenderbuffer[ge]&&r.deleteRenderbuffer(A.__webglColorRenderbuffer[ge]);A.__webglDepthRenderbuffer&&r.deleteRenderbuffer(A.__webglDepthRenderbuffer)}const ne=B.textures;for(let ge=0,ue=ne.length;ge<ue;ge++){const ce=n.get(ne[ge]);ce.__webglTexture&&(r.deleteTexture(ce.__webglTexture),o.memory.textures--),n.remove(ne[ge])}n.remove(B)}let D=0;function R(){D=0}function k(){const B=D;return B>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+i.maxTextures),D+=1,B}function N(B){const A=[];return A.push(B.wrapS),A.push(B.wrapT),A.push(B.wrapR||0),A.push(B.magFilter),A.push(B.minFilter),A.push(B.anisotropy),A.push(B.internalFormat),A.push(B.format),A.push(B.type),A.push(B.generateMipmaps),A.push(B.premultiplyAlpha),A.push(B.flipY),A.push(B.unpackAlignment),A.push(B.colorSpace),A.join()}function H(B,A){const ne=n.get(B);if(B.isVideoTexture&&he(B),B.isRenderTargetTexture===!1&&B.version>0&&ne.__version!==B.version){const ge=B.image;if(ge===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ge.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{W(ne,B,A);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+A)}function P(B,A){const ne=n.get(B);if(B.version>0&&ne.__version!==B.version){W(ne,B,A);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+A)}function ee(B,A){const ne=n.get(B);if(B.version>0&&ne.__version!==B.version){W(ne,B,A);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+A)}function X(B,A){const ne=n.get(B);if(B.version>0&&ne.__version!==B.version){j(ne,B,A);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+A)}const Q={[Gr]:r.REPEAT,[or]:r.CLAMP_TO_EDGE,[yu]:r.MIRRORED_REPEAT},Y={[Ii]:r.NEAREST,[q0]:r.NEAREST_MIPMAP_NEAREST,[Cl]:r.NEAREST_MIPMAP_LINEAR,[ei]:r.LINEAR,[Kc]:r.LINEAR_MIPMAP_NEAREST,[Hr]:r.LINEAR_MIPMAP_LINEAR},z={[uS]:r.NEVER,[gS]:r.ALWAYS,[dS]:r.LESS,[iy]:r.LEQUAL,[hS]:r.EQUAL,[mS]:r.GEQUAL,[fS]:r.GREATER,[pS]:r.NOTEQUAL};function K(B,A){if(A.type===ar&&e.has("OES_texture_float_linear")===!1&&(A.magFilter===ei||A.magFilter===Kc||A.magFilter===Cl||A.magFilter===Hr||A.minFilter===ei||A.minFilter===Kc||A.minFilter===Cl||A.minFilter===Hr)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(B,r.TEXTURE_WRAP_S,Q[A.wrapS]),r.texParameteri(B,r.TEXTURE_WRAP_T,Q[A.wrapT]),(B===r.TEXTURE_3D||B===r.TEXTURE_2D_ARRAY)&&r.texParameteri(B,r.TEXTURE_WRAP_R,Q[A.wrapR]),r.texParameteri(B,r.TEXTURE_MAG_FILTER,Y[A.magFilter]),r.texParameteri(B,r.TEXTURE_MIN_FILTER,Y[A.minFilter]),A.compareFunction&&(r.texParameteri(B,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(B,r.TEXTURE_COMPARE_FUNC,z[A.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(A.magFilter===Ii||A.minFilter!==Cl&&A.minFilter!==Hr||A.type===ar&&e.has("OES_texture_float_linear")===!1)return;if(A.anisotropy>1||n.get(A).__currentAnisotropy){const ne=e.get("EXT_texture_filter_anisotropic");r.texParameterf(B,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,i.getMaxAnisotropy())),n.get(A).__currentAnisotropy=A.anisotropy}}}function te(B,A){let ne=!1;B.__webglInit===void 0&&(B.__webglInit=!0,A.addEventListener("dispose",b));const ge=A.source;let ue=h.get(ge);ue===void 0&&(ue={},h.set(ge,ue));const ce=N(A);if(ce!==B.__cacheKey){ue[ce]===void 0&&(ue[ce]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),ue[ce].usedTimes++;const Ne=ue[B.__cacheKey];Ne!==void 0&&(ue[B.__cacheKey].usedTimes--,Ne.usedTimes===0&&S(A)),B.__cacheKey=ce,B.__webglTexture=ue[ce].texture}return ne}function O(B,A,ne){return Math.floor(Math.floor(B/ne)/A)}function U(B,A,ne,ge){const ce=B.updateRanges;if(ce.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,A.width,A.height,ne,ge,A.data);else{ce.sort((Ee,Ge)=>Ee.start-Ge.start);let Ne=0;for(let Ee=1;Ee<ce.length;Ee++){const Ge=ce[Ne],Ye=ce[Ee],it=Ge.start+Ge.count,Ze=O(Ye.start,A.width,4),ht=O(Ge.start,A.width,4);Ye.start<=it+1&&Ze===ht&&O(Ye.start+Ye.count-1,A.width,4)===Ze?Ge.count=Math.max(Ge.count,Ye.start+Ye.count-Ge.start):(++Ne,ce[Ne]=Ye)}ce.length=Ne+1;const De=r.getParameter(r.UNPACK_ROW_LENGTH),$e=r.getParameter(r.UNPACK_SKIP_PIXELS),Je=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,A.width);for(let Ee=0,Ge=ce.length;Ee<Ge;Ee++){const Ye=ce[Ee],it=Math.floor(Ye.start/4),Ze=Math.ceil(Ye.count/4),ht=it%A.width,oe=Math.floor(it/A.width),Oe=Ze,ke=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,ht),r.pixelStorei(r.UNPACK_SKIP_ROWS,oe),t.texSubImage2D(r.TEXTURE_2D,0,ht,oe,Oe,ke,ne,ge,A.data)}B.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,De),r.pixelStorei(r.UNPACK_SKIP_PIXELS,$e),r.pixelStorei(r.UNPACK_SKIP_ROWS,Je)}}function W(B,A,ne){let ge=r.TEXTURE_2D;(A.isDataArrayTexture||A.isCompressedArrayTexture)&&(ge=r.TEXTURE_2D_ARRAY),A.isData3DTexture&&(ge=r.TEXTURE_3D);const ue=te(B,A),ce=A.source;t.bindTexture(ge,B.__webglTexture,r.TEXTURE0+ne);const Ne=n.get(ce);if(ce.version!==Ne.__version||ue===!0){t.activeTexture(r.TEXTURE0+ne);
vendor: 22,174 bytes, line 3804
3804const De=rn.getPrimaries(rn.workingColorSpace),$e=A.colorSpace===Fs?null:rn.getPrimaries(A.colorSpace),Je=A.colorSpace===Fs||De===$e?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,A.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,A.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Je);let Ee=m(A.image,!1,i.maxTextureSize);Ee=le(A,Ee);const Ge=s.convert(A.format,A.colorSpace),Ye=s.convert(A.type);let it=_(A.internalFormat,Ge,Ye,A.colorSpace,A.isVideoTexture);K(ge,A);let Ze;const ht=A.mipmaps,oe=A.isVideoTexture!==!0,Oe=Ne.__version===void 0||ue===!0,ke=ce.dataReady,Xe=T(A,Ee);if(A.isDepthTexture)it=x(A.format===ic,A.type),Oe&&(oe?t.texStorage2D(r.TEXTURE_2D,1,it,Ee.width,Ee.height):t.texImage2D(r.TEXTURE_2D,0,it,Ee.width,Ee.height,0,Ge,Ye,null));else if(A.isDataTexture)if(ht.length>0){oe&&Oe&&t.texStorage2D(r.TEXTURE_2D,Xe,it,ht[0].width,ht[0].height);for(let Me=0,Ce=ht.length;Me<Ce;Me++)Ze=ht[Me],oe?ke&&t.texSubImage2D(r.TEXTURE_2D,Me,0,0,Ze.width,Ze.height,Ge,Ye,Ze.data):t.texImage2D(r.TEXTURE_2D,Me,it,Ze.width,Ze.height,0,Ge,Ye,Ze.data);A.generateMipmaps=!1}else oe?(Oe&&t.texStorage2D(r.TEXTURE_2D,Xe,it,Ee.width,Ee.height),ke&&U(A,Ee,Ge,Ye)):t.texImage2D(r.TEXTURE_2D,0,it,Ee.width,Ee.height,0,Ge,Ye,Ee.data);else if(A.isCompressedTexture)if(A.isCompressedArrayTexture){oe&&Oe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Xe,it,ht[0].width,ht[0].height,Ee.depth);for(let Me=0,Ce=ht.length;Me<Ce;Me++)if(Ze=ht[Me],A.format!==qi)if(Ge!==null)if(oe){if(ke)if(A.layerUpdates.size>0){const nt=Lv(Ze.width,Ze.height,A.format,A.type);for(const ct of A.layerUpdates){const dt=Ze.data.subarray(ct*nt/Ze.data.BYTES_PER_ELEMENT,(ct+1)*nt/Ze.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Me,0,0,ct,Ze.width,Ze.height,1,Ge,dt)}A.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Me,0,0,0,Ze.width,Ze.height,Ee.depth,Ge,Ze.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Me,it,Ze.width,Ze.height,Ee.depth,0,Ze.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else oe?ke&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Me,0,0,0,Ze.width,Ze.height,Ee.depth,Ge,Ye,Ze.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Me,it,Ze.width,Ze.height,Ee.depth,0,Ge,Ye,Ze.data)}else{oe&&Oe&&t.texStorage2D(r.TEXTURE_2D,Xe,it,ht[0].width,ht[0].height);for(let Me=0,Ce=ht.length;Me<Ce;Me++)Ze=ht[Me],A.format!==qi?Ge!==null?oe?ke&&t.compressedTexSubImage2D(r.TEXTURE_2D,Me,0,0,Ze.width,Ze.height,Ge,Ze.data):t.compressedTexImage2D(r.TEXTURE_2D,Me,it,Ze.width,Ze.height,0,Ze.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):oe?ke&&t.texSubImage2D(r.TEXTURE_2D,Me,0,0,Ze.width,Ze.height,Ge,Ye,Ze.data):t.texImage2D(r.TEXTURE_2D,Me,it,Ze.width,Ze.height,0,Ge,Ye,Ze.data)}else if(A.isDataArrayTexture)if(oe){if(Oe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Xe,it,Ee.width,Ee.height,Ee.depth),ke)if(A.layerUpdates.size>0){const Me=Lv(Ee.width,Ee.height,A.format,A.type);for(const Ce of A.layerUpdates){const nt=Ee.data.subarray(Ce*Me/Ee.data.BYTES_PER_ELEMENT,(Ce+1)*Me/Ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,Ce,Ee.width,Ee.height,1,Ge,Ye,nt)}A.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Ee.width,Ee.height,Ee.depth,Ge,Ye,Ee.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,it,Ee.width,Ee.height,Ee.depth,0,Ge,Ye,Ee.data);else if(A.isData3DTexture)oe?(Oe&&t.texStorage3D(r.TEXTURE_3D,Xe,it,Ee.width,Ee.height,Ee.depth),ke&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Ee.width,Ee.height,Ee.depth,Ge,Ye,Ee.data)):t.texImage3D(r.TEXTURE_3D,0,it,Ee.width,Ee.height,Ee.depth,0,Ge,Ye,Ee.data);else if(A.isFramebufferTexture){if(Oe)if(oe)t.texStorage2D(r.TEXTURE_2D,Xe,it,Ee.width,Ee.height);else{let Me=Ee.width,Ce=Ee.height;for(let nt=0;nt<Xe;nt++)t.texImage2D(r.TEXTURE_2D,nt,it,Me,Ce,0,Ge,Ye,null),Me>>=1,Ce>>=1}}else if(ht.length>0){if(oe&&Oe){const Me=He(ht[0]);t.texStorage2D(r.TEXTURE_2D,Xe,it,Me.width,Me.height)}for(let Me=0,Ce=ht.length;Me<Ce;Me++)Ze=ht[Me],oe?ke&&t.texSubImage2D(r.TEXTURE_2D,Me,0,0,Ge,Ye,Ze):t.texImage2D(r.TEXTURE_2D,Me,it,Ge,Ye,Ze);A.generateMipmaps=!1}else if(oe){if(Oe){const Me=He(Ee);t.texStorage2D(r.TEXTURE_2D,Xe,it,Me.width,Me.height)}ke&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Ge,Ye,Ee)}else t.texImage2D(r.TEXTURE_2D,0,it,Ge,Ye,Ee);g(A)&&v(ge),Ne.__version=ce.version,A.onUpdate&&A.onUpdate(A)}B.__version=A.version}function j(B,A,ne){if(A.image.length!==6)return;const ge=te(B,A),ue=A.source;t.bindTexture(r.TEXTURE_CUBE_MAP,B.__webglTexture,r.TEXTURE0+ne);const ce=n.get(ue);if(ue.version!==ce.__version||ge===!0){t.activeTexture(r.TEXTURE0+ne);const Ne=rn.getPrimaries(rn.workingColorSpace),De=A.colorSpace===Fs?null:rn.getPrimaries(A.colorSpace),$e=A.colorSpace===Fs||Ne===De?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,A.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,A.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,$e);const Je=A.isCompressedTexture||A.image[0].isCompressedTexture,Ee=A.image[0]&&A.image[0].isDataTexture,Ge=[];for(let Ce=0;Ce<6;Ce++)!Je&&!Ee?Ge[Ce]=m(A.image[Ce],!0,i.maxCubemapSize):Ge[Ce]=Ee?A.image[Ce].image:A.image[Ce],Ge[Ce]=le(A,Ge[Ce]);const Ye=Ge[0],it=s.convert(A.format,A.colorSpace),Ze=s.convert(A.type),ht=_(A.internalFormat,it,Ze,A.colorSpace),oe=A.isVideoTexture!==!0,Oe=ce.__version===void 0||ge===!0,ke=ue.dataReady;let Xe=T(A,Ye);K(r.TEXTURE_CUBE_MAP,A);let Me;if(Je){oe&&Oe&&t.texStorage2D(r.TEXTURE_CUBE_MAP,Xe,ht,Ye.width,Ye.height);for(let Ce=0;Ce<6;Ce++){Me=Ge[Ce].mipmaps;for(let nt=0;nt<Me.length;nt++){const ct=Me[nt];A.format!==qi?it!==null?oe?ke&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,nt,0,0,ct.width,ct.height,it,ct.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,nt,ht,ct.width,ct.height,0,ct.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):oe?ke&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,nt,0,0,ct.width,ct.height,it,Ze,ct.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,nt,ht,ct.width,ct.height,0,it,Ze,ct.data)}}}else{if(Me=A.mipmaps,oe&&Oe){Me.length>0&&Xe++;const Ce=He(Ge[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Xe,ht,Ce.width,Ce.height)}for(let Ce=0;Ce<6;Ce++)if(Ee){oe?ke&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,Ge[Ce].width,Ge[Ce].height,it,Ze,Ge[Ce].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,ht,Ge[Ce].width,Ge[Ce].height,0,it,Ze,Ge[Ce].data);for(let nt=0;nt<Me.length;nt++){const dt=Me[nt].image[Ce].image;oe?ke&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,nt+1,0,0,dt.width,dt.height,it,Ze,dt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,nt+1,ht,dt.width,dt.height,0,it,Ze,dt.data)}}else{oe?ke&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,it,Ze,Ge[Ce]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,ht,it,Ze,Ge[Ce]);for(let nt=0;nt<Me.length;nt++){const ct=Me[nt];oe?ke&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,nt+1,0,0,it,Ze,ct.image[Ce]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,nt+1,ht,it,Ze,ct.image[Ce])}}}g(A)&&v(r.TEXTURE_CUBE_MAP),ce.__version=ue.version,A.onUpdate&&A.onUpdate(A)}B.__version=A.version}function ie(B,A,ne,ge,ue,ce){const Ne=s.convert(ne.format,ne.colorSpace),De=s.convert(ne.type),$e=_(ne.internalFormat,Ne,De,ne.colorSpace),Je=n.get(A),Ee=n.get(ne);if(Ee.__renderTarget=A,!Je.__hasExternalTextures){const Ge=Math.max(1,A.width>>ce),Ye=Math.max(1,A.height>>ce);ue===r.TEXTURE_3D||ue===r.TEXTURE_2D_ARRAY?t.texImage3D(ue,ce,$e,Ge,Ye,A.depth,0,Ne,De,null):t.texImage2D(ue,ce,$e,Ge,Ye,0,Ne,De,null)}t.bindFramebuffer(r.FRAMEBUFFER,B),Se(A)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ge,ue,Ee.__webglTexture,0,se(A)):(ue===r.TEXTURE_2D||ue>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ue<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ge,ue,Ee.__webglTexture,ce),t.bindFramebuffer(r.FRAMEBUFFER,null)}function de(B,A,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,B),A.depthBuffer){const ge=A.depthTexture,ue=ge&&ge.isDepthTexture?ge.type:null,ce=x(A.stencilBuffer,ue),Ne=A.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,De=se(A);Se(A)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,De,ce,A.width,A.height):ne?r.renderbufferStorageMultisample(r.RENDERBUFFER,De,ce,A.width,A.height):r.renderbufferStorage(r.RENDERBUFFER,ce,A.width,A.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ne,r.RENDERBUFFER,B)}else{const ge=A.textures;for(let ue=0;ue<ge.length;ue++){const ce=ge[ue],Ne=s.convert(ce.format,ce.colorSpace),De=s.convert(ce.type),$e=_(ce.internalFormat,Ne,De,ce.colorSpace),Je=se(A);ne&&Se(A)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Je,$e,A.width,A.height):Se(A)?a.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Je,$e,A.width,A.height):r.renderbufferStorage(r.RENDERBUFFER,$e,A.width,A.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function ye(B,A){if(A&&A.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,B),!(A.depthTexture&&A.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ge=n.get(A.depthTexture);ge.__renderTarget=A,(!ge.__webglTexture||A.depthTexture.image.width!==A.width||A.depthTexture.image.height!==A.height)&&(A.depthTexture.image.width=A.width,A.depthTexture.image.height=A.height,A.depthTexture.needsUpdate=!0),H(A.depthTexture,0);const ue=ge.__webglTexture,ce=se(A);if(A.depthTexture.format===nc)Se(A)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,ue,0,ce):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,ue,0);else if(A.depthTexture.format===ic)Se(A)?a.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,ue,0,ce):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,ue,0);else throw new Error("Unknown depthTexture format")}function we(B){const A=n.get(B),ne=B.isWebGLCubeRenderTarget===!0;if(A.__boundDepthTexture!==B.depthTexture){const ge=B.depthTexture;if(A.__depthDisposeCallback&&A.__depthDisposeCallback(),ge){const ue=()=>{delete A.__boundDepthTexture,delete A.__depthDisposeCallback,ge.removeEventListener("dispose",ue)};ge.addEventListener("dispose",ue),A.__depthDisposeCallback=ue}A.__boundDepthTexture=ge}if(B.depthTexture&&!A.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");const ge=B.texture.mipmaps;ge&&ge.length>0?ye(A.__webglFramebuffer[0],B):ye(A.__webglFramebuffer,B)}else if(ne){A.__webglDepthbuffer=[];for(let ge=0;ge<6;ge++)if(t.bindFramebuffer(r.FRAMEBUFFER,A.__webglFramebuffer[ge]),A.__webglDepthbuffer[ge]===void 0)A.__webglDepthbuffer[ge]=r.createRenderbuffer(),de(A.__webglDepthbuffer[ge],B,!1);else{const ue=B.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ce=A.__webglDepthbuffer[ge];r.bindRenderbuffer(r.RENDERBUFFER,ce),r.framebufferRenderbuffer(r.FRAMEBUFFER,ue,r.RENDERBUFFER,ce)}}else{const ge=B.texture.mipmaps;if(ge&&ge.length>0?t.bindFramebuffer(r.FRAMEBUFFER,A.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,A.__webglFramebuffer),A.__webglDepthbuffer===void 0)A.__webglDepthbuffer=r.createRenderbuffer(),de(A.__webglDepthbuffer,B,!1);else{const ue=B.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ce=A.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,ce),r.framebufferRenderbuffer(r.FRAMEBUFFER,ue,r.RENDERBUFFER,ce)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function _e(B,A,ne){const ge=n.get(B);A!==void 0&&ie(ge.__webglFramebuffer,B,B.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ne!==void 0&&we(B)}function Re(B){const A=B.texture,ne=n.get(B),ge=n.get(A);B.addEventListener("dispose",M);const ue=B.textures,ce=B.isWebGLCubeRenderTarget===!0,Ne=ue.length>1;if(Ne||(ge.__webglTexture===void 0&&(ge.__webglTexture=r.createTexture()),ge.__version=A.version,o.memory.textures++),ce){ne.__webglFramebuffer=[];for(let De=0;De<6;De++)if(A.mipmaps&&A.mipmaps.length>0){ne.__webglFramebuffer[De]=[];for(let $e=0;$e<A.mipmaps.length;$e++)ne.__webglFramebuffer[De][$e]=r.createFramebuffer()}else ne.__webglFramebuffer[De]=r.createFramebuffer()}else{if(A.mipmaps&&A.mipmaps.length>0){ne.__webglFramebuffer=[];for(let De=0;De<A.mipmaps.length;De++)ne.__webglFramebuffer[De]=r.createFramebuffer()}else ne.__webglFramebuffer=r.createFramebuffer();if(Ne)for(let De=0,$e=ue.length;De<$e;De++){const Je=n.get(ue[De]);Je.__webglTexture===void 0&&(Je.__webglTexture=r.createTexture(),o.memory.textures++)}if(B.samples>0&&Se(B)===!1){ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let De=0;De<ue.length;De++){const $e=ue[De];ne.__webglColorRenderbuffer[De]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,ne.__webglColorRenderbuffer[De]);const Je=s.convert($e.format,$e.colorSpace),Ee=s.convert($e.type),Ge=_($e.internalFormat,Je,Ee,$e.colorSpace,B.isXRRenderTarget===!0),Ye=se(B);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ye,Ge,B.width,B.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+De,r.RENDERBUFFER,ne.__webglColorRenderbuffer[De])}r.bindRenderbuffer(r.RENDERBUFFER,null),B.depthBuffer&&(ne.__webglDepthRenderbuffer=r.createRenderbuffer(),de(ne.__webglDepthRenderbuffer,B,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ce){t.bindTexture(r.TEXTURE_CUBE_MAP,ge.__webglTexture),K(r.TEXTURE_CUBE_MAP,A);for(let De=0;De<6;De++)if(A.mipmaps&&A.mipmaps.length>0)for(let $e=0;$e<A.mipmaps.length;$e++)ie(ne.__webglFramebuffer[De][$e],B,A,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+De,$e);else ie(ne.__webglFramebuffer[De],B,A,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+De,0);g(A)&&v(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ne){for(let De=0,$e=ue.length;De<$e;De++){const Je=ue[De],Ee=n.get(Je);t.bindTexture(r.TEXTURE_2D,Ee.__webglTexture),K(r.TEXTURE_2D,Je),ie(ne.__webglFramebuffer,B,Je,r.COLOR_ATTACHMENT0+De,r.TEXTURE_2D,0),g(Je)&&v(r.TEXTURE_2D)}t.unbindTexture()}else{let De=r.TEXTURE_2D;if((B.isWebGL3DRenderTarget||B.isWebGLArrayRenderTarget)&&(De=B.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(De,ge.__webglTexture),K(De,A),A.mipmaps&&A.mipmaps.length>0)for(let $e=0;$e<A.mipmaps.length;$e++)ie(ne.__webglFramebuffer[$e],B,A,r.COLOR_ATTACHMENT0,De,$e);else ie(ne.__webglFramebuffer,B,A,r.COLOR_ATTACHMENT0,De,0);g(A)&&v(De),t.unbindTexture()}B.depthBuffer&&we(B)}function F(B){const A=B.textures;for(let ne=0,ge=A.length;ne<ge;ne++){const ue=A[ne];if(g(ue)){const ce=y(B),Ne=n.get(ue).__webglTexture;t.bindTexture(ce,Ne),v(ce),t.unbindTexture()}}}const pe=[],me=[];function be(B){if(B.samples>0){if(Se(B)===!1){const A=B.textures,ne=B.width,ge=B.height;let ue=r.COLOR_BUFFER_BIT;const ce=B.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ne=n.get(B),De=A.length>1;if(De)for(let Je=0;Je<A.length;Je++)t.bindFramebuffer(r.FRAMEBUFFER,Ne.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Je,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ne.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Je,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ne.__webglMultisampledFramebuffer);const $e=B.texture.mipmaps;$e&&$e.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ne.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ne.__webglFramebuffer);for(let Je=0;Je<A.length;Je++){if(B.resolveDepthBuffer&&(B.depthBuffer&&(ue|=r.DEPTH_BUFFER_BIT),B.stencilBuffer&&B.resolveStencilBuffer&&(ue|=r.STENCIL_BUFFER_BIT)),De){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ne.__webglColorRenderbuffer[Je]);const Ee=n.get(A[Je]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Ee,0)}r.blitFramebuffer(0,0,ne,ge,0,0,ne,ge,ue,r.NEAREST),l===!0&&(pe.length=0,me.length=0,pe.push(r.COLOR_ATTACHMENT0+Je),B.depthBuffer&&B.resolveDepthBuffer===!1&&(pe.push(ce),me.push(ce),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,me)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,pe))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),De)for(let Je=0;Je<A.length;Je++){t.bindFramebuffer(r.FRAMEBUFFER,Ne.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Je,r.RENDERBUFFER,Ne.__webglColorRenderbuffer[Je]);const Ee=n.get(A[Je]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ne.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Je,r.TEXTURE_2D,Ee,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ne.__webglMultisampledFramebuffer)}else if(B.depthBuffer&&B.resolveDepthBuffer===!1&&l){const A=B.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[A])}}}function se(B){return Math.min(i.maxSamples,B.samples)}function Se(B){const A=n.get(B);return B.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&A.__useRenderToTexture!==!1}function he(B){const A=o.render.frame;u.get(B)!==A&&(u.set(B,A),B.update())}function le(B,A){const ne=B.colorSpace,ge=B.format,ue=B.type;return B.isCompressedTexture===!0||B.isVideoTexture===!0||ne!==Fa&&ne!==Fs&&(rn.getTransfer(ne)===Mn?(ge!==qi||ue!==$r)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),A}function He(B){return typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement?(c.width=B.naturalWidth||B.width,c.height=B.naturalHeight||B.height):typeof VideoFrame<"u"&&B instanceof VideoFrame?(c.width=B.displayWidth,c.height=B.displayHeight):(c.width=B.width,c.height=B.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=R,this.setTexture2D=H,this.setTexture2DArray=P,this.setTexture3D=ee,this.setTextureCube=X,this.rebindTextures=_e,this.setupRenderTarget=Re,this.updateRenderTargetMipmap=F,this.updateMultisampleRenderTarget=be,this.setupDepthRenderbuffer=we,this.setupFrameBufferTexture=ie,this.useMultisampledRTT=Se}function vM(r,e){function t(n,i=Fs){let s;const o=rn.getTransfer(i);if(n===$r)return r.UNSIGNED_BYTE;if(n===om)return r.UNSIGNED_SHORT_4_4_4_4;if(n===am)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Z0)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Y0)return r.BYTE;if(n===$0)return r.SHORT;if(n===ec)return r.UNSIGNED_SHORT;if(n===sm)return r.INT;if(n===js)return r.UNSIGNED_INT;if(n===ar)return r.FLOAT;if(n===hc)return r.HALF_FLOAT;if(n===J0)return r.ALPHA;if(n===K0)return r.RGB;if(n===qi)return r.RGBA;if(n===nc)return r.DEPTH_COMPONENT;if(n===ic)return r.DEPTH_STENCIL;if(n===lm)return r.RED;if(n===zd)return r.RED_INTEGER;if(n===Q0)return r.RG;if(n===cm)return r.RG_INTEGER;if(n===um)return r.RGBA_INTEGER;if(n===Qc||n===eu||n===tu||n===nu)if(o===Mn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Qc)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===eu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===tu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===nu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Qc)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===eu)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===tu)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===nu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===$f||n===Zf||n===Jf||n===Kf)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===$f)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Zf)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Jf)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Kf)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Qf||n===ep||n===tp)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Qf||n===ep)return o===Mn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===tp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===np||n===ip||n===rp||n===sp||n===op||n===ap||n===lp||n===cp||n===up||n===dp||n===hp||n===fp||n===pp||n===mp)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===np)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ip)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===rp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===sp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===op)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ap)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===lp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===cp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===up)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===dp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===hp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===fp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===pp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===mp)return o===Mn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===iu||n===gp||n===vp)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===iu)return o===Mn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===gp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===vp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ey||n===yp||n===_p||n===xp)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===iu)return s.COMPRESSED_RED_RGT
vendor: 9,934 bytes, lines 3804-3828
3804C1_EXT;if(n===yp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===_p)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===xp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===tc?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const rk=`
3805void main() {
3806
3807	gl_Position = vec4( position, 1.0 );
3808
3809}`,sk=`
3810uniform sampler2DArray depthColor;
3811uniform float depthWidth;
3812uniform float depthHeight;
3813
3814void main() {
3815
3816	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3817
3818	if ( coord.x >= 1.0 ) {
3819
3820		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3821
3822	} else {
3823
3824		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
3825
3826	}
3827
3828}`;class ok{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new Wn,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Dr({vertexShader:rk,fragmentShader:sk,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new fn(new Zs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ak extends vs{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,d=null,h=null,f=null,p=null;const m=new ok,g=t.getContextAttributes();let v=null,y=null;const _=[],x=[],T=new Ue;let b=null;const M=new Qn;M.viewport=new Kt;const E=new Qn;E.viewport=new Kt;const S=[M,E],w=new oM;let D=null,R=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let U=_[O];return U===void 0&&(U=new Ef,_[O]=U),U.getTargetRaySpace()},this.getControllerGrip=function(O){let U=_[O];return U===void 0&&(U=new Ef,_[O]=U),U.getGripSpace()},this.getHand=function(O){let U=_[O];return U===void 0&&(U=new Ef,_[O]=U),U.getHandSpace()};function k(O){const U=x.indexOf(O.inputSource);if(U===-1)return;const W=_[U];W!==void 0&&(W.update(O.inputSource,O.frame,c||o),W.dispatchEvent({type:O.type,data:O.inputSource}))}function N(){i.removeEventListener("select",k),i.removeEventListener("selectstart",k),i.removeEventListener("selectend",k),i.removeEventListener("squeeze",k),i.removeEventListener("squeezestart",k),i.removeEventListener("squeezeend",k),i.removeEventListener("end",N),i.removeEventListener("inputsourceschange",H);for(let O=0;O<_.length;O++){const U=x[O];U!==null&&(x[O]=null,_[O].disconnect(U))}D=null,R=null,m.reset(),e.setRenderTarget(v),f=null,h=null,d=null,i=null,y=null,te.stop(),n.isPresenting=!1,e.setPixelRatio(b),e.setSize(T.width,T.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){s=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){a=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(O){c=O},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return d},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(O){if(i=O,i!==null){if(v=e.getRenderTarget(),i.addEventListener("select",k),i.addEventListener("selectstart",k),i.addEventListener("selectend",k),i.addEventListener("squeeze",k),i.addEventListener("squeezestart",k),i.addEventListener("squeezeend",k),i.addEventListener("end",N),i.addEventListener("inputsourceschange",H),g.xrCompatible!==!0&&await t.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(T),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let W=null,j=null,ie=null;g.depth&&(ie=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,W=g.stencil?ic:nc,j=g.stencil?tc:js);const de={colorFormat:t.RGBA8,depthFormat:ie,scaleFactor:s};d=new XRWebGLBinding(i,t),h=d.createProjectionLayer(de),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),y=new gs(h.textureWidth,h.textureHeight,{format:qi,type:$r,depthTexture:new cy(h.textureWidth,h.textureHeight,j,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const W={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,W),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new gs(f.framebufferWidth,f.framebufferHeight,{format:qi,type:$r,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),te.setContext(i),te.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function H(O){for(let U=0;U<O.removed.length;U++){const W=O.removed[U],j=x.indexOf(W);j>=0&&(x[j]=null,_[j].disconnect(W))}for(let U=0;U<O.added.length;U++){const W=O.added[U];let j=x.indexOf(W);if(j===-1){for(let de=0;de<_.length;de++)if(de>=x.length){x.push(W),j=de;break}else if(x[de]===null){x[de]=W,j=de;break}if(j===-1)break}const ie=_[j];ie&&ie.connect(W)}}const P=new V,ee=new V;function X(O,U,W){P.setFromMatrixPosition(U.matrixWorld),ee.setFromMatrixPosition(W.matrixWorld);const j=P.distanceTo(ee),ie=U.projectionMatrix.elements,de=W.projectionMatrix.elements,ye=ie[14]/(ie[10]-1),we=ie[14]/(ie[10]+1),_e=(ie[9]+1)/ie[5],Re=(ie[9]-1)/ie[5],F=(ie[8]-1)/ie[0],pe=(de[8]+1)/de[0],me=ye*F,be=ye*pe,se=j/(-F+pe),Se=se*-F;if(U.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(Se),O.translateZ(se),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert(),ie[10]===-1)O.projectionMatrix.copy(U.projectionMatrix),O.projectionMatrixInverse.copy(U.projectionMatrixInverse);else{const he=ye+se,le=we+se,He=me-Se,B=be+(j-Se),A=_e*we/le*he,ne=Re*we/le*he;O.projectionMatrix.makePerspective(He,B,A,ne,he,le),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}}function Q(O,U){U===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(U.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(i===null)return;let U=O.near,W=O.far;m.texture!==null&&(m.depthNear>0&&(U=m.depthNear),m.depthFar>0&&(W=m.depthFar)),w.near=E.near=M.near=U,w.far=E.far=M.far=W,(D!==w.near||R!==w.far)&&(i.updateRenderState({depthNear:w.near,depthFar:w.far}),D=w.near,R=w.far),M.layers.mask=O.layers.mask|2,E.layers.mask=O.layers.mask|4,w.layers.mask=M.layers.mask|E.layers.mask;const j=O.parent,ie=w.cameras;Q(w,j);for(let de=0;de<ie.length;de++)Q(ie[de],j);ie.length===2?X(w,M,E):w.projectionMatrix.copy(M.projectionMatrix),Y(O,w,j)};function Y(O,U,W){W===null?O.matrix.copy(U.matrixWorld):(O.matrix.copy(W.matrixWorld),O.matrix.invert(),O.matrix.multiply(U.matrixWorld)),O.matrix.decompose(O.position,O.quaternion,O.scale),O.updateMatrixWorld(!0),O.projectionMatrix.copy(U.projectionMatrix),O.projectionMatrixInverse.copy(U.projectionMatrixInverse),O.isPerspectiveCamera&&(O.fov=rc*2*Math.atan(1/O.projectionMatrix.elements[5]),O.zoom=1)}this.getCamera=function(){return w},this.getFoveation=function(){if(!(h===null&&f===null))return l},this.setFoveation=function(O){l=O,h!==null&&(h.fixedFoveation=O),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=O)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(w)};let z=null;function K(O,U){if(u=U.getViewerPose(c||o),p=U,u!==null){const W=u.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let j=!1;W.length!==w.cameras.length&&(w.cameras.length=0,j=!0);for(let ye=0;ye<W.length;ye++){const we=W[ye];let _e=null;if(f!==null)_e=f.getViewport(we);else{const F=d.getViewSubImage(h,we);_e=F.viewport,ye===0&&(e.setRenderTargetTextures(y,F.colorTexture,F.depthStencilTexture),e.setRenderTarget(y))}let Re=S[ye];Re===void 0&&(Re=new Qn,Re.layers.enable(ye),Re.viewport=new Kt,S[ye]=Re),Re.matrix.fromArray(we.transform.matrix),Re.matrix.decompose(Re.position,Re.quaternion,Re.scale),Re.projectionMatrix.fromArray(we.projectionMatrix),Re.projectionMatrixInverse.copy(Re.projectionMatrix).invert(),Re.viewport.set(_e.x,_e.y,_e.width,_e.height),ye===0&&(w.matrix.copy(Re.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale)),j===!0&&w.cameras.push(Re)}const ie=i.enabledFeatures;if(ie&&ie.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&d){const ye=d.getDepthInformation(W[0]);ye&&ye.isValid&&ye.texture&&m.init(e,ye,i.renderState)}}for(let W=0;W<_.length;W++){const j=x[W],ie=_[W];j!==null&&ie!==void 0&&ie.update(j,U,c||o)}z&&z(O,U),U.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:U}),p=null}const te=new hM;te.setAnimationLoop(K),this.setAnimationLoop=function(O){z=O},this.dispose=function(){}}}const $o=new xr,lk=new St;function ck(r,e){function t(g,v){g.matrixAutoUpdate===!0&&g.updateMatrix(),v.value.copy(g.matrix)}function n(g,v){v.color.getRGB(g.fogColor.value,bS(r)),v.isFog?(g.fogNear.value=v.near,g.fogFar.value=v.far):v.isFogExp2&&(g.fogDensity.value=v.density)}function i(g,v,y,_,x){v.isMeshBasicMaterial||v.isMeshLambertMaterial?s(g,v):v.isMeshToonMaterial?(s(g,v),d(g,v)):v.isMeshPhongMaterial?(s(g,v),u(g,v)):v.isMeshStandardMaterial?(s(g,v),h(g,v),v.isMeshPhysicalMaterial&&f(g,v,x)):v.isMeshMat
vendor: 11,398 bytes, line 3828
3828capMaterial?(s(g,v),p(g,v)):v.isMeshDepthMaterial?s(g,v):v.isMeshDistanceMaterial?(s(g,v),m(g,v)):v.isMeshNormalMaterial?s(g,v):v.isLineBasicMaterial?(o(g,v),v.isLineDashedMaterial&&a(g,v)):v.isPointsMaterial?l(g,v,y,_):v.isSpriteMaterial?c(g,v):v.isShadowMaterial?(g.color.value.copy(v.color),g.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function s(g,v){g.opacity.value=v.opacity,v.color&&g.diffuse.value.copy(v.color),v.emissive&&g.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(g.map.value=v.map,t(v.map,g.mapTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,t(v.alphaMap,g.alphaMapTransform)),v.bumpMap&&(g.bumpMap.value=v.bumpMap,t(v.bumpMap,g.bumpMapTransform),g.bumpScale.value=v.bumpScale,v.side===Fi&&(g.bumpScale.value*=-1)),v.normalMap&&(g.normalMap.value=v.normalMap,t(v.normalMap,g.normalMapTransform),g.normalScale.value.copy(v.normalScale),v.side===Fi&&g.normalScale.value.negate()),v.displacementMap&&(g.displacementMap.value=v.displacementMap,t(v.displacementMap,g.displacementMapTransform),g.displacementScale.value=v.displacementScale,g.displacementBias.value=v.displacementBias),v.emissiveMap&&(g.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,g.emissiveMapTransform)),v.specularMap&&(g.specularMap.value=v.specularMap,t(v.specularMap,g.specularMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest);const y=e.get(v),_=y.envMap,x=y.envMapRotation;_&&(g.envMap.value=_,$o.copy(x),$o.x*=-1,$o.y*=-1,$o.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&($o.y*=-1,$o.z*=-1),g.envMapRotation.value.setFromMatrix4(lk.makeRotationFromEuler($o)),g.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=v.reflectivity,g.ior.value=v.ior,g.refractionRatio.value=v.refractionRatio),v.lightMap&&(g.lightMap.value=v.lightMap,g.lightMapIntensity.value=v.lightMapIntensity,t(v.lightMap,g.lightMapTransform)),v.aoMap&&(g.aoMap.value=v.aoMap,g.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,g.aoMapTransform))}function o(g,v){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,v.map&&(g.map.value=v.map,t(v.map,g.mapTransform))}function a(g,v){g.dashSize.value=v.dashSize,g.totalSize.value=v.dashSize+v.gapSize,g.scale.value=v.scale}function l(g,v,y,_){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,g.size.value=v.size*y,g.scale.value=_*.5,v.map&&(g.map.value=v.map,t(v.map,g.uvTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,t(v.alphaMap,g.alphaMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest)}function c(g,v){g.diffuse.value.copy(v.color),g.opacity.value=v.opacity,g.rotation.value=v.rotation,v.map&&(g.map.value=v.map,t(v.map,g.mapTransform)),v.alphaMap&&(g.alphaMap.value=v.alphaMap,t(v.alphaMap,g.alphaMapTransform)),v.alphaTest>0&&(g.alphaTest.value=v.alphaTest)}function u(g,v){g.specular.value.copy(v.specular),g.shininess.value=Math.max(v.shininess,1e-4)}function d(g,v){v.gradientMap&&(g.gradientMap.value=v.gradientMap)}function h(g,v){g.metalness.value=v.metalness,v.metalnessMap&&(g.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,g.metalnessMapTransform)),g.roughness.value=v.roughness,v.roughnessMap&&(g.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,g.roughnessMapTransform)),v.envMap&&(g.envMapIntensity.value=v.envMapIntensity)}function f(g,v,y){g.ior.value=v.ior,v.sheen>0&&(g.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),g.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(g.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,g.sheenColorMapTransform)),v.sheenRoughnessMap&&(g.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,g.sheenRoughnessMapTransform))),v.clearcoat>0&&(g.clearcoat.value=v.clearcoat,g.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(g.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,g.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(g.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===Fi&&g.clearcoatNormalScale.value.negate())),v.dispersion>0&&(g.dispersion.value=v.dispersion),v.iridescence>0&&(g.iridescence.value=v.iridescence,g.iridescenceIOR.value=v.iridescenceIOR,g.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(g.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,g.iridescenceMapTransform)),v.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),v.transmission>0&&(g.transmission.value=v.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),v.transmissionMap&&(g.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,g.transmissionMapTransform)),g.thickness.value=v.thickness,v.thicknessMap&&(g.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=v.attenuationDistance,g.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(g.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(g.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=v.specularIntensity,g.specularColor.value.copy(v.specularColor),v.specularColorMap&&(g.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,g.specularColorMapTransform)),v.specularIntensityMap&&(g.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,v){v.matcap&&(g.matcap.value=v.matcap)}function m(g,v){const y=e.get(v).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function uk(r,e,t,n){let i={},s={},o=[];const a=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,_){const x=_.program;n.uniformBlockBinding(y,x)}function c(y,_){let x=i[y.id];x===void 0&&(p(y),x=u(y),i[y.id]=x,y.addEventListener("dispose",g));const T=_.program;n.updateUBOMapping(y,T);const b=e.render.frame;s[y.id]!==b&&(h(y),s[y.id]=b)}function u(y){const _=d();y.__bindingPointIndex=_;const x=r.createBuffer(),T=y.__size,b=y.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,T,b),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,_,x),x}function d(){for(let y=0;y<a;y++)if(o.indexOf(y)===-1)return o.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(y){const _=i[y.id],x=y.uniforms,T=y.__cache;r.bindBuffer(r.UNIFORM_BUFFER,_);for(let b=0,M=x.length;b<M;b++){const E=Array.isArray(x[b])?x[b]:[x[b]];for(let S=0,w=E.length;S<w;S++){const D=E[S];if(f(D,b,S,T)===!0){const R=D.__offset,k=Array.isArray(D.value)?D.value:[D.value];let N=0;for(let H=0;H<k.length;H++){const P=k[H],ee=m(P);typeof P=="number"||typeof P=="boolean"?(D.__data[0]=P,r.bufferSubData(r.UNIFORM_BUFFER,R+N,D.__data)):P.isMatrix3?(D.__data[0]=P.elements[0],D.__data[1]=P.elements[1],D.__data[2]=P.elements[2],D.__data[3]=0,D.__data[4]=P.elements[3],D.__data[5]=P.elements[4],D.__data[6]=P.elements[5],D.__data[7]=0,D.__data[8]=P.elements[6],D.__data[9]=P.elements[7],D.__data[10]=P.elements[8],D.__data[11]=0):(P.toArray(D.__data,N),N+=ee.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,R,D.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(y,_,x,T){const b=y.value,M=_+"_"+x;if(T[M]===void 0)return typeof b=="number"||typeof b=="boolean"?T[M]=b:T[M]=b.clone(),!0;{const E=T[M];if(typeof b=="number"||typeof b=="boolean"){if(E!==b)return T[M]=b,!0}else if(E.equals(b)===!1)return E.copy(b),!0}return!1}function p(y){const _=y.uniforms;let x=0;const T=16;for(let M=0,E=_.length;M<E;M++){const S=Array.isArray(_[M])?_[M]:[_[M]];for(let w=0,D=S.length;w<D;w++){const R=S[w],k=Array.isArray(R.value)?R.value:[R.value];for(let N=0,H=k.length;N<H;N++){const P=k[N],ee=m(P),X=x%T,Q=X%ee.boundary,Y=X+Q;x+=Q,Y!==0&&T-Y<ee.storage&&(x+=T-Y),R.__data=new Float32Array(ee.storage/Float32Array.BYTES_PER_ELEMENT),R.__offset=x,x+=ee.storage}}}const b=x%T;return b>0&&(x+=T-b),y.__size=x,y.__cache={},this}function m(y){const _={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(_.boundary=4,_.storage=4):y.isVector2?(_.boundary=8,_.storage=8):y.isVector3||y.isColor?(_.boundary=16,_.storage=12):y.isVector4?(_.boundary=16,_.storage=16):y.isMatrix3?(_.boundary=48,_.storage=48):y.isMatrix4?(_.boundary=64,_.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),_}function g(y){const _=y.target;_.removeEventListener("dispose",g);const x=o.indexOf(_.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(i[_.id]),delete i[_.id],delete s[_.id]}function v(){for(const y in i)r.deleteBuffer(i[y]);o=[],i={},s={}}return{bind:l,update:c,dispose:v}}class yM{constructor(e={}){const{canvas:t=yS(),context:n=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:h=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=o;const p=new Uint32Array(4),m=new Int32Array(4);let g=null,v=null;const y=[],_=[];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=hs,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const x=this;let T=!1;this._outputColorSpace=Ln;let b=0,M=0,E=null,S=-1,w=null;const D=new Kt,R=new Kt;let k=null;const N=new st(0);let H=0,P=t.width,ee=t.height,X=1,Q=null,Y=null;const z=new Kt(0,0,P,ee),K=new Kt(0,0,P,ee);let te=!1;const O=new pc;let U=!1,W=!1;const j=new St,ie=new St,de=new V,ye=new Kt,we={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let _e=!1;function Re(){return E===null?X:1}let F=n;function pe(q,ve){return t.getContext(q,ve)}try{const q={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Fd}`),t.addEventListener("webglcontextlost",Xe,!1),t.addEventListener("webglcontextrestored",Me,!1),t.addEventListener("webglcontextcreationerror",Ce,!1),F===null){const ve="webgl2";if(F=pe(ve,q),F===null)throw pe(ve)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let me,be,se,Se,he,le,He,B,A,ne,ge,ue,ce,Ne,De,$e,Je,Ee,Ge,Ye,it,Ze,ht,oe;
vendor: 7,184 bytes, line 3828
3828function Oe(){me=new wD(F),me.init(),Ze=new vM(F,me),be=new mD(F,me,e,Ze),se=new nk(F,me),be.reverseDepthBuffer&&h&&se.buffers.depth.setReversed(!0),Se=new ED(F),he=new HL,le=new ik(F,me,se,he,be,Ze,Se),He=new vD(x),B=new bD(x),A=new IP(F),ht=new fD(F,A),ne=new SD(F,A,Se,ht),ge=new AD(F,ne,A,Se),Ge=new TD(F,be,le),$e=new gD(he),ue=new GL(x,He,B,me,be,ht,$e),ce=new ck(x,he),Ne=new jL,De=new JL(me),Ee=new hD(x,He,B,se,ge,f,l),Je=new ek(x,ge,be),oe=new uk(F,Se,be,se),Ye=new pD(F,me,Se),it=new MD(F,me,Se),Se.programs=ue.programs,x.capabilities=be,x.extensions=me,x.properties=he,x.renderLists=Ne,x.shadowMap=Je,x.state=se,x.info=Se}Oe();const ke=new ak(x,F);this.xr=ke,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){const q=me.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){const q=me.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(q){q!==void 0&&(X=q,this.setSize(P,ee,!1))},this.getSize=function(q){return q.set(P,ee)},this.setSize=function(q,ve,Te=!0){if(ke.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}P=q,ee=ve,t.width=Math.floor(q*X),t.height=Math.floor(ve*X),Te===!0&&(t.style.width=q+"px",t.style.height=ve+"px"),this.setViewport(0,0,q,ve)},this.getDrawingBufferSize=function(q){return q.set(P*X,ee*X).floor()},this.setDrawingBufferSize=function(q,ve,Te){P=q,ee=ve,X=Te,t.width=Math.floor(q*Te),t.height=Math.floor(ve*Te),this.setViewport(0,0,q,ve)},this.getCurrentViewport=function(q){return q.copy(D)},this.getViewport=function(q){return q.copy(z)},this.setViewport=function(q,ve,Te,fe){q.isVector4?z.set(q.x,q.y,q.z,q.w):z.set(q,ve,Te,fe),se.viewport(D.copy(z).multiplyScalar(X).round())},this.getScissor=function(q){return q.copy(K)},this.setScissor=function(q,ve,Te,fe){q.isVector4?K.set(q.x,q.y,q.z,q.w):K.set(q,ve,Te,fe),se.scissor(R.copy(K).multiplyScalar(X).round())},this.getScissorTest=function(){return te},this.setScissorTest=function(q){se.setScissorTest(te=q)},this.setOpaqueSort=function(q){Q=q},this.setTransparentSort=function(q){Y=q},this.getClearColor=function(q){return q.copy(Ee.getClearColor())},this.setClearColor=function(){Ee.setClearColor(...arguments)},this.getClearAlpha=function(){return Ee.getClearAlpha()},this.setClearAlpha=function(){Ee.setClearAlpha(...arguments)},this.clear=function(q=!0,ve=!0,Te=!0){let fe=0;if(q){let xe=!1;if(E!==null){const et=E.texture.format;xe=et===um||et===cm||et===zd}if(xe){const et=E.texture.type,at=et===$r||et===js||et===ec||et===tc||et===om||et===am,_t=Ee.getClearColor(),pt=Ee.getClearAlpha(),Ot=_t.r,Ut=_t.g,Ct=_t.b;at?(p[0]=Ot,p[1]=Ut,p[2]=Ct,p[3]=pt,F.clearBufferuiv(F.COLOR,0,p)):(m[0]=Ot,m[1]=Ut,m[2]=Ct,m[3]=pt,F.clearBufferiv(F.COLOR,0,m))}else fe|=F.COLOR_BUFFER_BIT}ve&&(fe|=F.DEPTH_BUFFER_BIT),Te&&(fe|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),F.clear(fe)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Xe,!1),t.removeEventListener("webglcontextrestored",Me,!1),t.removeEventListener("webglcontextcreationerror",Ce,!1),Ee.dispose(),Ne.dispose(),De.dispose(),he.dispose(),He.dispose(),B.dispose(),ge.dispose(),ht.dispose(),oe.dispose(),ue.dispose(),ke.dispose(),ke.removeEventListener("sessionstart",vn),ke.removeEventListener("sessionend",Cn),On.stop()};function Xe(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const q=Se.autoReset,ve=Je.enabled,Te=Je.autoUpdate,fe=Je.needsUpdate,xe=Je.type;Oe(),Se.autoReset=q,Je.enabled=ve,Je.autoUpdate=Te,Je.needsUpdate=fe,Je.type=xe}function Ce(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function nt(q){const ve=q.target;ve.removeEventListener("dispose",nt),ct(ve)}function ct(q){dt(q),he.remove(q)}function dt(q){const ve=he.get(q).programs;ve!==void 0&&(ve.forEach(function(Te){ue.releaseProgram(Te)}),q.isShaderMaterial&&ue.releaseShaderCache(q))}this.renderBufferDirect=function(q,ve,Te,fe,xe,et){ve===null&&(ve=we);const at=xe.isMesh&&xe.matrixWorld.determinant()<0,_t=bc(q,ve,Te,fe,xe);se.setMaterial(fe,at);let pt=Te.index,Ot=1;if(fe.wireframe===!0){if(pt=ne.getWireframeAttribute(Te),pt===void 0)return;Ot=2}const Ut=Te.drawRange,Ct=Te.attributes.position;let Xt=Ut.start*Ot,ln=(Ut.start+Ut.count)*Ot;et!==null&&(Xt=Math.max(Xt,et.start*Ot),ln=Math.min(ln,(et.start+et.count)*Ot)),pt!==null?(Xt=Math.max(Xt,0),ln=Math.min(ln,pt.count)):Ct!=null&&(Xt=Math.max(Xt,0),ln=Math.min(ln,Ct.count));const wn=ln-Xt;if(wn<0||wn===1/0)return;ht.setup(xe,fe,_t,Te,pt);let Tn,on=Ye;if(pt!==null&&(Tn=A.get(pt),on=it,on.setIndex(Tn)),xe.isMesh)fe.wireframe===!0?(se.setLineWidth(fe.wireframeLinewidth*Re()),on.setMode(F.LINES)):on.setMode(F.TRIANGLES);else if(xe.isLine){let It=fe.linewidth;It===void 0&&(It=1),se.setLineWidth(It*Re()),xe.isLineSegments?on.setMode(F.LINES):xe.isLineLoop?on.setMode(F.LINE_LOOP):on.setMode(F.LINE_STRIP)}else xe.isPoints?on.setMode(F.POINTS):xe.isSprite&&on.setMode(F.TRIANGLES);if(xe.isBatchedMesh)if(xe._multiDrawInstances!==null)kl("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),on.renderMultiDrawInstances(xe._multiDrawStarts,xe._multiDrawCounts,xe._multiDrawCount,xe._multiDrawInstances);else if(me.get("WEBGL_multi_draw"))on.renderMultiDraw(xe._multiDrawStarts,xe._multiDrawCounts,xe._multiDrawCount);else{const It=xe._multiDrawStarts,Bn=xe._multiDrawCounts,tn=xe._multiDrawCount,mi=pt?A.get(pt).bytesPerElement:1,xn=he.get(fe).currentProgram.getUniforms();for(let Jn=0;Jn<tn;Jn++)xn.setValue(F,"_gl_DrawID",Jn),on.render(It[Jn]/mi,Bn[Jn])}else if(xe.isInstancedMesh)on.renderInstances(Xt,wn,xe.count);else if(Te.isInstancedBufferGeometry){const It=Te._maxInstanceCount!==void 0?Te._maxInstanceCount:1/0,Bn=Math.min(Te.instanceCount,It);on.renderInstances(Xt,wn,Bn)}else on.render(Xt,wn)};function ft(q,ve,Te){q.transparent===!0&&q.side===si&&q.forceSinglePass===!1?(q.side=Fi,q.needsUpdate=!0,Di(q,ve,Te),q.side=ms,q.needsUpdate=!0,Di(q,ve,Te),q.side=si):Di(q,ve,Te)}this.compile=function(q,ve,Te=null){Te===null&&(Te=q),v=De.get(Te),v.init(ve),_.push(v),Te.traverseVisible(function(xe){xe.isLight&&xe.layers.test(ve.layers)&&(v.pushLight(xe),xe.castShadow&&v.pushShadow(xe))}),q!==Te&&q.traverseVisible(function(xe){xe.isLight&&xe.layers.test(ve.layers)&&(v.pushLight(xe),xe.castShadow&&v.pushShadow(xe))}),v.setupLights();const fe=new Set;return q.traverse(function(xe){if(!(xe.isMesh||xe.isPoints||xe.isLine||xe.isSprite))return;const et=xe.material;if(et)if(Array.isArray(et))for(let at=0;at<et.length;at++){const _t=et[at];ft(_t,Te,xe),fe.add(_t)}else ft(et,Te,xe),fe.add(et)}),v=_.pop(),fe},this.compileAsync=function(q,ve,Te=null){const fe=this.compile(q,ve,Te);return new Promise(xe=>
vendor: 6,117 bytes, line 3828
3828{function et(){if(fe.forEach(function(at){he.get(at).currentProgram.isReady()&&fe.delete(at)}),fe.size===0){xe(q);return}setTimeout(et,10)}me.get("KHR_parallel_shader_compile")!==null?et():setTimeout(et,10)})};let qt=null;function sn(q){qt&&qt(q)}function vn(){On.stop()}function Cn(){On.start()}const On=new hM;On.setAnimationLoop(sn),typeof self<"u"&&On.setContext(self),this.setAnimationLoop=function(q){qt=q,ke.setAnimationLoop(q),q===null?On.stop():On.start()},ke.addEventListener("sessionstart",vn),ke.addEventListener("sessionend",Cn),this.render=function(q,ve){if(ve!==void 0&&ve.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),ve.parent===null&&ve.matrixWorldAutoUpdate===!0&&ve.updateMatrixWorld(),ke.enabled===!0&&ke.isPresenting===!0&&(ke.cameraAutoUpdate===!0&&ke.updateCamera(ve),ve=ke.getCamera()),q.isScene===!0&&q.onBeforeRender(x,q,ve,E),v=De.get(q,_.length),v.init(ve),_.push(v),ie.multiplyMatrices(ve.projectionMatrix,ve.matrixWorldInverse),O.setFromProjectionMatrix(ie),W=this.localClippingEnabled,U=$e.init(this.clippingPlanes,W),g=Ne.get(q,y.length),g.init(),y.push(g),ke.enabled===!0&&ke.isPresenting===!0){const et=x.xr.getDepthSensingMesh();et!==null&&fi(et,ve,-1/0,x.sortObjects)}fi(q,ve,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(Q,Y),_e=ke.enabled===!1||ke.isPresenting===!1||ke.hasDepthSensing()===!1,_e&&Ee.addToRenderList(g,q),this.info.render.frame++,U===!0&&$e.beginShadows();const Te=v.state.shadowsArray;Je.render(Te,q,ve),U===!0&&$e.endShadows(),this.info.autoReset===!0&&this.info.reset();const fe=g.opaque,xe=g.transmissive;if(v.setupLights(),ve.isArrayCamera){const et=ve.cameras;if(xe.length>0)for(let at=0,_t=et.length;at<_t;at++){const pt=et[at];Vi(fe,xe,q,pt)}_e&&Ee.render(q);for(let at=0,_t=et.length;at<_t;at++){const pt=et[at];zi(g,q,pt,pt.viewport)}}else xe.length>0&&Vi(fe,xe,q,ve),_e&&Ee.render(q),zi(g,q,ve);E!==null&&M===0&&(le.updateMultisampleRenderTarget(E),le.updateRenderTargetMipmap(E)),q.isScene===!0&&q.onAfterRender(x,q,ve),ht.resetDefaultState(),S=-1,w=null,_.pop(),_.length>0?(v=_[_.length-1],U===!0&&$e.setGlobalState(x.clippingPlanes,v.state.camera)):v=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function fi(q,ve,Te,fe){if(q.visible===!1)return;if(q.layers.test(ve.layers)){if(q.isGroup)Te=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(ve);else if(q.isLight)v.pushLight(q),q.castShadow&&v.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||O.intersectsSprite(q)){fe&&ye.setFromMatrixPosition(q.matrixWorld).applyMatrix4(ie);const at=ge.update(q),_t=q.material;_t.visible&&g.push(q,at,_t,Te,ye.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||O.intersectsObject(q))){const at=ge.update(q),_t=q.material;if(fe&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),ye.copy(q.boundingSphere.center)):(at.boundingSphere===null&&at.computeBoundingSphere(),ye.copy(at.boundingSphere.center)),ye.applyMatrix4(q.matrixWorld).applyMatrix4(ie)),Array.isArray(_t)){const pt=at.groups;for(let Ot=0,Ut=pt.length;Ot<Ut;Ot++){const Ct=pt[Ot],Xt=_t[Ct.materialIndex];Xt&&Xt.visible&&g.push(q,at,Xt,Te,ye.z,Ct)}}else _t.visible&&g.push(q,at,_t,Te,ye.z,null)}}const et=q.children;for(let at=0,_t=et.length;at<_t;at++)fi(et[at],ve,Te,fe)}function zi(q,ve,Te,fe){const xe=q.opaque,et=q.transmissive,at=q.transparent;v.setupLightsView(Te),U===!0&&$e.setGlobalState(x.clippingPlanes,Te),fe&&se.viewport(D.copy(fe)),xe.length>0&&pi(xe,ve,Te),et.length>0&&pi(et,ve,Te),at.length>0&&pi(at,ve,Te),se.buffers.depth.setTest(!0),se.buffers.depth.setMask(!0),se.buffers.color.setMask(!0),se.setPolygonOffset(!1)}function Vi(q,ve,Te,fe){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;v.state.transmissionRenderTarget[fe.id]===void 0&&(v.state.transmissionRenderTarget[fe.id]=new gs(1,1,{generateMipmaps:!0,type:me.has("EXT_color_buffer_half_float")||me.has("EXT_color_buffer_float")?hc:$r,minFilter:Hr,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rn.workingColorSpace}));const et=v.state.transmissionRenderTarget[fe.id],at=fe.viewport||D;et.setSize(at.z*x.transmissionResolutionScale,at.w*x.transmissionResolutionScale);const _t=x.getRenderTarget();x.setRenderTarget(et),x.getClearColor(N),H=x.getClearAlpha(),H<1&&x.setClearColor(16777215,.5),x.clear(),_e&&Ee.render(Te);const pt=x.toneMapping;x.toneMapping=hs;const Ot=fe.viewport;if(fe.viewport!==void 0&&(fe.viewport=void 0),v.setupLightsView(fe),U===!0&&$e.setGlobalState(x.clippingPlanes,fe),pi(q,Te,fe),le.updateMultisampleRenderTarget(et),le.updateRenderTargetMipmap(et),me.has("WEBGL_multisampled_render_to_texture")===!1){let Ut=!1;for(let Ct=0,Xt=ve.length;Ct<Xt;Ct++){const ln=ve[Ct],wn=ln.object,Tn=ln.geometry,on=ln.material,It=ln.group;if(on.side===si&&wn.layers.test(fe.layers)){const Bn=on.side;on.side=Fi,on.needsUpdate=!0,Fn(wn,Te,fe,Tn,on,It),on.side=Bn,on.needsUpdate=!0,Ut=!0}}Ut===!0&&(le.updateMultisampleRenderTarget(et),le.updateRenderTargetMipmap(et))}x.setRenderTarget(_t),x.setClearColor(N,H),Ot!==void 0&&(fe.viewport=Ot),x.toneMapping=pt}function pi(q,ve,Te){const fe=ve.isScene===!0?ve.overrideMaterial:null;for(let xe=0,et=q.length;xe<et;xe++){const at=q[xe],_t=at.object,pt=at.geometry,Ot=at.group;let Ut=at.material;Ut.allowOverride===!0&&fe!==null&&(Ut=fe),_t.layers.test(Te.layers)&&Fn(_t,ve,Te,pt,Ut,Ot)}}function Fn(q,ve,Te,fe,xe,et){q.onBeforeRender(x,ve,Te,fe,xe,et),q.modelViewMatrix.multiplyMatrices(Te.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),xe.onBeforeRender(x,ve,Te,fe,q,et),xe.transparent===!0&&xe.side===si&&xe.forceSinglePass===!1?(xe.side=Fi,xe.needsUpdate=!0,x.renderBufferDirect(Te,ve,fe,xe,q,et),xe.side=ms,xe.needsUpdate=!0,x.renderBufferDirect(Te,ve,fe,xe,q,et),xe.side=si):x.renderBufferDirect(Te,ve,fe,xe,q,et),q.onAfterRender(x,ve,Te,fe,xe,et)}function Di(q,ve,Te){ve.isScene!==!0&&(ve=we);const fe=he.get(q),xe=v.state.lights,et=v.state.shadowsArray,at=xe.state.ver
vendor: 4,411 bytes, line 3828
3828sion,_t=ue.getParameters(q,xe.state,et,ve,Te),pt=ue.getProgramCacheKey(_t);let Ot=fe.programs;fe.environment=q.isMeshStandardMaterial?ve.environment:null,fe.fog=ve.fog,fe.envMap=(q.isMeshStandardMaterial?B:He).get(q.envMap||fe.environment),fe.envMapRotation=fe.environment!==null&&q.envMap===null?ve.environmentRotation:q.envMapRotation,Ot===void 0&&(q.addEventListener("dispose",nt),Ot=new Map,fe.programs=Ot);let Ut=Ot.get(pt);if(Ut!==void 0){if(fe.currentProgram===Ut&&fe.lightsStateVersion===at)return eo(q,_t),Ut}else _t.uniforms=ue.getUniforms(q),q.onBeforeCompile(_t,x),Ut=ue.acquireProgram(_t,pt),Ot.set(pt,Ut),fe.uniforms=_t.uniforms;const Ct=fe.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(Ct.clippingPlanes=$e.uniform),eo(q,_t),fe.needsLights=to(q),fe.lightsStateVersion=at,fe.needsLights&&(Ct.ambientLightColor.value=xe.state.ambient,Ct.lightProbe.value=xe.state.probe,Ct.directionalLights.value=xe.state.directional,Ct.directionalLightShadows.value=xe.state.directionalShadow,Ct.spotLights.value=xe.state.spot,Ct.spotLightShadows.value=xe.state.spotShadow,Ct.rectAreaLights.value=xe.state.rectArea,Ct.ltc_1.value=xe.state.rectAreaLTC1,Ct.ltc_2.value=xe.state.rectAreaLTC2,Ct.pointLights.value=xe.state.point,Ct.pointLightShadows.value=xe.state.pointShadow,Ct.hemisphereLights.value=xe.state.hemi,Ct.directionalShadowMap.value=xe.state.directionalShadowMap,Ct.directionalShadowMatrix.value=xe.state.directionalShadowMatrix,Ct.spotShadowMap.value=xe.state.spotShadowMap,Ct.spotLightMatrix.value=xe.state.spotLightMatrix,Ct.spotLightMap.value=xe.state.spotLightMap,Ct.pointShadowMap.value=xe.state.pointShadowMap,Ct.pointShadowMatrix.value=xe.state.pointShadowMatrix),fe.currentProgram=Ut,fe.uniformsList=null,Ut}function Do(q){if(q.uniformsList===null){const ve=q.currentProgram.getUniforms();q.uniformsList=Tf.seqWithValue(ve.seq,q.uniforms)}return q.uniformsList}function eo(q,ve){const Te=he.get(q);Te.outputColorSpace=ve.outputColorSpace,Te.batching=ve.batching,Te.batchingColor=ve.batchingColor,Te.instancing=ve.instancing,Te.instancingColor=ve.instancingColor,Te.instancingMorph=ve.instancingMorph,Te.skinning=ve.skinning,Te.morphTargets=ve.morphTargets,Te.morphNormals=ve.morphNormals,Te.morphColors=ve.morphColors,Te.morphTargetsCount=ve.morphTargetsCount,Te.numClippingPlanes=ve.numClippingPlanes,Te.numIntersection=ve.numClipIntersection,Te.vertexAlphas=ve.vertexAlphas,Te.vertexTangents=ve.vertexTangents,Te.toneMapping=ve.toneMapping}function bc(q,ve,Te,fe,xe){ve.isScene!==!0&&(ve=we),le.resetTextureUnits();const et=ve.fog,at=fe.isMeshStandardMaterial?ve.environment:null,_t=E===null?x.outputColorSpace:E.isXRRenderTarget===!0?E.texture.colorSpace:Fa,pt=(fe.isMeshStandardMaterial?B:He).get(fe.envMap||at),Ot=fe.vertexColors===!0&&!!Te.attributes.color&&Te.attributes.color.itemSize===4,Ut=!!Te.attributes.tangent&&(!!fe.normalMap||fe.anisotropy>0),Ct=!!Te.morphAttributes.position,Xt=!!Te.morphAttributes.normal,ln=!!Te.morphAttributes.color;let wn=hs;fe.toneMapped&&(E===null||E.isXRRenderTarget===!0)&&(wn=x.toneMapping);const Tn=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,on=Tn!==void 0?Tn.length:0,It=he.get(fe),Bn=v.state.lights;if(U===!0&&(W===!0||q!==w)){const zn=q===w&&fe.id===S;$e.setState(fe,q,zn)}let tn=!1;fe.version===It.__version?(It.needsLights&&It.lightsStateVersion!==Bn.state.version||It.outputColorSpace!==_t||xe.isBatchedMesh&&It.batching===!1||!xe.isBatchedMesh&&It.batching===!0||xe.isBatchedMesh&&It.batchingColor===!0&&xe.colorTexture===null||xe.isBatchedMesh&&It.batchingColor===!1&&xe.colorTexture!==null||xe.isInstancedMesh&&It.instancing===!1||!xe.isInstancedMesh&&It.instancing===!0||xe.isSkinnedMesh&&It.skinning===!1||!xe.isSkinnedMesh&&It.skinning===!0||xe.isInstancedMesh&&It.instancingColor===!0&&xe.instanceColor===null||xe.isInstancedMesh&&It.instancingColor===!1&&xe.instanceColor!==null||xe.isInstancedMesh&&It.instancingMorph===!0&&xe.morphTexture===null||xe.isInstancedMesh&&It.instancingMorph===!1&&xe.morphTexture!==null||It.envMap!==pt||fe.fog===!0&&It.fog!==et||It.numClippingPlanes!==void 0&&(It.numClippingPlanes!==$e.numPlanes||It.numIntersection!==$e.numIntersection)||It.vertexAlphas!==Ot||It.vertexTangents!==Ut||It.morphTargets!==Ct||It.morphNormals!==Xt||It.morphColors!==ln||It.toneMapping!==wn||It.morphTargetsCount!==on)&&(tn=!0):(tn=!0,It.__version=fe.ver
vendor: 4,560 bytes, line 3828
3828sion);let mi=It.currentProgram;tn===!0&&(mi=Di(fe,ve,xe));let xn=!1,Jn=!1,gi=!1;const Sn=mi.getUniforms(),ni=It.uniforms;if(se.useProgram(mi.program)&&(xn=!0,Jn=!0,gi=!0),fe.id!==S&&(S=fe.id,Jn=!0),xn||w!==q){se.buffers.depth.getReversed()?(j.copy(q.projectionMatrix),s2(j),o2(j),Sn.setValue(F,"projectionMatrix",j)):Sn.setValue(F,"projectionMatrix",q.projectionMatrix),Sn.setValue(F,"viewMatrix",q.matrixWorldInverse);const kn=Sn.map.cameraPosition;kn!==void 0&&kn.setValue(F,de.setFromMatrixPosition(q.matrixWorld)),be.logarithmicDepthBuffer&&Sn.setValue(F,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(fe.isMeshPhongMaterial||fe.isMeshToonMaterial||fe.isMeshLambertMaterial||fe.isMeshBasicMaterial||fe.isMeshStandardMaterial||fe.isShaderMaterial)&&Sn.setValue(F,"isOrthographic",q.isOrthographicCamera===!0),w!==q&&(w=q,Jn=!0,gi=!0)}if(xe.isSkinnedMesh){Sn.setOptional(F,xe,"bindMatrix"),Sn.setOptional(F,xe,"bindMatrixInverse");const zn=xe.skeleton;zn&&(zn.boneTexture===null&&zn.computeBoneTexture(),Sn.setValue(F,"boneTexture",zn.boneTexture,le))}xe.isBatchedMesh&&(Sn.setOptional(F,xe,"batchingTexture"),Sn.setValue(F,"batchingTexture",xe._matricesTexture,le),Sn.setOptional(F,xe,"batchingIdTexture"),Sn.setValue(F,"batchingIdTexture",xe._indirectTexture,le),Sn.setOptional(F,xe,"batchingColorTexture"),xe._colorsTexture!==null&&Sn.setValue(F,"batchingColorTexture",xe._colorsTexture,le));const Xn=Te.morphAttributes;if((Xn.position!==void 0||Xn.normal!==void 0||Xn.color!==void 0)&&Ge.update(xe,Te,mi),(Jn||It.receiveShadow!==xe.receiveShadow)&&(It.receiveShadow=xe.receiveShadow,Sn.setValue(F,"receiveShadow",xe.receiveShadow)),fe.isMeshGouraudMaterial&&fe.envMap!==null&&(ni.envMap.value=pt,ni.flipEnvMap.value=pt.isCubeTexture&&pt.isRenderTargetTexture===!1?-1:1),fe.isMeshStandardMaterial&&fe.envMap===null&&ve.environment!==null&&(ni.envMapIntensity.value=ve.environmentIntensity),Jn&&(Sn.setValue(F,"toneMappingExposure",x.toneMappingExposure),It.needsLights&&el(ni,gi),et&&fe.fog===!0&&ce.refreshFogUniforms(ni,et),ce.refreshMaterialUniforms(ni,fe,X,ee,v.state.transmissionRenderTarget[q.id]),Tf.upload(F,Do(It),ni,le)),fe.isShaderMaterial&&fe.uniformsNeedUpdate===!0&&(Tf.upload(F,Do(It),ni,le),fe.uniformsNeedUpdate=!1),fe.isSpriteMaterial&&Sn.setValue(F,"center",xe.center),Sn.setValue(F,"modelViewMatrix",xe.modelViewMatrix),Sn.setValue(F,"normalMatrix",xe.normalMatrix),Sn.setValue(F,"modelMatrix",xe.matrixWorld),fe.isShaderMaterial||fe.isRawShaderMaterial){const zn=fe.uniformsGroups;for(let kn=0,Ur=zn.length;kn<Ur;kn++){const dr=zn[kn];oe.update(dr,mi),oe.bind(dr,mi)}}return mi}function el(q,ve){q.ambientLightColor.needsUpdate=ve,q.lightProbe.needsUpdate=ve,q.directionalLights.needsUpdate=ve,q.directionalLightShadows.needsUpdate=ve,q.pointLights.needsUpdate=ve,q.pointLightShadows.needsUpdate=ve,q.spotLights.needsUpdate=ve,q.spotLightShadows.needsUpdate=ve,q.rectAreaLights.needsUpdate=ve,q.hemisphereLights.needsUpdate=ve}function to(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(q,ve,Te){const fe=he.get(q);fe.__autoAllocateDepthBuffer=q.resolveDepthBuffer===!1,fe.__autoAllocateDepthBuffer===!1&&(fe.__useRenderToTexture=!1),he.get(q.texture).__webglTexture=ve,he.get(q.depthTexture).__webglTexture=fe.__autoAllocateDepthBuffer?void 0:Te,fe.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(q,ve){const Te=he.get(q);Te.__webglFramebuffer=ve,Te.__useDefaultFramebuffer=ve===void 0};const Lo=F.createFramebuffer();this.setRenderTarget=function(q,ve=0,Te=0){E=q,b=ve,M=Te;let fe=!0,xe=null,et=!1,at=!1;if(q){const pt=he.get(q);if(pt.__useDefaultFramebuffer!==void 0)se.bindFramebuffer(F.FRAMEBUFFER,null),fe=!1;else if(pt.__webglFramebuffer===void 0)le.setupRenderTarget(q);else if(pt.__hasExternalTextures)le.rebindTextures(q,he.get(q.texture).__webglTexture,he.get(q.depthTexture).__webglTexture);else if(q.depthBuffer){const Ct=q.depthTexture;if(pt.__boundDepthTexture!==Ct){if(Ct!==null&&he.has(Ct)&&(q.width!==Ct.image.width||q.height!==Ct.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");le.setupDepthRenderbuffer(q)}}const Ot=q.texture;(Ot.isData3DTexture||Ot.isDataArrayTexture||Ot.isCompressedArrayTexture)&&(at=!0);const Ut=he.get(q).__webglFramebuffer;
vendor: 4,118 bytes, line 3828
3828q.isWebGLCubeRenderTarget?(Array.isArray(Ut[ve])?xe=Ut[ve][Te]:xe=Ut[ve],et=!0):q.samples>0&&le.useMultisampledRTT(q)===!1?xe=he.get(q).__webglMultisampledFramebuffer:Array.isArray(Ut)?xe=Ut[Te]:xe=Ut,D.copy(q.viewport),R.copy(q.scissor),k=q.scissorTest}else D.copy(z).multiplyScalar(X).floor(),R.copy(K).multiplyScalar(X).floor(),k=te;if(Te!==0&&(xe=Lo),se.bindFramebuffer(F.FRAMEBUFFER,xe)&&fe&&se.drawBuffers(q,xe),se.viewport(D),se.scissor(R),se.setScissorTest(k),et){const pt=he.get(q.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+ve,pt.__webglTexture,Te)}else if(at){const pt=he.get(q.texture),Ot=ve;F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,pt.__webglTexture,Te,Ot)}else if(q!==null&&Te!==0){const pt=he.get(q.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,pt.__webglTexture,Te)}S=-1},this.readRenderTargetPixels=function(q,ve,Te,fe,xe,et,at,_t=0){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let pt=he.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&at!==void 0&&(pt=pt[at]),pt){se.bindFramebuffer(F.FRAMEBUFFER,pt);try{const Ot=q.textures[_t],Ut=Ot.format,Ct=Ot.type;if(!be.textureFormatReadable(Ut)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!be.textureTypeReadable(Ct)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ve>=0&&ve<=q.width-fe&&Te>=0&&Te<=q.height-xe&&(q.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+_t),F.readPixels(ve,Te,fe,xe,Ze.convert(Ut),Ze.convert(Ct),et))}finally{const Ot=E!==null?he.get(E).__webglFramebuffer:null;se.bindFramebuffer(F.FRAMEBUFFER,Ot)}}},this.readRenderTargetPixelsAsync=async function(q,ve,Te,fe,xe,et,at,_t=0){if(!(q&&q.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let pt=he.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&at!==void 0&&(pt=pt[at]),pt)if(ve>=0&&ve<=q.width-fe&&Te>=0&&Te<=q.height-xe){se.bindFramebuffer(F.FRAMEBUFFER,pt);const Ot=q.textures[_t],Ut=Ot.format,Ct=Ot.type;if(!be.textureFormatReadable(Ut))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!be.textureTypeReadable(Ct))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Xt=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,Xt),F.bufferData(F.PIXEL_PACK_BUFFER,et.byteLength,F.STREAM_READ),q.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+_t),F.readPixels(ve,Te,fe,xe,Ze.convert(Ut),Ze.convert(Ct),0);const ln=E!==null?he.get(E).__webglFramebuffer:null;se.bindFramebuffer(F.FRAMEBUFFER,ln);const wn=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await r2(F,wn,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,Xt),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,et),F.deleteBuffer(Xt),F.deleteSync(wn),et}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(q,ve=null,Te=0){const fe=Math.pow(2,-Te),xe=Math.floor(q.image.width*fe),et=Math.floor(q.image.height*fe),at=ve!==null?ve.x:0,_t=ve!==null?ve.y:0;le.setTexture2D(q,0),F.copyTexSubImage2D(F.TEXTURE_2D,Te,0,0,at,_t,xe,et),se.unbindTexture()};const wc=F.createFramebuffer(),tl=F.createFramebuffer();this.copyTextureToTexture=function(q,ve,Te=null,fe=null,xe=0,et=null){et===null&&(xe!==0?(kl("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),et=xe,xe=0):et=0);let at,_t,pt,Ot,Ut,Ct,Xt,ln,wn;const Tn=q.isCompressedTexture?q.mipmaps[et]:q.image;if(Te!==null)at=Te.max.x-Te.min.x,_t=Te.max.y-Te.min.y,pt=Te.isBox3?Te.max.z-Te.min.z:1,Ot=Te.min.x,Ut=Te.min.y,Ct=Te.isBox3?Te.min.z:0;else{const Xn=Math.pow(2,-xe);
vendor: 4,140 bytes, line 3828
3828at=Math.floor(Tn.width*Xn),_t=Math.floor(Tn.height*Xn),q.isDataArrayTexture?pt=Tn.depth:q.isData3DTexture?pt=Math.floor(Tn.depth*Xn):pt=1,Ot=0,Ut=0,Ct=0}fe!==null?(Xt=fe.x,ln=fe.y,wn=fe.z):(Xt=0,ln=0,wn=0);const on=Ze.convert(ve.format),It=Ze.convert(ve.type);let Bn;ve.isData3DTexture?(le.setTexture3D(ve,0),Bn=F.TEXTURE_3D):ve.isDataArrayTexture||ve.isCompressedArrayTexture?(le.setTexture2DArray(ve,0),Bn=F.TEXTURE_2D_ARRAY):(le.setTexture2D(ve,0),Bn=F.TEXTURE_2D),F.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,ve.flipY),F.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ve.premultiplyAlpha),F.pixelStorei(F.UNPACK_ALIGNMENT,ve.unpackAlignment);const tn=F.getParameter(F.UNPACK_ROW_LENGTH),mi=F.getParameter(F.UNPACK_IMAGE_HEIGHT),xn=F.getParameter(F.UNPACK_SKIP_PIXELS),Jn=F.getParameter(F.UNPACK_SKIP_ROWS),gi=F.getParameter(F.UNPACK_SKIP_IMAGES);F.pixelStorei(F.UNPACK_ROW_LENGTH,Tn.width),F.pixelStorei(F.UNPACK_IMAGE_HEIGHT,Tn.height),F.pixelStorei(F.UNPACK_SKIP_PIXELS,Ot),F.pixelStorei(F.UNPACK_SKIP_ROWS,Ut),F.pixelStorei(F.UNPACK_SKIP_IMAGES,Ct);const Sn=q.isDataArrayTexture||q.isData3DTexture,ni=ve.isDataArrayTexture||ve.isData3DTexture;if(q.isDepthTexture){const Xn=he.get(q),zn=he.get(ve),kn=he.get(Xn.__renderTarget),Ur=he.get(zn.__renderTarget);se.bindFramebuffer(F.READ_FRAMEBUFFER,kn.__webglFramebuffer),se.bindFramebuffer(F.DRAW_FRAMEBUFFER,Ur.__webglFramebuffer);for(let dr=0;dr<pt;dr++)Sn&&(F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,he.get(q).__webglTexture,xe,Ct+dr),F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,he.get(ve).__webglTexture,et,wn+dr)),F.blitFramebuffer(Ot,Ut,at,_t,Xt,ln,at,_t,F.DEPTH_BUFFER_BIT,F.NEAREST);se.bindFramebuffer(F.READ_FRAMEBUFFER,null),se.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else if(xe!==0||q.isRenderTargetTexture||he.has(q)){const Xn=he.get(q),zn=he.get(ve);se.bindFramebuffer(F.READ_FRAMEBUFFER,wc),se.bindFramebuffer(F.DRAW_FRAMEBUFFER,tl);for(let kn=0;kn<pt;kn++)Sn?F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Xn.__webglTexture,xe,Ct+kn):F.framebufferTexture2D(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,Xn.__webglTexture,xe),ni?F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,zn.__webglTexture,et,wn+kn):F.framebufferTexture2D(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,zn.__webglTexture,et),xe!==0?F.blitFramebuffer(Ot,Ut,at,_t,Xt,ln,at,_t,F.COLOR_BUFFER_BIT,F.NEAREST):ni?F.copyTexSubImage3D(Bn,et,Xt,ln,wn+kn,Ot,Ut,at,_t):F.copyTexSubImage2D(Bn,et,Xt,ln,Ot,Ut,at,_t);se.bindFramebuffer(F.READ_FRAMEBUFFER,null),se.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else ni?q.isDataTexture||q.isData3DTexture?F.texSubImage3D(Bn,et,Xt,ln,wn,at,_t,pt,on,It,Tn.data):ve.isCompressedArrayTexture?F.compressedTexSubImage3D(Bn,et,Xt,ln,wn,at,_t,pt,on,Tn.data):F.texSubImage3D(Bn,et,Xt,ln,wn,at,_t,pt,on,It,Tn):q.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,et,Xt,ln,at,_t,on,It,Tn.data):q.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,et,Xt,ln,Tn.width,Tn.height,on,Tn.data):F.texSubImage2D(F.TEXTURE_2D,et,Xt,ln,at,_t,on,It,Tn);F.pixelStorei(F.UNPACK_ROW_LENGTH,tn),F.pixelStorei(F.UNPACK_IMAGE_HEIGHT,mi),F.pixelStorei(F.UNPACK_SKIP_PIXELS,xn),F.pixelStorei(F.UNPACK_SKIP_ROWS,Jn),F.pixelStorei(F.UNPACK_SKIP_IMAGES,gi),et===0&&ve.generateMipmaps&&F.generateMipmap(Bn),se.unbindTexture()},this.copyTextureToTexture3D=function(q,ve,Te=null,fe=null,xe=0){return kl('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(q,ve,Te,fe,xe)},this.initRenderTarget=function(q){he.get(q).__webglFramebuffer===void 0&&le.setupRenderTarget(q)},this.initTexture=function(q){q.isCubeTexture?le.setTextureCube(q,0):q.isData3DTexture?le.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?le.setTexture2DArray(q,0):le.setTexture2D(q,0),se.unbindTexture()},this.resetState=function(){b=0,M=0,E=null,se.reset(),ht.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rr}get outputColorSpace(){return this._outputColorSpace}
3828set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=rn._getDrawingBufferColorSpace(e),t.unpackColorSpace=rn._getUnpackColorSpace()}}const dk=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:tS,AddEquation:go,AddOperation:J1,AdditiveAnimationBlendMode:ty,AdditiveBlending:wv,AgXToneMapping:X0,AlphaFormat:J0,AlwaysCompare:gS,AlwaysDepth:Hf,AlwaysStencilFunc:Tv,AmbientLight:Ay,AnimationAction:cM,AnimationClip:Ga,AnimationLoader:IR,AnimationMixer:rP,AnimationObjectGroup:nP,AnimationUtils:AR,ArcCurve:DS,ArrayCamera:oM,ArrowHelper:SP,AttachedBindMode:Ev,Audio:aM,AudioAnalyser:XR,AudioContext:Cy,AudioListener:HR,AudioLoader:zR,AxesHelper:MP,BackSide:Fi,BasicDepthPacking:lS,BasicShadowMap:rC,BatchedMesh:AS,Bone:_m,BooleanKeyframeTrack:Ya,Box2:uP,Box3:jn,Box3Helper:bP,BoxGeometry:qa,BoxHelper:xP,BufferAttribute:Zt,BufferGeometry:Ht,BufferGeometryLoader:sM,ByteType:Y0,Cache:Vs,Camera:mm,CameraHelper:_P,CanvasTexture:PS,CapsuleGeometry:wm,CatmullRomCurve3:LS,CineonToneMapping:eS,CircleGeometry:Sm,ClampToEdgeWrapping:or,Clock:Ry,Color:st,ColorKeyframeTrack:by,ColorManagement:rn,CompressedArrayTexture:$2,CompressedCubeTexture:Z2,CompressedTexture:bm,CompressedTextureLoader:DR,ConeGeometry:qd,ConstantAlphaFactor:Y1,ConstantColorFactor:X1,Controls:ky,CubeCamera:wS,CubeReflectionMapping:Ws,CubeRefractionMapping:Eo,CubeTexture:Gd,CubeTextureLoader:LR,CubeUVReflectionMapping:dc,CubicBezierCurve:dy,CubicBezierCurve3:kS,CubicInterpolant:ZS,CullFaceBack:bv,CullFaceFront:I1,CullFaceFrontBack:iC,CullFaceNone:P1,Curve:Zr,CurvePath:NS,CustomBlending:D1,CustomToneMapping:nS,CylinderGeometry:Xd,Cylindrical:cP,Data3DTexture:fm,DataArrayTexture:hm,DataTexture:fs,DataTextureLoader:QS,DataUtils:b2,DecrementStencilOp:yC,DecrementWrapStencilOp:xC,DefaultLoadingManager:Za,DepthFormat:nc,DepthStencilFormat:ic,DepthTexture:cy,DetachedBindMode:rS,DirectionalLight:Ty,DirectionalLightHelper:yP,DiscreteInterpolant:JS,DodecahedronGeometry:Mm,DoubleSide:si,DstAlphaFactor:V1,DstColorFactor:H1,DynamicCopyUsage:UC,DynamicDrawUsage:RC,DynamicReadUsage:DC,EdgesGeometry:IS,EllipseCurve:Em,EqualCompare:hS,EqualDepth:jf,EqualStencilFunc:MC,EquirectangularReflectionMapping:gu,EquirectangularRefractionMapping:vu,Euler:xr,EventDispatcher:vs,ExtrudeGeometry:Tm,FileLoader:Lr,Float16BufferAttribute:C2,Float32BufferAttribute:ot,FloatType:ar,Fog:vm,FogExp2:gm,FramebufferTexture:Y2,FrontSide:ms,Frustum:pc,FrustumArray:xm,GLBufferAttribute:lP,GLSL1:OC,GLSL3:Av,GreaterCompare:fS,GreaterDepth:qf,GreaterEqualCompare:mS,GreaterEqualDepth:Xf,GreaterEqualStencilFunc:CC,GreaterStencilFunc:TC,GridHelper:gP,Group:Pr,HalfFloatType:hc,HemisphereLight:tM,HemisphereLightHelper:mP,IcosahedronGeometry:Am,ImageBitmapLoader:BR,ImageLoader:Pu,ImageUtils:_S,IncrementStencilOp:vC,IncrementWrapStencilOp:_C,InstancedBufferAttribute:Ba,InstancedBufferGeometry:Fm,InstancedInterleavedBuffer:Ap,InstancedMesh:TS,Int16BufferAttribute:T2,Int32BufferAttribute:A2,Int8BufferAttribute:S2,IntType:sm,InterleavedBuffer:ym,InterleavedBufferAttribute:vr,Interpolant:$d,InterpolateDiscrete:_u,InterpolateLinear:bp,InterpolateSmooth:Mf,InterpolationSamplingMode:zC,InterpolationSamplingType:BC,InvertStencilOp:bC,KeepStencilOp:oa,KeyframeTrack:kr,LOD:ES,LatheGeometry:Cm,Layers:pm,LessCompare:dS,LessDepth:Wf,LessEqualCompare:iy,LessEqualDepth:Oa,LessEqualStencilFunc:EC,LessStencilFunc:SC,Light:Ro,LightProbe:rM,Line:Xs,Line3:uM,LineBasicMaterial:ai,LineCurve:hy,LineCurve3:US,LineDashedMaterial:qS,LineLoop:CS,LineSegments:br,LinearFilter:ei,LinearInterpolant:xy,LinearMipMapLinearFilter:lC,LinearMipMapNearestFilter:aC,LinearMipmapLinearFilter:Hr,LinearMipmapNearestFilter:Kc,LinearSRGBColorSpace:Fa,LinearToneMapping:K1,LinearTransfer:bu,Loader:Ei,LoaderUtils:Tp,LoadingManager:wy,LoopOnce:sS,LoopPingPong:aS,LoopRepeat:oS,MOUSE:yr,Material:Mi,MaterialLoader:Om,MathUtils:cs,Matrix2:Ly,Matrix3:Yt,Matrix4:St,MaxEquation:N1,Mesh:fn,MeshBasicMaterial:Bi,MeshDepthMaterial:Um,MeshDistanceMaterial:Nm,MeshLambertMaterial:yy,MeshMatcapMaterial:XS,MeshNormalMaterial:jS,MeshPhongMaterial:Cu,MeshPhysicalMaterial:HS,MeshStandardMaterial:vy,MeshToonMaterial:WS,MinEquation:U1,MirroredRepeatWrapping:yu,MixOperation:Z1,MultiplyBlending:Mv,MultiplyOperation:Bd,NearestFilter:Ii,NearestMipMapLinearFilter:oC,NearestMipMapNearestFilter:sC,NearestMipmapLinearFilter:Cl,NearestMipmapNearestFilter:q0,NeutralToneMapping:iS,NeverCompare:uS,NeverDepth:Gf,NeverStencilFunc:wC,NoBlending:Gs,NoColorSpace:Fs,NoToneMapping:hs,NormalAnimationBlendMode:dm,NormalBlending:Ia,NotEqualCompare:pS,NotEqualDepth:Yf,NotEqualStencilFunc:AC,NumberKeyframeTrack:Ru,Object3D:an,ObjectLoader:OR,ObjectSpaceNormalMap:cS,OctahedronGeometry:Yd,OneFactor:F1,OneMinusConstantAlphaFactor:$1,OneMinusConstantColorFactor:q1,OneMinusDstAlphaFactor:G1,OneMinusDstColorFactor:W1,OneMinusSrcAlphaFactor:Vf,OneMinusSrcColorFactor:z
38281,OrthographicCamera:Ja,PCFShadowMap:j0,PCFSoftShadowMap:Bf,PMREMGenerator:kv,Path:Ep,PerspectiveCamera:Qn,Plane:as,PlaneGeometry:Zs,PlaneHelper:wP,PointLight:Ey,PointLightHelper:fP,Points:su,PointsMaterial:ma,PolarGridHelper:vP,PolyhedronGeometry:Co,PositionalAudio:jR,PropertyBinding:mn,PropertyMixer:lM,QuadraticBezierCurve:fy,QuadraticBezierCurve3:py,Quaternion:$n,QuaternionKeyframeTrack:gc,QuaternionLinearInterpolant:KS,RED_GREEN_RGTC2_Format:_p,RED_RGTC1_Format:ey,REVISION:Fd,RGBADepthPacking:ny,RGBAFormat:qi,RGBAIntegerFormat:um,RGBA_ASTC_10x10_Format:fp,RGBA_ASTC_10x5_Format:up,RGBA_ASTC_10x6_Format:dp,RGBA_ASTC_10x8_Format:hp,RGBA_ASTC_12x10_Format:pp,RGBA_ASTC_12x12_Format:mp,RGBA_ASTC_4x4_Format:np,RGBA_ASTC_5x4_Format:ip,RGBA_ASTC_5x5_Format:rp,RGBA_ASTC_6x5_Format:sp,RGBA_ASTC_6x6_Format:op,RGBA_ASTC_8x5_Format:ap,RGBA_ASTC_8x6_Format:lp,RGBA_ASTC_8x8_Format:cp,RGBA_BPTC_Format:iu,RGBA_ETC2_EAC_Format:tp,RGBA_PVRTC_2BPPV1_Format:Kf,RGBA_PVRTC_4BPPV1_Format:Jf,RGBA_S3TC_DXT1_Format:eu,RGBA_S3TC_DXT3_Format:tu,RGBA_S3TC_DXT5_Format:nu,RGBDepthPacking:fC,RGBFormat:K0,RGBIntegerFormat:cC,RGB_BPTC_SIGNED_Format:gp,RGB_BPTC_UNSIGNED_Format:vp,RGB_ETC1_Format:Qf,RGB_ETC2_Format:ep,RGB_PVRTC_2BPPV1_Format:Zf,RGB_PVRTC_4BPPV1_Format:$f,RGB_S3TC_DXT1_Format:Qc,RGDepthPacking:pC,RGFormat:Q0,RGIntegerFormat:cm,RawShaderMaterial:GS,Ray:$s,Raycaster:Bm,RectAreaLight:nM,RedFormat:lm,RedIntegerFormat:zd,ReinhardToneMapping:Q1,RenderTarget:sy,RenderTarget3D:sP,RepeatWrapping:Gr,ReplaceStencilOp:gC,ReverseSubtractEquation:k1,RingGeometry:Rm,SIGNED_RED_GREEN_RGTC2_Format:xp,SIGNED_RED_RGTC1_Format:yp,SRGBColorSpace:Ln,SRGBTransfer:Mn,Scene:Hd,ShaderChunk:Ft,ShaderLib:ji,ShaderMaterial:Dr,ShadowMaterial:VS,Shape:La,ShapeGeometry:Pm,ShapePath:EP,ShapeUtils:Wr,ShortType:$0,Skeleton:jd,SkeletonHelper:hP,SkinnedMesh:ly,Source:wo,Sphere:Zn,SphereGeometry:mc,Spherical:Cp,SphericalHarmonics3:iM,SplineCurve:my,SpotLight:My,SpotLightHelper:dP,Sprite:Wd,SpriteMaterial:fc,SrcAlphaFactor:zf,SrcAlphaSaturateFactor:j1,SrcColorFactor:B1,StaticCopyUsage:kC,StaticDrawUsage:wu,StaticReadUsage:IC,StereoCamera:VR,StreamCopyUsage:NC,StreamDrawUsage:PC,StreamReadUsage:LC,StringKeyframeTrack:$a,SubtractEquation:L1,SubtractiveBlending:Sv,TOUCH:ha,TangentSpaceNormalMap:Ao,TetrahedronGeometry:Im,Texture:Wn,TextureLoader:eM,TextureUtils:PP,TimestampQuery:FC,TorusGeometry:Dm,TorusKnotGeometry:Lm,Triangle:sr,TriangleFanDrawMode:hC,TriangleStripDrawMode:dC,TrianglesDrawMode:uC,TubeGeometry:km,UVMapping:rm,Uint16BufferAttribute:oy,Uint32BufferAttribute:ay,Uint8BufferAttribute:M2,Uint8ClampedBufferAttribute:E2,Uniform:Dy,UniformsGroup:aP,UniformsLib:lt,UniformsUtils:Vd,UnsignedByteType:$r,UnsignedInt248Type:tc,UnsignedInt5999Type:Z0,UnsignedIntType:js,UnsignedShort4444Type:om,UnsignedShort5551Type:am,UnsignedShortType:ec,VSMShadowMap:is,Vector2:Ue,Vector3:V,Vector4:Kt,VectorKeyframeTrack:Va,VideoFrameTexture:q2,VideoTexture:RS,WebGL3DRenderTarget:d2,WebGLArrayRenderTarget:u2,WebGLCoordinateSystem:Rr,WebGLCubeRenderTarget:SS,WebGLRenderTarget:gs,WebGLRenderer:yM,WebGLUtils:vM,WebGPUCoordinateSystem:Su,WebXRController:Ef,WireframeGeometry:gy,WrapAroundEnding:xu,ZeroCurvatureEnding:fa,ZeroFactor:O1,ZeroSlopeEnding:pa,ZeroStencilOp:mC,createCanvasElement:yS},Symbol.toStringTag,{value:"Module"})),qg=(r,e)=>{if(r===e)return!0;if(!r||!e)return!1;const t=r.length;if(e.length!==t)return!1;for(let n=0;n<t;n++)if(r[n]!==e[n])return!1;return!0},hk=()=>{const r=[],n={items:r,remember:(i,s)=>{for(let l=0;l<r.length;l++){const c=r[l];if(qg(s,c.keys)&&c.promise)return c.promise}const o=i();o.catch(()=>{for(let l=0;l<r.length;l++){const c=r[l];if(qg(s,c.keys)){r.splice(l,1);break}}});const a={promise:o,keys:s};return r.push(a),a.promise},clear:i=>{for(let s=0;s<r.length;s++){const o=r[s];if(qg(i,o.keys)){r.splice(s,1);return}}}};return cr("threlte-cache",n),n},fk=()=>{const r=Si("threlte-cache");if(!r)throw new Error("No cache found. The cache can only be used in a child component to <Canvas>.");return r},Ir=r=>{const e=zs(r),t={set:n=>{t.current=n,e.set(n)},subscribe:e.subscribe,update:n=>{const i=n(t.current);t.current=i,e.set(i)},current:r};return t},va=(r,e)=>({subscribe:mu(r,e).subscribe,set:e,update:n=>e(n(wi(r))),get current(){return wi(r)}}),Ny=r=>{const{subscribe:e}=mu(r);return{subscribe:e,get current(){return wi(r)}}},pk=r=>{const e=r.getBoundingClientRect();let t=Pt({width:e.width,height:e.height}),n=0,i=0,s=0,o=0,a=!0,l=!1,c;const u=()=>{l=!0,c!==void 0&&clearTimeout(c),c=setTimeout(()=>{l=!1,c=void 0},250)},d=()=>{u()},h=new ResizeObserver(()=>{a=!0,u();const p=r.getBoundingClientRect();Be(t,{width:p.width,height:p.height})});function f(){if(!a&&!l)return!1;const{clientWidth:p,clientHeight:m}=r;if(!a&&p===i&&m===n)return!1;i=p,n=m,a=!1;const g=r.getBoundingClientRect();return Be(t,{width:g.width,height:g.height}),C(t).width===s&&C(t).height===o?!1:(s=C(t).width,o=C(t).height,!0)}return Pn(()=>(h.observe(r),window.addEventListener("resize",d,{passive:!0}),()=>{h.disconnect(),window.removeEventListener("resize",d),c!==void 0&&clearTimeout(c)})),{size:{get current(){return C(t)}},shouldUpdateSize:f}},mk=r=>{const e=typeof r=="function"?r():r,{dom:t,canvas:n}=e,{size:i,shouldUpdateSize:s}=pk(t),o={dom:t,canvas:n,size:Ny(()=>i.current),shouldUpdateSize:s};
3828return cr("threlte-dom-context",o),o},Zd=()=>{const r=Si("threlte-dom-context");if(!r)throw new Error("useDOM can only be used in a child component to <Canvas>.");return r};class po{constructor(){Ae(this,"allVertices",new Map);Ae(this,"isolatedVertices",new Map);Ae(this,"connectedVertices",new Map);Ae(this,"sortedConnectedValues",[]);Ae(this,"needsSort",!1);Ae(this,"listeners",new Map);Ae(this,"getKey",e=>typeof e=="object"?e.key:e)}emit(e,t){const n=this.listeners.get(e);if(n)for(const i of n)i(t)}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(t)}off(e,t){var n;(n=this.listeners.get(e))==null||n.delete(t)}get sortedVertices(){return this.mapNodes(e=>e)}moveToIsolated(e){const t=this.connectedVertices.get(e);t&&(this.isolatedVertices.set(e,t),this.connectedVertices.delete(e))}moveToConnected(e){const t=this.isolatedVertices.get(e);t&&(this.connectedVertices.set(e,t),this.isolatedVertices.delete(e))}add(e,t,n){let i=this.allVertices.get(e);if(i&&i.value!==void 0)throw new Error(`A node with the key ${e.toString()} already exists`);i?i.value===void 0&&(i.value=t):(i={value:t,previous:new Set,next:new Set},this.allVertices.set(e,i));const s=i.next.size>0||i.previous.size>0;if(!(n!=null&&n.after)&&!(n!=null&&n.before)&&!s){this.isolatedVertices.set(e,i),this.emit("node:added",{key:e,type:"isolated",value:t});return}else this.connectedVertices.set(e,i);if(n!=null&&n.after){const o=Array.isArray(n.after)?n.after:[n.after];for(const a of o)i.previous.add(this.getKey(a));for(const a of o){const l=this.getKey(a),c=this.allVertices.get(l);if(c)c.next.add(e),this.moveToConnected(l);else{const u={value:void 0,previous:new Set,next:new Set([e])};this.allVertices.set(l,u),this.connectedVertices.set(l,u)}}}if(n!=null&&n.before){const o=Array.isArray(n.before)?n.before:[n.before];for(const a of o)i.next.add(this.getKey(a));for(const a of o){const l=this.getKey(a),c=this.allVertices.get(l);if(c)c.previous.add(e),this.moveToConnected(l);else{const u={value:void 0,previous:new Set([e]),next:new Set};this.allVertices.set(l,u),this.connectedVertices.set(l,u)}}}this.emit("node:added",{key:e,type:"connected",value:t}),this.needsSort=!0}remove(e){const t=this.getKey(e);if(this.isolatedVertices.get(t)){this.isolatedVertices.delete(t),this.allVertices.delete(t),this.emit("node:removed",{key:t,type:"isolated"});return}const i=this.connectedVertices.get(t);if(!(!i||i.value===void 0)){for(const s of i.next){const o=this.connectedVertices.get(s);o&&(o.previous.delete(t),o.previous.size===0&&o.next.size===0&&this.moveToIsolated(s))}for(const s of i.previous){const o=this.connectedVertices.get(s);o&&(o.next.delete(t),o.previous.size===0&&o.next.size===0&&this.moveToIsolated(s))}this.connectedVertices.delete(t),this.allVertices.delete(t),this.emit("node:removed",{key:t,type:"connected"}),this.needsSort=!0}}mapNodes(e){this.needsSort&&this.sort();const t=[];return this.forEachNode((n,i)=>{t.push(e(n,i))}),t}forEachNode(e){this.needsSort&&this.sort();let t=0;for(;t<this.sortedConnectedValues.length;t++)e(this.sortedConnectedValues[t],t);for(const n of this.isolatedVertices.values())n.value!==void 0&&e(n.value,t++)}getValueByKey(e){var t;return(t=this.allVertices.get(e))==null?void 0:t.value}sort(){var s;const e=new Map,t=[],n=[];for(const[o,a]of this.connectedVertices)a.value!==void 0&&e.set(o,0);for(const[o]of e){const a=this.connectedVertices.get(o);for(const l of a.next)e.has(l)&&e.set(l,e.get(l)+1)}for(const[o,a]of e)a===0&&t.push(o);let i=0;for(;i<t.length;){const o=t[i++];n.push(o);const a=(s=this.connectedVertices.get(o))==null?void 0:s.next;if(a)for(const l of a){const c=(e.get(l)||0)-1;e.set(l,c),c===0&&t.push(l)}}if(n.length!==e.size)throw new Error("The graph contains a cycle, and thus can not be sorted topologically.");this.sortedConnectedValues.length=0;for(let o=0;o<n.length;o++){const a=this.connectedVertices.get(n[o]).value;a!==void 0&&this.sortedConnectedValues.push(a)}this.needsSort=!1}clear(){this.allVertices.clear(),this.isolatedVertices.clear(),this.connectedVertices.clear(),this.sortedConnectedValues=[],this.needsSort=!1}static isKey(e){return typeof e=="string"||typeof e=="symbol"}
3828static isValue(e){return typeof e=="object"&&"key"in e}}class gk{constructor(e,t,n){Ae(this,"key");Ae(this,"stage");Ae(this,"callback");Ae(this,"runTask",!0);this.stage=e,this.key=t,this.callback=n}stop(){this.runTask=!1}start(){this.runTask=!0}run(e){this.runTask&&this.callback(e)}}class vk extends po{constructor(t,n,i){super();Ae(this,"key");Ae(this,"scheduler");Ae(this,"runTask",!0);Ae(this,"callback",(t,n)=>n());Ae(this,"removeTask",this.remove.bind(this));this.scheduler=t,this.key=n,this.start=this.start.bind(this),this.stop=this.stop.bind(this),i&&(this.callback=i.bind(this))}stop(){this.runTask=!1}start(){this.runTask=!0}get tasks(){return this.sortedVertices}createTask(t,n,i){const s=new gk(this,t,n);return this.add(t,s,i),s}getTask(t){return this.getValueByKey(t)}run(t){this.runTask&&this.callback(t,n=>{this.forEachNode(i=>{i.run(n??t)})})}runWithTiming(t){if(!this.runTask)return{};const n={};return this.callback(t,i=>{this.forEachNode(s=>{const o=performance.now();s.run(i??t);const a=performance.now()-o;n[s.key]=a})}),n}getSchedule(){return this.mapNodes(t=>t.key.toString())}}class yk extends po{constructor(t){super();Ae(this,"lastTime",0);Ae(this,"clampDeltaTo",.1);Ae(this,"removeStage",this.remove.bind(this));t!=null&&t.clampDeltaTo&&(this.clampDeltaTo=t.clampDeltaTo),this.run=this.run.bind(this)}get stages(){return this.sortedVertices}createStage(t,n){const i=new vk(this,t,n==null?void 0:n.callback);return this.add(t,i,{after:n==null?void 0:n.after,before:n==null?void 0:n.before}),i}getStage(t){return this.getValueByKey(t)}run(t){const n=t-this.lastTime;this.forEachNode(i=>{i.run(Math.min(n/1e3,this.clampDeltaTo))}),this.lastTime=t}runWithTiming(t){const n=t-this.lastTime,i={},s=performance.now();return this.forEachNode(o=>{const a=performance.now(),l=o.runWithTiming(Math.min(n/1e3,this.clampDeltaTo)),c=performance.now()-a;i[o.key.toString()]={duration:c,tasks:l}}),this.lastTime=t,{total:performance.now()-s,stages:i}}getSchedule(t={tasks:!0}){return{stages:this.mapNodes(n=>{if(n===void 0)throw new Error("Stage not found");return{key:n.key.toString(),tasks:t.tasks?n.getSchedule():void 0}})}}dispose(){this.clear()}}const _k=r=>{const e=new yk,t=e.createStage(Symbol("threlte-main-stage")),n=Ve(r),i=Ve(()=>C(n).autoRender),s=Ve(()=>C(n).renderMode);let o=Ve(()=>C(i)??!0),a=Ve(()=>C(s)??"on-demand");const l=new Set;let c=!0;const u=()=>C(a)==="always"||C(a)==="on-demand"&&(c||l.size>0)||C(a)==="manual"&&c,d={scheduler:e,autoInvalidations:l,frameInvalidated:{get current(){return c},set current(h){c=h}},advance:()=>{c=!0},autoRender:va(()=>C(o),h=>Be(o,h)),renderMode:va(()=>C(a),h=>Be(a,h)),invalidate(){c=!0},mainStage:t,shouldRender:u,renderStage:e.createStage(Symbol("threlte-render-stage"),{after:t,callback(h,f){d.shouldRender()&&f()}}),resetFrameInvalidation(){c=!1}};return Pn(()=>()=>{e.dispose()}),cr("threlte-scheduler-context",d),d},Po=()=>{const r=Si("threlte-scheduler-context");if(!r)throw new Error("useScheduler can only be used in a child component to <Canvas>.");return r},xk=()=>{const{size:r}=Zd(),e=Xa(r),{invalidate:t}=Po(),n=new xv,i=new WeakMap,s=new Qn(75,1,.1,1e3);s.position.z=5,s.lookAt(0,0,0);let o=Pt(!1),a=Pt(s);Un(()=>{if(C(a)!==s||C(o))return;const{width:c,height:u}=e.current;s.aspect=c/u,s.updateProjectionMatrix(),s.updateMatrixWorld(),t()}),Un(()=>{if(C(a)===void 0||n.size===0){let c=!1;C(a)!==s&&(Be(a,s),c=!0),C(o)&&(Be(o,!1),c=!0),c&&t()}});const l={makeDefaultCameras:n,makeDefaultCameraManual:i,camera:va(()=>C(a),c=>Be(a,c)),manual:{get current(){return C(o)},set(c){Be(o,c,!0)}}};return cr("threlte-camera-context",l),l},Oy=()=>{const r=Si("threlte-camera-context");if(!r)throw new Error("useCamera can only be used in a child component to <Canvas>.");return r},bk=()=>{const r=new Map,e={disposableObjects:r,removeObjectFromDisposal:t=>{r.delete(t)},disposableObjectMounted:t=>{const n=r.get(t);n?r.set(t,n+1):r.set(t,1)},disposableObjectUnmounted:t=>{const n=r.get(t);n&&n>0&&(r.set(t,n-1),n-1<=0&&(r.delete(t),t.dispose()))}};return Pn(()=>()=>{for(const[t]of r)t.dispose();r.clear()}),cr("threlte-disposal-context",e),e},wk=()=>{const r=Si("threlte-disposal-context");if(!r)throw new Error("useDisposal can only be used in a child component to <Canvas>.");return r},_M=Symbol("threlte-parent-context"),xM=r=>{const e={get current(){return r()}};return cr(_M,e),e},bM=()=>Si(_M),wM=()=>{const r=bM();return Ny(()=>r.current)},Nv=Symbol("threlte-parent-object3d-context"),SM=r=>{const e=Si(Nv),t={get current(){return r()??e.current}};return cr(Nv,t),t},Sk=()=>Si(Nv),Mk=r=>{const e={scene:new Hd};return cr("threlte-scene-context",e),e},MM=()=>{const r=Si("threlte-scene-context");
3828if(!r)throw new Error("useScene can only be used in a child component to <Canvas>.");return r};var Nu,Ou,Ov,h1;const Ek=new(h1=class{constructor(){Fe(this,Ou);Fe(this,Nu,fu(window.devicePixelRatio));un(this,Ou,Ov).call(this)}get current(){return C(J(this,Nu)),window.devicePixelRatio}},Nu=new WeakMap,Ou=new WeakSet,Ov=function(){const e=Yr(window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),"change",()=>{Be(J(this,Nu),window.devicePixelRatio),e(),un(this,Ou,Ov).call(this)})},h1),Oi=(r,e)=>(r==null?void 0:r[`is${e}`])===!0,Tk=new Set(["fov","aspect","near","far","left","right","top","bottom","zoom","filmGauge","filmOffset"]),EM=(r,e,t)=>{Oi(r,"PerspectiveCamera")?r.aspect=e/t:Oi(r,"OrthographicCamera")&&(r.left=e/-2,r.right=e/2,r.top=t/2,r.bottom=t/-2),r.updateProjectionMatrix(),r.updateMatrixWorld()},Ak=(r,e,t,n)=>{const{camera:i,manual:s,makeDefaultCameras:o,makeDefaultCameraManual:a}=Oy(),{invalidate:l}=Po(),{size:c}=Zd(),u=Xa(c);Un(()=>{if(!t())return;const d=r(),h=e();return o.add(d),a.set(d,h),i.set(d),s.set(h),l(),()=>{o.delete(d),a.delete(d);const f=o.values().next().value;i.current===d&&(f?(i.set(f),s.set(a.get(f)??!1)):s.set(!1),l())}}),Un(()=>{if(e())return;const d=r();for(const h in n())if(Tk.has(h)){d.updateProjectionMatrix(),l();break}}),Un(()=>{e()||EM(r(),u.current.width,u.current.height)})},Rb=r=>Number.isFinite(r.width)&&Number.isFinite(r.height)&&r.width>0&&r.height>0,Ck=r=>{const{camera:e,manual:t}=Oy(),{scene:n}=MM(),{invalidate:i,mainStage:s,renderStage:o,autoRender:a,scheduler:l,frameInvalidated:c}=Po(),{canvas:u,size:d,shouldUpdateSize:h}=Zd(),f=Ve(r),p=wi(r),m=p.createRenderer?p.createRenderer(u):new yM({canvas:u,powerPreference:"high-performance",antialias:!0,alpha:!0});l.createStage(Symbol("threlte-resize-stage"),{before:s}).createTask(Symbol("threlte-resize-task"),()=>{m.xr.isPresenting||h()&&Rb(d.current)&&(m.setSize(d.current.width,d.current.height),t.current||EM(e.current,d.current.width,d.current.height),i())});const v=o.createTask(Symbol("threlte-auto-render-task"),()=>{!m.xr.isPresenting&&!Rb(d.current)||m.render(n,e.current)}),y=Ve(()=>C(f).colorSpace),_=Ve(()=>C(f).dpr),x=Ve(()=>C(f).shadows),T=Ve(()=>C(f).toneMapping);let b=Ve(()=>C(y)??Ln),M=Ve(()=>{const R=Ek.current??window.devicePixelRatio;return Array.isArray(C(_))?Math.min(Math.max(C(_)[0],R),C(_)[1]):C(_)??R}),E=Ve(()=>C(x)??Bf),S=Ve(()=>C(T)??X0);const w={renderer:m,colorManagementEnabled:Ny(()=>C(f).colorManagementEnabled??!0),colorSpace:va(()=>C(b),R=>Be(b,R)),dpr:va(()=>C(M),R=>Be(M,R)),shadows:va(()=>C(E),R=>Be(E,R)),toneMapping:va(()=>C(S),R=>Be(S,R)),autoRenderTask:v};cr("threlte-renderer-context",w);const D=Xa(a);return rn.enabled=p.colorManagementEnabled??!0,Un(()=>{m.outputColorSpace=C(b),i()}),Un(()=>{m.setPixelRatio(C(M)),i()}),Un(()=>{m.shadowMap.enabled=C(E)!==!1,C(E)!==!1&&C(E)!==!0?m.shadowMap.type=C(E):C(E)===!0&&(m.shadowMap.type=Bf),i()}),Un(()=>{m.toneMapping=C(S),i()}),Un(()=>(D.current?w.autoRenderTask.start():w.autoRenderTask.stop(),i(),()=>{w.autoRenderTask.stop()})),m.setAnimationLoop(R=>{l.run(R),c.current=!1}),Pn(()=>()=>{m.setAnimationLoop(null);try{m.dispose()}catch{}}),w},Rk=()=>{const r=Si("threlte-renderer-context");if(!r)throw new Error("useRenderer can only be used in a child component to <Canvas>.");return r},Pk=()=>{const r=Ir({});return cr("threlte-user-context",r),r},Ik=()=>{const r=Si("threlte-user-context");if(!r)throw new Error("useUserContext can only be used in a child component to <Canvas>.");return r},Dk=r=>{const{scene:e}=Mk(),t=typeof r=="function"?r:()=>r;return{scene:e,...mk(t),...hk(),...xM(()=>e),...SM(()=>e),...bk(),..._k(t),...xk(),...Ck(t),...Pk()}};var Lk=new Set(["$$slots","$$events","$$legacy","children"]);function kk(r,e){vt(e,!0);let t=Wt(e,Lk);Dk(()=>t);var n=tt(),i=Ie(n);zt(i,()=>e.children),re(r,n),yt()}var Uk=new Set(["$$slots","$$events","$$legacy","children"]),Nk=je('<div class="svelte-clyidt"><canvas class="svelte-clyidt"><!></canvas></div>');function Ok(r,e){let t=Wt(e,Uk),n=Pt(void 0),i=Pt(void 0);var s=Nk(),o=qe(s),a=qe(o);{var l=c=>{kk(c,pn({get dom(){return C(i)},get canvas(){return C(n)}},()=>t,{children:(u,d)=>{var h=tt(),f=Ie(h);zt(f,()=>e.children??jt),re(u,h)},$$slots:{default:!0}}
3828))};Dt(a,c=>{C(n)&&C(i)&&c(l)})}We(o),ti(o,c=>Be(n,c),()=>C(n)),We(s),ti(s,c=>Be(i,c),()=>C(i)),re(r,s)}const Fk=(r,e)=>{if(e.includes(".")){const t=e.split("."),n=t.pop();for(let i=0;i<t.length;i+=1)if(r=r[t[i]],r==null)return console.error(`Cannot resolve property path "${e}": "${t[i]}" is ${r}`),{target:{},key:""};return{target:r,key:n}}else return{target:r,key:e}},Bk=r=>typeof r=="object"&&r!==null,zk=(r,e)=>{const{invalidate:t}=Po(),n=bM(),i=Sk();Un(()=>{t();const s=r(),o=e();if(o===void 0&&Oi(s,"Object3D")){const a=i.current;return a==null||a.add(s),()=>{t(),a==null||a.remove(s)}}if(o===void 0&&Bk(n.current)){const a=n.current;if(Oi(s,"Material")){const l=a.material;return a.material=s,()=>{t(),a.material=l}}else if(Oi(s,"BufferGeometry")){const l=a.geometry;return a.geometry=s,()=>{t(),a.geometry=l}}}if(o===!1)return()=>{t()};if(typeof o=="function"){const a=o({ref:s,parent:n.current,parentObject3D:i.current});return()=>{t(),a==null||a()}}if(typeof o=="string"){const{target:a,key:l}=Fk(n.current,o);if(l in a){const c=a[l];return a[l]=s,()=>{t(),a[l]=c}}else return a[l]=s,()=>{t(),delete a[l]}}if(Oi(o,"Object3D")&&Oi(s,"Object3D"))return o.add(s),()=>{t(),o.remove(s)}})},Pb=Symbol("threlte-disposable-object-context"),Vk=r=>typeof(r==null?void 0:r.dispose)=="function",Gk=(r,e)=>{const{disposableObjectMounted:t,disposableObjectUnmounted:n,removeObjectFromDisposal:i}=wk(),s=Si(Pb),o=Ve(()=>{const l=e();return l!==void 0?l!==!1:(s==null?void 0:s())!==!1});cr(Pb,()=>C(o));const a=new Set;Pn(()=>{const l=r();Vk(l)&&(C(o)?(t(l),a.add(l)):(i(l),a.delete(l)))}),Pn(()=>()=>{for(const l of a)n(l);a.clear()})};let Fv;const Hk=r=>{Fv=r},Wk=()=>{const r=Fv;return Fv=void 0,r},Bv="threlte-plugin-context",jk=r=>{const e=Si(Bv);if(!e)return;const t=[],n=Object.values(e);if(n.length>0)for(let i=0;i<n.length;i++){const s=n[i],o=s(r);o&&o.pluginProps&&t.push(...o.pluginProps)}return{pluginsProps:t}},Xk=r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r>"u"||r===null,qk=(r,e,t)=>{const n=r[e],i=Array.isArray(t);!i&&typeof t=="number"&&typeof n=="object"&&n!==null&&typeof n.setScalar=="function"&&!n.isColor?n.setScalar(t):typeof n=="object"&&n!==null&&typeof n.set=="function"?i?n.set(...t):n.set(t):r[e]=t},Yk=(r,e,t)=>{const{invalidate:n}=Po(),i=new Map,s=(c,u,d)=>{if(Xk(d)){const m=i.get(u);if(m&&m.instance===c&&m.value===d)return;i.set(u,{instance:c,value:d})}else i.delete(u);let h=c,f=u;const p=u.includes(".");if(p){const m=u.split(".");f=m.pop();for(let g=0;g<m.length;g++)if(h=h[m[g]],h==null){console.error(`Cannot resolve property path "${u}": "${m[g]}" is ${h}`);return}}if(typeof d=="function"&&f.startsWith("on")&&!p&&"addEventListener"in h){const m=h,g=f.slice(2);return m.addEventListener(g,d),()=>{var v;(v=m.removeEventListener)==null||v.call(m,g,d)}}d!=null?qk(h,f,d):h[f]=d,n()};let o=[];const a=Ve(()=>{const c=Reflect.ownKeys(e()).filter(u=>typeof u=="string");return(c.length!==o.length||c.some((u,d)=>u!==o[d]))&&(o=c),o});let l;Un(()=>{const c=r(),u=e(),d=t(),h=C(a);if(c===l)for(const f of i.keys())h.includes(f)||i.delete(f);else i.clear(),l=c;wi(()=>{for(const f of h)d!=null&&d.includes(f)||Un(()=>s(c,f,u[f]))})})},$k=r=>typeof r=="function"&&Function.prototype.toString.call(r).startsWith("class "),Zk=(r,e)=>$k(r)?Array.isArray(e)?new r(...e):new r:r;var Jk=new Set(["$$slots","$$events","$$legacy","ref","manual","makeDefault"]);function Kk(r,e){vt(e,!0);let t=ae(e,"manual",3,!1),n=ae(e,"makeDefault",3,!1),i=Wt(e,Jk);Ak(()=>e.ref,()=>t(),()=>n(),()=>i),yt()}var Qk=new Set(["$$slots","$$events","$$legacy","is","args","attach","dispose","ref","oncreate","children","makeDefault","manual"]),eU=je("<!> <!>",1);function Ib(r,e){vt(e,!0);let t=ae(e,"is",19,Wk),n=ae(e,"ref",15),i=Wt(e,Qk);const s=Ve(()=>Zk(t(),e.args)),o=jk({get ref(){return C(s)},get args(){return e.args},get attach(){return e.attach},get manual(){return e.manual},get makeDefault(){return e.makeDefault},get dispose(){return e.dispose},get props(){return i}});Yk(()=>C(s),()=>i,()=>o==null?void 0:o.pluginsProps),zk(()=>C(s),()=>e.attach),Gk(()=>C(s),()=>
3828e.dispose),SM(()=>Oi(C(s),"Object3D")?C(s):void 0),xM(()=>C(s)),Pn(()=>{if(C(s))return wi(()=>{var h;return n()!==C(s)&&n(C(s)),(h=e.oncreate)==null?void 0:h.call(e,C(s))})});var a=eU(),l=Ie(a);{var c=h=>{Kk(h,pn({get ref(){return C(s)},get manual(){return e.manual},get makeDefault(){return e.makeDefault}},()=>i))},u=Ve(()=>Oi(C(s),"PerspectiveCamera")||Oi(C(s),"OrthographicCamera"));Dt(l,h=>{C(u)&&h(c)})}var d=Le(l,2);zt(d,()=>e.children??jt,()=>({ref:C(s)})),re(r,a),yt()}const tU={},Bt=new Proxy(Ib,{get(r,e){if(typeof e!="string")return Reflect.get(r,e);const t=tU[e]||dk[e];if(t===void 0)throw new Error(`No Three.js module found for ${e}. Did you forget to extend the catalogue?`);return(...n)=>(Hk(t),Ib(...n))}});function nU(r,e){e&&cr(Bv,{...Si(Bv),[r]:e})}const Js=()=>{const r=Po(),e=Rk(),t=Oy(),n=MM(),i=Zd();return{advance:r.advance,autoRender:r.autoRender,autoRenderTask:e.autoRenderTask,camera:t.camera,colorManagementEnabled:e.colorManagementEnabled,colorSpace:e.colorSpace,dpr:e.dpr,invalidate:r.invalidate,mainStage:r.mainStage,renderer:e.renderer,renderMode:r.renderMode,renderStage:r.renderStage,scheduler:r.scheduler,shadows:e.shadows,shouldRender:r.shouldRender,dom:i.dom,canvas:i.canvas,size:i.size,toneMapping:e.toneMapping,get scene(){return n.scene},set scene(o){n.scene=o}}};function iU(r,e){const{scheduler:t}=Po();return t.getStage(r)??t.createStage(r,e)}const rU=typeof window<"u";function Jd(r,e,t){if(!rU)return{task:void 0,start:()=>{},stop:()=>{},started:w1(!1)};let n,i,s;po.isKey(r)?(n=r,i=e,s=t):(n=Symbol("useTask"),i=r,s=e);const o=Po(),a=(s==null?void 0:s.autoInvalidate)??!0;let l=o.mainStage,c=Ve(()=>{var d;return((d=s==null?void 0:s.running)==null?void 0:d.call(s))??(s==null?void 0:s.autoStart)??!0});if(s){if(s.stage)if(po.isValue(s.stage))l=s.stage;else{const d=o.scheduler.getStage(s.stage);if(!d)throw new Error(`No stage found with key ${s.stage.toString()}`);l=d}else if(s.after)if(Array.isArray(s.after))for(let d=0;d<s.after.length;d++){const h=s.after[d];if(po.isValue(h)){l=h.stage;break}}else po.isValue(s.after)&&(l=s.after.stage);else if(s.before)if(Array.isArray(s.before))for(let d=0;d<s.before.length;d++){const h=s.before[d];if(po.isValue(h)){l=h.stage;break}}else po.isValue(s.before)&&(l=s.before.stage)}const u=l.createTask(n,i,s);return Un(()=>{C(c)?(u.start(),a&&o.autoInvalidations.add(i)):(u.stop(),a&&o.autoInvalidations.delete(i))}),Un(()=>()=>{l.removeTask(n),a&&o.autoInvalidations.delete(i)}),{task:u,start:()=>{Be(c,!0)},stop:()=>{Be(c,!1)},started:mu(()=>C(c))}}function TM(r,e,t){const n=Ik();if(!n)throw new Error("No user context store found, did you invoke this function outside of your main <Canvas> component?");return r?r&&!e?S1(n,i=>i[r]):(n.update(i=>{if(r in i)return i;const s=typeof e=="function"?e():e;return i[r]=s,i}),n.current[r]):{subscribe:n.subscribe}}const Yg=r=>{const e=zs(void 0),t=zs(void 0);return r.then(n=>{e.set(n)}).catch(n=>{console.error("Error in asyncWritable:",n.message),t.set(n)}),Object.assign(Object.assign(r,e),{error:t,promise:r})};function Fy(r,e){const{remember:t,clear:n}=fk(),i=new r;return{load:(a,l)=>{const c=async u=>{var d;if("loadAsync"in i){const h=await i.loadAsync(u,l==null?void 0:l.onProgress);return((d=l==null?void 0:l.transform)==null?void 0:d.call(l,h))??h}else return new Promise((h,f)=>{i.load(u,p=>{var m;return h(((m=l==null?void 0:l.transform)==null?void 0:m.call(l,p))??p)},p=>{var m;return(m=l==null?void 0:l.onProgress)==null?void 0:m.call(l,p)},f)})};if(Array.isArray(a)){const u=a.map(h=>t(()=>c(h),[r,h]));return Yg(Promise.all(u))}else if(typeof a=="string"){const u=t(()=>c(a),[r,a]);return Yg(u)}else{const u=Object.values(a).map(h=>t(()=>c(h),[r,h]));return Yg(Promise.all(u).then(h=>Object.fromEntries(Object.entries(a).map(([f],p)=>[f,h[p]]))))}},clear:a=>{Array.isArray(a)?a.forEach(l=>{n([r,l])}):typeof a=="string"?n([r,a]):Object.entries(a).forEach(([,l])=>{n([r,l])})},loader:i}}const Db=Symbol(),sU=r=>typeof(r==null?void 0:r.subscribe)=="function",AM=(r,e,t)=>{const n=r().map(o=>sU(o)?Xa(o):Db),i=Ve(()=>r().map((o,a)=>n[a]===Db?o:n[a].current)),s=()=>{C(i);let o;return wi(()=>{o=e(C(i))}),o};t?Un(s):Pn(s)},oU=(r,e)=>AM(r,e,!1),aU=(r,e)=>AM(r,e,!0),CM=Object.assign(oU,{pre:aU}),lU=Fd.replace("dev",""),cU=Number.parseInt(lU);function $g(r){const e=By(r,"xyz");if(!(!e||e.length!=3))return e}
3828function Lb(r){const e=By(r,"rpy");if(!(!e||e.length!=3))return e}function kb(r){const e=By(r,"rgba");if(!(!e||e.length!=4))return e}function By(r,e="xyz"){var t;if(r.hasAttribute(e)){const n=(t=r.getAttribute(e))==null?void 0:t.split(" ");if(n){const i=[];for(const s of n)i.push(parseFloat(s));return i}}}function uU([r,e,t]){const n=i=>Math.round(i).toString(16).padStart(2,"0");return`#${n(r*255)}${n(e*255)}${n(t*255)}`}function dU(r){const e=[],t=r.joints;for(const n of Object.values(r.links)){let i=!0;for(const s of t)if(s.child.name===n.name){i=!1;break}i&&e.push(n)}return e}function hU(r,e){const t=[],n=r.joints;if(!n)return[];for(const i of n)i.parent.name===e.name&&t.push(i);return t}class fU{constructor(e,t=""){Ae(this,"filename");Ae(this,"prefix");Ae(this,"colors",{});Ae(this,"robot",{name:"",links:{},joints:[]});this.filename=e,this.prefix=t.endsWith("/")?t:t+"/"}async load(){return fetch(this.filename).then(e=>e.text())}reset(){this.robot={name:"",links:{},joints:[]}}fromString(e){this.reset();const t=new window.DOMParser().parseFromString(e,"text/xml");return this.robot.elem=t.documentElement,this.parseRobotXMLNode(t.documentElement)}parseRobotXMLNode(e){if(e.nodeName!=="robot")throw new Error(`Invalid URDF: no <robot> (found <${e.nodeName}>)`);return this.robot.name=e.getAttribute("name")||"",this.parseColorsFromRobot(e),this.parseLinks(e),this.parseJoints(e),this.robot}parseColorsFromRobot(e){const t=e.getElementsByTagName("material");for(let n=0;n<t.length;n++){const i=t[n];if(!i.hasAttribute("name")){console.warn("Found <material> with no name attribute");continue}const s=i.getAttribute("name"),o=i.getElementsByTagName("color");if(o.length===0)continue;const a=o[0];if(!a.hasAttribute("rgba"))continue;const l=kb(a)||[0,0,0,1];this.colors[s]=l}}parseLinks(e){const t=e.getElementsByTagName("link");for(let n=0;n<t.length;n++){const i=t[n];if(!i.hasAttribute("name")){console.error("Link without a name:",i);continue}const s=i.getAttribute("name"),o={name:s,visual:[],collision:[],elem:i};this.robot.links[s]=o;const a=i.getElementsByTagName("visual");for(let c=0;c<a.length;c++)o.visual.push(this.parseVisual(a[c]));const l=i.getElementsByTagName("collision");for(let c=0;c<l.length;c++)o.collision.push(this.parseVisual(l[c]))}}parseVisual(e){const t={elem:e};for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes[n];if(i.nodeType!==Node.ELEMENT_NODE)continue;const s=i;switch(s.nodeName){case"geometry":{this.parseGeometry(s,t);break}case"origin":{const o=$g(s),a=Lb(s);o&&(t.origin_xyz=o),a&&(t.origin_rpy=a);break}case"material":{const o=s.getElementsByTagName("color");if(o.length>0&&o[0].hasAttribute("rgba"))t.color_rgba=kb(o[0]);else if(s.hasAttribute("name")){const a=s.getAttribute("name");t.color_rgba=this.colors[a]}break}default:{console.warn("Unknown child node:",s.nodeName);break}}}return t}parseGeometry(e,t){for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes[n];if(i.nodeType!==Node.ELEMENT_NODE)continue;const s=i;if(s.nodeName==="mesh"){const o=s.getAttribute("filename");if(!o){console.warn("<mesh> missing filename!");return}const a=this.resolveFilename(o);let l=[1,1,1];if(s.hasAttribute("scale")){const d=s.getAttribute("scale").split(" ").map(parseFloat);d.length===3&&(l=[d[0],d[1],d[2]])}const c=a.slice(a.lastIndexOf(".")+1).toLowerCase();let u;switch(c){case"stl":u="stl";break;case"fbx":u="fbx";break;case"obj":u="obj";break;case"dae":u="dae";break;default:throw new Error("Unknown mesh extension: "+c)}t.geometry={filename:a,type:u,scale:l},t.type="mesh";return}}}resolveFilename(e){if(/^https?:\/\//.test(e)||e.startsWith("data:"))return e;if(e.startsWith("package://")){const t=e.substring(10);return this.joinUrl(this.prefix,t)}if(e.startsWith("package:/")){const t=e.substring(9);return this.joinUrl(this.prefix,t)}return this.joinUrl(this.prefix,e)}joinUrl(e,t){return e.startsWith("/")||(e="/"+e),e.endsWith("/")||(e=e+"/"),t.startsWith("/")&&(t=t.substring(1)),e+t}parseJoints(e){const t=this.robot.links,n=[];this.robot.joints=n;const i=e.getElementsByTagName("joint");for(let s=0;s<i.length;s++){const o=i[s],a=o.getElementsByTagName("parent"),l=o.getElementsByTagName("child");if(a.length!==1||l.length!==1){console.warn("Joint without exactly one <parent> or <child>:",o);continue}const c=a[0].getAttribute("link"),u=l[0].getAttribute("link"),d=t[c],h=t[u];
3828if(!d||!h)throw new Error(`Joint references missing link: ${c} or ${u}`);let f=[0,0,0],p=[0,0,0];const m=o.getElementsByTagName("origin");m.length===1&&(f=$g(m[0])||f,p=Lb(m[0])||p);let g=[0,0,1];const v=o.getElementsByTagName("axis");v.length===1&&(g=$g(v[0])||g);let y;const _=o.getElementsByTagName("limit");if(_.length===1){const x=_[0];y={lower:parseFloat(x.getAttribute("lower")||"0"),upper:parseFloat(x.getAttribute("upper")||"0"),effort:parseFloat(x.getAttribute("effort")||"0"),velocity:parseFloat(x.getAttribute("velocity")||"0")}}n.push({name:o.getAttribute("name")||void 0,type:o.getAttribute("type"),origin_xyz:f,origin_rpy:p,axis_xyz:g,rotation:[0,0,0],parent:d,child:h,limit:y,elem:o})}}getURDFXML(){return this.robot.elem?`<?xml version="1.0" ?>
3829`+this.robot.elem.outerHTML:""}}class Ub extends QS{constructor(e){super(e)}parse(e){function t(P){switch(P.image_type){case h:case m:if(P.colormap_length>256||P.colormap_size!==24||P.colormap_type!==1)throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case f:case p:case g:case v:if(P.colormap_type)throw new Error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case d:throw new Error("THREE.TGALoader: No data.");default:throw new Error("THREE.TGALoader: Invalid type "+P.image_type)}if(P.width<=0||P.height<=0)throw new Error("THREE.TGALoader: Invalid image size.");if(P.pixel_size!==8&&P.pixel_size!==16&&P.pixel_size!==24&&P.pixel_size!==32)throw new Error("THREE.TGALoader: Invalid pixel size "+P.pixel_size)}function n(P,ee,X,Q,Y){let z,K;const te=X.pixel_size>>3,O=X.width*X.height*te;if(ee&&(K=Y.subarray(Q,Q+=X.colormap_length*(X.colormap_size>>3))),P){z=new Uint8Array(O);let U,W,j,ie=0;const de=new Uint8Array(te);for(;ie<O;)if(U=Y[Q++],W=(U&127)+1,U&128){for(j=0;j<te;++j)de[j]=Y[Q++];for(j=0;j<W;++j)z.set(de,ie+j*te);ie+=te*W}else{for(W*=te,j=0;j<W;++j)z[ie+j]=Y[Q++];ie+=W}}else z=Y.subarray(Q,Q+=ee?X.width*X.height:O);return{pixel_data:z,palettes:K}}function i(P,ee,X,Q,Y,z,K,te,O){const U=O;let W,j=0,ie,de;const ye=w.width;for(de=ee;de!==Q;de+=X)for(ie=Y;ie!==K;ie+=z,j++)W=te[j],P[(ie+ye*de)*4+3]=255,P[(ie+ye*de)*4+2]=U[W*3+0],P[(ie+ye*de)*4+1]=U[W*3+1],P[(ie+ye*de)*4+0]=U[W*3+2];return P}function s(P,ee,X,Q,Y,z,K,te){let O,U=0,W,j;const ie=w.width;for(j=ee;j!==Q;j+=X)for(W=Y;W!==K;W+=z,U+=2)O=te[U+0]+(te[U+1]<<8),P[(W+ie*j)*4+0]=(O&31744)>>7,P[(W+ie*j)*4+1]=(O&992)>>2,P[(W+ie*j)*4+2]=(O&31)<<3,P[(W+ie*j)*4+3]=O&32768?0:255;return P}function o(P,ee,X,Q,Y,z,K,te){let O=0,U,W;const j=w.width;for(W=ee;W!==Q;W+=X)for(U=Y;U!==K;U+=z,O+=3)P[(U+j*W)*4+3]=255,P[(U+j*W)*4+2]=te[O+0],P[(U+j*W)*4+1]=te[O+1],P[(U+j*W)*4+0]=te[O+2];return P}function a(P,ee,X,Q,Y,z,K,te){let O=0,U,W;const j=w.width;for(W=ee;W!==Q;W+=X)for(U=Y;U!==K;U+=z,O+=4)P[(U+j*W)*4+2]=te[O+0],P[(U+j*W)*4+1]=te[O+1],P[(U+j*W)*4+0]=te[O+2],P[(U+j*W)*4+3]=te[O+3];return P}function l(P,ee,X,Q,Y,z,K,te){let O,U=0,W,j;const ie=w.width;for(j=ee;j!==Q;j+=X)for(W=Y;W!==K;W+=z,U++)O=te[U],P[(W+ie*j)*4+0]=O,P[(W+ie*j)*4+1]=O,P[(W+ie*j)*4+2]=O,P[(W+ie*j)*4+3]=255;return P}function c(P,ee,X,Q,Y,z,K,te){let O=0,U,W;const j=w.width;for(W=ee;W!==Q;W+=X)for(U=Y;U!==K;U+=z,O+=2)P[(U+j*W)*4+0]=te[O+0],P[(U+j*W)*4+1]=te[O+0],P[(U+j*W)*4+2]=te[O+0],P[(U+j*W)*4+3]=te[O+1];return P}function u(P,ee,X,Q,Y){let z,K,te,O,U,W;switch((w.flags&y)>>_){default:case b:z=0,te=1,U=ee,K=0,O=1,W=X;break;case x:z=0,te=1,U=ee,K=X-1,O=-1,W=-1;break;case M:z=ee-1,te=-1,U=-1,K=0,O=1,W=X;break;case T:z=ee-1,te=-1,U=-1,K=X-1,O=-1,W=-1;break}if(k)switch(w.pixel_size){case 8:l(P,K,O,W,z,te,U,Q);break;case 16:c(P,K,O,W,z,te,U,Q);break;default:throw new Error("THREE.TGALoader: Format not supported.")}else switch(w.pixel_size){case 8:i(P,K,O,W,z,te,U,Q,Y);break;case 16:s(P,K,O,W,z,te,U,Q);break;case 24:o(P,K,O,W,z,te,U,Q);break;case 32:a(P,K,O,W,z,te,U,Q);break;default:throw new Error("THREE.TGALoader: Format not supported.")}return P}const d=0,h=1,f=2,p=3,m=9,g=10,v=11,y=48,_=4,x=0,T=1,b=2,M=3;if(e.length<19)throw new Error("THREE.TGALoader: Not enough data to contain header.");let E=0;const S=new Uint8Array(e),w={id_length:S[E++],colormap_type:S[E++],image_type:S[E++],colormap_index:S[E++]|S[E++]<<8,colormap_length:S[E++]|S[E++]<<8,colormap_size:S[E++],origin:[S[E++]|S[E++]<<8,S[E++]|S[E++]<<8],width:S[E++]|S[E++]<<8,height:S[E++]|S[E++]<<8,pixel_size:S[E++],flags:S[E++]};if(t(w),w.id_length+E>e.length)throw new Error("THREE.TGALoader: No data.");E+=w.id_length;let D=!1,R=!1,k=!1;switch(w.image_type){case m:D=!0,R=!0;break;case h:R=!0;break;case g:D=!0;break;case f:break;case v:D=!0,k=!0;break;case p:k=!0;break}const N=new Uint8Array(w.width*w.height*4),H=n(D,R,w,E,S);return u(N,w.width,w.height,H.pixel_data,H.palettes),{data:N,width:w.width,height:w.height,flipY:!0,generateMipmaps:!0,minFilter:Hr}}}
3829class pU extends Ei{load(e,t,n,i){const s=this,o=s.path===""?Tp.extractUrlBase(e):s.path,a=new Lr(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(l){try{t(s.parse(l,o))}catch(c){i?i(c):console.error(c),s.manager.itemError(e)}},n,i)}parse(e,t){function n(L,I){const $=[],G=L.childNodes;for(let Z=0,Pe=G.length;Z<Pe;Z++){const ze=G[Z];ze.nodeName===I&&$.push(ze)}return $}function i(L){if(L.length===0)return[];const I=L.trim().split(/\s+/),$=new Array(I.length);for(let G=0,Z=I.length;G<Z;G++)$[G]=I[G];return $}function s(L){if(L.length===0)return[];const I=L.trim().split(/\s+/),$=new Array(I.length);for(let G=0,Z=I.length;G<Z;G++)$[G]=parseFloat(I[G]);return $}function o(L){if(L.length===0)return[];const I=L.trim().split(/\s+/),$=new Array(I.length);for(let G=0,Z=I.length;G<Z;G++)$[G]=parseInt(I[G]);return $}function a(L){return L.substring(1)}function l(){return"three_default_"+dr++}function c(L){return Object.keys(L).length===0}function u(L){return{unit:d(n(L,"unit")[0]),upAxis:h(n(L,"up_axis")[0])}}function d(L){return L!==void 0&&L.hasAttribute("meter")===!0?parseFloat(L.getAttribute("meter")):1}function h(L){return L!==void 0?L.textContent:"Y_UP"}function f(L,I,$,G){const Z=n(L,I)[0];if(Z!==void 0){const Pe=n(Z,$);for(let ze=0;ze<Pe.length;ze++)G(Pe[ze])}}function p(L,I){for(const $ in L){const G=L[$];G.build=I(L[$])}}function m(L,I){return L.build!==void 0||(L.build=I(L)),L.build}function g(L){const I={sources:{},samplers:{},channels:{}};let $=!1;for(let G=0,Z=L.childNodes.length;G<Z;G++){const Pe=L.childNodes[G];if(Pe.nodeType!==1)continue;let ze;switch(Pe.nodeName){case"source":ze=Pe.getAttribute("id"),I.sources[ze]=ke(Pe);break;case"sampler":ze=Pe.getAttribute("id"),I.samplers[ze]=v(Pe);break;case"channel":ze=Pe.getAttribute("target"),I.channels[ze]=y(Pe);break;case"animation":g(Pe),$=!0;break;default:console.log(Pe)}}$===!1&&(Vt.animations[L.getAttribute("id")||cs.generateUUID()]=I)}function v(L){const I={inputs:{}};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"input":const Pe=a(Z.getAttribute("source")),ze=Z.getAttribute("semantic");I.inputs[ze]=Pe;break}}return I}function y(L){const I={};let G=L.getAttribute("target").split("/");const Z=G.shift();let Pe=G.shift();const ze=Pe.indexOf("(")!==-1,mt=Pe.indexOf(".")!==-1;if(mt)G=Pe.split("."),Pe=G.shift(),I.member=G.shift();else if(ze){const rt=Pe.split("(");Pe=rt.shift();for(let ut=0;ut<rt.length;ut++)rt[ut]=parseInt(rt[ut].replace(/\)/,""));I.indices=rt}return I.id=Z,I.sid=Pe,I.arraySyntax=ze,I.memberSyntax=mt,I.sampler=a(L.getAttribute("source")),I}function _(L){const I=[],$=L.channels,G=L.samplers,Z=L.sources;for(const Pe in $)if($.hasOwnProperty(Pe)){const ze=$[Pe],mt=G[ze.sampler],rt=mt.inputs.INPUT,ut=mt.inputs.OUTPUT,Rt=Z[rt],Ke=Z[ut],Et=T(ze,Rt,Ke);w(Et,I)}return I}function x(L){return m(Vt.animations[L],_)}function T(L,I,$){const G=Vt.nodes[L.id],Z=Xt(G.id),Pe=G.transforms[L.sid],ze=G.matrix.clone().transpose();let mt,rt,ut,Rt,Ke,Et;const xt={};switch(Pe){case"matrix":for(ut=0,Rt=I.array.length;ut<Rt;ut++)if(mt=I.array[ut],rt=ut*$.stride,xt[mt]===void 0&&(xt[mt]={}),L.arraySyntax===!0){const Rn=$.array[rt],yn=L.indices[0]+4*L.indices[1];xt[mt][yn]=Rn}else for(Ke=0,Et=$.stride;Ke<Et;Ke++)xt[mt][Ke]=$.array[rt+Ke];break;case"translate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',Pe);break;case"rotate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',Pe);break;case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',Pe);break}const Lt=b(xt,ze);return{name:Z.uuid,keyframes:Lt}}function b(L,I){const $=[];for(const Z in L)$.push({time:parseFloat(Z),value:L[Z]});$.sort(G);for(let Z=0;Z<16;Z++)D($,Z,I.elements[Z]);return $;function G(Z,Pe){return Z.time-Pe.time}}const M=new V,E=new V,S=new $n;function w(L,I){const $=L.keyframes,G=L.name,Z=[],Pe=[],ze=[],mt=[];for(let rt=0,ut=$.length;rt<ut;rt++){const Rt=$[rt],Ke=Rt.time,Et=Rt.value;ve.fromArray(Et).transpose(),ve.decompose(M,S,E),Z.push(Ke),Pe.push(M.x,M.y,M.z),ze.push(S.x,S.y,S.z,S.w),mt.push(E.x,E.y,E.z)}return Pe.length>0&&I.push(new Va(G+".position",Z,Pe)),ze.length>0&&I.push(new gc(G+".quaternion",Z,ze)),mt.length>0&&I.push(new Va(G+".scale",Z,mt)),I}function D(L,I,$){let G,Z=!0,Pe,ze;for(Pe=0,ze=L.length;Pe<ze;Pe++)G=L[Pe],G.value[I]===void 0?G.value[I]=null:Z=!1;if(Z===!0)for(Pe=0,ze=L.length;Pe<ze;Pe++)G=L[Pe],G.value[I]=$;else R(L,I)}function R(L,I){let $,G;for(let Z=0,Pe=L.length;Z<Pe;Z++){const ze=L[Z];if(ze.value[I]===null){if($=k(L,Z,I),G=N(L,Z,I),$===null){ze.value[I]=G.value[I];continue}if(G===null){ze.value[I]=$.value[I];continue}H(ze,$,G,I)}}}function k(L,I,$){for(;I>=0;){const G=L[I];if(G.value[$]!==null)return G;I--}return null}function N(L,I,$){for(;I<L.length;){const G=L[I];if(G.value[$]!==null)return G;I++}return null}function H(L,I,$,G){if($.time-I.time===0){L.value[G]=I.value[G];return}L.value[G]=(L.time-I.time)*($.value[G]-I.value[G])/($.time-I.time)+I.value[G]}function P(L){const I={name:L.getAttribute("id")||"default",start:parseFloat(L.getAttribute("start")||0),end:parseFloat(L.getAttribute("end")||0),animations:[]};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];
3829if(Z.nodeType===1)switch(Z.nodeName){case"instance_animation":I.animations.push(a(Z.getAttribute("url")));break}}Vt.clips[L.getAttribute("id")]=I}function ee(L){const I=[],$=L.name,G=L.end-L.start||-1,Z=L.animations;for(let Pe=0,ze=Z.length;Pe<ze;Pe++){const mt=x(Z[Pe]);for(let rt=0,ut=mt.length;rt<ut;rt++)I.push(mt[rt])}return new Ga($,G,I)}function X(L){return m(Vt.clips[L],ee)}function Q(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"skin":I.id=a(Z.getAttribute("source")),I.skin=Y(Z);break;case"morph":I.id=a(Z.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.");break}}Vt.controllers[L.getAttribute("id")]=I}function Y(L){const I={sources:{}};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"bind_shape_matrix":I.bindShapeMatrix=s(Z.textContent);break;case"source":const Pe=Z.getAttribute("id");I.sources[Pe]=ke(Z);break;case"joints":I.joints=z(Z);break;case"vertex_weights":I.vertexWeights=K(Z);break}}return I}function z(L){const I={inputs:{}};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"input":const Pe=Z.getAttribute("semantic"),ze=a(Z.getAttribute("source"));I.inputs[Pe]=ze;break}}return I}function K(L){const I={inputs:{}};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"input":const Pe=Z.getAttribute("semantic"),ze=a(Z.getAttribute("source")),mt=parseInt(Z.getAttribute("offset"));I.inputs[Pe]={id:ze,offset:mt};break;case"vcount":I.vcount=o(Z.textContent);break;case"v":I.v=o(Z.textContent);break}}return I}function te(L){const I={id:L.id},$=Vt.geometries[I.id];return L.skin!==void 0&&(I.skin=O(L.skin),$.sources.skinIndices=I.skin.indices,$.sources.skinWeights=I.skin.weights),I}function O(L){const $={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},G=L.sources,Z=L.vertexWeights,Pe=Z.vcount,ze=Z.v,mt=Z.inputs.JOINT.offset,rt=Z.inputs.WEIGHT.offset,ut=L.sources[L.joints.inputs.JOINT],Rt=L.sources[L.joints.inputs.INV_BIND_MATRIX],Ke=G[Z.inputs.WEIGHT.id].array;let Et=0,xt,Lt,bt;for(xt=0,bt=Pe.length;xt<bt;xt++){const yn=Pe[xt],hn=[];for(Lt=0;Lt<yn;Lt++){const cn=ze[Et+mt],wr=ze[Et+rt],Ti=Ke[wr];hn.push({index:cn,weight:Ti}),Et+=2}for(hn.sort(Rn),Lt=0;Lt<4;Lt++){const cn=hn[Lt];cn!==void 0?($.indices.array.push(cn.index),$.weights.array.push(cn.weight)):($.indices.array.push(0),$.weights.array.push(0))}}for(L.bindShapeMatrix?$.bindMatrix=new St().fromArray(L.bindShapeMatrix).transpose():$.bindMatrix=new St().identity(),xt=0,bt=ut.array.length;xt<bt;xt++){const yn=ut.array[xt],hn=new St().fromArray(Rt.array,xt*Rt.stride).transpose();$.joints.push({name:yn,boneInverse:hn})}return $;function Rn(yn,hn){return hn.weight-yn.weight}}function U(L){return m(Vt.controllers[L],te)}function W(L){const I={init_from:n(L,"init_from")[0].textContent};Vt.images[L.getAttribute("id")]=I}function j(L){return L.build!==void 0?L.build:L.init_from}function ie(L){const I=Vt.images[L];return I!==void 0?m(I,j):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",L),null)}function de(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"profile_COMMON":I.profile=ye(Z);break}}Vt.effects[L.getAttribute("id")]=I}function ye(L){const I={surfaces:{},samplers:{}};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"newparam":we(Z,I);break;case"technique":I.technique=F(Z);break;case"extra":I.extra=he(Z);break}}return I}function we(L,I){const $=L.getAttribute("sid");for(let G=0,Z=L.childNodes.length;G<Z;G++){const Pe=L.childNodes[G];if(Pe.nodeType===1)switch(Pe.nodeName){case"surface":I.surfaces[$]=_e(Pe);break;case"sampler2D":I.samplers[$]=Re(Pe);break}}}function _e(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"init_from":I.init_from=Z.textContent;break}}return I}function Re(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];
3829if(Z.nodeType===1)switch(Z.nodeName){case"source":I.source=Z.textContent;break}}return I}function F(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"constant":case"lambert":case"blinn":case"phong":I.type=Z.nodeName,I.parameters=pe(Z);break;case"extra":I.extra=he(Z);break}}return I}function pe(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":I[Z.nodeName]=me(Z);break;case"transparent":I[Z.nodeName]={opaque:Z.hasAttribute("opaque")?Z.getAttribute("opaque"):"A_ONE",data:me(Z)};break}}return I}function me(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"color":I[Z.nodeName]=s(Z.textContent);break;case"float":I[Z.nodeName]=parseFloat(Z.textContent);break;case"texture":I[Z.nodeName]={id:Z.getAttribute("texture"),extra:be(Z)};break}}return I}function be(L){const I={technique:{}};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"extra":se(Z,I);break}}return I}function se(L,I){for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"technique":Se(Z,I);break}}}function Se(L,I){for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":I.technique[Z.nodeName]=parseFloat(Z.textContent);break;case"wrapU":case"wrapV":Z.textContent.toUpperCase()==="TRUE"?I.technique[Z.nodeName]=1:Z.textContent.toUpperCase()==="FALSE"?I.technique[Z.nodeName]=0:I.technique[Z.nodeName]=parseInt(Z.textContent);break;case"bump":I[Z.nodeName]=He(Z);break}}}function he(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"technique":I.technique=le(Z);break}}return I}function le(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"double_sided":I[Z.nodeName]=parseInt(Z.textContent);break;case"bump":I[Z.nodeName]=He(Z);break}}return I}function He(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"texture":I[Z.nodeName]={id:Z.getAttribute("texture"),texcoord:Z.getAttribute("texcoord"),extra:be(Z)};break}}return I}function B(L){return L}function A(L){return m(Vt.effects[L],B)}function ne(L){const I={name:L.getAttribute("name")};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"instance_effect":I.url=a(Z.getAttribute("url"));break}}Vt.materials[L.getAttribute("id")]=I}function ge(L){let I,$=L.slice((L.lastIndexOf(".")-1>>>0)+2);switch($=$.toLowerCase(),$){case"tga":I=Xn;break;default:I=ni}return I}function ue(L){const I=A(L.url),$=I.profile.technique;let G;switch($.type){case"phong":case"blinn":G=new Cu;break;case"lambert":G=new yy;break;default:G=new Bi;break}G.name=L.name||"";function Z(rt,ut=null){const Rt=I.profile.samplers[rt.id];let Ke=null;if(Rt!==void 0){const Et=I.profile.surfaces[Rt.source];Ke=ie(Et.init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),Ke=ie(rt.id);if(Ke!==null){const Et=ge(Ke);if(Et!==void 0){const xt=Et.load(Ke),Lt=rt.extra;if(Lt!==void 0&&Lt.technique!==void 0&&c(Lt.technique)===!1){const bt=Lt.technique;xt.wrapS=bt.wrapU?Gr:or,xt.wrapT=bt.wrapV?Gr:or,xt.offset.set(bt.offsetU||0,bt.offsetV||0),xt.repeat.set(bt.repeatU||1,bt.repeatV||1)}else xt.wrapS=Gr,xt.wrapT=Gr;return ut!==null&&(xt.colorSpace=ut),xt}else return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",Ke),null}else return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",rt.id),null}const Pe=$.parameters;for(const rt in Pe){const ut=Pe[rt];switch(rt){case"diffuse":ut.color&&G.color.fromArray(ut.color),ut.texture&&(G.map=Z(ut.texture,Ln));break;case"specular":ut.color&&G.specular&&G.specular.fromArray(ut.color),ut.texture&&(G.specularMap=Z(ut.texture));break;case"bump":ut.texture&&(G.normalMap=Z(ut.texture));break;case"ambient":ut.texture&&(G.lightMap=Z(ut.texture,Ln));break;case"shininess":ut.float&&G.shininess&&(G.shininess=ut.float);break;case"emission":ut.color&&G.emissive&&G.emissive.fromArray(ut.color),ut.texture&&(G.emissiveMap=Z(ut.texture,Ln));break}}rn.colorSpaceToWorking(G.color,Ln),G.specular&&rn.colorSpaceToWorking(G.specular,Ln),G.emissive&&rn.colorSpaceToWorking(G.emissive,Ln);let ze=Pe.transparent,mt=Pe.transparency;if(mt===void 0&&ze&&(mt={float:1}),ze===void 0&&mt&&(ze={opaque:"A_ONE",data:{color:[1,1,1,1]}}),ze&&mt)if(ze.data.texture)G.transparent=!0;else{const rt=ze.data.color;switch(ze.opaque){case"A_ONE":G.opacity=rt[3]*mt.float;break;case"RGB_ZERO":G.opacity=1-rt[0]*mt.float;break;case"A_ZERO":G.opacity=1-rt[3]*mt.float;break;
3829case"RGB_ONE":G.opacity=rt[0]*mt.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',ze.opaque)}G.opacity<1&&(G.transparent=!0)}if($.extra!==void 0&&$.extra.technique!==void 0){const rt=$.extra.technique;for(const ut in rt){const Rt=rt[ut];switch(ut){case"double_sided":G.side=Rt===1?si:ms;break;case"bump":G.normalMap=Z(Rt.texture),G.normalScale=new Ue(1,1);break}}}return G}function ce(L){return m(Vt.materials[L],ue)}function Ne(L){const I={name:L.getAttribute("name")};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"optics":I.optics=De(Z);break}}Vt.cameras[L.getAttribute("id")]=I}function De(L){for(let I=0;I<L.childNodes.length;I++){const $=L.childNodes[I];switch($.nodeName){case"technique_common":return $e($)}}return{}}function $e(L){const I={};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];switch(G.nodeName){case"perspective":case"orthographic":I.technique=G.nodeName,I.parameters=Je(G);break}}return I}function Je(L){const I={};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];switch(G.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":I[G.nodeName]=parseFloat(G.textContent);break}}return I}function Ee(L){let I;switch(L.optics.technique){case"perspective":I=new Qn(L.optics.parameters.yfov,L.optics.parameters.aspect_ratio,L.optics.parameters.znear,L.optics.parameters.zfar);break;case"orthographic":let $=L.optics.parameters.ymag,G=L.optics.parameters.xmag;const Z=L.optics.parameters.aspect_ratio;G=G===void 0?$*Z:G,$=$===void 0?G/Z:$,G*=.5,$*=.5,I=new Ja(-G,G,$,-$,L.optics.parameters.znear,L.optics.parameters.zfar);break;default:I=new Qn;break}return I.name=L.name||"",I}function Ge(L){const I=Vt.cameras[L];return I!==void 0?m(I,Ee):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",L),null)}function Ye(L){let I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"technique_common":I=it(Z);break}}Vt.lights[L.getAttribute("id")]=I}function it(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"directional":case"point":case"spot":case"ambient":I.technique=Z.nodeName,I.parameters=Ze(Z)}}return I}function Ze(L){const I={};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];if(Z.nodeType===1)switch(Z.nodeName){case"color":const Pe=s(Z.textContent);I.color=new st().fromArray(Pe),rn.colorSpaceToWorking(I.color,Ln);break;case"falloff_angle":I.falloffAngle=parseFloat(Z.textContent);break;case"quadratic_attenuation":const ze=parseFloat(Z.textContent);I.distance=ze?Math.sqrt(1/ze):0;break}}return I}function ht(L){let I;switch(L.technique){case"directional":I=new Ty;break;case"point":I=new Ey;break;case"spot":I=new My;break;case"ambient":I=new Ay;break}return L.parameters.color&&I.color.copy(L.parameters.color),L.parameters.distance&&(I.distance=L.parameters.distance),I}function oe(L){const I=Vt.lights[L];return I!==void 0?m(I,ht):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",L),null)}function Oe(L){const I={name:L.getAttribute("name"),sources:{},vertices:{},primitives:[]},$=n(L,"mesh")[0];if($!==void 0){for(let G=0;G<$.childNodes.length;G++){const Z=$.childNodes[G];if(Z.nodeType!==1)continue;const Pe=Z.getAttribute("id");switch(Z.nodeName){case"source":I.sources[Pe]=ke(Z);break;case"vertices":I.vertices=Xe(Z);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",Z.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":I.primitives.push(Me(Z));break;default:console.log(Z)}}Vt.geometries[L.getAttribute("id")]=I}}function ke(L){const I={array:[],stride:3};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"float_array":I.array=s(G.textContent);break;case"Name_array":I.array=i(G.textContent);break;case"technique_common":const Z=n(G,"accessor")[0];Z!==void 0&&(I.stride=parseInt(Z.getAttribute("stride")));break}}return I}function Xe(L){const I={};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];G.nodeType===1&&(I[G.getAttribute("semantic")]=a(G.getAttribute("source")))}return I}function Me(L){const I={type:L.nodeName,material:L.getAttribute("material"),count:parseInt(L.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let $=0,G=L.childNodes.length;$<G;$++){const Z=L.childNodes[$];
3829if(Z.nodeType===1)switch(Z.nodeName){case"input":const Pe=a(Z.getAttribute("source")),ze=Z.getAttribute("semantic"),mt=parseInt(Z.getAttribute("offset")),rt=parseInt(Z.getAttribute("set")),ut=rt>0?ze+rt:ze;I.inputs[ut]={id:Pe,offset:mt},I.stride=Math.max(I.stride,mt+1),ze==="TEXCOORD"&&(I.hasUV=!0);break;case"vcount":I.vcount=o(Z.textContent);break;case"p":I.p=o(Z.textContent);break}}return I}function Ce(L){const I={};for(let $=0;$<L.length;$++){const G=L[$];I[G.type]===void 0&&(I[G.type]=[]),I[G.type].push(G)}return I}function nt(L){let I=0;for(let $=0,G=L.length;$<G;$++)L[$].hasUV===!0&&I++;I>0&&I<L.length&&(L.uvsNeedsFix=!0)}function ct(L){const I={},$=L.sources,G=L.vertices,Z=L.primitives;if(Z.length===0)return{};const Pe=Ce(Z);for(const ze in Pe){const mt=Pe[ze];nt(mt),I[ze]=dt(mt,$,G)}return I}function dt(L,I,$){const G={},Z={array:[],stride:0},Pe={array:[],stride:0},ze={array:[],stride:0},mt={array:[],stride:0},rt={array:[],stride:0},ut={array:[],stride:4},Rt={array:[],stride:4},Ke=new Ht,Et=[];let xt=0;for(let Lt=0;Lt<L.length;Lt++){const bt=L[Lt],Rn=bt.inputs;let yn=0;switch(bt.type){case"lines":case"linestrips":yn=bt.count*2;break;case"triangles":yn=bt.count*3;break;case"polylist":for(let hn=0;hn<bt.count;hn++){const cn=bt.vcount[hn];switch(cn){case 3:yn+=3;break;case 4:yn+=6;break;default:yn+=(cn-2)*3;break}}break;default:console.warn("THREE.ColladaLoader: Unknown primitive type:",bt.type)}Ke.addGroup(xt,yn,Lt),xt+=yn,bt.material&&Et.push(bt.material);for(const hn in Rn){const cn=Rn[hn];switch(hn){case"VERTEX":for(const wr in $){const Ti=$[wr];switch(wr){case"POSITION":const Sr=Z.array.length;if(ft(bt,I[Ti],cn.offset,Z.array),Z.stride=I[Ti].stride,I.skinWeights&&I.skinIndices&&(ft(bt,I.skinIndices,cn.offset,ut.array),ft(bt,I.skinWeights,cn.offset,Rt.array)),bt.hasUV===!1&&L.uvsNeedsFix===!0){const Uo=(Z.array.length-Sr)/Z.stride;for(let Nr=0;Nr<Uo;Nr++)ze.array.push(0,0)}break;case"NORMAL":ft(bt,I[Ti],cn.offset,Pe.array),Pe.stride=I[Ti].stride;break;case"COLOR":ft(bt,I[Ti],cn.offset,rt.array),rt.stride=I[Ti].stride;break;case"TEXCOORD":ft(bt,I[Ti],cn.offset,ze.array),ze.stride=I[Ti].stride;break;case"TEXCOORD1":ft(bt,I[Ti],cn.offset,mt.array),ze.stride=I[Ti].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',wr)}}break;case"NORMAL":ft(bt,I[cn.id],cn.offset,Pe.array),Pe.stride=I[cn.id].stride;break;case"COLOR":ft(bt,I[cn.id],cn.offset,rt.array,!0),rt.stride=I[cn.id].stride;break;case"TEXCOORD":ft(bt,I[cn.id],cn.offset,ze.array),ze.stride=I[cn.id].stride;break;case"TEXCOORD1":ft(bt,I[cn.id],cn.offset,mt.array),mt.stride=I[cn.id].stride;break}}}return Z.array.length>0&&Ke.setAttribute("position",new ot(Z.array,Z.stride)),Pe.array.length>0&&Ke.setAttribute("normal",new ot(Pe.array,Pe.stride)),rt.array.length>0&&Ke.setAttribute("color",new ot(rt.array,rt.stride)),ze.array.length>0&&Ke.setAttribute("uv",new ot(ze.array,ze.stride)),mt.array.length>0&&Ke.setAttribute("uv1",new ot(mt.array,mt.stride)),ut.array.length>0&&Ke.setAttribute("skinIndex",new ot(ut.array,ut.stride)),Rt.array.length>0&&Ke.setAttribute("skinWeight",new ot(Rt.array,Rt.stride)),G.data=Ke,G.type=L[0].type,G.materialKeys=Et,G}function ft(L,I,$,G,Z=!1){const Pe=L.p,ze=L.stride,mt=L.vcount;function rt(Ke){let Et=Pe[Ke+$]*Rt;const xt=Et+Rt;for(;Et<xt;Et++)G.push(ut[Et]);if(Z){const Lt=G.length-Rt-1;zn.setRGB(G[Lt+0],G[Lt+1],G[Lt+2],Ln),G[Lt+0]=zn.r,G[Lt+1]=zn.g,G[Lt+2]=zn.b}}const ut=I.array,Rt=I.stride;if(L.vcount!==void 0){let Ke=0;for(let Et=0,xt=mt.length;Et<xt;Et++){const Lt=mt[Et];if(Lt===4){const bt=Ke+ze*0,Rn=Ke+ze*1,yn=Ke+ze*2,hn=Ke+ze*3;rt(bt),rt(Rn),rt(hn),rt(Rn),rt(yn),rt(hn)}else if(Lt===3){const bt=Ke+ze*0,Rn=Ke+ze*1,yn=Ke+ze*2;rt(bt),rt(Rn),rt(yn)}else if(Lt>4)for(let bt=1,Rn=Lt-2;bt<=Rn;bt++){const yn=Ke+ze*0,hn=Ke+ze*bt,cn=Ke+ze*(bt+1);rt(yn),rt(hn),rt(cn)}Ke+=ze*Lt}}else for(let Ke=0,Et=Pe.length;Ke<Et;Ke+=ze)rt(Ke)}function qt(L){return m(Vt.geometries[L],ct)}function sn(L){const I={name:L.getAttribute("name")||"",joints:{},links:[]};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];
3829if(G.nodeType===1)switch(G.nodeName){case"technique_common":On(G,I);break}}Vt.kinematicsModels[L.getAttribute("id")]=I}function vn(L){return L.build!==void 0?L.build:L}function Cn(L){return m(Vt.kinematicsModels[L],vn)}function On(L,I){for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"joint":I.joints[G.getAttribute("sid")]=fi(G);break;case"link":I.links.push(Vi(G));break}}}function fi(L){let I;for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"prismatic":case"revolute":I=zi(G);break}}return I}function zi(L){const I={sid:L.getAttribute("sid"),name:L.getAttribute("name")||"",axis:new V,limits:{min:0,max:0},type:L.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"axis":const Z=s(G.textContent);I.axis.fromArray(Z);break;case"limits":const Pe=G.getElementsByTagName("max")[0],ze=G.getElementsByTagName("min")[0];I.limits.max=parseFloat(Pe.textContent),I.limits.min=parseFloat(ze.textContent);break}}return I.limits.min>=I.limits.max&&(I.static=!0),I.middlePosition=(I.limits.min+I.limits.max)/2,I}function Vi(L){const I={sid:L.getAttribute("sid"),name:L.getAttribute("name")||"",attachments:[],transforms:[]};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"attachment_full":I.attachments.push(pi(G));break;case"matrix":case"translate":case"rotate":I.transforms.push(Fn(G));break}}return I}function pi(L){const I={joint:L.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"link":I.links.push(Vi(G));break;case"matrix":case"translate":case"rotate":I.transforms.push(Fn(G));break}}return I}function Fn(L){const I={type:L.nodeName},$=s(L.textContent);switch(I.type){case"matrix":I.obj=new St,I.obj.fromArray($).transpose();break;case"translate":I.obj=new V,I.obj.fromArray($);break;case"rotate":I.obj=new V,I.obj.fromArray($),I.angle=cs.degToRad($[3]);break}return I}function Di(L){const I={name:L.getAttribute("name")||"",rigidBodies:{}};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"rigid_body":I.rigidBodies[G.getAttribute("name")]={},Do(G,I.rigidBodies[G.getAttribute("name")]);break}}Vt.physicsModels[L.getAttribute("id")]=I}function Do(L,I){for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"technique_common":eo(G,I);break}}}function eo(L,I){for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"inertia":I.inertia=s(G.textContent);break;case"mass":I.mass=s(G.textContent)[0];break}}}function bc(L){const I={bindJointAxis:[]};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"bind_joint_axis":I.bindJointAxis.push(el(G));break}}Vt.kinematicsScenes[a(L.getAttribute("url"))]=I}function el(L){const I={target:L.getAttribute("target").split("/").pop()};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType===1)switch(G.nodeName){case"axis":const Z=G.getElementsByTagName("param")[0];I.axis=Z.textContent;const Pe=I.axis.split("inst_").pop().split("axis")[0];I.jointIndex=Pe.substring(0,Pe.length-1);break}}return I}function to(L){return L.build!==void 0?L.build:L}function Lo(L){return m(Vt.kinematicsScenes[L],to)}function wc(){const L=Object.keys(Vt.kinematicsModels)[0],I=Object.keys(Vt.kinematicsScenes)[0],$=Object.keys(Vt.visualScenes)[0];if(L===void 0||I===void 0)return;const G=Cn(L),Z=Lo(I),Pe=on($),ze=Z.bindJointAxis,mt={};for(let Rt=0,Ke=ze.length;Rt<Ke;Rt++){const Et=ze[Rt],xt=xn.querySelector('[sid="'+Et.target+'"]');if(xt){const Lt=xt.parentElement;rt(Et.jointIndex,Lt)}}function rt(Rt,Ke){const Et=Ke.getAttribute("name"),xt=G.joints[Rt];Pe.traverse(function(Lt){Lt.name===Et&&(mt[Rt]={object:Lt,transforms:tl(Ke),joint:xt,position:xt.zeroPosition})})}const ut=new St;Ur={joints:G&&G.joints,getJointValue:function(Rt){const Ke=mt[Rt];if(Ke)return Ke.position;console.warn("THREE.ColladaLoader: Joint "+Rt+" doesn't exist.")},setJointValue:function(Rt,Ke){const Et=mt[Rt];if(Et){const xt=Et.joint;if(Ke>xt.limits.max||Ke<xt.limits.min)console.warn("THREE.ColladaLoader: Joint "+Rt+" value "+Ke+" outside of limits (min: "+xt.limits.min+", max: "+xt.limits.max+").");else if(xt.static)console.warn("THREE.ColladaLoader: Joint "+Rt+" is static.");else{const Lt=Et.object,bt=xt.axis,Rn=Et.transforms;ve.identity();for(let yn=0;yn<Rn.length;yn++){const hn=Rn[yn];if(hn.sid&&hn.sid.indexOf(Rt)!==-1)switch(xt.type){case"revolute":ve.multiply(ut.makeRotationAxis(bt,cs.degToRad(Ke)));break;case"prismatic":ve.multiply(ut.makeTranslation(bt.x*Ke,bt.y*Ke,bt.z*Ke));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+xt.type);break}else switch(hn.type){case"matrix":ve.multiply(hn.obj);break;case"translate":ve.multiply(ut.makeTranslation(hn.obj.x,hn.obj.y,hn.obj.z));break;case"scale":ve.scale(hn.obj);break;case"rotate":ve.multiply(ut.makeRotationAxis(hn.obj,hn.angle));break}}Lt.matrix.copy(ve),Lt.matrix.decompose(Lt.position,Lt.quaternion,Lt.scale),mt[Rt].position=Ke}}else console.log("THREE.ColladaLoader: "+Rt+" does not exist.")}}}function tl(L){const I=[],$=xn.querySelector('[id="'+L.id+'"]');for(let G=0;G<$.childNodes.length;G++){const Z=$.childNodes[G];
3829if(Z.nodeType!==1)continue;let Pe,ze;switch(Z.nodeName){case"matrix":Pe=s(Z.textContent);const mt=new St().fromArray(Pe).transpose();I.push({sid:Z.getAttribute("sid"),type:Z.nodeName,obj:mt});break;case"translate":case"scale":Pe=s(Z.textContent),ze=new V().fromArray(Pe),I.push({sid:Z.getAttribute("sid"),type:Z.nodeName,obj:ze});break;case"rotate":Pe=s(Z.textContent),ze=new V().fromArray(Pe);const rt=cs.degToRad(Pe[3]);I.push({sid:Z.getAttribute("sid"),type:Z.nodeName,obj:ze,angle:rt});break}}return I}function q(L){const I=L.getElementsByTagName("node");for(let $=0;$<I.length;$++){const G=I[$];G.hasAttribute("id")===!1&&G.setAttribute("id",l())}}const ve=new St,Te=new V;function fe(L){const I={name:L.getAttribute("name")||"",type:L.getAttribute("type"),id:L.getAttribute("id"),sid:L.getAttribute("sid"),matrix:new St,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];if(G.nodeType!==1)continue;let Z;switch(G.nodeName){case"node":I.nodes.push(G.getAttribute("id")),fe(G);break;case"instance_camera":I.instanceCameras.push(a(G.getAttribute("url")));break;case"instance_controller":I.instanceControllers.push(xe(G));break;case"instance_light":I.instanceLights.push(a(G.getAttribute("url")));break;case"instance_geometry":I.instanceGeometries.push(xe(G));break;case"instance_node":I.instanceNodes.push(a(G.getAttribute("url")));break;case"matrix":Z=s(G.textContent),I.matrix.multiply(ve.fromArray(Z).transpose()),I.transforms[G.getAttribute("sid")]=G.nodeName;break;case"translate":Z=s(G.textContent),Te.fromArray(Z),I.matrix.multiply(ve.makeTranslation(Te.x,Te.y,Te.z)),I.transforms[G.getAttribute("sid")]=G.nodeName;break;case"rotate":Z=s(G.textContent);const Pe=cs.degToRad(Z[3]);I.matrix.multiply(ve.makeRotationAxis(Te.fromArray(Z),Pe)),I.transforms[G.getAttribute("sid")]=G.nodeName;break;case"scale":Z=s(G.textContent),I.matrix.scale(Te.fromArray(Z)),I.transforms[G.getAttribute("sid")]=G.nodeName;break;case"extra":break;default:console.log(G)}}return Ct(I.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",I.id):Vt.nodes[I.id]=I,I}function xe(L){const I={id:a(L.getAttribute("url")),materials:{},skeletons:[]};for(let $=0;$<L.childNodes.length;$++){const G=L.childNodes[$];switch(G.nodeName){case"bind_material":const Z=G.getElementsByTagName("instance_material");for(let Pe=0;Pe<Z.length;Pe++){const ze=Z[Pe],mt=ze.getAttribute("symbol"),rt=ze.getAttribute("target");I.materials[mt]=a(rt)}break;case"skeleton":I.skeletons.push(a(G.textContent));break}}return I}function et(L,I){const $=[],G=[];let Z,Pe,ze;for(Z=0;Z<L.length;Z++){const ut=L[Z];let Rt;if(Ct(ut))Rt=Xt(ut),at(Rt,I,$);else if(Tn(ut)){const Et=Vt.visualScenes[ut].children;for(let xt=0;xt<Et.length;xt++){const Lt=Et[xt];if(Lt.type==="JOINT"){const bt=Xt(Lt.id);at(bt,I,$)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",ut)}for(Z=0;Z<I.length;Z++)for(Pe=0;Pe<$.length;Pe++)if(ze=$[Pe],ze.bone.name===I[Z].name){G[Z]=ze,ze.processed=!0;break}for(Z=0;Z<$.length;Z++)ze=$[Z],ze.processed===!1&&(G.push(ze),ze.processed=!0);const mt=[],rt=[];for(Z=0;Z<G.length;Z++)ze=G[Z],mt.push(ze.bone),rt.push(ze.boneInverse);return new jd(mt,rt)}function at(L,I,$){L.traverse(function(G){if(G.isBone===!0){let Z;for(let Pe=0;Pe<I.length;Pe++){const ze=I[Pe];if(ze.name===G.name){Z=ze.boneInverse;break}}Z===void 0&&(Z=new St),$.push({bone:G,boneInverse:Z,processed:!1})}})}function _t(L){const I=[],$=L.matrix,G=L.nodes,Z=L.type,Pe=L.instanceCameras,ze=L.instanceControllers,mt=L.instanceLights,rt=L.instanceGeometries,ut=L.instanceNodes;for(let Ke=0,Et=G.length;Ke<Et;Ke++)I.push(Xt(G[Ke]));for(let Ke=0,Et=Pe.length;Ke<Et;Ke++){const xt=Ge(Pe[Ke]);xt!==null&&I.push(xt.clone())}for(let Ke=0,Et=ze.length;Ke<Et;Ke++){const xt=ze[Ke],Lt=U(xt.id),bt=qt(Lt.id),Rn=Ut(bt,xt.materials),yn=xt.skeletons,hn=Lt.skin.joints,cn=et(yn,hn);for(let wr=0,Ti=Rn.length;wr<Ti;wr++){const Sr=Rn[wr];Sr.isSkinnedMesh&&(Sr.bind(cn,Lt.skin.bindMatrix),Sr.normalizeSkinWeights()),I.push(Sr)}}for(let Ke=0,Et=mt.length;Ke<Et;Ke++){const xt=oe(mt[Ke]);xt!==null&&I.push(xt.clone())}for(let Ke=0,Et=rt.length;Ke<Et;Ke++){const xt=rt[Ke],Lt=qt(xt.id),bt=Ut(Lt,xt.materials);for(let Rn=0,yn=bt.length;Rn<yn;Rn++)I.push(bt[Rn])}for(let Ke=0,Et=ut.length;Ke<Et;Ke++)I.push(Xt(ut[Ke]).clone());let Rt;
3829if(G.length===0&&I.length===1)Rt=I[0];else{Rt=Z==="JOINT"?new _m:new Pr;for(let Ke=0;Ke<I.length;Ke++)Rt.add(I[Ke])}return Rt.name=Z==="JOINT"?L.sid:L.name,Rt.matrix.copy($),Rt.matrix.decompose(Rt.position,Rt.quaternion,Rt.scale),Rt}const pt=new Bi({name:Ei.DEFAULT_MATERIAL_NAME,color:16711935});function Ot(L,I){const $=[];for(let G=0,Z=L.length;G<Z;G++){const Pe=I[L[G]];Pe===void 0?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",L[G]),$.push(pt)):$.push(ce(Pe))}return $}function Ut(L,I){const $=[];for(const G in L){const Z=L[G],Pe=Ot(Z.materialKeys,I);if(Pe.length===0&&(G==="lines"||G==="linestrips"?Pe.push(new ai):Pe.push(new Cu)),G==="lines"||G==="linestrips")for(let ut=0,Rt=Pe.length;ut<Rt;ut++){const Ke=Pe[ut];if(Ke.isMeshPhongMaterial===!0||Ke.isMeshLambertMaterial===!0){const Et=new ai;Et.color.copy(Ke.color),Et.opacity=Ke.opacity,Et.transparent=Ke.transparent,Pe[ut]=Et}}const ze=Z.data.attributes.skinIndex!==void 0,mt=Pe.length===1?Pe[0]:Pe;let rt;switch(G){case"lines":rt=new br(Z.data,mt);break;case"linestrips":rt=new Xs(Z.data,mt);break;case"triangles":case"polylist":ze?rt=new ly(Z.data,mt):rt=new fn(Z.data,mt);break}$.push(rt)}return $}function Ct(L){return Vt.nodes[L]!==void 0}function Xt(L){return m(Vt.nodes[L],_t)}function ln(L){const I={name:L.getAttribute("name"),children:[]};q(L);const $=n(L,"node");for(let G=0;G<$.length;G++)I.children.push(fe($[G]));Vt.visualScenes[L.getAttribute("id")]=I}function wn(L){const I=new Pr;I.name=L.name;const $=L.children;for(let G=0;G<$.length;G++){const Z=$[G];I.add(Xt(Z.id))}return I}function Tn(L){return Vt.visualScenes[L]!==void 0}function on(L){return m(Vt.visualScenes[L],wn)}function It(L){const I=n(L,"instance_visual_scene")[0];return on(a(I.getAttribute("url")))}function Bn(){const L=Vt.clips;if(c(L)===!0){if(c(Vt.animations)===!1){const I=[];for(const $ in Vt.animations){const G=x($);for(let Z=0,Pe=G.length;Z<Pe;Z++)I.push(G[Z])}kn.push(new Ga("default",-1,I))}}else for(const I in L)kn.push(X(I))}function tn(L){let I="";const $=[L];for(;$.length;){const G=$.shift();G.nodeType===Node.TEXT_NODE?I+=G.textContent:(I+=`
3830`,$.push(...G.childNodes))}return I.trim()}if(e.length===0)return{scene:new Hd};const mi=new DOMParser().parseFromString(e,"application/xml"),xn=n(mi,"COLLADA")[0],Jn=mi.getElementsByTagName("parsererror")[0];if(Jn!==void 0){const L=n(Jn,"div")[0];let I;return L?I=L.textContent:I=tn(Jn),console.error(`THREE.ColladaLoader: Failed to parse collada file.
3831`,I),null}const gi=xn.getAttribute("version");console.debug("THREE.ColladaLoader: File version",gi);const Sn=u(n(xn,"asset")[0]),ni=new eM(this.manager);ni.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);let Xn;Ub&&(Xn=new Ub(this.manager),Xn.setPath(this.resourcePath||t));const zn=new st,kn=[];let Ur={},dr=0;const Vt={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};f(xn,"library_animations","animation",g),f(xn,"library_animation_clips","animation_clip",P),f(xn,"library_controllers","controller",Q),f(xn,"library_images","image",W),f(xn,"library_effects","effect",de),f(xn,"library_materials","material",ne),f(xn,"library_cameras","camera",Ne),f(xn,"library_lights","light",Ye),f(xn,"library_geometries","geometry",Oe),f(xn,"library_nodes","node",fe),f(xn,"library_visual_scenes","visual_scene",ln),f(xn,"library_kinematics_models","kinematics_model",sn),f(xn,"library_physics_models","physics_model",Di),f(xn,"scene","instance_kinematics_scene",bc),p(Vt.animations,_),p(Vt.clips,ee),p(Vt.controllers,te),p(Vt.images,j),p(Vt.effects,B),p(Vt.materials,ue),p(Vt.cameras,Ee),p(Vt.lights,ht),p(Vt.geometries,ct),p(Vt.visualScenes,wn),Bn(),wc();const ko=It(n(xn,"scene")[0]);return ko.animations=kn,Sn.upAxis==="Z_UP"&&(console.warn("THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289."),ko.rotation.set(-Math.PI/2,0,0)),ko.scale.multiplyScalar(Sn.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),kn},kinematics:Ur,library:Vt,scene:ko}}}var mU=new Set(["$$slots","$$events","$$legacy","filename","color","scale","position","rotation","opacity","castShadow","receiveShadow","isInteractive","wireframe","side"]),gU=je("<!> <!>",1);function vU(r,e){vt(e,!0);let t=ae(e,"color",3,"#ffffff"),n=ae(e,"scale",19,()=>[1,1,1]),i=ae(e,"position",19,()=>[0,0,0]),s=ae(e,"rotation",19,()=>
3831[0,0,0]),o=ae(e,"opacity",3,1),a=ae(e,"castShadow",3,!0),l=ae(e,"receiveShadow",3,!0);ae(e,"isInteractive",3,!1),ae(e,"wireframe",3,!1),ae(e,"side",3,si);let c=Wt(e,mU);const u=[Math.PI/2,-Math.PI/2,-Math.PI/2],{load:d}=Fy(pU);var h=tt(),f=Ie(h);H0(f,()=>d(e.filename),null,(p,m)=>{var g=gU(),v=Ie(g);Od(v,()=>`<!-- include dae: ${e.filename} ${n()} -->`);var y=Le(v,2);Qe(y,()=>Bt.Group,(_,x)=>{x(_,{get scale(){return n()},get position(){return i()},get rotation(){return s()},children:(T,b)=>{var M=tt(),E=Ie(M);Qe(E,()=>Bt.Group,(S,w)=>{w(S,{get rotation(){return u},children:(D,R)=>{var k=tt(),N=Ie(k);{let H=Ve(()=>C(m).scene.scale.toArray()),P=Ve(()=>C(m).scene.position.toArray()),ee=Ve(()=>C(m).scene.rotation?C(m).scene.rotation.toArray():[0,0,0]);Qe(N,()=>Bt.Group,(X,Q)=>{Q(X,{get scale(){return C(H)},get position(){return C(P)},get rotation(){return C(ee)},children:(Y,z)=>{var K=tt(),te=Ie(K);qr(te,17,()=>C(m).scene.children,Mo,(O,U)=>{var W=tt(),j=Ie(W);{var ie=de=>{const ye=Ve(()=>C(U));var we=tt(),_e=Ie(we);{let Re=Ve(()=>C(ye).scale?C(ye).scale.toArray():[1,1,1]),F=Ve(()=>C(ye).position?C(ye).position.toArray():[0,0,0]);Qe(_e,()=>Bt.Mesh,(pe,me)=>{me(pe,pn({get castShadow(){return a()},get receiveShadow(){return l()},get geometry(){return C(ye).geometry},get scale(){return C(Re)},get position(){return C(F)},get material(){return C(ye).material}},()=>c,{children:(be,se)=>{var Se=tt(),he=Ie(Se);{let le=Ve(()=>o()<1);Qe(he,()=>Bt.MeshLambertMaterial,(He,B)=>{B(He,{get color(){return t()},get opacity(){return o()},get transparent(){return C(le)}})})}re(be,Se)},$$slots:{default:!0}}))})}re(de,we)};Dt(j,de=>{C(U).type==="Mesh"&&de(ie)})}re(O,W)}),re(Y,K)},$$slots:{default:!0}})})}re(D,k)},$$slots:{default:!0}})}),re(T,M)},$$slots:{default:!0}})}),re(p,g)}),re(r,h),yt()}const yU=/^[og]\s*(.+)?/,_U=/^mtllib /,xU=/^usemtl /,bU=/^usemap /,Nb=/\s+/,Ob=new V,Zg=new V,Fb=new V,Bb=new V,Er=new V,Yh=new st;function wU(){const r={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,s){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const a={index:this.materials.length,name:i||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){const c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),i&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},n&&n.name&&typeof n.clone=="function"){const i=n.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){const i=this.vertices,s=this.object.geometry.vertices;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,s=this.object.geometry.normals;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,s=this.object.geometry.normals;Ob.fromArray(i,e),Zg.fromArray(i,t),Fb.fromArray(i,n),Er.subVectors(Fb,Zg),Bb.subVectors(Ob,Zg),Er.cross(Bb),Er.normalize(),s.push(Er.x,Er.y,Er.z),s.push(Er.x,Er.y,Er.z),s.push(Er.x,Er.y,Er.z)},addColor:function(e,t,n){const i=this.colors,s=this.object.geometry.colors;i[e]!==void 0&&s.push(i[e+0],i[e+1],i[e+2]),i[t]!==void 0&&s.push(i[t+0],i[t+1],i[t+2]),i[n]!==void 0&&s.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,s=this.object.geometry.uvs;s.push(i[e+0],i[e+1]),s.push(i[t+0],i[t+1]),s.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,s,o,a,l,c){const u=this.vertices.length;let d=this.parseVertexIndex(e,u),h=this.parseVertexIndex(t,u),f=this.parseVertexIndex(n,u);
3831if(this.addVertex(d,h,f),this.addColor(d,h,f),a!==void 0&&a!==""){const p=this.normals.length;d=this.parseNormalIndex(a,p),h=this.parseNormalIndex(l,p),f=this.parseNormalIndex(c,p),this.addNormal(d,h,f)}else this.addFaceNormal(d,h,f);if(i!==void 0&&i!==""){const p=this.uvs.length;d=this.parseUVIndex(i,p),h=this.parseUVIndex(s,p),f=this.parseUVIndex(o,p),this.addUV(d,h,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n<i;n++){const s=this.parseVertexIndex(e[n],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let s=0,o=e.length;s<o;s++)this.addVertexLine(this.parseVertexIndex(e[s],n));for(let s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],i))}};return r.startObject("",!1),r}class SU extends Ei{constructor(e){super(e),this.materials=null}load(e,t,n,i){const s=this,o=new Lr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(a))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new wU;e.indexOf(`\r
3832`)!==-1&&(e=e.replace(/\r\n/g,`
3833`)),e.indexOf(`\\
3834`)!==-1&&(e=e.replace(/\\\n/g,""));const n=e.split(`
3835`);let i=[];for(let a=0,l=n.length;a<l;a++){const c=n[a].trimStart();if(c.length===0)continue;const u=c.charAt(0);if(u!=="#")if(u==="v"){const d=c.split(Nb);switch(d[0]){case"v":t.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),d.length>=7?(Yh.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6]),Ln),t.colors.push(Yh.r,Yh.g,Yh.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":t.uvs.push(parseFloat(d[1]),parseFloat(d[2]));break}}else if(u==="f"){const h=c.slice(1).trim().split(Nb),f=[];for(let m=0,g=h.length;m<g;m++){const v=h[m];if(v.length>0){const y=v.split("/");f.push(y)}}const p=f[0];for(let m=1,g=f.length-1;m<g;m++){const v=f[m],y=f[m+1];t.addFace(p[0],v[0],y[0],p[1],v[1],y[1],p[2],v[2],y[2])}}else if(u==="l"){const d=c.substring(1).trim().split(" ");let h=[];const f=[];if(c.indexOf("/")===-1)h=d;else for(let p=0,m=d.length;p<m;p++){const g=d[p].split("/");g[0]!==""&&h.push(g[0]),g[1]!==""&&f.push(g[1])}t.addLineGeometry(h,f)}else if(u==="p"){const h=c.slice(1).trim().split(" ");t.addPointGeometry(h)}else if((i=yU.exec(c))!==null){const d=(" "+i[0].slice(1).trim()).slice(1);t.startObject(d)}else if(xU.test(c))t.object.startMaterial(c.substring(7).trim(),t.materialLibraries);else if(_U.test(c))t.materialLibraries.push(c.substring(7).trim());else if(bU.test(c))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(u==="s"){if(i=c.split(" "),i.length>1){const h=i[1].trim().toLowerCase();t.object.smooth=h!=="0"&&h!=="off"}else t.object.smooth=!0;const d=t.object.currentMaterial();d&&(d.smooth=t.object.smooth)}else{if(c==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+c+'"')}}t.finalize();const s=new Pr;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let a=0,l=t.objects.length;a<l;a++){const c=t.objects[a],u=c.geometry,d=c.materials,h=u.type==="Line",f=u.type==="Points";let p=!1;if(u.vertices.length===0)continue;const m=new Ht;m.setAttribute("position",new ot(u.vertices,3)),u.normals.length>0&&m.setAttribute("normal",new ot(u.normals,3)),u.colors.length>0&&(p=!0,m.setAttribute("color",new ot(u.colors,3))),u.hasUVIndices===!0&&m.setAttribute("uv",new ot(u.uvs,2));const g=[];for(let y=0,_=d.length;y<_;y++){const x=d[y],T=x.name+"_"+x.smooth+"_"+p;let b=t.materials[T];if(this.materials!==null){if(b=this.materials.create(x.name),h&&b&&!(b instanceof ai)){const M=new ai;Mi.prototype.copy.call(M,b),M.color.copy(b.color),b=M}else if(f&&b&&!(b instanceof ma)){const M=new ma({size:10,sizeAttenuation:!1});Mi.prototype.copy.call(M,b),M.color.copy(b.color),M.map=b.map,b=M}}b===void 0&&(h?b=new ai:f?b=new ma({size:1,sizeAttenuation:!1}):b=new Cu,b.name=x.name,b.flatShading=!x.smooth,b.vertexColors=p,t.materials[T]=b),g.push(b)}let v;if(g.length>1){for(let y=0,_=d.length;y<_;y++){const x=d[y];m.addGroup(x.groupStart,x.groupCount,y)}h?v=new br(m,g):f?v=new su(m,g):v=new fn(m,g)}else h?v=new br(m,g[0]):f?v=new su(m,g[0]):v=new fn(m,g[0]);v.name=c.name,s.add(v)}else if(t.vertices.length>0){const a=new ma({size:1,sizeAttenuation:!1}),l=new Ht;l.setAttribute("position",new ot(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(l.setAttribute("color",new ot(t.colors,3)),a.vertexColors=!0);const c=new su(l,a);s.add(c)}return s}}var MU=new Set(["$$slots","$$events","$$legacy","filename","color","scale","rotation","position","opacity","castShadow","receiveShadow","isInteractive","wireframe","side"]),EU=je("<!> <!>",1);function TU(r,e){vt(e,!0);let t=ae(e,"color",3,"#ffffff"),n=ae(e,"scale",19,()=>[1,1,1]),i=ae(e,"rotation",19,()=>[0,0,0]),s=ae(e,"position",19,()=>
3835[0,0,0]),o=ae(e,"opacity",3,1),a=ae(e,"castShadow",3,!0),l=ae(e,"receiveShadow",3,!0);ae(e,"isInteractive",3,!1);let c=ae(e,"wireframe",3,!1),u=ae(e,"side",3,si),d=Wt(e,MU);const{load:h}=Fy(SU);var f=tt(),p=Ie(f);H0(p,()=>h(e.filename),null,(m,g)=>{var v=EU(),y=Ie(v);Od(y,()=>`<!-- include obj: ${e.filename} ${n()} -->`);var _=Le(y,2);Bt(_,pn({get is(){return C(g)},get position(){return s()},get rotation(){return i()},get scale(){return n()},get castShadow(){return a()},get receiveShadow(){return l()},get side(){return u()}},()=>d,{children:(x,T)=>{var b=tt(),M=Ie(b);{let E=Ve(()=>o()<1);Qe(M,()=>Bt.MeshLambertMaterial,(S,w)=>{w(S,{get color(){return t()},get opacity(){return o()},get transparent(){return C(E)},get wireframe(){return c()},get side(){return u()}})})}re(x,b)},$$slots:{default:!0}})),re(m,v)}),re(r,f),yt()}class AU extends Ei{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Lr(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(a))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){function t(c){const u=new DataView(c),d=32/8*3+32/8*3*3+16/8,h=u.getUint32(80,!0);if(80+32/8+h*d===u.byteLength)return!0;const p=[115,111,108,105,100];for(let m=0;m<5;m++)if(n(p,u,m))return!1;return!0}function n(c,u,d){for(let h=0,f=c.length;h<f;h++)if(c[h]!==u.getUint8(d+h))return!1;return!0}function i(c){const u=new DataView(c),d=u.getUint32(80,!0);let h,f,p,m=!1,g,v,y,_,x;for(let D=0;D<70;D++)u.getUint32(D,!1)==1129270351&&u.getUint8(D+4)==82&&u.getUint8(D+5)==61&&(m=!0,g=new Float32Array(d*3*3),v=u.getUint8(D+6)/255,y=u.getUint8(D+7)/255,_=u.getUint8(D+8)/255,x=u.getUint8(D+9)/255);const T=84,b=50,M=new Ht,E=new Float32Array(d*3*3),S=new Float32Array(d*3*3),w=new st;for(let D=0;D<d;D++){const R=T+D*b,k=u.getFloat32(R,!0),N=u.getFloat32(R+4,!0),H=u.getFloat32(R+8,!0);if(m){const P=u.getUint16(R+48,!0);(P&32768)===0?(h=(P&31)/31,f=(P>>5&31)/31,p=(P>>10&31)/31):(h=v,f=y,p=_)}for(let P=1;P<=3;P++){const ee=R+P*12,X=D*3*3+(P-1)*3;E[X]=u.getFloat32(ee,!0),E[X+1]=u.getFloat32(ee+4,!0),E[X+2]=u.getFloat32(ee+8,!0),S[X]=k,S[X+1]=N,S[X+2]=H,m&&(w.setRGB(h,f,p,Ln),g[X]=w.r,g[X+1]=w.g,g[X+2]=w.b)}}return M.setAttribute("position",new Zt(E,3)),M.setAttribute("normal",new Zt(S,3)),m&&(M.setAttribute("color",new Zt(g,3)),M.hasColors=!0,M.alpha=x),M}function s(c){const u=new Ht,d=/solid([\s\S]*?)endsolid/g,h=/facet([\s\S]*?)endfacet/g,f=/solid\s(.+)/;let p=0;const m=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,g=new RegExp("vertex"+m+m+m,"g"),v=new RegExp("normal"+m+m+m,"g"),y=[],_=[],x=[],T=new V;let b,M=0,E=0,S=0;for(;(b=d.exec(c))!==null;){E=S;const w=b[0],D=(b=f.exec(w))!==null?b[1]:"";for(x.push(D);(b=h.exec(w))!==null;){let N=0,H=0;const P=b[0];for(;(b=v.exec(P))!==null;)T.x=parseFloat(b[1]),T.y=parseFloat(b[2]),T.z=parseFloat(b[3]),H++;for(;(b=g.exec(P))!==null;)y.push(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3])),_.push(T.x,T.y,T.z),N++,S++;H!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+p),N!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+p),p++}const R=E,k=S-E;u.userData.groupNames=x,u.addGroup(R,k,M),M++}return u.setAttribute("position",new ot(y,3)),u.setAttribute("normal",new ot(_,3)),u}function o(c){return typeof c!="string"?new TextDecoder().decode(c):c}function a(c){if(typeof c=="string"){const u=new Uint8Array(c.length);for(let d=0;d<c.length;d++)u[d]=c.charCodeAt(d)&255;return u.buffer||u}else return c}const l=a(e);return t(l)?i(l):s(o(e))}}const CU=(r="pointer",e,t)=>{let n=Pt(!1);const i={cursor:"",fallback:void 0},s=()=>{Be(n,!0),l.add(i)},o=()=>{Be(n,!1),l.remove(i)};if(typeof window>"u")return{hovering:mu(()=>C(n)),onPointerEnter:s,onPointerLeave:o};const a=document.body,l=TM("threlte-extras-use-cursor",()=>{const u=a.style.cursor,d=[];return{active:d,originalCursor:u,el:a,add(h){d.push(h),a.style.cursor=h.cursor},remove(h){var p;const f=d.indexOf(h);f!==-1&&(d.splice(f,1),d.length>0?a.style.cursor=(p=d[d.length-1])==null?void 0:p.cursor:a.style.cursor=h.fallback??u)},refresh(){d.length>0&&(a.style.cursor=d[d.length-1].cursor)}}}),c=Xa(typeof r=="string"?zs(r):r);return Un(()=>{i.cursor=c.current,C(n)&&l.refresh()}),Pn(()=>()=>{l.remove(i)}),{hovering:mu(()=>C(n)),onPointerEnter:s,onPointerLeave:o}},Zo=r=>({subscribe:r.subscribe,get current(){return r.current}});let lu=0;const zy=Ir(!1),Vm=Ir(!1),Vy=Ir(void 0),Gy=Ir(0),Hy=Ir(0),RM=Ir([]),Wy=Ir(0),{onStart:Jg,onLoad:Kg,onError:Qg}=Za;Za.onStart=(r,e,t)=>{Jg==null||Jg(r,e,t),Vm.set(!0),Vy.set(r),Gy.set(e),Hy.set(t);const n=(e-lu)/(t-lu);Wy.set(n),n===1&&zy.set(!0)};Za.onLoad=()=>{Kg==null||Kg(),Vm.set(!1)};Za.onError=r=>{Qg==null||Qg(r),RM.update(e=>[...e,r])};Za.onProgress=(r,e,t)=>{e===t&&(lu=t),Vm.set(!0),Vy.set(r),Gy.set(e),Hy.set(t);const n=(e-lu)/(t-lu)||1;Wy.set(n),n===1&&zy.set(!0)};Zo(Vm),Zo(Vy),Zo(Gy),Zo(Hy),Zo(RM),Zo(Wy),Zo(zy);new V;new V;new V;const RU=()=>
3835TM("threlte-controls",{orbitControls:zs(void 0),trackballControls:zs(void 0),cameraControls:zs(void 0),transformControls:zs(void 0)});new Zn;new St;new $s;new V;const PU=Symbol("THRELTE_SUSPENSE_CONTEXT_IDENTIFIER"),PM=()=>{const r=Si(PU),e=new Set,t=i=>(r&&(r.suspend(i),e.add(i)),i),n={suspended:S1((r==null?void 0:r.suspended)??w1(!1),i=>i)};return M1(()=>{if(r){for(const i of e)r.onComponentDestroy(i);e.clear()}}),Object.assign(t,n)};new V;new St;new V;new V;new an;const IU=`
3836#include <common>
3837#include <logdepthbuf_pars_vertex>
3838void main() {
3839    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
3840    #include <logdepthbuf_vertex>
3841}`,zb=`
3842#include <logdepthbuf_pars_fragment>
3843void main() {
3844	#include <logdepthbuf_fragment>
3845	gl_FragColor = vec4(0.0,0.0,0.0,0.0);
3846}`,DU=`
3847#include <common>
3848#include <logdepthbuf_pars_vertex>
3849
3850void main() {
3851  vec2 center = vec2(0., 1.);
3852  float rotation = 0.0;
3853  
3854  // This is somewhat arbitrary, but it seems to work well
3855  // Need to figure out how to derive this dynamically if it even matters
3856  float size = 0.03;
3857
3858  vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
3859  vec2 scale = vec2(
3860    length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ),
3861    length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) )
3862  );
3863
3864  bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3865  if ( isPerspective ) scale *= - mvPosition.z;
3866
3867  vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
3868  vec2 rotatedPosition;
3869  rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3870  rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3871  mvPosition.xy += rotatedPosition;
3872
3873  gl_Position = projectionMatrix * mvPosition;
3874  #include <logdepthbuf_vertex>
3875}`,Ha=new V,Gm=new V,LU=new V,kU=new Ue,UU=(r,e,t)=>{const n=Ha.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,s=t.height/2;return[n.x*i+i,-(n.y*s)+s]},NU=(r,e)=>{const t=Ha.setFromMatrixPosition(r.matrixWorld),n=Gm.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),s=e.getWorldDirection(LU);return i.dot(s)<0},OU=(r,e,t,n)=>{const i=Ha.setFromMatrixPosition(r.matrixWorld),s=Gm.copy(Ha);s.project(e),t.setFromCamera(kU.set(s.x,s.y),e);const o=t.intersectObjects(n,!0);if(o.length){const a=o[0].distance;return i.distanceTo(t.ray.origin)<a}return!0},FU=(r,e)=>{if(Oi(e,"OrthographicCamera"))return e.zoom;if(Oi(e,"PerspectiveCamera")){const t=Ha.setFromMatrixPosition(r.matrixWorld),n=Gm.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,s=t.distanceTo(n);return 1/(2*Math.tan(i/2)*s)}else return 1},BU=(r,e,t)=>{const n=Ha.setFromMatrixPosition(r.matrixWorld),i=Gm.setFromMatrixPosition(e.matrixWorld),s=n.distanceTo(i),o=(t[1]-t[0])/(e.far-e.near),a=t[1]-o*e.far;return Math.round(o*s+a)},_i=r=>Math.abs(r)<1e-10?0:r,IM=(r,e,t="")=>{const n=r.elements;return`${t}matrix3d(${_i(e[0]*n[0])},${_i(e[1]*n[1])},${_i(e[2]*n[2])},${_i(e[3]*n[3])},${_i(e[4]*n[4])},${_i(e[5]*n[5])},${_i(e[6]*n[6])},${_i(e[7]*n[7])},${_i(e[8]*n[8])},${_i(e[9]*n[9])},${_i(e[10]*n[10])},${_i(e[11]*n[11])},${_i(e[12]*n[12])},${_i(e[13]*n[13])},${_i(e[14]*n[14])},${_i(e[15]*n[15])})`},zU=(r=>e=>IM(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),VU=(r=>(e,t)=>IM(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]),GU=(r,e,t)=>{if(Oi(r,"OrthographicCamera"))return 1;if(Oi(r,"PerspectiveCamera")){const{width:n,height:i}=t,s=r.getWorldPosition(Ha).distanceTo(e),o=r.fov*Math.PI/180,l=2*Math.tan(o/2)*s*(n/i);return n/l}throw new Error("getViewportFactor needs a Perspective or Orthogra
3875phic Camera")};let $h=!1,Rp=0,Vb="",Gb="",Hb="";const Wb=(r,e)=>{Rp===1&&!$h?(Vb=r.style.zIndex,Gb=r.style.position,Hb=r.style.pointerEvents,r.style.zIndex=`${Math.floor(e/2)}`,r.style.position="absolute",r.style.pointerEvents="none",$h=!0):Rp===0&&$h&&(r.style.zIndex=Vb,r.style.position=Gb,r.style.pointerEvents=Hb,$h=!1)};var HU=new Set(["$$slots","$$events","$$legacy","autoRender","eps","center","fullscreen","portal","distanceFactor","sprite","transform","occlude","castShadow","receiveShadow","material","geometry","zIndexRange","calculatePosition","as","wrapperClass","pointerEvents","ref","visible","children"]),jb=je("<!> <!>",1),WU=je("<div><div><div><!></div></div></div>"),jU=je("<div><!></div>");function XU(r,e){vt(e,!0);const t=()=>So(M,"$camera",s),n=()=>So(S,"$size",s),i=()=>So(be,"$suspended",s),[s,o]=im();let a=ae(e,"autoRender",3,!0),l=ae(e,"eps",3,.001),c=ae(e,"center",3,!1),u=ae(e,"fullscreen",3,!1),d=ae(e,"sprite",3,!1),h=ae(e,"transform",3,!1),f=ae(e,"occlude",3,!1),p=ae(e,"castShadow",3,!1),m=ae(e,"receiveShadow",3,!1),g=ae(e,"zIndexRange",19,()=>[16777271,0]),v=ae(e,"calculatePosition",3,UU),y=ae(e,"as",3,"div"),_=ae(e,"pointerEvents",3,"auto"),x=ae(e,"ref",15),T=ae(e,"visible",15),b=Wt(e,HU);T(!0);const{camera:M,scene:E,size:S,dom:w,canvas:D,renderStage:R}=Js(),k=new Pr;let N,H=0,P=0,ee=0,X=Number.MIN_SAFE_INTEGER,Q=-1,Y=-1,z="",K="",te="",O="",U=Pt(void 0),W=Pt(void 0),j=!1;const ie=new fn,de=new Bm,ye=new St,we=new V,_e=Ve(()=>!!f()&&f()!=="blending"),Re=Ve(()=>GU(t(),we,n())),F=Ve(()=>{if(!f())return g();const B=Math.floor(g()[0]/2);return C(_e)?[g()[0],B]:[B-1,0]});Un(()=>{if(f()==="blending")return Rp+=1,Wb(D,g()[0]),()=>{Rp-=1,Wb(D,g()[0])}});const pe=()=>{M.current.updateMatrixWorld(),k.updateWorldMatrix(!0,!1);const B=h()?null:v()(k,M.current,n());if(h()||B&&(Math.abs(H-M.current.zoom)>l()||Math.abs(P-B[0])>l()||Math.abs(ee-B[1])>l())){const A=NU(k,M.current);let ne=!1;C(_e)&&(Array.isArray(f())?ne=f():f()!=="blending"&&(ne=[E]));const ge=T();if(ne){const ce=OU(k,M.current,de,ne);T(ce&&!A)}else T(!A);ge!==T()&&(e.onvisibilitychange?e.onvisibilitychange(T()):N.style.display=T()?"block":"none");const ue=BU(k,M.current,C(F));if(X!==ue&&(N.style.zIndex=`${ue}`,X=ue),h()&&C(U)&&C(W)){const{isOrthographicCamera:ce,top:Ne,left:De,bottom:$e,right:Je}=M.current,{width:Ee,height:Ge}=n(),Ye=Ee/2,it=Ge/2,Ze=t().projectionMatrix.elements[5]*it,ht=zU(M.current.matrixWorldInverse),oe=ce?`scale(${Ze})translate(${_i(-(Je+De)/2)}px,${_i((Ne+$e)/2)}px)`:`translateZ(${Ze}px)`;d()?(ye.copy(M.current.matrixWorldInverse).transpose().copyPosition(ye).scale(k.scale),ye.elements[3]=ye.elements[7]=ye.elements[11]=0,ye.elements[15]=1):ye.copy(k.matrixWorld),Q!==Ee&&(N.style.width=`${Ee}px`,Q=Ee),Y!==Ge&&(N.style.height=`${Ge}px`,Y=Ge);const Oe=ce?"":`${Ze}px`;z!==Oe&&(N.style.perspective=Oe,z=Oe);const ke=`${oe}${ht}translate(${Ye}px,${it}px)`;K!==ke&&(C(U).style.transform=ke,K=ke);const Xe=VU(ye,1/((e.distanceFactor||10)/400));te!==Xe&&(C(W).style.transform=Xe,te=Xe)}else if(B){const ce=e.distanceFactor===void 0?1:FU(k,M.current)*e.distanceFactor,Ne=`translate3d(${B[0]}px,${B[1]}px,0) scale(${ce})`;O!==Ne&&(N.style.transform=Ne,O=Ne)}B&&(P=B[0],ee=B[1]),H=M.current.zoom}if(!C(_e)&&!j)if(h()&&C(U)){const A=C(U).children[0];if(A!=null&&A.clientWidth&&(A!=null&&A.clientHeight)){const{isOrthographicCamera:ne}=M.current;if(ne||e.geometry){const{scale:ge}=b;ge&&(Array.isArray(ge)?ie.scale.set(1/ge[0],1/ge[1],1/(ge[2]??1)):ie.scale.setScalar(1/ge))}else{const ge=(e.distanceFactor??10)/400,ue=A.clientWidth*ge,ce=A.clientHeight*ge;ie.scale.set(ue,ce,1)}j=!0}}else{const A=N.children[0];if(A!=null&&A.clientWidth&&(A!=null&&A.clientHeight)){const ne=1/C(Re),ge=A.clientWidth*ne,ue=A.clientHeight*ne;ie.scale.set(ge,ue,1),j=!0}ie.lookAt(M.current.position)}};Jd(pe,{autoInvalidate:!1,stage:R,running:()=>a()}),Pn(()=>{n(),wi(pe)});const me=B=>{const A=e.portal??w;if(!A){console.warn("<HTML>: target is undefined.");return}return A.append(B),{destroy:()=>B.remove()}},{suspended:be}=PM();var se={render:pe},Se=jb(),he=Ie(Se);Bt(he,pn({get is(){return k}},()=>b,{get ref(){return x()},set ref(B){x(B)},children:(B,A)=>{var ne=tt(),ge=Ie(ne);{var ue=ce=>{Bt(ce,{get is(){return ie},get castShadow(){return p()},get receiveShadow(){return m()},children:(Ne,De)=>{var $e=jb(),Je=Ie($e);{var Ee=oe=>{Bt(oe,{get is(){return e.geometry}})},Ge=oe=>{var Oe=tt(),ke=Ie(Oe);Qe(ke,()=>Bt.PlaneGeometry,(Xe,Me)=>{Me(Xe,{})}),re(oe,Oe)};Dt(Je,oe=>{e.geometry?oe(Ee):oe(Ge,-1)})}var Ye=Le(Je,2);{var it=oe=>{Bt(oe,{get is(){return e.material}})},Ze=oe=>{var Oe=tt(),ke=Ie(Oe);Qe(ke,()=>Bt.ShaderMaterial,(Xe,Me)=>{Me(Xe,{get side(){return si}
3875,get vertexShader(){return DU},get fragmentShader(){return zb}})}),re(oe,Oe)},ht=oe=>{var Oe=tt(),ke=Ie(Oe);Qe(ke,()=>Bt.ShaderMaterial,(Xe,Me)=>{Me(Xe,{get side(){return si},get vertexShader(){return IU},get fragmentShader(){return zb}})}),re(oe,Oe)};Dt(Ye,oe=>{e.material?oe(it):h()?oe(ht,-1):oe(Ze,1)})}re(Ne,$e)},$$slots:{default:!0}})};Dt(ge,ce=>{f()&&!C(_e)&&ce(ue)})}re(B,ne)},$$slots:{default:!0}}));var le=Le(he,2);W0(le,y,!1,(B,A)=>{VA(B,Ne=>me==null?void 0:me(Ne)),ti(B,Ne=>N=Ne,()=>N),In(B,()=>({class:e.wrapperClass,style:"",[PA]:{position:"absolute",top:"0",left:"0","pointer-events":h()?"none":void 0,overflow:h()?"hidden":void 0,"transform-origin":h()?void 0:"0 0",display:i()?"none":void 0}}));var ne=tt(),ge=Ie(ne);{var ue=Ne=>{var De=WU();let $e;var Je=qe(De);let Ee;var Ge=qe(Je),Ye=qe(Ge);zt(Ye,()=>e.children??jt,()=>({render:pe})),We(Ge),We(Je),ti(Je,it=>Be(W,it),()=>C(W)),We(De),ti(De,it=>Be(U,it),()=>C(U)),En(()=>{$e=nh(De,"",$e,{position:"absolute",top:"0",left:"0","transform-style":"preserve-3d","pointer-events":"none",width:`${n().width}px`,height:`${n().height}px`}),Ee=nh(Je,"",Ee,{position:"absolute","pointer-events":_()}),gr(Ge,1,da(e.class)),nh(Ge,e.style)}),re(Ne,De)},ce=Ne=>{var De=jU();let $e;var Je=qe(De);zt(Je,()=>e.children??jt,()=>({render:pe})),We(De),En(()=>{$e=nh(De,e.style,$e,{position:"absolute",transform:c()?"translate3d(-50%,-50%,0)":"none",top:u()?`${-n().height/2}px`:void 0,left:u()?`${-n().width/2}px`:void 0,width:u()?`${n().width}px`:void 0,height:u()?`${n().height}px`:void 0}),gr(De,1,da(e.class))}),re(Ne,De)};Dt(ge,Ne=>{h()?Ne(ue):Ne(ce,-1)})}re(A,ne)}),re(r,Se);var He=yt(se);return o(),He}var qU=Object.defineProperty,YU=(r,e,t)=>e in r?qU(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bn=(r,e,t)=>YU(r,typeof e!="symbol"?e+"":e,t);const DM=(r,e)=>{const[t,n]=e.split("-");return Object.assign(r.style,{left:n==="left"?"0":n==="center"?"50%":"",right:n==="right"?"0":"",top:t==="top"?"0":t==="bottom"?"":"50%",bottom:t==="bottom"?"0":"",transform:`${n==="center"?"translateX(-50%)":""} ${t==="center"?"translateY(-50%)":""}`}),e},$U=({placement:r,size:e,offset:t,id:n,className:i})=>{const s=document.createElement("div"),{top:o,left:a,right:l,bottom:c}=t;return Object.assign(s.style,{id:n,position:"absolute",zIndex:"1000",height:`${e}px`,width:`${e}px`,margin:`${o}px ${l}px ${c}px ${a}px`,borderRadius:"100%"}),DM(s,r),n&&(s.id=n),i&&(s.className=i),s},ZU=r=>{const e=typeof r=="string"?document.querySelector(r):r;if(!e)throw Error("Invalid DOM element");return e};function zv(r,e,t){return Math.max(e,Math.min(t,r))}const JU=[["x",0,3],["y",1,4],["z",2,5]],Xb=new V;function qb({isSphere:r},e,t){r&&(Xb.set(0,0,1).applyQuaternion(t.quaternion),JU.forEach(([n,i,s])=>{const o=Xb[n];let a=e[i],l=a.userData.opacity;a.material.opacity=zv(o>=0?l:l/2,0,1),a=e[s],l=a.userData.opacity,a.material.opacity=zv(o>=0?l/2:l,0,1)}))}const KU=(r,e,t=10)=>Math.abs(r.clientX-e.x)<t&&Math.abs(r.clientY-e.y)<t,Yb=new Bm,$b=new Ue,Zb=(r,e,t,n)=>{$b.set((r.clientX-e.left)/e.width*2-1,-((r.clientY-e.top)/e.height)*2+1),Yb.setFromCamera($b,t);const i=Yb.intersectObjects(n,!1),s=i.length?i[0]:null;return!s||!s.object.visible?null:s},ev=1e-6,QU=2*Math.PI,LM=["x","y","z"],Iu=[...LM,"nx","ny","nz"],eN=["x","z","y","nx","nz","ny"],tN=["z","x","y","nz","nx","ny"],Vv="Right",Af="Top",Gv="Front",Hv="Left",Cf="Bottom",Wv="Back",nN=[Vv,Af,Gv,Hv,Cf,Wv].map(r=>r.toLocaleLowerCase()),kM=1.3,Jb=(r,e=!0)=>{const{material:t,userData:n}=r,{color:i,opacity:s}=e?n.hover:n;t.color.set(i),t.opacity=s},Jo=r=>JSON.parse(JSON.stringify(r)),iN=r=>{const e=r.type||"sphere",t=e==="sphere",n=r.resolution||t?64:128,i=an.DEFAULT_UP,s=i.z===1,o=i.x===1,{container:a}=r;r.container=void 0,r=JSON.parse(JSON.stringify(r)),r.container=a;const l=s?eN:o?tN:Iu;nN.forEach((h,f)=>{r[h]&&(r[l[f]]=r[h])});const c={enabled:!0,color:16777215,opacity:1,scale:.7,labelColor:2236962,line:!1,border:{size:0,color:14540253},hover:{color:t?16777215:9688043,labelColor:2236962,opacity:1,scale:.7,border:{size:0,color:14540253}}},u={line:!1,scale:t?.45:.7,hover:{scale:t?.5:.7}},d={type:e,container:document.body,size:128,placement:"top-right",resolution:n,lineWidth:4,radius:t?1:.2,smoothness:18,animated:!0,speed:1,background:{enabled:!0,color:t?16777215:14739180,opacity:t?0:1,hover:{color:t?16777215:14739180,opacity:t?.2:1}},font:{family:"sans-serif",weight:900},offset:{top:10,left:10,bottom:10,right:10},corners:{enabled:!t,color:t?15915362:16777215,opacity:1,scale:t?.15:.2,radius:1,smoothness:18,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:.225}},edges:{enabled:!t,color:t?15915362:16777215,opacity:t?1:0,radius:t?1:.125,smoothness:18,scale:t?.15:1,hover:{color:t?16777215:9688043,opacity:1,scale:t?.2:1}},x:{...Jo(c),...t?{label:"X",color:16725587,line:!0}:{label:o?Af:Vv}},y:{...Jo(c),...t?{label:"Y",color:9100032,line:!0}:{label:s||o?Gv:Af}},z:{...Jo(c),...t?{label:"Z",color:2920447,line:!0}:{label:s?Af:o?Vv:Gv}},nx:{...Jo(u),label:t?"":o?Cf:Hv},ny:{...Jo(u),label:t?"":s||o?Wv:Cf},nz:{...Jo(u),label:t?"":s?Cf:o?Hv:Wv}};
3875return jv(r,d),LM.forEach(h=>jv(r[`n${h}`],Jo(r[h]))),{...r,isSphere:t}};function jv(r,...e){if(r instanceof HTMLElement||typeof r!="object"||r===null)return r;for(const t of e)for(const n in t)n!=="container"&&n in t&&(r[n]===void 0?r[n]=t[n]:typeof t[n]=="object"&&!Array.isArray(t[n])&&(r[n]=jv(r[n]||{},t[n])));return r}const rN=(r,e=2)=>{const t=new st,n=e*2,{isSphere:i,resolution:s,radius:o,font:a,corners:l,edges:c}=r,u=Iu.map(M=>({...r[M],radius:o}));i&&l.enabled&&u.push(l),i&&c.enabled&&u.push(c);const d=document.createElement("canvas"),h=d.getContext("2d");d.width=s*2+n*2,d.height=s*u.length+n*u.length;const[f,p]=T(u,s,a);u.forEach(({radius:M,label:E,color:S,labelColor:w,border:D,hover:{color:R,labelColor:k,border:N}},H)=>{const P=s*H+H*n+e;x(e,P,e,s,M,E,D,S,w),x(s+e*3,P,e,s,M,E,N??D,R??S,k??w)});const m=u.length,g=e/(s*2),v=e/(s*6),y=1/m,_=new PS(d);return _.repeat.set(.5-2*g,y-2*v),_.offset.set(g,1-v),Object.assign(_,{colorSpace:Ln,wrapS:Gr,wrapT:Gr,userData:{offsetX:g,offsetY:v,cellHeight:y}}),_;function x(M,E,S,w,D,R,k,N,H){if(D=D*(w/2),N!=null&&N!==""&&(P(),h.fillStyle=t.set(N).getStyle(),h.fill()),k&&k.size){const ee=k.size*w/2;M+=ee,E+=ee,w-=k.size*w,D=Math.max(0,D-ee),P(),h.strokeStyle=t.set(k.color).getStyle(),h.lineWidth=k.size*w,h.stroke()}R&&b(h,M+w/2,E+(w+S)/2,R,t.set(H).getStyle());function P(){h.beginPath(),h.moveTo(M+D,E),h.lineTo(M+w-D,E),h.arcTo(M+w,E,M+w,E+D,D),h.lineTo(M+w,E+w-D),h.arcTo(M+w,E+w,M+w-D,E+w,D),h.lineTo(M+D,E+w),h.arcTo(M,E+w,M,E+w-D,D),h.lineTo(M,E+D),h.arcTo(M,E,M+D,E,D),h.closePath()}}function T(M,E,S){const w=[...M].sort((Y,z)=>{var K,te;return(((K=Y.label)==null?void 0:K.length)||0)-(((te=z.label)==null?void 0:te.length)||0)}).pop().label,{family:D,weight:R}=S,k=i?Math.sqrt(Math.pow(E*.7,2)/2):E;let N=k,H=0,P=0;do{h.font=`${R} ${N}px ${D}`;const Y=h.measureText(w);H=Y.width,P=Y.fontBoundingBoxDescent,N--}while(H>k&&N>0);const ee=k/P,X=Math.min(k/H,ee),Q=Math.floor(N*X);return[`${R} ${Q}px ${D}`,ee]}function b(M,E,S,w,D){M.font=f,M.textAlign="center",M.textBaseline="middle",M.fillStyle=D,M.fillText(w,E,S+(i?p:0))}},sN=(r,e)=>r.offset.x=(e?.5:0)+r.userData.offsetX,jy=(r,e)=>{const{offset:t,userData:{offsetY:n,cellHeight:i}}=r;t.y=1-(e+1)*i+n};function Xy(r,e,t=2,n=2){const i=t/2-r,s=n/2-r,o=r/t,a=(t-r)/t,l=r/n,c=(n-r)/n,u=[i,s,0,-i,s,0,-i,-s,0,i,-s,0],d=[a,c,o,c,o,l,a,l],h=[3*(e+1)+3,3*(e+1)+4,e+4,e+5,2*(e+1)+4,2,1,2*(e+1)+3,3,4*(e+1)+3,4,0],f=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11].map(b=>h[b]);let p,m,g,v,y,_,x,T;for(let b=0;b<4;b++){v=b<1||b>2?i:-i,y=b<2?s:-s,_=b<1||b>2?a:o,x=b<2?c:l;for(let M=0;M<=e;M++)p=Math.PI/2*(b+M/e),m=Math.cos(p),g=Math.sin(p),u.push(v+r*m,y+r*g,0),d.push(_+o*m,x+l*g),M<e&&(T=(e+1)*b+M+4,f.push(b,T,T+1))}return new Ht().setIndex(new Zt(new Uint32Array(f),1)).setAttribute("position",new Zt(new Float32Array(u),3)).setAttribute("uv",new Zt(new Float32Array(d),2))}const oN=(r,e)=>{const t=new V,{isSphere:n,radius:i,smoothness:s}=r,o=Xy(i,s);return Iu.map((a,l)=>{const c=l<3,u=Iu[l],d=l?e.clone():e;jy(d,l);const{enabled:h,scale:f,opacity:p,hover:m}=r[u],g={map:d,opacity:p,transparent:!0},v=n?new Wd(new fc(g)):new fn(o,new Bi(g)),y=c?u:u[1];return v.position[y]=(c?1:-1)*(n?kM:1),n||v.lookAt(t.copy(v.position).multiplyScalar(1.7)),v.scale.setScalar(f),v.renderOrder=1,v.visible=h,v.userData={scale:f,opacity:p,hover:m},v})},aN=(r,e)=>{const{isSphere:t,corners:n}=r;if(!n.enabled)return[];const{color:i,opacity:s,scale:o,radius:a,smoothness:l,hover:c}=n,u=t?null:Xy(a,l),d={transparent:!0,opacity:s},h=[1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1].map(p=>p*.85),f=new V;return Array(h.length/3).fill(0).map((p,m)=>{if(t){const y=e.clone();jy(y,6),d.map=y}else d.color=i;const g=t?new Wd(new fc(d)):new fn(u,new Bi(d)),v=m*3;return g.position.set(h[v],h[v+1],h[v+2]),t&&g.position.normalize().multiplyScalar(1.7),g.scale.setScalar(o),g.lookAt(f.copy(g.position).multiplyScalar(2)),g.renderOrder=1,g.userData={color:i,opacity:s,scale:o,hover:c},g})},lN=(r,e,t)=>{const{isSphere:n,edges:i}=r;if(!i.enabled)return[];const{color:s,opacity:o,scale:a,hover:l,radius:c,smoothness:u}
3875=i,d=n?null:Xy(c,u,1.2,.25),h={transparent:!0,opacity:o},f=[0,1,1,0,-1,1,1,0,1,-1,0,1,0,1,-1,0,-1,-1,1,0,-1,-1,0,-1,1,1,0,1,-1,0,-1,1,0,-1,-1,0].map(g=>g*.925),p=new V,m=new V(0,1,0);return Array(f.length/3).fill(0).map((g,v)=>{if(n){const x=e.clone();jy(x,t),h.map=x}else h.color=s;const y=n?new Wd(new fc(h)):new fn(d,new Bi(h)),_=v*3;return y.position.set(f[_],f[_+1],f[_+2]),n&&y.position.normalize().multiplyScalar(1.7),y.scale.setScalar(a),y.up.copy(m),y.lookAt(p.copy(y.position).multiplyScalar(2)),!n&&!y.position.y&&(y.rotation.z=Math.PI/2),y.renderOrder=1,y.userData={color:s,opacity:o,scale:a,hover:l},y})};function cN(r,e=!1){const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,l=new Ht;let c=0;for(let u=0;u<r.length;++u){const d=r[u];let h=0;if(t!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in d.attributes){if(!n.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;s[f]===void 0&&(s[f]=[]),s[f].push(d.attributes[f]),h++}if(h!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in d.morphAttributes){if(!i.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+".  .morphAttributes must be consistent throughout all geometries."),null;o[f]===void 0&&(o[f]=[]),o[f].push(d.morphAttributes[f])}if(e){let f;if(t)f=d.index.count;else if(d.attributes.position!==void 0)f=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,f,u),c+=f}}if(t){let u=0;const d=[];for(let h=0;h<r.length;++h){const f=r[h].index;for(let p=0;p<f.count;++p)d.push(f.getX(p)+u);u+=r[h].attributes.position.count}l.setIndex(d)}for(const u in s){const d=Kb(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(const u in o){const d=o[u][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let h=0;h<d;++h){const f=[];for(let m=0;m<o[u].length;++m)f.push(o[u][m][h]);const p=Kb(f);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(p)}}return l}function Kb(r){let e,t,n,i=-1,s=0;for(let c=0;c<r.length;++c){const u=r[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=u.gpuType),i!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}const o=new e(s),a=new Zt(o,t,n);let l=0;for(let c=0;c<r.length;++c){const u=r[c];if(u.isInterleavedBufferAttribute){const d=l/t;for(let h=0,f=u.count;h<f;h++)for(let p=0;p<t;p++){const m=u.getComponent(h,p);a.setComponent(h+d,p,m)}}else o.set(u.array,l);l+=u.count*t}return i!==void 0&&(a.gpuType=i),a}const uN=(r,e)=>{const{isSphere:t,background:{enabled:n,color:i,opacity:s,hover:o}}=e;let a;const l=new Bi({color:i,side:Fi,opacity:s,transparent:!0,depthWrite:!1});if(!n)return null;if(t)a=new fn(new mc(1.8,64,64),l);else{let c;r.forEach(u=>{const d=u.scale.x;u.scale.setScalar(.9),u.updateMatrix();const h=u.geometry.clone();h.applyMatrix4(u.matrix),c=c?cN([c,h]):h,u.scale.setScalar(d)}),a=new fn(c,l)}return a.userData={color:i,opacity:s,hover:o},a},Qb=new jn,Zh=new V;let UM=class extends Fm{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new ot(e,3)),this.setAttribute("uv",new ot(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new Ap(t,6,1);return this.setAttribute("instanceStart",new vr(n,3,0)),this.setAttribute("instanceEnd",new vr(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new Ap(t,6,1);return this.setAttribute("instanceColorStart",new vr(n,3,0)),this.setAttribute("instanceColorEnd",new vr(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new gy(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new jn);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Qb.setFromBufferAttribute(t),this.boundingBox.union(Qb))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Zn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)Zh.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Zh)),Zh.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(Zh));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}};lt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Ue(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};ji.line={uniforms:Vd.merge([lt.common,lt.fog,lt.line]),vertexShader:`
3876		#include <common>
3877		#include <color_pars_vertex>
3878		#include <fog_pars_vertex>
3879		#include <logdepthbuf_pars_vertex>
3880		#include <clipping_planes_pars_vertex>
3881
3882		uniform float linewidth;
3883		uniform vec2 resolution;
3884
3885		attribute vec3 instanceStart;
3886		attribute vec3 instanceEnd;
3887
3888		attribute vec3 instanceColorStart;
3889		attribute vec3 instanceColorEnd;
3890
3891		#ifdef WORLD_UNITS
3892
3893			varying vec4 worldPos;
3894			varying vec3 worldStart;
3895			varying vec3 worldEnd;
3896
3897			#ifdef USE_DASH
3898
3899				varying vec2 vUv;
3900
3901			#endif
3902
3903		#else
3904
3905			varying vec2 vUv;
3906
3907		#endif
3908
3909		#ifdef USE_DASH
3910
3911			uniform float dashScale;
3912			attribute float instanceDistanceStart;
3913			attribute float instanceDistanceEnd;
3914			varying float vLineDistance;
3915
3916		#endif
3917
3918		void trimSegment( const in vec4 start, inout vec4 end ) {
3919
3920			// trim end segment so it terminates between the camera plane and the near plane
3921
3922			// conservative estimate of the near plane
3923			float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
3924			float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
3925			float nearEstimate = - 0.5 * b / a;
3926
3927			float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
3928
3929			end.xyz = mix( start.xyz, end.xyz, alpha );
3930
3931		}
3932
3933		void main() {
3934
3935			#ifdef USE_COLOR
3936
3937				vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
3938
3939			#endif
3940
3941			#ifdef USE_DASH
3942
3943				vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
3944				vUv = uv;
3945
3946			#endif
3947
3948			float aspect = resolution.x / resolution.y;
3949
3950			// camera space
3951			vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
3952			vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
3953
3954			#ifdef WORLD_UNITS
3955
3956				worldStart = start.xyz;
3957				worldEnd = end.xyz;
3958
3959			#else
3960
3961				vUv = uv;
3962
3963			#endif
3964
3965			// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
3966			// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
3967			// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
3968			// perhaps there is a more elegant solution -- WestLangley
3969
3970			bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
3971
3972			if ( perspective ) {
3973
3974				if ( start.z < 0.0 && end.z >= 0.0 ) {
3975
3976					trimSegment( start, end );
3977
3978				} else if ( end.z < 0.0 && start.z >= 0.0 ) {
3979
3980					trimSegment( end, start );
3981
3982				}
3983
3984			}
3985
3986			// clip space
3987			vec4 clipStart = projectionMatrix * start;
3988			vec4 clipEnd = projectionMatrix * end;
3989
3990			// ndc space
3991			vec3 ndcStart = clipStart.xyz / clipStart.w;
3992			vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
3993
3994			// direction
3995			vec2 dir = ndcEnd.xy - ndcStart.xy;
3996
3997			// account for clip-space aspect ratio
3998			dir.x *= aspect;
3999			dir = normalize( dir );
4000
4001			#ifdef WORLD_UNITS
4002
4003				vec3 worldDir = normalize( end.xyz - start.xyz );
4004				vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
4005				vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
4006				vec3 worldFwd = cross( worldDir, worldUp );
4007				worldPos = position.y < 0.5 ? start: end;
4008
4009				// height offset
4010				float hw = linewidth * 0.5;
4011				worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
4012
4013				// don't extend the line if we're rendering dashes because we
4014				// won't be rendering the endcaps
4015				#ifndef USE_DASH
4016
4017					// cap extension
4018					worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
4019
4020					// add width to the box
4021					worldPos.xyz += worldFwd * hw;
4022
4023					// endcaps
4024					if ( position.y > 1.0 || position.y < 0.0 ) {
4025
4026						worldPos.xyz -= worldFwd * 2.0 * hw;
4027
4028					}
4029
4030				#endif
4031
4032				// project the worldpos
4033				vec4 clip = projectionMatrix * worldPos;
4034
4035				// shift the depth of the projected points so the line
4036				// segments overlap neatly
4037				vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
4038				clip.z = clipPose.z * clip.w;
4039
4040			#else
4041
4042				vec2 offset = vec2( dir.y, - dir.x );
4043				// undo aspect ratio adjustment
4044				dir.x /= aspect;
4045				offset.x /= aspect;
4046
4047				// sign flip
4048				if ( position.x < 0.0 ) offset *= - 1.0;
4049
4050				// endcaps
4051				if ( position.y < 0.0 ) {
4052
4053					offset += - dir;
4054
4055				} else if ( position.y > 1.0 ) {
4056
4057					offset += dir;
4058
4059				}
4060
4061				// adjust for linewidth
4062				offset *= linewidth;
4063
4064				// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
4065				offset /= resolution.y;
4066
4067				// select end
4068				vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
4069
4070				// back to clip space
4071				offset *= clip.w;
4072
4073				clip.xy += offset;
4074
4075			#endif
4076
4077			gl_Position = clip;
4078
4079			vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
4080
4081			#include <logdepthbuf_vertex>
4082			#include <clipping_planes_vertex>
4083			#include <fog_vertex>
4084
4085		}
4086		`,fragmentShader:`
4087		uniform vec3 diffuse;
4088		uniform float opacity;
4089		uniform float linewidth;
4090
4091		#ifdef USE_DASH
4092
4093			uniform float dashOffset;
4094			uniform float dashSize;
4095			uniform float gapSize;
4096
4097		#endif
4098
4099		varying float vLineDistance;
4100
4101		#ifdef WORLD_UNITS
4102
4103			varying vec4 worldPos;
4104			varying vec3 worldStart;
4105			varying vec3 worldEnd;
4106
4107			#ifdef USE_DASH
4108
4109				varying vec2 vUv;
4110
4111			#endif
4112
4113		#else
4114
4115			varying vec2 vUv;
4116
4117		#endif
4118
4119		#include <common>
4120		#include <color_pars_fragment>
4121		#include <fog_pars_fragment>
4122		#include <logdepthbuf_pars_fragment>
4123		#include <clipping_planes_pars_fragment>
4124
4125		vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
4126
4127			float mua;
4128			float mub;
4129
4130			vec3 p13 = p1 - p3;
4131			vec3 p43 = p4 - p3;
4132
4133			vec3 p21 = p2 - p1;
4134
4135			float d1343 = dot( p13, p43 );
4136			float d4321 = dot( p43, p21 );
4137			float d1321 = dot( p13, p21 );
4138			float d4343 = dot( p43, p43 );
4139			float d2121 = dot( p21, p21 );
4140
4141			float denom = d2121 * d4343 - d4321 * d4321;
4142
4143			float numer = d1343 * d4321 - d1321 * d4343;
4144
4145			mua = numer / denom;
4146			mua = clamp( mua, 0.0, 1.0 );
4147			mub = ( d1343 + d4321 * ( mua ) ) / d4343;
4148			mub = clamp( mub, 0.0, 1.0 );
4149
4150			return vec2( mua, mub );
4151
4152		}
4153
4154		void main() {
4155
4156			#include <clipping_planes_fragment>
4157
4158			#ifdef USE_DASH
4159
4160				if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
4161
4162				if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
4163
4164			#endif
4165
4166			float alpha = opacity;
4167
4168			#ifdef WORLD_UNITS
4169
4170				// Find the closest points on the view ray and the line segment
4171				vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
4172				vec3 lineDir = worldEnd - worldStart;
4173				vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
4174
4175				vec3 p1 = worldStart + lineDir * params.x;
4176				vec3 p2 = rayEnd * params.y;
4177				vec3 delta = p1 - p2;
4178				float len = length( delta );
4179				float norm = len / linewidth;
4180
4181				#ifndef USE_DASH
4182
4183					#ifdef USE_ALPHA_TO_COVERAGE
4184
4185						float dnorm = fwidth( norm );
4186						alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
4187
4188					#else
4189
4190						if ( norm > 0.5 ) {
4191
4192							discard;
4193
4194						}
4195
4196					#endif
4197
4198				#endif
4199
4200			#else
4201
4202				#ifdef USE_ALPHA_TO_COVERAGE
4203
4204					// artifacts appear on some hardware if a derivative is taken within a conditional
4205					float a = vUv.x;
4206					float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4207					float len2 = a * a + b * b;
4208					float dlen = fwidth( len2 );
4209
4210					if ( abs( vUv.y ) > 1.0 ) {
4211
4212						alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
4213
4214					}
4215
4216				#else
4217
4218					if ( abs( vUv.y ) > 1.0 ) {
4219
4220						float a = vUv.x;
4221						float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
4222						float len2 = a * a + b * b;
4223
4224						if ( len2 > 1.0 ) discard;
4225
4226					}
4227
4228				#endif
4229
4230			#endif
4231
4232			vec4 diffuseColor = vec4( diffuse, alpha );
4233
4234			#include <logdepthbuf_fragment>
4235			#include <color_fragment>
4236
4237			gl_FragColor = vec4( diffuseColor.rgb, alpha );
4238
4239			#include <tonemapping_fragment>
4240			#include <colorspace_fragment>
4241			#include <fog_fragment>
4242			#include <premultiplied_alpha_fragment>
4243
4244		}
4245		`};let qy=class extends Dr{constructor(e){super({type:"LineMaterial",uniforms:Vd.clone(ji.line.uniforms),vertexShader:ji.line.vertexShader,fragmentShader:ji.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};const tv=new Kt,ew=new V,tw=new V,Ai=new Kt,Ci=new Kt,es=new Kt,nv=new V,iv=new St,Pi=new uM,nw=new V,Jh=new jn,Kh=new Zn,ts=new Kt;let us,ka;function iw(r,e,t){return ts.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),ts.multiplyScalar(1/ts.w),ts.x=ka/t.width,ts.y=ka/t.height,ts.applyMatrix4(r.projectionMatrixInverse),ts.multiplyScalar(1/ts.w),Math.abs(Math.max(ts.x,ts.y))}function dN(r,e){const t=r.matrixWorld,n=r.geometry,i=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,i.count);for(let a=0,l=o;a<l;a++){Pi.start.fromBufferAttribute(i,a),Pi.end.fromBufferAttribute(s,a),Pi.applyMatrix4(t);const c=new V,u=new V;us.distanceSqToSegment(Pi.start,Pi.end,u,c),u.distanceTo(c)<ka*.5&&e.push({point:u,pointOnLine:c,distance:us.origin.distanceTo(u),object:r,face:null,faceIndex:a,uv:null,uv1:null})}}function hN(r,e,t){const n=e.projectionMatrix,i=r.material.resolution,s=r.matrixWorld,o=r.geometry,a=o.attributes.instanceStart,l=o.attributes.instanceEnd,c=Math.min(o.instanceCount,a.count),u=-e.near;us.at(1,es),es.w=1,es.applyMatrix4(e.matrixWorldInverse),es.applyMatrix4(n),es.multiplyScalar(1/es.w),es.x*=i.x/2,es.y*=i.y/2,es.z=0,nv.copy(es),iv.multiplyMatrices(e.matrixWorldInverse,s);for(let d=0,h=c;d<h;d++){if(Ai.fromBufferAttribute(a,d),Ci.fromBufferAttribute(l,d),Ai.w=1,Ci.w=1,Ai.applyMatrix4(iv),Ci.applyMatrix4(iv),Ai.z>u&&Ci.z>u)continue;if(Ai.z>u){const v=Ai.z-Ci.z,y=(Ai.z-u)/v;Ai.lerp(Ci,y)}else if(Ci.z>u){const v=Ci.z-Ai.z,y=(Ci.z-u)/v;Ci.lerp(Ai,y)}Ai.applyMatrix4(n),Ci.applyMatrix4(n),Ai.multiplyScalar(1/Ai.w),Ci.multiplyScalar(1/Ci.w),Ai.x*=i.x/2,Ai.y*=i.y/2,Ci.x*=i.x/2,Ci.y*=i.y/2,Pi.start.copy(Ai),Pi.start.z=0,Pi.end.copy(Ci),Pi.end.z=0;const f=Pi.closestPointToPointParameter(nv,!0);Pi.at(f,nw);const p=cs.lerp(Ai.z,Ci.z,f),m=p>=-1&&p<=1,g=nv.distanceTo(nw)<ka*.5;if(m&&g){Pi.start.fromBufferAttribute(a,d),Pi.end.fromBufferAttribute(l,d),Pi.start.applyM
4245atrix4(s),Pi.end.applyMatrix4(s);const v=new V,y=new V;us.distanceSqToSegment(Pi.start,Pi.end,y,v),t.push({point:y,pointOnLine:v,distance:us.origin.distanceTo(y),object:r,face:null,faceIndex:d,uv:null,uv1:null})}}}class fN extends fn{constructor(e=new UM,t=new qy({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)ew.fromBufferAttribute(t,o),tw.fromBufferAttribute(n,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+ew.distanceTo(tw);const s=new Ap(i,2,1);return e.setAttribute("instanceDistanceStart",new vr(s,1,0)),e.setAttribute("instanceDistanceEnd",new vr(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;us=e.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;ka=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),Kh.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=ka*.5;else{const d=Math.max(i.near,Kh.distanceToPoint(us.origin));c=iw(i,d,l.resolution)}if(Kh.radius+=c,us.intersectsSphere(Kh)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),Jh.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=ka*.5;else{const d=Math.max(i.near,Jh.distanceToPoint(us.origin));u=iw(i,d,l.resolution)}Jh.expandByScalar(u),us.intersectsBox(Jh)!==!1&&(n?dN(this,t):hN(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(tv),this.material.uniforms.resolution.value.set(tv.z,tv.w))}}class NM extends UM{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setColors(n),this}setFromPoints(e){const t=e.length-1,n=new Float32Array(6*t);for(let i=0;i<t;i++)n[6*i]=e[i].x,n[6*i+1]=e[i].y,n[6*i+2]=e[i].z||0,n[6*i+3]=e[i+1].x,n[6*i+4]=e[i+1].y,n[6*i+5]=e[i+1].z||0;return super.setPositions(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class pN extends fN{constructor(e=new NM,t=new qy({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const mN=r=>{const e=new st,t=[],n=[],{isSphere:i}=r;if(Iu.forEach((a,l)=>{const{enabled:c,line:u,scale:d,color:h}=r[a];if(!c||!u)return;const f=l<3?1:-1,p=(i?kM-d/2:.975)*f;t.push(a.includes("x")?p:0,a.includes("y")?p:0,a.includes("z")?p:0,0,0,0);const m=e.set(h).toArray();n.push(...m,...m)}),!t.length)return null;const s=new NM().setPositions(t).setColors(n),o=new qy({linewidth:r.lineWidth,vertexColors:!0,resolution:new Ue(window.innerWidth,window.innerHeight)});return new pN(s,o).computeLineDistances()},gN=r=>{const{corners:e,edges:t}=r,n=[],i=rN(r),s=oN(r,i);n.push(...s),e.enabled&&n.push(...aN(r,i)),t.enabled&&n.push(...lN(r,i,e.enabled?7:6));const o=uN(s,r),a=mN(r);return[n,o,a]},Oc=(r,e=!0)=>{const{material:t,userData:n}=r,{opacity:i,color:s,scale:o}=e?n.hover:n;r.scale.setScalar(o),t.opacity=i,t.map?sN(t.map,e):t.color.set(s)},xl=new St,rw=new Cp,vN=new Ue,Ko=new V,sw=new Kt;class yN extends an{constructor(e,t,n={}){super(),bn(this,"enabled",!0),bn(this,"camera"),bn(this,"renderer"),bn(this,"options"),bn(this,"target",new V),bn(this,"animated",!0),bn(this,"speed",1),bn(this,"animating",!1),bn(this,"_options"),bn(this,"_intersections"),bn(this,"_background",null),bn(this,"_viewport",[0,0,0,0]),bn(this,"_originalViewport",[0,0,0,0]),bn(this,"_originalScissor",[0,0,0,0]),bn(this,"_scene"),bn(this,"_camera"),bn(this,"_container"),bn(this,"_domElement"),bn(this,"_domRect"),bn(this,"_dragging",!1),bn(this,"_distance",0),bn(this,"_clock",new Ry),bn(this,"_targetQuaternion",new $n),bn(this,"_quaternionStart",new $n),bn(this,"_quaternionEnd",new $n),bn(this,"_pointerStart",new Ue),bn(this,"_focus",null),bn(this,"_placement"),bn(this,"_controls"),bn(this,"_controlsListeners"),this.camera=e,this.renderer=t,this._scene=new Hd().add(this),this.set(n)}get placement(){return this._placement}set placement(e){this._placement=DM(this._domElement,e),this.domUpdate()}set(e={}){this.dispose(),this.options=e,this._options=iN(e),this._camera=this._options.isSphere?new Ja(-1.8,1.8,1.8,-1.8,5,10):new Qn(26,1,5,10),this._camera.position.set(0,0,7);const[t,n,i]=gN(this._options);n&&this.add(n),i&&this.add(i),this.add(...t),this._background=n,this._intersections=t;const{container:s,animated:o,speed:a}=this._options;return this.animated=o,this.speed=a,this._container=s?ZU(s):document.body,this._domElement=$U(this._options),this._domElement.onpointerdown=l=>this._onPointerDown(l),this._domElement.onpointermove=l=>this._onPointerMove(l),this._domElement.onpointerleave=()=>this._onPointerLeave(),this._container.appendChild(this._domElement),this._controls&&this.attachControl
4245s(this._controls),this.update(),this._updateOrientation(!0),this}render(){this.animating&&this._animate();const{renderer:e,_viewport:t}=this,n=e.getScissorTest(),i=e.autoClear;return e.autoClear=!1,e.setViewport(...t),n&&e.setScissor(...t),e.clear(!1,!0,!1),e.render(this._scene,this._camera),e.setViewport(...this._originalViewport),n&&e.setScissor(...this._originalScissor),e.autoClear=i,this}domUpdate(){this._domRect=this._domElement.getBoundingClientRect();const e=this.renderer,t=this._domRect,n=e.domElement.getBoundingClientRect();return this._viewport.splice(0,4,t.left-n.left,e.domElement.clientHeight-(t.top-n.top+t.height),t.width,t.height),e.getViewport(sw).toArray(this._originalViewport),e.getScissorTest()&&e.getScissor(sw).toArray(this._originalScissor),this}cameraUpdate(){return this._updateOrientation(),this}update(e=!0){return e&&this._controls&&this._controls.update(),this.domUpdate().cameraUpdate()}attachControls(e){return this.detachControls(),this.target=e.target,this._controlsListeners={start:()=>e.enabled=!1,end:()=>e.enabled=!0,change:()=>this.update(!1)},this.addEventListener("start",this._controlsListeners.start),this.addEventListener("end",this._controlsListeners.end),e.addEventListener("change",this._controlsListeners.change),this._controls=e,this}detachControls(){if(!(!this._controlsListeners||!this._controls))return this.target=new V().copy(this._controls.target),this.removeEventListener("start",this._controlsListeners.start),this.removeEventListener("end",this._controlsListeners.end),this._controls.removeEventListener("change",this._controlsListeners.change),this._controlsListeners=void 0,this._controls=void 0,this}dispose(){var e;this.detachControls(),this.children.forEach(t=>{var n,i,s,o;this.remove(t);const a=t;(n=a.material)==null||n.dispose(),(s=(i=a.material)==null?void 0:i.map)==null||s.dispose(),(o=a.geometry)==null||o.dispose()}),(e=this._domElement)==null||e.remove()}_updateOrientation(e=!0){e&&(this.quaternion.copy(this.camera.quaternion).invert(),this.updateMatrixWorld()),qb(this._options,this._intersections,this.camera)}_animate(){const{position:e,quaternion:t}=this.camera;if(e.set(0,0,1),!this.animated){e.applyQuaternion(this._quaternionEnd).multiplyScalar(this._distance).add(this.target),t.copy(this._targetQuaternion),this._updateOrientation(),this.animating=!1,this.dispatchEvent({type:"change"}),this.dispatchEvent({type:"end"});return}this._controls&&(this._controls.enabled=!1);const n=this._clock.getDelta()*QU*this.speed;this._quaternionStart.rotateTowards(this._quaternionEnd,n),e.applyQuaternion(this._quaternionStart).multiplyScalar(this._distance).add(this.target),t.rotateTowards(this._targetQuaternion,n),this._updateOrientation(),requestAnimationFrame(()=>this.dispatchEvent({type:"change"})),this._quaternionStart.angleTo(this._quaternionEnd)<ev&&(this._controls&&(this._controls.enabled=!0),this.animating=!1,this.dispatchEvent({type:"end"}))}_setOrientation(e){const t=this.camera,n=this.target;Ko.copy(e).multiplyScalar(this._distance),xl.setPosition(Ko).lookAt(Ko,this.position,this.up),this._targetQuaternion.setFromRotationMatrix(xl),Ko.add(n),xl.lookAt(Ko,n,this.up),this._quaternionEnd.setFromRotationMatrix(xl),xl.setPosition(t.position).lookAt(t.position,n,this.up),this._quaternionStart.setFromRotationMatrix(xl),this.animating=!0,this._clock.start(),this.dispatchEvent({type:"start"})}_onPointerDown(e){if(!this.enabled)return;const t=l=>{if(!this._dragging){if(KU(l,this._pointerStart))return;this._dragging=!0}const c=vN.set(l.clientX,l.clientY).sub(this._pointerStart).multiplyScalar(1/this._domRect.width*Math.PI),u=this.coordinateConversion(Ko.subVectors(this.camera.position,this.target)),d=rw.setFromVector3(u);d.theta=o-c.x,d.phi=zv(a-c.y,ev,Math.PI-ev),this.coordinateConversion(this.camera.position.setFromSpherical(d),!0).add(this.target),this.camera.lookAt(this.target),this.quaternion.copy(this.camera.quaternion).invert(),this._updateOrientation(!1),this.dispatchEvent({type:"change"})},n=()=>
4245{if(document.removeEventListener("pointermove",t,!1),document.removeEventListener("pointerup",n,!1),!this._dragging)return this._handleClick(e);this._focus&&(Oc(this._focus,!1),this._focus=null),this._dragging=!1,this.dispatchEvent({type:"end"})};if(this.animating)return;e.preventDefault(),this._pointerStart.set(e.clientX,e.clientY);const i=this.coordinateConversion(Ko.subVectors(this.camera.position,this.target)),s=rw.setFromVector3(i),o=s.theta,a=s.phi;this._distance=s.radius,document.addEventListener("pointermove",t,!1),document.addEventListener("pointerup",n,!1),this.dispatchEvent({type:"start"})}coordinateConversion(e,t=!1){const{x:n,y:i,z:s}=e,o=an.DEFAULT_UP;return o.x===1?t?e.set(i,s,n):e.set(s,n,i):o.z===1?t?e.set(s,n,i):e.set(i,s,n):e}_onPointerMove(e){!this.enabled||this._dragging||(this._background&&Jb(this._background,!0),this._handleHover(e))}_onPointerLeave(){!this.enabled||this._dragging||(this._background&&Jb(this._background,!1),this._focus&&Oc(this._focus,!1),this._domElement.style.cursor="")}_handleClick(e){const t=Zb(e,this._domRect,this._camera,this._intersections);this._focus&&(Oc(this._focus,!1),this._focus=null),t&&(this._setOrientation(t.object.position),this.dispatchEvent({type:"change"}))}_handleHover(e){const t=Zb(e,this._domRect,this._camera,this._intersections),n=(t==null?void 0:t.object)||null;this._focus!==n&&(this._domElement.style.cursor=n?"pointer":"",this._focus&&Oc(this._focus,!1),(this._focus=n)?Oc(n,!0):qb(this._options,this._intersections,this.camera))}}const ow={type:"change"},Yy={type:"start"},OM={type:"end"},Qh=new $s,aw=new as,_N=Math.cos(70*cs.DEG2RAD),ci=new V,Ji=2*Math.PI,An={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},rv=1e-6;class FM extends ky{constructor(e,t=null){super(e,t),this.state=An.NONE,this.target=new V,this.cursor=new V,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:yr.ROTATE,MIDDLE:yr.DOLLY,RIGHT:yr.PAN},this.touches={ONE:ha.ROTATE,TWO:ha.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new V,this._lastQuaternion=new $n,this._lastTargetPosition=new V,this._quat=new $n().setFromUnitVectors(e.up,new V(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Cp,this._sphericalDelta=new Cp,this._scale=1,this._panOffset=new V,this._rotateStart=new Ue,this._rotateEnd=new Ue,this._rotateDelta=new Ue,this._panStart=new Ue,this._panEnd=new Ue,this._panDelta=new Ue,this._dollyStart=new Ue,this._dollyEnd=new Ue,this._dollyDelta=new Ue,this._dollyDirection=new V,this._mouse=new Ue,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=bN.bind(this),this._onPointerDown=xN.bind(this),this._onPointerUp=wN.bind(this),this._onContextMenu=RN.bind(this),this._onMouseWheel=EN.bind(this),this._onKeyDown=TN.bind(this),this._onTouchStart=AN.bind(this),this._onTouchMove=CN.bind(this),this._onMouseDown=SN.bind(this),this._onMouseMove=MN.bind(this),this._interceptControlDown=PN.bind(this),this._interceptControlUp=IN.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(ow),this.update(),this.state=An.NONE}update(e=null){const t=this.object.position;ci.copy(t).sub(this.target),ci.applyQuaternion(this._quat),this._spherical.setFromVector3(ci),this.autoRotate&&this.state===An.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=Ji:n>
vendor: 14,486 bytes, line 4245
4245Math.PI&&(n-=Ji),i<-Math.PI?i+=Ji:i>Math.PI&&(i-=Ji),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ci.setFromSpherical(this._spherical),ci.applyQuaternion(this._quatInverse),t.copy(this.target).add(ci),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=ci.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new V(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new V(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=ci.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Qh.origin.copy(this.object.position),Qh.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Qh.direction))<_N?this.object.lookAt(this.target):(aw.setFromNormalAndCoplanarPoint(this.object.up,this.target),Qh.intersectPlane(aw,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>rv||8*(1-this._lastQuaternion.dot(this.object.quaternion))>rv||this._lastTargetPosition.distanceToSquared(this.target)>rv?(this.dispatchEvent(ow),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Ji/60*this.autoRotateSpeed*e:Ji/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ci.setFromMatrixColumn(t,0),ci.multiplyScalar(-e),this._panOffset.add(ci)}_panUp(e,t){this.screenSpacePanning===!0?ci.setFromMatrixColumn(t,1):(ci.setFromMatrixColumn(t,0),ci.crossVectors(this.object.up,ci)),ci.multiplyScalar(e),this._panOffset.add(ci)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;ci.copy(i).sub(this.target);let s=ci.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Ji*this._rotateDelta.x/t.clientHeight),this._rotateUp(Ji*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Ji*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Ji*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Ji*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Ji*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(n*n+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Ji*this._rotateDelta.x/t.clientHeight),this._rotateUp(Ji*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Ue,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function xN(r){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(r)&&(this._addPointer(r),r.pointerType==="touch"?this._onTouchStart(r):this._onMouseDown(r)))}function bN(r){this.enabled!==!1&&(r.pointerType==="touch"?this._onTouchMove(r):this._onMouseMove(r))}function wN(r){switch(this._removePointer(r),this._pointers.length){case 0:this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(OM),this.state=An.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function SN(r){let e;switch(r.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case yr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(r),this.state=An.DOLLY;break;case yr.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(r),this.state=An.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(r),this.state=An.ROTATE}break;case yr.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(r),this.state=An.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(r),this.state=An.PAN}break;default:this.state=An.NONE}this.state!==An.NONE&&this.dispatchEvent(Yy)}function MN(r){switch(this.state){case An.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(r);break;case An.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(r);break;case An.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(r);break}}function EN(r){this.enabled===!1||this.enableZoom===!1||this.state!==An.NONE||(r.preventDefault(),this.dispatchEvent(Yy),this._handleMouseWheel(this._customWheelEvent(r)),this.dispatchEvent(OM))}function TN(r){this.enabled!==!1&&this._handleKeyDown(r)}function AN(r){switch(this._trackPointer(r),this._pointers.length){case 1:switch(this.touches.ONE){case ha.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(r),this.state=An.TOUCH_ROTATE;break;case ha.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(r),this.state=An.TOUCH_PAN;break;default:this.state=An.NONE}break;case 2:switch(this.touches.TWO){case ha.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(r),this.state=An.TOUCH_DOLLY_PAN;break;case ha.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(r),this.state=An.TOUCH_DOLLY_ROTATE;break;default:this.state=An.NONE}break;default:this.state=An.NONE}this.state!==An.NONE&&this.dispatchEvent(Yy)}function CN(r){switch(this._trackPointer(r),this.state){case An.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(r),this.update();break;case An.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(r),this.update();break;case An.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(r),this.update();break;case An.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(r),this.update();break;default:this.state=An.NONE}}function RN(r){this.enabled!==!1&&r.preventDefault()}function PN(r){r.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function IN(r){r.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const sv={type:"change"}
4245,$y={type:"start"},Zy={type:"end"},lw=1e-6,_n={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},ef=new Ue,uo=new Ue,DN=new V,tf=new V,ov=new V,bl=new $n,cw=new V,nf=new V,av=new V,rf=new V;class LN extends ky{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:yr.ROTATE,MIDDLE:yr.DOLLY,RIGHT:yr.PAN},this.target=new V,this.state=_n.NONE,this.keyState=_n.NONE,this._lastPosition=new V,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new V,this._movePrev=new Ue,this._moveCurr=new Ue,this._lastAxis=new V,this._zoomStart=new Ue,this._zoomEnd=new Ue,this._panStart=new Ue,this._panEnd=new Ue,this._pointers=[],this._pointerPositions={},this._onPointerMove=UN.bind(this),this._onPointerDown=kN.bind(this),this._onPointerUp=NN.bind(this),this._onPointerCancel=ON.bind(this),this._onContextMenu=WN.bind(this),this._onMouseWheel=HN.bind(this),this._onKeyDown=BN.bind(this),this._onKeyUp=FN.bind(this),this._onTouchStart=jN.bind(this),this._onTouchMove=XN.bind(this),this._onTouchEnd=qN.bind(this),this._onMouseDown=zN.bind(this),this._onMouseMove=VN.bind(this),this._onMouseUp=GN.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}handleResize(){const e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>lw&&(this.dispatchEvent(sv),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>lw||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(sv),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=_n.NONE,this.keyState=_n.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(sv),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(uo.copy(this._panEnd).sub(this._panStart),uo.lengthSq()){if(this.object.isOrthographicCamera){const e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;uo.x*=e,uo.y*=t}uo.multiplyScalar(this._eye.length()*this.panSpeed),tf.copy(this._eye).cross(this.object.up).setLength(uo.x),tf.add(DN.copy(this.object.up).setLength(uo.y)),this.object.position.add(tf),this.target.add(tf),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(uo.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){rf.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=rf.length();e?(this._eye.copy(this.object.position).sub(this.target),cw.copy(this._eye).normalize(),nf.copy(this.object.up).normalize(),av.crossVectors(nf,cw).normalize(),nf.setLength(this._moveCurr.y-this._movePrev.y),av.setLength(this._moveCurr.x-this._movePrev.x),rf.copy(nf.add(av)),ov.crossVectors(rf,this._eye).normalize(),e*=this.rotateSpeed,bl.setFromAxisAngle(ov,e),this._eye.applyQuaternion(bl),this.object.up.applyQuaternion(bl),this._lastAxis.copy(ov),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),bl.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(bl),this.object.up.applyQuaternion(bl)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===_n.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=cs.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=cs.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return ef.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),ef}_getMouseOnCircle(e,t){return ef.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),ef}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Ue,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}}function kN(r){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),this._addPointer(r),r.pointerType==="touch"?this._onTouchStart(r):this._onMouseDown(r))}function UN(r){this.enabled!==!1&&(r.pointerType==="touch"?this._onTouchMove(r):this._onMouseMove(r))}function NN(r){this.enabled!==!1&&(r.pointerType==="touch"?this._onTouchEnd(r):this._onMouseUp(),this._removePointer(r),this._pointers.length===0&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp)))}function ON(r){this._removePointer(r)}function FN(){this.enabled!==!1&&(this.keyState=_n.NONE,window.addEventListener("keydown",this._onKeyDown))}function BN(r){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===_n.NONE&&(r.code===this.keys[_n.ROTATE]&&!this.noRotate?this.keyState=_n.ROTATE:r.code===this.keys[_n.ZOOM]&&!this.noZoom?this.keyState=_n.ZOOM:r.code===this.keys[_n.PAN]&&!this.noPan&&(this.keyState=_n.PAN)))}function zN(r){let e;switch(r.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case yr.DOLLY:this.state=_n.ZOOM;break;case yr.ROTATE:this.state=_n.ROTATE;break;case yr.PAN:this.state=_n.PAN;break;default:this.state=_n.NONE}const t=this.keyState!==_n.NONE?this.keyState:this.state;t===_n.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(r.pageX,r.pageY)),this._movePrev.copy(this._moveCurr)):t===_n.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(r.pageX,r.pageY)),this._zoomEnd.copy(this._zoomStart)):t===_n.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(r.pageX,r.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent($y)}function VN(r){const e=this.keyState!==_n.NONE?this.keyState:this.state;e===_n.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(r.pageX,r.pageY))):e===_n.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(r.pageX,r.pageY)):e===_n.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(r.pageX,r.pageY))}function GN(){this.state=_n.NONE,this.dispatchEvent(Zy)}function HN(r){if(this.enabled!==!1&&this.noZoom!==!0){switch(r.preventDefault(),r.deltaMode){case 2:this._zoomStart.y-=r.deltaY*.025;break;case 1:this._zoomStart.y-=r.deltaY*.01;break;default:this._zoomStart.y-=r.deltaY*25e-5;break}this.dispatchEvent($y),this.dispatchEvent(Zy)}}function WN(r){this.enabled!==!1&&r.preventDefault()}function jN(r){switch(this._trackPointer(r),this._pointers.length){case 1:this.state=_n.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);break;default:this.state=_n.TOUCH_ZOOM_PAN;const e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);const n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,i=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,i)),this._panEnd.copy(this._panStart);break}this.dispatchEvent($y)}function XN(r){switch(this._trackPointer(r),this._pointers.length){case 1:this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(r.pageX,r.pageY));break;default:const e=this._getSecondPointerPosition(r),t=r.pageX-e.x,n=r.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);const i=(r.pageX+e.x)/2,s=(r.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(i,s));break}}function qN(r){switch(this._pointers.length){case 0:this.state=_n.NONE;break;case 1:this.state=_n.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(r.pageX,r.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=_n.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==r.pointerId){const t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(Zy)}var YN=new Set(["$$slots","$$events","$$legacy","controls","renderTask","ref","onstart","onchange","onend"]);function $N(r,e){vt(e,!0);const t=()=>So(l,"$parent",i),n=()=>So(c,"$camera",i),[i,s]=im();let o=ae(e,"ref",15),a=Wt(e,YN);const l=wM(),{camera:c,renderer:u,dom:d,autoRenderTask:h,shouldRender:f,size:p,invalidate:m}=Js(),g=Ve(()=>(m(),new yN(c.current,u,{container:d,placement:"bottom-left",size:86,...a})));Un(()=>{o()!==C(g)&&o(C(g))});const v=new Kt,y=Ve(()=>e.controls??t()),_=wi(()=>e.renderTask);Jd((_==null?void 0:_.key)??Symbol("threlte-extras-gizmo-render"),()=>{if(f()){const M=u.toneMapping;u.getViewport(v),u.toneMapping=hs,C(g).render(),u.setViewport(v),u.toneMapping=M}},{autoInvalidate:!1,..._??{after:h}}),Pn(()=>{C(g).camera=n()}),Pn(()=>
4245{if(C(y))if(C(y)instanceof FM||C(y)instanceof LN){C(g).target=C(y).target;const M=()=>{C(g).update(!1)};return C(y).addEventListener("change",M),()=>C(y).removeEventListener("change",M)}else{const M=()=>{"getTarget"in C(y)&&typeof C(y).getTarget=="function"&&(C(y).getTarget(C(g).target),C(g).update())},E=()=>{C(y).setPosition(...c.current.position.toArray())};return C(g).addEventListener("change",E),C(y).addEventListener("update",M),()=>{C(g).removeEventListener("change",E),C(y).removeEventListener("update",M)}}});const x=M=>{var E;C(y).enabled=!1,(E=e.onstart)==null||E.call(e,M)},T=M=>{var E;m(),(E=e.onchange)==null||E.call(e,M)},b=M=>{var E;C(y).enabled=!0,(E=e.onend)==null||E.call(e,M)};Pn(()=>(C(g).addEventListener("start",x),C(g).addEventListener("change",T),C(g).addEventListener("end",b),()=>{C(g).removeEventListener("start",x),C(g).removeEventListener("change",T),C(g).removeEventListener("end",b)})),CM(()=>[p],()=>{C(g).update(),m()}),Pn(()=>()=>C(g).dispose()),yt(),s()}var ZN=new Set(["$$slots","$$events","$$legacy","camera","ref","children"]);function JN(r,e){vt(e,!0);const t=()=>So(d,"$parent",i),n=()=>So(c,"$defaultCamera",i),[i,s]=im();let o=ae(e,"ref",15),a=Wt(e,ZN);const{dom:l,camera:c,invalidate:u}=Js(),d=wM(),h=Ve(()=>e.camera?e.camera:Oi(t(),"Camera")?t():n()),f=new FM(wi(()=>C(h)),l);Pn(()=>{f.object=C(h)});const{orbitControls:p}=RU();Jd(()=>{f.update()},{autoInvalidate:!1,running:()=>e.autoRotate||e.enableDamping||!1});const m=g=>{var v;u(),(v=e.onchange)==null||v.call(e,g)};Pn(()=>(p.set(f),()=>{p.set(void 0)})),Bt(r,pn({get is(){return f}},()=>a,{onchange:m,get ref(){return o()},set ref(g){o(g)},children:(g,v)=>{var y=tt(),_=Ie(y);zt(_,()=>e.children??jt,()=>({ref:f})),re(g,y)},$$slots:{default:!0}})),yt(),s()}new St;new St;new fn;const KN=Ft.shadowmap_pars_fragment;KN.includes("unpackRGBAToDepth");var QN=new Set(["$$slots","$$events","$$legacy","points","shape","shapeFunction","ref","children"]);function uw(r,e){vt(e,!0);let t=ae(e,"points",19,()=>[]),n=ae(e,"shape",3,"none"),i=ae(e,"shapeFunction",3,()=>1),s=ae(e,"ref",15),o=Wt(e,QN);const a=Ve(()=>t().length),{invalidate:l}=Js(),c=Ve(()=>new Zt(new Float32Array(C(a)*6),3)),u=Ve(()=>new Zt(new Float32Array(C(a)*6),3)),d=Ve(()=>new Zt(new Float32Array(C(a)*6),3)),h=Ve(()=>new Zt(new Float32Array(C(a)*2),1)),f=Ve(()=>new Zt(new Float32Array(C(a)*2),1)),p=Ve(()=>new Zt(new Float32Array(C(a)*2),1)),m=Ve(()=>new Zt(new Float32Array(C(a)*4),2)),g=Ve(()=>new Zt(new Uint32Array(C(a)*6),1)),v=Ve(()=>n()==="taper"?_=>4*_*(1-_):i()),y=new Ht;Pn(()=>{const _=C(a)-1||1;for(let x=0,T=0,b=0;x<C(a);x+=1,T+=2,b+=6){C(h).setX(T,x/C(a)),C(h).setX(T+1,x/C(a)),C(f).setX(T,1),C(f).setX(T+1,-1);const M=n()==="none"?1:C(v)(x/_);if(C(p).setX(T,M),C(p).setX(T+1,M),C(m).setXYZW(T,x/_,0,x/_,1),x<C(a)-1){const E=x*2;C(g).setX(b+0,E+0),C(g).setX(b+1,E+1),C(g).setX(b+2,E+2),C(g).setX(b+3,E+2),C(g).setX(b+4,E+1),C(g).setX(b+5,E+3)}}y.setAttribute("position",C(c)),y.setAttribute("previous",C(u)),y.setAttribute("next",C(d)),y.setAttribute("counters",C(h)),y.setAttribute("side",C(f)),y.setAttribute("width",C(p)),y.setAttribute("uv",C(m)),y.setIndex(C(g)),C(p).needsUpdate=!0,l()}),Pn(()=>{if(t().length===0)return;let _=0,x=0,T=0;const b=t()[0];C(u).setXYZ(x,b.x,b.y,b.z),x+=1,C(u).setXYZ(x,b.x,b.y,b.z),x+=1;for(let E=0;E<C(a);E++){const S=t()[E];C(c).setXYZ(_,S.x,S.y,S.z),_+=1,C(c).setXYZ(_,S.x,S.y,S.z),_+=1,E<C(a)-1&&(C(u).setXYZ(x,S.x,S.y,S.z),x+=1,C(u).setXYZ(x,S.x,S.y,S.z),x+=1),E>0&&(C(d).setXYZ(T,S.x,S.y,S.z),T+=1,C(d).setXYZ(T,S.x,S.y,S.z),T+=1)}const M=t()[C(a)-1];C(d).setXYZ(T,M.x,M.y,M.z),T+=1,C(d).setXYZ(T,M.x,M.y,M.z),T+=1,C(c).needsUpdate=!0,C(u).needsUpdate=!0,C(d).needsUpdate=!0,y.computeBoundingSphere(),l()}),Bt(r,pn({get is(){return y}},()=>o,{get ref(){return s()},set ref(_){s(_)},children:(_,x)=>{var T=tt(),b=Ie(T);zt(b,()=>e.children??jt,()=>({ref:y})),re(_,T)},$$slots:{default:!0}})),yt()}`${Ft.logdepthbuf_pars_vertex}${Ft.fog_pars_vertex}${Ft.logdepthbuf_vertex}${Ft.fog_vertex}`;var eO=new Set(["$$slots","$$events","$$legacy","follow","ref","children"]);function BM(r,e){vt(e,!0);const t=()=>So(u,"$camera",n),[n,i]=im();let s=ae(e,"follow",3,!0),o=ae(e,"ref",15),a=Wt(e,eO);const l=new Pr,c=new Pr,{camera:u,renderStage:d}=Js(),h=new $n;let f=Ve(()=>s()===!0?t():s()===!1?void 0:s());const p=iU("<Billboard>",{before:d});Jd(()=>{var m;c.updateMatrix(),c.updateWorldMatrix(!1,!1),c.getWorldQuaternion(h
4245),(m=C(f))==null||m.getWorldQuaternion(l.quaternion).premultiply(h.invert())},{stage:p,running:()=>s()!==!1}),Bt(r,pn({get is(){return c}},()=>a,{get ref(){return o()},set ref(m){o(m)},children:(m,g)=>{Bt(m,{get is(){return l},children:(v,y)=>{var _=tt(),x=Ie(_);zt(x,()=>e.children??jt,()=>({ref:c})),re(v,_)},$$slots:{default:!0}})},$$slots:{default:!0}})),yt(),i()}`${Ft.tonemapping_fragment}${Ft.colorspace_fragment}`;`${Ft.tonemapping_fragment}${Ft.colorspace_fragment}`;const tO=`
4246
4247// A stack of uint32 indices can can store the indices for
4248// a perfectly balanced tree with a depth up to 31. Lower stack
4249// depth gets higher performance.
4250//
4251// However not all trees are balanced. Best value to set this to
4252// is the trees max depth.
4253#ifndef BVH_STACK_DEPTH
4254#define BVH_STACK_DEPTH 60
4255#endif
4256
4257#ifndef INFINITY
4258#define INFINITY 1e20
4259#endif
4260
4261// Utilities
4262uvec4 uTexelFetch1D( usampler2D tex, uint index ) {
4263
4264	uint width = uint( textureSize( tex, 0 ).x );
4265	uvec2 uv;
4266	uv.x = index % width;
4267	uv.y = index / width;
4268
4269	return texelFetch( tex, ivec2( uv ), 0 );
4270
4271}
4272
4273ivec4 iTexelFetch1D( isampler2D tex, uint index ) {
4274
4275	uint width = uint( textureSize( tex, 0 ).x );
4276	uvec2 uv;
4277	uv.x = index % width;
4278	uv.y = index / width;
4279
4280	return texelFetch( tex, ivec2( uv ), 0 );
4281
4282}
4283
4284vec4 texelFetch1D( sampler2D tex, uint index ) {
4285
4286	uint width = uint( textureSize( tex, 0 ).x );
4287	uvec2 uv;
4288	uv.x = index % width;
4289	uv.y = index / width;
4290
4291	return texelFetch( tex, ivec2( uv ), 0 );
4292
4293}
4294
4295vec4 textureSampleBarycoord( sampler2D tex, vec3 barycoord, uvec3 faceIndices ) {
4296
4297	return
4298		barycoord.x * texelFetch1D( tex, faceIndices.x ) +
4299		barycoord.y * texelFetch1D( tex, faceIndices.y ) +
4300		barycoord.z * texelFetch1D( tex, faceIndices.z );
4301
4302}
4303
4304void ndcToCameraRay(
4305	vec2 coord, mat4 cameraWorld, mat4 invProjectionMatrix,
4306	out vec3 rayOrigin, out vec3 rayDirection
4307) {
4308
4309	// get camera look direction and near plane for camera clipping
4310	vec4 lookDirection = cameraWorld * vec4( 0.0, 0.0, - 1.0, 0.0 );
4311	vec4 nearVector = invProjectionMatrix * vec4( 0.0, 0.0, - 1.0, 1.0 );
4312	float near = abs( nearVector.z / nearVector.w );
4313
4314	// get the camera direction and position from camera matrices
4315	vec4 origin = cameraWorld * vec4( 0.0, 0.0, 0.0, 1.0 );
4316	vec4 direction = invProjectionMatrix * vec4( coord, 0.5, 1.0 );
4317	direction /= direction.w;
4318	direction = cameraWorld * direction - origin;
4319
4320	// slide the origin along the ray until it sits at the near clip plane position
4321	origin.xyz += direction.xyz * near / dot( direction, lookDirection );
4322
4323	rayOrigin = origin.xyz;
4324	rayDirection = direction.xyz;
4325
4326}
4327`,nO=`
4328
4329#ifndef TRI_INTERSECT_EPSILON
4330#define TRI_INTERSECT_EPSILON 1e-5
4331#endif
4332
4333// Raycasting
4334bool intersectsBounds( vec3 rayOrigin, vec3 rayDirection, vec3 boundsMin, vec3 boundsMax, out float dist ) {
4335
4336	// https://www.reddit.com/r/opengl/comments/8ntzz5/fast_glsl_ray_box_intersection/
4337	// https://tavianator.com/2011/ray_box.html
4338	vec3 invDir = 1.0 / rayDirection;
4339
4340	// find intersection distances for each plane
4341	vec3 tMinPlane = invDir * ( boundsMin - rayOrigin );
4342	vec3 tMaxPlane = invDir * ( boundsMax - rayOrigin );
4343
4344	// get the min and max distances from each intersection
4345	vec3 tMinHit = min( tMaxPlane, tMinPlane );
4346	vec3 tMaxHit = max( tMaxPlane, tMinPlane );
4347
4348	// get the furthest hit distance
4349	vec2 t = max( tMinHit.xx, tMinHit.yz );
4350	float t0 = max( t.x, t.y );
4351
4352	// get the minimum hit distance
4353	t = min( tMaxHit.xx, tMaxHit.yz );
4354	float t1 = min( t.x, t.y );
4355
4356	// set distance to 0.0 if the ray starts inside the box
4357	dist = max( t0, 0.0 );
4358
4359	return t1 >= dist;
4360
4361}
4362
4363bool intersectsTriangle(
4364	vec3 rayOrigin, vec3 rayDirection, vec3 a, vec3 b, vec3 c,
4365	out vec3 barycoord, out vec3 norm, out float dist, out float side
4366) {
4367
4368	// https://stackoverflow.com/questions/42740765/intersection-between-line-and-triangle-in-3d
4369	vec3 edge1 = b - a;
4370	vec3 edge2 = c - a;
4371	norm = cross( edge1, edge2 );
4372
4373	float det = - dot( rayDirection, norm );
4374	float invdet = 1.0 / det;
4375
4376	vec3 AO = rayOrigin - a;
4377	vec3 DAO = cross( AO, rayDirection );
4378
4379	vec4 uvt;
4380	uvt.x = dot( edge2, DAO ) * invdet;
4381	uvt.y = - dot( edge1, DAO ) * invdet;
4382	uvt.z = dot( AO, norm ) * invdet;
4383	uvt.w = 1.0 - uvt.x - uvt.y;
4384
4385	// set the hit information
4386	barycoord = uvt.wxy; // arranged in A, B, C order
4387	dist = uvt.z;
4388	side = sign( det );
4389	norm = side * normalize( norm );
4390
4391	// add an epsilon to avoid misses between triangles
4392	uvt += vec4( TRI_INTERSECT_EPSILON );
4393
4394	return all( greaterThanEqual( uvt, vec4( 0.0 ) ) );
4395
4396}
4397
4398bool intersectTriangles(
4399	// geometry info and triangle range
4400	sampler2D positionAttr, usampler2D indexAttr, uint offset, uint count,
4401
4402	// ray
4403	vec3 rayOrigin, vec3 rayDirection,
4404
4405	// outputs
4406	inout float minDistance, inout uvec4 faceIndices, inout vec3 faceNormal, inout vec3 barycoord,
4407	inout float side, inout float dist
4408) {
4409
4410	bool found = false;
4411	vec3 localBarycoord, localNormal;
4412	float localDist, localSide;
4413	for ( uint i = offset, l = offset + count; i < l; i ++ ) {
4414
4415		uvec3 indices = uTexelFetch1D( indexAttr, i ).xyz;
4416		vec3 a = texelFetch1D( positionAttr, indices.x ).rgb;
4417		vec3 b = texelFetch1D( positionAttr, indices.y ).rgb;
4418		vec3 c = texelFetch1D( positionAttr, indices.z ).rgb;
4419
4420		if (
4421			intersectsTriangle( rayOrigin, rayDirection, a, b, c, localBarycoord, localNormal, localDist, localSide )
4422			&& localDist < minDistance
4423		) {
4424
4425			found = true;
4426			minDistance = localDist;
4427
4428			faceIndices = uvec4( indices.xyz, i );
4429			faceNormal = localNormal;
4430
4431			side = localSide;
4432			barycoord = localBarycoord;
4433			dist = localDist;
4434
4435		}
4436
4437	}
4438
4439	return found;
4440
4441}
4442
4443bool intersectsBVHNodeBounds( vec3 rayOrigin, vec3 rayDirection, sampler2D bvhBounds, uint currNodeIndex, out float dist ) {
4444
4445	uint cni2 = currNodeIndex * 2u;
4446	vec3 boundsMin = texelFetch1D( bvhBounds, cni2 ).xyz;
4447	vec3 boundsMax = texelFetch1D( bvhBounds, cni2 + 1u ).xyz;
4448	return intersectsBounds( rayOrigin, rayDirection, boundsMin, boundsMax, dist );
4449
4450}
4451
4452// use a macro to hide the fact that we need to expand the struct into separate fields
4453#define	bvhIntersectFirstHit(		bvh,		rayOrigin, rayDirection, faceIndices, faceNormal, barycoord, side, dist	)	_bvhIntersectFirstHit(		bvh.position, bvh.index, bvh.bvhBounds, bvh.bvhContents,		rayOrigin, rayDirection, faceIndices, faceNormal, barycoord, side, dist	)
4454
4455bool _bvhIntersectFirstHit(
4456	// bvh info
4457	sampler2D bvh_position, usampler2D bvh_index, sampler2D bvh_bvhBounds, usampler2D bvh_bvhContents,
4458
4459	// ray
4460	vec3 rayOrigin, vec3 rayDirection,
4461
4462	// output variables split into separate variables due to output precision
4463	inout uvec4 faceIndices, inout vec3 faceNormal, inout vec3 barycoord,
4464	inout float side, inout float dist
4465) {
4466
4467	// stack needs to be twice as long as the deepest tree we expect because
4468	// we push both the left and right child onto the stack every traversal
4469	int pointer = 0;
4470	uint stack[ BVH_STACK_DEPTH ];
4471	stack[ 0 ] = 0u;
4472
4473	float triangleDistance = INFINITY;
4474	bool found = false;
4475	while ( pointer > - 1 && pointer < BVH_STACK_DEPTH ) {
4476
4477		uint currNodeIndex = stack[ pointer ];
4478		pointer --;
4479
4480		// check if we intersect the current bounds
4481		float boundsHitDistance;
4482		if (
4483			! intersectsBVHNodeBounds( rayOrigin, rayDirection, bvh_bvhBounds, currNodeIndex, boundsHitDistance )
4484			|| boundsHitDistance > triangleDistance
4485		) {
4486
4487			continue;
4488
4489		}
4490
4491		uvec2 boundsInfo = uTexelFetch1D( bvh_bvhContents, currNodeIndex ).xy;
4492		bool isLeaf = bool( boundsInfo.x & 0xffff0000u );
4493
4494		if ( isLeaf ) {
4495
4496			uint count = boundsInfo.x & 0x0000ffffu;
4497			uint offset = boundsInfo.y;
4498
4499			found = intersectTriangles(
4500				bvh_position, bvh_index, offset, count,
4501				rayOrigin, rayDirection, triangleDistance,
4502				faceIndices, faceNormal, barycoord, side, dist
4503			) || found;
4504
4505		} else {
4506
4507			uint leftIndex = currNodeIndex + 1u;
4508			uint splitAxis = boundsInfo.x & 0x0000ffffu;
4509			uint rightIndex = currNodeIndex + boundsInfo.y;
4510
4511			bool leftToRight = rayDirection[ splitAxis ] >= 0.0;
4512			uint c1 = leftToRight ? leftIndex : rightIndex;
4513			uint c2 = leftToRight ? rightIndex : leftIndex;
4514
4515			// set c2 in the stack so we traverse it later. We need to keep track of a pointer in
4516			// the stack while we traverse. The second pointer added is the one that will be
4517			// traversed first
4518			pointer ++;
4519			stack[ pointer ] = c2;
4520
4521			pointer ++;
4522			stack[ pointer ] = c1;
4523
4524		}
4525
4526	}
4527
4528	return found;
4529
4530}
4531`,iO=`
4532struct BVH {
4533
4534	usampler2D index;
4535	sampler2D position;
4536
4537	sampler2D bvhBounds;
4538	usampler2D bvhContents;
4539
4540};
4541`,rO=iO,sO=`
4542	${tO}
4543	${nO}
4544`;`${rO}${sO}${Ft.tonemapping_fragment}${Ft.colorspace_fragment}`;function oO(){var r=Object.create(null);function e(i,s){var o=i.id,a=i.name,l=i.dependencies;l===void 0&&(l=[]);var c=i.init;c===void 0&&(c=function(){});var u=i.getTransferables;if(u===void 0&&(u=null),!r[o])try{l=l.map(function(h){return h&&h.isWorkerModule&&(e(h,function(f){if(f instanceof Error)throw f}),h=r[h.id].value),h}
4544),c=n("<"+a+">.init",c),u&&(u=n("<"+a+">.getTransferables",u));var d=null;typeof c=="function"?d=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),r[o]={id:o,value:d,getTransferables:u},s(d)}catch(h){h&&h.noLog||console.error(h),s(h)}}function t(i,s){var o,a=i.id,l=i.args;(!r[a]||typeof r[a].value!="function")&&s(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var c=(o=r[a]).value.apply(o,l);c&&typeof c.then=="function"?c.then(u,function(d){return s(d instanceof Error?d:new Error(""+d))}):u(c)}catch(d){s(d)}function u(d){try{var h=r[a].getTransferables&&r[a].getTransferables(d);(!h||!Array.isArray(h)||!h.length)&&(h=void 0),s(d,h)}catch(f){console.error(f),s(f)}}}function n(i,s){var o=void 0;self.troikaDefine=function(l){return o=l};var a=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/
4545
4546troikaDefine(
4547`+s+`
4548)`],{type:"application/javascript"}));try{importScripts(a)}catch(l){console.error(l)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(i){var s=i.data,o=s.messageId,a=s.action,l=s.data;try{a==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof c=="function"}})}),a==="callModule"&&t(l,function(c,u){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:c},u||void 0)})}catch(c){postMessage({messageId:o,success:!1,error:c.stack})}})}function aO(r){var e=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=r.dependencies,n=r.init;t=Array.isArray(t)?t.map(function(s){return s&&(s=s.onMainThread||s,s._getInitResult&&(s=s._getInitResult())),s}):[];var i=Promise.all(t).then(function(s){return n.apply(null,s)});return e._getInitResult=function(){return i},i},e}var zM=function(){var r=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),r=!0}catch(t){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return zM=function(){return r},r},lO=0,cO=0,lv=!1,cu=Object.create(null),uu=Object.create(null),Xv=Object.create(null);function yc(r){if((!r||typeof r.init!="function")&&!lv)throw new Error("requires `options.init` function");var e=r.dependencies,t=r.init,n=r.getTransferables,i=r.workerId,s=aO(r);i==null&&(i="#default");var o="workerModule"+ ++lO,a=r.name||o,l=null;e=e&&e.map(function(u){return typeof u=="function"&&!u.workerModuleData&&(lv=!0,u=yc({workerId:i,name:"<"+a+"> function dependency: "+u.name,init:`function(){return (
4549`+Rf(u)+`
4550)}`}),lv=!1),u&&u.workerModuleData&&(u=u.workerModuleData),u});function c(){for(var u=[],d=arguments.length;d--;)u[d]=arguments[d];if(!zM())return s.apply(void 0,u);if(!l){l=dw(i,"registerModule",c.workerModuleData);var h=function(){l=null,uu[i].delete(h)};(uu[i]||(uu[i]=new Set)).add(h)}return l.then(function(f){var p=f.isCallable;if(p)return dw(i,"callModule",{id:o,args:u});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c.workerModuleData={isWorkerModule:!0,id:o,name:a,dependencies:e,init:Rf(t),getTransferables:n&&Rf(n)},c.onMainThread=s,c}function uO(r){uu[r]&&uu[r].forEach(function(e){e()}),cu[r]&&(cu[r].terminate(),delete cu[r])}function Rf(r){var e=r.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function dO(r){var e=cu[r];if(!e){var t=Rf(oO);e=cu[r]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+r.replace(/\*/g,"")+` **/
4551
4552;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(n){var i=n.data,s=i.messageId,o=Xv[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete Xv[s],o(i)}}return e}function dw(r,e,t){return new Promise(function(n,i){var s=++cO;Xv[s]=function(o){o.success?n(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},dO(r).postMessage({messageId:s,action:e,data:t})})}
4552function VM(){var r=(function(e){function t(Q,Y,z,K,te,O,U,W){var j=1-U;W.x=j*j*Q+2*j*U*z+U*U*te,W.y=j*j*Y+2*j*U*K+U*U*O}function n(Q,Y,z,K,te,O,U,W,j,ie){var de=1-j;ie.x=de*de*de*Q+3*de*de*j*z+3*de*j*j*te+j*j*j*U,ie.y=de*de*de*Y+3*de*de*j*K+3*de*j*j*O+j*j*j*W}function i(Q,Y){for(var z=/([MLQCZ])([^MLQCZ]*)/g,K,te,O,U,W;K=z.exec(Q);){var j=K[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(ie){return parseFloat(ie)});switch(K[1]){case"M":U=te=j[0],W=O=j[1];break;case"L":(j[0]!==U||j[1]!==W)&&Y("L",U,W,U=j[0],W=j[1]);break;case"Q":{Y("Q",U,W,U=j[2],W=j[3],j[0],j[1]);break}case"C":{Y("C",U,W,U=j[4],W=j[5],j[0],j[1],j[2],j[3]);break}case"Z":(U!==te||W!==O)&&Y("L",U,W,te,O);break}}}function s(Q,Y,z){z===void 0&&(z=16);var K={x:0,y:0};i(Q,function(te,O,U,W,j,ie,de,ye,we){switch(te){case"L":Y(O,U,W,j);break;case"Q":{for(var _e=O,Re=U,F=1;F<z;F++)t(O,U,ie,de,W,j,F/(z-1),K),Y(_e,Re,K.x,K.y),_e=K.x,Re=K.y;break}case"C":{for(var pe=O,me=U,be=1;be<z;be++)n(O,U,ie,de,ye,we,W,j,be/(z-1),K),Y(pe,me,K.x,K.y),pe=K.x,me=K.y;break}}})}var o="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",a="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",l=new WeakMap,c={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function u(Q,Y){var z=Q.getContext?Q.getContext("webgl",c):Q,K=l.get(z);if(!K){let de=function(pe){var me=O[pe];if(!me&&(me=O[pe]=z.getExtension(pe),!me))throw new Error(pe+" not supported");return me},ye=function(pe,me){var be=z.createShader(me);return z.shaderSource(be,pe),z.compileShader(be),be},we=function(pe,me,be,se){if(!U[pe]){var Se={},he={},le=z.createProgram();z.attachShader(le,ye(me,z.VERTEX_SHADER)),z.attachShader(le,ye(be,z.FRAGMENT_SHADER)),z.linkProgram(le),U[pe]={program:le,transaction:function(B){z.useProgram(le),B({setUniform:function(ne,ge){for(var ue=[],ce=arguments.length-2;ce-- >0;)ue[ce]=arguments[ce+2];var Ne=he[ge]||(he[ge]=z.getUniformLocation(le,ge));z["uniform"+ne].apply(z,[Ne].concat(ue))},setAttribute:function(ne,ge,ue,ce,Ne){var De=Se[ne];De||(De=Se[ne]={buf:z.createBuffer(),loc:z.getAttribLocation(le,ne),data:null}),z.bindBuffer(z.ARRAY_BUFFER,De.buf),z.vertexAttribPointer(De.loc,ge,z.FLOAT,!1,0,0),z.enableVertexAttribArray(De.loc),te?z.vertexAttribDivisor(De.loc,ce):de("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(De.loc,ce),Ne!==De.data&&(z.bufferData(z.ARRAY_BUFFER,Ne,ue),De.data=Ne)}})}}}U[pe].transaction(se)},_e=function(pe,me){j++;try{z.activeTexture(z.TEXTURE0+j);var be=W[pe];be||(be=W[pe]=z.createTexture(),z.bindTexture(z.TEXTURE_2D,be),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MIN_FILTER,z.NEAREST),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MAG_FILTER,z.NEAREST)),z.bindTexture(z.TEXTURE_2D,be),me(be,j)}finally{j--}},Re=function(pe,me,be){var se=z.createFramebuffer();ie.push(se),z.bindFramebuffer(z.FRAMEBUFFER,se),z.activeTexture(z.TEXTURE0+me),z.bindTexture(z.TEXTURE_2D,pe),z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,pe,0);try{be(se)}finally{z.deleteFramebuffer(se),z.bindFramebuffer(z.FRAMEBUFFER,ie[--ie.length-1]||null)}},F=function(){O={},U={},W={},j=-1,ie.length=0};var te=typeof WebGL2RenderingContext<"u"&&z instanceof WebGL2RenderingContext,O={},U={},W={},j=-1,ie=[];z.canvas.addEventListener("webglcontextlost",function(pe){F(),pe.preventDefault()},!1),l.set(z,K={gl:z,isWebGL2:te,getExtension:de,withProgram:we,withTexture:_e,withTextureFramebuffer:Re,handleContextLoss:F})}Y(K)}function d(Q,Y,z,K,te,O,U,W){U===void 0&&(U=15),W===void 0&&(W=null),u(Q,function(j){var ie=j.gl,de=j.withProgram,ye=j.withTexture;ye("copy",function(we,_e){ie.texImage2D(ie.TEXTURE_2D,0,ie.RGBA,te,O,0,ie.RGBA,ie.UNSIGNED_BYTE,Y),de("copy",o,a,function(Re){var F=Re.setUniform,pe=Re.setAttribute;pe("aUV",2,ie.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),F("1i","image",_e),ie.bindFramebuffer(ie.FRAMEBUFFER,W||null),ie.disable(ie.BLEND),ie.colorMask(U&8,U&4,U&2,U&1),ie.viewport(z,K,te,O),ie.scissor(z,K,te,O),ie.drawArrays(ie.TRIANGLES,0,3)})})})}function h(Q,Y,z){var K=Q.width,te=Q.height;
4552u(Q,function(O){var U=O.gl,W=new Uint8Array(K*te*4);U.readPixels(0,0,K,te,U.RGBA,U.UNSIGNED_BYTE,W),Q.width=Y,Q.height=z,d(U,W,0,0,K,te)})}var f=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:d,resizeWebGLCanvasWithoutClearing:h});function p(Q,Y,z,K,te,O){O===void 0&&(O=1);var U=new Uint8Array(Q*Y),W=K[2]-K[0],j=K[3]-K[1],ie=[];s(z,function(pe,me,be,se){ie.push({x1:pe,y1:me,x2:be,y2:se,minX:Math.min(pe,be),minY:Math.min(me,se),maxX:Math.max(pe,be),maxY:Math.max(me,se)})}),ie.sort(function(pe,me){return pe.maxX-me.maxX});for(var de=0;de<Q;de++)for(var ye=0;ye<Y;ye++){var we=Re(K[0]+W*(de+.5)/Q,K[1]+j*(ye+.5)/Y),_e=Math.pow(1-Math.abs(we)/te,O)/2;we<0&&(_e=1-_e),_e=Math.max(0,Math.min(255,Math.round(_e*255))),U[ye*Q+de]=_e}return U;function Re(pe,me){for(var be=1/0,se=1/0,Se=ie.length;Se--;){var he=ie[Se];if(he.maxX+se<=pe)break;if(pe+se>he.minX&&me-se<he.maxY&&me+se>he.minY){var le=v(pe,me,he.x1,he.y1,he.x2,he.y2);le<be&&(be=le,se=Math.sqrt(be))}}return F(pe,me)&&(se=-se),se}function F(pe,me){for(var be=0,se=ie.length;se--;){var Se=ie[se];if(Se.maxX<=pe)break;var he=Se.y1>me!=Se.y2>me&&pe<(Se.x2-Se.x1)*(me-Se.y1)/(Se.y2-Se.y1)+Se.x1;he&&(be+=Se.y1<Se.y2?1:-1)}return be!==0}}function m(Q,Y,z,K,te,O,U,W,j,ie){O===void 0&&(O=1),W===void 0&&(W=0),j===void 0&&(j=0),ie===void 0&&(ie=0),g(Q,Y,z,K,te,O,U,null,W,j,ie)}function g(Q,Y,z,K,te,O,U,W,j,ie,de){O===void 0&&(O=1),j===void 0&&(j=0),ie===void 0&&(ie=0),de===void 0&&(de=0);for(var ye=p(Q,Y,z,K,te,O),we=new Uint8Array(ye.length*4),_e=0;_e<ye.length;_e++)we[_e*4+de]=ye[_e];d(U,we,j,ie,Q,Y,1<<3-de,W)}function v(Q,Y,z,K,te,O){var U=te-z,W=O-K,j=U*U+W*W,ie=j?Math.max(0,Math.min(1,((Q-z)*U+(Y-K)*W)/j)):0,de=Q-(z+ie*U),ye=Y-(K+ie*W);return de*de+ye*ye}var y=Object.freeze({__proto__:null,generate:p,generateIntoCanvas:m,generateIntoFramebuffer:g}),_="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",x="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",T="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",b=new Float32Array([0,0,2,0,0,2]),M=null,E=!1,S={},w=new WeakMap;function D(Q){if(!E&&!H(Q))throw new Error("WebGL generation not supported")}function R(Q,Y,z,K,te,O,U){if(O===void 0&&(O=1),U===void 0&&(U=null),!U&&(U=M,!U)){var W=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!W)throw new Error("OffscreenCanvas or DOM canvas not supported");U=M=W.getContext("webgl",{depth:!1})}D(U);var j=new Uint8Array(Q*Y*4);u(U,function(we){var _e=we.gl,Re=we.withTexture,F=we.withTextureFramebuffer;Re("readable",function(pe,me){_e.texImage2D(_e.TEXTURE_2D,0,_e.RGBA,Q,Y,0,_e.RGBA,_e.UNSIGNED_BYTE,null),F(pe,me,function(be){N(Q,Y,z,K,te,O,_e,be,0,0,0),_e.readPixels(0,0,Q,Y,_e.RGBA,_e.UNSIGNED_BYTE,j)})})});for(var ie=new Uint8Array(Q*Y),de=0,ye=0;de<j.length;de+=4)ie[ye++]=j[de];return ie}function k(Q,Y,z,K,te,O,U,W,j,ie){O===void 0&&(O=1),W===void 0&&(W=0),j===void 0&&(j=0),ie===void 0&&(ie=0),N(Q,Y,z,K,te,O,U,null,W,j,ie)}function N(Q,Y,z,K,te,O,U,W,j,ie,de){O===void 0&&(O=1),j===void 0&&(j=0),ie===void 0&&(ie=0),de===void 0&&(de=0),D(U);var ye=[];s(z,function(we,_e,Re,F){ye.push(we,_e,Re,F)}),ye=new Float32Array(ye),u(U,function(we){var _e=we.gl,Re=we.isWebGL2,F=we.getExtension,pe=we.withProgram,me=we.withTexture,be=we.withTextureFramebuffer,se=we.handleContextLoss;if(me("rawDistances",function(Se,he){(Q!==Se._lastWidth||Y!==Se._lastHeight)&&_e.texImage2D(_e.TEXTURE_2D,0,_e.RGBA,Se._lastWidth=Q,Se._lastHeight=Y,0,_e.RGBA,_e.UNSIGNED_BYTE,null),pe("main",_,x,function(le){var He=le.setAttribute,B=le.setUniform,A=!Re&&F("ANGLE_instanced_arrays"),ne=!Re&&F("EXT_blend_minmax");He("aUV",2,_e.STATIC_DRAW,0,b),He("aLineSegment",4,_e.DYNAMIC_DRAW,1,ye),B.apply(void 0,["4f","uGlyphBounds"].concat(K)),B("1f","uMaxDistance",te),B("1f","uExponent",O),be(Se,he,function(ge){_e.enable(_e.BLEND),_e.colorMask(!0,!0,
4552!0,!0),_e.viewport(0,0,Q,Y),_e.scissor(0,0,Q,Y),_e.blendFunc(_e.ONE,_e.ONE),_e.blendEquationSeparate(_e.FUNC_ADD,Re?_e.MAX:ne.MAX_EXT),_e.clear(_e.COLOR_BUFFER_BIT),Re?_e.drawArraysInstanced(_e.TRIANGLES,0,3,ye.length/4):A.drawArraysInstancedANGLE(_e.TRIANGLES,0,3,ye.length/4)})}),pe("post",o,T,function(le){le.setAttribute("aUV",2,_e.STATIC_DRAW,0,b),le.setUniform("1i","tex",he),_e.bindFramebuffer(_e.FRAMEBUFFER,W),_e.disable(_e.BLEND),_e.colorMask(de===0,de===1,de===2,de===3),_e.viewport(j,ie,Q,Y),_e.scissor(j,ie,Q,Y),_e.drawArrays(_e.TRIANGLES,0,3)})}),_e.isContextLost())throw se(),new Error("webgl context lost")})}function H(Q){var Y=!Q||Q===M?S:Q.canvas||Q,z=w.get(Y);if(z===void 0){E=!0;var K=null;try{var te=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],O=R(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,Q);z=O&&te.length===O.length&&O.every(function(U,W){return U===te[W]}),z||(K="bad trial run results",console.info(te,O))}catch(U){z=!1,K=U.message}K&&console.warn("WebGL SDF generation not supported:",K),E=!1,w.set(Y,z)}return z}var P=Object.freeze({__proto__:null,generate:R,generateIntoCanvas:k,generateIntoFramebuffer:N,isSupported:H});function ee(Q,Y,z,K,te,O){te===void 0&&(te=Math.max(K[2]-K[0],K[3]-K[1])/2),O===void 0&&(O=1);try{return R.apply(P,arguments)}catch(U){return console.info("WebGL SDF generation failed, falling back to JS",U),p.apply(y,arguments)}}function X(Q,Y,z,K,te,O,U,W,j,ie){te===void 0&&(te=Math.max(K[2]-K[0],K[3]-K[1])/2),O===void 0&&(O=1),W===void 0&&(W=0),j===void 0&&(j=0),ie===void 0&&(ie=0);try{return k.apply(P,arguments)}catch(de){return console.info("WebGL SDF generation failed, falling back to JS",de),m.apply(y,arguments)}}return e.forEachPathCommand=i,e.generate=ee,e.generateIntoCanvas=X,e.javascript=y,e.pathToLineSegments=s,e.webgl=P,e.webglUtils=f,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return r}function hO(){var r=(function(e){var t={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},n={},i={};n.L=1,i[1]="L",Object.keys(t).forEach(function(se,Se){n[se]=1<<Se+1,i[n[se]]=se}),Object.freeze(n);var s=n.LRI|n.RLI|n.FSI,o=n.L|n.R|n.AL,a=n.B|n.S|n.WS|n.ON|n.FSI|n.LRI|n.RLI|n.PDI,l=n.BN|n.RLE|n.LRE|n.RLO|n.LRO|n.PDF,c=n.S|n.WS|n.B|s|n.PDI|l,u=null;function d(){if(!u){u=new Map;var se=0;for(var Se in t)if(t.hasOwnProperty(Se))for(var he=t[Se],le="",He=void 0,B=!1,A=0,ne=0;ne<=he.length+1;ne+=1){var ge=he[ne];if(ge!==","&&ne!==he.length)ge==="+"?(B=!0,A=se=A+parseInt(le,36),le=""):le+=ge;else{B?He=se+parseInt(le,36):(A=se=A+parseInt(le,36),He=se),B=!1,le="",A=He;for(var ue=se;ue<He+1;ue+=1)u.set(ue,n[Se])}}}}function h(se){return d(),u.get(se.codePointAt(0))||n.L}function f(se){return i[h(se)]}var p={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function m(se,Se){var he=36,le=0,He=new Map,B=Se&&new Map,A;return se.split(",").forEach(function ne(ge){if(ge.indexOf("+")!==-1)for(var ue=+ge;ue--;)ne(A);else{A=ge;var ce=ge.split(">"),Ne=ce[0],De=ce[1];Ne=String.fromCodePoint(le+=parseInt(Ne,he)),De=String.fromCodePoint(le+=parseInt(De,he)),He.set(Ne,De),Se&&B.set(De,Ne)}}),{map:He,reverseMap:B}}var g,v,y;function _(){if(!g){var se=m(p.pairs,!0),Se=se.map,he=se.reverseMap;g=Se,v=he,y=m(p.canonical,!1).map}}function x(se){return _(),g.get(se)||null}function T(se){return _(),v.get(se)||null}function b(se){return _(),y.get(se)||null}var M=n.L,E=n.R,S=n.EN,w=n.ES,D=n.ET,R=n.AN,k=n.CS,N=n.B,H=n.S,P=n.ON,ee=n.BN,X=n.NSM,Q=n.AL,Y=n.LRO,z=n.RLO,K=n.LRE,te=n.RLE,O=n.PDF,U=n.LRI,W=n.RLI,j=n.FSI,ie=n.PDI;function de(se,Se){for(var he=125,le=new Uint32Array(se.length),He=0;He<se.length;He++)le[He]=h(se[He]);var B=new Map;function A(Yi,Or){var $i=le[Yi];le[Yi]=Or,B.set($i,B.get($i)-1),$i&a&&B.set(a,B.get(a)-1),B.set(Or,(B.get(Or)||0)+1),Or&a&&B.set(a,(B.get(a)||0)+1)}for(var ne=new Uint8Array(se.length),ge=new Map,ue=[],ce=null,Ne=0;Ne<se.length;Ne++)ce||ue.push(ce={start:Ne,end:se.length-1,level:Se==="rtl"?1:Se==="ltr"?0:R_(Ne,!1)}),le[Ne]&N&&(ce.end=Ne,ce=null);for(var De=te|K|z|Y|s|ie|O|N,$e=function(Yi){return Yi+(Yi&1?1:2)},Je=function(Yi){return Yi+(Yi&1?2:1)},Ee=0;Ee<ue.length;Ee++){ce=ue[Ee];var Ge=[{_level:ce.level,_override:0,_isolate:0}],Ye=void 0,it=0,Ze=0,ht=0;
vendor: 5,203 bytes, line 4552
4552B.clear();for(var oe=ce.start;oe<=ce.end;oe++){var Oe=le[oe];if(Ye=Ge[Ge.length-1],B.set(Oe,(B.get(Oe)||0)+1),Oe&a&&B.set(a,(B.get(a)||0)+1),Oe&De)if(Oe&(te|K)){ne[oe]=Ye._level;var ke=(Oe===te?Je:$e)(Ye._level);ke<=he&&!it&&!Ze?Ge.push({_level:ke,_override:0,_isolate:0}):it||Ze++}else if(Oe&(z|Y)){ne[oe]=Ye._level;var Xe=(Oe===z?Je:$e)(Ye._level);Xe<=he&&!it&&!Ze?Ge.push({_level:Xe,_override:Oe&z?E:M,_isolate:0}):it||Ze++}else if(Oe&s){Oe&j&&(Oe=R_(oe+1,!0)===1?W:U),ne[oe]=Ye._level,Ye._override&&A(oe,Ye._override);var Me=(Oe===W?Je:$e)(Ye._level);Me<=he&&it===0&&Ze===0?(ht++,Ge.push({_level:Me,_override:0,_isolate:1,_isolInitIndex:oe})):it++}else if(Oe&ie){if(it>0)it--;else if(ht>0){for(Ze=0;!Ge[Ge.length-1]._isolate;)Ge.pop();var Ce=Ge[Ge.length-1]._isolInitIndex;Ce!=null&&(ge.set(Ce,oe),ge.set(oe,Ce)),Ge.pop(),ht--}Ye=Ge[Ge.length-1],ne[oe]=Ye._level,Ye._override&&A(oe,Ye._override)}else Oe&O?(it===0&&(Ze>0?Ze--:!Ye._isolate&&Ge.length>1&&(Ge.pop(),Ye=Ge[Ge.length-1])),ne[oe]=Ye._level):Oe&N&&(ne[oe]=ce.level);else ne[oe]=Ye._level,Ye._override&&Oe!==ee&&A(oe,Ye._override)}for(var nt=[],ct=null,dt=ce.start;dt<=ce.end;dt++){var ft=le[dt];if(!(ft&l)){var qt=ne[dt],sn=ft&s,vn=ft===ie;ct&&qt===ct._level?(ct._end=dt,ct._endsWithIsolInit=sn):nt.push(ct={_start:dt,_end:dt,_level:qt,_startsWithPDI:vn,_endsWithIsolInit:sn})}}for(var Cn=[],On=0;On<nt.length;On++){var fi=nt[On];if(!fi._startsWithPDI||fi._startsWithPDI&&!ge.has(fi._start)){for(var zi=[ct=fi],Vi=void 0;ct&&ct._endsWithIsolInit&&(Vi=ge.get(ct._end))!=null;)for(var pi=On+1;pi<nt.length;pi++)if(nt[pi]._start===Vi){zi.push(ct=nt[pi]);break}for(var Fn=[],Di=0;Di<zi.length;Di++)for(var Do=zi[Di],eo=Do._start;eo<=Do._end;eo++)Fn.push(eo);for(var bc=ne[Fn[0]],el=ce.level,to=Fn[0]-1;to>=0;to--)if(!(le[to]&l)){el=ne[to];break}var Lo=Fn[Fn.length-1],wc=ne[Lo],tl=ce.level;if(!(le[Lo]&s)){for(var q=Lo+1;q<=ce.end;q++)if(!(le[q]&l)){tl=ne[q];break}}Cn.push({_seqIndices:Fn,_sosType:Math.max(el,bc)%2?E:M,_eosType:Math.max(tl,wc)%2?E:M})}}for(var ve=0;ve<Cn.length;ve++){var Te=Cn[ve],fe=Te._seqIndices,xe=Te._sosType,et=Te._eosType,at=ne[fe[0]]&1?E:M;if(B.get(X))for(var _t=0;_t<fe.length;_t++){var pt=fe[_t];if(le[pt]&X){for(var Ot=xe,Ut=_t-1;Ut>=0;Ut--)if(!(le[fe[Ut]]&l)){Ot=le[fe[Ut]];break}A(pt,Ot&(s|ie)?P:Ot)}}if(B.get(S))for(var Ct=0;Ct<fe.length;Ct++){var Xt=fe[Ct];if(le[Xt]&S)for(var ln=Ct-1;ln>=-1;ln--){var wn=ln===-1?xe:le[fe[ln]];if(wn&o){wn===Q&&A(Xt,R);break}}}if(B.get(Q))for(var Tn=0;Tn<fe.length;Tn++){var on=fe[Tn];le[on]&Q&&A(on,E)}if(B.get(w)||B.get(k))for(var It=1;It<fe.length-1;It++){var Bn=fe[It];if(le[Bn]&(w|k)){for(var tn=0,mi=0,xn=It-1;xn>=0&&(tn=le[fe[xn]],!!(tn&l));xn--);for(var Jn=It+1;Jn<fe.length&&(mi=le[fe[Jn]],!!(mi&l));Jn++);tn===mi&&(le[Bn]===w?tn===S:tn&(S|R))&&A(Bn,tn)}}if(B.get(S))for(var gi=0;gi<fe.length;gi++){var Sn=fe[gi];if(le[Sn]&S){for(var ni=gi-1;ni>=0&&le[fe[ni]]&(D|l);ni--)A(fe[ni],S);for(gi++;gi<fe.length&&le[fe[gi]]&(D|l|S);gi++)le[fe[gi]]!==S&&A(fe[gi],S)}}if(B.get(D)||B.get(w)||B.get(k))for(var Xn=0;Xn<fe.length;Xn++){var zn=fe[Xn];if(le[zn]&(D|w|k)){A(zn,P);for(var kn=Xn-1;kn>=0&&le[fe[kn]]&l;kn--)A(fe[kn],P);for(var Ur=Xn+1;Ur<fe.length&&le[fe[Ur]]&l;Ur++)A(fe[Ur],P)}}if(B.get(S))for(var dr=0,Vt=xe;dr<fe.length;dr++){var ko=fe[dr],L=le[ko];L&S?Vt===M&&A(ko,M):L&o&&(Vt=L)}if(B.get(a)){var I=E|S|R,$=I|M,G=[];{for(var Z=[],Pe=0;Pe<fe.length;Pe++)if(le[fe[Pe]]&a){var ze=se[fe[Pe]],mt=void 0;if(x(ze)!==null)if(Z.length<63)Z.push({char:ze,seqIndex:Pe});else break;else if((mt=T(ze))!==null)for(var rt=Z.length-1;rt>=0;rt--){var ut=Z[rt].char;if(ut===mt||ut===T(b(ze))||x(b(ut))===ze){G.push([Z[rt].seqIndex,Pe]),Z.length=rt;break}}}G.sort(function(Yi,Or){return Yi[0]-Or[0]})}for(var Rt=0;Rt<G.length;Rt++){for(var Ke=G[Rt],Et=Ke[0],xt=Ke[1],Lt=!1,bt=0,Rn=Et+1;Rn<xt;Rn++){var yn=fe[Rn];if(le[yn]&$){Lt=!0;var hn=le[yn]&I?E:M;if(hn===at){bt=hn;break}}}if(Lt&&!bt){bt=xe;for(var cn=Et-1;cn>=0;cn--){var wr=fe[cn];if(le[wr]&$){var Ti=le[wr]&I?E:M;Ti!==at?bt=Ti:bt=at;break}}}if(bt){if(le[fe[Et]]=le[fe[xt]]=bt,bt!==at){for(var Sr=Et+1;Sr<fe.length;Sr++)if(!(le[fe[Sr]]&l)){h(se[fe[Sr]])&X&&(le[fe[Sr]]=bt);break}}if(bt!==at){for(var Uo=xt+1;Uo<fe.length;Uo++)if(!(le[fe[Uo]]&l)){h(se[fe[Uo]])&X&&(le[fe[Uo]]=bt);break}}}}for(var Nr=0;Nr<fe.length;Nr++)if(le[fe[Nr]]&a){for(var A_=Nr,Jm=Nr,Km=xe,Sc=Nr-1;Sc>=0;Sc--)if(le[fe[Sc]]&l)A_=Sc;else{Km=le[fe[Sc]]&I?E:M;break}for(var C_=et,Mc=Nr+1;Mc<fe.length;Mc++)if(le[fe[Mc]]&(a|l))Jm=Mc;else{C_=le[fe[Mc]]&I?E:M;break}for(var Qm=A_;Qm<=Jm;Qm++)le[fe[Qm]]=Km===C_?Km:at;Nr=Jm}}}for(var hr=ce.start;hr<=ce.end;hr++){var BT=ne[hr],Qd=le[hr];if(BT&1?Qd&(M|S|R)&&ne[hr]++:Qd&E?ne[hr]++:Qd&(R|S)&&(ne[hr]+=2),Qd&l&&(ne[hr]=hr===0?ce.level:ne[hr-1]),hr===ce.end||h(se[hr])&(H|N))for(var eh=hr;eh>=0&&h(se[eh])&c;eh--)ne[eh]=ce.level}}return{levels:ne,paragraphs:ue};function R_(Yi,Or){for(var $i=Yi;$i<se.length;$i++){var no=le[$i];if(no&(E|Q))return 1;if(no&(N|M)||Or&&no===ie)return 0;if(no&s){var P_=zT($i);$i=P_===-1?se.length:P_}}return 0}function zT(Yi){for(var Or=1,$i=Yi+1;$i<se.length;$i++){var no=le[$i];if(no&N)break;if(no&ie){if(--Or===0)return $i}else no&s&&Or++}return-1}}var ye="14>1,j>2,t>2,u>2,1a>g,2v3>
45521,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",we;function _e(){if(!we){var se=m(ye,!0),Se=se.map,he=se.reverseMap;he.forEach(function(le,He){Se.set(He,le)}),we=Se}}function Re(se){return _e(),we.get(se)||null}function F(se,Se,he,le){var He=se.length;he=Math.max(0,he==null?0:+he),le=Math.min(He-1,le==null?He-1:+le);for(var B=new Map,A=he;A<=le;A++)if(Se[A]&1){var ne=Re(se[A]);ne!==null&&B.set(A,ne)}return B}function pe(se,Se,he,le){var He=se.length;he=Math.max(0,he==null?0:+he),le=Math.min(He-1,le==null?He-1:+le);var B=[];return Se.paragraphs.forEach(function(A){var ne=Math.max(he,A.start),ge=Math.min(le,A.end);if(ne<ge){for(var ue=Se.levels.slice(ne,ge+1),ce=ge;ce>=ne&&h(se[ce])&c;ce--)ue[ce]=A.level;for(var Ne=A.level,De=1/0,$e=0;$e<ue.length;$e++){var Je=ue[$e];Je>Ne&&(Ne=Je),Je<De&&(De=Je|1)}for(var Ee=Ne;Ee>=De;Ee--)for(var Ge=0;Ge<ue.length;Ge++)if(ue[Ge]>=Ee){for(var Ye=Ge;Ge+1<ue.length&&ue[Ge+1]>=Ee;)Ge++;Ge>Ye&&B.push([Ye+ne,Ge+ne])}}}),B}function me(se,Se,he,le){var He=be(se,Se,he,le),B=[].concat(se);return He.forEach(function(A,ne){B[ne]=(Se.levels[A]&1?Re(se[A]):null)||se[A]}),B.join("")}function be(se,Se,he,le){for(var He=pe(se,Se,he,le),B=[],A=0;A<se.length;A++)B[A]=A;return He.forEach(function(ne){for(var ge=ne[0],ue=ne[1],ce=B.slice(ge,ue+1),Ne=ce.length;Ne--;)B[ue-Ne]=ce[Ne]}),B}return e.closingToOpeningBracket=T,e.getBidiCharType=h,e.getBidiCharTypeName=f,e.getCanonicalBracket=b,e.getEmbeddingLevels=de,e.getMirroredCharacter=Re,e.getMirroredCharactersMap=F,e.getReorderSegments=pe,e.getReorderedIndices=be,e.getReorderedString=me,e.openingToClosingBracket=x,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return r}const GM=/\bvoid\s+main\s*\(\s*\)\s*{/g;function qv(r){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function t(n,i){let s=Ft[i];return s?qv(s):n}return r.replace(e,t)}const Ri=[];for(let r=0;r<256;r++)Ri[r]=(r<16?"0":"")+r.toString(16);function fO(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ri[r&255]+Ri[r>>8&255]+Ri[r>>16&255]+Ri[r>>24&255]+"-"+Ri[e&255]+Ri[e>>8&255]+"-"+Ri[e>>16&15|64]+Ri[e>>24&255]+"-"+Ri[t&63|128]+Ri[t>>8&255]+"-"+Ri[t>>16&255]+Ri[t>>24&255]+Ri[n&255]+Ri[n>>8&255]+Ri[n>>16&255]+Ri[n>>24&255]).toUpperCase()}const Qo=Object.assign||function(){let r=arguments[0];for(let e=1,t=arguments.length;e<t;e++){let n=arguments[e];if(n)for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])}return r},pO=Date.now(),hw=new WeakMap,fw=new Map;let mO=1e10;function Yv(r,e){const t=_O(e);let n=hw.get(r);if(n||hw.set(r,n=Object.create(null)),n[t])return new n[t];const i=`_onBeforeCompile${t}`,s=function(c,u){r.onBeforeCompile.call(this,c,u);const d=this.customProgramCacheKey()+"|"+c.vertexShader+"|"+c.fragmentShader;let h=fw[d];if(!h){const f=gO(this,c,e,t);h=fw[d]=f}c.vertexShader=h.vertexShader,c.fragmentShader=h.fragmentShader,Qo(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-pO}}),this[i]&&this[i](c)},o=function(){return a(e.chained?r:r.clone())},a=function(c){const u=Object.create(c,l);return Object.defineProperty(u,"baseMaterial",{value:r}),Object.defineProperty(u,"id",{value:mO++}),u.uuid=fO(),u.uniforms=Qo({},c.uniforms,e.uniforms),u.defines=Qo({},c.defines,e.defines),u.defines[`TROIKA_DERIVED_MATERIAL_${t}`]="",u.extensions=Qo({},c.extensions,e.extensions),u._listeners=void 0,u},l={constructor:{value:o},isDerivedMaterial:{value:!0},type:{get:()=>r.type,set:c=>{r.type=c}},isDerivedFrom:{writable:!0,configurable:!0,value:function(c){const u=this.baseMaterial;return c===u||u.isDerivedMaterial&&u.isDerivedFrom(c)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return r.customProgramCacheKey()+"|"+t}},onBeforeCompile:{get(){return s},set(c){this[i]=c}},copy:{writable:!0,configurable:!0,value:function(c){return r.copy.call(this,c),!r.isShaderMaterial&&!r.isDerivedMaterial&&(Qo(this.extensions,c.extensions),Qo(this.defines,c.defines),Qo(this.uniforms,Vd.clone(c.uniforms)
4552)),this}},clone:{writable:!0,configurable:!0,value:function(){const c=new r.constructor;return a(c).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let c=this._depthMaterial;return c||(c=this._depthMaterial=Yv(r.isDerivedMaterial?r.getDepthMaterial():new Um({depthPacking:ny}),e),c.defines.IS_DEPTH_MATERIAL="",c.uniforms=this.uniforms),c}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let c=this._distanceMaterial;return c||(c=this._distanceMaterial=Yv(r.isDerivedMaterial?r.getDistanceMaterial():new Nm,e),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms),c}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:c,_distanceMaterial:u}=this;c&&c.dispose(),u&&u.dispose(),r.dispose.call(this)}}};return n[t]=o,new o}function gO(r,{vertexShader:e,fragmentShader:t},n,i){let{vertexDefs:s,vertexMainIntro:o,vertexMainOutro:a,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:u,fragmentMainOutro:d,fragmentColorTransform:h,customRewriter:f,timeUniform:p}=n;if(s=s||"",o=o||"",a=a||"",c=c||"",u=u||"",d=d||"",(l||f)&&(e=qv(e)),(h||f)&&(t=t.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
4553//!BEGIN_POST_CHUNK $1
4554$&
4555//!END_POST_CHUNK
4556`),t=qv(t)),f){let m=f({vertexShader:e,fragmentShader:t});e=m.vertexShader,t=m.fragmentShader}if(h){let m=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,g=>(m.push(g),"")),d=`${h}
4557${m.join(`
4558`)}
4559${d}`}if(p){const m=`
4560uniform float ${p};
4561`;s=m+s,c=m+c}return l&&(e=`vec3 troika_position_${i};
4562vec3 troika_normal_${i};
4563vec2 troika_uv_${i};
4564${e}
4565`,s=`${s}
4566void troikaVertexTransform${i}() {
4567  vec3 position = troika_position_${i};
4568  vec3 normal = troika_normal_${i};
4569  vec2 uv = troika_uv_${i};
4570  ${l}
4571  troika_position_${i} = position;
4572  troika_normal_${i} = normal;
4573  troika_uv_${i} = uv;
4574}
4575`,o=`
4576troika_position_${i} = vec3(position);
4577troika_normal_${i} = vec3(normal);
4578troika_uv_${i} = vec2(uv);
4579troikaVertexTransform${i}();
4580${o}
4581`,e=e.replace(/\b(position|normal|uv)\b/g,(m,g,v,y)=>/\battribute\s+vec[23]\s+$/.test(y.substr(0,v))?g:`troika_${g}_${i}`),r.map&&r.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=pw(e,i,s,o,a),t=pw(t,i,c,u,d),{vertexShader:e,fragmentShader:t}}function pw(r,e,t,n,i){return(n||i||t)&&(r=r.replace(GM,`
4582${t}
4583void troikaOrigMain${e}() {`),r+=`
4584void main() {
4585  ${n}
4586  troikaOrigMain${e}();
4587  ${i}
4588}`),r}function vO(r,e){return r==="uniforms"?void 0:typeof e=="function"?e.toString():e}let yO=0;const mw=new Map;function _O(r){const e=JSON.stringify(r,vO);let t=mw.get(e);return t==null&&mw.set(e,t=++yO),t}/*!
4589Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering.
4590Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE
4591*/function xO(){return typeof window>"u"&&(self.window=self),(function(r){var e={parse:function(i){var s=e._bin,o=new Uint8Array(i);if(s.readASCII(o,0,4)=="ttcf"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var l=s.readUint(o,a);a+=4;for(var c=[],u=0;u<l;u++){var d=s.readUint(o,a);a+=4,c.push(e._readFont(o,d))}return c}return[e._readFont(o,0)]},_readFont:function(i,s){var o=e._bin,a=s;o.readFixed(i,s),s+=4;var l=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2;for(var c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],u={_data:i,_offset:a},d={},h=0;h<l;h++){var f=o.readASCII(i,s,4);s+=4,o.readUint(i,s),s+=4;var p=o.readUint(i,s);s+=4;var m=o.readUint(i,s);s+=4,d[f]={offset:p,length:m}}for(h=0;h<c.length;h++){var g=c[h];d[g]&&(u[g.trim()]=e[g.trim()].parse(i,d[g].offset,d[g].length,u))}return u},_tabOffset:function(i,s,o){for(var a=e._bin,l=a.readUshort(i,o+4),c=o+12,u=0;u<l;u++){var d=a.readASCII(i,c,4);c+=4,a.readUint(i,c),c+=4;var h=a.readUint(i,c);if(c+=4,a.readUint(i,c),c+=4,d==s)return h}return 0}};e._bin={readFixed:function(i,s){return(i[s]<<8|i[s+1])+(i[s+2]<<8|i[s+3])/65540},readF2dot14:function(i,s){return e._bin.readShort(i,s)/16384},readInt:function(i,s){return e._bin._view(i).getInt32(s)},readInt8:function(i,s){return e._bin._view(i).getInt8(s)},readShort:function(i,s){return e._bin._view(i).getInt16(s)},readUshort:function(i,s){return e._bin._view(i).getUint16(s)},readUshorts:function(i,s,o){for(var a=[],l=0;l<o;l++)a.push(e._bin.readUshort(i,s+2*l));return a},readUint:function(i,s){return e._bin._view(i).getUint32(s)},readUint64:function(i,s){return 4294967296*e._bin.readUint(i,s)+e._bin.readUint(i,s+4)},readASCII:function(i,s,o){for(var a="",l=0;l<o;l++)a+=String.fromCharCode(i[s+l]);return a},readUnicode:function(i,s,o){for(var a="",l=0;l<o;l++){var c=i[s++]<<8|i[s++];a+=String.fromCharCode(c)}return a},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(i,s,o){var a=e._bin._tdec;return a&&s==0&&o==i.length?a.decode(i):e._bin.readASCII(i,s,o)},readBytes:function(i,s,o){for(var a=[],l=0;l<o;l++)a.push(i[s+l]);return a},readASCIIArray:function(i,s,o){for(var a=[],l=0;l<o;l++)a.push(String.fromCharCode(i[s+l]));return a},_view:function(i){return i._dataView||(i._dataView=i.buffer?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(new Uint8Array(i).buffer))}},e._lctf={},e._lctf.parse=function(i,s,o,a,l){var c=e._bin,u={},d=s;c.readFixed(i,s),s+=4;var h=c.readUshort(i,s);s+=2;var f=c.readUshort(i,s);s+=2;var p=c.readUshort(i,s);return s+=2,u.scriptList=e._lctf.readScriptList(i,d+h),u.featureList=e._lctf.readFeatureList(i,d+f),u.lookupList=e._lctf.readLookupList(i,d+p,l),u},e._lctf.readLookupList=function(i,s,o){var a=e._bin,l=s,c=[],u=a.readUshort(i,s);s+=2;for(var d=0;d<u;d++){var h=a.readUshort(i,s);s+=2;var f=e._lctf.readLookupTable(i,l+h,o);c.push(f)}return c},e._lctf.readLookupTable=function(i,s,o){var a=e._bin,l=s,c={tabs:[]};c.ltype=a.readUshort(i,s),s+=2,c.flag=a.readUshort(i,s),s+=2;var u=a.readUshort(i,s);s+=2;for(var d=c.ltype,h=0;h<u;h++){var f=a.readUshort(i,s);s+=2;var p=o(i,d,l+f,c);c.tabs.push(p)}return c},e._lctf.numOfOnes=function(i){for(var s=0,o=0;o<32;o++)(i>
4591>>o&1)!=0&&s++;return s},e._lctf.readClassDef=function(i,s){var o=e._bin,a=[],l=o.readUshort(i,s);if(s+=2,l==1){var c=o.readUshort(i,s);s+=2;var u=o.readUshort(i,s);s+=2;for(var d=0;d<u;d++)a.push(c+d),a.push(c+d),a.push(o.readUshort(i,s)),s+=2}if(l==2){var h=o.readUshort(i,s);for(s+=2,d=0;d<h;d++)a.push(o.readUshort(i,s)),s+=2,a.push(o.readUshort(i,s)),s+=2,a.push(o.readUshort(i,s)),s+=2}return a},e._lctf.getInterval=function(i,s){for(var o=0;o<i.length;o+=3){var a=i[o],l=i[o+1];if(i[o+2],a<=s&&s<=l)return o}return-1},e._lctf.readCoverage=function(i,s){var o=e._bin,a={};a.fmt=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);return s+=2,a.fmt==1&&(a.tab=o.readUshorts(i,s,l)),a.fmt==2&&(a.tab=o.readUshorts(i,s,3*l)),a},e._lctf.coverageIndex=function(i,s){var o=i.tab;if(i.fmt==1)return o.indexOf(s);if(i.fmt==2){var a=e._lctf.getInterval(o,s);if(a!=-1)return o[a+2]+(s-o[a])}return-1},e._lctf.readFeatureList=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var u=0;u<c;u++){var d=o.readASCII(i,s,4);s+=4;var h=o.readUshort(i,s);s+=2;var f=e._lctf.readFeatureTable(i,a+h);f.tag=d.trim(),l.push(f)}return l},e._lctf.readFeatureTable=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2,c>0&&(l.featureParams=a+c);var u=o.readUshort(i,s);s+=2,l.tab=[];for(var d=0;d<u;d++)l.tab.push(o.readUshort(i,s+2*d));return l},e._lctf.readScriptList=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2;for(var u=0;u<c;u++){var d=o.readASCII(i,s,4);s+=4;var h=o.readUshort(i,s);s+=2,l[d.trim()]=e._lctf.readScriptTable(i,a+h)}return l},e._lctf.readScriptTable=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2,c>0&&(l.default=e._lctf.readLangSysTable(i,a+c));var u=o.readUshort(i,s);s+=2;for(var d=0;d<u;d++){var h=o.readASCII(i,s,4);s+=4;var f=o.readUshort(i,s);s+=2,l[h.trim()]=e._lctf.readLangSysTable(i,a+f)}return l},e._lctf.readLangSysTable=function(i,s){var o=e._bin,a={};o.readUshort(i,s),s+=2,a.reqFeature=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);return s+=2,a.features=o.readUshorts(i,s,l),a},e.CFF={},e.CFF.parse=function(i,s,o){var a=e._bin;(i=new Uint8Array(i.buffer,s,o))[s=0],i[++s],i[++s],i[++s],s++;var l=[];s=e.CFF.readIndex(i,s,l);for(var c=[],u=0;u<l.length-1;u++)c.push(a.readASCII(i,s+l[u],l[u+1]-l[u]));s+=l[l.length-1];var d=[];s=e.CFF.readIndex(i,s,d);var h=[];for(u=0;u<d.length-1;u++)h.push(e.CFF.readDict(i,s+d[u],s+d[u+1]));s+=d[d.length-1];var f=h[0],p=[];s=e.CFF.readIndex(i,s,p);var m=[];for(u=0;u<p.length-1;u++)m.push(a.readASCII(i,s+p[u],p[u+1]-p[u]));if(s+=p[p.length-1],e.CFF.readSubrs(i,s,f),f.CharStrings){s=f.CharStrings,p=[],s=e.CFF.readIndex(i,s,p);var g=[];for(u=0;u<p.length-1;u++)g.push(a.readBytes(i,s+p[u],p[u+1]-p[u]));f.CharStrings=g}if(f.ROS){s=f.FDArray;var v=[];for(s=e.CFF.readIndex(i,s,v),f.FDArray=[],u=0;u<v.length-1;u++){var y=e.CFF.readDict(i,s+v[u],s+v[u+1]);e.CFF._readFDict(i,y,m),f.FDArray.push(y)}s+=v[v.length-1],s=f.FDSelect,f.FDSelect=[];var _=i[s];if(s++,_!=3)throw _;var x=a.readUshort(i,s);for(s+=2,u=0;u<x+1;u++)f.FDSelect.push(a.readUshort(i,s),i[s+2]),s+=3}return f.Encoding&&(f.Encoding=e.CFF.readEncoding(i,f.Encoding,f.CharStrings.length)),f.charset&&(f.charset=e.CFF.readCharset(i,f.charset,f.CharStrings.length)),e.CFF._readFDict(i,f,m),f},e.CFF._readFDict=function(i,s,o){var a;for(var l in s.Private&&(a=s.Private[1],s.Private=e.CFF.readDict(i,a,a+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(i,a+s.Private.Subrs,s.Private)),s)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(s[l]=o[s[l]-426+35])},e.CFF.readSubrs=function(i,s,o){var a=e._bin,l=[];s=e.CFF.readIndex(i,s,l);var c,u=l.length;c=u<1240?107:u<33900?1131:32768,o.Bias=c,o.Subrs=[];for(var d=0;d<l.length-1;d++)o.Subrs.push(a.readBytes(i,s+l[d],l[d+1]-l[d]))},e.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(i,s){for(var o=0;o<i.charset.length;o++)if(i.charset[o]==s)return o;return-1},e.CFF.glyphBySE=function(i,s){return s<0||s>
4591255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[s])},e.CFF.readEncoding=function(i,s,o){e._bin;var a=[".notdef"],l=i[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=i[s];s++;for(var u=0;u<c;u++)a.push(i[s+u]);return a},e.CFF.readCharset=function(i,s,o){var a=e._bin,l=[".notdef"],c=i[s];if(s++,c==0)for(var u=0;u<o;u++){var d=a.readUshort(i,s);s+=2,l.push(d)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<o;){d=a.readUshort(i,s),s+=2;var h=0;for(c==1?(h=i[s],s++):(h=a.readUshort(i,s),s+=2),u=0;u<=h;u++)l.push(d),d++}}return l},e.CFF.readIndex=function(i,s,o){var a=e._bin,l=a.readUshort(i,s)+1,c=i[s+=2];if(s++,c==1)for(var u=0;u<l;u++)o.push(i[s+u]);else if(c==2)for(u=0;u<l;u++)o.push(a.readUshort(i,s+2*u));else if(c==3)for(u=0;u<l;u++)o.push(16777215&a.readUint(i,s+3*u-1));else if(l!=1)throw"unsupported offset size: "+c+", count: "+l;return(s+=l*c)-1},e.CFF.getCharString=function(i,s,o){var a=e._bin,l=i[s],c=i[s+1];i[s+2],i[s+3],i[s+4];var u=1,d=null,h=null;l<=20&&(d=l,u=1),l==12&&(d=100*l+c,u=2),21<=l&&l<=27&&(d=l,u=1),l==28&&(h=a.readShort(i,s+1),u=3),29<=l&&l<=31&&(d=l,u=1),32<=l&&l<=246&&(h=l-139,u=1),247<=l&&l<=250&&(h=256*(l-247)+c+108,u=2),251<=l&&l<=254&&(h=256*-(l-251)-c-108,u=2),l==255&&(h=a.readInt(i,s+1)/65535,u=5),o.val=h??"o"+d,o.size=u},e.CFF.readCharString=function(i,s,o){for(var a=s+o,l=e._bin,c=[];s<a;){var u=i[s],d=i[s+1];i[s+2],i[s+3],i[s+4];var h=1,f=null,p=null;u<=20&&(f=u,h=1),u==12&&(f=100*u+d,h=2),u!=19&&u!=20||(f=u,h=2),21<=u&&u<=27&&(f=u,h=1),u==28&&(p=l.readShort(i,s+1),h=3),29<=u&&u<=31&&(f=u,h=1),32<=u&&u<=246&&(p=u-139,h=1),247<=u&&u<=250&&(p=256*(u-247)+d+108,h=2),251<=u&&u<=254&&(p=256*-(u-251)-d-108,h=2),u==255&&(p=l.readInt(i,s+1)/65535,h=5),c.push(p??"o"+f),s+=h}return c},e.CFF.readDict=function(i,s,o){for(var a=e._bin,l={},c=[];s<o;){var u=i[s],d=i[s+1];i[s+2],i[s+3],i[s+4];var h=1,f=null,p=null;if(u==28&&(p=a.readShort(i,s+1),h=3),u==29&&(p=a.readInt(i,s+1),h=5),32<=u&&u<=246&&(p=u-139,h=1),247<=u&&u<=250&&(p=256*(u-247)+d+108,h=2),251<=u&&u<=254&&(p=256*-(u-251)-d-108,h=2),u==255)throw p=a.readInt(i,s+1)/65535,h=5,"unknown number";if(u==30){var m=[];for(h=1;;){var g=i[s+h];h++;var v=g>>4,y=15&g;if(v!=15&&m.push(v),y!=15&&m.push(y),y==15)break}for(var _="",x=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],T=0;T<m.length;T++)_+=x[m[T]];p=parseFloat(_)}u<=21&&(f=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][u],h=1,u==12&&(f=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][d],h=2)),f!=null?(l[f]=c.length==1?c[0]:c,c=[]):c.push(p),s+=h}return l},e.cmap={},e.cmap.parse=function(i,s,o){i=new Uint8Array(i.buffer,s,o),s=0;var a=e._bin,l={};a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2;var u=[];l.tables=[];for(var d=0;d<c;d++){var h=a.readUshort(i,s);s+=2;var f=a.readUshort(i,s);s+=2;var p=a.readUint(i,s);s+=4;var m="p"+h+"e"+f,g=u.indexOf(p);if(g==-1){var v;g=l.tables.length,u.push(p);var y=a.readUshort(i,p);y==0?v=e.cmap.parse0(i,p):y==4?v=e.cmap.parse4(i,p):y==6?v=e.cmap.parse6(i,p):y==12?v=e.cmap.parse12(i,p):console.debug("unknown format: "+y,h,f,p),l.tables.push(v)}if(l[m]!=null)throw"multiple tables for one platform+encoding";l[m]=g}return l},e.cmap.parse0=function(i,s){var o=e._bin,a={};a.format=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2,a.map=[];for(var c=0;c<l-6;c++)a.map.push(i[s+c]);return a},e.cmap.parse4=function(i,s){var o=e._bin,a=s,l={};l.format=o.readUshort(i,s),s+=2;var c=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2;var u=o.readUshort(i,s);s+=2;var d=u/2;
4591l.searchRange=o.readUshort(i,s),s+=2,l.entrySelector=o.readUshort(i,s),s+=2,l.rangeShift=o.readUshort(i,s),s+=2,l.endCount=o.readUshorts(i,s,d),s+=2*d,s+=2,l.startCount=o.readUshorts(i,s,d),s+=2*d,l.idDelta=[];for(var h=0;h<d;h++)l.idDelta.push(o.readShort(i,s)),s+=2;for(l.idRangeOffset=o.readUshorts(i,s,d),s+=2*d,l.glyphIdArray=[];s<a+c;)l.glyphIdArray.push(o.readUshort(i,s)),s+=2;return l},e.cmap.parse6=function(i,s){var o=e._bin,a={};a.format=o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,a.firstCode=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2,a.glyphIdArray=[];for(var c=0;c<l;c++)a.glyphIdArray.push(o.readUshort(i,s)),s+=2;return a},e.cmap.parse12=function(i,s){var o=e._bin,a={};a.format=o.readUshort(i,s),s+=2,s+=2,o.readUint(i,s),s+=4,o.readUint(i,s),s+=4;var l=o.readUint(i,s);s+=4,a.groups=[];for(var c=0;c<l;c++){var u=s+12*c,d=o.readUint(i,u+0),h=o.readUint(i,u+4),f=o.readUint(i,u+8);a.groups.push([d,h,f])}return a},e.glyf={},e.glyf.parse=function(i,s,o,a){for(var l=[],c=0;c<a.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(i,s){var o=e._bin,a=i._data,l=e._tabOffset(a,"glyf",i._offset)+i.loca[s];if(i.loca[s]==i.loca[s+1])return null;var c={};if(c.noc=o.readShort(a,l),l+=2,c.xMin=o.readShort(a,l),l+=2,c.yMin=o.readShort(a,l),l+=2,c.xMax=o.readShort(a,l),l+=2,c.yMax=o.readShort(a,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var u=0;u<c.noc;u++)c.endPts.push(o.readUshort(a,l)),l+=2;var d=o.readUshort(a,l);if(l+=2,a.length-l<d)return null;c.instructions=o.readBytes(a,l,d),l+=d;var h=c.endPts[c.noc-1]+1;for(c.flags=[],u=0;u<h;u++){var f=a[l];if(l++,c.flags.push(f),(8&f)!=0){var p=a[l];l++;for(var m=0;m<p;m++)c.flags.push(f),u++}}for(c.xs=[],u=0;u<h;u++){var g=(2&c.flags[u])!=0,v=(16&c.flags[u])!=0;g?(c.xs.push(v?a[l]:-a[l]),l++):v?c.xs.push(0):(c.xs.push(o.readShort(a,l)),l+=2)}for(c.ys=[],u=0;u<h;u++)g=(4&c.flags[u])!=0,v=(32&c.flags[u])!=0,g?(c.ys.push(v?a[l]:-a[l]),l++):v?c.ys.push(0):(c.ys.push(o.readShort(a,l)),l+=2);var y=0,_=0;for(u=0;u<h;u++)y+=c.xs[u],_+=c.ys[u],c.xs[u]=y,c.ys[u]=_}else{var x;c.parts=[];do{x=o.readUshort(a,l),l+=2;var T={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(T),T.glyphIndex=o.readUshort(a,l),l+=2,1&x){var b=o.readShort(a,l);l+=2;var M=o.readShort(a,l);l+=2}else b=o.readInt8(a,l),l++,M=o.readInt8(a,l),l++;2&x?(T.m.tx=b,T.m.ty=M):(T.p1=b,T.p2=M),8&x?(T.m.a=T.m.d=o.readF2dot14(a,l),l+=2):64&x?(T.m.a=o.readF2dot14(a,l),l+=2,T.m.d=o.readF2dot14(a,l),l+=2):128&x&&(T.m.a=o.readF2dot14(a,l),l+=2,T.m.b=o.readF2dot14(a,l),l+=2,T.m.c=o.readF2dot14(a,l),l+=2,T.m.d=o.readF2dot14(a,l),l+=2)}while(32&x);if(256&x){var E=o.readUshort(a,l);for(l+=2,c.instr=[],u=0;u<E;u++)c.instr.push(a[l]),l++}}return c},e.GDEF={},e.GDEF.parse=function(i,s,o,a){var l=s;s+=4;var c=e._bin.readUshort(i,s);return{glyphClassDef:c===0?null:e._lctf.readClassDef(i,l+c)}},e.GPOS={},e.GPOS.parse=function(i,s,o,a){return e._lctf.parse(i,s,o,a,e.GPOS.subt)},e.GPOS.subt=function(i,s,o,a){var l=e._bin,c=o,u={};if(u.fmt=l.readUshort(i,o),o+=2,s==1||s==2||s==3||s==7||s==8&&u.fmt<=2){var d=l.readUshort(i,o);o+=2,u.coverage=e._lctf.readCoverage(i,d+c)}if(s==1&&u.fmt==1){var h=l.readUshort(i,o);o+=2,h!=0&&(u.pos=e.GPOS.readValueRecord(i,o,h))}else if(s==2&&u.fmt>=1&&u.fmt<=2){h=l.readUshort(i,o),o+=2;var f=l.readUshort(i,o);o+=2;var p=e._lctf.numOfOnes(h),m=e._lctf.numOfOnes(f);if(u.fmt==1){u.pairsets=[];var g=l.readUshort(i,o);o+=2;for(var v=0;v<g;v++){var y=c+l.readUshort(i,o);o+=2;var _=l.readUshort(i,y);y+=2;for(var x=[],T=0;T<_;T++){var b=l.readUshort(i,y);y+=2,h!=0&&(R=e.GPOS.readValueRecord(i,y,h),y+=2*p),f!=0&&(k=e.GPOS.readValueRecord(i,y,f),y+=2*m),x.push({gid2:b,val1:R,val2:k})}u.pairsets.push(x)}}if(u.fmt==2){var M=l.readUshort(i,o);o+=2;var E=l.readUshort(i,o);o+=2;var S=l.readUshort(i,o);o+=2;var w=l.readUshort(i,o);for(o+=2,u.classDef1=e._lctf.readClassDef(i,c+M),u.classDef2=e._lctf.readClassDef(i,c+E),u.matrix=[],v=0;v<S;v++){var D=[];for(T=0;T<w;T++){var R=null,k=null;h!=0&&(R=e.GPOS.readValueRecord(i,o,h),o+=2*p),f!=0&&(k=e.GPOS.readValueRecord(i,o,f),o+=2*m),D.push({val1:R,val2:k})}u.matrix.push(D)}}}else if(s==4&&u.fmt==1)u.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),u.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),u.markClassCount=l.readUshort(i,o+4),u.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),u.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,u.markClassCount);else if(s==6&&u.fmt==1)u.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),u.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),u.markClassCount=l.readUshort(i,o+4),u.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),u.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,u.markClassCount);else{if(s==9&&u.fmt==1){var N=l.readUshort(i,o);o+=2;var H=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=N;else if(a.ltype!=N)throw"invalid extension substitution";return e.GPOS.subt(i,a.ltype,c+H)}console.debug("unsupported GPOS table LookupType",s,"format",u.fmt)}return u},e.GPOS.readValueRecord=function(i,s,o){var a=e._bin,l=[];return l.push(1&o?a.readShort(i,s):0),s+=1&o?2:0,l.push(2&o?a.readShort(i,s):0),s+=2&o?2:0,l.push(4&o?a.readShort(i,s):0),s+=4&o?2:0,l.push(8&o?a.readShort(i,s):0),s+=8&o?2:0,l},e.GPOS.readBaseArray=function(i,s,o){var a=e._bin,l=[],c=s,u=a.readUshort(i,s);s+=2;for(var d=0;d<u;d++){for(var h=[],f=0;f<o;f++)h.push(e.GPOS.readAnchorRecord(i,c+a.readUshort(i,s))),s+=2;l.push(h)}return l},e.GPOS.readMarkArray=function(i,s){var o=e._bin,a=[],l=s,c=o.readUshort(i,s);s+=2;for(var u=0;u<c;u++){var d=e.GPOS.readAnchorRecord(i,o.readUshort(i,s+2)+l);d.markClass=o.readUshort(i,s),a.push(d),s+=4}return a},e.GPOS.readAnchorRecord=function(i,s){var o=e._bin,a={};return a.fmt=o.readUshort(i,s),a.x=o.readShort(i,s+2),a.y=o.readShort(i,s+4),a},e.GSUB={},e.GSUB.parse=function(i,s,o,a){return e._lctf.parse(i,s,o,a,e.GSUB.subt)},e.GSUB.subt=function(i,s,o,a){var l=e._bin,c=o,u={};
4591if(u.fmt=l.readUshort(i,o),o+=2,s!=1&&s!=2&&s!=4&&s!=5&&s!=6)return null;if(s==1||s==2||s==4||s==5&&u.fmt<=2||s==6&&u.fmt<=2){var d=l.readUshort(i,o);o+=2,u.coverage=e._lctf.readCoverage(i,c+d)}if(s==1&&u.fmt>=1&&u.fmt<=2){if(u.fmt==1)u.delta=l.readShort(i,o),o+=2;else if(u.fmt==2){var h=l.readUshort(i,o);o+=2,u.newg=l.readUshorts(i,o,h),o+=2*u.newg.length}}else if(s==2&&u.fmt==1){h=l.readUshort(i,o),o+=2,u.seqs=[];for(var f=0;f<h;f++){var p=l.readUshort(i,o)+c;o+=2;var m=l.readUshort(i,p);u.seqs.push(l.readUshorts(i,p+2,m))}}else if(s==4)for(u.vals=[],h=l.readUshort(i,o),o+=2,f=0;f<h;f++){var g=l.readUshort(i,o);o+=2,u.vals.push(e.GSUB.readLigatureSet(i,c+g))}else if(s==5&&u.fmt==2){if(u.fmt==2){var v=l.readUshort(i,o);o+=2,u.cDef=e._lctf.readClassDef(i,c+v),u.scset=[];var y=l.readUshort(i,o);for(o+=2,f=0;f<y;f++){var _=l.readUshort(i,o);o+=2,u.scset.push(_==0?null:e.GSUB.readSubClassSet(i,c+_))}}}else if(s==6&&u.fmt==3){if(u.fmt==3){for(f=0;f<3;f++){h=l.readUshort(i,o),o+=2;for(var x=[],T=0;T<h;T++)x.push(e._lctf.readCoverage(i,c+l.readUshort(i,o+2*T)));o+=2*h,f==0&&(u.backCvg=x),f==1&&(u.inptCvg=x),f==2&&(u.ahedCvg=x)}h=l.readUshort(i,o),o+=2,u.lookupRec=e.GSUB.readSubstLookupRecords(i,o,h)}}else{if(s==7&&u.fmt==1){var b=l.readUshort(i,o);o+=2;var M=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=b;else if(a.ltype!=b)throw"invalid extension substitution";return e.GSUB.subt(i,a.ltype,c+M)}console.debug("unsupported GSUB table LookupType",s,"format",u.fmt)}return u},e.GSUB.readSubClassSet=function(i,s){var o=e._bin.readUshort,a=s,l=[],c=o(i,s);s+=2;for(var u=0;u<c;u++){var d=o(i,s);s+=2,l.push(e.GSUB.readSubClassRule(i,a+d))}return l},e.GSUB.readSubClassRule=function(i,s){var o=e._bin.readUshort,a={},l=o(i,s),c=o(i,s+=2);s+=2,a.input=[];for(var u=0;u<l-1;u++)a.input.push(o(i,s)),s+=2;return a.substLookupRecords=e.GSUB.readSubstLookupRecords(i,s,c),a},e.GSUB.readSubstLookupRecords=function(i,s,o){for(var a=e._bin.readUshort,l=[],c=0;c<o;c++)l.push(a(i,s),a(i,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var u=0;u<c;u++){var d=o.readUshort(i,s);s+=2,l.push(e.GSUB.readChainSubClassRule(i,a+d))}return l},e.GSUB.readChainSubClassRule=function(i,s){for(var o=e._bin,a={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var u=o.readUshort(i,s);s+=2,c==1&&u--,a[l[c]]=o.readUshorts(i,s,u),s+=2*a[l[c]].length}return u=o.readUshort(i,s),s+=2,a.subst=o.readUshorts(i,s,2*u),s+=2*a.subst.length,a},e.GSUB.readLigatureSet=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var u=0;u<c;u++){var d=o.readUshort(i,s);s+=2,l.push(e.GSUB.readLigature(i,a+d))}return l},e.GSUB.readLigature=function(i,s){var o=e._bin,a={chain:[]};a.nglyph=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2;for(var c=0;c<l-1;c++)a.chain.push(o.readUshort(i,s)),s+=2;return a},e.head={},e.head.parse=function(i,s,o){var a=e._bin,l={};return a.readFixed(i,s),s+=4,l.fontRevision=a.readFixed(i,s),s+=4,a.readUint(i,s),s+=4,a.readUint(i,s),s+=4,l.flags=a.readUshort(i,s),s+=2,l.unitsPerEm=a.readUshort(i,s),s+=2,l.created=a.readUint64(i,s),s+=8,l.modified=a.readUint64(i,s),s+=8,l.xMin=a.readShort(i,s),s+=2,l.yMin=a.readShort(i,s),s+=2,l.xMax=a.readShort(i,s),s+=2,l.yMax=a.readShort(i,s),s+=2,l.macStyle=a.readUshort(i,s),s+=2,l.lowestRecPPEM=a.readUshort(i,s),s+=2,l.fontDirectionHint=a.readShort(i,s),s+=2,l.indexToLocFormat=a.readShort(i,s),s+=2,l.glyphDataFormat=a.readShort(i,s),s+=2,l},e.hhea={},e.hhea.parse=function(i,s,o){var a=e._bin,l={};return a.readFixed(i,s),s+=4,l.ascender=a.readShort(i,s),s+=2,l.descender=a.readShort(i,s),s+=2,l.lineGap=a.readShort(i,s),s+=2,l.advanceWidthMax=a.readUshort(i,s),s+=2,l.minLeftSideBearing=a.readShort(i,s),s+=2,l.minRightSideBearing=a.readShort(i,s),s+=2,l.xMaxExtent=a.readShort(i,s),s+=2,l.caretSlopeRise=a.readShort(i,s),s+=2,l.caretSlopeRun=a.readShort(i,s),s+=2,l.caretOffset=a.readShort(i,s),s+=2,s+=8,l.metricDataFormat=a.readShort(i,s),s+=2,l.numberOfHMetrics=a.readUshort(i,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(i,s,o,a){for(var l=e._bin,c={aWidth:[],lsBearing:[]},u=0,d=0,h=0;h<a.maxp.numGlyphs;h++)h<a.hhea.numberOfHMetrics&&(u=l.readUshort(i,s),s+=2,d=l.readShort(i,s),s+=2),c.aWidth.push(u),c.lsBearing.push(d);return c},e.kern={},e.kern.parse=function(i,s,o,a){var l=e._bin,c=l.readUshort(i,s);if(s+=2,c==1)return e.kern.parseV1(i,s-2,o,a);var u=l.readUshort(i,s);s+=2;for(var d={glyph1:[],rval:[]},h=0;h<u;h++){s+=2,o=l.readUshort(i,s),s+=2;var f=l.readUshort(i,s);s+=2;var p=f>>>8;if((p&=15)!=0)throw"unknown kern table format: "+p;s=e.kern.readFormat0(i,s,d)}return d},e.kern.parseV1=function(i,s,o,a){var l=e._bin;l.readFixed(i,s),s+=4;var c=l.readUint(i,s);s+=4;for(var u={glyph1:[],rval:[]},d=0;d<c;d++){l.readUint(i,s),s+=4;var h=l.readUshort(i,s);s+=2,l.readUshort(i,s),s+=2;var f=h>>>8;if((f&=15)!=0)throw"unknown kern table format: "+f;s=e.kern.readFormat0(i,s,u)}return u},e.kern.readFormat0=function(i,s,o){var a=e._bin,l=-1,c=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2;for(var u=0;u<c;u++){var d=a.readUshort(i,s);s+=2;var h=a.readUshort(i,s);s+=2;var f=a.readShort(i,s);s+=2,d!=l&&(o.glyph1.push(d),o.rval.push({glyph2:[],vals:[]}));var p=o.rval[o.rval.length-1];p.glyph2.push(h),p.vals.push(f),l=d}return s},e.loca={},e.loca.parse=function(i,s,o,a){var l=e._bin,c=[],u=a.head.indexToLocFormat,d=a.maxp.numGlyphs+1;if(u==0)for(var h=0;h<d;h++)c.push(l.readUshort(i,s+(h<<1))<<1);if(u==1)for(h=0;h<d;h++)c.push(l.readUint(i,s+(h<<2)));return c},e.maxp={},e.maxp.parse=function(i,s,o){var a=e._bin,l={},c=a.readUint(i,s);return s+=4,l.numGlyphs=a.readUshort(i,s),s+=2,c==65536&&(l.maxPoints=a.readUshort(i,s),s+=2,l.maxContours=a.readUshort(i,s),s+=2,l.maxCompositePoints=a.readUshort(i,s),s+=2,l.maxCompositeContours=a.readUshort(i,s),s+=2,l.maxZones=a.readUshort(i,s),s+=2,l.maxTwilightPoints=a.readUshort(i,s),s+=2,l.maxStorage=a.readUshort(i,s),s+=2,l.maxFunctionDefs=a.readUshort(i,s),s+=2,l.maxInstructionDefs=a.readUshort(i,s),s+=2,l.maxStackElements=a.readUshort(i,s),s+=2,l.maxSizeOfInstru
4591ctions=a.readUshort(i,s),s+=2,l.maxComponentElements=a.readUshort(i,s),s+=2,l.maxComponentDepth=a.readUshort(i,s),s+=2),l},e.name={},e.name.parse=function(i,s,o){var a=e._bin,l={};a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2,a.readUshort(i,s);for(var u,d=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],h=s+=2,f=0;f<c;f++){var p=a.readUshort(i,s);s+=2;var m=a.readUshort(i,s);s+=2;var g=a.readUshort(i,s);s+=2;var v=a.readUshort(i,s);s+=2;var y=a.readUshort(i,s);s+=2;var _=a.readUshort(i,s);s+=2;var x,T=d[v],b=h+12*c+_;if(p==0)x=a.readUnicode(i,b,y/2);else if(p==3&&m==0)x=a.readUnicode(i,b,y/2);else if(m==0)x=a.readASCII(i,b,y);else if(m==1)x=a.readUnicode(i,b,y/2);else if(m==3)x=a.readUnicode(i,b,y/2);else{if(p!=1)throw"unknown encoding "+m+", platformID: "+p;x=a.readASCII(i,b,y),console.debug("reading unknown MAC encoding "+m+" as ASCII")}var M="p"+p+","+g.toString(16);l[M]==null&&(l[M]={}),l[M][T!==void 0?T:v]=x,l[M]._lang=g}for(var E in l)if(l[E].postScriptName!=null&&l[E]._lang==1033)return l[E];for(var E in l)if(l[E].postScriptName!=null&&l[E]._lang==0)return l[E];for(var E in l)if(l[E].postScriptName!=null&&l[E]._lang==3084)return l[E];for(var E in l)if(l[E].postScriptName!=null)return l[E];for(var E in l){u=E;break}return console.debug("returning name table with languageID "+l[u]._lang),l[u]},e["OS/2"]={},e["OS/2"].parse=function(i,s,o){var a=e._bin.readUshort(i,s);s+=2;var l={};if(a==0)e["OS/2"].version0(i,s,l);else if(a==1)e["OS/2"].version1(i,s,l);else if(a==2||a==3||a==4)e["OS/2"].version2(i,s,l);else{if(a!=5)throw"unknown OS/2 table version: "+a;e["OS/2"].version5(i,s,l)}return l},e["OS/2"].version0=function(i,s,o){var a=e._bin;return o.xAvgCharWidth=a.readShort(i,s),s+=2,o.usWeightClass=a.readUshort(i,s),s+=2,o.usWidthClass=a.readUshort(i,s),s+=2,o.fsType=a.readUshort(i,s),s+=2,o.ySubscriptXSize=a.readShort(i,s),s+=2,o.ySubscriptYSize=a.readShort(i,s),s+=2,o.ySubscriptXOffset=a.readShort(i,s),s+=2,o.ySubscriptYOffset=a.readShort(i,s),s+=2,o.ySuperscriptXSize=a.readShort(i,s),s+=2,o.ySuperscriptYSize=a.readShort(i,s),s+=2,o.ySuperscriptXOffset=a.readShort(i,s),s+=2,o.ySuperscriptYOffset=a.readShort(i,s),s+=2,o.yStrikeoutSize=a.readShort(i,s),s+=2,o.yStrikeoutPosition=a.readShort(i,s),s+=2,o.sFamilyClass=a.readShort(i,s),s+=2,o.panose=a.readBytes(i,s,10),s+=10,o.ulUnicodeRange1=a.readUint(i,s),s+=4,o.ulUnicodeRange2=a.readUint(i,s),s+=4,o.ulUnicodeRange3=a.readUint(i,s),s+=4,o.ulUnicodeRange4=a.readUint(i,s),s+=4,o.achVendID=[a.readInt8(i,s),a.readInt8(i,s+1),a.readInt8(i,s+2),a.readInt8(i,s+3)],s+=4,o.fsSelection=a.readUshort(i,s),s+=2,o.usFirstCharIndex=a.readUshort(i,s),s+=2,o.usLastCharIndex=a.readUshort(i,s),s+=2,o.sTypoAscender=a.readShort(i,s),s+=2,o.sTypoDescender=a.readShort(i,s),s+=2,o.sTypoLineGap=a.readShort(i,s),s+=2,o.usWinAscent=a.readUshort(i,s),s+=2,o.usWinDescent=a.readUshort(i,s),s+=2},e["OS/2"].version1=function(i,s,o){var a=e._bin;return s=e["OS/2"].version0(i,s,o),o.ulCodePageRange1=a.readUint(i,s),s+=4,o.ulCodePageRange2=a.readUint(i,s),s+=4},e["OS/2"].version2=function(i,s,o){var a=e._bin;return s=e["OS/2"].version1(i,s,o),o.sxHeight=a.readShort(i,s),s+=2,o.sCapHeight=a.readShort(i,s),s+=2,o.usDefault=a.readUshort(i,s),s+=2,o.usBreak=a.readUshort(i,s),s+=2,o.usMaxContext=a.readUshort(i,s),s+=2},e["OS/2"].version5=function(i,s,o){var a=e._bin;return s=e["OS/2"].version2(i,s,o),o.usLowerOpticalPointSize=a.readUshort(i,s),s+=2,o.usUpperOpticalPointSize=a.readUshort(i,s),s+=2},e.post={},e.post.parse=function(i,s,o){var a=e._bin,l={};return l.version=a.readFixed(i,s),s+=4,l.italicAngle=a.readFixed(i,s),s+=4,l.underlinePosition=a.readShort(i,s),s+=2,l.underlineThickness=a.readShort(i,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(i,s){var o=i.cmap,a=-1;if(o.p0e4!=null?a=o.p0e4:o.p3e1!=null?a=o.p3e1:o.p1e0!=null?a=o.p1e0:o.p0e3!=null&&(a=o.p0e3),a==-1)throw"no familiar platform and encoding!";var l=o.tables[a];if(l.format==0)return s>=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,u=0;u<l.endCount.length;u++)if(s<=l.endCount[u]){c=u;break}return c==-1||l.startCount[c]>s?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(u=0;
4591u<l.groups.length;u++){var d=l.groups[u];if(d[0]<=s&&s<=d[1])return d[2]+(s-d[0])}return 0}throw"unknown cmap table format "+l.format},e.U.glyphToPath=function(i,s){var o={cmds:[],crds:[]};if(i.SVG&&i.SVG.entries[s]){var a=i.SVG.entries[s];return a==null?o:(typeof a=="string"&&(a=e.SVG.toPath(a),i.SVG.entries[s]=a),a)}if(i.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:i.CFF.Private?i.CFF.Private.defaultWidthX:0,open:!1},c=i.CFF,u=i.CFF.Private;if(c.ROS){for(var d=0;c.FDSelect[d+2]<=s;)d+=2;u=c.FDArray[c.FDSelect[d+1]].Private}e.U._drawCFF(i.CFF.CharStrings[s],l,c,u,o)}else i.glyf&&e.U._drawGlyf(s,i,o);return o},e.U._drawGlyf=function(i,s,o){var a=s.glyf[i];a==null&&(a=s.glyf[i]=e.glyf._parseGlyf(s,i)),a!=null&&(a.noc>-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(i,s){for(var o=0;o<i.noc;o++){for(var a=o==0?0:i.endPts[o-1]+1,l=i.endPts[o],c=a;c<=l;c++){var u=c==a?l:c-1,d=c==l?a:c+1,h=1&i.flags[c],f=1&i.flags[u],p=1&i.flags[d],m=i.xs[c],g=i.ys[c];if(c==a)if(h){if(!f){e.U.P.moveTo(s,m,g);continue}e.U.P.moveTo(s,i.xs[u],i.ys[u])}else f?e.U.P.moveTo(s,i.xs[u],i.ys[u]):e.U.P.moveTo(s,(i.xs[u]+m)/2,(i.ys[u]+g)/2);h?f&&e.U.P.lineTo(s,m,g):p?e.U.P.qcurveTo(s,m,g,i.xs[d],i.ys[d]):e.U.P.qcurveTo(s,m,g,(m+i.xs[d])/2,(g+i.ys[d])/2)}e.U.P.closePath(s)}},e.U._compoGlyph=function(i,s,o){for(var a=0;a<i.parts.length;a++){var l={cmds:[],crds:[]},c=i.parts[a];e.U._drawGlyf(c.glyphIndex,s,l);for(var u=c.m,d=0;d<l.crds.length;d+=2){var h=l.crds[d],f=l.crds[d+1];o.crds.push(h*u.a+f*u.b+u.tx),o.crds.push(h*u.c+f*u.d+u.ty)}for(d=0;d<l.cmds.length;d++)o.cmds.push(l.cmds[d])}},e.U._getGlyphClass=function(i,s){var o=e._lctf.getInterval(s,i);return o==-1?0:s[o+2]},e.U._applySubs=function(i,s,o,a){for(var l=i.length-s-1,c=0;c<o.tabs.length;c++)if(o.tabs[c]!=null){var u,d=o.tabs[c];if(!d.coverage||(u=e._lctf.coverageIndex(d.coverage,i[s]))!=-1){if(o.ltype==1)i[s],d.fmt==1?i[s]=i[s]+d.delta:i[s]=d.newg[u];else if(o.ltype==4)for(var h=d.vals[u],f=0;f<h.length;f++){var p=h[f],m=p.chain.length;if(!(m>l)){for(var g=!0,v=0,y=0;y<m;y++){for(;i[s+v+(1+y)]==-1;)v++;p.chain[y]!=i[s+v+(1+y)]&&(g=!1)}if(g){for(i[s]=p.nglyph,y=0;y<m+v;y++)i[s+y+1]=-1;break}}}else if(o.ltype==5&&d.fmt==2)for(var _=e._lctf.getInterval(d.cDef,i[s]),x=d.cDef[_+2],T=d.scset[x],b=0;b<T.length;b++){var M=T[b],E=M.input;if(!(E.length>l)){for(g=!0,y=0;y<E.length;y++){var S=e._lctf.getInterval(d.cDef,i[s+1+y]);if(_==-1&&d.cDef[S+2]!=E[y]){g=!1;break}}if(g){var w=M.substLookupRecords;for(f=0;f<w.length;f+=2)w[f],w[f+1]}}}else if(o.ltype==6&&d.fmt==3){if(!e.U._glsCovered(i,d.backCvg,s-d.backCvg.length)||!e.U._glsCovered(i,d.inptCvg,s)||!e.U._glsCovered(i,d.ahedCvg,s+d.inptCvg.length))continue;var D=d.lookupRec;for(b=0;b<D.length;b+=2){_=D[b];var R=a[D[b+1]];e.U._applySubs(i,s+_,R,a)}}}}},e.U._glsCovered=function(i,s,o){for(var a=0;a<s.length;a++)if(e._lctf.coverageIndex(s[a],i[o+a])==-1)return!1;return!0},e.U.glyphsToPath=function(i,s,o){for(var a={cmds:[],crds:[]},l=0,c=0;c<s.length;c++){var u=s[c];if(u!=-1){for(var d=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,h=e.U.glyphToPath(i,u),f=0;f<h.crds.length;f+=2)a.crds.push(h.crds[f]+l),a.crds.push(h.crds[f+1]);for(o&&a.cmds.push(o),f=0;f<h.cmds.length;f++)a.cmds.push(h.cmds[f]);o&&a.cmds.push("X"),l+=i.hmtx.aWidth[u],c<s.length-1&&(l+=e.U.getPairAdjustment(i,u,d))}}return a},e.U.P={},e.U.P.moveTo=function(i,s,o){i.cmds.push("M"),i.crds.push(s,o)},e.U.P.lineTo=function(i,s,o){i.cmds.push("L"),i.crds.push(s,o)},e.U.P.curveTo=function(i,s,o,a,l,c,u){i.cmds.push("C"),i.crds.push(s,o,a,l,c,u)},e.U.P.qcurveTo=function(i,s,o,a,l){i.cmds.push("Q"),i.crds.push(s,o,a,l)},e.U.P.closePath=function(i){i.cmds.push("Z")},e.U._drawCFF=function(i,s,o,a,l){for(var c=s.stack,u=s.nStems,d=s.haveWidth,h=s.width,f=s.open,p=0,m=s.x,g=s.y,v=0,y=0,_=0,x=0,T=0,b=0,M=0,E=0,S=0,w=0,D={val:0,size:0};p<i.length;){e.CFF.getCharString(i,p,D);var R=D.val;if(p+=D.size,R=="o1"||R=="o18")c.length%2!=0&&!d&&(h=c.shift()+a.nominalWidthX),u+=c.length>>1,c.length=0,d=!0;else if(R=="o3"||R=="o23")c.length%2!=0&&!d&&(h=c.shift()+a.nominalWidthX),u+=c.length>>1,c.length=0,d=!0;else if(R=="o4")c.length>1&&!d&&(h=c.shift()+a.nominalWidthX,d=!0),f&&e.U.P.closePath(l),g+=c.pop(),e.U.P.moveTo(l,m,g),f=!0;else if(R=="o5")for(;c.length>0;)m+=c.shift(),g+=c.shift(),e.U.P.lineTo(l,m,g);else if(R=="o6"||R=="o7")for(var k=c.length,N=R=="o6",H=0;H<k;H++){var P=c.shift();
4591N?m+=P:g+=P,N=!N,e.U.P.lineTo(l,m,g)}else if(R=="o8"||R=="o24"){k=c.length;for(var ee=0;ee+6<=k;)v=m+c.shift(),y=g+c.shift(),_=v+c.shift(),x=y+c.shift(),m=_+c.shift(),g=x+c.shift(),e.U.P.curveTo(l,v,y,_,x,m,g),ee+=6;R=="o24"&&(m+=c.shift(),g+=c.shift(),e.U.P.lineTo(l,m,g))}else{if(R=="o11")break;if(R=="o1234"||R=="o1235"||R=="o1236"||R=="o1237")R=="o1234"&&(y=g,_=(v=m+c.shift())+c.shift(),w=x=y+c.shift(),b=x,E=g,m=(M=(T=(S=_+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,v,y,_,x,S,w),e.U.P.curveTo(l,T,b,M,E,m,g)),R=="o1235"&&(v=m+c.shift(),y=g+c.shift(),_=v+c.shift(),x=y+c.shift(),S=_+c.shift(),w=x+c.shift(),T=S+c.shift(),b=w+c.shift(),M=T+c.shift(),E=b+c.shift(),m=M+c.shift(),g=E+c.shift(),c.shift(),e.U.P.curveTo(l,v,y,_,x,S,w),e.U.P.curveTo(l,T,b,M,E,m,g)),R=="o1236"&&(v=m+c.shift(),y=g+c.shift(),_=v+c.shift(),w=x=y+c.shift(),b=x,M=(T=(S=_+c.shift())+c.shift())+c.shift(),E=b+c.shift(),m=M+c.shift(),e.U.P.curveTo(l,v,y,_,x,S,w),e.U.P.curveTo(l,T,b,M,E,m,g)),R=="o1237"&&(v=m+c.shift(),y=g+c.shift(),_=v+c.shift(),x=y+c.shift(),S=_+c.shift(),w=x+c.shift(),T=S+c.shift(),b=w+c.shift(),M=T+c.shift(),E=b+c.shift(),Math.abs(M-m)>Math.abs(E-g)?m=M+c.shift():g=E+c.shift(),e.U.P.curveTo(l,v,y,_,x,S,w),e.U.P.curveTo(l,T,b,M,E,m,g));else if(R=="o14"){if(c.length>0&&!d&&(h=c.shift()+o.nominalWidthX,d=!0),c.length==4){var X=c.shift(),Q=c.shift(),Y=c.shift(),z=c.shift(),K=e.CFF.glyphBySE(o,Y),te=e.CFF.glyphBySE(o,z);e.U._drawCFF(o.CharStrings[K],s,o,a,l),s.x=X,s.y=Q,e.U._drawCFF(o.CharStrings[te],s,o,a,l)}f&&(e.U.P.closePath(l),f=!1)}else if(R=="o19"||R=="o20")c.length%2!=0&&!d&&(h=c.shift()+a.nominalWidthX),u+=c.length>>1,c.length=0,d=!0,p+=u+7>>3;else if(R=="o21")c.length>2&&!d&&(h=c.shift()+a.nominalWidthX,d=!0),g+=c.pop(),m+=c.pop(),f&&e.U.P.closePath(l),e.U.P.moveTo(l,m,g),f=!0;else if(R=="o22")c.length>1&&!d&&(h=c.shift()+a.nominalWidthX,d=!0),m+=c.pop(),f&&e.U.P.closePath(l),e.U.P.moveTo(l,m,g),f=!0;else if(R=="o25"){for(;c.length>6;)m+=c.shift(),g+=c.shift(),e.U.P.lineTo(l,m,g);v=m+c.shift(),y=g+c.shift(),_=v+c.shift(),x=y+c.shift(),m=_+c.shift(),g=x+c.shift(),e.U.P.curveTo(l,v,y,_,x,m,g)}else if(R=="o26")for(c.length%2&&(m+=c.shift());c.length>0;)v=m,y=g+c.shift(),m=_=v+c.shift(),g=(x=y+c.shift())+c.shift(),e.U.P.curveTo(l,v,y,_,x,m,g);else if(R=="o27")for(c.length%2&&(g+=c.shift());c.length>0;)y=g,_=(v=m+c.shift())+c.shift(),x=y+c.shift(),m=_+c.shift(),g=x,e.U.P.curveTo(l,v,y,_,x,m,g);else if(R=="o10"||R=="o29"){var O=R=="o10"?a:o;if(c.length==0)console.debug("error: empty stack");else{var U=c.pop(),W=O.Subrs[U+O.Bias];s.x=m,s.y=g,s.nStems=u,s.haveWidth=d,s.width=h,s.open=f,e.U._drawCFF(W,s,o,a,l),m=s.x,g=s.y,u=s.nStems,d=s.haveWidth,h=s.width,f=s.open}}else if(R=="o30"||R=="o31"){var j=c.length,ie=(ee=0,R=="o31");for(ee+=j-(k=-3&j);ee<k;)ie?(y=g,_=(v=m+c.shift())+c.shift(),g=(x=y+c.shift())+c.shift(),k-ee==5?(m=_+c.shift(),ee++):m=_,ie=!1):(v=m,y=g+c.shift(),_=v+c.shift(),x=y+c.shift(),m=_+c.shift(),k-ee==5?(g=x+c.shift(),ee++):g=x,ie=!0),e.U.P.curveTo(l,v,y,_,x,m,g),ee+=4}else{if((R+"").charAt(0)=="o")throw console.debug("Unknown operation: "+R,i),R;c.push(R)}}}s.x=m,s.y=g,s.nStems=u,s.haveWidth=d,s.width=h,s.open=f};var t=e,n={Typr:t};return r.Typr=t,r.default=n,Object.defineProperty(r,"__esModule",{value:!0}),r})({}).Typr}/*!
4592Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate
4593(https://github.com/101arrowz/fflate) for use in Troika text rendering. 
4594Original licenses apply: 
4595- fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT)
4596- woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2)
4597*/function bO(){return(function(r){var e=Uint8Array,t=Uint16Array,n=Uint32Array,i=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),o=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(R,k){for(var N=new t(31),H=0;H<31;++H)N[H]=k+=1<<R[H-1];var P=new n(N[30]);for(H=1;H<30;++H)for(var ee=N[H];ee<N[H+1];++ee)P[ee]=ee-N[H]<<5|H;return[N,P]},l=a(i,2),c=l[0],u=l[1];c[28]=258,u[258]=28;for(var d=a(s,0)[0],h=new t(32768),f=0;f<32768;++f){var p=(43690&f)>>>1|(21845&f)<<1;p=(61680&(p=(52428&p)>>>2|(13107&p)<<2))>>>4|(3855&p)<<4,h[f]=((65280&p)>>>8|(255&p)<<8)>>>1}var m=function(R,k,N){for(var H=R.length,P=0,ee=new t(k);P<H;++P)++ee[R[P]-1];var X,Q=new t(k);for(P=0;P<k;++P)Q[P]=Q[P-1]+ee[P-1]<<1;{X=new t(1<<k);var Y=15-k;for(P=0;P<H;++P)if(R[P])for(var z=P<<4|R[P],K=k-R[P],te=Q[R[P]-1]++<<K,O=te|(1<<K)-1;te<=O;++te)X[h[te]>>>Y]=z}return X},g=new e(288);for(f=0;f<144;++f)g[f]=8;for(f=144;f<256;++f)g[f]=9;for(f=256;f<280;++f)g[f]=7;for(f=280;f<288;++f)g[f]=8;var v=new e(32);for(f=0;f<32;++f)v[f]=5;var y=m(g,9),_=m(v,5),x=function(R){for(var k=R[0],N=1;N<R.length;++N)R[N]>k&&(k=R[N]);return k},T=function(R,k,N){var H=k/8|0;return(R[H]|R[H+1]<<8)>>(7&k)&N},b=function(R,k){var N=k/8|0;return(R[N]|R[N+1]<<8|R[N+2]<<16)>>(7&k)}
4597,M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(R,k,N){var H=new Error(k||M[R]);if(H.code=R,Error.captureStackTrace&&Error.captureStackTrace(H,E),!N)throw H;return H},S=function(R,k,N){var H=R.length;if(!H||N&&!N.l&&H<5)return k||new e(0);var P=!k||N,ee=!N||N.i;N||(N={}),k||(k=new e(3*H));var X,Q=function(Ye){var it=k.length;if(Ye>it){var Ze=new e(Math.max(2*it,Ye));Ze.set(k),k=Ze}},Y=N.f||0,z=N.p||0,K=N.b||0,te=N.l,O=N.d,U=N.m,W=N.n,j=8*H;do{if(!te){N.f=Y=T(R,z,1);var ie=T(R,z+1,3);if(z+=3,!ie){var de=R[(he=((X=z)/8|0)+(7&X&&1)+4)-4]|R[he-3]<<8,ye=he+de;if(ye>H){ee&&E(0);break}P&&Q(K+de),k.set(R.subarray(he,ye),K),N.b=K+=de,N.p=z=8*ye;continue}if(ie==1)te=y,O=_,U=9,W=5;else if(ie==2){var we=T(R,z,31)+257,_e=T(R,z+10,15)+4,Re=we+T(R,z+5,31)+1;z+=14;for(var F=new e(Re),pe=new e(19),me=0;me<_e;++me)pe[o[me]]=T(R,z+3*me,7);z+=3*_e;var be=x(pe),se=(1<<be)-1,Se=m(pe,be);for(me=0;me<Re;){var he,le=Se[T(R,z,se)];if(z+=15&le,(he=le>>>4)<16)F[me++]=he;else{var He=0,B=0;for(he==16?(B=3+T(R,z,3),z+=2,He=F[me-1]):he==17?(B=3+T(R,z,7),z+=3):he==18&&(B=11+T(R,z,127),z+=7);B--;)F[me++]=He}}var A=F.subarray(0,we),ne=F.subarray(we);U=x(A),W=x(ne),te=m(A,U),O=m(ne,W)}else E(1);if(z>j){ee&&E(0);break}}P&&Q(K+131072);for(var ge=(1<<U)-1,ue=(1<<W)-1,ce=z;;ce=z){var Ne=(He=te[b(R,z)&ge])>>>4;if((z+=15&He)>j){ee&&E(0);break}if(He||E(2),Ne<256)k[K++]=Ne;else{if(Ne==256){ce=z,te=null;break}var De=Ne-254;if(Ne>264){var $e=i[me=Ne-257];De=T(R,z,(1<<$e)-1)+c[me],z+=$e}var Je=O[b(R,z)&ue],Ee=Je>>>4;if(Je||E(3),z+=15&Je,ne=d[Ee],Ee>3&&($e=s[Ee],ne+=b(R,z)&(1<<$e)-1,z+=$e),z>j){ee&&E(0);break}P&&Q(K+131072);for(var Ge=K+De;K<Ge;K+=4)k[K]=k[K-ne],k[K+1]=k[K+1-ne],k[K+2]=k[K+2-ne],k[K+3]=k[K+3-ne];K=Ge}}N.l=te,N.p=ce,N.b=K,te&&(Y=1,N.m=U,N.d=O,N.n=W)}while(!Y);return K==k.length?k:(function(Ye,it,Ze){(Ze==null||Ze>Ye.length)&&(Ze=Ye.length);var ht=new(Ye instanceof t?t:Ye instanceof n?n:e)(Ze-it);return ht.set(Ye.subarray(it,Ze)),ht})(k,0,K)},w=new e(0),D=typeof TextDecoder<"u"&&new TextDecoder;try{D.decode(w,{stream:!0})}catch{}return r.convert_streams=function(R){var k=new DataView(R),N=0;function H(){var we=k.getUint16(N);return N+=2,we}function P(){var we=k.getUint32(N);return N+=4,we}function ee(we){de.setUint16(ye,we),ye+=2}function X(we){de.setUint32(ye,we),ye+=4}for(var Q={signature:P(),flavor:P(),length:P(),numTables:H(),reserved:H(),totalSfntSize:P(),majorVersion:H(),minorVersion:H(),metaOffset:P(),metaLength:P(),metaOrigLength:P(),privOffset:P(),privLength:P()},Y=0;Math.pow(2,Y)<=Q.numTables;)Y++;Y--;for(var z=16*Math.pow(2,Y),K=16*Q.numTables-z,te=12,O=[],U=0;U<Q.numTables;U++)O.push({tag:P(),offset:P(),compLength:P(),origLength:P(),origChecksum:P()}),te+=16;var W,j=new Uint8Array(12+16*O.length+O.reduce((function(we,_e){return we+_e.origLength+4}),0)),ie=j.buffer,de=new DataView(ie),ye=0;return X(Q.flavor),ee(Q.numTables),ee(z),ee(Y),ee(K),O.forEach((function(we){X(we.tag),X(we.origChecksum),X(te),X(we.origLength),we.outOffset=te,(te+=we.origLength)%4!=0&&(te+=4-te%4)})),O.forEach((function(we){var _e,Re=R.slice(we.offset,we.offset+we.compLength);if(we.compLength!=we.origLength){var F=new Uint8Array(we.origLength);_e=new Uint8Array(Re,2),S(_e,F)}else F=new Uint8Array(Re);j.set(F,we.outOffset);var pe=0;(te=we.outOffset+we.origLength)%4!=0&&(pe=4-te%4),j.set(new Uint8Array(pe).buffer,we.outOffset+we.origLength),W=te+pe})),ie.slice(0,W)},Object.defineProperty(r,"__esModule",{value:!0}),r})({}).convert_streams}function wO(r,e){const t={M:2,L:2,Q:4,C:6,Z:0},n={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},i=1,s=2,o=4,a=8,l=16,c=32;let u;function d(M){if(!u){const E={R:s,L:i,D:o,C:l,U:c,T:a};u=new Map;for(let S in n){let w=0;n[S].split(",").forEach(D=>{let[R,k]=D.split("+");R=parseInt(R,36),k=k?parseInt(k,36):0,u.set(w+=R,E[S]);for(let N=k;N--;)u.set(++w,E[S])})}}return u.get(M)||c}const h=1,f=2,p=3,m=4,g=[null,"isol","init","fina","medi"];function v(M){const E=new Uint8Array(M.length);let S=c,w=h,D=-1;for(let R=0;R<M.length;R++){const k=M.codePointAt(R);
4597let N=d(k)|0,H=h;N&a||(S&(i|o|l)?N&(s|o|l)?(H=p,(w===h||w===p)&&E[D]++):N&(i|c)&&(w===f||w===m)&&E[D]--:S&(s|c)&&(w===f||w===m)&&E[D]--,w=E[R]=H,S=N,D=R,k>65535&&R++)}return E}function y(M,E){const S=[];for(let D=0;D<E.length;D++){const R=E.codePointAt(D);R>65535&&D++,S.push(r.U.codeToGlyph(M,R))}const w=M.GSUB;if(w){const{lookupList:D,featureList:R}=w;let k;const N=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,H=[];R.forEach(P=>{if(N.test(P.tag))for(let ee=0;ee<P.tab.length;ee++){if(H[P.tab[ee]])continue;H[P.tab[ee]]=!0;const X=D[P.tab[ee]],Q=/^(isol|init|fina|medi)$/.test(P.tag);Q&&!k&&(k=v(E));for(let Y=0;Y<S.length;Y++)(!k||!Q||g[k[Y]]===P.tag)&&r.U._applySubs(S,Y,X,D)}})}return S}function _(M,E){const S=new Int16Array(E.length*3);let w=0;for(;w<E.length;w++){const N=E[w];if(N===-1)continue;S[w*3+2]=M.hmtx.aWidth[N];const H=M.GPOS;if(H){const P=H.lookupList;for(let ee=0;ee<P.length;ee++){const X=P[ee];for(let Q=0;Q<X.tabs.length;Q++){const Y=X.tabs[Q];if(X.ltype===1){if(r._lctf.coverageIndex(Y.coverage,N)!==-1&&Y.pos){k(Y.pos,w);break}}else if(X.ltype===2){let z=null,K=D();if(K!==-1){const te=r._lctf.coverageIndex(Y.coverage,E[K]);if(te!==-1){if(Y.fmt===1){const O=Y.pairsets[te];for(let U=0;U<O.length;U++)O[U].gid2===N&&(z=O[U])}else if(Y.fmt===2){const O=r.U._getGlyphClass(E[K],Y.classDef1),U=r.U._getGlyphClass(N,Y.classDef2);z=Y.matrix[O][U]}if(z){z.val1&&k(z.val1,K),z.val2&&k(z.val2,w);break}}}}else if(X.ltype===4){const z=r._lctf.coverageIndex(Y.markCoverage,N);if(z!==-1){const K=D(R),te=K===-1?-1:r._lctf.coverageIndex(Y.baseCoverage,E[K]);if(te!==-1){const O=Y.markArray[z],U=Y.baseArray[te][O.markClass];S[w*3]=U.x-O.x+S[K*3]-S[K*3+2],S[w*3+1]=U.y-O.y+S[K*3+1];break}}}else if(X.ltype===6){const z=r._lctf.coverageIndex(Y.mark1Coverage,N);if(z!==-1){const K=D();if(K!==-1){const te=E[K];if(x(M,te)===3){const O=r._lctf.coverageIndex(Y.mark2Coverage,te);if(O!==-1){const U=Y.mark1Array[z],W=Y.mark2Array[O][U.markClass];S[w*3]=W.x-U.x+S[K*3]-S[K*3+2],S[w*3+1]=W.y-U.y+S[K*3+1];break}}}}}}}}else if(M.kern&&!M.cff){const P=D();if(P!==-1){const ee=M.kern.glyph1.indexOf(E[P]);if(ee!==-1){const X=M.kern.rval[ee].glyph2.indexOf(N);X!==-1&&(S[P*3+2]+=M.kern.rval[ee].vals[X])}}}}return S;function D(N){for(let H=w-1;H>=0;H--)if(E[H]!==-1&&(!N||N(E[H])))return H;return-1}function R(N){return x(M,N)===1}function k(N,H){for(let P=0;P<3;P++)S[H*3+P]+=N[P]||0}}function x(M,E){const S=M.GDEF&&M.GDEF.glyphClassDef;return S?r.U._getGlyphClass(E,S):0}function T(...M){for(let E=0;E<M.length;E++)if(typeof M[E]=="number")return M[E]}function b(M){const E=Object.create(null),S=M["OS/2"],w=M.hhea,D=M.head.unitsPerEm,R=T(S&&S.sTypoAscender,w&&w.ascender,D),k={unitsPerEm:D,ascender:R,descender:T(S&&S.sTypoDescender,w&&w.descender,0),capHeight:T(S&&S.sCapHeight,R),xHeight:T(S&&S.sxHeight,R),lineGap:T(S&&S.sTypoLineGap,w&&w.lineGap),supportsCodePoint(N){return r.U.codeToGlyph(M,N)>0},forEachGlyph(N,H,P,ee){let X=0;const Q=1/k.unitsPerEm*H,Y=y(M,N);let z=0;const K=_(M,Y);return Y.forEach((te,O)=>{if(te!==-1){let U=E[te];if(!U){const{cmds:W,crds:j}=r.U.glyphToPath(M,te);let ie="",de=0;for(let F=0,pe=W.length;F<pe;F++){const me=t[W[F]];ie+=W[F];for(let be=1;be<=me;be++)ie+=(be>1?",":"")+j[de++]}let ye,we,_e,Re;if(j.length){ye=we=1/0,_e=Re=-1/0;for(let F=0,pe=j.length;F<pe;F+=2){let me=j[F],be=j[F+1];me<ye&&(ye=me),be<we&&(we=be),me>_e&&(_e=me),be>Re&&(Re=be)}}else ye=_e=we=Re=0;U=E[te]={index:te,advanceWidth:M.hmtx.aWidth[te],xMin:ye,yMin:we,xMax:_e,yMax:Re,path:ie}}ee.call(null,U,X+K[O*3]*Q,K[O*3+1]*Q,z),X+=K[O*3+2]*Q,P&&(X+=P*H)}z+=N.codePointAt(z)>65535?2:1}),X}};return k}return function(E){const S=new Uint8Array(E,0,4),w=r._bin.readASCII(S,0,4);if(w==="wOFF")E=e(E);else if(w==="wOF2")throw new Error("woff2 fonts not supported");return b(r.parse(E)[0])}}const SO=yc({name:"Typr Font Parser",dependencies:[xO,bO,wO],init(r,e,t){const n=r(),i=e();return t(n,i)}});/*!
4598Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver)
4599for use in Troika text rendering. 
4600Original MIT license applies
4601*/function MO(){return(function(r){var e=function(){this.buckets=new Map};e.prototype.add=function(_){var x=_>>5;this.buckets.set(x,(this.buckets.get(x)||0)|1<<(31&_))},e.prototype.has=function(_){var x=this.buckets.get(_>>5);return x!==void 0&&(x&1<<(31&_))!=0},e.prototype.serialize=function(){var _=[];return this.buckets.forEach((function(x,T){_.push((+T).toString(36)+":"+x.toString(36))})),_.join(",")},e.prototype.deserialize=function(_){var x=this;this.buckets.clear(),_.split(",").forEach((function(T){var b=T.split(":");x.buckets.set(parseInt(b[0],36),parseInt(b[1],36))}))};var t=Math.pow(2,8),n=t-1,i=~n;function s(_){var x=(function(b){return b&i})(_).toString(16),T=(function(b){return(b&i)+t-1})(_).toString(16);return"codepoint-index/plane"+(_>>16)+"/"+x+"-"+T+".json"}function o(_,x){var T=_&n,b=x.codePointAt(T/6|0);return((b=(b||48)-48)&1<<T%6)!=0}function a(_,x){var T;(T=_,T.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(b){return b.split("-").map((function(M){return parseInt(M.trim(),16)}))}))).forEach((function(b){var M=b[0],E=b[1];E===void 0&&(E=M),x(M,E)}))}function l(_,x){a(_,(function(T,b){for(var M=T;M<=b;M++)x(M)}))}var c={},u={},d=new WeakMap,h="https://cdn.jsdelivr.net/gh/lojjic/[email protected]/packages/data";function f(_){var x=d.get(_);return x||(x=new e,l(_.ranges,(function(T){return x.add(T)})),d.set(_,x)),x}var p,m=new Map;function g(_,x,T){return _[x]?x:_[T]?T:(function(b){for(var M in b)return M})(_)}function v(_,x){var T=x;if(!_.includes(T)){T=1/0;for(var b=0;b<_.length;b++)Math.abs(_[b]-x)<Math.abs(T-x)&&(T=_[b])}return T}function y(_){return p||(p=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(x){p.add(x)}))),p.has(_)}return r.CodePointSet=e,r.clearCache=function(){c={},u={}},r.getFontsForString=function(_,x){x===void 0&&(x={});var T,b=x.lang;b===void 0&&(b=new RegExp("\\p{Script=Hangul}
4601","u").test(T=_)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(T)?"ja":"en");var M=x.category;M===void 0&&(M="sans-serif");var E=x.style;E===void 0&&(E="normal");var S=x.weight;S===void 0&&(S=400);var w=(x.dataUrl||h).replace(/\/$/g,""),D=new Map,R=new Uint8Array(_.length),k={},N={},H=new Array(_.length),P=new Map,ee=!1;function X(z){var K=m.get(z);return K||(K=fetch(w+"/"+z).then((function(te){if(!te.ok)throw new Error(te.statusText);return te.json().then((function(O){if(!Array.isArray(O)||O[0]!==1)throw new Error("Incorrect schema version; need 1, got "+O[0]);return O[1]}))})).catch((function(te){if(w!==h)return ee||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+w+'", trying default CDN. '+te.message),ee=!0),w=h,m.delete(z),X(z);throw te})),m.set(z,K)),K}for(var Q=function(z){var K=_.codePointAt(z),te=s(K);H[z]=te,c[te]||P.has(te)||P.set(te,X(te).then((function(O){c[te]=O}))),K>65535&&(z++,Y=z)},Y=0;Y<_.length;Y++)Q(Y);return Promise.all(P.values()).then((function(){P.clear();for(var z=function(te){var O=_.codePointAt(te),U=null,W=c[H[te]],j=void 0;for(var ie in W){var de=N[ie];if(de===void 0&&(de=N[ie]=new RegExp(ie).test(b||"en")),de){for(var ye in j=ie,W[ie])if(o(O,W[ie][ye])){U=ye;break}break}}if(!U){e:for(var we in W)if(we!==j){for(var _e in W[we])if(o(O,W[we][_e])){U=_e;break e}}}U||(console.debug("No font coverage for U+"+O.toString(16)),U="latin"),H[te]=U,u[U]||P.has(U)||P.set(U,X("font-meta/"+U+".json").then((function(Re){u[U]=Re}))),O>65535&&(te++,K=te)},K=0;K<_.length;K++)z(K);return Promise.all(P.values())})).then((function(){for(var z,K=null,te=0;te<_.length;te++){var O=_.codePointAt(te);if(K&&(y(O)||f(K).has(O)))R[te]=R[te-1];else{K=u[H[te]];var U=k[K.id];if(!U){var W=K.typeforms,j=g(W,M,"sans-serif"),ie=g(W[j],E,"normal"),de=v((z=W[j])===null||z===void 0?void 0:z[ie],S);U=k[K.id]=w+"/font-files/"+K.id+"/"+j+"."+ie+"."+de+".woff"}var ye=D.get(U);ye==null&&(ye=D.size,D.set(U,ye)),R[te]=ye}O>65535&&(te++,R[te]=R[te-1])}return{fontUrls:Array.from(D.keys()),chars:R}}))},Object.defineProperty(r,"__esModule",{value:!0}),r})({})}function EO(r,e){const t=Object.create(null),n=Object.create(null);function i(o,a){const l=c=>{console.error(`Failure loading font ${o}`,c)};try{const c=new XMLHttpRequest;c.open("get",o,!0),c.responseType="arraybuffer",c.onload=function(){if(c.status>=400)l(new Error(c.statusText));else if(c.status>0)try{const u=r(c.response);u.src=o,a(u)}catch(u){l(u)}},c.onerror=l,c.send()}catch(c){l(c)}}function s(o,a){let l=t[o];l?a(l):n[o]?n[o].push(a):(n[o]=[a],i(o,c=>{c.src=o,t[o]=c,n[o].forEach(u=>u(c)),delete n[o]}))}return function(o,a,{lang:l,fonts:c=[],style:u="normal",weight:d="normal",unicodeFontsURL:h}={}){const f=new Uint8Array(o.length),p=[];o.length||y();const m=new Map,g=[];if(u!=="italic"&&(u="normal"),typeof d!="number"&&(d=d==="bold"?700:400),c&&!Array.isArray(c)&&(c=[c]),c=c.slice().filter(x=>!x.lang||x.lang.test(l)).reverse(),c.length){let M=0;(function E(S=0){for(let w=S,D=o.length;w<D;w++){const R=o.codePointAt(w);if(M===1&&p[f[w-1]].supportsCodePoint(R)||w>0&&/\s/.test(o[w]))f[w]=f[w-1],M===2&&(g[g.length-1][1]=w);else for(let k=f[w],N=c.length;k<=N;k++)if(k===N){const H=M===2?g[g.length-1]:g[g.length]=[w,w];H[1]=w,M=2}else{f[w]=k;const{src:H,unicodeRange:P}=c[k];if(!P||_(R,P)){const ee=t[H];if(!ee){s(H,()=>{E(w)});return}if(ee.supportsCodePoint(R)){let X=m.get(ee);typeof X!="number"&&(X=p.length,p.push(ee),m.set(ee,X)),f[w]=X,M=1;break}}}R>65535&&w+1<D&&(f[w+1]=f[w],w++,M===2&&(g[g.length-1][1]=w))}v()})()}else g.push([0,o.length-1]),v();function v(){if(g.length){const x=g.map(T=>o.substring(T[0],T[1]+1)).join(`
4602`);e.getFontsForString(x,{lang:l||void 0,style:u,weight:d,dataUrl:h}).then(({fontUrls:T,chars:b})=>{const M=p.length;let E=0;g.forEach(w=>{for(let D=0,R=w[1]-w[0];D<=R;D++)f[w[0]+D]=b[E++]+M;E++});let S=0;T.forEach((w,D)=>{s(w,R=>{p[D+M]=R,++S===T.length&&y()})})})}else y()}function y(){a({chars:f,fonts:p})}function _(x,T){for(let b=0;b<T.length;b++){const[M,E=M]=T[b];if(M<=x&&x<=E)return!0}return!1}}}
4602const TO=yc({name:"FontResolver",dependencies:[EO,SO,MO],init(r,e,t){return r(e,t())}});function AO(r,e){const n=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",s=new RegExp(`${i}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function o({text:p,lang:m,fonts:g,style:v,weight:y,preResolvedFonts:_,unicodeFontsURL:x},T){const b=({chars:M,fonts:E})=>{let S,w;const D=[];for(let R=0;R<M.length;R++)M[R]!==w?(w=M[R],D.push(S={start:R,end:R,fontObj:E[M[R]]})):S.end=R;T(D)};_?b(_):r(p,b,{lang:m,fonts:g,style:v,weight:y,unicodeFontsURL:x})}function a({text:p="",font:m,lang:g,sdfGlyphSize:v=64,fontSize:y=400,fontWeight:_=1,fontStyle:x="normal",letterSpacing:T=0,lineHeight:b="normal",maxWidth:M=1/0,direction:E,textAlign:S="left",textIndent:w=0,whiteSpace:D="normal",overflowWrap:R="normal",anchorX:k=0,anchorY:N=0,metricsOnly:H=!1,unicodeFontsURL:P,preResolvedFonts:ee=null,includeCaretPositions:X=!1,chunkedBoundsSize:Q=8192,colorRanges:Y=null},z){const K=d(),te={fontLoad:0,typesetting:0};p.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),p=p.replace(/\r\n/g,`
4603`).replace(/\r/g,`
4604`)),y=+y,T=+T,M=+M,b=b||"normal",w=+w,o({text:p,lang:g,style:x,weight:_,fonts:typeof m=="string"?[{src:m}]:m,unicodeFontsURL:P,preResolvedFonts:ee},O=>{te.fontLoad=d()-K;const U=isFinite(M);let W=null,j=null,ie=null,de=null,ye=null,we=null,_e=null,Re=null,F=0,pe=0,me=D!=="nowrap";const be=new Map,se=d();let Se=w,he=0,le=new h;const He=[le];O.forEach(ue=>{const{fontObj:ce}=ue,{ascender:Ne,descender:De,unitsPerEm:$e,lineGap:Je,capHeight:Ee,xHeight:Ge}=ce;let Ye=be.get(ce);if(!Ye){const Oe=y/$e,ke=b==="normal"?(Ne-De+Je)*Oe:b*y,Xe=(ke-(Ne-De)*Oe)/2,Me=Math.min(ke,(Ne-De)*Oe),Ce=(Ne+De)/2*Oe+Me/2;Ye={index:be.size,src:ce.src,fontObj:ce,fontSizeMult:Oe,unitsPerEm:$e,ascender:Ne*Oe,descender:De*Oe,capHeight:Ee*Oe,xHeight:Ge*Oe,lineHeight:ke,baseline:-Xe-Ne*Oe,caretTop:Ce,caretBottom:Ce-Me},be.set(ce,Ye)}const{fontSizeMult:it}=Ye,Ze=p.slice(ue.start,ue.end+1);let ht,oe;ce.forEachGlyph(Ze,y,T,(Oe,ke,Xe,Me)=>{ke+=he,Me+=ue.start,ht=ke,oe=Oe;const Ce=p.charAt(Me),nt=Oe.advanceWidth*it,ct=le.count;let dt;if("isEmpty"in Oe||(Oe.isWhitespace=!!Ce&&new RegExp(i).test(Ce),Oe.canBreakAfter=!!Ce&&s.test(Ce),Oe.isEmpty=Oe.xMin===Oe.xMax||Oe.yMin===Oe.yMax||n.test(Ce)),!Oe.isWhitespace&&!Oe.isEmpty&&pe++,me&&U&&!Oe.isWhitespace&&ke+nt+Se>M&&ct){if(le.glyphAt(ct-1).glyphObj.canBreakAfter)dt=new h,Se=-ke;else for(let qt=ct;qt--;)if(qt===0&&R==="break-word"){dt=new h,Se=-ke;break}else if(le.glyphAt(qt).glyphObj.canBreakAfter){dt=le.splitAt(qt+1);const sn=dt.glyphAt(0).x;Se-=sn;for(let vn=dt.count;vn--;)dt.glyphAt(vn).x-=sn;break}dt&&(le.isSoftWrapped=!0,le=dt,He.push(le),F=M)}let ft=le.glyphAt(le.count);ft.glyphObj=Oe,ft.x=ke+Se,ft.y=Xe,ft.width=nt,ft.charIndex=Me,ft.fontData=Ye,Ce===`
4605`&&(le=new h,He.push(le),Se=-(ke+nt+T*y)+w)}),he=ht+oe.advanceWidth*it+T*y});let B=0;He.forEach(ue=>{let ce=!0;for(let Ne=ue.count;Ne--;){const De=ue.glyphAt(Ne);ce&&!De.glyphObj.isWhitespace&&(ue.width=De.x+De.width,ue.width>F&&(F=ue.width),ce=!1);let{lineHeight:$e,capHeight:Je,xHeight:Ee,baseline:Ge}=De.fontData;$e>ue.lineHeight&&(ue.lineHeight=$e);const Ye=Ge-ue.baseline;Ye<0&&(ue.baseline+=Ye,ue.cap+=Ye,ue.ex+=Ye),ue.cap=Math.max(ue.cap,ue.baseline+Je),ue.ex=Math.max(ue.ex,ue.baseline+Ee)}ue.baseline-=B,ue.cap-=B,ue.ex-=B,B+=ue.lineHeight});let A=0,ne=0;if(k&&(typeof k=="number"?A=-k:typeof k=="string"&&(A=-F*(k==="left"?0:k==="center"?.5:k==="right"?1:c(k)))),N&&(typeof N=="number"?ne=-N:typeof N=="string"&&(ne=N==="top"?0:N==="top-baseline"?-He[0].baseline:N==="top-cap"?-He[0].cap:N==="top-ex"?-He[0].ex:N==="middle"?B/2:N==="bottom"?B:N==="bottom-baseline"?-He[He.length-1].baseline:c(N)*B)),!H){const ue=e.getEmbeddingLevels(p,E);W=new Uint16Array(pe),j=new Uint8Array(pe),ie=new Float32Array(pe*2),de={},_e=[1/0,1/0,-1/0,-1/0],Re=[],X&&(we=new Float32Array(p.length*4)),Y&&(ye=new Uint8Array(pe*3));let ce=0,Ne=-1,De=-1,$e,Je;if(He.forEach((Ee,Ge)=>{let{count:Ye,width:it}=Ee;if(Ye>0){let Ze=0;for(let Me=Ye;Me--&&Ee.glyphAt(Me).glyphObj.isWhitespace;)Ze++;let ht=0,oe=0;if(S==="center")ht=(F-it)/2;else if(S==="right")ht=F-it;else if(S==="justify"&&Ee.isSoftWrapped){let Me=0;for(let Ce=Ye-Ze;
4605Ce--;)Ee.glyphAt(Ce).glyphObj.isWhitespace&&Me++;oe=(F-it)/Me}if(oe||ht){let Me=0;for(let Ce=0;Ce<Ye;Ce++){let nt=Ee.glyphAt(Ce);const ct=nt.glyphObj;nt.x+=ht+Me,oe!==0&&ct.isWhitespace&&Ce<Ye-Ze&&(Me+=oe,nt.width+=oe)}}const Oe=e.getReorderSegments(p,ue,Ee.glyphAt(0).charIndex,Ee.glyphAt(Ee.count-1).charIndex);for(let Me=0;Me<Oe.length;Me++){const[Ce,nt]=Oe[Me];let ct=1/0,dt=-1/0;for(let ft=0;ft<Ye;ft++)if(Ee.glyphAt(ft).charIndex>=Ce){let qt=ft,sn=ft;for(;sn<Ye;sn++){let vn=Ee.glyphAt(sn);if(vn.charIndex>nt)break;sn<Ye-Ze&&(ct=Math.min(ct,vn.x),dt=Math.max(dt,vn.x+vn.width))}for(let vn=qt;vn<sn;vn++){const Cn=Ee.glyphAt(vn);Cn.x=dt-(Cn.x+Cn.width-ct)}break}}let ke;const Xe=Me=>ke=Me;for(let Me=0;Me<Ye;Me++){const Ce=Ee.glyphAt(Me);ke=Ce.glyphObj;const nt=ke.index,ct=ue.levels[Ce.charIndex]&1;if(ct){const dt=e.getMirroredCharacter(p[Ce.charIndex]);dt&&Ce.fontData.fontObj.forEachGlyph(dt,0,0,Xe)}if(X){const{charIndex:dt,fontData:ft}=Ce,qt=Ce.x+A,sn=Ce.x+Ce.width+A;we[dt*4]=ct?sn:qt,we[dt*4+1]=ct?qt:sn,we[dt*4+2]=Ee.baseline+ft.caretBottom+ne,we[dt*4+3]=Ee.baseline+ft.caretTop+ne;const vn=dt-Ne;vn>1&&u(we,Ne,vn),Ne=dt}if(Y){const{charIndex:dt}=Ce;for(;dt>De;)De++,Y.hasOwnProperty(De)&&(Je=Y[De])}if(!ke.isWhitespace&&!ke.isEmpty){const dt=ce++,{fontSizeMult:ft,src:qt,index:sn}=Ce.fontData,vn=de[qt]||(de[qt]={});vn[nt]||(vn[nt]={path:ke.path,pathBounds:[ke.xMin,ke.yMin,ke.xMax,ke.yMax]});const Cn=Ce.x+A,On=Ce.y+Ee.baseline+ne;ie[dt*2]=Cn,ie[dt*2+1]=On;const fi=Cn+ke.xMin*ft,zi=On+ke.yMin*ft,Vi=Cn+ke.xMax*ft,pi=On+ke.yMax*ft;fi<_e[0]&&(_e[0]=fi),zi<_e[1]&&(_e[1]=zi),Vi>_e[2]&&(_e[2]=Vi),pi>_e[3]&&(_e[3]=pi),dt%Q===0&&($e={start:dt,end:dt,rect:[1/0,1/0,-1/0,-1/0]},Re.push($e)),$e.end++;const Fn=$e.rect;if(fi<Fn[0]&&(Fn[0]=fi),zi<Fn[1]&&(Fn[1]=zi),Vi>Fn[2]&&(Fn[2]=Vi),pi>Fn[3]&&(Fn[3]=pi),W[dt]=nt,j[dt]=sn,Y){const Di=dt*3;ye[Di]=Je>>16&255,ye[Di+1]=Je>>8&255,ye[Di+2]=Je&255}}}}}),we){const Ee=p.length-Ne;Ee>1&&u(we,Ne,Ee)}}const ge=[];be.forEach(({index:ue,src:ce,unitsPerEm:Ne,ascender:De,descender:$e,lineHeight:Je,capHeight:Ee,xHeight:Ge})=>{ge[ue]={src:ce,unitsPerEm:Ne,ascender:De,descender:$e,lineHeight:Je,capHeight:Ee,xHeight:Ge}}),te.typesetting=d()-se,z({glyphIds:W,glyphFontIndices:j,glyphPositions:ie,glyphData:de,fontData:ge,caretPositions:we,glyphColors:ye,chunkedBounds:Re,fontSize:y,topBaseline:ne+He[0].baseline,blockBounds:[A,ne-B,A+F,ne],visibleBounds:_e,timings:te})})}function l(p,m){a({...p,metricsOnly:!0},g=>{const[v,y,_,x]=g.blockBounds;m({width:_-v,height:x-y})})}function c(p){let m=p.match(/^([\d.]+)%$/),g=m?parseFloat(m[1]):NaN;return isNaN(g)?0:g/100}function u(p,m,g){const v=p[m*4],y=p[m*4+1],_=p[m*4+2],x=p[m*4+3],T=(y-v)/g;for(let b=0;b<g;b++){const M=(m+b)*4;p[M]=v+T*b,p[M+1]=v+T*(b+1),p[M+2]=_,p[M+3]=x}}function d(){return(self.performance||Date).now()}function h(){this.data=[]}const f=["glyphObj","x","y","width","charIndex","fontData"];return h.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/f.length)},glyphAt(p){let m=h.flyweight;return m.data=this.data,m.index=p,m},splitAt(p){let m=new h;return m.data=this.data.splice(p*f.length),m}},h.flyweight=f.reduce((p,m,g,v)=>(Object.defineProperty(p,m,{get(){return this.data[this.index*f.length+g]},set(y){this.data[this.index*f.length+g]=y}}),p),{data:null,index:0}),{typeset:a,measure:l}}const Ua=()=>(self.performance||Date).now(),Hm=VM();let gw;function CO(r,e,t,n,i,s,o,a,l,c,u=!0){return u?PO(r,e,t,n,i,s,o,a,l,c).then(null,d=>(gw||(console.warn("WebGL SDF generation failed, falling back to JS",d),gw=!0),yw(r,e,t,n,i,s,o,a,l,c))):yw(r,e,t,n,i,s,o,a,l,c)}const Pf=[],RO=5;let $v=0;function HM(){const r=Ua();for(;Pf.length&&Ua()-r<RO;)Pf.shift()();$v=Pf.length?setTimeout(HM,0):0}const PO=(...r)=>new Promise((e,t)=>{Pf.push(()=>{const n=Ua();try{Hm.webgl.generateIntoCanvas(...r),e({timing:Ua()-n})}catch(i){t(i)}}),$v||($v=setTimeout(HM,0))}),IO=4,DO=2e3,vw={};let LO=0;function yw(r,e,t,n,i,s,o,a,l,c){const u="TroikaTextSDFGenerator_JS_"+LO++%IO;let d=vw[u];
4605return d||(d=vw[u]={workerModule:yc({name:u,workerId:u,dependencies:[VM,Ua],init(h,f){const p=h().javascript.generate;return function(...m){const g=f();return{textureData:p(...m),timing:f()-g}}},getTransferables(h){return[h.textureData.buffer]}}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(r,e,t,n,i,s).then(({textureData:h,timing:f})=>{const p=Ua(),m=new Uint8Array(h.length*4);for(let g=0;g<h.length;g++)m[g*4+c]=h[g];return Hm.webglUtils.renderImageData(o,m,a,l,r,e,1<<3-c),f+=Ua()-p,--d.requests===0&&(d.idleTimer=setTimeout(()=>{uO(u)},DO)),{timing:f}})}function kO(r){r._warm||(Hm.webgl.isSupported(r),r._warm=!0)}const UO=Hm.webglUtils.resizeWebGLCanvasWithoutClearing,$c={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},NO=new st;function wl(){return(self.performance||Date).now()}const _w=Object.create(null);function WM(r,e){r=BO({},r);const t=wl(),n=[];if(r.font&&n.push({label:"user",src:zO(r.font)}),r.font=n,r.text=""+r.text,r.sdfGlyphSize=r.sdfGlyphSize||$c.sdfGlyphSize,r.unicodeFontsURL=r.unicodeFontsURL||$c.unicodeFontsURL,r.colorRanges!=null){let h={};for(let f in r.colorRanges)if(r.colorRanges.hasOwnProperty(f)){let p=r.colorRanges[f];typeof p!="number"&&(p=NO.set(p).getHex()),h[f]=p}r.colorRanges=h}Object.freeze(r);const{textureWidth:i,sdfExponent:s}=$c,{sdfGlyphSize:o}=r,a=i/o*4;let l=_w[o];if(!l){const h=document.createElement("canvas");h.width=i,h.height=o*256/a,l=_w[o]={glyphCount:0,sdfGlyphSize:o,sdfCanvas:h,sdfTexture:new Wn(h,void 0,void 0,void 0,ei,ei),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,OO(l)}const{sdfTexture:c,sdfCanvas:u}=l;qM(r).then(h=>{const{glyphIds:f,glyphFontIndices:p,fontData:m,glyphPositions:g,fontSize:v,timings:y}=h,_=[],x=new Float32Array(f.length*4);let T=0,b=0;const M=wl(),E=m.map(k=>{let N=l.glyphsByFont.get(k.src);return N||l.glyphsByFont.set(k.src,N=new Map),N});f.forEach((k,N)=>{const H=p[N],{src:P,unitsPerEm:ee}=m[H];let X=E[H].get(k);if(!X){const{path:te,pathBounds:O}=h.glyphData[P][k],U=Math.max(O[2]-O[0],O[3]-O[1])/o*($c.sdfMargin*o+.5),W=l.glyphCount++,j=[O[0]-U,O[1]-U,O[2]+U,O[3]+U];E[H].set(k,X={path:te,atlasIndex:W,sdfViewBox:j}),_.push(X)}const{sdfViewBox:Q}=X,Y=g[b++],z=g[b++],K=v/ee;x[T++]=Y+Q[0]*K,x[T++]=z+Q[1]*K,x[T++]=Y+Q[2]*K,x[T++]=z+Q[3]*K,f[N]=X.atlasIndex}),y.quads=(y.quads||0)+(wl()-M);const S=wl();y.sdf={};const w=u.height,D=Math.ceil(l.glyphCount/a),R=Math.pow(2,Math.ceil(Math.log2(D*o)));R>w&&(console.info(`Increasing SDF texture size ${w}->${R}`),UO(u,i,R),c.dispose()),Promise.all(_.map(k=>jM(k,l,r.gpuAccelerateSDF).then(({timing:N})=>{y.sdf[k.atlasIndex]=N}))).then(()=>{_.length&&!l.contextLost&&(XM(l),c.needsUpdate=!0),y.sdfTotal=wl()-S,y.total=wl()-t,e(Object.freeze({parameters:r,sdfTexture:c,sdfGlyphSize:o,sdfExponent:s,glyphBounds:x,glyphAtlasIndices:f,glyphColors:h.glyphColors,caretPositions:h.caretPositions,chunkedBounds:h.chunkedBounds,ascender:h.ascender,descender:h.descender,lineHeight:h.lineHeight,capHeight:h.capHeight,xHeight:h.xHeight,topBaseline:h.topBaseline,blockBounds:h.blockBounds,visibleBounds:h.visibleBounds,timings:h.timings}))})}),Promise.resolve().then(()=>{l.contextLost||kO(u)})}function jM({path:r,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:n,sdfCanvas:i,contextLost:s},o){if(s)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:l}=$c,c=Math.max(t[2]-t[0],t[3]-t[1]),u=Math.floor(e/4),d=u%(a/n)*n,h=Math.floor(u/(a/n))*n,f=e%4;return CO(n,n,r,t,c,l,i,d,h,f,o)}function OO(r){const e=r.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),r.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),r.contextLost=!1;const n=[];r.glyphsByFont.forEach(i=>{i.forEach(s=>{n.push(jM(s,r,!0))})}),Promise.all(n).then(()=>{XM(r),r.sdfTexture.needsUpdate=!0})})}function FO({font:r,characters:e,sdfGlyphSize:t},n){let i=Array.isArray(e)?e.join(`
4606`):""+e;WM({font:r,sdfGlyphSize:t,text:i},n)}function BO(r,e){for(let t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}let sf;function zO(r){return sf||(sf=typeof document>"u"?{}:document.createElement("a")),sf.href=r,sf.href}function XM(r){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=r,{width:n,height:i}=e,s=r.sdfCanvas.getContext("webgl");let o=t.image.data;(!o||o.length!==n*i*4)&&(o=new Uint8Array(n*i*4),t.image={width:n,height:i,data:o},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,n,i,s.RGBA,s.UNSIGNED_BYTE,o)}}
4606const VO=yc({name:"Typesetter",dependencies:[AO,TO,hO],init(r,e,t){return r(e,t())}}),qM=yc({name:"Typesetter",dependencies:[VO],init(r){return function(e){return new Promise(t=>{r.typeset(e,t)})}},getTransferables(r){const e=[];for(let t in r)r[t]&&r[t].buffer&&e.push(r[t].buffer);return e}});qM.onMainThread;const xw={};function GO(r){let e=xw[r];return e||(e=xw[r]=new Zs(1,1,r,r).translate(.5,.5,0)),e}const HO="aTroikaGlyphBounds",bw="aTroikaGlyphIndex",WO="aTroikaGlyphColor";class jO extends Fm{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Zn,this.boundingBox=new jn}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=GO(e);["position","normal","uv"].forEach(n=>{this.attributes[n]=t.attributes[n].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,n,i,s){this.updateAttributeData(HO,e,4),this.updateAttributeData(bw,t,1),this.updateAttributeData(WO,s,3),this._blockBounds=n,this._chunkedBounds=i,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:n}=this;if(t){const{PI:i,floor:s,min:o,max:a,sin:l,cos:c}=Math,u=i/2,d=i*2,h=Math.abs(t),f=e[0]/h,p=e[2]/h,m=s((f+u)/d)!==s((p+u)/d)?-h:o(l(f)*h,l(p)*h),g=s((f-u)/d)!==s((p-u)/d)?h:a(l(f)*h,l(p)*h),v=s((f+i)/d)!==s((p+i)/d)?h*2:a(h-c(f)*h,h-c(p)*h);n.min.set(m,e[1],t<0?-v:0),n.max.set(g,e[3],t<0?0:v)}else n.min.set(e[0],e[1],0),n.max.set(e[2],e[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(bw).count,n=this._chunkedBounds;if(n)for(let i=n.length;i--;){t=n[i].end;let s=n[i].rect;if(s[1]<e.w&&s[3]>e.y&&s[0]<e.z&&s[2]>e.x)break}this.instanceCount=t}updateAttributeData(e,t,n){const i=this.getAttribute(e);t?i&&i.array.length===t.length?(i.array.set(t),i.needsUpdate=!0):(this.setAttribute(e,new Ba(t,n)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const XO=`
4607uniform vec2 uTroikaSDFTextureSize;
4608uniform float uTroikaSDFGlyphSize;
4609uniform vec4 uTroikaTotalBounds;
4610uniform vec4 uTroikaClipRect;
4611uniform mat3 uTroikaOrient;
4612uniform bool uTroikaUseGlyphColors;
4613uniform float uTroikaEdgeOffset;
4614uniform float uTroikaBlurRadius;
4615uniform vec2 uTroikaPositionOffset;
4616uniform float uTroikaCurveRadius;
4617attribute vec4 aTroikaGlyphBounds;
4618attribute float aTroikaGlyphIndex;
4619attribute vec3 aTroikaGlyphColor;
4620varying vec2 vTroikaGlyphUV;
4621varying vec4 vTroikaTextureUVBounds;
4622varying float vTroikaTextureChannel;
4623varying vec3 vTroikaGlyphColor;
4624varying vec2 vTroikaGlyphDimensions;
4625`,qO=`
4626vec4 bounds = aTroikaGlyphBounds;
4627bounds.xz += uTroikaPositionOffset.x;
4628bounds.yw -= uTroikaPositionOffset.y;
4629
4630vec4 outlineBounds = vec4(
4631  bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,
4632  bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius
4633);
4634vec4 clippedBounds = vec4(
4635  clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
4636  clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
4637);
4638
4639vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);
4640
4641position.xy = mix(bounds.xy, bounds.zw, clippedXY);
4642
4643uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);
4644
4645float rad = uTroikaCurveRadius;
4646if (rad != 0.0) {
4647  float angle = position.x / rad;
4648  position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
4649  normal.xz = vec2(sin(angle), cos(angle));
4650}
4651  
4652position = uTroikaOrient * position;
4653normal = uTroikaOrient * normal;
4654
4655vTroikaGlyphUV = clippedXY.xy;
4656vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);
4657
4658
4659float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
4660vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
4661vec2 txStartUV = txUvPerSquare * vec2(
4662  mod(floor(aTroikaGlyphIndex / 4.0), txCols),
4663  floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
4664);
4665vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
4666vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
4667`,YO=`
4668uniform sampler2D uTroikaSDFTexture;
4669uniform vec2 uTroikaSDFTextureSize;
4670uniform float uTroikaSDFGlyphSize;
4671uniform float uTroikaSDFExponent;
4672uniform float uTroikaEdgeOffset;
4673uniform float uTroikaFillOpacity;
4674uniform float uTroikaBlurRadius;
4675uniform vec3 uTroikaStrokeColor;
4676uniform float uTroikaStrokeWidth;
4677uniform float uTroikaStrokeOpacity;
4678uniform bool uTroikaSDFDebug;
4679varying vec2 vTroikaGlyphUV;
4680varying vec4 vTroikaTextureUVBounds;
4681varying float vTroikaTextureChannel;
4682varying vec2 vTroikaGlyphDimensions;
4683
4684float troikaSdfValueToSignedDistance(float alpha) {
4685  // Inverse of exponential encoding in webgl-sdf-generator
4686  
4687  float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
4688  float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
4689  float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
4690  return signedDist;
4691}
4692
4693float troikaGlyphUvToSdfValue(vec2 glyphUV) {
4694  vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
4695  vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
4696  float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
4697  return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
4698}
4699
4700float troikaGlyphUvToDistance(vec2 uv) {
4701  return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
4702}
4703
4704float troikaGetAADist() {
4705  
4706  #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
4707  return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
4708  #else
4709  return vTroikaGlyphDimensions.x / 64.0;
4710  #endif
4711}
4712
4713float troikaGetFragDistValue() {
4714  vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
4715  float distance = troikaGlyphUvToDistance(clampedGlyphUV);
4716 
4717  // Extrapolate distance when outside bounds:
4718  distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : 
4719    length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);
4720
4721  
4722
4723  return distance;
4724}
4725
4726float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
4727  #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
4728  float alpha = step(-distanceOffset, -distance);
4729  #else
4730
4731  float alpha = smoothstep(
4732    distanceOffset + aaDist,
4733    distanceOffset - aaDist,
4734    distance
4735  );
4736  #endif
4737
4738  return alpha;
4739}
4740`,$O=`
4741float aaDist = troikaGetAADist();
4742float fragDistance = troikaGetFragDistValue();
4743float edgeAlpha = uTroikaSDFDebug ?
4744  troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
4745  troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));
4746
4747#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
4748vec4 fillRGBA = gl_FragColor;
4749fillRGBA.a *= uTroikaFillOpacity;
4750vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
4751if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
4752gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
4753  -uTroikaStrokeWidth - aaDist,
4754  -uTroikaStrokeWidth + aaDist,
4755  fragDistance
4756));
4757gl_FragColor.a *= edgeAlpha;
4758#endif
4759
4760if (edgeAlpha == 0.0) {
4761  discard;
4762}
4763`;function ZO(r){const e=Yv(r,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Ue},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Kt(0,0,0,0)},uTroikaClipRect:{value:new Kt(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Ue},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new st},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Yt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:XO,vertexTransform:qO,fragmentDefs:YO,fragmentColorTransform:$O,customRewriter({vertexShader:t,fragmentShader:n}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(n)&&(n=n.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(t)||(t=t.replace(GM,`uniform vec3 diffuse;
4764$&
4765vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
4766`))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const Jy=new Bi({color:16777215,side:si,transparent:!0}),ww=8421504,Sw=new St,of=new V,cv=new V,Fc=[],JO=new V,uv="+x+y";function Mw(r){return Array.isArray(r)?r[0]:r}let YM=()=>{const r=new fn(new Zs(1,1),Jy);return YM=()=>r,r},$M=()=>{const r=new fn(new Zs(1,1,32,1),Jy);return $M=()=>r,r};const KO={type:"syncstart"},QO={type:"synccomplete"},ZM=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],eF=ZM.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let JM=class extends fn{constructor(){const e=new jO;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=ww,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=uv,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(KO),WM({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(i=>i&&i())})),this.dispatchEvent(QO),e&&e()})))}onBeforeRender(e,t,n,i,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return ZO(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=Jy.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.hasOutline()){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return Mw(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return Mw(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:a,blockBounds:l}=i;n.uTroikaSDFTexture.value=a,n.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),n.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,n.uTroikaSDFExponent.value=i.sdfExponent,n.uTroikaTotalBounds.value.fromArray(l),n.uTroikaUseGlyphColors.value=!t&&!!i.glyphColors;let c=0,u=0,d=0,h,f,p,m=0,g=0;if(t){let{outlineWidth:y,outlineOffsetX:_,outlineOffsetY:x,outlineBlur:T,outlineOpacity:b}=this;c=this._parsePercent(y)||0,u=Math.max(0,this._parsePercent(T)||0),h=b,m=this._parsePercent(_)||0,g=this._parsePercent(x
4766)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(p=this.strokeColor,n.uTroikaStrokeColor.value.set(p??ww),f=this.strokeOpacity,f==null&&(f=1)),h=this.fillOpacity;n.uTroikaEdgeOffset.value=c,n.uTroikaPositionOffset.value.set(m,g),n.uTroikaBlurRadius.value=u,n.uTroikaStrokeWidth.value=d,n.uTroikaStrokeOpacity.value=f,n.uTroikaFillOpacity.value=h??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let v=this.clipRect;if(v&&Array.isArray(v)&&v.length===4)n.uTroikaClipRect.value.fromArray(v);else{const y=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(l[0]-y,l[1]-y,l[2]+y,l[3]+y)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new st;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||uv;if(o!==e._orientation){let a=n.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let l=o!==uv&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,u,d,h]=l;of.set(0,0,0)[u]=c==="-"?1:-1,cv.set(0,0,0)[h]=d==="-"?-1:1,Sw.lookAt(JO,of.cross(cv),cv),a.setFromMatrix4(Sw)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new Ue){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new Ue){return of.copy(e),this.localPositionToTextCoords(this.worldToLocal(of),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:i}=this;if(n){const s=n.blockBounds,o=i?$M():YM(),a=o.geometry,{position:l,uv:c}=a.attributes;for(let u=0;u<c.count;u++){let d=s[0]+c.getX(u)*(s[2]-s[0]);const h=s[1]+c.getY(u)*(s[3]-s[1]);let f=0;i&&(f=i-Math.cos(d/i)*i,d=Math.sin(d/i)*i),l.setXYZ(u,d,h,f)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,Fc.length=0,o.raycast(e,Fc);for(let u=0;u<Fc.length;u++)Fc[u].object=this,t.push(Fc[u])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,eF.forEach(n=>{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};
4766ZM.forEach(r=>{const e="_private_"+r;Object.defineProperty(JM.prototype,r,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new jn;new st;new jn;typeof window<"u"&&document.createElement("div");var tF=new Set(["$$slots","$$events","$$legacy","font","characters","sdfGlyphSize","ref","onsync","children"]);function nF(r,e){vt(e,!0);let t=ae(e,"font",3,null),n=ae(e,"characters",3,null),i=ae(e,"sdfGlyphSize",3,null),s=ae(e,"ref",15),o=Wt(e,tF);const a=new JM,{invalidate:l}=Js(),c=async()=>{await B0(),a.sync(()=>{var h;l(),(h=e.onsync)==null||h.call(e)})},u=["text","anchorX","anchorY","curveRadius","direction","font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","textAlign","textIndent","whiteSpace","material","color","depthOffset","clipRect","glyphGeometryDetail","sdfGlyphSize","outlineWidth","outlineColor","outlineOpacity","outlineBlur","outlineOffsetX","outlineOffsetY","strokeWidth","strokeColor","strokeOpacity","fillOpacity","characters","colorRanges"];CM(()=>u.map(h=>o[h]),()=>{c()});const d=PM();Pn(()=>{d(new Promise(h=>FO({font:t(),characters:n(),sdfGlyphSize:i()},h)))}),Bt(r,pn({get is(){return a}},()=>o,{get font(){return t()},get characters(){return n()},get sdfGlyphSize(){return i()},get ref(){return s()},set ref(h){s(h)},children:(h,f)=>{var p=tt(),m=Ie(p);zt(m,()=>e.children??jt,()=>({ref:a})),re(h,p)},$$slots:{default:!0}})),yt()}new Ff;const iF=r=>{const{camera:e}=Js();let t=0,n=0;const i=new ResizeObserver(([o])=>{t=o.contentRect.width,n=o.contentRect.height}),s=Xa(r);return Un(()=>{const{current:o}=s;if(o)return i.observe(o),()=>i.unobserve(o)}),(o,a)=>{t===0||n===0||(a.pointer.update(l=>(l.set(o.offsetX/t*2-1,-(o.offsetY/n)*2+1),l)),a.raycaster.setFromCamera(a.pointer.current,e.current))}},KM=Symbol("interactivity-context"),rF=()=>Si(KM),sF=r=>{const e=Ir(Zd().dom),t={enabled:Ir(!0),pointer:Ir(new Ue),pointerOverTarget:Ir(!1),lastEvent:void 0,raycaster:new Bm,initialClick:[0,0],initialClickTime:0,initialHits:[],hovered:new Map,interactiveObjects:[],target:e,handlers:new WeakMap,compute:iF(e),filter:r==null?void 0:r.filter,clickDistanceThreshold:8,clickTimeThreshold:Number.POSITIVE_INFINITY,eventOptions:r==null?void 0:r.eventOptions,addInteractiveObject:(n,i)=>{t.handlers.set(n,i),t.interactiveObjects.indexOf(n)===-1&&t.interactiveObjects.push(n)},removeInteractiveObject:n=>{const i=t.interactiveObjects.indexOf(n);i!==-1&&(t.interactiveObjects.splice(i,1),t.handlers.delete(n))}};return cr(KM,t),t},QM=()=>{const r=rF();if(!r)throw new Error("No interactivity context found. Did you forget to implement interactivity()?");return r},Ew=["onclick","oncontextmenu","ondblclick","onwheel","onpointerup","onpointerdown","onpointerover","onpointerout","onpointerenter","onpointerleave","onpointermove","onpointermissed"],oF=()=>{nU("interactivity",r=>{if(!Oi(r.ref,"Object3D"))return;const{addInteractiveObject:e,removeInteractiveObject:t}=QM();return Un(()=>{const n=r.ref,i=r.props;if(Ew.some(o=>typeof i[o]=="function"))return e(n,i),()=>{t(n)}}),{pluginProps:Ew}})};function dv(r){const e=r.eventObject??r.object,t=r.instanceId??r.batchId;return t!==void 0?`${e.uuid}|${t}`:r.object.isPoints?`${e.uuid}|${r.index}`:e.uuid}const Tw=[["click",!1],["contextmenu",!1],["dblclick",!1],["wheel",!1],["pointerdown",!0],["pointerup",!0],["pointerleave",!0],["pointerenter",!0],["pointermove",!0],["pointercancel",!0]],aF=r=>{const{handlers:e}=QM(),t=y=>{const _=y.offsetX-r.initialClick[0],x=y.offsetY-r.initialClick[1];return Math.round(Math.hypot(_,x))},n=y=>{var x,T;if(r.hovered.size===0)return;const _=new Set;for(const b of y)_.add(dv(b));for(const[b,M]of r.hovered)if(!_.has(b)){const{eventObject:E}=M;r.hovered.delete(b);const S=e.get(E);if(S){const w={...M,intersections:y};(x=S.onpointerout)==null||x.call(S,w),(T=S.onpointerleave)==null||T.call(S,w)}}},i=()=>{if(!r.enabled.current)return[];const y=[],_=r.raycaster.intersectObjects(r.interactiveObjects,!0),x=new Set,T=_.filter(M=>{const E=M.instanceId??M.batchId,S=E!==void 0?`${M.object.uuid}|${E}`:M.object.isPoints?`${M.object.uuid}|${M.index}`:M.object.uuid;return x.has(S)?!1:(x.add(S),!0)}),b=r.filter===void 0?T:r.filter(T,r);for(const M of b){let E=M.object;for(;E;)e.has(E)&&y.push({...M,eventObject:E}),E=E.parent}return y},s=(y,_)=>{var x,T;for(const b of _)(T=(x=e.get(b))==null?void 0:x.onpointermissed)==null||T.call(x,y)},o=()=>{r.pointerOverTarget.set(!1),n([])},a=()=>{r.pointerOverTarget.set(!0)},l=y=>{var D,R,k,N;const _=y.type,x=_==="pointermove",T=_==="click"||_==="contextmenu"||_==="dblclick";r.compute(y,r);const b=i(),M=T?t(y):0;_==="pointerdown"&&(r.initialClick=[y.offsetX,y.offsetY],r.initialClickTime=performance.now(),r.initialHits=b.map(H=>H.eventObject));const E=T&&M<=r.clickDistanceThreshold&&performance.now()-r.initialClickTime<=r.clickTimeThreshold;E&&s(y,r.interactiveObjects.filter(H=>!r.initialHits.includes(H))),x&&n(b);let S=!1,w=-1;e:for(const H of b){const P=e.get(H.eventObject);if(!P)continue;const ee={stopped:S,...H,intersections:b,stopPropagation(){if(S=!0,ee.stopped=!0,r.hovered.size>0&&Array.from(r.hovered.values()).some(X=>X.eventObject===H.eventObject)){const X=b.slice(0,b.indexOf(H));n([...X,H])}},stopImmediatePropagation(){y.stopImmediatePropagation()}
4766,camera:r.raycaster.camera,delta:M,nativeEvent:y,pointer:r.pointer.current,ray:r.raycaster.ray};if(x){if(P.onpointerover||P.onpointerenter||P.onpointerout||P.onpointerleave){const X=dv(ee),Q=r.hovered.get(X);Q?Q.stopped&&ee.stopPropagation():(r.hovered.set(X,ee),(D=P.onpointerover)==null||D.call(P,ee),(R=P.onpointerenter)==null||R.call(P,ee))}if((k=P.onpointermove)==null||k.call(P,ee),ee.stopped){const X=dv(ee),Q=r.hovered.get(X);Q&&(Q.stopped=!0)}}else P[`on${_}`]&&(!T||E&&r.initialHits.includes(H.eventObject))&&((N=P[`on${_}`])==null||N.call(P,ee));if(S){w=b.indexOf(H);break e}}x&&S&&n(b.slice(0,w+1))};let c=0,u=null,d=-1/0,h=-1/0;const f=.25,p=y=>{Math.abs(y.offsetX-d)<f&&Math.abs(y.offsetY-h)<f||(d=y.offsetX,h=y.offsetY,c?u=y:(l(y),c=requestAnimationFrame(()=>{c=0,u&&(l(u),u=null)})))},m=y=>{for(const[_]of Tw)_==="pointerleave"||_==="pointercancel"?y.removeEventListener(_,o):_==="pointermove"?y.removeEventListener(_,p):_==="pointerenter"?y.removeEventListener(_,a):y.removeEventListener(_,l)},g=y=>{var _,x;for(const[T,b]of Tw){const M=((x=(_=r.eventOptions)==null?void 0:_[T])==null?void 0:x.passive)??b;T==="pointerleave"||T==="pointercancel"?y.addEventListener(T,o,{passive:M}):T==="pointermove"?y.addEventListener(T,p,{passive:M}):T==="pointerenter"?y.addEventListener(T,a,{passive:M}):y.addEventListener(T,l,{passive:M})}},v=Xa(r.target);Pn(()=>{const{current:y}=v;if(y)return g(y),()=>{m(y)}})},Ky=r=>{const e=sF(r);return oF(),aF(e),e};for(let r=0;r<256;r++)(r<16?"0":"")+r.toString(16);new Ja(-1,1,1,-1,0,1);class lF extends Ht{constructor(){super(),this.setAttribute("position",new ot([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new ot([0,2,0,0,2,0],2))}}new lF;var eE={exports:{}};eE.exports=Wm;eE.exports.default=Wm;function Wm(r,e,t){t=t||2;var n=e&&e.length,i=n?e[0]*t:r.length,s=tE(r,0,i,t,!0),o=[];if(!s||s.next===s.prev)return o;var a,l,c,u,d,h,f;if(n&&(s=fF(r,e,s,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(var p=t;p<i;p+=t)d=r[p],h=r[p+1],d<a&&(a=d),h<l&&(l=h),d>c&&(c=d),h>u&&(u=h);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return Du(s,o,t,a,l,f,0),o}function tE(r,e,t,n,i){var s,o;if(i===Kv(r,e,t,n)>0)for(s=e;s<t;s+=n)o=Aw(s,r[s],r[s+1],o);else for(s=t-n;s>=e;s-=n)o=Aw(s,r[s],r[s+1],o);return o&&jm(o,o.next)&&(ku(o),o=o.next),o}function Wa(r,e){if(!r)return r;e||(e=r);var t=r,n;do if(n=!1,!t.steiner&&(jm(t,t.next)||Hn(t.prev,t,t.next)===0)){if(ku(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Du(r,e,t,n,i,s,o){if(r){!o&&s&&yF(r,n,i,s);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,s?uF(r,n,i,s):cF(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),ku(r),r=c.next,a=c.next;continue}if(r=c,r===a){o?o===1?(r=dF(Wa(r),e,t),Du(r,e,t,n,i,s,2)):o===2&&hF(r,e,t,n,i,s):Du(Wa(r),e,t,n,i,s,1);break}}}}function cF(r){var e=r.prev,t=r,n=r.next;if(Hn(e,t,n)>=0)return!1;for(var i=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=i<s?i<o?i:o:s<o?s:o,d=a<l?a<c?a:c:l<c?l:c,h=i>s?i>o?i:o:s>o?s:o,f=a>l?a>c?a:c:l>c?l:c,p=n.next;p!==e;){if(p.x>=u&&p.x<=h&&p.y>=d&&p.y<=f&&Il(i,a,s,l,o,c,p.x,p.y)&&Hn(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function uF(r,e,t,n){var i=r.prev,s=r,o=r.next;if(Hn(i,s,o)>=0)return!1;for(var a=i.x,l=s.x,c=o.x,u=i.y,d=s.y,h=o.y,f=a<l?a<c?a:c:l<c?l:c,p=u<d?u<h?u:h:d<h?d:h,m=a>l?a>c?a:c:l>c?l:c,g=u>d?u>h?u:h:d>h?d:h,v=Zv(f,p,e,t,n),y=Zv(m,g,e,t,n),_=r.prevZ,x=r.nextZ;_&&_.z>=v&&x&&x.z<=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==i&&_!==o&&Il(a,u,l,d,c,h,_.x,_.y)&&Hn(_.prev,_,_.next)>=0||(_=_.prevZ,x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==i&&x!==o&&Il(a,u,l,d,c,h,x.x,x.y)&&Hn(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;_&&_.z>=v;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==i&&_!==o&&Il(a,u,l,d,c,h,_.x,_.y)&&Hn(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==i&&x!==o&&Il(a,u,l,d,c,h,x.x,x.y)&&Hn(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function dF(r,e,t){var n=r;do{var i=n.prev,s=n.next.next;!jm(i,s)&&nE(i,n,n.next,s)&&Lu(i,s)&&Lu(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),ku(n),ku(n.next),n=r=s),n=n.next}while(n!==r);return Wa(n)}function hF(r,e,t,n,i,s){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&bF(o,a)){var l=iE(o,a);o=Wa(o,o.next),l=Wa(l,l.next),Du(o,e,t,n,i,s,0),Du(l,e,t,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function fF(r,e,t,n){var i=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*n,l=s<o-1?e[s+1]*n:r.length,c=tE(r,a,l,n,!1),c===c.next&&(c.steiner=!0),i.push(xF(c));for(i.sort(pF),s=0;s<i.length;s++)t=mF(i[s],t);return t}function pF(r,e){return r.x-e.x}function mF(r,e){var t=gF(r,e);if(!t)return e;var n=iE(t,r);return Wa(n,n.next),Wa(t,t.next)}function gF(r,e){var t=e,n=r.x,i=r.y,s=-1/0,o;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){var a=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=n&&a>s&&(s=a,o=t.x<t.next.x?t:t.next,a===n))return o}t=t.next}
4766while(t!==e);if(!o)return null;var l=o,c=o.x,u=o.y,d=1/0,h;t=o;do n>=t.x&&t.x>=c&&n!==t.x&&Il(i<u?n:s,i,c,u,i<u?s:n,i,t.x,t.y)&&(h=Math.abs(i-t.y)/(n-t.x),Lu(t,r)&&(h<d||h===d&&(t.x>o.x||t.x===o.x&&vF(o,t)))&&(o=t,d=h)),t=t.next;while(t!==l);return o}function vF(r,e){return Hn(r.prev,r,e.prev)<0&&Hn(e.next,r,r.next)<0}function yF(r,e,t,n){var i=r;do i.z===0&&(i.z=Zv(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,_F(i)}function _F(r){var e,t,n,i,s,o,a,l,c=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e<c&&(a++,n=n.nextZ,!!n);e++);for(l=c;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(o>1);return r}function Zv(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function xF(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Il(r,e,t,n,i,s,o,a){return(i-o)*(e-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(n-a)}function bF(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!wF(r,e)&&(Lu(r,e)&&Lu(e,r)&&SF(r,e)&&(Hn(r.prev,r,e.prev)||Hn(r,e.prev,e))||jm(r,e)&&Hn(r.prev,r,r.next)>0&&Hn(e.prev,e,e.next)>0)}function Hn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function jm(r,e){return r.x===e.x&&r.y===e.y}function nE(r,e,t,n){var i=lf(Hn(r,e,t)),s=lf(Hn(r,e,n)),o=lf(Hn(t,n,r)),a=lf(Hn(t,n,e));return!!(i!==s&&o!==a||i===0&&af(r,t,e)||s===0&&af(r,n,e)||o===0&&af(t,r,n)||a===0&&af(t,e,n))}function af(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function lf(r){return r>0?1:r<0?-1:0}function wF(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&nE(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Lu(r,e){return Hn(r.prev,r,r.next)<0?Hn(r,e,r.next)>=0&&Hn(r,r.prev,e)>=0:Hn(r,e,r.prev)<0||Hn(r,r.next,e)<0}function SF(r,e){var t=r,n=!1,i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function iE(r,e){var t=new Jv(r.i,r.x,r.y),n=new Jv(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Aw(r,e,t,n){var i=new Jv(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ku(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Jv(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Wm.deviation=function(r,e,t,n){var i=e&&e.length,s=i?e[0]*t:r.length,o=Math.abs(Kv(r,0,s,t));if(i)for(var a=0,l=e.length;a<l;a++){var c=e[a]*t,u=a<l-1?e[a+1]*t:r.length;o-=Math.abs(Kv(r,c,u,t))}var d=0;for(a=0;a<n.length;a+=3){var h=n[a]*t,f=n[a+1]*t,p=n[a+2]*t;d+=Math.abs((r[h]-r[p])*(r[f+1]-r[h+1])-(r[h]-r[f])*(r[p+1]-r[h+1]))}return o===0&&d===0?0:Math.abs((d-o)/o)};function Kv(r,e,t,n){for(var i=0,s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}Wm.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},n=0,i=0;i<r.length;i++){for(var s=0;s<r[i].length;s++)for(var o=0;o<e;o++)t.vertices.push(r[i][s][o]);i>0&&(n+=r[i-1].length,t.holes.push(n))}return t};new Ue;new Ue;var Cw;(r=>{function e(i){let s=i.slice();return s.sort(r.POINT_COMPARATOR),r.makeHullPresorted(s)}r.makeHull=e;function t(i){if(i.length<=1)return i.slice();let s=[];for(let a=0;a<i.length;a++){const l=i[a];for(;s.length>=2;){const c=s[s.length-1],u=s[s.length-2];if((c.x-u.x)*(l.y-u.y)>=(c.y-u.y)*(l.x-u.x))s.pop();else break}s.push(l)}s.pop();let o=[];for(let a=i.length-1;a>=0;a--){const l=i[a];for(;o.length>=2;){const c=o[o.length-1],u=o[o.length-2];if((c.x-u.x)*(l.y-u.y)>=(c.y-u.y)*(l.x-u.x))o.pop();else break}o.push(l)}return o.pop(),s.length==1&&o.length==1&&s[0].x==o[0].x&&s[0].y==o[0].y?s:s.concat(o)}r.makeHullPresorted=t;function n(i,s){return i.x<s.x?-1:i.x>s.x?1:i.y<s.y?-1:i.y>s.y?1:0}r.POINT_COMPARATOR=n})(Cw||(Cw={}));new Bi;new V;new St;new $s;new Zn;new jn;new V;new V;var MF=new Set(["$$slots","$$events","$$legacy","filename","color","scale","position","rotation","opacity","castShadow","receiveShadow","isInteractive","wireframe","side"]),EF=je("<!> <!>",1);function TF(r,e){vt(e,!0);let t=ae(e,"color",3,"#ffffff"),n=ae(e,"scale",19,()=>[1,1,1]),i=ae(e,"position",19,()=>[0,0,0]),s=ae(e,"rotation",19,()=>
4766[0,0,0]),o=ae(e,"opacity",3,1),a=ae(e,"castShadow",3,!0),l=ae(e,"receiveShadow",3,!0),c=ae(e,"isInteractive",3,!1),u=ae(e,"wireframe",3,!1),d=ae(e,"side",3,si),h=Wt(e,MF);c()&&Ky();const{load:f}=Fy(AU);var p=tt(),m=Ie(p);H0(m,()=>f(e.filename),null,(g,v)=>{var y=EF(),_=Ie(y);Od(_,()=>`<!-- include stl: ${e.filename} ${n()} -->`);var x=Le(_,2);Qe(x,()=>Bt.Mesh,(T,b)=>{b(T,pn({get geometry(){return C(v)},get scale(){return n()},get castShadow(){return a()},get receiveShadow(){return l()},get position(){return i()},get rotation(){return s()}},()=>h,{children:(M,E)=>{var S=tt(),w=Ie(S);{let D=Ve(()=>o()<1);Qe(w,()=>Bt.MeshLambertMaterial,(R,k)=>{k(R,{get color(){return t()},get opacity(){return o()},get transparent(){return C(D)},get wireframe(){return u()},get side(){return d()}})})}re(M,S)},$$slots:{default:!0}}))}),re(g,y)}),re(r,p),yt()}var AF=new Set(["$$slots","$$events","$$legacy","visual","opacity","defaultColor","position","rotation","castShadow","receiveShadow","isInteractive","wireframe","side"]),Rw=je("<!> <!>",1);function Pw(r,e){var v;vt(e,!0);let t=ae(e,"opacity",3,1),n=ae(e,"defaultColor",3,"#000000"),i=ae(e,"position",19,()=>[0,0,0]),s=ae(e,"rotation",19,()=>[0,0,0]),o=ae(e,"castShadow",3,!0),a=ae(e,"receiveShadow",3,!0);ae(e,"isInteractive",3,!1);let l=ae(e,"wireframe",3,!1),c=ae(e,"side",3,si),u=Wt(e,AF);const d=(v=e.visual)!=null&&v.color_rgba?uU(e.visual.color_rgba.slice(0,3)):n();var h=tt(),f=Ie(h);{var p=y=>{var _=tt(),x=Ie(_);{var T=E=>{TF(E,pn({get color(){return d},get opacity(){return t()},get filename(){return e.visual.geometry.filename},get scale(){return e.visual.geometry.scale},get position(){return i()},get rotation(){return s()},get castShadow(){return o()},get receiveShadow(){return a()},get wireframe(){return l()},get side(){return c()}},()=>u))},b=E=>{TU(E,pn({get color(){return d},get opacity(){return t()},get scale(){return e.visual.geometry.scale},get filename(){return e.visual.geometry.filename},get position(){return i()},get rotation(){return s()},get castShadow(){return o()},get receiveShadow(){return a()},get wireframe(){return l()},get side(){return c()}},()=>u))},M=E=>{vU(E,pn({get filename(){return e.visual.geometry.filename},get color(){return d},get opacity(){return t()},get scale(){return e.visual.geometry.scale},get position(){return i()},get rotation(){return s()},get castShadow(){return o()},get receiveShadow(){return a()},get wireframe(){return l()},get side(){return c()}},()=>u))};Dt(x,E=>{e.visual.geometry.type==="stl"?E(T):e.visual.geometry.type==="obj"?E(b,1):e.visual.geometry.type==="dae"&&E(M,2)})}re(y,_)},m=y=>{var _=tt(),x=Ie(_);Qe(x,()=>Bt.Mesh,(T,b)=>{b(T,{castShadow:!0,receiveShadow:!0,rotation:[Math.PI/2,0,0],onclick,children:(M,E)=>{var S=Rw(),w=Ie(S);{let R=Ve(()=>[e.visual.geometry.radius,e.visual.geometry.radius,e.visual.geometry.length]);Qe(w,()=>Bt.CylinderGeometry,(k,N)=>{N(k,{get args(){return C(R)}})})}var D=Le(w,2);{let R=Ve(()=>t()<1);Qe(D,()=>Bt.MeshBasicMaterial,(k,N)=>{N(k,{get color(){return d},get opacity(){return t()},get transparent(){return C(R)}})})}re(M,S)},$$slots:{default:!0}})}),re(y,_)},g=y=>{var _=tt(),x=Ie(_);Qe(x,()=>Bt.Mesh,(T,b)=>{b(T,{castShadow:!0,receiveShadow:!0,get scale(){return e.visual.geometry.size},onclick,children:(M,E)=>{var S=Rw(),w=Ie(S);Qe(w,()=>Bt.BoxGeometry,(R,k)=>{k(R,{})});var D=Le(w,2);{let R=Ve(()=>t()<1);Qe(D,()=>Bt.MeshBasicMaterial,(k,N)=>{N(k,{get color(){return d},get opacity(){return t()},get transparent(){return C(R)}})})}re(M,S)},$$slots:{default:!0}})}),re(y,_)};Dt(f,y=>{e.visual.type==="mesh"?y(p):e.visual.type==="cylinder"?y(m,1):e.visual.type==="box"&&y(g,2)})}re(r,h),yt()}const CF=(r,e)=>{const t=new Array(r.length+e.length);for(let n=0;n<r.length;n++)t[n]=r[n];for(let n=0;n<e.length;
vendor: 4,116 bytes, line 4766
4766n++)t[r.length+n]=e[n];return t},RF=(r,e)=>({classGroupId:r,validator:e}),rE=(r=new Map,e=null,t)=>({nextPart:r,validators:e,classGroupId:t}),Pp="-",Iw=[],PF="arbitrary..",IF=r=>{const e=LF(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=r;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return DF(o);const a=o.split(Pp),l=a[0]===""&&a.length>1?1:0;return sE(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=t[o];return l?c?CF(c,l):l:c||Iw}return t[o]||Iw}}},sE=(r,e,t)=>{if(r.length-e===0)return t.classGroupId;const i=r[e],s=t.nextPart.get(i);if(s){const c=sE(r,e+1,s);if(c)return c}const o=t.validators;if(o===null)return;const a=e===0?r.join(Pp):r.slice(e).join(Pp),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},DF=r=>r.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=r.slice(1,-1),t=e.indexOf(":"),n=e.slice(0,t);return n?PF+n:void 0})(),LF=r=>{const{theme:e,classGroups:t}=r;return kF(t,e)},kF=(r,e)=>{const t=rE();for(const n in r){const i=r[n];Qy(i,t,n,e)}return t},Qy=(r,e,t,n)=>{const i=r.length;for(let s=0;s<i;s++){const o=r[s];UF(o,e,t,n)}},UF=(r,e,t,n)=>{if(typeof r=="string"){NF(r,e,t);return}if(typeof r=="function"){OF(r,e,t,n);return}FF(r,e,t,n)},NF=(r,e,t)=>{const n=r===""?e:oE(e,r);n.classGroupId=t},OF=(r,e,t,n)=>{if(BF(r)){Qy(r(n),e,t,n);return}e.validators===null&&(e.validators=[]),e.validators.push(RF(t,r))},FF=(r,e,t,n)=>{const i=Object.entries(r),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];Qy(l,oE(e,a),t,n)}},oE=(r,e)=>{let t=r;const n=e.split(Pp),i=n.length;for(let s=0;s<i;s++){const o=n[s];let a=t.nextPart.get(o);a||(a=rE(),t.nextPart.set(o,a)),t=a}return t},BF=r=>"isThemeGetter"in r&&r.isThemeGetter===!0,zF=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),n=Object.create(null);const i=(s,o)=>{t[s]=o,e++,e>r&&(e=0,n=t,t=Object.create(null))};return{get(s){let o=t[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in t?t[s]=o:i(s,o)}}},Qv="!",Dw=":",VF=[],Lw=(r,e,t,n,i)=>({modifiers:r,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:n,isExternal:i}),GF=r=>{const{prefix:e,experimentalParseClassName:t}=r;let n=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let m=0;m<u;m++){const g=i[m];if(o===0&&a===0){if(g===Dw){s.push(i.slice(l,m)),l=m+1;continue}if(g==="/"){c=m;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=s.length===0?i:i.slice(l);let h=d,f=!1;d.endsWith(Qv)?(h=d.slice(0,-1),f=!0):d.startsWith(Qv)&&(h=d.slice(1),f=!0);const p=c&&c>l?c-l:void 0;return Lw(s,f,h,p)};if(e){const i=e+Dw,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):Lw(VF,!1,o,void 0,!0)}if(t){const i=n;n=s=>t({className:s,parseClassName:i})}return n},HF=r=>{const e=new Map;return r.orderSensitiveModifiers.forEach((t,n)=>{e.set(t,1e6+n)}),t=>{const n=[];let i=[];for(let s=0;s<t.length;s++){const o=t[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},WF=r=>({cache:zF(r.cacheSize),parseClassName:GF(r),sortModifiers:HF(r),postfixLookupClassGroupIds:jF(r),...IF(r)}),jF=r=>{const e=Object.create(null),t=r.postfixLookupClassGroups;if(t)for(let n=0;n<t.length;n++)e[t[n]]=!0;return e},XF=/\s+/,qF=(r,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s,postfixLookupClassGroupIds:o}=e,a=[],l=r.trim().split(XF);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:h,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=t(d);if(h){c=d+(c.length>0?" "+c:c);continue}let v=!!g,y;if(v){const M=m.substring(0,g);y=n(M);const E=y&&o[y]?n(m):void 0;E&&E!==y&&(y=E,v=!1)}else y=n(m);if(!y){if(!v){c=d+(c.length>0?" "+c:c);continue}if(y=n(m),!y){c=d+(c.length>0?" "+c:c);continue}v=!1}const _=f.length===0?"":f.length===1?f[0]:s(f).join(":"),x=p?_+Qv:_,T=x+y;if(a.indexOf(T)>-1)continue;a.push(T);const b=i(y,v);for(let M=0;M<b.length;++M){const E=b[M];a.push(x+E)}c=d+(c.length>0?" "+c:c)}return c},YF=(...r)=>{let e=0,t,n,i="";for(;e<r.length;
vendor: 4,664 bytes, line 4766
4766)(t=r[e++])&&(n=aE(t))&&(i&&(i+=" "),i+=n);return i},aE=r=>{if(typeof r=="string")return r;let e,t="";for(let n=0;n<r.length;n++)r[n]&&(e=aE(r[n]))&&(t&&(t+=" "),t+=e);return t},$F=(r,...e)=>{let t,n,i,s;const o=l=>{const c=e.reduce((u,d)=>d(u),r());return t=WF(c),n=t.cache.get,i=t.cache.set,s=a,a(l)},a=l=>{const c=n(l);if(c)return c;const u=qF(l,t);return i(l,u),u};return s=o,(...l)=>s(YF(...l))},ZF=[],ui=r=>{const e=t=>t[r]||ZF;return e.isThemeGetter=!0,e.themeKey=r,e},lE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,JF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,KF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,eB=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,tB=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nB=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ho=r=>JF.test(r),nn=r=>!!r&&!Number.isNaN(Number(r)),ns=r=>!!r&&Number.isInteger(Number(r)),hv=r=>r.endsWith("%")&&nn(r.slice(0,-1)),Ms=r=>KF.test(r),uE=()=>!0,iB=r=>QF.test(r)&&!eB.test(r),e_=()=>!1,rB=r=>tB.test(r),sB=r=>nB.test(r),oB=r=>!wt(r)&&!Mt(r),aB=r=>r.startsWith("@container")&&(r[10]==="/"&&r[11]!==void 0||r[11]==="s"&&r[16]!==void 0&&r.startsWith("-size/",10)||r[11]==="n"&&r[18]!==void 0&&r.startsWith("-normal/",10)),lB=r=>Io(r,fE,e_),wt=r=>lE.test(r),ea=r=>Io(r,pE,iB),kw=r=>Io(r,gB,nn),cB=r=>Io(r,gE,uE),uB=r=>Io(r,mE,e_),Uw=r=>Io(r,dE,e_),dB=r=>Io(r,hE,sB),cf=r=>Io(r,vE,rB),Mt=r=>cE.test(r),Bc=r=>Ka(r,pE),hB=r=>Ka(r,mE),Nw=r=>Ka(r,dE),fB=r=>Ka(r,fE),pB=r=>Ka(r,hE),uf=r=>Ka(r,vE,!0),mB=r=>Ka(r,gE,!0),Io=(r,e,t)=>{const n=lE.exec(r);return n?n[1]?e(n[1]):t(n[2]):!1},Ka=(r,e,t=!1)=>{const n=cE.exec(r);return n?n[1]?e(n[1]):t:!1},dE=r=>r==="position"||r==="percentage",hE=r=>r==="image"||r==="url",fE=r=>r==="length"||r==="size"||r==="bg-size",pE=r=>r==="length",gB=r=>r==="number",mE=r=>r==="family-name",gE=r=>r==="number"||r==="weight",vE=r=>r==="shadow",vB=()=>{const r=ui("color"),e=ui("font"),t=ui("text"),n=ui("font-weight"),i=ui("tracking"),s=ui("leading"),o=ui("breakpoint"),a=ui("container"),l=ui("spacing"),c=ui("radius"),u=ui("shadow"),d=ui("inset-shadow"),h=ui("text-shadow"),f=ui("drop-shadow"),p=ui("blur"),m=ui("perspective"),g=ui("aspect"),v=ui("ease"),y=ui("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...x(),Mt,wt],b=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],E=()=>[Mt,wt,l],S=()=>[ho,"full","auto",...E()],w=()=>[ns,"none","subgrid",Mt,wt],D=()=>["auto",{span:["full",ns,Mt,wt]},ns,Mt,wt],R=()=>[ns,"auto",Mt,wt],k=()=>["auto","min","max","fr",Mt,wt],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...E()],ee=()=>[ho,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],X=()=>[a,ho,"screen","full","dvw","lvw","svw","min","max","fit",...E()],Q=()=>[ho,"screen","full","lh","dvh","lvh","svh","min","max","fit",...E()],Y=()=>[r,Mt,wt],z=()=>[...x(),Nw,Uw,{position:[Mt,wt]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",fB,lB,{size:[Mt,wt]}],O=()=>[hv,Bc,ea],U=()=>["","none","full",c,Mt,wt],W=()=>["",nn,Bc,ea],j=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[nn,hv,Nw,Uw],ye=()=>["","none",p,Mt,wt],we=()=>["none",nn,Mt,wt],_e=()=>["none",nn,Mt,wt],Re=()=>[nn,Mt,wt],F=()=>[ho,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ms],breakpoint:[Ms],color:[uE],container:[Ms],"drop-shadow":[Ms],ease:["in","out","in-out"],font:[oB],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ms],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ms],shadow:[Ms],spacing:["px",nn],text:[Ms],"text-shadow":[Ms],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ho,wt,Mt,g]}],container:["container"],"container-type":[{"@container":["","normal","size",Mt,wt]}
vendor: 13,548 bytes, line 4766
4766],"container-named":[aB],columns:[{columns:[nn,"auto",wt,Mt,a]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:b()}],"overflow-x":[{"overflow-x":b()}],"overflow-y":[{"overflow-y":b()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{"inset-s":S(),start:S()}],end:[{"inset-e":S(),end:S()}],"inset-bs":[{"inset-bs":S()}],"inset-be":[{"inset-be":S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[ns,"auto",Mt,wt]}],basis:[{basis:[ho,"full","auto",a,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nn,ho,"auto","initial","none",wt]}],grow:[{grow:["",nn,Mt,wt]}],shrink:[{shrink:["",nn,Mt,wt]}],order:[{order:[ns,"first","last","none",Mt,wt]}],"grid-cols":[{"grid-cols":w()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":w()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pbs:[{pbs:E()}],pbe:[{pbe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mbs:[{mbs:P()}],mbe:[{mbe:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:ee()}],"inline-size":[{inline:["auto",...X()]}],"min-inline-size":[{"min-inline":["auto",...X()]}],"max-inline-size":[{"max-inline":["none",...X()]}],"block-size":[{block:["auto",...Q()]}],"min-block-size":[{"min-block":["auto",...Q()]}],"max-block-size":[{"max-block":["none",...Q()]}],w:[{w:[a,"screen",...ee()]}],"min-w":[{"min-w":[a,"screen","none",...ee()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...ee()]}],h:[{h:["screen","lh",...ee()]}],"min-h":[{"min-h":["screen","lh","none",...ee()]}],"max-h":[{"max-h":["screen","lh","none",...ee()]}],"font-size":[{text:["base",t,Bc,ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,mB,cB]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hv,wt]}],"font-family":[{font:[hB,uB,e]}],"font-features":[{"font-features":[wt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Mt,wt]}],"line-clamp":[{"line-clamp":[nn,"none",Mt,kw]}],leading:[{leading:["none",s,...E()]}],"list-image":[{"list-image":["none",Mt,wt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Mt,wt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...j(),"wavy"]}],"text-decoration-thickness":[{decoration:[nn,"from-font","auto",Mt,ea]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[nn,"auto",Mt,wt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"tab-size":[{tab:[ns,Mt,wt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Mt,wt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Mt,wt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ns,Mt,wt],radial:["",Mt,wt],conic:["",ns,Mt,wt]},pB,dB]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...j(),"hidden","none"]}],"divide-style":[{divide:[...j(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-bs":[{"border-bs":Y()}],"border-color-be":[{"border-be":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...j(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nn,Mt,wt]}],"outline-w":[{outline:["",nn,Bc,ea]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","inner","none",u,uf,cf]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",d,uf,cf]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[nn,ea]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",h,uf,cf]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[nn,Mt,wt]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[nn]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[Mt,wt]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[nn]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Mt,wt]}],filter:[{filter:["","none",Mt,wt]}],blur:[{blur:ye()}],brightness:[{brightness:[nn,Mt,wt]}],contrast:[{contrast:[nn,Mt,wt]}],"drop-shadow":[{"drop-shadow":["","none",f,uf,cf]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",nn,Mt,wt]}],"hue-rotate":[{"hue-rotate":[nn,Mt,wt]}],invert:[{invert:["",nn,Mt,wt]}],saturate:[{saturate:[nn,Mt,wt]}],sepia:[{sepia:["",nn,Mt,wt]}],"backdrop-filter":[{"backdrop-filter":["","none",Mt,wt]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[nn,Mt,wt]}],"backdrop-contrast":[{"backdrop-contrast":[nn,Mt,wt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nn,Mt,wt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nn,Mt,wt]}],"backdrop-invert":[{"backdrop-invert":["",nn,Mt,wt]}],"backdrop-opacity":[{"backdrop-opacity":[nn,Mt,wt]}],"backdrop-saturate":[{"backdrop-saturate":[nn,Mt,wt]}],"backdrop-sepia":[{"backdrop-sepia":["",nn,Mt,wt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Mt,wt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nn,"initial",Mt,wt]}],ease:[{ease:["linear","initial",v,Mt,wt]}],delay:[{delay:[nn,Mt,wt]}],animate:[{animate:["none",y,Mt,wt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Mt,wt]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[Mt,wt,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:F()}],"translate-x":[{"translate-x":F()}],"translate-y":[{"translate-y":F()}],"translate-z":[{"translate-z":F()}],"translate-none":["translate-none"],zoom:[{zoom:[ns,Mt,wt]}],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}
4766],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Mt,wt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":Y()}],"scrollbar-track-color":[{"scrollbar-track":Y()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mbs":[{"scroll-mbs":E()}],"scroll-mbe":[{"scroll-mbe":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pbs":[{"scroll-pbs":E()}],"scroll-pbe":[{"scroll-pbe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Mt,wt]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[nn,Bc,ea,kw]}],stroke:[{stroke:["none",...Y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},yB=$F(vB);function Nn(...r){return yB(wf(r))}function Ow(r){return r/4096*360}function _B(r){return Math.min(Math.round(r*4096/360),4096)}function xB(r){return r*180/Math.PI}var bB=new Set(["$$slots","$$events","$$legacy","robot","joint","selectedJoint","selectedLink","
4766showLine","nameHeight","highlightColor","jointColor","jointIndicatorColor","opacity","isInteractive","showName","showVisual","showCollision","visualOpacity","collisionOpacity","collisionColor","jointNames","onclick"]),zc=je("<!> <!>",1),wB=je("<!> <!> <!> <!>",1);function SB(r,e){vt(e,!0);const t=D=>{D.stopPropagation(),i(void 0),n(e.joint)};let n=ae(e,"selectedJoint",15),i=ae(e,"selectedLink",15),s=ae(e,"showLine",3,!1),o=ae(e,"nameHeight",3,.02),a=ae(e,"highlightColor",3,"#ff0000"),l=ae(e,"jointColor",3,"#000000"),c=ae(e,"jointIndicatorColor",3,"#000000"),u=ae(e,"opacity",3,.7),d=ae(e,"isInteractive",3,!1),h=ae(e,"showName",3,!1),f=ae(e,"showVisual",3,!0),p=ae(e,"showCollision",3,!0),m=ae(e,"visualOpacity",3,1),g=ae(e,"collisionOpacity",3,1),v=ae(e,"collisionColor",3,"#000000");ae(e,"jointNames",3,!0),ae(e,"onclick",3,t);let y=Wt(e,bB);d()&&Ky();function _(D){const R=D.axis_xyz||[0,0,1],k=D.rotation||[0,0,0];for(let N=0;N<3;N++)if(Math.abs(R[N])>.001)return xB(k[N]/R[N]);return 0}var x=wB(),T=Ie(x);Od(T,()=>`<!-- Joint ${e.joint.name} (${e.joint.type}) -->`);var b=Le(T,2);{var M=D=>{var R=tt(),k=Ie(R);Qe(k,()=>Bt.Line,(N,H)=>{H(N,{children:(P,ee)=>{var X=zc(),Q=Ie(X);{let z=Ve(()=>[new V(0,0,0),new V(e.joint.origin_xyz[0],e.joint.origin_xyz[1],e.joint.origin_xyz[2])]);uw(Q,{get points(){return C(z)}})}var Y=Le(Q,2);Qe(Y,()=>Bt.LineBasicMaterial,(z,K)=>{K(z,{get color(){return l()}})}),re(P,X)},$$slots:{default:!0}})}),re(D,R)};Dt(b,D=>{s()&&D(M)})}var E=Le(b,2);Qe(E,()=>Bt.Group,(D,R)=>{R(D,{get position(){return e.joint.origin_xyz},get rotation(){return e.joint.origin_rpy},children:(k,N)=>{var H=tt(),P=Ie(H);Qe(P,()=>Bt.Group,(ee,X)=>{X(ee,{get rotation(){return e.joint.rotation},children:(Q,Y)=>{var z=zc(),K=Ie(z);{var te=W=>{yE(W,{get robot(){return e.robot},get link(){return e.joint.child},textScale:.2,get showName(){return h()},get showVisual(){return f()},get showCollision(){return p()},get visualOpacity(){return m()},get collisionOpacity(){return g()},get collisionColor(){return v()},jointNames:!0,joints:!0,get jointColor(){return l()},get jointIndicatorColor(){return c()},get nameHeight(){return o()},get selectedLink(){return i()},get selectedJoint(){return n()},get highlightColor(){return a()},get showLine(){return s()},opacity:1,isInteractive:!0})};Dt(K,W=>{e.joint.child&&W(te)})}var O=Le(K,2);{var U=W=>{var j=zc(),ie=Ie(j);Qe(ie,()=>Bt.Line,(ye,we)=>{we(ye,{children:(_e,Re)=>{var F=zc(),pe=Ie(F);{let be=Ve(()=>[new V(0,0,0),new V(0,-.02,0)]);uw(pe,{get points(){return C(be)}})}var me=Le(pe,2);Qe(me,()=>Bt.LineBasicMaterial,(be,se)=>{se(be,{get color(){return c()}})}),re(_e,F)},$$slots:{default:!0}})});var de=Le(ie,2);Qe(de,()=>Bt.Mesh,(ye,we)=>{we(ye,pn({rotation:[Math.PI/2,0,0]},()=>y,{children:(_e,Re)=>{var F=zc(),pe=Ie(F);Qe(pe,()=>Bt.CylinderGeometry,(be,se)=>{se(be,{args:[.004,.004,.03]})});var me=Le(pe,2);{let be=Ve(()=>n()==e.joint?a():l()),se=Ve(()=>u()<1);Qe(me,()=>Bt.MeshBasicMaterial,(Se,he)=>{he(Se,{get color(){return C(be)},get opacity(){return u()},get transparent(){return C(se)}})})}re(_e,F)},$$slots:{default:!0}}))}),re(W,j)};Dt(O,W=>{s()&&W(U)})}re(Q,z)},$$slots:{default:!0}})}),re(k,H)},$$slots:{default:!0}})});var S=Le(E,2);{var w=D=>{{let R=Ve(()=>e.joint.origin_xyz[0]+.04),k=Ve(()=>e.joint.origin_xyz[1]+.01),N=Ve(()=>e.joint.origin_xyz[2]+.03);BM(D,{get"position.x"(){return C(R)},get"position.y"(){return C(k)},get"position.z"(){return C(N)},renderOrder:999,frustumCulled:!1,children:(H,P)=>{{let ee=Ve(()=>n()==e.joint?a():l()),X=Ve(()=>e.joint.name+" "+_(e.joint).toFixed(0)+"°");nF(H,{get scale(){return o()},get color(){return C(ee)},get text(){return C(X)},characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",renderOrder:999})}},$$slots:{default:!0}})}};Dt(S,D=>{h()&&D(w)})}re(r,x),yt()}var MB=je("<!> <!> <!> <!>",1);function yE(r,e){vt(e,!0),ae(e,"textScale",3,1);let t=ae(e,"showName",3,!0),n=ae(e,"showVisual",3,!0),i=ae(e,"showCollision",3,!0),s=ae(e,"visualColor",3,"#000000"),o=ae(e,"visualOpacity",3,1),a=ae(e,"collisionOpacity",3,1),l=ae(e,"collisionColor",3,"#000000"),c=ae(e,"jointNames",3,!0),u=ae(e,"joints",3,!0),d=ae(e,"jointColor",3,"#000000"),h=ae(e,"jointIndicatorColor",3,"#000000"),f=ae(e,"nameHeight",3,.1),p=ae(e,"selectedLink",3,void 0),m=ae(e,"selectedJoint",3,void 0),g=ae(e,"highlightColor",3,"#000000"),v=ae(e,"showLine",3,!0),y=ae(e,"o
4766pacity",3,.7),_=ae(e,"isInteractive",3,!1);var x=MB(),T=Ie(x);Od(T,()=>`<!-- Link ${e.link.name} -->`);var b=Le(T,2);{var M=D=>{var R=tt(),k=Ie(R);qr(k,17,()=>e.link.visual,Mo,(N,H)=>{Pw(N,{get opacity(){return o()},get visual(){return C(H)},get defaultColor(){return s()}})}),re(D,R)};Dt(b,D=>{n()&&D(M)})}var E=Le(b,2);{var S=D=>{var R=tt(),k=Ie(R);qr(k,17,()=>e.link.collision,Mo,(N,H)=>{Pw(N,{get opacity(){return a()},get visual(){return C(H)},get defaultColor(){return l()}})}),re(D,R)};Dt(E,D=>{i()&&D(S)})}var w=Le(E,2);qr(w,17,()=>hU(e.robot,e.link),D=>D.name,(D,R)=>{SB(D,{get robot(){return e.robot},get joint(){return C(R)},get selectedJoint(){return m()},get selectedLink(){return p()},get showName(){return t()},get nameHeight(){return f()},get highlightColor(){return g()},get jointColor(){return d()},get jointIndicatorColor(){return h()},get showLine(){return v()},get opacity(){return y()},get isInteractive(){return _()},get showVisual(){return n()},get showCollision(){return i()},get visualOpacity(){return o()},get collisionOpacity(){return a()},get collisionColor(){return l()},get jointNames(){return c()},get joints(){return u()}})}),re(r,x),yt()}const ta={WEBSOCKET:{CONNECTION_TIMEOUT_MS:3e3,MAX_RECONNECT_ATTEMPTS:10,INITIAL_RECONNECT_DELAY_MS:250,MAX_RECONNECT_DELAY_MS:2e3,HEARTBEAT_INTERVAL_MS:5e3},ROBOT_POLLING:{USB_MASTER_POLL_INTERVAL_MS:50,ROBOT_SYNC_INTERVAL_MS:33,STATE_UPDATE_INTERVAL_MS:33,SEQUENCE_PLAYBACK_INTERVAL_MS:16,POSITION_CHANGE_THRESHOLD:2},DATA_PROCESSING:{SMOOTHING_HISTORY_SIZE:2,ENABLE_SMOOTHING:!1},COMMUNICATION:{USB_BAUD_RATE:1e6,BATCH_COMMAND_DELAY_MS:10},SAFETY:{MAX_RELATIVE_TARGET_DEG:15,MAX_JOINT_VELOCITY_DEG_S:120,ENABLE_POSITION_CLAMPING:!0,EMERGENCY_STOP_THRESHOLD_DEG:45},TIMING:{USE_BUSY_WAIT:!0,USE_HIGH_PRECISION_TIMING:!0,DEVICE_WARMUP_TIME_MS:2e3},LOGGING:{ENABLE_PERFORMANCE_LOGS:!1,WEBSOCKET_LOG_LEVEL:"error",ENABLE_TIMING_MEASUREMENTS:!0,LOG_BUFFER_SIZE:100,ENABLE_DETAILED_METRICS:!1}}
4766,EB={ULTRA_LOW_LATENCY:{...ta,ROBOT_POLLING:{...ta.ROBOT_POLLING,USB_MASTER_POLL_INTERVAL_MS:20,ROBOT_SYNC_INTERVAL_MS:16,STATE_UPDATE_INTERVAL_MS:16},WEBSOCKET:{...ta.WEBSOCKET,HEARTBEAT_INTERVAL_MS:2e3,CONNECTION_TIMEOUT_MS:1500},DATA_PROCESSING:{...ta.DATA_PROCESSING,ENABLE_SMOOTHING:!1,POSITION_CHANGE_THRESHOLD:1}},BALANCED:{DATA_PROCESSING:{...ta.DATA_PROCESSING}},STABLE:{ROBOT_POLLING:{...ta.ROBOT_POLLING},WEBSOCKET:{...ta.WEBSOCKET}}},Xm=EB.ULTRA_LOW_LATENCY,ds=()=>Xm.WEBSOCKET,Nl=()=>Xm.ROBOT_POLLING,e0=()=>Xm.DATA_PROCESSING,_E=()=>Xm.COMMUNICATION;var Fu,Bu,zu,Vu,Gu,Hu,Wu,f1;let TB=(f1=class{constructor(e,t){Ae(this,"id");Ae(this,"robotState");Fe(this,Fu,Pt(mr([])));Fe(this,Bu,Pt(void 0));Fe(this,zu,Pt(mr({isConnected:!1})));Fe(this,Vu,Pt(mr([])));Fe(this,Gu,Pt(mr(new Map)));Fe(this,Hu,Pt(mr({hasActiveMaster:!1,manualControlEnabled:!0,lastCommandSource:"none",commandQueue:[]})));Fe(this,Wu,Pt(mr({isCalibrated:!1,offsets:{}})));Ae(this,"unsubscribeCallbacks",[]);Ae(this,"_cloudSocket",null);this.id=e,this.robotState=t,this.initializeJoints(),this.initCloudBridge()}get _joints(){return C(J(this,Fu))}set _joints(e){Be(J(this,Fu),e,!0)}get _master(){return C(J(this,Bu))}set _master(e){Be(J(this,Bu),e,!0)}get _masterStatus(){return C(J(this,zu))}set _masterStatus(e){Be(J(this,zu),e,!0)}get _slaves(){return C(J(this,Vu))}set _slaves(e){Be(J(this,Vu),e,!0)}get _slaveStatuses(){return C(J(this,Gu))}set _slaveStatuses(e){Be(J(this,Gu),e,!0)}get _controlState(){return C(J(this,Hu))}set _controlState(e){Be(J(this,Hu),e,!0)}get _calibrationState(){return C(J(this,Wu))}set _calibrationState(e){Be(J(this,Wu),e,!0)}get joints(){return this._joints}get master(){return this._master}get masterStatus(){return this._masterStatus}get slaves(){return this._slaves}get slaveStatuses(){return this._slaveStatuses}get controlState(){return this._controlState}get calibrationState(){return this._calibrationState}get isCalibrated(){return this._calibrationState.isCalibrated}get activeJoints(){return this._joints.filter(e=>e.isActive)}get connectedSlaves(){return this._slaves.filter(e=>{var t;return(t=this._slaveStatuses.get(e.id))==null?void 0:t.isConnected})}get manualControlEnabled(){return this._controlState.manualControlEnabled&&!this._controlState.hasActiveMaster}initCloudBridge(){if(typeof window>"u")return;const e=window.location.protocol==="https:"?"wss:":"ws:",t=window.location.host,n=`${e}//${t}/ws/robot/${this.id}`;console.log(`📡 Cloud Bridge joining room: ${this.id}`),this._cloudSocket=new WebSocket(n),this._cloudSocket.onopen=()=>{var i;console.log("✅ Cloud Bridge Active"),(i=this._cloudSocket)==null||i.send(JSON.stringify({type:"join",robotId:this.id}))},this._cloudSocket.onmessage=i=>{try{const s=JSON.parse(i.data);if(s.type==="execute_command"&&s.data){console.log("☁️ Cloud Command Received:",s.data),this.updateVirtualFromCommands([s.data]);const o=this.connectedSlaves;o.length>0&&o.forEach(a=>{a.executeCommand(s.data).catch(()=>{})})}}catch(s){console.error("❌ Cloud Sync Error",s)}},this._cloudSocket.onerror=i=>console.error("❌ Cloud Bridge Error:",i)}initializeJoints(){const e=this.robotState.urdfConfig.jointNameIdMap||{},t=this.robotState.urdfConfig.restPosition||{};this._joints=this.robotState.robot.joints.filter(n=>n.type==="revolute"||n.type==="continuous").map(n=>{const i=n.name||"",s=t[i]||0;if(n.type==="revolute"){const o=s*Math.PI/180,a=n.axis_xyz||[0,0,1];n.rotation=[o*a[0],o*a[1],o*a[2]]}return{name:i,urdfJoint:n,servoId:e[i],virtualValue:s,commandedValue:s,realValue:void 0,isActive:!!e[i],lastVirtualUpdate:new Date,lastRealUpdate:void 0,lastCommandUpdate:void 0,syncError:void 0,calibrationOffset:0,restPosition:s}})}async setMaster(e){this._master&&await this.removeMaster(),this._master=e,this._masterStatus=e.status;const t=e.onStatusChange(s=>{this._masterStatus=s,this._controlState.hasActiveMaster=s.isConnected,this._controlState.manualControlEnabled=!s.isConnected}),n=e.onCommand(s=>{this.handleMasterCommands(s)}),i=e.onSequence(s=>{this.handleMasterSequence(s)});this.unsubscribeCallbacks.push(t,n,i),this._controlState.hasActiveMaster=e.status.isConnected,this._controlState.manualControlEnabled=!e.status.isConnected,this._controlState.masterName=e.name,e.status.isConnected&&await e.start()}async removeMaster(){if(this._master){if(this._master.status.isConnected){try{await this._master.stop()}catch{}await this._master.disconnect()}this._master=void 0,this._masterStatus={isConnected:!1},this._controlState.hasActiveMaster=!1,this._controlState.manualControlEnabled=!0,this._controlState.masterName=void 0}}async addSlave(e){if(this._slaves.find(i=>i.id===e.id))return;await e.connect(),this._slaves.push(e),this._slaveStatuses.set(e.id,e.status);const t=e.onStatusChange(i=>{this._slaveStatuses.set(e.id,i)}),n=e.onStateUpdate(i=>{this.updateFromSlave(e.id,i)});this.unsubscribeCallbacks.push(t,n),await this.moveSlaveToRestPosition(e)}async removeSlave(e){const t=this._slaves.findIndex(i=>i.id===e);if(t===-1)return;const n=this._slaves[t];n.status.isConnected&&await n.disconnect(),this._slaves.splice(t,1),this._slaveStatuses.delete(e)}async handleMasterCommands(e){this._controlState.lastCommandSource="master",this._controlState.commandQueue=[...e],this._cloudSocket&&this._cloudSocket.readyState===WebSocket.OPEN&&this._cloudSocket.send(JSON.stringify({type:"command",data:e[0],robotId:this.id}));const t=this.connectedSlaves.map(n=>n.executeCommands(e).catch(()=>{}));await Promise.allSettled(t),this.updateVirtualFromCommands(e)}async handleMasterSequence(e){for(const t of e.commands)await this.handleMasterCommands([t]),t.duration&&await new Promise(n=>setTimeout(n,t.duration))}async updateJointValue(e,t){if(!this.manualControlEnabled)return;const n=this._joints.find(a=>a.name===e);if(!n)return;const i=this.clampJointValue(n,t);n.virtualValue=i,this.updateUrdfJointRotation(n,i);const s={timestamp:Date.now(),joints:[{name:e,value:i}]};this._cloudSocket&&this._cloudSocket.readyState===WebSocket.OPEN&&this._cloudSocket.send(JSON.stringify({type:"command",data:s,robotId:this.id}));const o=this.connectedSlaves.map(a=>a.executeCommand(s).catch(()=>{}));await Promise.allSettled(o)}async updateJointValues(e){if(!this.manualControlEnabled)return;const t=[];for(const{jointName:s,value:o}of e){const a=this._joints.find(c=>c.name===s);if(!a)continue;const l=this.clampJointValue(a,o);a.virtualValue=l,this.updateUrdfJointRotation(a,l),t.push({name:s,value:l})}if(t.length===0)return;const n={timestamp:Date.now(),joints:t};this._cloudSocket&&this._cloudSocket.readyState===WebSocket.OPEN&&this._cloudSocket.send(JSON.stringify({type:"command",data:n,robotId:this.id}));const i=this.connectedSlaves.map(s=>s.executeCommand(n).catch(()=>{}));await Promise.allSettled(i)}updateVirtualFromCommands(e){for(const t of e)for(const n of t.joints){const i=this._joints.find(s=>s.name===n.name);i&&(i.virtualValue=n.value,this.updateUrdfJointRotation(i,n.value))}}updateFromSlave(e,t){for(const n of t){const i=this._joints.find(s=>s.name===n.name);i&&n.realValue!==void 0&&(i.realValue=n.realValue+i.calibrationOffset)}}updateUrdfJointRotation(e,t){const n=e.urdfJoint;if(!n)return;const i=t*Math.PI/180,s=n.axis_xyz||[0,0,1];n.rotation=[i*s[0],i*s[1],i*s[2]]}clampJointValue(e,t){const n=e.urdfJoint.limit;if(!n)return t;const i=n.lower*180/Math.PI,s=n.upper*180/Math.PI;return Math.max(i,Math.min(s,t))}async moveToRestPosition(e=3e3){const t=this._joints.filter(i=>i.isActive).map(i=>({joint:i,start:i.virtualValue,target:i.restPosition,delta:i.restPosition-i.virtualValue})),n=Date.now();return new Promise(i=>{const s=()=>{const o=Math.min((Date.now()-n)/e,1),a=o<.5?4*o**3:1-(-2*o+2)**3/2;this.updateJointValues(t.map(l=>({jointName:l.joint.name,value:l.start+l.delta*a}))),o<1?setTimeout(s,50):i()};s()})}async moveSlaveToRestPosition(e){const t={timestamp:Date.now(),joints:this._joints.map(n=>({name:n.name,value:n.restPosition}))};await e.executeCommand(t)}async calibrateRobot(){if(this.connectedSlaves.length===0)throw new Error("No slaves connected");const e=await this.connectedSlaves[0].readJointStates();for(const t of e){const n=this._joints.find(i=>i.name===t.name);n&&t.realValue!==void 0&&(n.calibrationOffset=n.restPosition-t.realValue)}this._calibrationState.isCalibrated=!0}clearCalibration(){this._calibrationState.isCalibrated=!1,this._joints.forEac
4766h(e=>e.calibrationOffset=0)}getJoint(e){return this._joints.find(t=>t.name===e)}async destroy(){this._cloudSocket&&this._cloudSocket.close(),this.unsubscribeCallbacks.forEach(e=>e()),await this.removeMaster();for(const e of this._slaves)await this.removeSlave(e.id)}},Fu=new WeakMap,Bu=new WeakMap,zu=new WeakMap,Vu=new WeakMap,Gu=new WeakMap,Hu=new WeakMap,Wu=new WeakMap,f1);class AB{constructor(e){Ae(this,"type","master");Ae(this,"id");Ae(this,"name");Ae(this,"_status",{isConnected:!1});Ae(this,"config");Ae(this,"commandCallbacks",[]);Ae(this,"sequenceCallbacks",[]);Ae(this,"statusCallbacks",[]);Ae(this,"isPlaying",!1);Ae(this,"isPaused",!1);Ae(this,"currentSequenceIndex",0);Ae(this,"currentCommandIndex",0);Ae(this,"playbackIntervalId");this.config=e,this.id=`mock-sequence-${Date.now()}`,this.name="Mock Sequence Master",console.log(`Created MockSequenceMaster with ${e.sequences.length} sequences`)}get status(){return this._status}async connect(){console.log(`Connecting ${this.name}...`),this._status={isConnected:!0,lastConnected:new Date},this.notifyStatusChange(),this.config.autoStart&&await this.start(),console.log(`${this.name} connected`)}async disconnect(){console.log(`Disconnecting ${this.name}...`),await this.stop(),this._status={isConnected:!1},this.notifyStatusChange(),console.log(`${this.name} disconnected`)}async start(){if(!this._status.isConnected)throw new Error("Cannot start: master not connected");if(this.isPlaying&&!this.isPaused){console.log("Sequence already playing");return}console.log("Starting sequence playback..."),this.isPlaying=!0,this.isPaused=!1,this.currentSequenceIndex>=this.config.sequences.length&&(this.currentSequenceIndex=0,this.currentCommandIndex=0),this.startPlaybackLoop()}async stop(){console.log("Stopping sequence playback"),this.isPlaying=!1,this.isPaused=!1,this.currentSequenceIndex=0,this.currentCommandIndex=0,this.playbackIntervalId&&(clearInterval(this.playbackIntervalId),this.playbackIntervalId=void 0)}async pause(){console.log("Pausing sequence playback"),this.isPaused=!0,this.playbackIntervalId&&(clearInterval(this.playbackIntervalId),this.playbackIntervalId=void 0)}async resume(){!this.isPlaying||!this.isPaused||(console.log("Resuming sequence playback"),this.isPaused=!1,this.startPlaybackLoop())}onCommand(e){return this.commandCallbacks.push(e),()=>{const t=this.commandCallbacks.indexOf(e);t>=0&&this.commandCallbacks.splice(t,1)}}onSequence(e){return this.sequenceCallbacks.push(e),()=>{const t=this.sequenceCallbacks.indexOf(e);t>=0&&this.sequenceCallbacks.splice(t,1)}}onStatusChange(e){return this.statusCallbacks.push(e),()=>{const t=this.statusCallbacks.indexOf(e);t>=0&&this.statusCallbacks.splice(t,1)}}startPlaybackLoop(){this.playbackIntervalId&&clearInterval(this.playbackIntervalId),this.playbackIntervalId=setInterval(()=>{this.executeNextCommand()},Nl().SEQUENCE_PLAYBACK_INTERVAL_MS)}executeNextCommand(){if(!this.isPlaying||this.isPaused||this.config.sequences.length===0)return;const e=this.config.sequences[this.currentSequenceIndex];if(!e){this.handleSequenceEnd();return}const t=e.commands[this.currentCommandIndex];if(!t){this.handleCommandEnd();return}console.log(`Executing command ${this.currentCommandIndex+1}/${e.commands.length} from sequence "${e.name}"`),this.notifyCommand([t]),this.currentCommandIndex++}handleCommandEnd(){const e=this.config.sequences[this.currentSequenceIndex];this.notifySequence(e),this.currentCommandIndex=0,this.currentSequenceIndex++,this.currentSequenceIndex>=this.config.sequences.length&&(this.config.loopMode?(console.log("Looping back to first sequence"),this.currentSequenceIndex=0):(console.log("All sequences completed"),this.stop()))}handleSequenceEnd(){this.config.loopMode?(this.currentSequenceIndex=0,this.currentCommandIndex=0):this.stop()}notifyCommand(e){this.commandCallbacks.forEach(t=>{try{t(e)}catch(n){console.error("Error in command callback:",n)}})}notifySequence(e){this.sequenceCallbacks.forEach(t=>{try{t(e)}catch(n){console.error("Error in sequence callback:",n)}})}notifyStatusChange(){this.statusCallbacks.forEach(e=>{try{e(this._status)}catch(t){console.error("Error in status callback:",t)}})}}const CB=[{id:"gentle-wave",name:"Gentle Wave Pattern",totalDuration:6e3,commands:[{timestamp:0,joints:[{name:"Rotation",value:-10},{name:"Pitch",value:8},{name:"Elbow",value:-12}
4766],duration:2e3},{timestamp:2e3,joints:[{name:"Wrist_Roll",value:10}],duration:1e3},{timestamp:3e3,joints:[{name:"Wrist_Roll",value:-10}],duration:1e3},{timestamp:4e3,joints:[{name:"Wrist_Roll",value:0},{name:"Rotation",value:0},{name:"Pitch",value:0},{name:"Elbow",value:0}],duration:2e3}]},{id:"small-scan",name:"Small Scanning Pattern",totalDuration:8e3,commands:[{timestamp:0,joints:[{name:"Rotation",value:-15},{name:"Pitch",value:10}],duration:2e3},{timestamp:2e3,joints:[{name:"Rotation",value:15}],duration:3e3},{timestamp:5e3,joints:[{name:"Rotation",value:0},{name:"Pitch",value:0}],duration:3e3}]},{id:"tiny-flex",name:"Tiny Flex Pattern",totalDuration:8e3,commands:[{timestamp:0,joints:[{name:"Elbow",value:-15},{name:"Wrist_Pitch",value:8}],duration:2e3},{timestamp:2e3,joints:[{name:"Jaw",value:8}],duration:1e3},{timestamp:3e3,joints:[{name:"Elbow",value:-25}],duration:2e3},{timestamp:5e3,joints:[{name:"Jaw",value:0},{name:"Elbow",value:0},{name:"Wrist_Pitch",value:0}],duration:3e3}]}];class RB{constructor(e,t){Ae(this,"type","slave");Ae(this,"id");Ae(this,"name");Ae(this,"_status",{isConnected:!1});Ae(this,"config");Ae(this,"jointStates",[]);Ae(this,"stateCallbacks",[]);Ae(this,"statusCallbacks",[]);Ae(this,"simulationIntervalId");this.config=e,this.id=`mock-slave-${Date.now()}`,this.name="Mock Slave Robot",this.jointStates=t.map(n=>({...n,virtualValue:n.virtualValue,realValue:n.virtualValue})),console.log(`Created MockSlave with ${this.jointStates.length} joints`)}get status(){return this._status}async connect(){console.log(`Connecting ${this.name}...`),this.config.simulateLatency&&await new Promise(e=>setTimeout(e,this.config.simulateLatency)),this._status={isConnected:!0,lastConnected:new Date},this.notifyStatusChange(),this.startSimulation(),console.log(`${this.name} connected`)}async disconnect(){console.log(`Disconnecting ${this.name}...`),this.stopSimulation(),this._status={isConnected:!1},this.notifyStatusChange(),console.log(`${this.name} disconnected`)}async executeCommand(e){if(!this._status.isConnected)throw new Error("Cannot execute command: slave not connected");if(this.config.simulateErrors&&Math.random()<.1)throw new Error("Simulated command execution error");console.log(`MockSlave executing command with ${e.joints.length} joint updates`);for(const t of e.joints){const n=this.jointStates.find(i=>i.name===t.name);n&&(n.virtualValue=t.value,n.realValue=t.value)}this.config.responseDelay&&await new Promise(t=>setTimeout(t,this.config.responseDelay)),this.notifyStateUpdate()}async executeCommands(e){console.log(`MockSlave executing batch of ${e.length} commands`);for(const t of e)await this.executeCommand(t),e.length>1&&await new Promise(n=>setTimeout(n,50))}async readJointStates(){if(!this._status.isConnected)throw new Error("Cannot read states: slave not connected");return this.config.simulateLatency&&await new Promise(e=>setTimeout(e,this.config.simulateLatency)),[...this.jointStates]}async writeJointState(e,t){const n={timestamp:Date.now(),joints:[{name:e,value:t}]};await this.executeCommand(n)}async writeJointStates(e){const t={timestamp:Date.now(),joints:e.map(n=>({name:n.jointName,value:n.value}))};await this.executeCommand(t)}onStateUpdate(e){return this.stateCallbacks.push(e),()=>{const t=this.stateCallbacks.indexOf(e);t>=0&&this.stateCallbacks.splice(t,1)}}onStatusChange(e){return this.statusCallbacks.push(e),()=>{const t=this.statusCallbacks.indexOf(e);t>=0&&this.statusCallbacks.splice(t,1)}}startSimulation(){this.simulationIntervalId&&clearInterval(this.simulationIntervalId),this.simulationIntervalId=setInterval(()=>{this.notifyStateUpdate()},Nl().STATE_UPDATE_INTERVAL_MS)}stopSimulation(){this.simulationIntervalId&&(clearInterval(this.simulationIntervalId),this.simulationIntervalId=void 0)}notifyStateUpdate(){this.stateCallbacks.forEach(e=>{try{e([...this.jointStates])}catch(t){console.error("Error in state update callback:",t)}})}notifyStatusChange(){this.statusCallbacks.forEach(e=>{try{e(this._status)}catch(t){console.error("Error in status change callback:",t)}})}}const Sl=254,PB=1,Fw=2,IB=3,DB=131,LB=130,Qt=0,If=-1,Vc=-2,Dl=-3,Bw=-4,kB=-5,fv=-6,tr=-7,ya=-9,UB=250,NB=250,df=0,hf=1,Ni=2,Ki=3,Ml=4,xE=4,Vn=5,OB=1,FB=2,BB=4,zB=8,VB=32,GB=1e6,HB=16;let Ol=0;function zw(r){return r&65535}function Vw(r){return r>>16&65535}function du(r){return Ol===0?r&255:r>>8&255}function hu(r){return Ol===0?r>>8&255:r&255}function As(r,e){return Ol===0?r&255|(e&255)<<8:e&255|(r&255)<<8}function bE(r,e){return r&65535|(e&65535)<<16}class wE{constructor(){this.port=null,this.reader=null,this.writer=null,this.isOpen=!1,this.isUsing=!1,this.baudrate=GB,this.packetStartTime=0,this.packetTimeout=0,this.txTimePerByte=0}async requestPort(){try{return this.port=await navigator.serial.requestPort(),!0}catch(e){return console.error("Error requesting serial port:",e),!1}}
4766async openPort(){if(!this.port)return!1;try{return await this.port.open({baudRate:this.baudrate}),this.reader=this.port.readable.getReader(),this.writer=this.port.writable.getWriter(),this.isOpen=!0,this.txTimePerByte=1e3/this.baudrate*10,!0}catch(e){return console.error("Error opening port:",e),!1}}async closePort(){this.reader&&(await this.reader.releaseLock(),this.reader=null),this.writer&&(await this.writer.releaseLock(),this.writer=null),this.port&&this.isOpen&&(await this.port.close(),this.isOpen=!1)}async clearPort(){this.reader&&(await this.reader.releaseLock(),this.reader=this.port.readable.getReader())}setBaudRate(e){return this.baudrate=e,this.txTimePerByte=1e3/this.baudrate*10,!0}getBaudRate(){return this.baudrate}async writePort(e){if(!this.isOpen||!this.writer)return 0;try{return await this.writer.write(new Uint8Array(e)),e.length}catch(t){return console.error("Error writing to port:",t),0}}async readPort(e){if(!this.isOpen||!this.reader)return[];try{let n=[];const i=performance.now();for(;n.length<e;){const s=new Promise(l=>{setTimeout(()=>l({value:new Uint8Array,done:!1,timeout:!0}),100)}),o=await Promise.race([this.reader.read(),s]);if(o.timeout){if(performance.now()-i>500){console.log("readPort total timeout after 500ms");break}continue}if(o.done){console.log("Reader done, stream closed");break}if(o.value.length===0){if(await new Promise(l=>setTimeout(l,10)),performance.now()-i>500){console.log("readPort total timeout after 500ms");break}continue}const a=Array.from(o.value);if(n.push(...a),console.log(`Read ${a.length} bytes:`,a.map(l=>l.toString(16).padStart(2,"0")).join(" ")),n.length>=e)break}return n}catch(t){return console.error("Error reading from port:",t),[]}}setPacketTimeout(e){this.packetStartTime=this.getCurrentTime(),this.packetTimeout=this.txTimePerByte*e+HB*2+2}setPacketTimeoutMillis(e){this.packetStartTime=this.getCurrentTime(),this.packetTimeout=e}isPacketTimeout(){return this.getTimeSinceStart()>this.packetTimeout?(this.packetTimeout=0,!0):!1}getCurrentTime(){return performance.now()}getTimeSinceStart(){const e=this.getCurrentTime()-this.packetStartTime;return e<0&&(this.packetStartTime=this.getCurrentTime()),e}}class SE{constructor(e=0){Ol=e,console.log(`PacketHandler initialized with protocol_end=${e} (STS/SMS=0, SCS=1)`)}getProtocolVersion(){return 1}getProtocolEnd(){return Ol}getTxRxResult(e){return e===Qt?"[TxRxResult] Communication success!":e===If?"[TxRxResult] Port is in use!":e===Vc?"[TxRxResult] Failed transmit instruction packet!":e===Dl?"[TxRxResult] Failed get status packet from device!":e===Bw?"[TxRxResult] Incorrect instruction packet!":e===kB?"[TxRxResult] Now receiving status packet!":e===fv?"[TxRxResult] There is no status packet!":e===tr?"[TxRxResult] Incorrect status packet!":e===ya?"[TxRxResult] Protocol does not support this function!":""}getRxPacketError(e){return e&OB?"[RxPacketError] Input voltage error!":e&FB?"[RxPacketError] Angle sen error!":e&BB?"[RxPacketError] Overheat error!":e&zB?"[RxPacketError] OverEle error!":e&VB?"[RxPacketError] Overload error!":""}async txPacket(e,t){let n=0;const i=t[Ki]+4;if(e.isUsing)return If;if(e.isUsing=!0,i>UB)return e.isUsing=!1,Bw;t[df]=255,t[hf]=255;for(let o=2;o<i-1;o++)n+=t[o];t[i-1]=~n&255,await e.clearPort();const s=await e.writePort(t);return i!==s?(e.isUsing=!1,Vc):Qt}async rxPacket(e){let t=[],n=Dl,i=6;for(;;){const s=await e.readPort(i-t.length);if(t.push(...s),t.length>=i){let o=-1;for(let a=0;a<t.length-1;a++)if(t[a]===255&&t[a+1]===255){o=a;break}if(o===0){if(t[Ni]>253||t[Ki]>NB){t.shift();continue}if(i!==t[Ki]+Ki+1){i=t[Ki]+Ki+1;continue}if(t.length<i){if(e.isPacketTimeout()){n=t.length===0?fv:tr;break}continue}let a=0;for(let l=2;l<i-1;l++)a+=t[l];a=~a&255,t[i-1]===a?n=Qt:n=tr;break}else if(o>0){t=t.slice(o);continue}}if(e.isPacketTimeout()){n=t.length===0?fv:tr;break}}return n!==Qt?console.log(`rxPacket result: ${n}, packet: ${t.map(s=>"0x"+s.toString(16).padStart(2,"0")).join(" ")}`):console.debug(`rxPacket successful: ${t.map(s=>"0x"+s.toString(16).padStart(2,"0")).join(" ")}`),[t,n]}async txRxPacket(e,t){let n=null,i=0,s=Vc;try{if(e.isUsing)return console.log("Port is busy, cannot start new transaction"),[n,If,i];if(console.log("Sending packet:",t.map(l=>"0x"+l.toString(16).padStart(2,"0")).join(" ")),s=await this.txPacket(e,t),console.log(`TX result: ${s}`),s!==Qt)return console.log(`TX failed with result: ${s}`),e.isUsing=!1,[n,s,i];if(t[Ni]===Sl)return e.isUsing=!1,[n,s,i];if(t[Ml]===Fw){const l=t[Vn+1];e.setPacketTimeout(l+10),console.log(`Set READ packet timeout for ${l+10} bytes`)}else e.setPacketTimeout(10),console.log("Set standard packet timeout for 10 bytes");console.log("Receiving packet"),await e.clearPort();const[o,a]=await this.rxPacket(e);return n=o,a!==Qt?(console.log(`Rx failed with result: ${a}`),e.isUsing=!1,[n,a,i]):n.length<6?(console.log(`Received packet too short (${n.length} bytes)`),e.isUsing=!1,[n,tr,i]):n[Ni]!==t[Ni]?(console.log(`Received packet ID (${n[Ni]}) doesn't match sent ID (${t[Ni]})`),e.isUsing=!1,[n,tr,i]):(i=n[xE],e.isUsing=!1,[n,a,i])}catch(o){return console.error("Exception in txRxPacket:",o),e.isUsing=!1,[n,Dl,i]}}async ping(e,t){let n=0,i=0;try{if(t>=Sl)return console.log(`Cannot ping broadcast ID ${t}`),[n,ya,i];const s=new Array(6).fill(0);s[Ni]=t,s[Ki]=2,s[Ml]=PB,console.log(`Pinging servo ID ${t}...`);const[o,a,l]=await this.txRxPacket(e,s);if(i=l,a===Qt){console.log(`Ping to servo ID ${t} succeeded, reading model number from address 3`);const[c,u,d]=await this.readTxRx(e,t,3,2);u===Qt&&c&&c.length>=2?(n=As(c[0],c[1]),console.log(`Model number read: ${n}`)):console.log(`Could not read model number: ${this.getTxRxResult(u)}`)}else console.log(`Ping failed with result: ${a}, error: ${i}`);return[n,a,i]}catch(s){return console.error("Exception in ping():",s),[0,Dl,0]}}async readTxRx(e,t,n,i){if(t>=Sl)return console.log("Cannot read from broadcast ID"),[[],ya,0];const s=new Array(8).fill(0);
4766s[Ni]=t,s[Ki]=4,s[Ml]=Fw,s[Vn]=n,s[Vn+1]=i,console.log(`Reading ${i} bytes from address ${n} for servo ID ${t}`);const[o,a,l]=await this.txRxPacket(e,s);if(a!==Qt)return console.log(`Read failed with result: ${a}, error: ${l}`),[[],a,l];if(!o||o.length<Vn+i)return console.log(`Invalid response packet: expected at least ${Vn+i} bytes, got ${o?o.length:0}`),[[],tr,l];const c=[];console.log(`Response packet length: ${o.length}, extracting ${i} bytes from offset ${Vn}`),console.log(`Response data bytes: ${o.slice(Vn,Vn+i).map(u=>"0x"+u.toString(16).padStart(2,"0")).join(" ")}`);for(let u=0;u<i;u++)c.push(o[Vn+u]);return console.log(`Successfully read ${i} bytes: ${c.map(u=>"0x"+u.toString(16).padStart(2,"0")).join(" ")}`),[c,a,l]}async read1ByteTxRx(e,t,n){const[i,s,o]=await this.readTxRx(e,t,n,1);return[i.length>0?i[0]:0,s,o]}async read2ByteTxRx(e,t,n){const[i,s,o]=await this.readTxRx(e,t,n,2);let a=0;return i.length>=2&&(a=As(i[0],i[1])),[a,s,o]}async read4ByteTxRx(e,t,n){const[i,s,o]=await this.readTxRx(e,t,n,4);let a=0;if(i.length>=4){const l=As(i[0],i[1]),c=As(i[2],i[3]);a=bE(l,c),console.log(`read4ByteTxRx: data=${i.map(u=>"0x"+u.toString(16).padStart(2,"0")).join(" ")}`),console.log(`  loword=${l} (0x${l.toString(16)}), hiword=${c} (0x${c.toString(16)})`),console.log(`  value=${a} (0x${a.toString(16)})`)}return[a,s,o]}async writeTxRx(e,t,n,i,s){if(t>=Sl)return[ya,0];const o=new Array(i+7).fill(0);o[Ni]=t,o[Ki]=i+3,o[Ml]=IB,o[Vn]=n;for(let u=0;u<i;u++)o[Vn+1+u]=s[u]&255;const[a,l,c]=await this.txRxPacket(e,o);return[l,c]}async write1ByteTxRx(e,t,n,i){const s=[i&255];return await this.writeTxRx(e,t,n,1,s)}async write2ByteTxRx(e,t,n,i){const s=[du(i),hu(i)];return await this.writeTxRx(e,t,n,2,s)}async write4ByteTxRx(e,t,n,i){const s=[du(zw(i)),hu(zw(i)),du(Vw(i)),hu(Vw(i))];return await this.writeTxRx(e,t,n,4,s)}async syncReadTx(e,t,n,i,s){const o=new Array(s+8).fill(0);o[Ni]=Sl,o[Ki]=s+4,o[Ml]=LB,o[Vn]=t,o[Vn+1]=n;for(let u=0;u<s;u++)o[Vn+2+u]=i[u];const a=o[Ki]+4;o[df]=255,o[hf]=255;let l=0;for(let u=2;u<a-1;u++)l+=o[u]&255;return o[a-1]=~l&255,console.log(`SyncReadTx: ${o.map(u=>"0x"+u.toString(16).padStart(2,"0")).join(" ")}`),await e.clearPort(),await e.writePort(o)!==a?Vc:(e.setPacketTimeout((6+n)*s),Qt)}async syncWriteTxOnly(e,t,n,i,s){const o=new Array(s+8).fill(0);o[Ni]=Sl,o[Ki]=s+4,o[Ml]=DB,o[Vn]=t,o[Vn+1]=n;for(let u=0;u<s;u++)o[Vn+2+u]=i[u];const a=o[Ki]+4;o[df]=255,o[hf]=255;let l=0;for(let u=2;u<a-1;u++)l+=o[u]&255;return o[a-1]=~l&255,console.log(`SyncWriteTxOnly: ${o.map(u=>"0x"+u.toString(16).padStart(2,"0")).join(" ")}`),await e.clearPort(),await e.writePort(o)!==a?Vc:Qt}formatPacketStructure(e){if(!e||e.length<4)return"Invalid packet (too short)";try{let t="";if(t+=`HEADER: ${e[0].toString(16).padStart(2,"0")} ${e[1].toString(16).padStart(2,"0")} | `,t+=`ID: ${e[2]} | `,t+=`LENGTH: ${e[3]} | `,e.length>=5&&(t+=`ERROR/INST: ${e[4].toString(16).padStart(2,"0")} | `),e.length>=6){t+="PARAMS: ";for(let n=5;n<e.length-1;n++)t+=`${e[n].toString(16).padStart(2,"0")} `;t+=`| CHECKSUM: ${e[e.length-1].toString(16).padStart(2,"0")}`}return t}catch(t){return"Error formatting packet: "+t.message}}parseModelNumber(e){if(!e||e.length<7||e.length<=Vn+1)return 0;const t=e[Vn],n=e[Vn+1];return Ol===0?As(t,n):As(n,t)}getPacketHeader(e){if(!e||e.length<4||e[df]!==255||e[hf]!==255||e[Ni]>253||e.length!=e[Ki]+4)return tr;let t=0;for(let n=2;n<e.length-1;n++)t+=e[n]&255;return t=~t&255,e[e.length-1]!==t?tr:Qt}}class ME{constructor(e,t,n,i){this.port=e,this.ph=t,this.startAddress=n,this.dataLength=i,this.isAvailableServiceID=new Set,this.dataDict=new Map,this.param=[],this.clearParam()}makeParam(){this.param=[];for(const e of this.isAvailableServiceID)this.param.push(e);return this.param.length}addParam(e){return this.isAvailableServiceID.has(e)?!1:(this.isAvailableServiceID.add(e),this.dataDict.set(e,new Array(this.dataLength).fill(0)),!0)}removeParam(e){return this.isAvailableServiceID.has(e)?(this.isAvailableServiceID.delete(e),this.dataDict.delete(e),!0):!1}clearParam(){return this.isAvailableServiceID.clear(),this.dataDict.clear(),!0}async txPacket(){if(this.isAvailableServiceID.size===0)return ya;const e=this.makeParam();return await this.ph.syncReadTx(this.port,this.startAddress,this.dataLength,this.param,e)}async rxPacket(){let e=Dl;if(this.isAvailableServiceID.size===0)return ya;for(const o of this.isAvailableServiceID)this.dataDict.set(o,new Array(this.dataLength).fill(0));const[t,n]=await this.ph.rxPacket(this.port);
4766if(n!==Qt||!t||t.length===0)return n;if(console.log(`GroupSyncRead rxPacket: ID=${t[Ni]}, ERROR/INST field=0x${t[xE].toString(16)}`),!this.isAvailableServiceID.has(t[Ni]))return console.log(`Received packet with ID ${t[Ni]} which is not in the available IDs list`),tr;const i=t[Ni],s=new Array(this.dataLength).fill(0);if(t.length<Vn+this.dataLength)return console.log(`Packet too short: expected ${Vn+this.dataLength} bytes, got ${t.length}`),tr;for(let o=0;o<this.dataLength;o++)s[o]=t[Vn+o];return this.dataDict.set(i,s),console.log(`Updated data for servo ID ${i}: ${s.map(o=>"0x"+o.toString(16).padStart(2,"0")).join(" ")}`),this.isAvailableServiceID.size>1?e=await this.rxPacket():e=Qt,e}async txRxPacket(){try{if(this.port.isUsing)return console.log("Port is busy, cannot start sync read operation"),If;console.log("Starting sync read TX/RX operation...");let e=await this.txPacket();return e!==Qt?(console.log(`Sync read TX failed with result: ${e}`),e):(console.log("Attempting to receive a response..."),e=await this.rxPacket(),this.port.isUsing=!1,e)}catch(e){return console.error("Exception in GroupSyncRead txRxPacket:",e),this.port.isUsing=!1,Dl}}isAvailable(e,t,n){if(!this.isAvailableServiceID.has(e))return!1;const i=this.startAddress,s=i+this.dataLength-1,o=t,a=o+n-1;if(o<i||a>s)return!1;const l=this.dataDict.get(e);return!(!l||l.length===0)}getData(e,t,n){if(!this.isAvailable(e,t,n))return 0;const i=this.startAddress,s=this.dataDict.get(e),o=t-i;switch(n){case 1:return s[o];case 2:return As(s[o],s[o+1]);case 4:return bE(As(s[o],s[o+1]),As(s[o+2],s[o+3]));default:return 0}}}class EE{constructor(e,t,n,i){this.port=e,this.ph=t,this.startAddress=n,this.dataLength=i,this.isAvailableServiceID=new Set,this.dataDict=new Map,this.param=[],this.clearParam()}makeParam(){this.param=[];for(const e of this.isAvailableServiceID){this.param.push(e);const t=this.dataDict.get(e);for(let n=0;n<this.dataLength;n++)this.param.push(t[n])}return this.param.length}addParam(e,t){return this.isAvailableServiceID.has(e)?!1:t.length!==this.dataLength?(console.error(`Data length (${t.length}) doesn't match required length (${this.dataLength})`),!1):(this.isAvailableServiceID.add(e),this.dataDict.set(e,t),!0)}removeParam(e){return this.isAvailableServiceID.has(e)?(this.isAvailableServiceID.delete(e),this.dataDict.delete(e),!0):!1}changeParam(e,t){return this.isAvailableServiceID.has(e)?t.length!==this.dataLength?(console.error(`Data length (${t.length}) doesn't match required length (${this.dataLength})`),!1):(this.dataDict.set(e,t),!0):!1}clearParam(){return this.isAvailableServiceID.clear(),this.dataDict.clear(),!0}async txPacket(){if(this.isAvailableServiceID.size===0)return ya;const e=this.makeParam();return await this.ph.syncWriteTxOnly(this.port,this.startAddress,this.dataLength,this.param,e)}}const WB=40,jB=41,TE=42,AE=46,qm=56,t_=33,qs=55,XB=5,CE=6;let en=null,Gt=null;async function qB(r={}){if(en&&en.isOpen)return console.log("Already connected."),!0;const{baudRate:e=1e6,protocolEnd:t=0}=r;try{if(en=new wE,!await en.requestPort())throw en=null,new Error("Failed to select a serial port.");if(en.setBaudRate(e),!await en.openPort())throw await en.closePort().catch(console.error),en=null,new Error(`Failed to open port at baudrate ${e}.`);return Gt=new SE(t),console.log(`Connected to serial port at ${e} baud, protocol end: ${t}.`),!0}catch(n){if(console.error("Error during connection:",n),en)try{await en.closePort()}catch(i){console.error("Error closing port after connection failure:",i)}throw en=null,Gt=null,new Error(`Connection failed: ${n.message}`)}}async function YB(){if(!en||!en.isOpen)return console.log("Already disconnected."),!0;try{return await en.closePort(),en=null,Gt=null,console.log("Disconnected from serial port."),!0}catch(r){throw console.error("Error during disconnection:",r),en=null,Gt=null,new Error(`Disconnection failed: ${r.message}`)}}function ur(){if(!en||!Gt)throw new Error("Not connected. Call connect() first.")}async function $B(r){ur();try{const[e,t,n]=await Gt.read2ByteTxRx(en,r,qm);if(t!==Qt)throw new Error(`Error reading position from servo ${r}: ${Gt.getTxRxResult(t)}, Error code: ${n}`);return e&65535}catch(e){throw console.error(`Exception reading position from servo ${r}:`,e),new Error(`Exception reading position from servo ${r}: ${e.message}`)}}async function ZB(r){ur();try{const[e,t,n]=await Gt.read1ByteTxRx(en,r,CE);if(t!==Qt)throw new Error(`Error reading baud rate from servo ${r}: ${Gt.getTxRxResult(t)}, Error code: ${n}`);return e}catch(e){throw console.error(`Exception reading baud rate from servo ${r}:`,e),new Error(`Exception reading baud rate from servo ${r}: ${e.message}`)}}async function JB(r){ur();try{const[e,t,n]=await Gt.read1ByteTxRx(en,r,t_);if(t!==Qt)throw new Error(`Error reading mode from servo ${r}: ${Gt.getTxRxResult(t)}, Error code: ${n}`);return e}catch(e){throw console.error(`Exception reading mode from servo ${r}:`,e),new Error(`Exception reading mode from servo ${r}: ${e.message}`)}}async function KB(r,e){ur();try{if(e<0||e>4095)throw new Error(`Invalid position value ${e} for servo ${r}. Must be between 0 and 4095.`);const t=Math.round(e),[n,i]=await Gt.write2ByteTxRx(en,r,TE,t);
4766if(n!==Qt)throw new Error(`Error writing position to servo ${r}: ${Gt.getTxRxResult(n)}, Error code: ${i}`);return"success"}catch(t){throw console.error(`Exception writing position to servo ${r}:`,t),new Error(`Failed to write position to servo ${r}: ${t.message}`)}}async function QB(r,e){ur();try{const t=e?1:0,[n,i]=await Gt.write1ByteTxRx(en,r,WB,t);if(n!==Qt)throw new Error(`Error setting torque for servo ${r}: ${Gt.getTxRxResult(n)}, Error code: ${i}`);return"success"}catch(t){throw console.error(`Exception setting torque for servo ${r}:`,t),new Error(`Exception setting torque for servo ${r}: ${t.message}`)}}async function ez(r,e){ur();try{const t=Math.max(0,Math.min(254,Math.round(e))),[n,i]=await Gt.write1ByteTxRx(en,r,jB,t);if(n!==Qt)throw new Error(`Error writing acceleration to servo ${r}: ${Gt.getTxRxResult(n)}, Error code: ${i}`);return"success"}catch(t){throw console.error(`Exception writing acceleration to servo ${r}:`,t),new Error(`Exception writing acceleration to servo ${r}: ${t.message}`)}}async function Ym(r){try{await Gt.write1ByteTxRx(en,r,qs,1)}catch(e){console.error(`Failed to re-lock servo ${r}:`,e)}}async function tz(r){ur();let e=!1;try{console.log(`Setting servo ${r} to wheel mode...`);const[t,n]=await Gt.write1ByteTxRx(en,r,qs,0);if(t!==Qt)throw new Error(`Failed to unlock servo ${r}: ${Gt.getTxRxResult(t)}, Error: ${n}`);e=!0;const[i,s]=await Gt.write1ByteTxRx(en,r,t_,1);if(i!==Qt)throw new Error(`Failed to set wheel mode for servo ${r}: ${Gt.getTxRxResult(i)}, Error: ${s}`);const[o,a]=await Gt.write1ByteTxRx(en,r,qs,1);if(o!==Qt)throw new Error(`Failed to lock servo ${r} after setting mode: ${Gt.getTxRxResult(o)}, Error: ${a}`);return e=!1,console.log(`Successfully set servo ${r} to wheel mode.`),"success"}catch(t){throw console.error(`Exception setting wheel mode for servo ${r}:`,t),e&&await Ym(r),new Error(`Failed to set wheel mode for servo ${r}: ${t.message}`)}}async function nz(r){ur();let e=!1;try{console.log(`Setting servo ${r} back to position mode...`);const[t,n]=await Gt.write1ByteTxRx(en,r,qs,0);if(t!==Qt)throw new Error(`Failed to unlock servo ${r}: ${Gt.getTxRxResult(t)}, Error: ${n}`);e=!0;const[i,s]=await Gt.write1ByteTxRx(en,r,t_,0);if(i!==Qt)throw new Error(`Failed to set position mode for servo ${r}: ${Gt.getTxRxResult(i)}, Error: ${s}`);const[o,a]=await Gt.write1ByteTxRx(en,r,qs,1);if(o!==Qt)throw new Error(`Failed to lock servo ${r} after setting mode: ${Gt.getTxRxResult(o)}, Error: ${a}`);return e=!1,console.log(`Successfully set servo ${r} back to position mode.`),"success"}catch(t){throw console.error(`Exception setting position mode for servo ${r}:`,t),e&&await Ym(r),new Error(`Failed to set position mode for servo ${r}: ${t.message}`)}}async function iz(r,e){ur();try{const t=Math.max(-1e4,Math.min(1e4,Math.round(e)));let n=Math.abs(t)&32767;t<0&&(n|=32768);const[i,s]=await Gt.write2ByteTxRx(en,r,AE,n);if(i!==Qt)throw new Error(`Error writing wheel speed to servo ${r}: ${Gt.getTxRxResult(i)}, Error: ${s}`);return"success"}catch(t){throw console.error(`Exception writing wheel speed to servo ${r}:`,t),new Error(`Exception writing wheel speed to servo ${r}: ${t.message}`)}}async function rz(r){ur();const e=new EE(en,Gt,AE,2);let t=!1;const n=r instanceof Map?r.entries():Object.entries(r);for(const[i,s]of n){const o=parseInt(i,10);if(isNaN(o)||o<1||o>252)throw new Error(`Invalid servo ID "${i}" in syncWriteWheelSpeed.`);if(s<-1e4||s>1e4)throw new Error(`Invalid speed value ${s} for servo ${o} in syncWriteWheelSpeed. Must be between -10000 and 10000.`);const a=Math.max(-1e4,Math.min(1e4,Math.round(s)));let l=Math.abs(a)&32767;a<0&&(l|=32768);const c=[du(l),hu(l)];e.addParam(o,c)?t=!0:console.warn(`Failed to add servo ${o} to sync write speed group (possibly duplicate).`)}if(!t)return console.log("Sync Write Speed: No valid servo speeds provided or added."),"success";try{const i=await e.txPacket();if(i!==Qt)throw new Error(`Sync Write Speed txPacket failed: ${Gt.getTxRxResult(i)}`);return"success"}catch(i){throw console.error("Exception during syncWriteWheelSpeed:",i),new Error(`Sync Write Speed failed: ${i.message}`)}}async function sz(r){if(ur(),!Array.isArray(r)||r.length===0)return console.log("Sync Read: No servo IDs provided."),new Map;const e=qm,t=2,n=new ME(en,Gt,e,t),i=new Map,s=[];if(r.forEach(o=>{o>=1&&o<=252?n.addParam(o)?s.push(o):console.warn(`Sync Read: Failed to add param for servo ID ${o} (maybe duplicate or invalid).`):console.warn(`Sync Read: Invalid servo ID ${o} skipped.`)}),s.length===0)return console.log("Sync Read: No valid servo IDs to read."),new Map;try{let o=await n.txPacket();if(o!==Qt)throw new Error(`Sync Read txPacket failed: ${Gt.getTxRxResult(o)}`);let a=await n.rxPacket();a!==Qt&&console.warn(`Sync Read rxPacket overall result: ${Gt.getTxRxResult(a)}. Checking individual servos.`);const l=[];
4766if(s.forEach(c=>{if(n.isAvailable(c,e,t)){const d=n.getData(c,e,t);i.set(c,d&65535)}else l.push(c)}),l.length>0)throw new Error(`Sync Read failed: Data not available for servo IDs: ${l.join(", ")}. Overall RX result: ${Gt.getTxRxResult(a)}`);return i}catch(o){throw console.error("Exception or failure during syncReadPositions:",o),new Error(`Sync Read failed: ${o.message}`)}}async function oz(r){ur();const e=new EE(en,Gt,TE,2);let t=!1;const n=r instanceof Map?r.entries():Object.entries(r);for(const[i,s]of n){const o=parseInt(i,10);if(isNaN(o)||o<1||o>252)throw new Error(`Invalid servo ID "${i}" in syncWritePositions.`);if(s<0||s>4095)throw new Error(`Invalid position value ${s} for servo ${o} in syncWritePositions. Must be between 0 and 4095.`);const a=Math.round(s),l=[du(a),hu(a)];e.addParam(o,l)?t=!0:console.warn(`Failed to add servo ${o} to sync write group (possibly duplicate).`)}if(!t)return console.log("Sync Write: No valid servo positions provided or added."),"success";try{const i=await e.txPacket();if(i!==Qt)throw new Error(`Sync Write txPacket failed: ${Gt.getTxRxResult(i)}`);return"success"}catch(i){throw console.error("Exception during syncWritePositions:",i),new Error(`Sync Write failed: ${i.message}`)}}async function az(r,e){if(ur(),r<1||r>252)throw new Error(`Invalid servo ID provided: ${r}. Must be between 1 and 252.`);if(e<0||e>7)throw new Error(`Invalid baudRateIndex: ${e}. Must be between 0 and 7.`);let t=!1;try{console.log(`Setting baud rate for servo ${r}: Index=${e}`);const[n,i]=await Gt.write1ByteTxRx(en,r,qs,0);if(n!==Qt)throw new Error(`Failed to unlock servo ${r}: ${Gt.getTxRxResult(n)}, Error: ${i}`);t=!0;const[s,o]=await Gt.write1ByteTxRx(en,r,CE,e);if(s!==Qt)throw new Error(`Failed to write baud rate index ${e} to servo ${r}: ${Gt.getTxRxResult(s)}, Error: ${o}`);const[a,l]=await Gt.write1ByteTxRx(en,r,qs,1);if(a!==Qt)throw new Error(`Failed to lock servo ${r} after setting baud rate: ${Gt.getTxRxResult(a)}, Error: ${l}.`);return t=!1,console.log(`Successfully set baud rate for servo ${r}. Index: ${e}. Remember to potentially reconnect with the new baud rate.`),"success"}catch(n){throw console.error(`Exception during setBaudRate for servo ID ${r}:`,n),t&&await Ym(r),new Error(`Failed to set baud rate for servo ${r}: ${n.message}`)}}async function lz(r,e){if(ur(),r<1||r>252||e<1||e>252)throw new Error(`Invalid servo ID provided. Current: ${r}, New: ${e}. Must be between 1 and 252.`);if(r===e)return console.log(`Servo ID is already ${e}. No change needed.`),"success";let t=!1,n=!1;try{console.log(`Setting servo ID: From ${r} to ${e}`);const[i,s]=await Gt.write1ByteTxRx(en,r,qs,0);if(i!==Qt)throw new Error(`Failed to unlock servo ${r}: ${Gt.getTxRxResult(i)}, Error: ${s}`);t=!0;const[o,a]=await Gt.write1ByteTxRx(en,r,XB,e);if(o!==Qt)throw new Error(`Failed to write new ID ${e} to servo ${r}: ${Gt.getTxRxResult(o)}, Error: ${a}`);n=!0;const[l,c]=await Gt.write1ByteTxRx(en,e,qs,1);if(l!==Qt)throw new Error(`Failed to lock servo with new ID ${e}: ${Gt.getTxRxResult(l)}, Error: ${c}. Configuration might be incomplete.`);return t=!1,console.log(`Successfully set servo ID from ${r} to ${e}. Remember to use the new ID for future commands.`),"success"}catch(i){if(console.error(`Exception during setServoId for current ID ${r}:`,i),t){const s=n?e:r;console.warn(`Attempting to re-lock servo using ID ${s}...`),await Ym(s)}throw new Error(`Failed to set servo ID from ${r} to ${e}: ${i.message}`)}}let ri=null,ps=null;async function cz(r={}){if(ri&&ri.isOpen)return console.log("🔓 Already connected to USB robot (read-only mode)."),!0;const{baudRate:e=1e6,protocolEnd:t=0}=r;try{if(ri=new wE,!await ri.requestPort())throw ri=null,new Error("Failed to select a serial port.");if(ri.setBaudRate(e),!await ri.openPort())throw await ri.closePort().catch(console.error),ri=null,new Error(`Failed to open port at baudrate ${e}.`);return ps=new SE(t),console.log(`🔓 Connected to USB robot (read-only mode) at ${e} baud, protocol end: ${t}.`),!0}catch(n){if(console.error("Error during USB robot connection:",n),ri)try{await ri.closePort()}catch(i){console.error("Error closing port after connection failure:",i)}throw ri=null,ps=null,new Error(`USB robot connection failed: ${n.message}`)}}async function uz(){if(!ri||!ri.isOpen)return console.log("Already disconnected from USB robot."),!0;try{return await ri.closePort(),ri=null,ps=null,console.log("🔓 Disconnected from USB robot (read-only mode)."),!0}catch(r){throw console.error("Error during USB robot disconnection:",r),ri=null,ps=null,new Error(`USB robot disconnection failed: ${r.message}`)}}function RE(){if(!ri||!ps)throw new Error("Not connected to USB robot. Call connect() first.")}async function dz(r){RE();try{const[e,t,n]=await ps.read2ByteTxRx(ri,r,qm);if(t!==Qt)throw new Error(`Error reading position from servo ${r}: ${ps.getTxRxResult(t)}, Error code: ${n}`);return e&65535}catch(e){throw console.error(`Exception reading position from servo ${r}:`,e),new Error(`Exception reading position from servo ${r}: ${e.message}`)}}async function hz(r){if(RE(),!Array.isArray(r)||r.length===0)return console.log("Sync Read: No servo IDs provided."),new Map;const e=qm,t=2,n=new ME(ri,ps,e,t),i=new Map,s=[];if(r.forEach(o=>{o>=1&&o<=252?n.addParam(o)?s.push(o):console.warn(`Sync Read: Failed to add param for servo ID ${o} (maybe duplicate or invalid).`):console.warn(`Sync Read: Invalid servo ID ${o} skipped.`)}),s.length===0)return console.log("Sync Read: No valid servo IDs to read."),new Map;try{let o=await n.txPacket();if(o!==Qt)throw new Error(`Sync Read txPacket failed: ${ps.getTxRxResult(o)}`);let a=await n.rxPacket();a!==Qt&&console.warn(`Sync Read rxPacket overall result: ${ps.getTxRxResult(a)}. Checking individual servos.`);const l=[];
4766return s.forEach(c=>{if(n.isAvailable(c,e,t)){const d=n.getData(c,e,t),h=d&65535;console.log(`🔍 Debug Servo ${c}: raw=${d}, final=${h}, hex=${d.toString(16)}`),i.set(c,h)}else l.push(c)}),l.length>0&&console.warn(`Sync Read: Data not available for servo IDs: ${l.join(", ")}. Got ${i.size}/${s.length} servos successfully.`),i}catch(o){throw console.error("Exception during syncReadPositions:",o),new Error(`Sync Read failed: ${o.message}`)}}const Tr={connect:qB,disconnect:YB,readPosition:$B,readBaudRate:ZB,readMode:JB,writePosition:KB,writeTorqueEnable:QB,writeAcceleration:ez,setWheelMode:tz,setPositionMode:nz,writeWheelSpeed:iz,syncReadPositions:sz,syncWritePositions:oz,syncWriteWheelSpeed:rz,setBaudRate:az,setServoId:lz},na={connect:cz,disconnect:uz,readPosition:dz,syncReadPositions:hz};class fz{constructor(e,t){Ae(this,"type","slave");Ae(this,"id");Ae(this,"name");Ae(this,"_status",{isConnected:!1});Ae(this,"config");Ae(this,"jointStates",[]);Ae(this,"initialPositions",[]);Ae(this,"stateCallbacks",[]);Ae(this,"statusCallbacks",[]);this.config=e,this.id=`usb-slave-${Date.now()}`,this.name="USB Slave Robot",this.jointStates=t.map(i=>({...i}));const n=this.jointStates.filter(i=>!i.servoId);n.length>0&&console.warn(`USB slave: Some joints missing servo IDs: ${n.map(i=>i.name).join(", ")}`),console.log(`Created USBSlave with ${this.jointStates.length} joints`)}get status(){return this._status}async connect(){console.log(`Connecting ${this.name}...`);try{this._status={isConnected:!1},this.notifyStatusChange(),await Tr.connect();const e=[];for(const t of this.jointStates){if(!t.servoId){e.push(0);continue}try{if(t.type==="continuous")await Tr.setWheelMode(t.servoId),await Tr.writeWheelSpeed(t.servoId,0),e.push(0),t.realValue=0;else{await Tr.setPositionMode(t.servoId);const n=await Tr.readPosition(t.servoId),i=Ow(n);e.push(i),await Tr.writeTorqueEnable(t.servoId,!0),t.realValue=i}}catch(n){console.error(`Failed to initialize servo ${t.servoId} (${t.name}):`,n),e.push(0),t.realValue=void 0}}this.initialPositions=e,this._status={isConnected:!0,lastConnected:new Date,error:void 0},this.notifyStatusChange(),console.log(`${this.name} connected successfully`)}catch(e){throw this._status={isConnected:!1,error:`Connection failed: ${e}`},this.notifyStatusChange(),e}}async disconnect(){if(console.log(`Disconnecting ${this.name}...`),!!this._status.isConnected)try{for(const e of this.jointStates)if(e.servoId)try{e.type==="continuous"&&await Tr.writeWheelSpeed(e.servoId,0),await Tr.writeTorqueEnable(e.servoId,!1)}catch(t){console.error(`Failed to stop servo ${e.servoId}:`,t)}await Tr.disconnect(),this.jointStates.forEach(e=>{e.realValue=void 0}),this._status={isConnected:!1},this.notifyStatusChange(),console.log(`${this.name} disconnected`)}catch(e){throw this._status={isConnected:!1,error:`Disconnect failed: ${e}`},this.notifyStatusChange(),e}}async executeCommand(e){if(!this._status.isConnected)throw new Error("Cannot execute command: USB slave not connected");console.log(`USBSlave executing command with ${e.joints.length} joint updates`);for(const t of e.joints){const n=this.jointStates.find(i=>i.name===t.name);if(!(!n||!n.servoId))try{if(n.type==="continuous")await Tr.writeWheelSpeed(n.servoId,t.value),n.realValue=t.value;else{const i=this.jointStates.indexOf(n),s=(this.initialPositions[i]||0)+t.value;if(s>=0&&s<=360){const o=_B(s);await Tr.writePosition(n.servoId,Math.round(o)),n.realValue=s}else throw new Error(`Position ${s}° out of range (0-360°)`)}n.virtualValue=t.value}catch(i){throw console.error(`Failed to execute command for joint ${n.name}:`,i),n.realValue=void 0,i}}this.notifyStateUpdate()}async executeCommands(e){console.log(`USBSlave executing batch of ${e.length} commands`);for(const t of e)await this.executeCommand(t),e.length>1&&await new Promise(n=>setTimeout(n,50))}async readJointStates(){if(!this._status.isConnected)throw new Error("Cannot read states: USB slave not connected");const e=[];for(let t=0;t<this.jointStates.length;t++){const n=this.jointStates[t];if(!n.servoId){e.push({...n});continue}try{if(n.type==="revolute"){const i=await Tr.readPosition(n.servoId),s=Ow(i);e.push({...n,realValue:s})}else e.push({...n})}catch(i){console.error(`Failed to read servo ${n.servoId}:`,i),e.push({...n,realValue:void 0})}}return e}async writeJointState(e,t){const n={timestamp:Date.now(),joints:[{name:e,value:t}]};await this.executeCommand(n)}async writeJointStates(e){const t={timestamp:Date.now(),joints:e.map(n=>({name:n.jointName,value:n.value}))};await this.executeCommand(t)}onStateUpdate(e){return this.stateCallbacks.push(e),()=>{const t=this.stateCallbacks.indexOf(e);t>=0&&this.stateCallbacks.splice(t,1)}}onStatusChange(e){return this.statusCallbacks.push(e),()=>{const t=this.statusCallbacks.indexOf(e);t>=0&&this.statusCallbacks.splice(t,1)}}
4766notifyStateUpdate(){this.stateCallbacks.forEach(e=>{try{e([...this.jointStates])}catch(t){console.error("Error in state update callback:",t)}})}notifyStatusChange(){this.statusCallbacks.forEach(e=>{try{e(this._status)}catch(t){console.error("Error in status change callback:",t)}})}}class pz{constructor(e,t){Ae(this,"type","master");Ae(this,"id");Ae(this,"name");Ae(this,"_status",{isConnected:!1});Ae(this,"config");Ae(this,"robotId");Ae(this,"ws");Ae(this,"reconnectAttempts",0);Ae(this,"maxReconnectAttempts",ds().MAX_RECONNECT_ATTEMPTS);Ae(this,"reconnectDelay",ds().INITIAL_RECONNECT_DELAY_MS);Ae(this,"heartbeatInterval");Ae(this,"commandCallbacks",[]);Ae(this,"sequenceCallbacks",[]);Ae(this,"statusCallbacks",[]);this.config=e,this.robotId=t,this.id=`remote-master-${t}-${Date.now()}`,this.name=`Remote Server Master (${t})`,console.log(`Created RemoteServerMaster for robot ${t}`)}get status(){return this._status}async connect(){console.log(`Connecting ${this.name} to ${this.config.url}...`);try{const e=this.buildWebSocketUrl();this.ws=new WebSocket(e),this.setupWebSocketHandlers(),await this.waitForConnection(),this.startHeartbeat(),this._status={isConnected:!0,lastConnected:new Date,error:void 0},this.notifyStatusChange(),console.log(`${this.name} connected successfully`)}catch(e){throw this._status={isConnected:!1,error:`Connection failed: ${e}`},this.notifyStatusChange(),e}}async disconnect(){console.log(`Disconnecting ${this.name}...`),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=void 0),this._status={isConnected:!1},this.notifyStatusChange(),console.log(`${this.name} disconnected`)}async start(){if(!this._status.isConnected)throw new Error("Cannot start: master not connected");console.log(`Starting remote control for robot ${this.robotId}`),await this.sendMessage({type:"start_control",timestamp:new Date().toISOString(),data:{robotId:this.robotId}})}async stop(){console.log(`Stopping remote control for robot ${this.robotId}`),this._status.isConnected&&this.ws&&await this.sendMessage({type:"stop_control",timestamp:new Date().toISOString(),data:{robotId:this.robotId}})}async pause(){console.log(`Pausing remote control for robot ${this.robotId}`),this._status.isConnected&&this.ws&&await this.sendMessage({type:"pause_control",timestamp:new Date().toISOString(),data:{robotId:this.robotId}})}async resume(){console.log(`Resuming remote control for robot ${this.robotId}`),this._status.isConnected&&this.ws&&await this.sendMessage({type:"resume_control",timestamp:new Date().toISOString(),data:{robotId:this.robotId}})}onCommand(e){return this.commandCallbacks.push(e),()=>{const t=this.commandCallbacks.indexOf(e);t>=0&&this.commandCallbacks.splice(t,1)}}onSequence(e){return this.sequenceCallbacks.push(e),()=>{const t=this.sequenceCallbacks.indexOf(e);t>=0&&this.sequenceCallbacks.splice(t,1)}}onStatusChange(e){return this.statusCallbacks.push(e),()=>{const t=this.statusCallbacks.indexOf(e);t>=0&&this.statusCallbacks.splice(t,1)}}buildWebSocketUrl(){return`${this.config.url.replace(/^http/,"ws")}/ws/master/${this.robotId}`}setupWebSocketHandlers(){this.ws&&(this.ws.onopen=()=>{console.log(`WebSocket connected for robot ${this.robotId}`),this.reconnectAttempts=0},this.ws.onmessage=e=>{try{const t=JSON.parse(e.data);this.handleServerMessage(t)}catch(t){console.error("Failed to parse WebSocket message:",t)}},this.ws.onclose=e=>{console.log(`WebSocket closed for robot ${this.robotId}:`,e.code,e.reason),this.handleDisconnection()},this.ws.onerror=e=>{console.error(`WebSocket error for robot ${this.robotId}:`,e),this._status={isConnected:!1,error:`WebSocket error: ${e}`},this.notifyStatusChange()})}async waitForConnection(){if(!this.ws)throw new Error("WebSocket not created");return new Promise((e,t)=>{const n=setTimeout(()=>{t(new Error("Connection timeout"))},ds().CONNECTION_TIMEOUT_MS);if(this.ws.readyState===WebSocket.OPEN){clearTimeout(n),e();return}this.ws.onopen=()=>{clearTimeout(n),e()},this.ws.onerror=i=>{clearTimeout(n),t(i)}})}async sendMessage(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(e))}handleServerMessage(e){const{type:t,data:n}=e;switch(console.log(`🔍 RemoteServerMaster received: ${t}`,n),t){case"command":n&&this.notifyCommand([n]);break;case"sequence":n&&this.notifySequence(n);break;case"play_sequence":n&&(console.log(`Playing sequence from server on robot ${this.robotId}`),this.notifySequence(n));break;case"robot_state":console.log(`Received robot state for ${this.robotId}:`,n);break;case"slave_status":console.log(`Slave status update for ${this.robotId}:`,n);break;case"joint_states":if(console.log(`Joint states update for ${this.robotId}:`,n),n&&typeof n=="object"&&"joints"in n){const i=n.joints;if(Array.isArray(i)&&i.length>0){const s={timestamp:Date.now(),joints:i.map(o=>({name:o.name,value:o.real_value!==void 0?o.real_value:o.virtual_value})),metadata:{source:"remote_slave_joint_states"}};
4766console.log("🔄 Converting joint states to command:",s),this.notifyCommand([s])}}break;case"slave_error":console.error(`Slave error for ${this.robotId}:`,n);break;case"heartbeat_ack":break;default:console.warn(`Unknown message type from server: ${t}`)}}handleDisconnection(){this._status={isConnected:!1},this.notifyStatusChange(),this.stopHeartbeat(),this.reconnectAttempts<this.maxReconnectAttempts&&this.attemptReconnection()}async attemptReconnection(){this.reconnectAttempts++;const e=ds().MAX_RECONNECT_DELAY_MS,t=Math.min(this.reconnectDelay*Math.pow(1.5,this.reconnectAttempts-1),e);console.log(`Attempting master reconnection ${this.reconnectAttempts}/${this.maxReconnectAttempts} in ${t}ms...`),setTimeout(async()=>{try{await this.connect()}catch(n){console.error(`Master reconnection attempt ${this.reconnectAttempts} failed:`,n)}},t)}startHeartbeat(){this.heartbeatInterval=setInterval(async()=>{if(this._status.isConnected&&this.ws)try{await this.sendMessage({type:"heartbeat",timestamp:new Date().toISOString()})}catch(e){console.error("Failed to send heartbeat:",e)}},ds().HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0)}notifyCommand(e){this.commandCallbacks.forEach(t=>{try{t(e)}catch(n){console.error("Error in command callback:",n)}})}notifySequence(e){this.sequenceCallbacks.forEach(t=>{try{t(e)}catch(n){console.error("Error in sequence callback:",n)}})}notifyStatusChange(){this.statusCallbacks.forEach(e=>{try{e(this._status)}catch(t){console.error("Error in status callback:",t)}})}}class mz{constructor(e,t){Ae(this,"type","slave");Ae(this,"id");Ae(this,"name");Ae(this,"_status",{isConnected:!1});Ae(this,"config");Ae(this,"jointStates",[]);Ae(this,"ws");Ae(this,"reconnectAttempts",0);Ae(this,"maxReconnectAttempts",ds().MAX_RECONNECT_ATTEMPTS);Ae(this,"reconnectDelay",ds().INITIAL_RECONNECT_DELAY_MS);Ae(this,"heartbeatInterval");Ae(this,"stateCallbacks",[]);Ae(this,"statusCallbacks",[]);this.config=e,this.id=`remote-slave-${e.robotId}-${Date.now()}`,this.name=`Remote Server Slave (${e.robotId})`,this.jointStates=t.map(n=>({...n})),console.log(`Created RemoteServerSlave for robot ${e.robotId} with ${this.jointStates.length} joints`)}get status(){return this._status}async connect(){console.log(`Connecting ${this.name} to ${this.config.url}...`);try{const e=this.buildWebSocketUrl();this.ws=new WebSocket(e),this.setupWebSocketHandlers(),await this.waitForConnection(),this._status={isConnected:!0,lastConnected:new Date,error:void 0},this.notifyStatusChange(),console.log(`${this.name} connected successfully`),await this.sendStatusUpdate()}catch(e){throw this._status={isConnected:!1,error:`Connection failed: ${e}`},this.notifyStatusChange(),e}}async disconnect(){console.log(`Disconnecting ${this.name}...`),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=void 0),this._status={isConnected:!1},this.notifyStatusChange(),console.log(`${this.name} disconnected`)}async executeCommand(e){if(!this._status.isConnected)throw new Error("Cannot execute command: slave not connected");console.log(`RemoteServerSlave executing command with ${e.joints.length} joint updates`);try{for(const t of e.joints){const n=this.jointStates.find(i=>i.name===t.name);n&&(n.virtualValue=t.value,n.realValue=t.value)}this.notifyStateUpdate(),await this.sendJointStates(),await this.sendStatusUpdate()}catch(t){throw console.error("Error executing command:",t),await this.sendError(`Command execution failed: ${t}`),t}}async executeCommands(e){console.log(`RemoteServerSlave executing batch of ${e.length} commands`);for(const t of e)await this.executeCommand(t),e.length>1&&await new Promise(n=>setTimeout(n,_E().BATCH_COMMAND_DELAY_MS))}async readJointStates(){return[...this.jointStates]}async writeJointState(e,t){const n={timestamp:Date.now(),joints:[{name:e,value:t}]};await this.executeCommand(n)}async writeJointStates(e){const t={timestamp:Date.now(),joints:e.map(n=>({name:n.jointName,value:n.value}))};await this.executeCommand(t)}onStateUpdate(e){return this.stateCallbacks.push(e),()=>{const t=this.stateCallbacks.indexOf(e);t>=0&&this.stateCallbacks.splice(t,1)}}onStatusChange(e){return this.statusCallbacks.push(e),()=>{const t=this.statusCallbacks.indexOf(e);t>=0&&this.statusCallbacks.splice(t,1)}}buildWebSocketUrl(){return`${this.config.url.replace(/^http/,"ws")}/ws/slave/${this.config.robotId}`}setupWebSocketHandlers(){this.ws&&(this.ws.onopen=()=>{console.log(`WebSocket connected for slave ${this.config.robotId}`),this.reconnectAttempts=0,this.startHeartbeat()},this.ws.onmessage=e=>{try{const t=JSON.parse(e.data);this.handleServerMessage(t)}catch(t){console.error("Failed to parse WebSocket message:",t)}}
4766,this.ws.onclose=e=>{console.log(`WebSocket closed for slave ${this.config.robotId}:`,e.code,e.reason),this.handleDisconnection()},this.ws.onerror=e=>{console.error(`WebSocket error for slave ${this.config.robotId}:`,e),this._status={isConnected:!1,error:`WebSocket error: ${e}`},this.notifyStatusChange()})}async waitForConnection(){if(!this.ws)throw new Error("WebSocket not created");return new Promise((e,t)=>{const n=setTimeout(()=>{t(new Error("Connection timeout"))},ds().CONNECTION_TIMEOUT_MS);if(this.ws.readyState===WebSocket.OPEN){clearTimeout(n),e();return}this.ws.onopen=()=>{clearTimeout(n),e()},this.ws.onerror=i=>{clearTimeout(n),t(i)}})}async sendMessage(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(e))}handleServerMessage(e){const{type:t,data:n}=e;switch(t){case"execute_command":n&&this.executeCommand(n).catch(i=>{console.error("Failed to execute command from server:",i)});break;case"execute_sequence":if(n&&typeof n=="object"&&"commands"in n){const i=n;this.executeCommands(i.commands).catch(s=>{console.error("Failed to execute sequence from server:",s)})}break;case"play_sequence":if(n&&typeof n=="object"&&"commands"in n){console.log(`Playing sequence from server on remote slave ${this.config.robotId}`);const i=n;this.executeCommands(i.commands).catch(s=>{console.error("Failed to play sequence from server:",s)})}break;case"stop_sequence":console.log(`Stopping sequences on remote slave ${this.config.robotId}`);break;case"status_request":this.sendStatusUpdate().catch(i=>{console.error("Failed to send status update:",i)});break;default:console.warn(`Unknown message type from server: ${t}`)}}handleDisconnection(){this._status={isConnected:!1},this.notifyStatusChange(),this.stopHeartbeat(),this.reconnectAttempts<this.maxReconnectAttempts&&this.attemptReconnection()}async attemptReconnection(){this.reconnectAttempts++;const e=ds().MAX_RECONNECT_DELAY_MS,t=Math.min(this.reconnectDelay*Math.pow(1.5,this.reconnectAttempts-1),e);console.log(`Attempting slave reconnection ${this.reconnectAttempts}/${this.maxReconnectAttempts} in ${t}ms...`),setTimeout(async()=>{try{await this.connect()}catch(n){console.error(`Slave reconnection attempt ${this.reconnectAttempts} failed:`,n)}},t)}startHeartbeat(){this.heartbeatInterval=setInterval(async()=>{if(this._status.isConnected&&this.ws)try{await this.sendStatusUpdate()}catch(e){console.error("Failed to send heartbeat status:",e)}},ds().HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0)}async sendStatusUpdate(){if(this._status.isConnected)try{await this.sendMessage({type:"status_update",timestamp:new Date().toISOString(),data:{slave_id:this.id,robot_id:this.config.robotId,is_connected:this._status.isConnected,joint_count:this.jointStates.length}})}catch(e){console.error("Failed to send status update:",e)}}async sendJointStates(){if(this._status.isConnected)try{await this.sendMessage({type:"joint_states",timestamp:new Date().toISOString(),data:{slave_id:this.id,robot_id:this.config.robotId,joints:this.jointStates.map(e=>({name:e.name,virtual_value:e.virtualValue,real_value:e.realValue}))}})}catch(e){console.error("Failed to send joint states:",e)}}async sendError(e){if(this._status.isConnected)try{await this.sendMessage({type:"error",timestamp:new Date().toISOString(),data:{slave_id:this.id,robot_id:this.config.robotId,error:e}})}catch(t){console.error("Failed to send error message:",t)}}notifyStateUpdate(){this.stateCallbacks.forEach(e=>{try{e([...this.jointStates])}catch(t){console.error("Error in state update callback:",t)}})}notifyStatusChange(){this.statusCallbacks.forEach(e=>{try{e(this._status)}catch(t){console.error("Error in status change callback:",t)}})}}class gz{constructor(e){Ae(this,"type","master");Ae(this,"id");Ae(this,"name");Ae(this,"_status",{isConnected:!1});Ae(this,"config");Ae(this,"jointIds",[1,2,3,4,5,6]);Ae(this,"jointNames",["Rotation","Pitch","Elbow","Wrist_Pitch","Wrist_Roll","Jaw"]);Ae(this,"lastPositions",new Map);Ae(this,"restPositions",new Map);Ae(this,"positionHistory",new Map);Ae(this,"pollingInterval");Ae(this,"isPolling",!1);Ae(this,"isPaused",!1);Ae(this,"isReading",!1);Ae(this,"commandCallbacks",[]);Ae(this,"sequenceCallbacks",[]);Ae(this,"statusCallbacks",[]);this.config=e,this.id=`usb-master-${Date.now()}`,this.name="USB Master Robot",this.jointIds.forEach(t=>{this.lastPositions.set(t,2048),this.restPositions.set(t,2048),this.positionHistory.set(t,[])}),console.log(`🔌 Created USBMaster with ${this.jointIds.length} joints (unlock mode)`)}get status(){return this._status}async connect(){console.log(`🔌 Connecting ${this.name} to USB robot...`);try{await na.connect({baudRate:this.config.baudRate||1e6,protocolEnd:0}),await this.readInitialPositions(),this._status={isConnected:!0,lastConnected:new Date,error:void 0},this.notifyStatusChange(),console.log(`✅ ${this.name} connected successfully`)}catch(e){throw this._status={isConnected:!1,error:`Connection failed: ${e}`},this.notifyStatusChange(),e}}async disconnect(){if(console.log(`🔌 Disconnecting ${this.name}...`),this.stopPolling(),na&&this._status.isConnected)try{await na.disconnect()}catch(e){console.warn("Error disconnecting USB robot:",e)}this._status={isConnected:!1},this.notifyStatusChange(),console.log(`✅ ${this.name} disconnected`)}
4766async start(){if(!this._status.isConnected)throw new Error("Cannot start: USB master not connected");console.log("🎮 Starting USB master polling..."),this.startPolling()}async stop(){console.log("⏹️ Stopping USB master polling..."),this.stopPolling()}async pause(){console.log("⏸️ Pausing USB master polling..."),this.isPaused=!0}async resume(){console.log("▶️ Resuming USB master polling..."),this.isPaused=!1}onCommand(e){return this.commandCallbacks.push(e),()=>{const t=this.commandCallbacks.indexOf(e);t>=0&&this.commandCallbacks.splice(t,1)}}onSequence(e){return this.sequenceCallbacks.push(e),()=>{const t=this.sequenceCallbacks.indexOf(e);t>=0&&this.sequenceCallbacks.splice(t,1)}}onStatusChange(e){return this.statusCallbacks.push(e),()=>{const t=this.statusCallbacks.indexOf(e);t>=0&&this.statusCallbacks.splice(t,1)}}async readInitialPositions(){if(na)try{console.log("📖 Reading initial REST positions from USB robot (individual reads)...");let e=0;for(const t of this.jointIds)try{const n=await na.readPosition(t);this.lastPositions.set(t,n),this.restPositions.set(t,n),console.log(`Joint ${t}: REST position = ${n} (servo units)`),e++}catch(n){console.warn(`Failed to read servo ${t}:`,n)}console.log(`📖 Successfully read ${e}/${this.jointIds.length}
4766 REST positions`),console.log("🏠 Robot is now calibrated to REST position baseline")}catch(e){console.warn("Could not read initial positions:",e),console.log("🏠 Using default center positions as REST baseline")}}startPolling(){if(this.isPolling)return;this.isPolling=!0;const e=this.config.pollInterval||Nl().USB_MASTER_POLL_INTERVAL_MS;this.pollingInterval=setInterval(async()=>{var t;if(!(this.isPaused||!this._status.isConnected||this.isReading))try{await this.pollRobotPositions()}catch(n){console.error("Error polling robot positions:",n),n instanceof Error&&((t=n.message)!=null&&t.includes("Not connected"))&&(this._status={isConnected:!1,error:`Connection lost: ${n.message}`},this.notifyStatusChange(),this.stopPolling())}},e),console.log(`🔄 USB master polling started (${e}ms interval)`)}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=void 0),this.isPolling=!1}async pollRobotPositions(){var e;if(!(!na||this.isReading)){this.isReading=!0;try{const t=new Map,n=[];let i=0;for(const s of this.jointIds)try{const o=await na.readPosition(s);o!=null&&(t.set(s,o),i++)}catch{}if(t.forEach((s,o)=>{const a=this.lastPositions.get(o)||2048,l=e0().ENABLE_SMOOTHING?Nl().POSITION_CHANGE_THRESHOLD:1;if(Math.abs(s-a)>l){const c=this.jointIds.indexOf(o);if(c>=0){const u=this.jointNames[c],d=this.servoToRelativeDegrees(s,o);console.log(`🎯 Joint ${u} moved: ${a} → ${s} (${d.toFixed(1)}°)`),this.config.smoothing&&e0().ENABLE_SMOOTHING||n.push({name:u,value:d}),this.lastPositions.set(o,s)}}}),Date.now()%5e3<Nl().USB_MASTER_POLL_INTERVAL_MS&&console.log(`🔄 USB polling: ${i}/${this.jointIds.length} joints read successfully`),n.length>0){const s={timestamp:Date.now(),joints:n,metadata:{source:"usb_master_polling"}};console.log(`📤 Emitting command with ${n.length} joint changes`),this.notifyCommand([s])}}catch(t){if(console.error("Polling error:",t),t instanceof Error&&((e=t.message)!=null&&e.includes("Releasing Default reader"))){console.warn("Serial port access conflict, skipping this poll cycle");return}throw t}finally{this.isReading=!1}}}servoToRelativeDegrees(e,t){const n=this.restPositions.get(t)||2048;return(e-n)/4095*360}notifyCommand(e){this.commandCallbacks.forEach(t=>{try{t(e)}catch(n){console.error("Error in command callback:",n)}})}notifySequence(e){this.sequenceCallbacks.forEach(t=>{try{t(e)}catch(n){console.error("Error in sequence callback:",n)}})}notifyStatusChange(){this.statusCallbacks.forEach(e=>{try{e(this._status)}catch(t){console.error("Error in status callback:",t)}})}}async function vz(r){const e=new fU(r.urdfUrl,"/robots/so-100/"),t=await e.load(),n=e.fromString(t),i=mr(n),s=mr({isSelected:!1,selectedLink:void 0,selectedJoint:void 0});return{robot:i,urdfConfig:r,selection:s}}var ju;class yz{constructor(){Fe(this,ju,Pt(mr([])))}get _robots(){return C(J(this,ju))}set _robots(e){Be(J(this,ju),e,!0)}get robots(){return this._robots}get robotCount(){return this._robots.length}get robotsWithMaster(){return this._robots.filter(e=>e.master!==void 0)}get robotsWithSlaves(){return this._robots.filter(e=>e.slaves.length>0)}async createRobot(e,t){if(this._robots.find(s=>s.id===e))throw new Error(`Robot with ID ${e} already exists`);const n=await vz(t),i=new TB(e,n);return this._robots.push(i),console.log(`Created robot ${e}. Total robots: ${this._robots.length}`),i}getRobot(e){return this._robots.find(t=>t.id===e)}async removeRobot(e){const t=this._robots.findIndex(i=>i.id===e);if(t===-1)return;const n=this._robots[t];if(n.connectedSlaves.length>0)try{console.log(`Removing robot ${e}: moving to rest position first`),await n.moveToRestPosition(3e3),await new Promise(i=>setTimeout(i,500))}catch(i){console.warn(`Failed to move robot ${e} to rest position before removal:`,i)}await n.destroy(),this._robots.splice(t,1),console.log(`Removed robot ${e}. Remaining robots: ${this._robots.length}`)}async connectMaster(e,t){const n=this._robots.find(s=>s.id===e);if(!n)throw new Error(`Robot ${e} not found`);const i=this.createMaster(t,e);await i.connect(),await n.setMaster(i),console.log(`Master ${i.name} connected to robot ${e}`)}async disconnectMaster(e){const t=this._robots.find(n=>n.id===e);if(!t)throw new Error(`Robot ${e} not found`);
4766await t.removeMaster(),console.log(`Master disconnected from robot ${e}. Manual control restored.`)}async connectSlave(e,t){const n=this._robots.find(s=>s.id===e);if(!n)throw new Error(`Robot ${e} not found`);const i=this.createSlave(t,n);await n.addSlave(i),console.log(`Slave ${i.name} connected to robot ${e}`)}async disconnectSlave(e,t){const n=this._robots.find(i=>i.id===e);if(!n)throw new Error(`Robot ${e} not found`);await n.removeSlave(t),console.log(`Slave ${t} disconnected from robot ${e}`)}async connectDemoSequences(e,t=!0){const n={type:"mock-sequence",sequences:CB,autoStart:!0,loopMode:t};await this.connectMaster(e,n)}async connectMockSlave(e,t=50){const n={type:"mock-slave",simulateLatency:t,simulateErrors:!1,responseDelay:20};await this.connectSlave(e,n)}async connectUSBSlave(e,t){const n={type:"usb-slave",port:t,baudRate:115200};await this.connectSlave(e,n)}async connectRemoteServerSlave(e,t="ws://localhost:8080",n,i){const s={type:"remote-server-slave",url:t,apiKey:n,robotId:i||e};await this.connectSlave(e,s)}async connectUSBMaster(e,t={}){const n={type:"usb-master",port:t.port,baudRate:t.baudRate||_E().USB_BAUD_RATE,pollInterval:t.pollInterval||Nl().USB_MASTER_POLL_INTERVAL_MS,smoothing:t.smoothing??e0().ENABLE_SMOOTHING};await this.connectMaster(e,n)}getRobotStatus(e){const t=this._robots.find(n=>n.id===e);if(t)return{id:t.id,hasActiveMaster:t.controlState.hasActiveMaster,masterName:t.controlState.masterName,manualControlEnabled:t.manualControlEnabled,connectedSlaves:t.connectedSlaves.length,totalSlaves:t.slaves.length,lastCommandSource:t.controlState.lastCommandSource}}getAllJointStates(){return this._robots.map(e=>({robotId:e.id,joints:e.joints}))}async destroy(){const e=this._robots.map(t=>t.destroy());await Promise.allSettled(e),this._robots.length=0}createMaster(e,t){switch(e.type){case"mock-sequence":return new AB(e);case"remote-server":return new pz(e,t);case"script-player":throw new Error("Script player master not implemented yet");case"usb-master":return new gz(e);default:{const n=e;throw new Error(`Unknown master driver type: ${n.type}`)}}}createSlave(e,t){const n=t.joints.map(i=>({name:i.name,servoId:i.servoId||0,type:i.urdfJoint.type,virtualValue:i.virtualValue,realValue:i.realValue,limits:i.urdfJoint.limit?{lower:i.urdfJoint.limit.lower,upper:i.urdfJoint.limit.upper,velocity:i.urdfJoint.limit.velocity,effort:i.urdfJoint.limit.effort}:void 0}));switch(e.type){case"mock-slave":return new RB(e,n);case"usb-slave":return new fz(e,n);case"simulation-slave":throw new Error("Simulation slave driver not implemented yet");case"remote-server-slave":return new mz(e,n);default:{const i=e;throw new Error(`Unknown slave driver type: ${i.type}`)}}}}ju=new WeakMap;const jr=new yz;function _z(r){const e=r-1;return e*e*e+1}function Gw(r,{delay:e=0,duration:t=400,easing:n=_z,start:i=0,opacity:s=0}={}){const o=getComputedStyle(r),a=+o.opacity,l=o.transform==="none"?"":o.transform,c=1-i,u=a*(1-s);return{delay:e,duration:t,easing:n,css:(d,h)=>`
4767			transform: ${l} scale(${1-c*h});
4768			opacity: ${a-u*h}
4769		`}}const xz={"so-arm100":{urdfUrl:"/robots/so-100/so_arm100.urdf",jointNameIdMap:{Rotation:1,Pitch:2,Elbow:3,Wrist_Pitch:4,Wrist_Roll:5,Jaw:6},restPosition:{Rotation:0,Pitch:0,Elbow:0,Wrist_Pitch:0,Wrist_Roll:0,Jaw:0},compoundMovements:[{name:"Jaw down & up",primaryJoint:2,primaryFormula:"primary < 100 ? 1 : -1",dependents:[{joint:3,formula:"primary < 100 ? -1.9 * deltaPrimary : 0.4 * deltaPrimary"},{joint:4,formula:"primary < 100 ? (primary < 10 ? 0 : 0.51 * deltaPrimary) : -0.4 * deltaPrimary"}]},{name:"Jaw backward & forward",primaryJoint:2,primaryFormula:"1",dependents:[{joint:3,formula:"-0.9*deltaPrimary"}]}]}};function Kd(r){return r!==null&&typeof r=="object"}const bz=["string","number","bigint","boolean"];function t0(r){return r==null||bz.includes(typeof r)?!0:Array.isArray(r)?r.every(e=>t0(e)):typeof r=="object"?Object.getPrototypeOf(r)===Object.prototype:!1}const Ip=Symbol("box"),PE=Symbol("is-writable");function kt(r,e){const t=Ve(r);return e?{[Ip]:!0,[PE]:!0,get current(){return C(t)},set current(n){e(n)}}:{[Ip]:!0,get current(){return r()}}}function wz(r){return Kd(r)&&Ip in r}function Sz(r){let e=Pt(mr(r));return{[Ip]:!0,[PE]:!0,get current(){return C(e)},set current(t){Be(e,t,!0)}}}function Mz(...r){return function(e){var t;for(const n of r)if(n){if(e.defaultPrevented)return;typeof n=="function"?n.call(this,e):(t=n.current)==null||t.call(this,e)}}}const Ez=/\d/,Tz=["-","_","/","."];function Az(r=""){if(!Ez.test(r))return r!==r.toLowerCase()}function Cz(r){const e=[];let t="",n,i;for(const s of r){const o=Tz.includes(s);if(o===!0){e.push(t),t="",n=void 0;continue}const a=Az(s);if(i===!1){if(n===!1&&a===!0){e.push(t),t=s,n=a;continue}if(n===!0&&a===!1&&t.length>1){const l=t.at(-1);e.push(t.slice(0,Math.max(0,t.length-1))),t=l+s,n=a;continue}}t+=s,n=a,i=o}return e.push(t),e}function IE(r){return r?Cz(r).map(e=>Pz(e)).join(""):""}function Rz(r){return Iz(IE(r||""))}function Pz(r){return r?r[0].toUpperCase()+r.slice(1):""}function Iz(r){return r?r[0].toLowerCase()+r.slice(1):""}function ff(r){if(!r)return{};const e={};function t(n,i){if(n.startsWith("-moz-")||n.startsWith("-webkit-")||n.startsWith("-ms-")||n.startsWith("-o-")){e[IE(n)]=i;return}if(n.startsWith("--")){e[n]=i;return}e[Rz(n)]=i}return nC(r,t),e}function n_(...r){return(...e)=>{for(const t of r)typeof t=="function"&&t(...e)}}function Dz(r,e){const t=RegExp(r,"g");return n=>
4769{if(typeof n!="string")throw new TypeError(`expected an argument of type string, but got ${typeof n}`);return n.match(t)?n.replace(t,e):n}}const Lz=Dz(/[A-Z]/,r=>`-${r.toLowerCase()}`);function kz(r){if(!r||typeof r!="object"||Array.isArray(r))throw new TypeError(`expected an argument of type object, but got ${typeof r}`);return Object.keys(r).map(e=>`${Lz(e)}: ${r[e]};`).join(`
4770`)}function DE(r={}){return kz(r).replace(`
4771`," ")}const Uz=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onbeforeinput","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncompositionend","oncompositionstart","oncompositionupdate","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"],Nz=new Set(Uz);function Oz(r){return Nz.has(r)}function lr(...r){const e={...r[0]};for(let t=1;t<r.length;t++){const n=r[t];if(n){for(const i of Object.keys(n)){const s=e[i],o=n[i],a=typeof s=="function",l=typeof o=="function";if(a&&Oz(i)){const c=s,u=o;e[i]=Mz(c,u)}else if(a&&l)e[i]=n_(s,o);else if(i==="class"){const c=t0(s),u=t0(o);c&&u?e[i]=wf(s,o):c?e[i]=wf(s):u&&(e[i]=wf(o))}else if(i==="style"){const c=typeof s=="object",u=typeof o=="object",d=typeof s=="string",h=typeof o=="string";if(c&&u)e[i]={...s,...o};else if(c&&h){const f=ff(o);e[i]={...s,...f}}else if(d&&u){const f=ff(s);e[i]={...f,...o}}else if(d&&h){const f=ff(s),p=ff(o);e[i]={...f,...p}}else c?e[i]=s:u?e[i]=o:d?e[i]=s:h&&(e[i]=o)}else e[i]=o!==void 0?o:s}for(const i of Object.getOwnPropertySymbols(n)){const s=e[i],o=n[i];e[i]=o!==void 0?o:s}}}return typeof e.style=="object"&&(e.style=DE(e.style).replaceAll(`
4772`," ")),e.hidden===!1&&(e.hidden=void 0,delete e.hidden),e.disabled===!1&&(e.disabled=void 0,delete e.disabled),e}const LE={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",transform:"translateX(-100%)"};DE(LE);const Fz=typeof window<"u"?window:void 0;function Bz(r){let e=r.activeElement;for(;e!=null&&e.shadowRoot;){const t=e.shadowRoot.activeElement;if(t===e)break;e=t}return e}var Bl,Xu;class zz{constructor(e={}){Fe(this,Bl);Fe(this,Xu);const{window:t=Fz,document:n=t==null?void 0:t.document}=e;t!==void 0&&(gt(this,Bl,n),gt(this,Xu,p1(i=>{const s=Yr(t,"focusin",i),o=Yr(t,"focusout",i);return()=>{s(),o()}})))}get current(){var e;return(e=J(this,Xu))==null||e.call(this),J(this,Bl)?Bz(J(this,Bl)):null}}Bl=new WeakMap,Xu=new WeakMap;new zz;var qu,Rs;class i_{constructor(e){Fe(this,qu);Fe(this,Rs);gt(this,qu,e),gt(this,Rs,Symbol(e))}get key(){return J(this,Rs)}exists(){return EA(J(this,Rs))}get(){const e=Si(J(this,Rs));if(e===void 0)throw new Error(`Context "${J(this,qu)}" not found`);return e}getOr(e){const t=Si(J(this,Rs));return t===void 0?e:t}set(e){return cr(J(this,Rs),e)}}qu=new WeakMap,Rs=new WeakMap;function Vz(r,e){switch(r){case"post":Pn(e);break;case"pre":Un(e);break}}function kE(r,e,t,n={}){const{lazy:i=!1}=n;let s=!i,o=Array.isArray(r)?[]:void 0;Vz(e,()=>{const a=Array.isArray(r)?r.map(c=>c()):r();if(!s){s=!0,o=a;return}const l=wi(()=>t(a,o));return o=a,l})}function Jr(r,e,t){kE(r,"post",e,t)}function Gz(r,e,t){kE(r,"pre",e,t)}Jr.pre=Gz;function Qa(r){Pn(()=>()=>{r()})}function r_(r){B0().then(r)}const Hz=1,Wz=9,jz=11;function Hw(r){return Kd(r)&&r.nodeType===Hz&&typeof r.nodeName=="string"}function Xz(r){return Kd(r)&&r.nodeType===Wz}function qz(r){var e;return Kd(r)&&((e=r.constructor)==null?void 0:e.name)==="VisualViewport"}function Yz(r){return Kd(r)&&r.nodeType!==void 0}function $z(r){return Yz(r)&&r.nodeType===jz&&"host"in r}function Zz(r,e){var n;if(!r||!e||!Hw(r)||!Hw(e))return!1;const t=(n=e.getRootNode)==null?void 0:n.call(e);
4772if(r===e||r.contains(e))return!0;if(t&&$z(t)){let i=e;for(;i;){if(r===i)return!0;i=i.parentNode||i.host}}return!1}function Jz(r){return Xz(r)?r:qz(r)?r.document:(r==null?void 0:r.ownerDocument)??document}function Kz(r){let e=r.activeElement;for(;e!=null&&e.shadowRoot;){const t=e.shadowRoot.activeElement;if(t===e)break;e=t}return e}var Yu;class UE{constructor(e){Ae(this,"element");Fe(this,Yu,Ve(()=>this.element.current?this.element.current.getRootNode()??document:document));Ae(this,"getDocument",()=>Jz(this.root));Ae(this,"getWindow",()=>this.getDocument().defaultView??window);Ae(this,"getActiveElement",()=>Kz(this.root));Ae(this,"isActiveElement",e=>e===this.getActiveElement());Ae(this,"querySelector",e=>this.root?this.root.querySelector(e):null);Ae(this,"querySelectorAll",e=>this.root?this.root.querySelectorAll(e):[]);Ae(this,"setTimeout",(e,t)=>this.getWindow().setTimeout(e,t));Ae(this,"clearTimeout",e=>this.getWindow().clearTimeout(e));typeof e=="function"?this.element=kt(e):this.element=e}get root(){return C(J(this,Yu))}set root(e){Be(J(this,Yu),e)}getElementById(e){return this.root.getElementById(e)}}Yu=new WeakMap;function Ks(r,e){return{[kA()]:t=>wz(r)?(r.current=t,wi(()=>e==null?void 0:e(t)),()=>{"isConnected"in t&&t.isConnected||(r.current=null,e==null||e(null))}):(r(t),wi(()=>e==null?void 0:e(t)),()=>{"isConnected"in t&&t.isConnected||(r(null),e==null||e(null))})}}function Qz(r){return r?"true":"false"}function e4(r){return r?"true":void 0}function ac(r){return r?"":void 0}function t4(r){return r?!0:void 0}function n4(r){return r?"open":"closed"}function i4(r){return r?"checked":"unchecked"}function NE(r){return r==="starting"?{"data-starting-style":""}:r==="ending"?{"data-ending-style":""}:{}}function r4(r,e){return r?"true":"false"}var zl,$u;class s4{constructor(e){Fe(this,zl);Fe(this,$u);Ae(this,"attrs");gt(this,zl,e.getVariant?e.getVariant():null),gt(this,$u,J(this,zl)?`data-${J(this,zl)}-`:`data-${e.component}-`),this.getAttr=this.getAttr.bind(this),this.selector=this.selector.bind(this),this.attrs=Object.fromEntries(e.parts.map(t=>[t,this.getAttr(t)]))}getAttr(e,t){return t?`data-${t}-${e}`:`${J(this,$u)}${e}`}selector(e,t){return`[${this.getAttr(e,t)}]`}}zl=new WeakMap,$u=new WeakMap;function $m(r){const e=new s4(r);return{...e.attrs,selector:e.selector,getAttr:e.getAttr}}const OE="Enter",o4="Escape",FE=" ",BE=typeof document<"u",Ww=a4();function a4(){var r,e;return BE&&((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function jw(r){return r instanceof HTMLElement}function l4(r){return r instanceof Element||r instanceof SVGElement}var _a,os,Ps,Is,To,n0,i0;class c4{constructor(e){Fe(this,To);Fe(this,_a);Fe(this,os,null);Fe(this,Ps,null);Fe(this,Is,0);gt(this,_a,e),Qa(()=>un(this,To,n0).call(this))}run(e){un(this,To,n0).call(this);const t=J(this,_a).ref.current;if(!t)return;if(typeof t.getAnimations!="function"){un(this,To,i0).call(this,e);return}const n=J(this,Is),i=()=>{n===J(this,Is)&&un(this,To,i0).call(this,e)},s=()=>{if(n!==J(this,Is))return;const a=t.getAnimations();if(a.length===0){i();return}Promise.all(a.map(l=>l.finished)).then(()=>{i()}).catch(()=>{if(n!==J(this,Is))return;if(t.getAnimations().some(u=>u.pending||u.playState!=="finished")){s();return}i()})},o=()=>{gt(this,os,window.requestAnimationFrame(()=>{gt(this,os,null),s()}))};if(!J(this,_a).afterTick.current){o();return}gt(this,os,window.requestAnimationFrame(()=>{gt(this,os,null);const a="data-starting-style";if(!t.hasAttribute(a)){o();return}gt(this,Ps,new MutationObserver(()=>{var l;n===J(this,Is)&&(t.hasAttribute(a)||((l=J(this,Ps))==null||l.disconnect(),gt(this,Ps,null),o()))})),J(this,Ps).observe(t,{attributes:!0,attributeFilter:[a]})}))}}_a=new WeakMap,os=new WeakMap,Ps=new WeakMap,Is=new WeakMap,To=new WeakSet,n0=function(){var e;J(this,os)!==null&&(window.cancelAnimationFrame(J(this,os)),gt(this,os,null)),(e=J(this,Ps))==null||e.disconnect(),gt(this,Ps,null),D_(this,Is)._++},i0=function(e){const t=()=>{e()};J(this,_a).afterTick?r_(t):t()};var nr,Zu,Ju,Ds,Ls,Ku,yo,Qu,r0;class Xw{constructor(e){Fe(this,Qu);Fe(this,nr);Fe(this,Zu);Fe(this,Ju);Fe(this,Ds,Pt(!1));Fe(this,Ls,Pt(void 0));Fe(this,Ku,!1);Fe(this,yo,null);gt(this,nr,e),Be(J(this,Ds),e.open.current,!0),gt(this,Zu,e.enabled??!0),gt(this,Ju,new c4({ref:J(this,nr).ref,afterTick:J(this,nr).open})),Qa(()=>un(this,Qu,r0).call(this)),Jr(()=>J(this,nr).open.current,t=>{var n,i,s,o,a,l;if(!J(this,Ku)){gt(this,Ku,!0);return}if(un(this,Qu,r0).call(this),!t&&((i=(n=J(this,nr)).shouldSkipExitAnimation)!=null&&i.call(n))){Be(J(this,Ds),!1),Be(J(this,Ls),void 0),(o=(s=J(this,nr)).onComplete)==null||o.call(s);return}if(t&&Be(J(this,Ds),!0),Be(J(this,Ls),t?"starting":"ending",!0),t&&gt(this,yo,window.requestAnimationFrame(()=>{gt(this,yo,null),J(this,nr).open.current&&Be(J(this,Ls),void 0)})),!J(this,Zu)){t||Be(J(this,Ds),!1),Be(J(this,Ls),void 0),(l=(a=J(this,nr)).onComplete)==null||l.call(a);return}J(this,Ju).run(()=>{var c,u;t===J(this,nr).open.current&&(J(this,nr).open.current||Be(J(this,Ds),!1),Be(J(this,Ls),void 0),(u=(c=J(this,nr)).onComplete)==null||u.call(c))})})}get shouldRender(){return C(J(this,Ds))}get transitionStatus(){return C(J(this,Ls))}}nr=new WeakMap,Zu=new WeakMap,Ju=new WeakMap,Ds=new WeakMap,Ls=new WeakMap,Ku=new WeakMap,yo=new WeakMap,Qu=new WeakSet,r0=function(){J(this,yo)!==null&&(window.cancelAnimationFrame(J(this,yo)),gt(this,yo,null))};function oi(){}function Qs(r,e){return`bits-${r}`}const u4=$m({component:"dialog",parts:["content","trigger","overlay","title","description","close","cancel","action"]}),ja=new i_("Dialog.Root | AlertDialog.Root");var ed,td,nd,id,rd,sd,od,ad,ld,cd,ud;const d_=class d_{constructor(e,t){Ae(this,"opts");Fe(this,ed,Pt(null));Fe(this,td,Pt(null));Fe(this,nd,Pt(null));Fe(this,id,Pt(null));Fe(this,rd,Pt(void 0));Fe(this,sd,Pt(void 0));Fe(this,od,Pt(void 0));Fe(this,ad,Pt(void 0));Fe(this,ld,Pt(null));Fe(this,cd,Pt(0));Ae(this,"depth");Ae(this,"parent");Ae(this,"contentPresence");Ae(this,"overlayPresence");Ae(this,"getBitsAttr",e=>u4.getAttr(e,this.opts.variant.current));Fe(this,ud,Ve(()=>({"data-state":n4(this.opts.open.current)})));this.opts=e,this.parent=t,this.depth=t?t.depth+1:0,this.handleOpen=this.handleOpen.bind(this),this.handleClose=this.handleClose.bind(this),this.contentPresence=new Xw({ref:kt(()=>this.contentNode),open:this.opts.open,enabled:!0,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),this.overlayPresence=new Xw({ref:kt(()=>this.overlayNode),open:this.opts.open,enabled:!0}),Jr(()=>this.opts.open.current,n=>{this.parent&&(n?this.parent.incrementNested():this.parent.decrementNested())},{lazy:!0}),Qa(()=>{var n;this.opts.open.current&&((n=this.parent)==null||n.decrementNested())})}static create(e){const t=ja.getOr(null);return ja.set(new d_(e,t))}get triggerNode(){return C(J(this,ed))}set triggerNode(e){Be(J(this,ed),e,!0)}get contentNode(){return C(J(this,td))}set contentNode(e){Be(J(this,td),e,!0)}get overlayNode(){return C(J(this,nd))}set overlayNode(e){Be(J(this,nd),e,!0)}get descriptionNode(){return C(J(this,id))}set descriptionNode(e){Be(J(this,id),e,!0)}get contentId(){return C(J(this,rd))}set contentId(e){Be(J(this,rd),e,!0)}get titleId(){return C(J(this,sd))}set titleId(e){Be(J(this,sd),e,!0)}get triggerId(){return C(J(this,od))}set triggerId(e){Be(J(this,od),e,!0)}get descriptionId(){return C(J(this,ad))}set descriptionId(e){Be(J(this,ad),e,!0)}get cancelNode(){return C(J(this,ld))}set cancelNode(e){Be(J(this,ld),e,!0)}get nestedOpenCount(){return C(J(this,cd))}set nestedOpenCount(e){Be(J(this,cd),e,!0)}handleOpen(){this.opts.open.current||(this.opts.open.current=!0)}handleClose(){this.opts.open.current&&(this.opts.open.current=!1)}incrementNested(){var e;this.nestedOpenCount++,(e=this.parent)==null||e.incrementNested()}decrementNested(){var e;this.nestedOpenCount!==0&&(this.nestedOpenCount--,(e=this.parent)==null||e.decrementNested())}get sharedProps(){return C(J(this,ud))}set sharedProps(e){Be(J(this,ud),e)}};ed=new WeakMap,td=new WeakMap,nd=new WeakMap,id=new WeakMap,rd=new WeakMap,sd=new WeakMap,od=new WeakMap,ad=new WeakMap,ld=new WeakMap,cd=new WeakMap,ud=new WeakMap;let s0=d_;var dd;const h_=class h_{constructor(e,t){Ae(this,"opts");Ae(this,"root");Ae(this,"attachment");Fe(this,dd,Ve(()=>({id:this.opts.id.current,[this.root.getBitsAttr(this.opts.variant.current)]:"",oncl
4772ick:this.onclick,onkeydown:this.onkeydown,disabled:this.opts.disabled.current?!0:void 0,tabindex:0,...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.attachment=Ks(this.opts.ref),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this)}static create(e){return new h_(e,ja.get())}onclick(e){this.opts.disabled.current||e.button>0||this.root.handleClose()}onkeydown(e){this.opts.disabled.current||(e.key===FE||e.key===OE)&&(e.preventDefault(),this.root.handleClose())}get props(){return C(J(this,dd))}set props(e){Be(J(this,dd),e)}};dd=new WeakMap;let o0=h_;var hd;const f_=class f_{constructor(e,t){Ae(this,"opts");Ae(this,"root");Ae(this,"attachment");Fe(this,hd,Ve(()=>({id:this.opts.id.current,role:"heading","aria-level":this.opts.level.current,[this.root.getBitsAttr("title")]:"",...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.root.titleId=this.opts.id.current,this.attachment=Ks(this.opts.ref),Jr.pre(()=>this.opts.id.current,n=>{this.root.titleId=n})}static create(e){return new f_(e,ja.get())}get props(){return C(J(this,hd))}set props(e){Be(J(this,hd),e)}};hd=new WeakMap;let a0=f_;var fd;const p_=class p_{constructor(e,t){Ae(this,"opts");Ae(this,"root");Ae(this,"attachment");Fe(this,fd,Ve(()=>({id:this.opts.id.current,[this.root.getBitsAttr("description")]:"",...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.root.descriptionId=this.opts.id.current,this.attachment=Ks(this.opts.ref,n=>{this.root.descriptionNode=n}),Jr.pre(()=>this.opts.id.current,n=>{this.root.descriptionId=n})}static create(e){return new p_(e,ja.get())}get props(){return C(J(this,fd))}set props(e){Be(J(this,fd),e)}};fd=new WeakMap;let l0=p_;var pd,md;const m_=class m_{constructor(e,t){Ae(this,"opts");Ae(this,"root");Ae(this,"attachment");Fe(this,pd,Ve(()=>({open:this.root.opts.open.current})));Fe(this,md,Ve(()=>({id:this.opts.id.current,role:this.root.opts.variant.current==="alert-dialog"?"alertdialog":"dialog","aria-modal":"true","aria-describedby":this.root.descriptionId,"aria-labelledby":this.root.titleId,[this.root.getBitsAttr("content")]:"",style:{pointerEvents:"auto",outline:this.root.opts.variant.current==="alert-dialog"?"none":void 0,"--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount,contain:"layout style"},tabindex:this.root.opts.variant.current==="alert-dialog"?-1:void 0,"data-nested-open":ac(this.root.nestedOpenCount>0),"data-nested":ac(this.root.parent!==null),...NE(this.root.contentPresence.transitionStatus),...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.attachment=Ks(this.opts.ref,n=>{this.root.contentNode=n,this.root.contentId=n==null?void 0:n.id})}static create(e){return new m_(e,ja.get())}get snippetProps(){return C(J(this,pd))}set snippetProps(e){Be(J(this,pd),e)}get props(){return C(J(this,md))}set props(e){Be(J(this,md),e)}get shouldRender(){return this.root.contentPresence.shouldRender}};pd=new WeakMap,md=new WeakMap;let c0=m_;var gd,vd;const g_=class g_{constructor(e,t){Ae(this,"opts");Ae(this,"root");Ae(this,"attachment");Fe(this,gd,Ve(()=>({open:this.root.opts.open.current})));Fe(this,vd,Ve(()=>({id:this.opts.id.current,[this.root.getBitsAttr("overlay")]:"",style:{pointerEvents:"auto","--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount},"data-nested-open":ac(this.root.nestedOpenCount>0),"data-nested":ac(this.root.parent!==null),...NE(this.root.overlayPresence.transitionStatus),...this.root.sharedProps,...this.attachment})));this.opts=e,this.root=t,this.attachment=Ks(this.opts.ref,n=>this.root.overlayNode=n)}static create(e){return new g_(e,ja.get())}get snippetProps(){return C(J(this,gd))}set snippetProps(e){Be(J(this,gd),e)}get props(){return C(J(this,vd))}set props(e){Be(J(this,vd),e)}get shouldRender(){return this.root.overlayPresence.shouldRender}};gd=new WeakMap,vd=new WeakMap;let u0=g_;var d4=new Set(["$$slots","$$events","$$legacy","id","ref","child","children","level"]),h4=je("<div><!></div>");function zE(r,e){const t=Ys();vt(e,!0);let n=ae(e,"id",19,()=>Qs(t)),i=ae(e,"ref",15,null),s=ae(e,"level",3,2),o=Wt(e,d4);
4772const a=a0.create({id:kt(()=>n()),level:kt(()=>s()),ref:kt(()=>i(),f=>i(f))}),l=Ve(()=>lr(o,a.props));var c=tt(),u=Ie(c);{var d=f=>{var p=tt(),m=Ie(p);zt(m,()=>e.child,()=>({props:C(l)})),re(f,p)},h=f=>{var p=h4();In(p,()=>({...C(l)}));var m=qe(p);zt(m,()=>e.children??jt),We(p),re(f,p)};Dt(u,f=>{e.child?f(d):f(h,-1)})}re(r,c),yt()}function f4(r,e){var t=tt(),n=Ie(t);OA(n,()=>e.children,i=>{var s=tt(),o=Ie(s);zt(o,()=>e.children??jt),re(i,s)}),re(r,t)}const p4=new i_("BitsConfig");function m4(){const r=new g4(null,{});return p4.getOr(r).opts}class g4{constructor(e,t){Ae(this,"opts");const n=v4(e,t);this.opts={defaultPortalTo:n(i=>i.defaultPortalTo),defaultLocale:n(i=>i.defaultLocale)}}}function v4(r,e){return t=>kt(()=>{var s,o;const i=(s=t(e))==null?void 0:s.current;if(i!==void 0)return i;if(r!==null)return(o=t(r.opts))==null?void 0:o.current})}function y4(r,e){return t=>{const n=m4();return kt(()=>{const i=t();if(i!==void 0)return i;const s=r(n).current;return s!==void 0?s:e})}}const _4=y4(r=>r.defaultPortalTo,"body");function VE(r,e){vt(e,!0);const t=_4(()=>e.to),n=TA();let i=Ve(s);function s(){if(!BE||e.disabled)return null;let d=null;return typeof t.current=="string"?d=document.querySelector(t.current):d=t.current,d}let o;function a(){o&&(YT(o),o=null)}Jr([()=>C(i),()=>e.disabled],([d,h])=>{if(!d||h){a();return}return o=qT(f4,{target:d,props:{children:e.children},context:n}),()=>{a()}});var l=tt(),c=Ie(l);{var u=d=>{var h=tt(),f=Ie(h);zt(f,()=>e.children??jt),re(d,h)};Dt(c,d=>{e.disabled&&d(u)})}re(r,l),yt()}function x4(r,e=500){let t=null;const n=(...i)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{r(...i)},e)};return n.destroy=()=>{t!==null&&(clearTimeout(t),t=null)},n}function GE(r,e){return r===e||r.contains(e)}function HE(r){return(r==null?void 0:r.ownerDocument)??document}function b4(r,e){const{clientX:t,clientY:n}=r,i=e.getBoundingClientRect();return t<i.left||t>i.right||n<i.top||n>i.bottom}const w4="data-context-menu-trigger",S4="data-context-menu-content";globalThis.bitsDismissableLayers??(globalThis.bitsDismissableLayers=new Map);var Vl,xa,_o,Gl,Hl,Wl,jl,yd,ks,Xl,Bp,uc,WE,zp,_d,Vp,Gp,Hp,Wp,jp,jE,Xp,qp;const v_=class v_{constructor(e){Fe(this,uc);Ae(this,"opts");Fe(this,Vl);Fe(this,xa);Fe(this,_o,{pointerdown:!1});Fe(this,Gl,!1);Fe(this,Hl,null);Fe(this,Wl,!1);Fe(this,jl);Fe(this,yd);Fe(this,ks,oi);Fe(this,Xl,!1);Fe(this,Bp,e=>{e.defaultPrevented||J(this,Xl)||!this.opts.ref.current||r_(()=>{var t,n;J(this,Xl)||!this.opts.ref.current||J(this,Wp).call(this,e.target)||e.target&&!J(this,Wl)&&((n=(t=J(this,yd)).current)==null||n.call(t,e))})});Fe(this,zp,e=>{let t=e;t.defaultPrevented&&(t=qw(e)),J(this,Vl).current(e)});Fe(this,_d,x4(e=>{if(!this.opts.ref.current){J(this,ks).call(this);return}const t=this.opts.isValidEvent.current(e,this.opts.ref.current)||T4(e,this.opts.ref.current);if(!J(this,Gl)||un(this,uc,jE).call(this)||!t){J(this,ks).call(this);return}let n=e;if(n.defaultPrevented&&(n=qw(n)),J(this,xa).current!=="close"&&J(this,xa).current!=="defer-otherwise-close"){J(this,ks).call(this);return}e.pointerType==="touch"?(J(this,ks).call(this),gt(this,ks,Yr(J(this,jl),"click",J(this,zp),{once:!0}))):J(this,Vl).current(n)},10));Fe(this,Vp,e=>{J(this,_o)[e.type]=!0});Fe(this,Gp,e=>{J(this,_o)[e.type]=!1});Fe(this,Hp,e=>{gt(this,Hl,e),this.opts.ref.current&&gt(this,Gl,E4(this.opts.ref.current))});Fe(this,Wp,e=>this.opts.ref.current?GE(this.opts.ref.current,e):!1);Fe(this,jp,()=>{for(const e in J(this,_o))J(this,_o)[e]=!1;gt(this,Gl,!1),gt(this,Hl,null)});Fe(this,Xp,()=>{gt(this,Wl,!0)});Fe(this,qp,()=>{gt(this,Wl,!1)});Ae(this,"props",{onfocuscapture:J(this,Xp),onblurcapture:J(this,qp)});this.opts=e,gt(this,xa,e.interactOutsideBehavior),gt(this,Vl,e.onInteractOutside),gt(this,yd,e.onFocusOutside);let t=oi,n=null;const i=()=>{n=null,J(this,jp).call(this),globalThis.bitsDismissableLayers.delete(this),J(this,_d).destroy(),J(this,ks).call(this),t()};Jr([()=>this.opts.enabled.current,()=>this.opts.ref.current],([s,o])=>{const a=s?o:null;n!==a&&(i(),a&&(n=a,gt(this,jl,HE(a)),globalThis.bitsDismissableLayers.set(this,J(this,xa)),t=un(this,uc,WE).call(this)))}),Qa(()=>{gt(this,Xl,!0),i()})}static create(e){return new v_(e)}};
4772Vl=new WeakMap,xa=new WeakMap,_o=new WeakMap,Gl=new WeakMap,Hl=new WeakMap,Wl=new WeakMap,jl=new WeakMap,yd=new WeakMap,ks=new WeakMap,Xl=new WeakMap,Bp=new WeakMap,uc=new WeakSet,WE=function(){const e=J(this,jl),t=i=>{wi(()=>{J(this,Vp).call(this,i),J(this,Hp).call(this,i)})},n=i=>{i.cancelBubble||i!==J(this,Hl)||(J(this,Gp).call(this,i),J(this,_d).call(this,i))};return e.addEventListener("pointerdown",t,!0),e.addEventListener("pointerdown",n),n_(()=>e.removeEventListener("pointerdown",t,!0),()=>e.removeEventListener("pointerdown",n),Yr(e,"focusin",J(this,Bp)))},zp=new WeakMap,_d=new WeakMap,Vp=new WeakMap,Gp=new WeakMap,Hp=new WeakMap,Wp=new WeakMap,jp=new WeakMap,jE=function(){return Object.values(J(this,_o)).some(Boolean)},Xp=new WeakMap,qp=new WeakMap;let d0=v_;function M4(r=[...globalThis.bitsDismissableLayers]){return r.findLast(([e,{current:t}])=>t==="close"||t==="ignore")}function E4(r){const e=[...globalThis.bitsDismissableLayers],t=M4(e);if(t)return t[0].opts.ref.current===r;const[n]=e[0];return n.opts.ref.current===r}function T4(r,e){const t=r.target;if(!l4(t))return!1;const n=!!t.closest(`[${w4}]`),i=!!e.closest(`[${S4}]`);return"button"in r&&r.button>0&&!n?!1:"button"in r&&r.button===0&&n&&i?!0:n&&i?!1:HE(t).documentElement.contains(t)&&!GE(e,t)&&b4(r,e)}function qw(r){const e=r.currentTarget,t=r.target;let n;r instanceof PointerEvent?n=new PointerEvent(r.type,r):n=new PointerEvent("pointerdown",r);let i=!1;return new Proxy(n,{get:(o,a)=>a==="currentTarget"?e:a==="target"?t:a==="preventDefault"?()=>{i=!0,typeof o.preventDefault=="function"&&o.preventDefault()}:a==="defaultPrevented"?i:a in o?o[a]:r[a]})}function A4(r,e){vt(e,!0);let t=ae(e,"interactOutsideBehavior",3,"close"),n=ae(e,"onInteractOutside",3,oi),i=ae(e,"onFocusOutside",3,oi),s=ae(e,"isValidEvent",3,()=>!1);const o=d0.create({id:kt(()=>e.id),interactOutsideBehavior:kt(()=>t()),onInteractOutside:kt(()=>n()),enabled:kt(()=>e.enabled),onFocusOutside:kt(()=>i()),isValidEvent:kt(()=>s()),ref:e.ref});var a=tt(),l=Ie(a);zt(l,()=>e.children??jt,()=>({props:o.props})),re(r,a),yt()}globalThis.bitsEscapeLayers??(globalThis.bitsEscapeLayers=new Map);var Yp,$p;const y_=class y_{constructor(e){Ae(this,"opts");Ae(this,"domContext");Fe(this,Yp,()=>Yr(this.domContext.getDocument(),"keydown",J(this,$p),{passive:!1}));Fe(this,$p,e=>{if(e.key!==o4||!C4(this))return;const t=new KeyboardEvent(e.type,e);e.preventDefault();const n=this.opts.escapeKeydownBehavior.current;n!=="close"&&n!=="defer-otherwise-close"||this.opts.onEscapeKeydown.current(t)});this.opts=e,this.domContext=new UE(this.opts.ref);
4772let t=oi;Jr(()=>e.enabled.current,n=>(n&&(globalThis.bitsEscapeLayers.set(this,e.escapeKeydownBehavior),t=J(this,Yp).call(this)),()=>{t(),globalThis.bitsEscapeLayers.delete(this)}))}static create(e){return new y_(e)}};Yp=new WeakMap,$p=new WeakMap;let h0=y_;function C4(r){const e=[...globalThis.bitsEscapeLayers],t=e.findLast(([i,{current:s}])=>s==="close"||s==="ignore");if(t)return t[0]===r;const[n]=e[0];return n===r}function R4(r,e){vt(e,!0);let t=ae(e,"escapeKeydownBehavior",3,"close"),n=ae(e,"onEscapeKeydown",3,oi);h0.create({escapeKeydownBehavior:kt(()=>t()),onEscapeKeydown:kt(()=>n()),enabled:kt(()=>e.enabled),ref:e.ref});var i=tt(),s=Ie(i);zt(s,()=>e.children??jt),re(r,i),yt()}var Us,xd,ba;const Zp=class Zp{constructor(){Fe(this,Us,Sz([]));Fe(this,xd,new WeakMap);Fe(this,ba,new WeakMap)}static getInstance(){return this.instance||(this.instance=new Zp),this.instance}register(e){const t=this.getActive();t&&t!==e&&t.pause();const n=document.activeElement;n&&n!==document.body&&J(this,ba).set(e,n),J(this,Us).current=J(this,Us).current.filter(i=>i!==e),J(this,Us).current.unshift(e)}unregister(e){J(this,Us).current=J(this,Us).current.filter(n=>n!==e);const t=this.getActive();t&&t.resume()}getActive(){return J(this,Us).current[0]}setFocusMemory(e,t){J(this,xd).set(e,t)}getFocusMemory(e){return J(this,xd).get(e)}isActiveScope(e){return this.getActive()===e}setPreFocusMemory(e,t){J(this,ba).set(e,t)}getPreFocusMemory(e){return J(this,ba).get(e)}clearPreFocusMemory(e){J(this,ba).delete(e)}};Us=new WeakMap,xd=new WeakMap,ba=new WeakMap,Ae(Zp,"instance");let f0=Zp;/*!
4773* tabbable 6.5.0
4774* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
4775*/var XE=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],p0=XE.join(","),qE=typeof Element>"u",lc=qE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Dp=!qE&&Element.prototype.getRootNode?function(r){var e;return r==null||(e=r.getRootNode)===null||e===void 0?void 0:e.call(r)}:function(r){return r==null?void 0:r.ownerDocument},Lp=function(e,t){var n;t===void 0&&(t=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),s=i===""||i==="true",o=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Lp(e.parentNode));return o},P4=function(e){var t,n=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return n===""||n==="true"},YE=function(e,t,n){if(Lp(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(p0));return t&&lc.call(e,p0)&&i.unshift(e),i=i.filter(n),i},kp=function(e,t,n){for(var i=[],s=Array.from(e);s.length;){var o=s.shift();if(!Lp(o,!1))if(o.tagName==="SLOT"){var a=o.assignedElements(),l=a.length?a:o.children,c=kp(l,!0,n);n.flatten?i.push.apply(i,c):i.push({scopeParent:o,candidates:c})}else{var u=lc.call(o,p0);u&&n.filter(o)&&(t||!e.includes(o))&&i.push(o);var d=o.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(o),h=!Lp(d,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(o));if(d&&h){var f=kp(d===!0?o.children:d.children,!0,n);n.flatten?i.push.apply(i,f):i.push({scopeParent:o,candidates:f})}else s.unshift.apply(s,o.children)}}return i},$E=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ZE=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||P4(e))&&!$E(e)?0:e.tabIndex},I4=function(e,t){var n=ZE(e);return n<0&&t&&!$E(e)?0:n},D4=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},JE=function(e){return e.tagName==="INPUT"},L4=function(e){return JE(e)&&e.type==="hidden"},k4=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return t},U4=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},N4=function(e){if(!e.name)return!0;var t=e.form||Dp(e),n=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(o){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",o.message),!1}var s=U4(i,e.form);return!s||s===e},O4=function(e){return JE(e)&&e.type==="radio"},F4=function(e){return O4(e)&&!N4(e)},B4=function(e){var t,n=e&&Dp(e),i=(t=n)===null||t===void 0?void 0:t.host,s=!1;if(n&&n!==e){var o,a,l;for(s=!!((o=i)!==null&&o!==void 0&&(a=o.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&i;){var c,u,d;n=Dp(i),i=(c=n)===null||c===void 0?void 0:c.host,s=!!((u=i)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(i))}}return s}
4775,Yw=function(e){var t=e.getBoundingClientRect(),n=t.width,i=t.height;return n===0&&i===0},z4=function(e,t){var n=t.displayCheck,i=t.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}var o=getComputedStyle(e),a=o.visibility;if(a==="hidden"||a==="collapse")return!0;var l=lc.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if(lc.call(c,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var u=e;e;){var d=e.parentElement,h=Dp(e);if(d&&!d.shadowRoot&&i(d)===!0)return Yw(e);e.assignedSlot?e=e.assignedSlot:!d&&h!==e.ownerDocument?e=h.host:e=d}e=u}if(B4(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Yw(e);return!1},V4=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var n=0;n<t.children.length;n++){var i=t.children.item(n);if(i.tagName==="LEGEND")return lc.call(t,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}t=t.parentElement}return!1},Up=function(e,t){return!(t.disabled||L4(t)||z4(t,e)||k4(t)||V4(t))},$w=function(e,t){return!(F4(t)||ZE(t)<0||!Up(e,t))},G4=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},KE=function(e){var t=[],n=[];return e.forEach(function(i,s){var o=!!i.scopeParent,a=o?i.scopeParent:i,l=I4(a,o),c=o?KE(i.candidates):a;l===0?o?t.push.apply(t,c):t.push(a):n.push({documentOrder:s,tabIndex:l,item:i,isScope:o,content:c})}),n.sort(D4).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(t)},H4=function(e,t){t=t||{};var n;return t.getShadowRoot?n=kp([e],t.includeContainer,{filter:$w.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:G4}):n=YE(e,t.includeContainer,$w.bind(null,t)),KE(n)},W4=function(e,t){t=t||{};var n;return t.getShadowRoot?n=kp([e],t.includeContainer,{filter:Up.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):n=YE(e,t.includeContainer,Up.bind(null,t)),n},j4=XE.concat("iframe:not([inert]):not([inert] *)").join(","),X4=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return lc.call(e,j4)===!1?!1:Up(t,e)},Ns,xi,Wi,wa,xo,li,QE,eT,tT,nT,g0,Df,v0;const __=class __{constructor(e){Fe(this,li);Fe(this,Ns,!1);Fe(this,xi,null);Fe(this,Wi,f0.getInstance());Fe(this,wa,[]);Fe(this,xo);gt(this,xo,e)}get paused(){return J(this,Ns)}pause(){gt(this,Ns,!0)}resume(){gt(this,Ns,!1)}mount(e){J(this,xi)&&this.unmount(),gt(this,xi,e),J(this,Wi).register(this),un(this,li,nT).call(this),un(this,li,eT).call(this)}unmount(){J(this,xi)&&(un(this,li,QE).call(this),un(this,li,tT).call(this),J(this,Wi).unregister(this),J(this,Wi).clearPreFocusMemory(this),gt(this,xi,null))}static use(e){let t=null;return Jr([()=>e.ref.current,()=>e.enabled.current],([n,i])=>{n&&i?(t||(t=new __(e)),t.mount(n)):t&&(t.unmount(),t=null)}),Qa(()=>{t==null||t.unmount()}),{get props(){return{tabindex:-1}}}}};Ns=new WeakMap,xi=new WeakMap,Wi=new WeakMap,wa=new WeakMap,xo=new WeakMap,li=new WeakSet,QE=function(){for(const e of J(this,wa))e();gt(this,wa,[])},eT=function(){if(!J(this,xi))return;const e=new CustomEvent("focusScope.onOpenAutoFocus",{bubbles:!1,cancelable:!0});J(this,xo).onOpenAutoFocus.current(e),e.defaultPrevented||requestAnimationFrame(()=>{if(!J(this,xi)||J(this,Ns)||!J(this,Wi).isActiveScope(this)||J(this,xi).contains(J(this,xi).ownerDocument.activeElement))return;const t=un(this,li,Df).call(this);t?(t.focus(),J(this,Wi).setFocusMemory(this,t)):J(this,xi).focus()})},tT=function(){var t,n;const e=new CustomEvent("focusScope.onCloseAutoFocus",{bubbles:!1,cancelable:!0});if((n=(t=J(this,xo).onCloseAutoFocus).current)==null||n.call(t,e),!e.defaultPrevented){const i=J(this,Wi).getPreFocusMemory(this);if(i&&document.contains(i))try{i.focus()}catch{document.body.focus()}}},nT=function(){if(!J(this,xi)||!J(this,xo).trap.current)return;const e=J(this,xi),t=e.ownerDocument,n=o=>
4775{if(J(this,Ns)||!J(this,Wi).isActiveScope(this))return;const a=o.target;if(!a)return;if(e.contains(a))J(this,Wi).setFocusMemory(this,a);else{const c=J(this,Wi).getFocusMemory(this);if(c&&e.contains(c)&&X4(c))o.preventDefault(),c.focus();else{const u=un(this,li,Df).call(this),d=un(this,li,v0).call(this)[0];(u||d||e).focus()}}},i=o=>{if(!J(this,xo).loop||J(this,Ns)||o.key!=="Tab"||!J(this,Wi).isActiveScope(this))return;const a=un(this,li,g0).call(this);if(a.length===0)return;const l=a[0],c=a[a.length-1];!o.shiftKey&&t.activeElement===c?(o.preventDefault(),l.focus()):o.shiftKey&&t.activeElement===l&&(o.preventDefault(),c.focus())};J(this,wa).push(Yr(t,"focusin",n,{capture:!0}),Yr(e,"keydown",i));const s=new MutationObserver(()=>{const o=J(this,Wi).getFocusMemory(this);if(o&&!e.contains(o)){const a=un(this,li,Df).call(this),l=un(this,li,v0).call(this)[0],c=a||l;c?(c.focus(),J(this,Wi).setFocusMemory(this,c)):e.focus()}});s.observe(e,{childList:!0,subtree:!0}),J(this,wa).push(()=>s.disconnect())},g0=function(){return J(this,xi)?H4(J(this,xi),{includeContainer:!1,getShadowRoot:!0}):[]},Df=function(){return un(this,li,g0).call(this)[0]||null},v0=function(){return J(this,xi)?W4(J(this,xi),{includeContainer:!1,getShadowRoot:!0}):[]};let m0=__;function q4(r,e){vt(e,!0);let t=ae(e,"enabled",3,!1),n=ae(e,"trapFocus",3,!1),i=ae(e,"loop",3,!1),s=ae(e,"onCloseAutoFocus",3,oi),o=ae(e,"onOpenAutoFocus",3,oi);const a=m0.use({enabled:kt(()=>t()),trap:kt(()=>n()),loop:i(),onCloseAutoFocus:kt(()=>s()),onOpenAutoFocus:kt(()=>o()),ref:e.ref});var l=tt(),c=Ie(l);zt(c,()=>e.focusScope??jt,()=>({props:a.props})),re(r,l),yt()}const Zw=()=>{};globalThis.bitsTextSelectionLayers??(globalThis.bitsTextSelectionLayers=new Map);var ql,Yl,bd,wd,Jp,iT,Kp,Qp,$l;const x_=class x_{constructor(e){Fe(this,Jp);Ae(this,"opts");Ae(this,"domContext");Fe(this,ql,oi);Fe(this,Yl,!1);Fe(this,bd,Zw);Fe(this,wd,Zw);Fe(this,Kp,e=>{J(this,$l).call(this),!e.defaultPrevented&&J(this,wd).call(this,e)});Fe(this,Qp,e=>{if(!J(this,Yl))return;J(this,$l).call(this);const t=this.opts.ref.current,n=e.target;!jw(t)||!jw(n)||!$4(this)||!Zz(t,n)||(J(this,bd).call(this,e),!e.defaultPrevented&&gt(this,ql,Y4(t,this.domContext.getDocument().body)))});Fe(this,$l,()=>{J(this,ql).call(this),gt(this,ql,oi)});this.opts=e,this.domContext=new UE(e.ref);let t=oi;Jr(()=>[this.opts.enabled.current,this.opts.onPointerDown.current,this.opts.onPointerUp.current],([n,i,s])=>(gt(this,Yl,n),gt(this,bd,i),gt(this,wd,s),n&&(globalThis.bitsTextSelectionLayers.set(this,this.opts.enabled),t(),t=un(this,Jp,iT).call(this)),()=>{gt(this,Yl,!1),t(),J(this,$l).call(this),globalThis.bitsTextSelectionLayers.delete(this)}))}static create(e){return new x_(e)}};ql=new WeakMap,Yl=new WeakMap,bd=new WeakMap,wd=new WeakMap,Jp=new WeakSet,iT=function(){return n_(Yr(this.domContext.getDocument(),"pointerdown",J(this,Qp)),Yr(this.domContext.getDocument(),"pointerup",J(this,Kp)))},Kp=new WeakMap,Qp=new WeakMap,$l=new WeakMap;let y0=x_;const Jw=r=>r.style.userSelect||r.style.webkitUserSelect;function Y4(r,e){const t=Jw(e),n=Jw(r);return pf(e,"none"),pf(r,"text"),()=>{pf(e,t),pf(r,n)}}function pf(r,e){r.style.userSelect=e,r.style.webkitUserSelect=e}function $4(r){const e=[...globalThis.bitsTextSelectionLayers];if(!e.length)return!1;const t=e.at(-1);return t?t[0]===r:!1}function Z4(r,e){vt(e,!0);let t=ae(e,"preventOverflowTextSelection",3,!0),n=ae(e,"onPointerDown",3,oi),i=ae(e,"onPointerUp",3,oi);y0.create({id:kt(()=>e.id),onPointerDown:kt(()=>n()),onPointerUp:kt(()=>i()),enabled:kt(()=>e.enabled&&t()),ref:e.ref});var s=tt(),o=Ie(s);zt(o,()=>e.children??jt),re(r,s),yt()}globalThis.bitsIdCounter??(globalThis.bitsIdCounter={current:0});function J4(r="bits"){return globalThis.bitsIdCounter.current++,`${r}-${globalThis.bitsIdCounter.current}`}var Sd,Zl,Sa,Ma,em,rT;class K4{constructor(e){Fe(this,em);Fe(this,Sd);Fe(this,Zl,0);Fe(this,Sa,Pt());Fe(this,Ma);gt(this,Sd,e)}get(...e){return gt(this,Zl,J(this,Zl)+1),C(J(this,Sa))===void 0&&gt(this,Ma,b1(()=>{Be(J(this,Sa),J(this,Sd).call(this,...e),!0)})),Pn(()=>()=>{un(this,em,rT).call(this)}),C(J(this,Sa))}}Sd=new WeakMap,Zl=new WeakMap,Sa=new WeakMap,Ma=new WeakMap,em=new WeakSet,rT=function(){gt(this,Zl,J(this,Zl)-1),J(this,Ma)&&J(this,Zl)<=0&&(J(this,Ma).call(this),Be(J(this,Sa),void 0),gt(this,Ma,void 0))};const Lf=new Ff;let mf=Pt(null),ia=null,Gc=null,Hc=!1;const Kw=kt(()=>{for(const r of Lf.values())if(r)return!0;return!1});let pv=null;const Q4=new K4(()=>{function r(i){i.body.setAttribute("style",C(mf)??""),i.body.style.removeProperty("--scrollbar-width"),Ww&&(ia==null||ia()),Be(mf,null)}function e(){Gc!==null&&(window.clearTimeout(Gc),Gc=null)}function t(i,s){e(),Hc=!0,pv=Date.now();const o=pv,a=()=>{Gc=null,pv===o&&(sT(Lf)?Hc=!1:(Hc=!1,s()))},l=i===null?24:i;Gc=window.setTimeout(a,l)}function n(){C(mf)===null&&Lf.size===0&&!Hc&&Be(mf,document.body.getAttribute("style"),!0)}return Jr(()=>Kw.current,()=>{var u,d;if(!Kw.current)return;n(),Hc=!1;const i=getComputedStyle(document.documentElement),s=getComputedStyle(document.body),o=((u=i.scrollbarGutter)==null?void 0:u.includes("stable"))||((d=s.scrollbarGutter)==null?void 0:d.includes("stable")),a=window.innerWidth-document.documentElement.clientWidth,c={padding:Number.parseInt(s.paddingRight??"0",10)+a,margin:Number.parseInt(s.marginRight??"0",10)};a>
47750&&!o&&(document.body.style.paddingRight=`${c.padding}px`,document.body.style.marginRight=`${c.margin}px`,document.body.style.setProperty("--scrollbar-width",`${a}px`)),document.body.style.overflow="hidden",Ww&&(ia=Yr(document,"touchmove",h=>{h.target===document.documentElement&&(h.touches.length>1||h.preventDefault())},{passive:!1})),r_(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})}),Qa(()=>()=>{ia==null||ia()}),{get lockMap(){return Lf},resetBodyStyle:r,scheduleCleanupIfNoNewLocks:t,cancelPendingCleanup:e,ensureInitialStyleCaptured:n}});var Ea,Md,Ed,ir;class eV{constructor(e,t=()=>null){Fe(this,Ea,J4());Fe(this,Md);Fe(this,Ed,()=>null);Fe(this,ir);Ae(this,"locked");gt(this,Md,e),gt(this,Ed,t),gt(this,ir,Q4.get()),J(this,ir)&&(J(this,ir).cancelPendingCleanup(),J(this,ir).ensureInitialStyleCaptured(),J(this,ir).lockMap.set(J(this,Ea),J(this,Md)??!1),this.locked=kt(()=>J(this,ir).lockMap.get(J(this,Ea))??!1,n=>J(this,ir).lockMap.set(J(this,Ea),n)),Qa(()=>{if(J(this,ir).lockMap.delete(J(this,Ea)),sT(J(this,ir).lockMap))return;const n=J(this,Ed).call(this),i=document;J(this,ir).scheduleCleanupIfNoNewLocks(n,()=>{J(this,ir).resetBodyStyle(i)})}))}}Ea=new WeakMap,Md=new WeakMap,Ed=new WeakMap,ir=new WeakMap;function sT(r){for(const[e,t]of r)if(t)return!0;return!1}function Qw(r,e){vt(e,!0);let t=ae(e,"preventScroll",3,!0),n=ae(e,"restoreScrollDelay",3,null);t()&&new eV(t(),()=>n()),yt()}var tV=new Set(["$$slots","$$events","$$legacy","id","forceMount","child","children","ref"]),nV=je("<div><!></div>");function oT(r,e){const t=Ys();vt(e,!0);let n=ae(e,"id",19,()=>Qs(t)),i=ae(e,"forceMount",3,!1),s=ae(e,"ref",15,null),o=Wt(e,tV);const a=u0.create({id:kt(()=>n()),ref:kt(()=>s(),h=>s(h))}),l=Ve(()=>lr(o,a.props));var c=tt(),u=Ie(c);{var d=h=>{var f=tt(),p=Ie(f);{var m=v=>{var y=tt(),_=Ie(y);{let x=Ve(()=>({props:lr(C(l)),...a.snippetProps}));zt(_,()=>e.child,()=>C(x))}re(v,y)},g=v=>{var y=nV();In(y,x=>({...x}),[()=>lr(C(l))]);var _=qe(y);zt(_,()=>e.children??jt,()=>a.snippetProps),We(y),re(v,y)};Dt(p,v=>{e.child?v(m):v(g,-1)})}re(h,f)};Dt(u,h=>{(a.shouldRender||i())&&h(d)})}re(r,c),yt()}var iV=new Set(["$$slots","$$events","$$legacy","id","children","child","ref"]),rV=je("<div><!></div>");function sV(r,e){const t=Ys();vt(e,!0);let n=ae(e,"id",19,()=>Qs(t)),i=ae(e,"ref",15,null),s=Wt(e,iV);const o=l0.create({id:kt(()=>n()),ref:kt(()=>i(),h=>i(h))}),a=Ve(()=>lr(s,o.props));var l=tt(),c=Ie(l);{var u=h=>{var f=tt(),p=Ie(f);zt(p,()=>e.child,()=>({props:C(a)})),re(h,f)},d=h=>{var f=rV();In(f,()=>({...C(a)}));var p=qe(f);zt(p,()=>e.children??jt),We(f),re(h,f)};Dt(c,h=>{e.child?h(u):h(d,-1)})}re(r,l),yt()}var oV=new Set(["$$slots","$$events","$$legacy","value"]),e1=je("<input/>");function aV(r,e){vt(e,!0);let t=ae(e,"value",15),n=Wt(e,oV);const i=Ve(()=>lr(n,{"aria-hidden":"true",tabindex:-1,style:{...LE,position:"absolute",top:"0",left:"0"}}));var s=tt(),o=Ie(s);{var a=c=>{var u=e1();In(u,()=>({...C(i),value:t()}),void 0,void 0,void 0,void 0,!0),re(c,u)},l=c=>{var u=e1();In(u,()=>({...C(i)}),void 0,void 0,void 0,void 0,!0),Of(u,t),re(c,u)};Dt(o,c=>{C(i).type==="checkbox"?c(a):c(l,-1)})}re(r,s),yt()}const lV=$m({component:"separator",parts:["root"]});var Td;const b_=class b_{constructor(e){Ae(this,"opts");Ae(this,"attachment");Fe(this,Td,Ve(()=>({id:this.opts.id.current,role:this.opts.decorative.current?"none":"separator","aria-orientation":this.opts.orientation.current,"aria-hidden":e4(this.opts.decorative.current),"data-orientation":this.opts.orientation.current,[lV.root]:"",...this.attachment})));this.opts=e,this.attachment=Ks(e.ref)}static create(e){return new b_(e)}get props(){return C(J(this,Td))}set props(e){Be(J(this,Td),e)}};Td=new WeakMap;let _0=b_;var cV=new Set(["$$slots","$$events","$$legacy","id","ref","child","children","decorative","orientation"]),uV=je("<div><!></div>");function dV(r,e){const t=Ys();vt(e,!0);let n=ae(e,"id",19,()=>Qs(t)),i=ae(e,"ref",15,null),s=ae(e,"decorative",3,!1),o=ae(e,"orientation",3,"horizontal"),a=Wt(e,cV);const l=_0.create({ref:kt(()=>i(),p=>i(p)),id:kt(()=>n()),decorative:kt(()=>s()),orientation:kt(()=>o())}),c=Ve(()=>lr(a,l.props));var u=tt(),d=Ie(u);{var h=p=>{var m=tt(),g=Ie(m);zt(g,()=>e.child,()=>({props:C(c)})),re(p,m)},f=p=>{var m=uV();In(m,()=>({...C(c)}));var g=qe(m);zt(g,()=>e.children??jt),We(m),re(p,m)};Dt(d,p=>{e.child?p(h):p(f,-1)})}re(r,u),yt()}function aT(r,e){vt(e,!0);let t=ae(e,"open",15,!1),n=ae(e,"onOpenChange",3,oi),i=ae(e,"onOpenChangeComplete",3,oi);s0.create({variant:kt(()=>"dialog"),open:kt(()=>t(),a=>{t(a),n()(a)}),onOpenChangeComplete:kt(()=>i())});var s=tt(),o=Ie(s);zt(o,()=>e.children??jt),re(r,s),yt()}var hV=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","disabled"]),fV=je("<button><!></button>");function lT(r,e){const t=Ys();vt(e,!0);let n=ae(e,"id",19,()=>Qs(t)),i=ae(e,"ref",15,null),s=ae(e,"disabled",3,!1),o=Wt(e,hV);const a=o0.create({variant:kt(()=>"close"),id:kt(()=>n()),ref:kt(()=>i(),f=>i(f)),disabled:kt(()=>!!s())}),l=Ve(()=>lr(o,a.props));var c=tt(),u=Ie(c);{var d=f=>{var p=tt(),m=Ie(p);zt(m,()=>e.child,()=>({props:C(l)})),re(f,p)},h=f=>{var p=fV();In(p,()=>({...C(l)}));var m=qe(p);zt(m,()=>e.children??jt),We(p),re(f,p)};Dt(u,f=>{e.child?f(d):f(h,-1)})}re(r,c),yt()}var pV=new Set(["$$slots","$$events","$$legacy","id","children","child","ref","forceMount","onCloseAutoFocus","onOpenAutoFocus","onEscapeKey
4775down","onInteractOutside","trapFocus","preventScroll","preventOverflowTextSelection","restoreScrollDelay"]),mV=je("<!> <!>",1),gV=je("<!> <div><!></div>",1);function cT(r,e){const t=Ys();vt(e,!0);let n=ae(e,"id",19,()=>Qs(t)),i=ae(e,"ref",15,null),s=ae(e,"forceMount",3,!1),o=ae(e,"onCloseAutoFocus",3,oi),a=ae(e,"onOpenAutoFocus",3,oi),l=ae(e,"onEscapeKeydown",3,oi),c=ae(e,"onInteractOutside",3,oi),u=ae(e,"trapFocus",3,!0),d=ae(e,"preventScroll",3,!0),h=ae(e,"preventOverflowTextSelection",3,!0),f=ae(e,"restoreScrollDelay",3,null),p=Wt(e,pV);const m=c0.create({id:kt(()=>n()),ref:kt(()=>i(),x=>i(x))}),g=Ve(()=>lr(p,m.props));var v=tt(),y=Ie(v);{var _=x=>{q4(x,{get ref(){return m.opts.ref},loop:!0,get trapFocus(){return u()},get enabled(){return m.root.opts.open.current},get onOpenAutoFocus(){return a()},get onCloseAutoFocus(){return o()},focusScope:(b,M)=>{let E=()=>(M==null?void 0:M()).props;R4(b,pn(()=>C(g),{get enabled(){return m.root.opts.open.current},get ref(){return m.opts.ref},onEscapeKeydown:S=>{l()(S),!S.defaultPrevented&&m.root.handleClose()},children:(S,w)=>{A4(S,pn(()=>C(g),{get ref(){return m.opts.ref},get enabled(){return m.root.opts.open.current},onInteractOutside:D=>{c()(D),!D.defaultPrevented&&m.root.handleClose()},children:(D,R)=>{Z4(D,pn(()=>C(g),{get preventOverflowTextSelection(){return h()},get ref(){return m.opts.ref},get enabled(){return m.root.opts.open.current},children:(k,N)=>{var H=tt(),P=Ie(H);{var ee=Q=>{var Y=mV(),z=Ie(Y);{var K=O=>{Qw(O,{get preventScroll(){return d()},get restoreScrollDelay(){return f()}})};Dt(z,O=>{m.root.opts.open.current&&O(K)})}var te=Le(z,2);{let O=Ve(()=>({props:lr(C(g),E()),...m.snippetProps}));zt(te,()=>e.child,()=>C(O))}re(Q,Y)},X=Q=>{var Y=gV(),z=Ie(Y);Qw(z,{get preventScroll(){return d()}});var K=Le(z,2);In(K,O=>({...O}),[()=>lr(C(g),E())]);var te=qe(K);zt(te,()=>e.children??jt),We(K),re(Q,Y)};Dt(P,Q=>{e.child?Q(ee):Q(X,-1)})}re(k,H)},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{focusScope:!0}})};Dt(y,x=>{(m.shouldRender||s())&&x(_)})}re(r,v),yt()}const vV=$m({component:"label",parts:["root"]});var Ad;const w_=class w_{constructor(e){Ae(this,"opts");Ae(this,"attachment");Fe(this,Ad,Ve(()=>({id:this.opts.id.current,[vV.root]:"",onmousedown:this.onmousedown,...this.attachment})));this.opts=e,this.attachment=Ks(this.opts.ref),this.onmousedown=this.onmousedown.bind(this)}static create(e){return new w_(e)}onmousedown(e){e.detail>1&&e.preventDefault()}get props(){return C(J(this,Ad))}set props(e){Be(J(this,Ad),e)}};Ad=new WeakMap;let x0=w_;var yV=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","for"]),_V=je("<label><!></label>");function xV(r,e){const t=Ys();vt(e,!0);let n=ae(e,"id",19,()=>Qs(t)),i=ae(e,"ref",15,null),s=Wt(e,yV);const o=x0.create({id:kt(()=>n()),ref:kt(()=>i(),h=>i(h))}),a=Ve(()=>lr(s,o.props,{for:e.for}));var l=tt(),c=Ie(l);{var u=h=>{var f=tt(),p=Ie(f);zt(p,()=>e.child,()=>({props:C(a)})),re(h,f)},d=h=>{var f=_V();In(f,()=>({...C(a),for:e.for}));var p=qe(f);zt(p,()=>e.children??jt),We(f),re(h,f)};Dt(c,h=>{e.child?h(u):h(d,-1)})}re(r,l),yt()}const uT=$m({component:"switch",parts:["root","thumb"]}),s_=new i_("Switch.Root");var Cd,w0,Rd,Pd,Id;const S_=class S_{constructor(e){Fe(this,Cd);Ae(this,"opts");Ae(this,"attachment");Fe(this,Rd,Ve(()=>({"data-disabled":ac(this.opts.disabled.current),"data-state":i4(this.opts.checked.current),"data-required":ac(this.opts.required.current)})));Fe(this,Pd,Ve(()=>({checked:this.opts.checked.current})));Fe(this,Id,Ve(()=>({...this.sharedProps,id:this.opts.id.current,role:"switch",disabled:t4(this.opts.disabled.current),"aria-checked":r4(this.opts.checked.current),"aria-required":Qz(this.opts.required.current),[uT.root]:"",onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment})));this.opts=e,this.attachment=Ks(e.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this)}static create(e){return s_.set(new S_(e))}onkeydown(e){!(e.key===OE||e.key===FE)||this.opts.disabled.current||(e.preventDefault(),un(this,Cd,w0).call(this))}onclick(e){this.opts.disabled.current||un(this,Cd,w0).call(this)}get sharedProps(){return C(J(this,Rd))}set sharedProps(e){Be(J(this,Rd),e)}get snippetProps(){return C(J(this,Pd))}set snippetProps(e){Be(J(this,Pd),e)}get props(){return C(J(this,Id))}set props(e){Be(J(this,Id),e)}};Cd=new WeakSet,w0=function(){this.opts.checked.current=!this.opts.checked.current},Rd=new WeakMap,Pd=new WeakMap,Id=new WeakMap;let b0=S_;var Dd,Ld;const M_=class M_{constructor(e){Ae(this,"root");Fe(this,Dd,Ve(()=>this.root.opts.name.current!==void 0));Fe(this,Ld,Ve(()=>({type:"checkbox",name:this.root.opts.name.current,value:this.root.opts.value.current,checked:this.root.opts.checked.current,disabled:this.root.opts.disabled.current,required:this.root.opts.required.current})));this.root=e}static create(){return new M_(s_.get())}get shouldRender(){return C(J(this,Dd))}set shouldRender(e){Be(J(this,Dd),e)}get props(){return C(J(this,Ld))}set props(e){Be(J(this,Ld),e)}};Dd=new WeakMap,Ld=new WeakMap;let S0=M_;var kd,Ud;const E_=class E_{constructor(e,t){Ae(this,"opts");Ae(this,"root");Ae(this,"attachment");Fe(this,kd,Ve(()=>({checked:this.root.opts.checked.current})));Fe(this,Ud,Ve(()=>({...this.root.sharedProps,id:this.opts.id.current,[uT.thumb]:"",...this.attachment})));this.opts=e,this.root=t,this.attachment=Ks(e.ref)}static create(e){return new E_(e,s_.get())}get snippetProps(){return C(J(this,kd))}set snippetProps(e){Be(J(this,kd),e)}get props(){return C(J(this,Ud))}set props(e){Be(J(this,Ud),e)}};kd=new WeakMap,Ud=new WeakMap;let M0=E_;function bV(r,e){vt(e,!1);const t=S0.create();GA();var n=tt(),i=Ie(n);{var s=o=>{aV(o,pn(()=>t.props))};Dt(i,o=>{t.shouldRender&&o(s)})}re(r,n),yt()}var wV=new Set(["$$slots","$$events","$$legacy","child","children","ref","id","disabled","required","checked","value","name","type","onCheckedChange"]),SV=je("<button><!></button>"),MV=je("<!> <!>",1);function EV(r,e){const t=Ys();vt(e,!0);let n=ae(e,"ref",15,null),i=ae(e,"id",19,()=>Qs(t)),s=ae(e,"disabled",3,!1),o=ae(e,"required",3,!1),a=ae(e,"checked",15,!1),l=ae(e,"value",3,"on"),c=ae(e,"name",3,void 0),u=ae(e,"type",3,"button"),d=ae(e,"onCheckedChange",3,oi),h=Wt(e,wV);const f=b0.create({checked:kt(()=>a(),x=>{var T;a(x),(T=d())==null||T(x)}),disabled:kt(()=>s()??!1),required:kt(()=>o()),value:kt(()=>l()),name:kt(()=>c()),id:kt(()=>i()),ref:kt(()=>n(),x=>n(x))}),p=Ve(()=>lr(h,f.props,{type:u()}));var m=MV(),g=Ie(m);{var v=x=>{var T=tt(),b=Ie(T);{let M=Ve(()=>({props:C(p),...f.snippetProps}));zt(b,()=>e.child,()=>C(M))}re(x,T)},y=x=>{var T=SV();In(T,()=>({...C(p)}
4775));var b=qe(T);zt(b,()=>e.children??jt,()=>f.snippetProps),We(T),re(x,T)};Dt(g,x=>{e.child?x(v):x(y,-1)})}var _=Le(g,2);bV(_,{}),re(r,m),yt()}var TV=new Set(["$$slots","$$events","$$legacy","child","children","ref","id"]),AV=je("<span><!></span>");function CV(r,e){const t=Ys();vt(e,!0);let n=ae(e,"ref",15,null),i=ae(e,"id",19,()=>Qs(t)),s=Wt(e,TV);const o=M0.create({id:kt(()=>i()),ref:kt(()=>n(),h=>n(h))}),a=Ve(()=>lr(s,o.props));var l=tt(),c=Ie(l);{var u=h=>{var f=tt(),p=Ie(f);{let m=Ve(()=>({props:C(a),...o.snippetProps}));zt(p,()=>e.child,()=>C(m))}re(h,f)},d=h=>{var f=AV();In(f,()=>({...C(a)}));var p=qe(f);zt(p,()=>e.children??jt,()=>o.snippetProps),We(f),re(h,f)};Dt(c,h=>{e.child?h(u):h(d,-1)})}re(r,l),yt()}var RV=new Set(["$$slots","$$events","$$legacy","ref","class"]);function E0(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,RV);var i=tt(),s=Ie(i);{let o=Ve(()=>Nn("text-lg leading-none font-semibold",e.class));Qe(s,()=>zE,(a,l)=>{l(a,pn({"data-slot":"dialog-title",get class(){return C(o)}},()=>n,{get ref(){return t()},set ref(c){t(c)}}))})}re(r,i),yt()}var PV=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),IV=je("<div><!></div>");function DV(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,PV);var i=IV();In(i,o=>({"data-slot":"dialog-footer",class:o,...n}),[()=>Nn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}var LV=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),kV=je("<div><!></div>");function T0(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,LV);var i=kV();In(i,o=>({"data-slot":"dialog-header",class:o,...n}),[()=>Nn("flex flex-col gap-2 text-center sm:text-left",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}var UV=new Set(["$$slots","$$events","$$legacy","ref","class"]);function NV(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,UV);var i=tt(),s=Ie(i);{let o=Ve(()=>Nn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e.class));Qe(s,()=>oT,(a,l)=>{l(a,pn({"data-slot":"dialog-overlay",get class(){return C(o)}},()=>n,{get ref(){return t()},set ref(c){t(c)}}))})}re(r,i),yt()}/**
4776 * @license @lucide/svelte v0.511.0 - ISC
4777 *
4778 * ISC License
4779 * 
4780 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
4781 * 
4782 * Permission to use, copy, modify, and/or distribute this software for any
4783 * purpose with or without fee is hereby granted, provided that the above
4784 * copyright notice and this permission notice appear in all copies.
4785 * 
4786 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
4787 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
4788 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
4789 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
4790 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
4791 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
4792 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4793 * 
4794 */const OV={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};var FV=new Set(["$$slots","$$events","$$legacy","name","color","size","strokeWidth","absoluteStrokeWidth","iconNode","children"]),BV=$T("<svg><!><!></svg>");function zV(r,e){vt(e,!0);const t=ae(e,"color",3,"currentColor"),n=ae(e,"size",3,24),i=ae(e,"strokeWidth",3,2),s=ae(e,"absoluteStrokeWidth",3,!1),o=ae(e,"iconNode",19,()=>[]),a=Wt(e,FV);var l=BV();In(l,d=>({...OV,...a,width:n(),height:n(),stroke:t(),"stroke-width":d,class:["lucide-icon lucide",e.name&&`lucide-${e.name}`,e.class]}),[()=>s()?Number(i())*24/Number(n()):i()]);var c=qe(l);qr(c,17,o,Mo,(d,h)=>{var f=Ve(()=>AA(C(h),2));let p=()=>C(f)[0],m=()=>C(f)[1];var g=tt(),v=Ie(g);W0(v,p,!0,(y,_)=>{In(y,()=>({...m()}))}),re(d,g)});var u=Le(c);zt(u,()=>e.children??jt),We(l),re(r,l),yt()}var VV=new Set(["$$slots","$$events","$$legacy"]);function dT(r,e){vt(e,!0);/**
4795 * @license @lucide/svelte v0.511.0 - ISC
4796 *
4797 * ISC License
4798 *
4799 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
4800 *
4801 * Permission to use, copy, modify, and/or distribute this software for any
4802 * purpose with or without fee is hereby granted, provided that the above
4803 * copyright notice and this permission notice appear in all copies.
4804 *
4805 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
4806 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
4807 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
4808 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
4809 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
4810 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
4811 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4812 *
4813 */let t=Wt(e,VV);const n=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];
4813zV(r,pn({name:"x"},()=>t,{get iconNode(){return n},children:(i,s)=>{var o=tt(),a=Ie(o);zt(a,()=>e.children??jt),re(i,o)},$$slots:{default:!0}})),yt()}var GV=new Set(["$$slots","$$events","$$legacy","ref","class","portalProps","children"]),HV=je('<!> <span class="sr-only">Close</span>',1),t1=je("<!> <!>",1);function A0(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,GV);var i=tt(),s=Ie(i);Qe(s,()=>jV,(o,a)=>{a(o,pn(()=>e.portalProps,{children:(l,c)=>{var u=t1(),d=Ie(u);Qe(d,()=>NV,(f,p)=>{p(f,{})});var h=Le(d,2);{let f=Ve(()=>Nn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e.class));Qe(h,()=>cT,(p,m)=>{m(p,pn({"data-slot":"dialog-content",get class(){return C(f)}},()=>n,{get ref(){return t()},set ref(g){t(g)},children:(g,v)=>{var y=t1(),_=Ie(y);zt(_,()=>e.children??jt);var x=Le(_,2);Qe(x,()=>lT,(T,b)=>{b(T,{class:"ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:(M,E)=>{var S=HV(),w=Ie(S);dT(w,{}),Nt(2),re(M,S)},$$slots:{default:!0}})}),re(g,y)},$$slots:{default:!0}}))})}re(l,u)},$$slots:{default:!0}}))}),re(r,i),yt()}var WV=new Set(["$$slots","$$events","$$legacy","ref","class"]);function C0(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,WV);var i=tt(),s=Ie(i);{let o=Ve(()=>Nn("text-muted-foreground text-sm",e.class));Qe(s,()=>sV,(a,l)=>{l(a,pn({"data-slot":"dialog-description",get class(){return C(o)}},()=>n,{get ref(){return t()},set ref(c){t(c)}}))})}re(r,i),yt()}const R0=aT,jV=VE;var n1=r=>typeof r=="boolean"?`${r}`:r===0?"0":r,er=r=>!r||typeof r!="object"||Object.keys(r).length===0,XV=(r,e)=>JSON.stringify(r)===JSON.stringify(e);function hT(r,e){r.forEach(function(t){Array.isArray(t)?hT(t,e):e.push(t)})}function fT(r){let e=[];return hT(r,e),e}var pT=(...r)=>fT(r).filter(Boolean),mT=(r,e)=>{let t={},n=Object.keys(r),i=Object.keys(e);for(let s of n)if(i.includes(s)){let o=r[s],a=e[s];Array.isArray(o)||Array.isArray(a)?t[s]=pT(a,o):typeof o=="object"&&typeof a=="object"?t[s]=mT(o,a):t[s]=a+" "+o}else t[s]=r[s];for(let s of i)n.includes(s)||(t[s]=e[s]);return t},i1=r=>!r||typeof r!="string"?r:r.replace(/\s+/g," ").trim();const o_="-",qV=r=>{const e=$V(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=r;return{getClassGroupId:o=>{const a=o.split(o_);return a[0]===""&&a.length!==1&&a.shift(),gT(a,e)||YV(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&n[o]?[...l,...n[o]]:l}}},gT=(r,e)=>{var o;if(r.length===0)return e.classGroupId;const t=r[0],n=e.nextPart.get(t),i=n?gT(r.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const s=r.join(o_);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},r1=/^\[(.+)\]$/,YV=r=>{if(r1.test(r)){const e=r1.exec(r)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},$V=r=>{const{theme:e,classGroups:t}=r,n={nextPart:new Map,validators:[]};for(const i in t)P0(t[i],n,i,e);return n},P0=(r,e,t,n)=>{r.forEach(i=>{if(typeof i=="string"){const s=i===""?e:s1(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(ZV(i)){P0(i(n),e,t,n);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{P0(o,s1(e,s),t,n)})})},s1=(r,e)=>{let t=r;return e.split(o_).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},ZV=r=>r.isThemeGetter,JV=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const i=(s,o)=>{t.set(s,o),e++,e>r&&(e=0,n=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=n.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}},I0="!",D0=":",KV=D0.length,QV=r=>{const{prefix:e,experimentalParseClassName:t}=r;let n=i=>{const s=[];let o=0,a=0,l=0,c;for(let p=0;p<i.length;p++){let m=i[p];if(o===0&&a===0){if(m===D0){s.push(i.slice(l,p)),l=p+KV;continue}if(m==="/"){c=p;continue}}m==="["?o++:m==="]"?o--:m==="("?a++:m===")"&&a--}const u=s.length===0?i:i.substring(l),d=eG(u),h=d!==u,f=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:h,baseClassName:d,maybePostfixModifierPosition:f}};if(e){const i=e+D0,s=n;n=o=>o.startsWith(i)?s(o.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(t){const i=n;n=s=>t({className:s,parseClassName:i})}return n},eG=r=>r.endsWith(I0)?r.substring(0,r.length-1):r.startsWith(I0)?r.substring(1):r,tG=r=>{const e=Object.fromEntries(r.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const i=[];let s=[];
vendor: 10,444 bytes, line 4813
4813return n.forEach(o=>{o[0]==="["||e[o]?(i.push(...s.sort(),o),s=[]):s.push(o)}),i.push(...s.sort()),i}},nG=r=>({cache:JV(r.cacheSize),parseClassName:QV(r),sortModifiers:tG(r),...qV(r)}),iG=/\s+/,rG=(r,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=r.trim().split(iG);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:h,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=t(u);if(d){l=u+(l.length>0?" "+l:l);continue}let g=!!m,v=n(g?p.substring(0,m):p);if(!v){if(!g){l=u+(l.length>0?" "+l:l);continue}if(v=n(p),!v){l=u+(l.length>0?" "+l:l);continue}g=!1}const y=s(h).join(":"),_=f?y+I0:y,x=_+v;if(o.includes(x))continue;o.push(x);const T=i(v,g);for(let b=0;b<T.length;++b){const M=T[b];o.push(_+M)}l=u+(l.length>0?" "+l:l)}return l};function sG(){let r=0,e,t,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=vT(e))&&(n&&(n+=" "),n+=t);return n}const vT=r=>{if(typeof r=="string")return r;let e,t="";for(let n=0;n<r.length;n++)r[n]&&(e=vT(r[n]))&&(t&&(t+=" "),t+=e);return t};function L0(r,...e){let t,n,i,s=o;function o(l){const c=e.reduce((u,d)=>d(u),r());return t=nG(c),n=t.cache.get,i=t.cache.set,s=a,a(l)}function a(l){const c=n(l);if(c)return c;const u=rG(l,t);return i(l,u),u}return function(){return s(sG.apply(null,arguments))}}const yi=r=>{const e=t=>t[r]||[];return e.isThemeGetter=!0,e},yT=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_T=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oG=/^\d+\/\d+$/,aG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,uG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,El=r=>oG.test(r),dn=r=>!!r&&!Number.isNaN(Number(r)),ra=r=>!!r&&Number.isInteger(Number(r)),o1=r=>r.endsWith("%")&&dn(r.slice(0,-1)),fo=r=>aG.test(r),hG=()=>!0,fG=r=>lG.test(r)&&!cG.test(r),a_=()=>!1,pG=r=>uG.test(r),mG=r=>dG.test(r),gG=r=>!Tt(r)&&!At(r),vG=r=>_c(r,wT,a_),Tt=r=>yT.test(r),sa=r=>_c(r,ST,fG),mv=r=>_c(r,CG,dn),yG=r=>_c(r,xT,a_),_G=r=>_c(r,bT,mG),xG=r=>_c(r,a_,pG),At=r=>_T.test(r),gf=r=>xc(r,ST),bG=r=>xc(r,RG),wG=r=>xc(r,xT),SG=r=>xc(r,wT),MG=r=>xc(r,bT),EG=r=>xc(r,PG,!0),_c=(r,e,t)=>{const n=yT.exec(r);return n?n[1]?e(n[1]):t(n[2]):!1},xc=(r,e,t=!1)=>{const n=_T.exec(r);return n?n[1]?e(n[1]):t:!1},xT=r=>r==="position",TG=new Set(["image","url"]),bT=r=>TG.has(r),AG=new Set(["length","size","percentage"]),wT=r=>AG.has(r),ST=r=>r==="length",CG=r=>r==="number",RG=r=>r==="family-name",PG=r=>r==="shadow",k0=()=>{const r=yi("color"),e=yi("font"),t=yi("text"),n=yi("font-weight"),i=yi("tracking"),s=yi("leading"),o=yi("breakpoint"),a=yi("container"),l=yi("spacing"),c=yi("radius"),u=yi("shadow"),d=yi("inset-shadow"),h=yi("drop-shadow"),f=yi("blur"),p=yi("perspective"),m=yi("aspect"),g=yi("ease"),v=yi("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],x=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],b=()=>[At,Tt,l],M=()=>[El,"full","auto",...b()],E=()=>[ra,"none","subgrid",At,Tt],S=()=>["auto",{span:["full",ra,At,Tt]},At,Tt],w=()=>[ra,"auto",At,Tt],D=()=>["auto","min","max","fr",At,Tt],R=()=>["start","end","center","between","around","evenly","stretch","baseline"],k=()=>["start","end","center","stretch"],N=()=>["auto",...b()],H=()=>[El,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...b()],P=()=>[r,At,Tt],ee=()=>[o1,sa],X=()=>["","none","full",c,At,Tt],Q=()=>["",dn,gf,sa],Y=()=>["solid","dashed","dotted","double"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["","none",f,At,Tt],te=()=>["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",At,Tt],O=()=>["none",dn,At,Tt],U=()=>["none",dn,At,Tt],W=()=>[dn,At,Tt],j=()=>[El,"full",...b()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fo],breakpoint:[fo],color:[hG],container:[fo],"drop-shadow":[fo],ease:["in","out","in-out"],font:[gG],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fo],shadow:[fo],spacing:["px",dn],text:[fo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",El,Tt,At,m]}],container:["container"],columns:[{columns:[dn,Tt,At,a]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[..._(),Tt,At]}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[ra,"auto",At,Tt]}],basis:[{basis:[El,"full","auto",a,...b()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[dn,El,"auto","initial","none",Tt]}],grow:[{grow:["",dn,At,Tt]}],shrink:[{shrink:["",dn,At,Tt]}],order:[{order:[ra,"first","last","none",At,Tt]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":w()}],"col-end":[{"col-end":w()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":w()}],"row-end":[{"row-end":w()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:b()}],"gap-x":[{"gap-x":b()}],"gap-y":[{"gap-y":b()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...k(),"normal"]}],"justify-self":[{"justify-self":["auto",...k()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...k(),"baseline"]}],"align-self":[{self:["auto",...k(),"baseline"]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...k(),"baseline"]}],"place-self":[{"place-self":["auto",...k()]}],p:[{p:b()}],px:[{px:b()}],py:[{py:b()}],ps:[{ps:b()}],pe:[{pe:b()}],pt:[{pt:b()}],pr:[{pr:b()}],pb:[{pb:b()}],pl:[{pl:b()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":b()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":b()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[a,"screen",...H()]}],"min-w":[{"min-w":[a,"screen","none",...H()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen",...H()]}],"min-h":[{"min-h":["screen","none",...H()]}],"max-h":[{"max-h":["screen",...H()]}],"font-size":[{text:["base",t,gf,sa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,At,mv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",o1,Tt]}],"font-family":[{font:[bG,Tt,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,At,Tt]}],"line-clamp":[{"line-clamp":[dn,"none",At,mv]}],leading:[{leading:[s,...b()]}],"list-image":[{"list-image":["none",At,Tt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",At,Tt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[dn,"from-font","auto",At,sa]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[dn,"auto",At,Tt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:b()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",At,Tt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",At,Tt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[..._(),wG,yG]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:["auto","cover","contain",SG,vG]}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ra,At,Tt],radial:["",At,Tt],conic:[ra,At,Tt]},MG,_G]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ee()}
vendor: 4,504 bytes, line 4813
4813],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[dn,At,Tt]}],"outline-w":[{outline:["",dn,gf,sa]}],"outline-color":[{outline:[r]}],shadow:[{shadow:["","none",u,EG,xG]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",At,Tt,d]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[dn,sa]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":P()}],opacity:[{opacity:[dn,At,Tt]}],"mix-blend":[{"mix-blend":[...z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none",At,Tt]}],blur:[{blur:K()}],brightness:[{brightness:[dn,At,Tt]}],contrast:[{contrast:[dn,At,Tt]}],"drop-shadow":[{"drop-shadow":["","none",h,At,Tt]}],grayscale:[{grayscale:["",dn,At,Tt]}],"hue-rotate":[{"hue-rotate":[dn,At,Tt]}],invert:[{invert:["",dn,At,Tt]}],saturate:[{saturate:[dn,At,Tt]}],sepia:[{sepia:["",dn,At,Tt]}],"backdrop-filter":[{"backdrop-filter":["","none",At,Tt]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[dn,At,Tt]}],"backdrop-contrast":[{"backdrop-contrast":[dn,At,Tt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dn,At,Tt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dn,At,Tt]}],"backdrop-invert":[{"backdrop-invert":["",dn,At,Tt]}],"backdrop-opacity":[{"backdrop-opacity":[dn,At,Tt]}],"backdrop-saturate":[{"backdrop-saturate":[dn,At,Tt]}],"backdrop-sepia":[{"backdrop-sepia":["",dn,At,Tt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":b()}],"border-spacing-x":[{"border-spacing-x":b()}],"border-spacing-y":[{"border-spacing-y":b()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",At,Tt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dn,"initial",At,Tt]}],ease:[{ease:["linear","initial",g,At,Tt]}],delay:[{delay:[dn,At,Tt]}],animate:[{animate:["none",v,At,Tt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,At,Tt]}],"perspective-origin":[{"perspective-origin":te()}],rotate:[{rotate:O()}],"rotate-x":[{"rotate-x":O()}],"rotate-y":[{"rotate-y":O()}],"rotate-z":[{"rotate-z":O()}],scale:[{scale:U()}],"scale-x":[{"scale-x":U()}],"scale-y":[{"scale-y":U()}],"scale-z":[{"scale-z":U()}],"scale-3d":["scale-3d"],skew:[{skew:W()}],"skew-x":[{"skew-x":W()}],"skew-y":[{"skew-y":W()}],transform:[{transform:[At,Tt,"","none","gpu","cpu"]}],"transform-origin":[{origin:te()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:j()}],"translate-x":[{"translate-x":j()}],"translate-y":[{"translate-y":j()}],"translate-z":[{"translate-z":j()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}
vendor: 5,231 bytes, line 4813
4813],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",At,Tt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":b()}],"scroll-mx":[{"scroll-mx":b()}],"scroll-my":[{"scroll-my":b()}],"scroll-ms":[{"scroll-ms":b()}],"scroll-me":[{"scroll-me":b()}],"scroll-mt":[{"scroll-mt":b()}],"scroll-mr":[{"scroll-mr":b()}],"scroll-mb":[{"scroll-mb":b()}],"scroll-ml":[{"scroll-ml":b()}],"scroll-p":[{"scroll-p":b()}],"scroll-px":[{"scroll-px":b()}],"scroll-py":[{"scroll-py":b()}],"scroll-ps":[{"scroll-ps":b()}],"scroll-pe":[{"scroll-pe":b()}],"scroll-pt":[{"scroll-pt":b()}],"scroll-pr":[{"scroll-pr":b()}],"scroll-pb":[{"scroll-pb":b()}],"scroll-pl":[{"scroll-pl":b()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",At,Tt]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[dn,gf,sa,mv]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["before","after","placeholder","file","marker","selection","first-line","first-letter","backdrop","*","**"]}},IG=(r,{cacheSize:e,prefix:t,experimentalParseClassName:n,extend:i={},override:s={}})=>(Zc(r,"cacheSize",e),Zc(r,"prefix",t),Zc(r,"experimentalParseClassName",n),vf(r.theme,s.theme),vf(r.classGroups,s.classGroups),vf(r.conflictingClassGroups,s.conflictingClassGroups),vf(r.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),Zc(r,"orderSensitiveModifiers",s.orderSensitiveModifiers),yf(r.theme,i.theme),yf(r.classGroups,i.classGroups),yf(r.conflictingClassGroups,i.conflictingClassGroups),yf(r.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),MT(r,i,"orderSensitiveModifiers"),r),Zc=(r,e,t)=>{t!==void 0&&(r[e]=t)},vf=(r,e)=>{if(e)for(const t in e)Zc(r,t,e[t])},yf=(r,e)=>{if(e)for(const t in e)MT(r,e,t)},MT=(r,e,t)=>{const n=e[t];n!==void 0&&(r[t]=r[t]?r[t].concat(n):n)},DG=(r,...e)=>typeof r=="function"?L0(k0,r,...e):L0(()=>IG(k0(),r),...e),LG=L0(k0);
4813var kG={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},ET=r=>r||void 0,Uu=(...r)=>ET(fT(r).filter(Boolean).join(" ")),gv=null,Es={},U0=!1,Wc=(...r)=>e=>e.twMerge?((!gv||U0)&&(U0=!1,gv=er(Es)?LG:DG({...Es,extend:{theme:Es.theme,classGroups:Es.classGroups,conflictingClassGroupModifiers:Es.conflictingClassGroupModifiers,conflictingClassGroups:Es.conflictingClassGroups,...Es.extend}})),ET(gv(Uu(r)))):Uu(r),a1=(r,e)=>{for(let t in e)r.hasOwnProperty(t)?r[t]=Uu(r[t],e[t]):r[t]=e[t];return r},Zm=(r,e)=>{let{extend:t=null,slots:n={},variants:i={},compoundVariants:s=[],compoundSlots:o=[],defaultVariants:a={}}=r,l={...kG,...e},c=t!=null&&t.base?Uu(t.base,r==null?void 0:r.base):r==null?void 0:r.base,u=t!=null&&t.variants&&!er(t.variants)?mT(i,t.variants):i,d=t!=null&&t.defaultVariants&&!er(t.defaultVariants)?{...t.defaultVariants,...a}:a;!er(l.twMergeConfig)&&!XV(l.twMergeConfig,Es)&&(U0=!0,Es=l.twMergeConfig);let h=er(t==null?void 0:t.slots),f=er(n)?{}:{base:Uu(r==null?void 0:r.base,h&&(t==null?void 0:t.base)),...n},p=h?f:a1({...t==null?void 0:t.slots},er(f)?{base:r==null?void 0:r.base}:f),m=er(t==null?void 0:t.compoundVariants)?s:pT(t==null?void 0:t.compoundVariants,s),g=y=>{if(er(u)&&er(n)&&h)return Wc(c,y==null?void 0:y.class,y==null?void 0:y.className)(l);if(m&&!Array.isArray(m))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof m}`);if(o&&!Array.isArray(o))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof o}`);let _=(R,k,N=[],H)=>{let P=N;if(typeof k=="string")P=P.concat(i1(k).split(" ").map(ee=>`${R}:${ee}`));else if(Array.isArray(k))P=P.concat(k.reduce((ee,X)=>ee.concat(`${R}:${X}`),[]));else if(typeof k=="object"&&typeof H=="string"){for(let ee in k)if(k.hasOwnProperty(ee)&&ee===H){let X=k[ee];if(X&&typeof X=="string"){let Q=i1(X);P[H]?P[H]=P[H].concat(Q.split(" ").map(Y=>`${R}:${Y}`)):P[H]=Q.split(" ").map(Y=>`${R}:${Y}`)}else Array.isArray(X)&&X.length>0&&(P[H]=X.reduce((Q,Y)=>Q.concat(`${R}:${Y}`),[]))}}return P},x=(R,k=u,N=null,H=null)=>{var P;let ee=k[R];if(!ee||er(ee))return null;let X=(P=H==null?void 0:H[R])!=null?P:y==null?void 0:y[R];if(X===null)return null;let Q=n1(X),Y=Array.isArray(l.responsiveVariants)&&l.responsiveVariants.length>0||l.responsiveVariants===!0,z=d==null?void 0:d[R],K=[];if(typeof Q=="object"&&Y)for(let[U,W]of Object.entries(Q)){let j=ee[W];if(U==="initial"){z=W;continue}Array.isArray(l.responsiveVariants)&&!l.responsiveVariants.includes(U)||(K=_(U,j,K,N))}let te=Q!=null&&typeof Q!="object"?Q:n1(z),O=ee[te||"false"];return typeof K=="object"&&typeof N=="string"&&K[N]?a1(K,O):K.length>0?(K.push(O),N==="base"?K.join(" "):K):O},T=()=>u?Object.keys(u).map(R=>x(R,u)):null,b=(R,k)=>{if(!u||typeof u!="object")return null;let N=new Array;for(let H in u){let P=x(H,u,R,k),ee=R==="base"&&typeof P=="string"?P:P&&P[R];ee&&(N[N.length]=ee)}return N},M={};for(let R in y)y[R]!==void 0&&(M[R]=y[R]);let E=(R,k)=>{var N;let H=typeof(y==null?void 0:y[R])=="object"?{[R]:(N=y[R])==null?void 0:N.initial}:{};return{...d,...M,...H,...k}},S=(R=[],k)=>{let N=[];for(let{class:H,className:P,...ee}of R){let X=!0;for(let[Q,Y]of Object.entries(ee)){let z=E(Q,k)[Q];if(Array.isArray(Y)){if(!Y.includes(z)){X=!1;break}}else{let K=te=>te==null||te===!1;if(K(Y)&&K(z))continue;if(z!==Y){X=!1;break}}}X&&(H&&N.push(H),P&&N.push(P))}return N},w=R=>{let k=S(m,R);if(!Array.isArray(k))return k;let N={};for(let H of k)if(typeof H=="string"&&(N.base=Wc(N.base,H)(l)),typeof H=="object")for(let[P,ee]of Object.entries(H))N[P]=Wc(N[P],ee)(l);return N},D=R=>{if(o.length<1)return null;let k={};for(let{slots:N=[],class:H,className:P,...ee}of o){if(!er(ee)){let X=!0;for(let Q of Object.keys(ee)){let Y=E(Q,R)[Q];if(Y===void 0||(Array.isArray(ee[Q])?!ee[Q].includes(Y):ee[Q]!==Y)){X=!1;break}}if(!X)continue}for(let X of N)k[X]=k[X]||[],k[X].push([H,P])}return k};if(!er(n)||!h){let R={};if(typeof p=="object"&&!er(p))for(let k of Object.keys(p))R[k]=N=>{var H,P;return Wc(p[k],b(k,N),((H=w(N))!=null?H:[])[k],((P=D(N))!=null?P:[])[k],N==null?void 0:N.class,N==null?void 0:N.className)(l)};return R}return Wc(c,T(),S(m),y==null?void 0:y.class,y==null?void 0:y.className)(l)},v=()=>{if(!(!u||typeof u!="object"))return Object.keys(u)};return g.variantKeys=v(),g.extend=t,g.base=c,g.slots=p,g.variants=u,g.defaultVariants=d,g.compoundSlots=o,g.compoundVariants=m,g};
4813const l1=Zm({base:"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white",outline:"bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});var UG=new Set(["$$slots","$$events","$$legacy","class","variant","size","ref","href","type","disabled","children"]),NG=je("<a><!></a>"),OG=je("<button><!></button>");function rr(r,e){vt(e,!0);let t=ae(e,"variant",3,"default"),n=ae(e,"size",3,"default"),i=ae(e,"ref",15,null),s=ae(e,"href",3,void 0),o=ae(e,"type",3,"button"),a=Wt(e,UG);var l=tt(),c=Ie(l);{var u=h=>{var f=NG();In(f,m=>({"data-slot":"button",class:m,href:e.disabled?void 0:s(),"aria-disabled":e.disabled,role:e.disabled?"link":void 0,tabindex:e.disabled?-1:void 0,...a}),[()=>Nn(l1({variant:t(),size:n()}),e.class)]);var p=qe(f);zt(p,()=>e.children??jt),We(f),ti(f,m=>i(m),()=>i()),re(h,f)},d=h=>{var f=OG();In(f,m=>({"data-slot":"button",class:m,type:o(),disabled:e.disabled,...a}),[()=>Nn(l1({variant:t(),size:n()}),e.class)]);var p=qe(f);zt(p,()=>e.children??jt),We(f),ti(f,m=>i(m),()=>i()),re(h,f)};Dt(c,h=>{s()?h(u):h(d,-1)})}re(r,l),yt()}var FG=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),BG=je("<div><!></div>");function TT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,FG);var i=BG();In(i,o=>({"data-slot":"card",class:o,...n}),[()=>Nn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}var zG=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),VG=je("<div><!></div>");function AT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,zG);var i=VG();In(i,o=>({"data-slot":"card-content",class:o,...n}),[()=>Nn("px-6",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}var GG=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),HG=je("<div><!></div>");function CT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,GG);var i=HG();In(i,o=>({"data-slot":"card-header",class:o,...n}),[()=>Nn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}var WG=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),jG=je("<div><!></div>");function RT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,WG);var i=jG();In(i,o=>({"data-slot":"card-title",class:o,...n}),[()=>Nn("leading-none font-semibold",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}const XG=Zm({base:"relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"}},defaultVariants:{variant:"default"}});var qG=new Set(["$$slots","$$events","$$legacy","ref","class","variant","children"]),YG=je("<div><!></div>");function PT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=ae(e,"variant",3,"default"),i=Wt(e,qG);var s=YG();In(s,a=>({"data-slot":"alert",class:a,...i,role:"alert"}),[()=>Nn(XG({variant:n()}),e.class)]);var o=qe(s);zt(o,()=>e.children??jt),We(s),ti(s,a=>t(a),()=>t()),re(r,s),yt()}var $G=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),ZG=je("<div><!></div>");function IT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,$G);var i=ZG();In(i,o=>({"data-slot":"alert-description",class:o,...n}),[()=>Nn("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}var JG=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),KG=je("<div><!></div>");function QG(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,JG);var i=KG();In(i,o=>({"data-slot":"alert-title",class:o,...n}),[()=>Nn("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}
4813const e5=Zm({base:"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",destructive:"bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70 border-transparent text-white",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});var t5=new Set(["$$slots","$$events","$$legacy","ref","href","class","variant","children"]);function Na(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=ae(e,"variant",3,"default"),i=Wt(e,t5);var s=tt(),o=Ie(s);W0(o,()=>e.href?"a":"span",!1,(a,l)=>{ti(a,d=>t(d),()=>t()),In(a,d=>({"data-slot":"badge",href:e.href,class:d,...i}),[()=>Nn(e5({variant:n()}),e.class)]);var c=tt(),u=Ie(c);zt(u,()=>e.children??jt),re(l,c)}),re(r,s),yt()}const l_=typeof window<"u";function DT(){if(!l_)return;if(window.SPACE_HOST)return window.SPACE_HOST;const r=window.location.hostname;if(r.includes("hf.space")||r.includes("huggingface.co"))return r}function n5(){if(!l_)return"http://localhost:7860";const r=DT();if(r)return`https://${r}`;const{protocol:e,hostname:t,port:n}=window.location;return t==="localhost"||t==="127.0.0.1"?n==="5173"?"http://localhost:7860":`${e}//${t}:${n}`:`${e}//${t}${n?`:${n}`:""}`}function LT(){if(!l_)return"ws://localhost:7860";const r=DT();if(r)return`wss://${r}`;const{protocol:e,hostname:t,port:n}=window.location;return t==="localhost"||t==="127.0.0.1"?n==="5173"?"ws://localhost:7860":`${e==="https:"?"wss:":"ws:"}//${t}:${n}`:`${e==="https:"?"wss:":"ws:"}//${t}${n?`:${n}`:""}`}var i5=je('<span class="icon-[mdi--account-supervisor] size-5 text-green-400"></span> Master Connection',1),vv=je("<!> <!>",1),r5=je('<span class="icon-[mdi--account-supervisor] size-4"></span> Connection Options',1),s5=je('<span class="icon-[mdi--close-circle] mr-1 size-3"></span> Disconnect',1),o5=je('<div class="rounded-lg border border-green-500/30 bg-green-900/20 p-2"><div class="flex items-center justify-between"><div><p class="text-sm font-medium text-green-300"> </p> <p class="text-xs text-green-400/70">Currently active</p></div> <!></div></div>'),a5=je('<span class="icon-[mdi--play-circle] mr-2 size-4"></span> Demo Sequences',1),l5=je('<span class="icon-[mdi--cloud] mr-2 size-4"></span> Remote Server',1),c5=je('<span class="icon-[mdi--usb] mr-2 size-4"></span> USB Master',1),u5=je('<div class="space-y-2"><!> <!> <!></div>'),d5=je('<div class="space-y-4"><div class="flex items-center justify-between rounded-lg border border-green-500/30 bg-green-900/20 p-3"><div class="flex items-center gap-2"><span class="icon-[mdi--speak] size-4 text-green-400"></span> <span class="text-sm font-medium text-green-300">Master Status</span></div> <!></div> <!> <div class="rounded border border-slate-700 bg-slate-800/30 p-2 text-xs text-slate-500"><span class="icon-[mdi--information] mr-1 size-3"></span> Masters are input sources. Only one can be active at a time.</div></div>');function h5(r,e){vt(e,!0);let t=ae(e,"open",15);const n=LT();async function i(){if(e.robot)try{await jr.connectDemoSequences(e.robot.id)}catch(u){Cr.error("Failed to Connect Demo Sequences",{description:`Could not connect demo sequences: ${u}`}),console.error(u)}}async function s(){if(e.robot)try{const u={type:"remote-server",url:n,apiKey:void 0,pollInterval:100};await jr.connectMaster(e.robot.id,u)}catch(u){Cr.error("Failed to Connect Remote Server",{description:`Could not connect remote server: ${u}`}),console.error(u)}}async function o(){if(e.robot)try{await jr.connectUSBMaster(e.robot.id,{pollInterval:200,smoothing:!0})}catch(u){Cr.error("Failed to Connect USB Master",{description:`Could not connect USB master: ${u}`}),console.error(u)}}async function a(){if(e.robot)try{await jr.disconnectMaster(e.robot.id)}catch(u){Cr.error("Failed to Disconnect Master",{description:`Could not disconnect master: ${u}`}),console.error(u)}}var l=tt(),c=Ie(l);Qe(c,()=>R0,(u,d)=>{d(u,{get open(){return t()},set open(h){t(h)},children:(h,f)=>{var p=tt(),m=Ie(p);Qe(m,()=>A0,(g,v)=>{v(g,{class:"max-h-[80vh] max-w-xl overflow-y-auto border-slate-600 bg-slate-900 text-slate-100",children:(y,_)=>{var x=vv(),T=Ie(x);Qe(T,()=>T0,(E,S)=>{S(E,{class:"pb-3",children:(w,D)=>{var R=vv(),k=Ie(R);Qe(k,()=>E0,(H,P)=>{P(H,{class:"flex items-center gap-2 text-lg font-bold text-slate-100",children:(ee,X)=>{var Q=i5();Nt(),re(ee,Q)},$$slots:{default:!0}})});var N=Le(k,2);Qe(N,()=>C0,(H,P)=>{P(H,{class:"text-sm text-slate-400",children:(ee,X)=>{Nt();var Q=Yn();En(()=>{var Y;return gn(Q,`Configure master sources for robot ${((Y=e.robot)==null?void 0:Y.id)??""}`)}),re(ee,Q)},$$slots:{default:!0}})}),re(w,R)},$$slots:{default:!0}})});var b=Le(T,2);{var M=E=>{var S=d5(),w=qe(S),D=Le(qe(w),2);{var R=H=>{Na(H,{variant:"default",class:"bg-green-600 text-xs",children:(P,ee)=>{Nt();var X=Yn();En(()=>gn(X,e.robot.controlState.masterName)),re(P,X)},$$slots:{default:!0}})},k=H=>{Na(H,{variant:"outline",class:"text-xs text-slate-400",children:(P,ee)=>{Nt();var X=Yn("None Connected");re(P,X)},$$slots:{default:!0}})};Dt(D,H=>{e.robot.controlState.hasActiveMaster?H(R):H(k,-1)})}We(w);var N=Le(w,2);Qe(N,()=>TT,(H,P)=>{P(H,{class:"border-green-500/30 bg-green-500/5",children:(ee,X)=>{var Q=vv(),Y=Ie(Q);Qe(Y,()=>CT,(K,te)=>{te(K,{children:(O,U)=>{var W=tt(),j=Ie(W);Qe(j,()=>RT,(ie,de)=>{de(ie,{class:"flex items-center gap-2 text-base text-green-200",children:(ye,we)=>{var _e=r5();Nt(),re(ye,_e)},$$slots:{default:!0}})}),re(O,W)},$$slots:{default:!0}})});var z=Le(Y,2);Qe(z,()=>AT,(K,te)=>{te(K,{class:"space-y-2",children:(O,U)=>{var W=tt(),j=Ie(W);{var ie=ye=>{var we=o5(),_e=qe(we),Re=qe(_e),F=qe(Re),pe=Dn(F,!0);Nt(2),We(Re);var me=Le(Re,2);rr(me,{variant:"destructive",size:"sm",onclick:a,class:"h-7 px-2 text-xs",children:(be,se)=>{var Se=s5();Nt(),re(be,Se)},$$slots:{default:!0}}),We(_e),We(we),En(()=>gn(pe,e.robot.controlState.masterName)),re(ye,we)},de=ye=>{var we=u5(),_e=qe(we);rr(_e,{variant:"secondary",onclick:i,class:"h-8 w-full bg-orange-600 text-sm text-white hover:bg-orange-700",children:(pe,me)=>{var be=a5();Nt(),re(pe,be)},$$slots:{default:!0}});var Re=Le(_e,2);rr(Re,{variant:"secondary",onclick:s,class:"h-8 w-full bg-purple-600 text-sm text-white hover:bg-purple-700",children:(pe,me)=>{var be=l5();Nt(),re(pe,be)},$$slots:{default:!0}});var F=Le(Re,2);rr(F,{variant:"secondary",onclick:o,class:"h-8 w-full bg-blue-600 text-sm text-white hover:bg-blue-700",children:(pe,me)=>{var be=c5();Nt(),re(pe,be)},$$slots:{default:!0}}),We(we),re(ye,we)};Dt(j,ye=>{e.robot.controlState.hasActiveMaster?ye(ie):ye(de,-1)})}re(O,W)},$$slots:{default:!0}})}),re(ee,Q)},$$slots:{default:!0}})}),Nt(2),We(S),re(E,S)};Dt(b,E=>{e.robot&&E(M)})}re(y,x)},$$slots:{default:!0}})}),re(h,p)},$$slots:{default:!0}})}),re(r,l),yt()}var f5=new Set(["$$slots","$$events","$$legacy","ref","class"]);function c_(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,f5);var i=tt(),s=Ie(i);{let o=Ve(()=>Nn("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e.class));Qe(s,()=>dV,(a,l)=>{l(a,pn({"data-slot":"separator-root",get class(){return C(o)}},()=>n,{get ref(){return t()},set ref(c){t(c)}}))})}re(r,i),yt()}var p5=je('<span class="icon-[mdi--devices] size-5 text-blue-400"></span> Slave Connection',1),Tl=je("<!>
4813 <!>",1),m5=je('<span class="icon-[mdi--devices] size-4"></span> Connection Options',1),g5=je('<span class="icon-[mdi--robot-confused] mr-2 size-4"></span> Add Mock Slave',1),v5=je('<span class="icon-[mdi--usb] mr-2 size-4"></span> Add USB Slave',1),y5=je('<span class="icon-[mdi--cloud] mr-2 size-4"></span> Add Remote Server Slave',1),_5=je('<span class="icon-[mdi--close] size-3"></span>'),x5=je('<div class="flex items-center justify-between rounded-md bg-slate-700/50 p-2"><div class="flex items-center gap-2"><span class="icon-[mdi--circle] size-2 text-green-400"></span> <span class="text-sm text-slate-300"> </span> <!></div> <!></div>'),b5=je('<!> <div class="space-y-2"><p class="text-xs font-medium text-blue-300">Connected Slaves:</p> <div class="max-h-32 space-y-1 overflow-y-auto"></div></div>',1),w5=je('<div class="space-y-2"><!> <!> <!></div> <!>',1),S5=je('<div class="space-y-4"><div class="flex items-center justify-between rounded-lg border border-blue-500/30 bg-blue-900/20 p-3"><div class="flex items-center gap-2"><span class="icon-[fa6-solid--ear-listen] size-4 text-blue-400"></span> <span class="text-sm font-medium text-blue-300">Slave Status</span></div> <!></div> <!> <div class="rounded border border-slate-700 bg-slate-800/30 p-2 text-xs text-slate-500"><span class="icon-[mdi--information] mr-1 size-3"></span> Slaves are output targets. Multiple can be connected simultaneously.</div></div>'),M5=je('<span class="icon-[ix--robotic-arm] size-5"></span> Select Server Robot',1),E5=je("<option> </option>"),T5=je(`This will connect your local robot <strong> </strong> as a slave to receive commands
4814						from the selected server robot.`,1),A5=je('<span class="icon-[mdi--information] size-4"></span> <!>',1),C5=je('<span class="icon-[mdi--link] mr-1 size-4"></span> Connect Slave',1),R5=je('<!> <div class="space-y-4"><div class="space-y-2"><label for="server-robot-select" class="text-sm font-medium text-slate-300">Available robots on server:</label> <select class="w-full rounded-md border border-slate-600 bg-slate-700 px-3 py-2 text-sm text-slate-100" id="server-robot-select"></select></div> <!></div> <!>',1);function P5(r,e){vt(e,!0);let t=ae(e,"open",15),n=Pt(!1),i=Pt(mr([])),s=Pt("");const o=n5(),a=LT();async function l(){if(e.robot)try{await jr.connectMockSlave(e.robot.id,50)}catch(y){Cr.error("Failed to Connect Mock Slave",{description:`Could not connect mock slave: ${y}`}),console.error(y)}}async function c(){if(e.robot)try{await jr.connectUSBSlave(e.robot.id)}catch(y){Cr.error("Failed to Connect USB Slave",{description:`Could not connect USB slave: ${y}`}),console.error(y)}}async function u(){var y;if(e.robot)try{const _=await fetch(`${o}/api/robots`);if(!_.ok)throw new Error(`Server responded with ${_.status}: ${_.statusText}`);const x=await _.json();if(x.length===0){Cr.error("No Server Robots Available",{description:"No robots available on the server. Create a robot on the server first."});return}Be(i,x,!0),Be(s,((y=x[0])==null?void 0:y.id)||"",!0),Be(n,!0)}catch(_){Cr.error("Failed to Fetch Server Robots",{description:`Could not fetch server robots: ${_}`}),console.error(_)}}async function d(){if(!(!e.robot||!C(s)))try{await jr.connectRemoteServerSlave(e.robot.id,a,void 0,C(s)),Be(n,!1)}catch(y){Cr.error("Failed to Connect Remote Server Slave",{description:`Could not connect remote server slave: ${y}`}),console.error(y)}}function h(){Be(n,!1),Be(s,"")}async function f(y){if(e.robot)try{await jr.disconnectSlave(e.robot.id,y)}catch(_){Cr.error("Failed to Disconnect Slave",{description:`Could not disconnect slave: ${_}`}),console.error(_)}}var p=Tl(),m=Ie(p);Qe(m,()=>R0,(y,_)=>{_(y,{get open(){return t()},set open(x){t(x)},children:(x,T)=>{var b=tt(),M=Ie(b);Qe(M,()=>A0,(E,S)=>{S(E,{class:"max-h-[80vh] max-w-xl overflow-y-auto border-slate-600 bg-slate-900 text-slate-100",children:(w,D)=>{var R=Tl(),k=Ie(R);Qe(k,()=>T0,(P,ee)=>{ee(P,{class:"pb-3",children:(X,Q)=>{var Y=Tl(),z=Ie(Y);Qe(z,()=>E0,(te,O)=>{O(te,{class:"flex items-center gap-2 text-lg font-bold text-slate-100",children:(U,W)=>{var j=p5();Nt(),re(U,j)},$$slots:{default:!0}})});var K=Le(z,2);Qe(K,()=>C0,(te,O)=>{O(te,{class:"text-sm text-slate-400",children:(U,W)=>{Nt();var j=Yn();En(()=>{var ie;return gn(j,`Configure slave targets for robot ${((ie=e.robot)==null?void 0:ie.id)??""}`)}),re(U,j)},$$slots:{default:!0}})}),re(X,Y)},$$slots:{default:!0}})});var N=Le(k,2);{var H=P=>{var ee=S5(),X=qe(ee),Q=Le(qe(X),2);Na(Q,{variant:"default",class:"bg-blue-600 text-xs",children:(z,K)=>{Nt();var te=Yn();En(()=>gn(te,`${e.robot.connectedSlaves.length??""} / ${e.robot.slaves.length??""} Connected`)),re(z,te)},$$slots:{default:!0}}),We(X);var Y=Le(X,2);Qe(Y,()=>
4814TT,(z,K)=>{K(z,{class:"border-blue-500/30 bg-blue-500/5",children:(te,O)=>{var U=Tl(),W=Ie(U);Qe(W,()=>CT,(ie,de)=>{de(ie,{class:"pb-2",children:(ye,we)=>{var _e=tt(),Re=Ie(_e);Qe(Re,()=>RT,(F,pe)=>{pe(F,{class:"flex items-center gap-2 text-base text-blue-200",children:(me,be)=>{var se=m5();Nt(),re(me,se)},$$slots:{default:!0}})}),re(ye,_e)},$$slots:{default:!0}})});var j=Le(W,2);Qe(j,()=>AT,(ie,de)=>{de(ie,{class:"space-y-3",children:(ye,we)=>{var _e=w5(),Re=Ie(_e),F=qe(Re);rr(F,{variant:"secondary",onclick:l,class:"h-8 w-full bg-yellow-600 text-sm text-white hover:bg-yellow-700",children:(Se,he)=>{var le=g5();Nt(),re(Se,le)},$$slots:{default:!0}});var pe=Le(F,2);rr(pe,{variant:"secondary",onclick:c,class:"h-8 w-full bg-green-600 text-sm text-white hover:bg-green-700",children:(Se,he)=>{var le=v5();Nt(),re(Se,le)},$$slots:{default:!0}});var me=Le(pe,2);rr(me,{variant:"secondary",onclick:u,class:"h-8 w-full bg-purple-600 text-sm text-white hover:bg-purple-700",children:(Se,he)=>{var le=y5();Nt(),re(Se,le)},$$slots:{default:!0}}),We(Re);var be=Le(Re,2);{var se=Se=>{var he=b5(),le=Ie(he);c_(le,{});var He=Le(le,2),B=Le(qe(He),2);qr(B,21,()=>e.robot.slaves,Mo,(A,ne)=>{var ge=x5(),ue=qe(ge),ce=Le(qe(ue),2),Ne=Dn(ce,!0),De=Le(ce,2);Na(De,{variant:"outline",class:"text-xs",children:(Je,Ee)=>{Nt();var Ge=Yn();En(Ye=>gn(Ge,Ye),[()=>C(ne).id.slice(0,8)]),re(Je,Ge)},$$slots:{default:!0}}),We(ue);var $e=Le(ue,2);rr($e,{variant:"destructive",size:"sm",onclick:()=>f(C(ne).id),class:"h-6 px-2 text-xs",children:(Je,Ee)=>{var Ge=_5();re(Je,Ge)},$$slots:{default:!0}}),We(ge),En(()=>gn(Ne,C(ne).name)),re(A,ge)}),We(B),We(He),re(Se,he)};Dt(be,Se=>{e.robot.slaves.length>0&&Se(se)})}re(ye,_e)},$$slots:{default:!0}})}),re(te,U)},$$slots:{default:!0}})}),Nt(2),We(ee),re(P,ee)};Dt(N,P=>{e.robot&&P(H)})}re(w,R)},$$slots:{default:!0}})}),re(x,b)},$$slots:{default:!0}})});var g=Le(m,2);{var v=y=>{var _=tt(),x=Ie(_);Qe(x,()=>R0,(T,b)=>{b(T,{open:!0,children:(M,E)=>{var S=tt(),w=Ie(S);Qe(w,()=>A0,(D,R)=>{R(D,{class:"max-w-md border-slate-600 bg-slate-900 text-slate-100",children:(k,N)=>{var H=R5(),P=Ie(H);Qe(P,()=>T0,(K,te)=>{te(K,{children:(O,U)=>{var W=Tl(),j=Ie(W);Qe(j,()=>E0,(de,ye)=>{ye(de,{class:"flex items-center gap-2 text-slate-100",children:(we,_e)=>{var Re=M5();Nt(),re(we,Re)},$$slots:{default:!0}})});var ie=Le(j,2);Qe(ie,()=>C0,(de,ye)=>{ye(de,{class:"text-slate-400",children:(we,_e)=>{Nt();var Re=Yn("Choose which server robot to connect as a slave target");re(we,Re)},$$slots:{default:!0}})}),re(O,W)},$$slots:{default:!0}})});var ee=Le(P,2),X=qe(ee),Q=Le(qe(X),2);qr(Q,21,()=>C(i),Mo,(K,te)=>{var O=E5(),U=Dn(O),W={};En(()=>{gn(U,`${C(te).name??""} (${C(te).id??""}) - ${C(te).robot_type??""}`),W!==(W=C(te).id)&&(O.value=(O.__value=W)??"")}),re(K,O)}),We(Q),IA(Q),We(X);var Y=Le(X,2);Qe(Y,()=>PT,(K,te)=>{te(K,{children:(O,U)=>{var W=A5(),j=Le(Ie(W),2);Qe(j,()=>IT,(ie,de)=>{de(ie,{children:(ye,we)=>{Nt();var _e=T5(),Re=Le(Ie(_e)),F=Dn(Re);Nt(),En(()=>{var pe;return gn(F,`"${((pe=e.robot)==null?void 0:pe.id)??""}"`)}),re(ye,_e)},$$slots:{default:!0}})}),re(O,W)},$$slots:{default:!0}})}),We(ee);var z=Le(ee,2);Qe(z,()=>DV,(K,te)=>{te(K,{class:"flex justify-end gap-3",children:(O,U)=>{var W=Tl(),j=Ie(W);rr(j,{variant:"outline",onclick:h,children:(de,ye)=>{Nt();var we=Yn("Cancel");re(de,we)},$$slots:{default:!0}});var ie=Le(j,2);{let de=Ve(()=>!C(s));rr(ie,{onclick:d,get disabled(){return C(de)},class:"bg-purple-600 hover:bg-purple-700",children:(ye,we)=>{var _e=C5();Nt(),re(ye,_e)},$$slots:{default:!0}})}re(O,W)},$$slots:{default:!0}})}),DA(Q,()=>C(s),K=>Be(s,K)),re(k,H)},$$slots:{default:!0}})}),re(M,S)},$$slots:{default:!0}})}),re(y,_)};Dt(g,y=>{C(n)&&y(v)})}re(r,p),yt()}var I5=new Set(["$$slots","$$events","$$legacy","ref","class"]);function D5(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,I5);var i=tt(),s=Ie(i);{let o=Ve(()=>Nn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e.class));Qe(s,()=>oT,(a,l)=>{l(a,pn({"data-slot":"sheet-overlay",get class(){return C(o)}},()=>n,{get ref(){return t()},set ref(c){t(c)}}))})}re(r,i),yt()}
4814const L5=Zm({base:"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",variants:{side:{top:"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",bottom:"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",left:"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",right:"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"}},defaultVariants:{side:"right"}});var k5=new Set(["$$slots","$$events","$$legacy","ref","class","side","portalProps","children"]),U5=je('<!> <span class="sr-only">Close</span>',1),c1=je("<!> <!>",1);function kT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=ae(e,"side",3,"right"),i=Wt(e,k5);var s=tt(),o=Ie(s);Qe(o,()=>VE,(a,l)=>{l(a,pn(()=>e.portalProps,{children:(c,u)=>{var d=c1(),h=Ie(d);D5(h,{class:"bg-black/10"});var f=Le(h,2);{let p=Ve(()=>Nn(L5({side:n()}),e.class));Qe(f,()=>cT,(m,g)=>{g(m,pn({"data-slot":"sheet-content",get class(){return C(p)}},()=>i,{get ref(){return t()},set ref(v){t(v)},children:(v,y)=>{var _=c1(),x=Ie(_);zt(x,()=>e.children??jt);var T=Le(x,2);Qe(T,()=>lT,(b,M)=>{M(b,{class:"ring-offset-background focus-visible:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none",children:(E,S)=>{var w=U5(),D=Ie(w);dT(D,{class:"size-4"}),Nt(2),re(E,w)},$$slots:{default:!0}})}),re(v,_)},$$slots:{default:!0}}))})}re(c,d)},$$slots:{default:!0}}))}),re(r,s),yt()}var N5=new Set(["$$slots","$$events","$$legacy","ref","class","children"]),O5=je("<div><!></div>");function UT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,N5);var i=O5();In(i,o=>({"data-slot":"sheet-header",class:o,...n}),[()=>Nn("flex flex-col gap-1.5 p-4",e.class)]);var s=qe(i);zt(s,()=>e.children??jt),We(i),ti(i,o=>t(o),()=>t()),re(r,i),yt()}var F5=new Set(["$$slots","$$events","$$legacy","ref","class"]);function NT(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,F5);var i=tt(),s=Ie(i);{let o=Ve(()=>Nn("text-foreground font-semibold",e.class));Qe(s,()=>zE,(a,l)=>{l(a,pn({"data-slot":"sheet-title",get class(){return C(o)}},()=>n,{get ref(){return t()},set ref(c){t(c)}}))})}re(r,i),yt()}const OT=aT;var B5=je('<div class="flex items-center justify-between"><div class="flex items-center gap-3"><span class="icon-[mdi--tune] size-6 text-purple-400"></span> <div><!> <p class="mt-1 text-sm text-slate-400">Direct robot joint manipulation</p></div></div></div>'),z5=je('<span class="icon-[mdi--check] mr-1 size-3"></span> OK',1),V5=je('<span class="icon-[mdi--alert] mr-1 size-3"></span> Required',1),G5=je('<span class="icon-[mdi--human-handsup] mr-1 size-3"></span> Rest Pose',1),H5=je('<span class="icon-[mdi--crosshairs-gps] mr-1 size-3"></span> Calibrate',1),W5=je('<div class="space-y-4"><div class="space-y-1 text-xs text-purple-300/70"><p>1. Position robot to match rest pose</p> <p>2. Click Calibrate when ready</p></div> <div class="flex gap-2"><!> <!></div></div>'),j5=je('<span class="icon-[mdi--refresh] mr-1 size-3"></span> Clear Calibration',1),X5=je('<div class="space-y-3"><div class="flex items-center gap-2 text-xs text-green-300"><span class="icon-[mdi--check-circle] size-3"></span> </div> <!></div>'),q5=je('<div class="space-y-4"><div class="mb-3 flex items-center gap-3"><span class="icon-[mdi--crosshairs-gps] size-5 text-purple-400"></span> <h3 class="text-lg font-medium text-slate-100">USB Robot Calibration</h3> <!></div> <!></div> <!>',1),Y5=je('<p class="py-4 text-center text-xs text-slate-500 italic">No active joints</p>'),$5=je('<span class="font-mono text-green-400"> </span>'),Z5=je('<div class="space-y-2 rounded-lg border border-slate-600 bg-slate-800/50 p-3"><div class="flex items-center justify-between"><span class="text-sm font-medium text-slate-200"> </span> <div class="flex items-center gap-2 text-xs"><span class="font-mono text-purple-400"> </span> <!></div></div> <div class="space-y-1"><input type="range" step="0.001" class="slider h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-600 svelte-5qito1"/> <div class="flex justify-between text-xs text-slate-500"><span> </span> <span> </span></div></div></div>'),J5=je('<div class="space-y-3"></div>'),K5=je(`<div class="space-y-4"><div class="mb-3 flex items-center gap-3"><span class="icon-[lucide--rotate-3d] size-5 text-purple-400"></span> <h3 class="text-lg font-medium text-slate-100">Joint Controls</h3> <!></div> <p class="text-xs text-slate-400">Each joint can be moved independently using sliders. Values show virtual position
4815								(degrees) and real position in parentheses when available.</p> <!></div>`),Q5=je("Robot controlled by: <strong> </strong><br/> Disconnect master to enable manual control.",1),eH=je('<span class="icon-[mdi--gamepad-variant] size-4"></span> <!> <!>
4815',1),tH=je('<div class="space-y-4"><div class="mb-3 flex items-center gap-3"><span class="icon-[mdi--gamepad-variant] size-5 text-purple-400"></span> <h3 class="text-lg font-medium text-slate-100">Master Control Active</h3></div> <!></div>'),nH=je('<div class="scrollbar-thin scrollbar-track-slate-700 scrollbar-thumb-slate-500 flex-1 overflow-y-auto px-4"><div class="space-y-6 py-4"><!> <!></div></div>'),iH=je("<!> <!>",1);function rH(r,e){vt(e,!0);let t=ae(e,"open",15);async function n(){if(e.robot)try{await e.robot.calibrateRobot()}catch(l){Cr.error("Calibration Failed",{description:`Failed to calibrate: ${l}`}),console.error(l)}}async function i(){if(e.robot)try{await e.robot.moveToRestPosition()}catch(l){Cr.error("Movement Failed",{description:`Failed to move to rest: ${l}`}),console.error(l)}}function s(){e.robot&&e.robot.clearCalibration()}var o=tt(),a=Ie(o);Qe(a,()=>OT,(l,c)=>{c(l,{get open(){return t()},set open(u){t(u)},children:(u,d)=>{var h=tt(),f=Ie(h);Qe(f,()=>kT,(p,m)=>{m(p,{trapFocus:!1,side:"right",class:"w-80 gap-0 border-l border-slate-600 bg-gradient-to-b from-slate-700 to-slate-800 p-0 text-white sm:w-96",children:(g,v)=>{var y=iH(),_=Ie(y);Qe(_,()=>UT,(b,M)=>{M(b,{class:"border-b border-slate-600 bg-slate-700/80 p-6 backdrop-blur-sm",children:(E,S)=>{var w=B5(),D=qe(w),R=Le(qe(D),2),k=qe(R);Qe(k,()=>NT,(N,H)=>{H(N,{class:"text-xl font-semibold text-slate-100",children:(P,ee)=>{Nt();var X=Yn("Manual Control");re(P,X)},$$slots:{default:!0}})}),Nt(2),We(R),We(D),We(w),re(E,w)},$$slots:{default:!0}})});var x=Le(_,2);{var T=b=>{var M=nH(),E=qe(M),S=qe(E);{var w=H=>{var P=q5(),ee=Ie(P),X=qe(ee),Q=Le(qe(X),4);{var Y=W=>{Na(W,{variant:"default",class:"ml-auto bg-green-600 text-xs",children:(j,ie)=>{var de=z5();Nt(),re(j,de)},$$slots:{default:!0}})},z=W=>{Na(W,{variant:"destructive",class:"ml-auto text-xs",children:(j,ie)=>{var de=V5();Nt(),re(j,de)},$$slots:{default:!0}})};Dt(Q,W=>{e.robot.isCalibrated?W(Y):W(z,-1)})}We(X);var K=Le(X,2);{var te=W=>{var j=W5(),ie=Le(qe(j),2),de=qe(ie);rr(de,{variant:"outline",size:"sm",onclick:i,class:"h-8 flex-1 border-slate-600 text-xs text-slate-200 hover:bg-slate-700",children:(we,_e)=>{var Re=G5();Nt(),re(we,Re)},$$slots:{default:!0}});var ye=Le(de,2);rr(ye,{variant:"default",size:"sm",onclick:n,class:"h-8 flex-1 bg-green-600 text-xs hover:bg-green-700",children:(we,_e)=>{var Re=H5();Nt(),re(we,Re)},$$slots:{default:!0}}),We(ie),We(j),re(W,j)},O=W=>{var j=X5(),ie=qe(j),de=Le(qe(ie));We(ie);var ye=Le(ie,2);rr(ye,{variant:"outline",size:"sm",onclick:s,class:"h-8 w-full border-slate-600 text-xs text-slate-200 hover:bg-slate-700",children:(we,_e)=>{var Re=j5();Nt(),re(we,Re)},$$slots:{default:!0}}),We(j),En(we=>gn(de,` Calibrated at ${we??""}`),[()=>{var we;return(we=e.robot.calibrationState.calibrationTime)==null?void 0:we.toLocaleTimeString()}]),re(W,j)};Dt(K,W=>{e.robot.isCalibrated?W(O,-1):W(te)})}We(ee);var U=Le(ee,2);c_(U,{class:"bg-slate-600"}),re(H,P)},D=Ve(()=>e.robot.connectedSlaves.some(H=>H.name.includes("USB")));Dt(S,H=>{C(D)&&H(w)})}var R=Le(S,2);{var k=H=>{var P=K5(),ee=qe(P),X=Le(qe(ee),4);Na(X,{variant:"default",class:"ml-auto bg-purple-600 text-xs",children:(K,te)=>{Nt();var O=Yn();En(()=>gn(O,e.robot.activeJoints.length)),re(K,O)},$$slots:{default:!0}}),We(ee);var Q=Le(ee,4);{var Y=K=>{var te=Y5();re(K,te)},z=K=>{var te=J5();qr(te,21,()=>e.robot.activeJoints,O=>O.name,(O,U)=>{const W=Ve(()=>{var A;return((A=C(U).urdfJoint.limit)==null?void 0:A.lower)!=null?C(U).urdfJoint.limit.lower*180/Math.PI:-180}),j=Ve(()=>{var A;return((A=C(U).urdfJoint.limit)==null?void 0:A.upper)!=null?C(U).urdfJoint.limit.upper*180/Math.PI:180});var ie=Z5(),de=qe(ie),ye=qe(de),we=Dn(ye,!0),_e=Le(ye,2),Re=qe(_e),F=Dn(Re),pe=Le(Re,2);{var me=A=>{var ne=$5(),ge=Dn(ne);En(ue=>gn(ge,`(${ue??""}°)`),[()=>C(U).realValue.toFixed(0)]),re(A,ne)};Dt(pe,A=>{C(U).realValue!==void 0&&A(me)})}We(_e),We(de);var be=Le(de,2),se=qe(be);Nf(se);var Se=Le(se,2),he=qe(Se),le=Dn(he),He=Le(he,2),B=Dn(He);We(Se),We(be),We(ie),En((A,ne,ge)=>{gn(we,C(U).name),gn(F,`${A??""}°`),z_(se,"min",C(W)),z_(se,"max",C(j)),LA(se,C(U).virtualValue),gn(le,`${ne??""}°`),gn(B,`${ge??""}°`)},[()=>C(U).virtualValue.toFixed(0),()=>C(W).toFixed(0),()=>C(j).toFixed(0)]),Ts("input",se,A=>{const ne=parseFloat(A.target.value);e.robot.updateJointValue(C(U).name,ne)}
4815),re(O,ie)}),We(te),re(K,te)};Dt(Q,K=>{e.robot.activeJoints.length===0?K(Y):K(z,-1)})}We(P),re(H,P)},N=H=>{var P=tH(),ee=Le(qe(P),2);Qe(ee,()=>PT,(X,Q)=>{Q(X,{class:"border-purple-500/30 bg-purple-500/10",children:(Y,z)=>{var K=eH(),te=Le(Ie(K),2);Qe(te,()=>QG,(U,W)=>{W(U,{class:"text-sm text-purple-200",children:(j,ie)=>{Nt();var de=Yn("Master Control Active");re(j,de)},$$slots:{default:!0}})});var O=Le(te,2);Qe(O,()=>IT,(U,W)=>{W(U,{class:"text-xs text-purple-300",children:(j,ie)=>{Nt();var de=Q5(),ye=Le(Ie(de)),we=Dn(ye,!0);Nt(2),En(()=>gn(we,e.robot.controlState.masterName)),re(j,de)},$$slots:{default:!0}})}),re(Y,K)},$$slots:{default:!0}})}),We(P),re(H,P)};Dt(R,H=>{e.robot.manualControlEnabled?H(k):H(N,-1)})}We(E),We(M),re(b,M)};Dt(x,b=>{e.robot&&b(T)})}re(g,y)},$$slots:{default:!0}})}),re(u,h)},$$slots:{default:!0}})}),re(r,o),yt()}nm(["input"]);function u1(r){return Object.prototype.toString.call(r)==="[object Date]"}function N0(r,e,t,n){if(typeof t=="number"||u1(t)){const i=n-t,s=(t-e)/(r.dt||1/60),o=r.opts.stiffness*i,a=r.opts.damping*s,l=(o-a)*r.inv_mass,c=(s+l)*r.dt;return Math.abs(c)<r.opts.precision&&Math.abs(i)<r.opts.precision?n:(r.settled=!1,u1(t)?new Date(t.getTime()+c):t+c)}else{if(Array.isArray(t))return t.map((i,s)=>N0(r,e[s],t[s],n[s]));if(typeof t=="object"){const i={};for(const s in t)i[s]=N0(r,e[s],t[s],n[s]);return i}else throw new Error(`Cannot spring ${typeof t} values`)}}var Ta,Aa,Ca,Ar,bo,Ra,Jl,Pa,Nd,Os,Kl,tm,FT;const T_=class T_{constructor(e,t={}){Fe(this,tm);Fe(this,Ta,Pt(.15));Fe(this,Aa,Pt(.8));Fe(this,Ca,Pt(.01));Fe(this,Ar);Fe(this,bo);Fe(this,Ra);Fe(this,Jl,0);Fe(this,Pa,1);Fe(this,Nd,0);Fe(this,Os,null);Fe(this,Kl,null);gt(this,Ar,Pt(e)),gt(this,bo,Pt(e)),typeof t.stiffness=="number"&&(J(this,Ta).v=_f(t.stiffness,0,1)),typeof t.damping=="number"&&(J(this,Aa).v=_f(t.damping,0,1)),typeof t.precision=="number"&&(J(this,Ca).v=t.precision)}static of(e,t){const n=new T_(e(),t);return z0(()=>{n.set(e())}),n}set(e,t){var i,s;if((i=J(this,Kl))==null||i.reject(new Error("Aborted")),t!=null&&t.instant||J(this,Ar).v===void 0)return(s=J(this,Os))==null||s.abort(),gt(this,Os,null),Be(J(this,Ar),Be(J(this,bo),e)),gt(this,Ra,e),Promise.resolve();t!=null&&t.preserveMomentum&&(gt(this,Pa,0),gt(this,Nd,t.preserveMomentum));var n=gt(this,Kl,CA());return n.promise.catch(jt),un(this,tm,FT).call(this,e).then(()=>{n===J(this,Kl)&&n.resolve(void 0)}),n.promise}get current(){return C(J(this,Ar))}get damping(){return C(J(this,Aa))}set damping(e){Be(J(this,Aa),_f(e,0,1))}get precision(){return C(J(this,Ca))}set precision(e){Be(J(this,Ca),e)}get stiffness(){return C(J(this,Ta))}set stiffness(e){Be(J(this,Ta),_f(e,0,1))}get target(){return C(J(this,bo))}set target(e){this.set(e)}};Ta=new WeakMap,Aa=new WeakMap,Ca=new WeakMap,Ar=new WeakMap,bo=new WeakMap,Ra=new WeakMap,Jl=new WeakMap,Pa=new WeakMap,Nd=new WeakMap,Os=new WeakMap,Kl=new WeakMap,tm=new WeakSet,FT=function(e){var n;if(Be(J(this,bo),e),(n=J(this,Ar)).v??(n.v=e),J(this,Ra)??gt(this,Ra,J(this,Ar).v),!J(this,Os)){gt(this,Jl,ls.now());var t=1e3/(J(this,Nd)*60);J(this,Os)??gt(this,Os,T1(i=>{gt(this,Pa,Math.min(J(this,Pa)+t,1));const s=Math.min(i-J(this,Jl),1e3/30),o={inv_mass:J(this,Pa),opts:{stiffness:J(this,Ta).v,damping:J(this,Aa).v,precision:J(this,Ca).v},settled:!0,dt:s*60/1e3};var a=N0(o,J(this,Ra),J(this,Ar).v,J(this,bo).v);return gt(this,Ra,J(this,Ar).v),gt(this,Jl,i),Be(J(this,Ar),a),o.settled&&gt(this,Os,null),!o.settled}))}return J(this,Os).promise};let O0=T_;function _f(r,e,t){return Math.max(e,Math.min(t,r))}function sH(r,e){vt(e,!0),Ky();const t=new O0(1);let n=Pt(!1),i=Pt(!1),s=Ve(()=>C(n)||C(i));Pn(()=>{C(s)?t.target=1.05:t.target=1}),Pn(()=>{const u=d=>{d.key==="Escape"&&C(i)&&Be(i,!1)};if(C(i))return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}});const{onPointerEnter:o,onPointerLeave:a}=CU();var l=tt(),c=Ie(l);{const u=(d,h)=>{var f=tt(),p=Ie(f);zt(p,()=>e.content,()=>({isHovered:C(n),isSelected:C(i)})),re(d,f)};Qe(c,()=>Bt.Group,(d,h)=>{h(d,{onclick:()=>{Be(i,!0),e.onClick&&e.onClick()},onpointerenter:()=>{o(),Be(n,!0)},onpointerleave:()=>{a(),Be(n,!1)},get scale(){return t.current},children:u,$$slots:{default:!0}})})}re(r,l),yt()}function oH(){return"myrobotlab"}var aH=je('<div class="flex flex-col items-center"><div class="flex items-center gap-1"><span class="icon-[mdi--lock] size-3 text-purple-400/60"></span> <span class="text-xs leading-tight font-medium text-purple-400/60 uppercase">CONTROL DISABLED</span></div> <span class="mt-0.5 text-center text-xs leading-tight text-purple-300/60">Control managed by</span> <span class="text-center text-xs leading-tight font-semibold text-purple-300/60"> </span></div>'),lH=je('<div class="flex flex-col items-center"><div class="flex items-center gap-1"><span class="icon-[mdi--tune] size-3 text-purple-400"></span> <span class="text-xs leading-tight font-semibold text-purple-400 uppercase">MANUAL</span></div> <span class="mt-0.5 text-xs leading-tight text-purple-200"> </span> <span class="text-xs leading-tight text-purple-300/80">Click to take manual control</span></div>'),cH=je('<div class="flex flex-col items-center"><div class="flex items-center gap-1"><span class="icon-[mdi--tune] size-3 text-purple-400/60"></span> <span class="text-xs leading-tight font-medium text-purple-400/60">MANUAL OFF</span></div> <span class="mt-0.5 text-xs leading-tight text-purple-300/40">Click to Configure</span> <div class="mt-2 text-purple-400/60"><span class="icon-[mdi--cog-outline] size-4"></span></div></div>'),uH=je('<div class="pointer-events-auto select-none" style="pointer-events: auto !important;"><div class="flex items-center gap-3"><button style="pointer-events: auto !important;"><!></button></div></div>'),dH=je('<span class="text-xs leading-tight text-green-300/80"> </span>'),hH=je('<span class="text-xs leading-tight text-red-300/80">
4815N/A</span>'),fH=je('<div class="flex flex-col items-center"><div class="flex items-center gap-1"><span class="icon-[mdi--speak] size-3 text-green-400"></span> <span class="text-xs leading-tight font-semibold text-green-400 uppercase">MASTER</span></div> <span class="mt-0.5 text-xs leading-tight text-green-200"> </span> <!> <div class="mt-1 h-1.5 w-1.5 animate-pulse rounded-full bg-green-400"></div></div>'),pH=je('<div class="flex flex-col items-center"><div class="flex items-center gap-1"><span class="icon-[mdi--speak] size-3 text-green-400/60"></span> <span class="text-xs leading-tight font-medium text-green-400/60">NO MASTER</span></div> <span class="mt-0.5 text-xs leading-tight text-green-300/40">Click to Connect</span> <div class="mt-2 text-green-400/60"><span class="icon-[mdi--plus-circle] size-4"></span></div></div>'),mH=je('<span class="text-green-400">→</span>'),gH=je('<span class="text-green-400/50">⇢</span>'),vH=je('<span class="text-blue-400">→</span>'),yH=je('<span class="text-blue-400/50">⇢</span>'),_H=je('<div class="mt-0.5 text-xs leading-tight text-blue-300/80"> </div> <div class="text-xs leading-tight text-blue-200"> </div>',1),xH=je('<span class="text-xs text-blue-400/60"> </span>'),bH=je('<div class="mt-1 flex flex-col items-center gap-0.5"><!> <!></div>'),wH=je('<div class="flex flex-col items-center"><div class="flex items-center gap-1"><span class="icon-[fa6-solid--ear-listen] size-3 text-blue-400"></span> <span class="text-xs leading-tight font-semibold text-blue-400 uppercase">SLAVES</span></div> <!></div>'),SH=je('<div class="flex flex-col items-center"><div class="flex items-center gap-1"><span class="icon-[fa6-solid--ear-listen] size-3 text-blue-400/60"></span> <span class="text-xs leading-tight font-medium text-blue-400/60">NO SLAVES</span></div> <span class="mt-0.5 text-xs leading-tight text-blue-300/40">Click to Connect</span> <div class="mt-2 text-blue-400/60"><span class="icon-[mdi--plus-circle] size-4"></span></div></div>'),MH=je('<div class="pointer-events-auto select-none" style="pointer-events: auto !important;"><div class="flex items-center gap-3"><button style="pointer-events: auto !important;"><!></button> <div class="font-mono text-sm text-slate-400"><!></div> <div><div class="flex flex-col items-center"><div class="flex items-center gap-1"><span class="icon-[mdi--connection] size-3 text-amber-400"></span> <span class="text-xs leading-tight font-semibold text-amber-400 uppercase">Robot</span></div> <span class="mt-0.5 text-xs leading-tight text-amber-200"> </span></div></div> <div class="font-mono text-sm text-slate-400"><!></div> <button style="pointer-events: auto !important;"><!></button></div></div>'),EH=je("<!> <!>",1),TH=je("<!> <!> <!> <!>",1);function AH(r,e){vt(e,!0);const{camera:t}=Js();let n=Pt(!1),i=Pt(!1),s=Pt(!1),o=Pt(null);const a=Ve(()=>jr.robots);function l(y,_){if(!t.current)return;const x=3,T=6,b=Math.ceil(C(a).length/x),M=Math.floor(_/x),S=(1+_%x-Math.floor(x/2))*T,w=(M-Math.floor(b/2))*T,D=12,R=8,k=Math.PI/4,N=S+Math.cos(k)*D,H=w+Math.sin(k)*D,P=new V(N,R,H),ee=new V(S,1,w),X=t.current.position.clone(),Q=Date.now(),Y=1e3;function z(){const K=Date.now()-Q,te=Math.min(K/Y,1),O=1-Math.pow(1-te,3);t.current.position.lerpVectors(X,P,O),t.current.lookAt(ee),te<1&&requestAnimationFrame(z)}z()}function c(y){console.log("Opening master modal for robot:",y.id),Be(o,y,!0),Be(n,!0)}function u(y){console.log("Opening slave modal for robot:",y.id),Be(o,y,!0),Be(i,!0)}function d(y){console.log("Opening manual control modal for robot:",y.id),Be(o,y,!0),Be(s,!0)}function h(y,_){console.log("Box clicked:",_,"for robot:",y.id),_==="master"?c(y):_==="slaves"?u(y):_==="manual"&&d(y)}V0(()=>{function y(){const _=xz["so-arm100"];if(!_)return;const x=oH();console.log("Creating robot with ID:",x,"and config:",_),jr.createRobot(x,_)}C(a).length===0&&y()});var f=TH(),p=Ie(f);qr(p,19,()=>C(a),y=>y.id,(y,_,x)=>{const T=Ve(()=>3),b=Ve(()=>6),M=Ve(()=>Math.ceil(C(a).length/C(T))),E=Ve(()=>Math.floor(C(x)/C(T))),S=Ve(()=>1+C(x)%C(T)),w=Ve(()=>(C(S)-Math.floor(C(T)/2))*C(b)),D=Ve(()=>(C(E)-Math.floor(C(M)/2))*C(b)),R=Ve(()=>
4815jr.getRobotStatus(C(_).id));var k=tt(),N=Ie(k);Qe(N,()=>Bt.Group,(H,P)=>{P(H,{get"position.x"(){return C(w)},"position.y":0,get"position.z"(){return C(D)},quaternion:[0,0,0,1],scale:[10,10,10],rotation:[-Math.PI/2,0,0],children:(ee,X)=>{sH(ee,{onClick:()=>{l(C(_),C(x)),h(C(_),"manual")},content:(Y,z)=>{let K=()=>(z==null?void 0:z()).isHovered,te=()=>(z==null?void 0:z()).isSelected;var O=EH(),U=Ie(O);qr(U,17,()=>dU(C(_).robotState.robot),Mo,(j,ie)=>{{let de=Ve(()=>K()||te()),ye=Ve(()=>K()||te()?.4:1),we=Ve(()=>K()||te()),_e=Ve(()=>K()||te()),Re=Ve(()=>K()||te());yE(j,{get robot(){return C(_).robotState.robot},get link(){return C(ie)},textScale:.2,get showName(){return C(de)},showVisual:!0,showCollision:!1,visualColor:"#333333",get visualOpacity(){return C(ye)},collisionOpacity:1,collisionColor:"#813d9c",get jointNames(){return C(we)},get joints(){return C(_e)},jointColor:"#62a0ea",jointIndicatorColor:"#f66151",nameHeight:.1,get selectedLink(){return C(_).robotState.selection.selectedLink},get selectedJoint(){return C(_).robotState.selection.selectedJoint},highlightColor:"#ffa348",get showLine(){return C(Re)},opacity:1,isInteractive:!1})}});var W=Le(U,2);Qe(W,()=>Bt.Group,(j,ie)=>{ie(j,{"position.z":.25,rotation:[Math.PI/2,0,0],scale:[.12,.12,.12],children:(de,ye)=>{BM(de,{children:(we,_e)=>{XU(we,{transform:!0,autoRender:!0,center:!0,distanceFactor:3,pointerEvents:"auto",style:`
4816								pointer-events: auto !important;
4817								image-rendering: auto;
4818								image-rendering: smooth;
4819								text-rendering: optimizeLegibility;
4820								-webkit-font-smoothing: subpixel-antialiased;
4821								-moz-osx-font-smoothing: auto;
4822								backface-visibility: hidden;
4823								transform-style: preserve-3d;
4824								will-change: transform;
4825							`,children:(Re,F)=>{var pe=tt(),me=Ie(pe);{var be=Se=>{var he=uH(),le=qe(he),He=qe(le),B=qe(He);{var A=ue=>{var ce=aH(),Ne=Le(qe(ce),4),De=Dn(Ne,!0);We(ce),En($e=>gn(De,$e),[()=>{var $e,Je;return((Je=($e=C(_).master)==null?void 0:$e.name)==null?void 0:Je.slice(0,20))||"Master"}
4825]),re(ue,ce)},ne=ue=>{var ce=lH(),Ne=Le(qe(ce),2),De=Dn(Ne);Nt(2),We(ce),En(()=>gn(De,`${C(_).activeJoints.length??""} Joints Active`)),re(ue,ce)},ge=ue=>{var ce=cH();re(ue,ce)};Dt(B,ue=>{var ce;(ce=C(R))!=null&&ce.hasActiveMaster?ue(A):C(_).manualControlEnabled?ue(ne,1):ue(ge,-1)})}We(He),We(le),We(he),En(()=>{var ue,ce;gr(He,1,da(["relative min-h-[80px] min-w-[90px] cursor-pointer rounded-lg border border-purple-500/40 bg-purple-950/20 bg-slate-900/80 px-3 py-3 backdrop-blur-sm transition-colors hover:border-purple-400/60",(ue=C(R))!=null&&ue.hasActiveMaster?"cursor-not-allowed border-dashed opacity-40":C(_).manualControlEnabled?"":"border-dashed opacity-60"])),He.disabled=(ce=C(R))==null?void 0:ce.hasActiveMaster}),Ts("mousedown",He,()=>{var ue;return!((ue=C(R))!=null&&ue.hasActiveMaster)&&h(C(_),"manual")}),Ts("click",He,()=>{var ue;return!((ue=C(R))!=null&&ue.hasActiveMaster)&&h(C(_),"manual")}),j_(1,he,()=>Gw,()=>({duration:200,start:.5})),re(Se,he)},se=Se=>{var he=MH(),le=qe(he),He=qe(le),B=qe(He);{var A=Xe=>{var Me=fH(),Ce=Le(qe(Me),2),nt=Dn(Ce,!0),ct=Le(Ce,2);{var dt=qt=>{var sn=dH(),vn=Dn(sn,!0);En(Cn=>gn(vn,Cn),[()=>{var Cn;return(Cn=C(_).master)==null?void 0:Cn.constructor.name.replace("Driver","").slice(0,30)}]),re(qt,sn)},ft=qt=>{var sn=hH();re(qt,sn)};Dt(ct,qt=>{var sn;(sn=C(_).master)!=null&&sn.constructor.name?qt(dt):qt(ft,-1)})}Nt(2),We(Me),En(qt=>gn(nt,qt),[()=>{var qt;return((qt=C(_).master)==null?void 0:qt.name.slice(0,30))||"Unknown"}]),re(Xe,Me)},ne=Xe=>{var Me=pH();re(Xe,Me)};Dt(B,Xe=>{var Me;(Me=C(R))!=null&&Me.hasActiveMaster?Xe(A):Xe(ne,-1)})}We(He);var ge=Le(He,2),ue=qe(ge);{var ce=Xe=>{var Me=mH();re(Xe,Me)},Ne=Xe=>{var Me=gH();re(Xe,Me)};Dt(ue,Xe=>{var Me;(Me=C(R))!=null&&Me.hasActiveMaster?Xe(ce):Xe(Ne,-1)})}We(ge);var De=Le(ge,2);gr(De,1,da(["min-h-[80px] min-w-[90px] rounded-lg border border-amber-500/40 bg-slate-900/80 px-3 py-3 backdrop-blur-sm"]));var $e=qe(De),Je=Le(qe($e),2),Ee=Dn(Je,!0);We($e),We(De);var Ge=Le(De,2),Ye=qe(Ge);{var it=Xe=>{var Me=vH();re(Xe,Me)},Ze=Xe=>{var Me=yH();re(Xe,Me)};Dt(Ye,Xe=>{var Me;(Me=C(R))!=null&&Me.connectedSlaves&&C(R).connectedSlaves>0?Xe(it):Xe(Ze,-1)})}We(Ge);var ht=Le(Ge,2),oe=qe(ht);{var Oe=Xe=>{var Me=wH(),Ce=Le(qe(Me),2);{var nt=ct=>{var dt=bH(),ft=qe(dt);qr(ft,17,()=>C(_).slaves.slice(0,2),Mo,(vn,Cn)=>{var On=_H(),fi=Ie(On),zi=Dn(fi,!0),Vi=Le(fi,2),pi=Dn(Vi,!0);En((Fn,Di)=>{gn(zi,Fn),gn(pi,Di)},[()=>C(Cn).name.slice(0,30)||"Slave",()=>C(Cn).constructor.name.replace("Driver","").slice(0,30)||"N/A"]),re(vn,On)});var qt=Le(ft,2);{var sn=vn=>{var Cn=xH(),On=Dn(Cn);En(()=>gn(On,`+${C(_).slaves.length-2} more`)),re(vn,Cn)};Dt(qt,vn=>{C(_).slaves.length>2&&vn(sn)})}We(dt),re(ct,dt)};Dt(Ce,ct=>{C(_).slaves.length>0&&ct(nt)})}We(Me),re(Xe,Me)},ke=Xe=>{var Me=SH();re(Xe,Me)};Dt(oe,Xe=>{var Me;(Me=C(R))!=null&&Me.connectedSlaves&&C(R).connectedSlaves>0?Xe(Oe):Xe(ke,-1)})}We(ht),We(le),We(he),En(()=>{var Xe,Me;gr(He,1,da(["relative min-h-[80px] min-w-[90px] cursor-pointer rounded-lg border border-green-500/40 bg-green-950/20 bg-slate-900/80 px-3 py-3 backdrop-blur-sm transition-colors hover:border-green-400/60",(Xe=C(R))!=null&&Xe.hasActiveMaster?"":"border-dashed opacity-60"])),gn(Ee,C(_).id),gr(ht,1,da(["relative min-h-[80px] min-w-[90px] cursor-pointer rounded-lg border border-blue-500/40 bg-blue-950/20 bg-slate-900/80 px-3 py-3 backdrop-blur-sm transition-colors hover:border-blue-400/60",(Me=C(R))!=null&&Me.connectedSlaves&&C(R).connectedSlaves>0?"":"border-dashed opacity-60"]))}),Ts("mousedown",He,()=>h(C(_),"master")),Ts("click",He,()=>h(C(_),"master")),Ts("mousedown",ht,()=>h(C(_),"slaves")),Ts("click",ht,()=>h(C(_),"slaves")),j_(1,he,()=>Gw,()=>({duration:200,start:.5})),re(Se,he)};Dt(me,Se=>{K()||te()?Se(be):Se(se,-1)})}re(Re,pe)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}})}),re(Y,O)},$$slots:{content:!0}})},$$slots:{default:!0}})}),re(y,k)});var m=Le(p,2);h5(m,{get robot(){return C(o)},get open(){return C(n)},set open(y){Be(n,y,!0)}});var g=Le(m,2);P5(g,{get robot(){return C(o)},get open(){return C(i)},set open(y){Be(i,y,!0)}});var v=Le(g,2);rH(v,{get robot(){return C(o)},get open(){return C(s)},set open(y){Be(s,y,!0)}}),re(r,f),yt()}nm(["mousedown","click"]);
4825var CH=new Set(["$$slots","$$events","$$legacy","cellColor","sectionColor","cellSize","backgroundColor","backgroundOpacity","sectionSize","plane","gridSize","followCamera","infiniteGrid","fadeDistance","fadeStrength","fadeOrigin","cellThickness","sectionThickness","side","type","axis","maxRadius","cellDividers","sectionDividers","floorColor","floorOpacity","ref","children"]),yv=je("<!> <!>",1),RH=je("<!> <!> <!>",1);function PH(r,e){vt(e,!0);let t=ae(e,"cellColor",3,"#71717A"),n=ae(e,"sectionColor",3,"#707070"),i=ae(e,"cellSize",3,1),s=ae(e,"backgroundColor",3,"#000000"),o=ae(e,"backgroundOpacity",3,0),a=ae(e,"sectionSize",3,10),l=ae(e,"plane",3,"xz"),c=ae(e,"gridSize",19,()=>[20,20]),u=ae(e,"followCamera",3,!1),d=ae(e,"infiniteGrid",3,!1),h=ae(e,"fadeDistance",3,100),f=ae(e,"fadeStrength",3,1),p=ae(e,"fadeOrigin",3,void 0),m=ae(e,"cellThickness",3,1),g=ae(e,"sectionThickness",3,2),v=ae(e,"side",3,si),y=ae(e,"type",3,"grid"),_=ae(e,"axis",3,"x"),x=ae(e,"maxRadius",3,0),T=ae(e,"cellDividers",3,6),b=ae(e,"sectionDividers",3,2),M=ae(e,"floorColor",3,"#2a2a2a"),E=ae(e,"floorOpacity",3,.3),S=ae(e,"ref",15),w=ae(e,"children",3,void 0),D=Wt(e,CH);const R=`
4826		float calculateFade(vec3 worldPos, float viewZ, vec3 fadeOrigin, float fadeDistance, float fadeStrength, float cameraNear, float cameraFar) {
4827			float dist = distance(fadeOrigin, worldPos);
4828			float fadeFactor = 1.0 - clamp(dist / fadeDistance, 0.0, 1.0);
4829			fadeFactor = pow(fadeFactor, fadeStrength);
4830			
4831			float viewDepthFade = 1.0 - clamp((viewZ - cameraNear) / (cameraFar - cameraNear), 0.0, 1.0);
4832			viewDepthFade = smoothstep(0.0, 0.3, viewDepthFade);
4833			
4834			return min(fadeFactor, viewDepthFade);
4835		}
4836	`,k=`
4837		varying vec3 localPosition;
4838		varying vec4 worldPosition;
4839		varying float vViewZ;
4840
4841		uniform vec3 worldCamProjPosition;
4842		uniform vec3 worldPlanePosition;
4843		uniform float fadeDistance;
4844		uniform bool infiniteGrid;
4845		uniform bool followCamera;
4846		uniform int coord0, coord1, coord2;
4847
4848		void main() {
4849			localPosition = vec3(position[coord0], position[coord1], position[coord2]);
4850			if (infiniteGrid) localPosition *= 1.0 + fadeDistance;
4851
4852			worldPosition = modelMatrix * vec4(localPosition, 1.0);
4853			if (followCamera) {
4854				worldPosition.xyz += (worldCamProjPosition - worldPlanePosition);
4855				localPosition = (inverse(modelMatrix) * worldPosition).xyz;
4856			}
4857
4858			vec4 mvPosition = viewMatrix * worldPosition;
4859			vViewZ = -mvPosition.z;
4860			gl_Position = projectionMatrix * mvPosition;
4861		}
4862	`,N=`
4863		#define PI 3.141592653589793
4864		
4865		varying vec3 localPosition;
4866		varying vec4 worldPosition;
4867		varying float vViewZ;
4868
4869		uniform float cellSize, sectionSize, cellThickness, sectionThickness;
4870		uniform vec3 cellColor, sectionColor, backgroundColor, fadeOrigin;
4871		uniform float backgroundOpacity, fadeDistance, fadeStrength, cameraNear, cameraFar;
4872		uniform bool infiniteGrid;
4873		uniform int coord0, coord1, coord2, gridType, lineGridCoord;
4874		uniform float circleGridMaxRadius, polarCellDividers, polarSectionDividers;
4875
4876		${R}
4877
4878		float getSquareGrid(float size, float thickness, vec3 localPos) {
4879			vec2 coord = localPos.xy / size;
4880			vec2 derivative = fwidth(coord);
4881			vec2 grid = abs(fract(coord - 0.5) - 0.5) / derivative;
4882			float line = min(grid.x, grid.y) + 1.0 - thickness;
4883			return clamp(1.0 - line, 0.0, 1.0);
4884		}
4885
4886		float getLinesGrid(float size, float thickness, vec3 localPos) {
4887			float coord = localPos[lineGridCoord] / size;
4888			float derivative = fwidth(coord);
4889			float line = abs(fract(coord - 0.5) - 0.5) / derivative - thickness * 0.5;
4890			return clamp(1.0 - line, 0.0, 1.0);
4891		}
4892
4893		float getCirclesGrid(float size, float thickness, vec3 localPos) {
4894			float coord = length(localPos.xy) / size;
4895			float derivative = fwidth(coord);
4896			float line = abs(fract(coord - 0.5) - 0.5) / derivative - thickness * 0.5;
4897			if (!infiniteGrid && circleGridMaxRadius > 0.0 && coord > circleGridMaxRadius + thickness * 0.1) discard;
4898			return clamp(1.0 - line, 0.0, 1.0);
4899		}
4900
4901		float getPolarGrid(float size, float thickness, float polarDividers, vec3 localPos) {
4902			float rad = length(localPos.xy) / size;
4903			vec2 coord = vec2(rad, atan(localPos.x, localPos.y) * polarDividers / PI);
4904			vec2 derivative = fwidth(coord);
4905			vec2 grid = abs(fract(coord - 0.5) - 0.5) / derivative;
4906			float line = min(grid.x, grid.y) + 1.0 - thickness;
4907			if (!infiniteGrid && circleGridMaxRadius > 0.0 && rad > circleGridMaxRadius + thickness * 0.1) discard;
4908			return clamp(1.0 - line, 0.0, 1.0);
4909		}
4910
4911		void main() {
4912			float g1 = 0.0, g2 = 0.0;
4913			vec3 localPos = vec3(localPosition[coord0], localPosition[coord1], localPosition[coord2]);
4914
4915			if (gridType == 0) {
4916				g1 = getSquareGrid(cellSize, cellThickness, localPos);
4917				g2 = getSquareGrid(sectionSize, sectionThickness, localPos);
4918			} else if (gridType == 1) {
4919				g1 = getLinesGrid(cellSize, cellThickness, localPos);
4920				g2 = getLinesGrid(sectionSize, sectionThickness, localPos);
4921			} else if (gridType == 2) {
4922				g1 = getCirclesGrid(cellSize, cellThickness, localPos);
4923				g2 = getCirclesGrid(sectionSize, sectionThickness, localPos);
4924			} else if (gridType == 3) {
4925				g1 = getPolarGrid(cellSize, cellThickness, polarCellDividers, localPos);
4926				g2 = getPolarGrid(sectionSize, sectionThickness, polarSectionDividers, localPos);
4927			}
4928
4929			float fadeFactor = calculateFade(worldPosition.xyz, vViewZ, fadeOrigin, fadeDistance, fadeStrength, cameraNear, cameraFar);
4930			vec3 color = mix(cellColor, sectionColor, clamp(sectionThickness * g2, 0.0, 1.0));
4931			float gridAlpha = clamp((g1 + g2) * fadeFactor, 0.0, 1.0);
4932
4933			if (backgroundOpacity > 0.0) {
4934				vec3 finalColor = mix(backgroundColor, color, gridAlpha);
4935				float blendedAlpha = clamp(max(gridAlpha, backgroundOpacity * fadeFactor), 0.0, 1.0);
4936				gl_FragColor = vec4(finalColor, blendedAlpha);
4937			} else {
4938				gl_FragColor = vec4(color, gridAlpha);
4939			}
4940
4941			if (gl_FragColor.a < 0.05) discard;
4942
4943			#include <tonemapping_fragment>
4944			#include <${cU<154?"encodings_fragment":"colorspace_fragment"}>
4945		}
4946	`,H=`
4947		varying vec3 vWorldPosition;
4948		varying float vViewZ;
4949		
4950		void main() {
4951			vec4 worldPosition = modelMatrix * vec4(position, 1.0);
4952			vWorldPosition = worldPosition.xyz;
4953			vec4 mvPosition = viewMatrix * worldPosition;
4954			vViewZ = -mvPosition.z;
4955			gl_Position = projectionMatrix * mvPosition;
4956		}
4957	`,P=`
4958		uniform vec3 floorColor, fadeOrigin;
4959		uniform float floorOpacity, fadeDistance, fadeStrength, cameraNear, cameraFar;
4960		varying vec3 vWorldPosition;
4961		varying float vViewZ;
4962		
4963		${R}
4964		
4965		void main() {
4966			float fadeFactor = calculateFade(vWorldPosition, vViewZ, fadeOrigin, fadeDistance, fadeStrength, cameraNear, cameraFar);
4967			float finalOpacity = floorOpacity * fadeFactor;
4968			gl_FragColor = vec4(floorColor, finalOpacity);
4969			if (gl_FragColor.a < 0.01) discard;
4970		}
4971	`,ee=new fn,{invalidate:X,camera:Q}=Js(),Y=new as,z=new V(0,1,0),K=new V(0,0,0),te={x:0,y:1,z:2},O={xz:"xzy",xy:"xyz",zy:"zyx"},U={grid:0},W={fadeOrigin:{value:new V},fadeDistance:{value:h()},fadeStrength:{value:f()},cameraNear:{value:.1},cameraFar:{value:1e3}},j={...W,cellSize:{value:i()},sectionSize:{value:a()},cellColor:{value:new st(t())},sectionColor:{value:new st(n())},backgroundColor:{value:new st(s())},backgroundOpacity:{value:o()},cellThickness:{value:m()},sectionThickness:{value:g()},infiniteGrid:{value:d()},followCamera:{value:u()},coord0:{value:0},coord1:{value:2},coord2:{value:1},gridType:{value:U.grid},lineGridCoord:{value:te[_()]||0},circleGridMaxRadius:{value:x()},polarCellDividers:{value:T()},polarSectionDividers:{value:b()},worldCamProjPosition:{value:new V},worldPlanePosition:{value:new V}},ie={...W,floorColor:{value:new st(M())},floorOpacity:{value:E()}};Un(()=>{const Re=O[l()]||"xzy",[F,pe,me]=[Re.charAt(0),Re.charAt(1),Re.charAt(2)].map(se=>te[se]);if(Object.assign(j,{coord0:{value:F},coord1:{value:pe},coord2:{value:me},cellSize:{value:i()},sectionSize:{value:a()},cellThickness:{value:m()},sectionThickness:{value:g()},backgroundOpacity:{value:o()},infiniteGrid:{value:d()},followCamera:{value:u()}}),j.cellColor.value.set(t()),j.sectionColor.value.set(n()),j.backgroundColor.value.set(s()),W.fadeDistance.value=h(),W.fadeStrength.value=f(),ie.floorColor.value.set(M()),ie.floorOpacity.value=E(),Q.current&&"near"in Q.current&&"far"in Q.current){const se=Q.current;W.cameraNear.value=se.near,W.cameraFar.value=se.far}const be={grid:0,lines:1,circular:2,polar:3};j.gridType.value=be[y()]||0,y()==="lines"&&(j.lineGridCoord.value=te[_()]||0),(y()==="circular"||y()==="polar")&&(j.circleGridMaxRadius.value=x(),y()==="polar"&&(j.polarCellDividers.value=T(),j.polarSectionDividers.value=b())),X()}),Jd(()=>{Y.setFromNormalAndCoplanarPoint(z,K).applyMatrix4(ee.matrixWorld);const Re=ee.material;if(Re!=null&&Re.uniforms){const{worldCamProjPosition:F,worldPlanePosition:pe}=Re.uniforms,me=Y.projectPoint(Q.current.position,F.value);p()||(W.fadeOrigin.value=me),pe.value.set(0,0,0).applyMatrix4(ee.matrixWorld)}},{autoInvalidate:!1});var de=RH(),ye=Ie(de);Qe(ye,()=>Bt.Mesh,(Re,F)=>{F(Re,pn({rotation:[-Math.PI/2,0,0],receiveShadow:!0,"position.y":0},()=>D,{children:(pe,me)=>{var be=yv(),se=Ie(be);{let he=Ve(()=>d()?[1e3,1e3]:typeof c()=="number"?[c(),c()]:c());Qe(se,()=>Bt.PlaneGeometry,(le,He)=>{He(le,{get args(){return C(he)}})})}var Se=Le(se,2);Qe(Se,()=>Bt.ShadowMaterial,(he,le)=>{le(he,{transparent:!0,opacity:.3,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1})}),re(pe,be)},$$slots:{default:!0}}
4971))});var we=Le(ye,2);Qe(we,()=>Bt.Mesh,(Re,F)=>{F(Re,pn({rotation:[-Math.PI/2,0,0],"position.y":0},()=>D,{children:(pe,me)=>{var be=yv(),se=Ie(be);{let he=Ve(()=>d()?[1e3,1e3]:typeof c()=="number"?[c(),c()]:c());Qe(se,()=>Bt.PlaneGeometry,(le,He)=>{He(le,{get args(){return C(he)}})})}var Se=Le(se,2);Qe(Se,()=>Bt.ShaderMaterial,(he,le)=>{le(he,{vertexShader:H,fragmentShader:P,get uniforms(){return ie},transparent:!0,get side(){return si},depthTest:!0,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1})}),re(pe,be)},$$slots:{default:!0}}))});var _e=Le(we,2);Bt(_e,pn({get is(){return ee},frustumCulled:!1,"position.y":.005},()=>D,{get ref(){return S()},set ref(Re){S(Re)},children:(Re,F)=>{var pe=yv(),me=Ie(pe);Qe(me,()=>Bt.ShaderMaterial,(he,le)=>{le(he,{get fragmentShader(){return N},vertexShader:k,get uniforms(){return j},transparent:!0,get side(){return v()},depthTest:!0,depthWrite:!1})});var be=Le(me,2);{var se=he=>{var le=tt(),He=Ie(le);zt(He,w,()=>({ref:ee})),re(he,le)},Se=he=>{var le=tt(),He=Ie(le);{let B=Ve(()=>typeof c()=="number"?[c(),c()]:c());Qe(He,()=>Bt.PlaneGeometry,(A,ne)=>{ne(A,{get args(){return C(B)}})})}re(he,le)};Dt(be,he=>{w()?he(se):he(Se,-1)})}re(Re,pe)},$$slots:{default:!0}})),re(r,de),yt()}function IH(r,e){vt(e,!0),ae(e,"open",15),yt()}var DH=je("<span></span> Settings",1);function LH(r,e){vt(e,!0);let t=ae(e,"open",15,!1);rr(r,{variant:"default",size:"sm",onclick:()=>t(!t()),class:"group w-32 border-0 bg-orange-600 text-white transition-all duration-200 hover:bg-orange-500",children:(n,i)=>{var s=DH(),o=Ie(s);gr(o,1,da(["mr-2 size-4 transition-transform duration-200","icon-[mdi--cog] group-hover:rotate-90"])),Nt(),re(n,s)},$$slots:{default:!0}}),yt()}var kH=new Set(["$$slots","$$events","$$legacy","ref","class","checked"]);function d1(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=ae(e,"checked",15,!1),i=Wt(e,kH);var s=tt(),o=Ie(s);{let a=Ve(()=>Nn("data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e.class));Qe(o,()=>EV,(l,c)=>{c(l,pn({"data-slot":"switch",get class(){return C(a)}},()=>i,{get ref(){return t()},set ref(u){t(u)},get checked(){return n()},set checked(u){n(u)},children:(u,d)=>{var h=tt(),f=Ie(h);{let p=Ve(()=>Nn("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"));Qe(f,()=>CV,(m,g)=>{g(m,{"data-slot":"switch-thumb",get class(){return C(p)}})})}re(u,h)},$$slots:{default:!0}}))})}re(r,s),yt()}var UH=new Set(["$$slots","$$events","$$legacy","ref","class"]);function xf(r,e){vt(e,!0);let t=ae(e,"ref",15,null),n=Wt(e,UH);var i=tt(),s=Ie(i);{let o=Ve(()=>Nn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e.class));Qe(s,()=>xV,(a,l)=>{l(a,pn({"data-slot":"label",get class(){return C(o)}},()=>n,{get ref(){return t()},set ref(c){t(c)}}))})}re(r,i),yt()}var NH=je('<div class="flex items-center justify-between"><div class="flex items-center gap-3"><span class="icon-[mdi--cog] size-6 text-orange-400"></span> <div><!> <p class="mt-1 text-sm text-slate-400">Configure application preferences</p></div></div></div>'),OH=je('<!> <div class="scrollbar-thin scrollbar-track-slate-700 scrollbar-thumb-slate-500 flex-1 overflow-y-auto px-4"><div class="space-y-6 py-4"><div class="space-y-4"><div class="mb-3 flex items-center gap-3"><span class="icon-[mdi--tune] size-5 text-orange-400"></span> <h3 class="text-lg font-medium text-slate-100">Application Settings</h3></div> <div class="space-y-4"><div class="flex items-center justify-between"><div class="space-y-1"><!> <p class="text-xs text-slate-400">Use dark theme for the interface</p></div> <!></div> <div class="flex items-center justify-between"><div class="space-y-1"><!> <p class="text-xs text-slate-400">Display frame rate counter</p></div> <!></div> <div class="space-y-3"><div class="space-y-1"><!> <p class="text-xs text-slate-400"> </p></div> <input type="range" min="25" max="100" step="5" class="slider h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-600 svelte-1xyy0ob"/> <div class="flex justify-between text-xs text-slate-500"><span>25%</span> <span>100%</span></div></div> <div class="space-y-3"><div class="space-y-1"><!> <p class="text-xs text-slate-400"> </p></div> <input type="range" min="0.1" max="3" step="0.1" class="slider h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-600 svelte-1xyy0ob"/> <div class="flex justify-between text-xs text-slate-500"><span>0.1x</span> <span>3x</span></div></div></div></div> <!> <div class="space-y-4"><div class="mb-3 flex items-center gap-3"><span class="icon-[mdi--information-outline] size-5 text-blue-400"></span> <h3 class="text-lg font-medium text-slate-100">About</h3></div> <div class="space-y-4"><div class="space-y-2"><h4 class="text-sm font-medium text-slate-200">Acknowledgements</h4> <p class="text-xs leading-relaxed text-slate-400">This application is built with amazing open-source technologies and communities.</p></div> <div class="space-y-3"><a href="https://github.com/huggingface/lerobot" target="_blank" rel="noopener noreferrer" class="flex items-center gap-3 rounded-lg border border-slate-600 bg-slate-800/50 p-3 transition-colors duration-200 hover:bg-slate-700/50"><span class="icon-[mdi--robot] size-5 text-yellow-400"></span> <div class="flex-1"><div class="text-sm font-medium text-slate-200">Hugging Face LeRobot</div> <p class="text-xs text-slate-400">Robotics AI framework and models</p></div></a> <a href="https://threlte.xyz" target="_blank" rel="noopener noreferrer" class="flex items-center gap-3 rounded-lg border border-slate-600 bg-slate-800/50 p-3 transition-colors duration-200 hover:bg-slate-700/50"><span class="icon-[mdi--cube-outline] size-5 text-orange-400"></span> <div class="flex-1"><div class="text-sm font-medium text-slate-200">Threlte</div> <p class="text-xs text-slate-400">3D graphics library for Svelte</p></div></a> <a href="https://bambot.org" target="_blank" rel="noopener noreferrer" class="flex items-center gap-3 rounded-lg border border-slate-600 bg-slate-800/50 p-3 transition-colors duration-200 hover:bg-slate-700/50"><span class="icon-[mdi--memory] size-5 text-green-400"></span> <div class="flex-1"><div class="text-sm font-medium text-slate-200">bambot.org feetech.js</div> <p class="text-xs text-slate-400">Servo motor control library</p></div></a> <a href="https://github.com/brean/urdf-viewer" target="_blank" rel="noopener noreferrer" class="flex items-center gap-3 rounded-lg border border-slate-600 bg-slate-800/50 p-3 transition-colors duration-200 hover:bg-slate-700/50"><span class="icon-[mdi--cube-outline] size-5 text-orange-400"></span> <div class="flex-1"><div class="text-sm font-medium text-slate-200">URDF Viewer</div> <p class="text-xs text-slate-400">
4971Nice component for viewing URDF models with Threlte</p></div></a></div></div></div></div></div>',1);function FH(r,e){vt(e,!0);let t=ae(e,"open",15,!1),n=mr({darkMode:!0,showFPS:!1,renderQuality:75,animationSpeed:1});var i=tt(),s=Ie(i);Qe(s,()=>OT,(o,a)=>{a(o,{get open(){return t()},set open(l){t(l)},children:(l,c)=>{var u=tt(),d=Ie(u);Qe(d,()=>kT,(h,f)=>{f(h,{side:"left",class:"w-80 gap-0 border-r border-slate-600 bg-gradient-to-b from-slate-700 to-slate-800 p-0 text-white sm:w-96",children:(p,m)=>{var g=OH(),v=Ie(g);Qe(v,()=>UT,(j,ie)=>{ie(j,{class:"border-b border-slate-600 bg-slate-700/80 p-6 backdrop-blur-sm",children:(de,ye)=>{var we=NH(),_e=qe(we),Re=Le(qe(_e),2),F=qe(Re);Qe(F,()=>NT,(pe,me)=>{me(pe,{class:"text-xl font-semibold text-slate-100",children:(be,se)=>{Nt();var Se=Yn("Robot Settings");re(be,Se)},$$slots:{default:!0}})}),Nt(2),We(Re),We(_e),We(we),re(de,we)},$$slots:{default:!0}})});var y=Le(v,2),_=qe(y),x=qe(_),T=Le(qe(x),2),b=qe(T),M=qe(b),E=qe(M);xf(E,{class:"text-sm font-medium text-slate-200",children:(j,ie)=>{Nt();var de=Yn("Dark Mode");re(j,de)},$$slots:{default:!0}}),Nt(2),We(M);var S=Le(M,2);d1(S,{get checked(){return n.darkMode},set checked(j){n.darkMode=j}}),We(b);var w=Le(b,2),D=qe(w),R=qe(D);xf(R,{class:"text-sm font-medium text-slate-200",children:(j,ie)=>{Nt();var de=Yn("Show FPS");re(j,de)},$$slots:{default:!0}}),Nt(2),We(D);var k=Le(D,2);d1(k,{get checked(){return n.showFPS},set checked(j){n.showFPS=j}}),We(w);var N=Le(w,2),H=qe(N),P=qe(H);xf(P,{class:"text-sm font-medium text-slate-200",children:(j,ie)=>{Nt();var de=Yn("Render Quality");re(j,de)},$$slots:{default:!0}});var ee=Le(P,2),X=Dn(ee);We(H);var Q=Le(H,2);Nf(Q),Nt(2),We(N);var Y=Le(N,2),z=qe(Y),K=qe(z);xf(K,{class:"text-sm font-medium text-slate-200",children:(j,ie)=>{Nt();var de=Yn("Animation Speed");re(j,de)},$$slots:{default:!0}});var te=Le(K,2),O=Dn(te);We(z);var U=Le(z,2);Nf(U),Nt(2),We(Y),We(T),We(x);var W=Le(x,2);c_(W,{class:"bg-slate-600"}),Nt(2),We(_),We(y),En(()=>{gn(X,`Adjust 3D rendering quality (${n.renderQuality??""}%)`),gn(O,`Robot movement animation speed (${n.animationSpeed??""}x)`)}),Of(Q,()=>n.renderQuality,j=>n.renderQuality=j),Of(U,()=>n.animationSpeed,j=>n.animationSpeed=j),re(p,g)},$$slots:{default:!0}})}),re(l,u)},$$slots:{default:!0}})}),re(r,i),yt()}var BH=je('<div class="fixed top-4 left-4 z-50 flex gap-2"><div class="flex items-center justify-center gap-2 overflow-hidden rounded-lg shadow-lg"><div class="flex items-center justify-center"><img src="/favicon_1024.png" alt="Logo" draggable="false" class="h-10 w-10 invert"/></div> <div class="flex items-center justify-center"><!></div></div></div> <div class="fixed top-4 right-4 z-50"><!></div> <!>',1);function zH(r,e){vt(e,!0);let t=ae(e,"addRobotDropdownMenuOpen",15,!1),n=ae(e,"settingsOpen",15,!1);var i=BH(),s=Ie(i),o=qe(s),a=Le(qe(o),2),l=qe(a);IH(l,{get open(){return t()},set open(h){t(h)}}),We(a),We(o),We(s);var c=Le(s,2),u=qe(c);LH(u,{get open(){return n()},set open(h){n(h)}}),We(c);var d=Le(c,2);FH(d,{get open(){return n()},set open(h){n(h)}}),re(r,i),yt()}var VH=je('<div class="telemetry-bar svelte-uoctuf"><div class="stat svelte-uoctuf"><span class="dot green svelte-uoctuf"></span> <span class="label">FPS:</span> <strong class="svelte-uoctuf"> </strong></div> <div class="stat svelte-uoctuf"><span class="dot blue svelte-uoctuf"></span> <span class="label">PING:</span> <strong class="svelte-uoctuf"> </strong></div> <div class="stat svelte-uoctuf"><span class="label">RES:</span> <strong class="svelte-uoctuf">480p</strong></div></div>'),GH=je('<div class="placeholder svelte-uoctuf"><div class="icon">🛰️</div> <p>No active data transmissions in room.</p></div>'),HH=je('<div class="camera-panel svelte-uoctuf"><div class="header svelte-uoctuf"><h3 class="svelte-uoctuf">📷 Remote Camera Rig</h3> <span> </span></div> <!> <div class="viewport svelte-uoctuf"><video autoplay="" playsinline=""></video> <img alt="Cloud Stream Feed"/> <!></div>
4971 <canvas id="telemetry-capture-canvas" width="480" height="360" class="hidden-canvas svelte-uoctuf"></canvas> <button> </button></div>',2);function WH(r,e){vt(e,!0);let t=Pt(!1),n=Pt(!1),i=Pt("Checking Feed..."),s=Pt(0),o=Pt(0),a=0,l=Date.now(),c=null,u=null,d=null,h=null,f=null,p=null,m=null;const g="myrobotlab";V0(()=>{v()});function v(){if(typeof window>"u")return;const U=window.location.protocol==="https:"?"wss:":"ws:",W=window.location.host,j=`${U}//${W}/ws/video/${g}`;f=new WebSocket(j),f.binaryType="blob",f.onopen=()=>{C(t)||Be(i,"Monitoring Cloud Feed")},f.onmessage=ie=>{ie.data instanceof Blob&&(Be(n,!0),Be(i,"Live Feed Incoming"),y(),m&&URL.revokeObjectURL(m),m=URL.createObjectURL(ie.data),u&&(u.src=m))},f.onerror=()=>{Be(i,"Bridge Error")},f.onclose=()=>{Be(n,!1)}}function y(){a++;const U=Date.now();U-l>=1e3&&(Be(s,Math.round(a*1e3/(U-l)),!0),a=0,l=U,Be(o,Math.floor(Math.random()*20)+35))}async function _(){Be(i,"Provisioning Camera...");try{h=await navigator.mediaDevices.getUserMedia({video:{width:480,height:360,frameRate:{ideal:24}},audio:!1}),c&&(c.srcObject=h),Be(t,!0),Be(n,!1),Be(i,"Broadcasting Live"),x()}catch{Be(i,"Hardware Access Error"),T()}}function x(){if(!d||!c)return;const U=d.getContext("2d");U&&(p=window.setInterval(()=>{!c||!d||!U||!f||f.readyState!==WebSocket.OPEN||(U.drawImage(c,0,0,d.width,d.height),d.toBlob(W=>{W&&f&&f.readyState===WebSocket.OPEN&&C(t)&&(f.send(W),y())},"image/jpeg",.55))},41))}function T(){Be(t,!1),p&&clearInterval(p),h&&(h.getTracks().forEach(U=>U.stop()),h=null),c&&(c.srcObject=null),Be(i,"Monitoring Cloud Feed")}function b(){C(t)?T():_()}M1(()=>{p&&clearInterval(p),f&&f.close(),m&&URL.revokeObjectURL(m),h&&h.getTracks().forEach(U=>U.stop())});var M=HH(),E=qe(M),S=Le(qe(E),2);let w;var D=Dn(S,!0);We(E);var R=Le(E,2);{var k=U=>{var W=VH(),j=qe(W),ie=Le(qe(j),4),de=Dn(ie,!0);We(j);var ye=Le(j,2),we=Le(qe(ye),4),_e=Dn(we);We(ye),Nt(2),We(W),En(()=>{gn(de,C(s)),gn(_e,`${C(o)??""}ms`)}),re(U,W)};Dt(R,U=>{(C(t)||C(n))&&U(k)})}var N=Le(R,2),H=qe(N);let P;ti(H,U=>c=U,()=>c);var ee=Le(H,2);let X;ti(ee,U=>u=U,()=>u);var Q=Le(ee,2);{var Y=U=>{var W=GH();re(U,W)};Dt(Q,U=>{!C(t)&&!C(n)&&U(Y)})}We(N);var z=Le(N,2);ti(z,U=>d=U,()=>d);var K=Le(z,2);let te;var O=Dn(K,!0);We(M),En(()=>{w=gr(S,1,"badge svelte-uoctuf",null,w,{active:C(t)||C(n)}),gn(D,C(i)),P=gr(H,1,"svelte-uoctuf",null,P,{hidden:!C(t)}),X=gr(ee,1,"svelte-uoctuf",null,X,{hidden:C(t)||!C(n)}),te=gr(K,1,"action-btn svelte-uoctuf",null,te,{"stop-btn":C(t)}),gn(O,C(t)?"🛑 Stop Broadcasting Video":"🚀 Broadcast My Local View")}),Ts("click",K,b),re(r,M),yt()}nm(["click"]);var jH=je("<!> <!> <!> <!> <!> <!>",1),XH=je('<div class="fixed inset-0 -z-20 h-[100dvh] w-screen bg-[#1a1a1a] svelte-1uha8ag"><!></div> <div class="absolute left-6 top-6 z-30 flex flex-col gap-4 pointer-events-none max-w-sm w-full svelte-1uha8ag"><div class="pointer-events-auto recorder-panel svelte-1uha8ag"><div class="flex justify-between items-center mb-3 svelte-1uha8ag"><h4 class="text-xs font-bold uppercase tracking-wider text-zinc-400 svelte-1uha8ag">AI Synced Recorder</h4> <span><!></span></div> <div class="naming-row mb-3 svelte-1uha8ag"><label for="dataset-name-field" class="input-lbl svelte-1uha8ag">Target Hub Repository Name</label> <div class="input-container svelte-1uha8ag"><span class="prefix svelte-1uha8ag">abbas-mesolitica /</span> <input id="dataset-name-field" type="text" placeholder="example_dataset" class="name-input svelte-1uha8ag"/></div></div> <div class="stats-row mb-4 svelte-1uha8ag"><div class="stat-box svelte-1uha8ag"><span class="lbl svelte-1uha8ag">Pairs Logged (Img+Joint)</span> <span class="val font-mono text-emerald-400 svelte-1uha8ag"> </span></div> <div class="stat-box svelte-1uha8ag"><span class="lbl svelte-1uha8ag">Sessions Uploaded</span> <span class="val font-mono svelte-1uha8ag"> </span></div></div> <button><!></button></div> <div class="pointer-events-auto svelte-1uha8ag"><!></div></div> <!>',1);function sW(r,e){vt(e,!0);let t=Pt(!1),n=Pt(!1),i=Pt(mr([])),s=Pt(0),o=Pt("example_dataset");async function a(){if(C(i).length===0)return;Be(n,!0);const O=Date.now().toString();try{const U=await fetch("/api/upload_episode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({robot_id:"myrobotlab",episode_id:O,dataset_name:C(o),data:C(i)})});if(U.ok){const W=await U.json();RA(s),alert(`🚀 Demonstration saved directly to Hugging Face Dataset repo:
4972${W.repo_id}`)}else{const W=await U.text();alert(`Cloud synchronization failed: ${W}`)}}catch(U){console.error("Network error hitting backend API link:",U),alert("Could not communicate with cloud server api endpoint.")}finally{Be(n,!1)}}function l(){C(t)?(Be(t,!1),a()):(Be(i,[],!0),Be(t,!0))}V0(()=>
4972{if(typeof window>"u")return;const O=window.WebSocket.prototype.send;window.WebSocket.prototype.send=function(U){if(C(t)&&typeof U=="string")try{const W=JSON.parse(U);if(W.type==="execute_command"||W.type==="command"){let j=null;const ie=document.getElementById("telemetry-capture-canvas");ie&&(j=ie.toDataURL("image/jpeg",.5)),C(i).push({timestamp:Date.now(),observation:{image:j},action:W.data})}}catch{}return O.apply(this,arguments)}});var c=XH(),u=Ie(c),d=qe(u);Ok(d,{shadows:!0,children:(O,U)=>{var W=tt(),j=Ie(W);{let ie=Ve(()=>new st("black"));Qe(j,()=>Bt.Scene,(de,ye)=>{ye(de,{get background(){return C(ie)},children:(we,_e)=>{var Re=jH(),F=Ie(Re);Qe(F,()=>Bt.PerspectiveCamera,(he,le)=>{le(he,{"position.x":-10,"position.y":10,"position.z":10,fov:20,makeDefault:!0,children:(He,B)=>{JN(He,{enableDamping:!0,target:[0,1,0],dampingFactor:.05,minDistance:10,maxDistance:30,minPolarAngle:Math.PI/6,maxPolarAngle:Math.PI/2,enableZoom:!0,children:(A,ne)=>{$N(A,{})},$$slots:{default:!0}})},$$slots:{default:!0}})});var pe=Le(F,2);Qe(pe,()=>Bt.AmbientLight,(he,le)=>{le(he,{intensity:.4})});var me=Le(pe,2);Qe(me,()=>Bt.DirectionalLight,(he,le)=>{le(he,{position:[2,20,5],intensity:1,castShadow:!0})});var be=Le(me,2);Qe(be,()=>Bt.DirectionalLight,(he,le)=>{le(he,{position:[-2,20,-5],intensity:1,castShadow:!0})});var se=Le(be,2);PH(se,{"position.y":0,type:"grid",sectionThickness:1,infiniteGrid:!0,cellColor:"#71717A",sectionColor:"#707070",sectionSize:10,cellSize:1,floorColor:"#1a1a1a",floorOpacity:0,fadeDistance:40,fadeStrength:1});var Se=Le(se,2);AH(Se,{}),re(we,Re)},$$slots:{default:!0}})})}re(O,W)},$$slots:{default:!0}}),We(u);var h=Le(u,2),f=qe(h),p=qe(f),m=Le(qe(p),2);let g;var v=qe(m);{var y=O=>{var U=Yn("⚡ UPLOADING...");re(O,U)},_=O=>{var U=Yn("● REC LIVE");re(O,U)},x=O=>{var U=Yn("STANDBY");re(O,U)};Dt(v,O=>{C(n)?O(y):C(t)?O(_,1):O(x,-1)})}We(m),We(p);var T=Le(p,2),b=Le(qe(T),2),M=Le(qe(b),2);Nf(M),We(b),We(T);var E=Le(T,2),S=qe(E),w=Le(qe(S),2),D=Dn(w,!0);We(S);var R=Le(S,2),k=Le(qe(R),2),N=Dn(k,!0);We(R),We(E);var H=Le(E,2);let P;var ee=qe(H);{var X=O=>{var U=Yn("📤 Syncing to Hub Repository...");re(O,U)},Q=O=>{var U=Yn("🛑 Stop & Commit to Cloud");re(O,U)},Y=O=>{var U=Yn("🔴 Start Multimodal Capture");re(O,U)};Dt(ee,O=>{C(n)?O(X):C(t)?O(Q,1):O(Y,-1)})}We(H),We(f);var z=Le(f,2),K=qe(z);WH(K,{}),We(z),We(h);var te=Le(h,2);zH(te,{}),En(()=>{g=gr(m,1,"indicator svelte-1uha8ag",null,g,{recording:C(t),uploading:C(n)}),M.disabled=C(t)||C(n),gn(D,C(i).length),gn(N,C(s)),P=gr(H,1,"rec-btn svelte-1uha8ag",null,P,{active:C(t)}),H.disabled=C(n)}),Of(M,()=>C(o),O=>Be(o,O)),Ts("click",H,l),re(r,c),yt()}nm(["click"]);export{sW as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.