From 25e3588e470dadf57cbf755ce3a6dfbe7922049a Mon Sep 17 00:00:00 2001 From: davidferlay Date: Sun, 23 Feb 2025 23:43:57 +0000 Subject: [PATCH] deploy: 913bc41533a43576026bb17c3f6ec53be5a915ff --- assets/index-C6G_3qQV.css | 1 - assets/index-CGKpM3LH.css | 1 + .../{index-BGGMskAw.js => index-DV3GE1d6.js} | 364 +++++++++--------- index.html | 4 +- 4 files changed, 187 insertions(+), 183 deletions(-) delete mode 100644 assets/index-C6G_3qQV.css create mode 100644 assets/index-CGKpM3LH.css rename assets/{index-BGGMskAw.js => index-DV3GE1d6.js} (57%) diff --git a/assets/index-C6G_3qQV.css b/assets/index-C6G_3qQV.css deleted file mode 100644 index 1ded670..0000000 --- a/assets/index-C6G_3qQV.css +++ /dev/null @@ -1 +0,0 @@ -@tailwind base;@tailwind components;@tailwind utilities; diff --git a/assets/index-CGKpM3LH.css b/assets/index-CGKpM3LH.css new file mode 100644 index 0000000..ed59633 --- /dev/null +++ b/assets/index-CGKpM3LH.css @@ -0,0 +1 @@ +.faq-collapse-enter-active[data-v-585f6811],.faq-collapse-leave-active[data-v-585f6811]{transition:max-height .3s ease,opacity .3s ease,padding .3s ease}.faq-collapse-enter-from[data-v-585f6811],.faq-collapse-leave-to[data-v-585f6811]{max-height:0;opacity:0;padding-top:0;padding-bottom:0}.faq-collapse-enter-to[data-v-585f6811],.faq-collapse-leave-from[data-v-585f6811]{max-height:200px;opacity:1}@tailwind base;@tailwind components;@tailwind utilities; diff --git a/assets/index-BGGMskAw.js b/assets/index-DV3GE1d6.js similarity index 57% rename from assets/index-BGGMskAw.js rename to assets/index-DV3GE1d6.js index c8663df..a5938f4 100644 --- a/assets/index-BGGMskAw.js +++ b/assets/index-DV3GE1d6.js @@ -2,27 +2,27 @@ * @vue/shared v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**//*! #__NO_SIDE_EFFECTS__ */function El(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const nt={},Cs=[],Nn=()=>{},qg=()=>!1,ea=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Sl=t=>t.startsWith("onUpdate:"),Xt=Object.assign,yl=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Yg=Object.prototype.hasOwnProperty,Ze=(t,e)=>Yg.call(t,e),Oe=Array.isArray,xr=t=>ta(t)==="[object Map]",jg=t=>ta(t)==="[object Set]",Fe=t=>typeof t=="function",Tt=t=>typeof t=="string",ks=t=>typeof t=="symbol",gt=t=>t!==null&&typeof t=="object",tp=t=>(gt(t)||Fe(t))&&Fe(t.then)&&Fe(t.catch),Zg=Object.prototype.toString,ta=t=>Zg.call(t),Kg=t=>ta(t).slice(8,-1),Jg=t=>ta(t)==="[object Object]",bl=t=>Tt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Mr=El(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),na=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},Qg=/-(\w)/g,mn=na(t=>t.replace(Qg,(e,n)=>n?n.toUpperCase():"")),e0=/\B([A-Z])/g,Qi=na(t=>t.replace(e0,"-$1").toLowerCase()),ia=na(t=>t.charAt(0).toUpperCase()+t.slice(1)),Ra=na(t=>t?`on${ia(t)}`:""),Wi=(t,e)=>!Object.is(t,e),Oo=(t,...e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:i,value:n})},Xc=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let pf;const sa=()=>pf||(pf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Tl(t){if(Oe(t)){const e={};for(let n=0;n{if(n){const i=n.split(n0);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function wl(t){let e="";if(Tt(t))e=t;else if(Oe(t))for(let n=0;nn in e}const it={},Vs=[],Vn=()=>{},L0=()=>!1,ma=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Xl=t=>t.startsWith("onUpdate:"),Rt=Object.assign,ql=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},D0=Object.prototype.hasOwnProperty,Ze=(t,e)=>D0.call(t,e),Ie=Array.isArray,Gs=t=>ga(t)==="[object Map]",bp=t=>ga(t)==="[object Set]",Oe=t=>typeof t=="function",ht=t=>typeof t=="string",Li=t=>typeof t=="symbol",ct=t=>t!==null&&typeof t=="object",Tp=t=>(ct(t)||Oe(t))&&Oe(t.then)&&Oe(t.catch),wp=Object.prototype.toString,ga=t=>wp.call(t),U0=t=>ga(t).slice(8,-1),Ap=t=>ga(t)==="[object Object]",jl=t=>ht(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Ur=Wl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),_a=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},I0=/-(\w)/g,vn=_a(t=>t.replace(I0,(e,n)=>n?n.toUpperCase():"")),N0=/\B([A-Z])/g,us=_a(t=>t.replace(N0,"-$1").toLowerCase()),va=_a(t=>t.charAt(0).toUpperCase()+t.slice(1)),qa=_a(t=>t?`on${va(t)}`:""),is=(t,e)=>!Object.is(t,e),Zo=(t,...e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:i,value:n})},ml=t=>{const e=parseFloat(t);return isNaN(e)?t:e},F0=t=>{const e=ht(t)?Number(t):NaN;return isNaN(e)?t:e};let Df;const xa=()=>Df||(Df=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Yl(t){if(Ie(t)){const e={};for(let n=0;n{if(n){const i=n.split(B0);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Ma(t){let e="";if(ht(t))e=t;else if(Ie(t))for(let n=0;n!!(t&&t.__v_isRef===!0),Lp=t=>ht(t)?t:t==null?"":Ie(t)||ct(t)&&(t.toString===wp||!Oe(t.toString))?Pp(t)?Lp(t.value):JSON.stringify(t,Dp,2):String(t),Dp=(t,e)=>Pp(e)?Dp(t,e.value):Gs(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[i,s],r)=>(n[ja(i,r)+" =>"]=s,n),{})}:bp(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>ja(n))}:Li(e)?ja(e):ct(e)&&!Ie(e)&&!Ap(e)?String(e):e,ja=(t,e="")=>{var n;return Li(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};/** * @vue/reactivity v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let rn;class a0{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=rn,!e&&rn&&(this.index=(rn.scopes||(rn.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e0)return;if(Sr){let e=Sr;for(Sr=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;Er;){let e=Er;for(Er=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){t||(t=i)}e=n}}if(t)throw t}function ap(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function cp(t){let e,n=t.depsTail,i=n;for(;i;){const s=i.prevDep;i.version===-1?(i===n&&(n=s),Cl(i),l0(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}t.deps=e,t.depsTail=n}function qc(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(lp(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function lp(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Pr))return;t.globalVersion=Pr;const e=t.dep;if(t.flags|=2,e.version>0&&!t.isSSR&&t.deps&&!qc(t)){t.flags&=-3;return}const n=st,i=Tn;st=t,Tn=!0;try{ap(t);const s=t.fn(t._value);(e.version===0||Wi(s,t._value))&&(t._value=s,e.version++)}catch(s){throw e.version++,s}finally{st=n,Tn=i,cp(t),t.flags&=-3}}function Cl(t,e=!1){const{dep:n,prevSub:i,nextSub:s}=t;if(i&&(i.nextSub=s,t.prevSub=void 0),s&&(s.prevSub=i,t.nextSub=void 0),n.subs===t&&(n.subs=i,!i&&n.computed)){n.computed.flags&=-5;for(let r=n.computed.deps;r;r=r.nextDep)Cl(r,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function l0(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let Tn=!0;const fp=[];function Ti(){fp.push(Tn),Tn=!1}function wi(){const t=fp.pop();Tn=t===void 0?!0:t}function mf(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=st;st=void 0;try{e()}finally{st=n}}}let Pr=0;class f0{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class up{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0}track(e){if(!st||!Tn||st===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==st)n=this.activeLink=new f0(st,this),st.deps?(n.prevDep=st.depsTail,st.depsTail.nextDep=n,st.depsTail=n):st.deps=st.depsTail=n,hp(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const i=n.nextDep;i.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=i),n.prevDep=st.depsTail,n.nextDep=void 0,st.depsTail.nextDep=n,st.depsTail=n,st.deps===n&&(st.deps=i)}return n}trigger(e){this.version++,Pr++,this.notify(e)}notify(e){Al();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Rl()}}}function hp(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)hp(i)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const Yc=new WeakMap,Xi=Symbol(""),jc=Symbol(""),Lr=Symbol("");function Dt(t,e,n){if(Tn&&st){let i=Yc.get(t);i||Yc.set(t,i=new Map);let s=i.get(n);s||(i.set(n,s=new up),s.map=i,s.key=n),s.track()}}function ei(t,e,n,i,s,r){const o=Yc.get(t);if(!o){Pr++;return}const a=c=>{c&&c.trigger()};if(Al(),e==="clear")o.forEach(a);else{const c=Oe(t),l=c&&bl(n);if(c&&n==="length"){const f=Number(i);o.forEach((u,h)=>{(h==="length"||h===Lr||!ks(h)&&h>=f)&&a(u)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),l&&a(o.get(Lr)),e){case"add":c?l&&a(o.get("length")):(a(o.get(Xi)),xr(t)&&a(o.get(jc)));break;case"delete":c||(a(o.get(Xi)),xr(t)&&a(o.get(jc)));break;case"set":xr(t)&&a(o.get(Xi));break}}Rl()}function is(t){const e=Je(t);return e===t?e:(Dt(e,"iterate",Lr),Fn(t)?e:e.map(on))}function Pl(t){return Dt(t=Je(t),"iterate",Lr),t}const u0={__proto__:null,[Symbol.iterator](){return Pa(this,Symbol.iterator,on)},concat(...t){return is(this).concat(...t.map(e=>Oe(e)?is(e):e))},entries(){return Pa(this,"entries",t=>(t[1]=on(t[1]),t))},every(t,e){return zn(this,"every",t,e,void 0,arguments)},filter(t,e){return zn(this,"filter",t,e,n=>n.map(on),arguments)},find(t,e){return zn(this,"find",t,e,on,arguments)},findIndex(t,e){return zn(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return zn(this,"findLast",t,e,on,arguments)},findLastIndex(t,e){return zn(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return zn(this,"forEach",t,e,void 0,arguments)},includes(...t){return La(this,"includes",t)},indexOf(...t){return La(this,"indexOf",t)},join(t){return is(this).join(t)},lastIndexOf(...t){return La(this,"lastIndexOf",t)},map(t,e){return zn(this,"map",t,e,void 0,arguments)},pop(){return Qs(this,"pop")},push(...t){return Qs(this,"push",t)},reduce(t,...e){return gf(this,"reduce",t,e)},reduceRight(t,...e){return gf(this,"reduceRight",t,e)},shift(){return Qs(this,"shift")},some(t,e){return zn(this,"some",t,e,void 0,arguments)},splice(...t){return Qs(this,"splice",t)},toReversed(){return is(this).toReversed()},toSorted(t){return is(this).toSorted(t)},toSpliced(...t){return is(this).toSpliced(...t)},unshift(...t){return Qs(this,"unshift",t)},values(){return Pa(this,"values",on)}};function Pa(t,e,n){const i=Pl(t),s=i[e]();return i!==t&&!Fn(t)&&(s._next=s.next,s.next=()=>{const r=s._next();return r.value&&(r.value=n(r.value)),r}),s}const h0=Array.prototype;function zn(t,e,n,i,s,r){const o=Pl(t),a=o!==t&&!Fn(t),c=o[e];if(c!==h0[e]){const u=c.apply(t,r);return a?on(u):u}let l=n;o!==t&&(a?l=function(u,h){return n.call(this,on(u),h,t)}:n.length>2&&(l=function(u,h){return n.call(this,u,h,t)}));const f=c.call(o,l,i);return a&&s?s(f):f}function gf(t,e,n,i){const s=Pl(t);let r=n;return s!==t&&(Fn(t)?n.length>3&&(r=function(o,a,c){return n.call(this,o,a,c,t)}):r=function(o,a,c){return n.call(this,o,on(a),c,t)}),s[e](r,...i)}function La(t,e,n){const i=Je(t);Dt(i,"iterate",Lr);const s=i[e](...n);return(s===-1||s===!1)&&Il(n[0])?(n[0]=Je(n[0]),i[e](...n)):s}function Qs(t,e,n=[]){Ti(),Al();const i=Je(t)[e].apply(t,n);return Rl(),wi(),i}const d0=El("__proto__,__v_isRef,__isVue"),dp=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(ks));function p0(t){ks(t)||(t=String(t));const e=Je(this);return Dt(e,"has",t),e.hasOwnProperty(t)}class pp{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,i){if(n==="__v_skip")return e.__v_skip;const s=this._isReadonly,r=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return r;if(n==="__v_raw")return i===(s?r?b0:vp:r?_p:gp).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=Oe(e);if(!s){let c;if(o&&(c=u0[n]))return c;if(n==="hasOwnProperty")return p0}const a=Reflect.get(e,n,Wt(e)?e:i);return(ks(n)?dp.has(n):d0(n))||(s||Dt(e,"get",n),r)?a:Wt(a)?o&&bl(n)?a:a.value:gt(a)?s?xp(a):Dl(a):a}}class mp extends pp{constructor(e=!1){super(!1,e)}set(e,n,i,s){let r=e[n];if(!this._isShallow){const c=Ns(r);if(!Fn(i)&&!Ns(i)&&(r=Je(r),i=Je(i)),!Oe(e)&&Wt(r)&&!Wt(i))return c?!1:(r.value=i,!0)}const o=Oe(e)&&bl(n)?Number(n)t,Zr=t=>Reflect.getPrototypeOf(t);function x0(t,e,n){return function(...i){const s=this.__v_raw,r=Je(s),o=xr(r),a=t==="entries"||t===Symbol.iterator&&o,c=t==="keys"&&o,l=s[t](...i),f=n?Zc:e?Kc:on;return!e&&Dt(r,"iterate",c?jc:Xi),{next(){const{value:u,done:h}=l.next();return h?{value:u,done:h}:{value:a?[f(u[0]),f(u[1])]:f(u),done:h}},[Symbol.iterator](){return this}}}}function Kr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function M0(t,e){const n={get(s){const r=this.__v_raw,o=Je(r),a=Je(s);t||(Wi(s,a)&&Dt(o,"get",s),Dt(o,"get",a));const{has:c}=Zr(o),l=e?Zc:t?Kc:on;if(c.call(o,s))return l(r.get(s));if(c.call(o,a))return l(r.get(a));r!==o&&r.get(s)},get size(){const s=this.__v_raw;return!t&&Dt(Je(s),"iterate",Xi),Reflect.get(s,"size",s)},has(s){const r=this.__v_raw,o=Je(r),a=Je(s);return t||(Wi(s,a)&&Dt(o,"has",s),Dt(o,"has",a)),s===a?r.has(s):r.has(s)||r.has(a)},forEach(s,r){const o=this,a=o.__v_raw,c=Je(a),l=e?Zc:t?Kc:on;return!t&&Dt(c,"iterate",Xi),a.forEach((f,u)=>s.call(r,l(f),l(u),o))}};return Xt(n,t?{add:Kr("add"),set:Kr("set"),delete:Kr("delete"),clear:Kr("clear")}:{add(s){!e&&!Fn(s)&&!Ns(s)&&(s=Je(s));const r=Je(this);return Zr(r).has.call(r,s)||(r.add(s),ei(r,"add",s,s)),this},set(s,r){!e&&!Fn(r)&&!Ns(r)&&(r=Je(r));const o=Je(this),{has:a,get:c}=Zr(o);let l=a.call(o,s);l||(s=Je(s),l=a.call(o,s));const f=c.call(o,s);return o.set(s,r),l?Wi(r,f)&&ei(o,"set",s,r):ei(o,"add",s,r),this},delete(s){const r=Je(this),{has:o,get:a}=Zr(r);let c=o.call(r,s);c||(s=Je(s),c=o.call(r,s)),a&&a.call(r,s);const l=r.delete(s);return c&&ei(r,"delete",s,void 0),l},clear(){const s=Je(this),r=s.size!==0,o=s.clear();return r&&ei(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=x0(s,t,e)}),n}function Ll(t,e){const n=M0(t,e);return(i,s,r)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?i:Reflect.get(Ze(n,s)&&s in i?n:i,s,r)}const E0={get:Ll(!1,!1)},S0={get:Ll(!1,!0)},y0={get:Ll(!0,!1)};const gp=new WeakMap,_p=new WeakMap,vp=new WeakMap,b0=new WeakMap;function T0(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function w0(t){return t.__v_skip||!Object.isExtensible(t)?0:T0(Kg(t))}function Dl(t){return Ns(t)?t:Ul(t,!1,g0,E0,gp)}function A0(t){return Ul(t,!1,v0,S0,_p)}function xp(t){return Ul(t,!0,_0,y0,vp)}function Ul(t,e,n,i,s){if(!gt(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=s.get(t);if(r)return r;const o=w0(t);if(o===0)return t;const a=new Proxy(t,o===2?i:n);return s.set(t,a),a}function yr(t){return Ns(t)?yr(t.__v_raw):!!(t&&t.__v_isReactive)}function Ns(t){return!!(t&&t.__v_isReadonly)}function Fn(t){return!!(t&&t.__v_isShallow)}function Il(t){return t?!!t.__v_raw:!1}function Je(t){const e=t&&t.__v_raw;return e?Je(e):t}function R0(t){return!Ze(t,"__v_skip")&&Object.isExtensible(t)&&np(t,"__v_skip",!0),t}const on=t=>gt(t)?Dl(t):t,Kc=t=>gt(t)?xp(t):t;function Wt(t){return t?t.__v_isRef===!0:!1}function C0(t){return Wt(t)?t.value:t}const P0={get:(t,e,n)=>e==="__v_raw"?t:C0(Reflect.get(t,e,n)),set:(t,e,n,i)=>{const s=t[e];return Wt(s)&&!Wt(n)?(s.value=n,!0):Reflect.set(t,e,n,i)}};function Mp(t){return yr(t)?t:new Proxy(t,P0)}class L0{constructor(e,n,i){this.fn=e,this.setter=n,this._value=void 0,this.dep=new up(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Pr-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&st!==this)return op(this,!0),!0}get value(){const e=this.dep.track();return lp(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function D0(t,e,n=!1){let i,s;return Fe(t)?i=t:(i=t.get,s=t.set),new L0(i,s,n)}const Jr={},ko=new WeakMap;let Oi;function U0(t,e=!1,n=Oi){if(n){let i=ko.get(n);i||ko.set(n,i=[]),i.push(t)}}function I0(t,e,n=nt){const{immediate:i,deep:s,once:r,scheduler:o,augmentJob:a,call:c}=n,l=v=>s?v:Fn(v)||s===!1||s===0?ti(v,1):ti(v);let f,u,h,d,_=!1,g=!1;if(Wt(t)?(u=()=>t.value,_=Fn(t)):yr(t)?(u=()=>l(t),_=!0):Oe(t)?(g=!0,_=t.some(v=>yr(v)||Fn(v)),u=()=>t.map(v=>{if(Wt(v))return v.value;if(yr(v))return l(v);if(Fe(v))return c?c(v,2):v()})):Fe(t)?e?u=c?()=>c(t,2):t:u=()=>{if(h){Ti();try{h()}finally{wi()}}const v=Oi;Oi=f;try{return c?c(t,3,[d]):t(d)}finally{Oi=v}}:u=Nn,e&&s){const v=u,M=s===!0?1/0:s;u=()=>ti(v(),M)}const m=c0(),p=()=>{f.stop(),m&&m.active&&yl(m.effects,f)};if(r&&e){const v=e;e=(...M)=>{v(...M),p()}}let y=g?new Array(t.length).fill(Jr):Jr;const E=v=>{if(!(!(f.flags&1)||!f.dirty&&!v))if(e){const M=f.run();if(s||_||(g?M.some((b,w)=>Wi(b,y[w])):Wi(M,y))){h&&h();const b=Oi;Oi=f;try{const w=[M,y===Jr?void 0:g&&y[0]===Jr?[]:y,d];c?c(e,3,w):e(...w),y=M}finally{Oi=b}}}else f.run()};return a&&a(E),f=new sp(u),f.scheduler=o?()=>o(E,!1):E,d=v=>U0(v,!1,f),h=f.onStop=()=>{const v=ko.get(f);if(v){if(c)c(v,4);else for(const M of v)M();ko.delete(f)}},e?i?E(!0):y=f.run():o?o(E.bind(null,!0),!0):f.run(),p.pause=f.pause.bind(f),p.resume=f.resume.bind(f),p.stop=p,p}function ti(t,e=1/0,n){if(e<=0||!gt(t)||t.__v_skip||(n=n||new Set,n.has(t)))return t;if(n.add(t),e--,Wt(t))ti(t.value,e,n);else if(Oe(t))for(let i=0;i{ti(i,e,n)});else if(Jg(t)){for(const i in t)ti(t[i],e,n);for(const i of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,i)&&ti(t[i],e,n)}return t}/** +**/let cn;class $0{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=cn,!e&&cn&&(this.index=(cn.scopes||(cn.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e0)return;if(Nr){let e=Nr;for(Nr=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;Ir;){let e=Ir;for(Ir=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){t||(t=i)}e=n}}if(t)throw t}function Fp(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Op(t){let e,n=t.depsTail,i=n;for(;i;){const s=i.prevDep;i.version===-1?(i===n&&(n=s),Jl(i),W0(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}t.deps=e,t.depsTail=n}function gl(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Bp(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Bp(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Gr))return;t.globalVersion=Gr;const e=t.dep;if(t.flags|=2,e.version>0&&!t.isSSR&&t.deps&&!gl(t)){t.flags&=-3;return}const n=rt,i=Cn;rt=t,Cn=!0;try{Fp(t);const s=t.fn(t._value);(e.version===0||is(s,t._value))&&(t._value=s,e.version++)}catch(s){throw e.version++,s}finally{rt=n,Cn=i,Op(t),t.flags&=-3}}function Jl(t,e=!1){const{dep:n,prevSub:i,nextSub:s}=t;if(i&&(i.nextSub=s,t.prevSub=void 0),s&&(s.prevSub=i,t.nextSub=void 0),n.subs===t&&(n.subs=i,!i&&n.computed)){n.computed.flags&=-5;for(let r=n.computed.deps;r;r=r.nextDep)Jl(r,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function W0(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let Cn=!0;const zp=[];function Di(){zp.push(Cn),Cn=!1}function Ui(){const t=zp.pop();Cn=t===void 0?!0:t}function Uf(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=rt;rt=void 0;try{e()}finally{rt=n}}}let Gr=0;class X0{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Hp{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0}track(e){if(!rt||!Cn||rt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==rt)n=this.activeLink=new X0(rt,this),rt.deps?(n.prevDep=rt.depsTail,rt.depsTail.nextDep=n,rt.depsTail=n):rt.deps=rt.depsTail=n,Vp(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const i=n.nextDep;i.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=i),n.prevDep=rt.depsTail,n.nextDep=void 0,rt.depsTail.nextDep=n,rt.depsTail=n,rt.deps===n&&(rt.deps=i)}return n}trigger(e){this.version++,Gr++,this.notify(e)}notify(e){Zl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Kl()}}}function Vp(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)Vp(i)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const _l=new WeakMap,ss=Symbol(""),vl=Symbol(""),$r=Symbol("");function It(t,e,n){if(Cn&&rt){let i=_l.get(t);i||_l.set(t,i=new Map);let s=i.get(n);s||(i.set(n,s=new Hp),s.map=i,s.key=n),s.track()}}function si(t,e,n,i,s,r){const o=_l.get(t);if(!o){Gr++;return}const a=c=>{c&&c.trigger()};if(Zl(),e==="clear")o.forEach(a);else{const c=Ie(t),l=c&&jl(n);if(c&&n==="length"){const f=Number(i);o.forEach((u,h)=>{(h==="length"||h===$r||!Li(h)&&h>=f)&&a(u)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),l&&a(o.get($r)),e){case"add":c?l&&a(o.get("length")):(a(o.get(ss)),Gs(t)&&a(o.get(vl)));break;case"delete":c||(a(o.get(ss)),Gs(t)&&a(o.get(vl)));break;case"set":Gs(t)&&a(o.get(ss));break}}Kl()}function ms(t){const e=Ke(t);return e===t?e:(It(e,"iterate",$r),Pn(t)?e:e.map(Zt))}function Ea(t){return It(t=Ke(t),"iterate",$r),t}const q0={__proto__:null,[Symbol.iterator](){return Za(this,Symbol.iterator,Zt)},concat(...t){return ms(this).concat(...t.map(e=>Ie(e)?ms(e):e))},entries(){return Za(this,"entries",t=>(t[1]=Zt(t[1]),t))},every(t,e){return $n(this,"every",t,e,void 0,arguments)},filter(t,e){return $n(this,"filter",t,e,n=>n.map(Zt),arguments)},find(t,e){return $n(this,"find",t,e,Zt,arguments)},findIndex(t,e){return $n(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return $n(this,"findLast",t,e,Zt,arguments)},findLastIndex(t,e){return $n(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return $n(this,"forEach",t,e,void 0,arguments)},includes(...t){return Ka(this,"includes",t)},indexOf(...t){return Ka(this,"indexOf",t)},join(t){return ms(this).join(t)},lastIndexOf(...t){return Ka(this,"lastIndexOf",t)},map(t,e){return $n(this,"map",t,e,void 0,arguments)},pop(){return ur(this,"pop")},push(...t){return ur(this,"push",t)},reduce(t,...e){return If(this,"reduce",t,e)},reduceRight(t,...e){return If(this,"reduceRight",t,e)},shift(){return ur(this,"shift")},some(t,e){return $n(this,"some",t,e,void 0,arguments)},splice(...t){return ur(this,"splice",t)},toReversed(){return ms(this).toReversed()},toSorted(t){return ms(this).toSorted(t)},toSpliced(...t){return ms(this).toSpliced(...t)},unshift(...t){return ur(this,"unshift",t)},values(){return Za(this,"values",Zt)}};function Za(t,e,n){const i=Ea(t),s=i[e]();return i!==t&&!Pn(t)&&(s._next=s.next,s.next=()=>{const r=s._next();return r.value&&(r.value=n(r.value)),r}),s}const j0=Array.prototype;function $n(t,e,n,i,s,r){const o=Ea(t),a=o!==t&&!Pn(t),c=o[e];if(c!==j0[e]){const u=c.apply(t,r);return a?Zt(u):u}let l=n;o!==t&&(a?l=function(u,h){return n.call(this,Zt(u),h,t)}:n.length>2&&(l=function(u,h){return n.call(this,u,h,t)}));const f=c.call(o,l,i);return a&&s?s(f):f}function If(t,e,n,i){const s=Ea(t);let r=n;return s!==t&&(Pn(t)?n.length>3&&(r=function(o,a,c){return n.call(this,o,a,c,t)}):r=function(o,a,c){return n.call(this,o,Zt(a),c,t)}),s[e](r,...i)}function Ka(t,e,n){const i=Ke(t);It(i,"iterate",$r);const s=i[e](...n);return(s===-1||s===!1)&&nf(n[0])?(n[0]=Ke(n[0]),i[e](...n)):s}function ur(t,e,n=[]){Di(),Zl();const i=Ke(t)[e].apply(t,n);return Kl(),Ui(),i}const Y0=Wl("__proto__,__v_isRef,__isVue"),Gp=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Li));function Z0(t){Li(t)||(t=String(t));const e=Ke(this);return It(e,"has",t),e.hasOwnProperty(t)}class $p{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,i){if(n==="__v_skip")return e.__v_skip;const s=this._isReadonly,r=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return r;if(n==="__v_raw")return i===(s?r?o_:qp:r?Xp:Wp).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=Ie(e);if(!s){let c;if(o&&(c=q0[n]))return c;if(n==="hasOwnProperty")return Z0}const a=Reflect.get(e,n,qt(e)?e:i);return(Li(n)?Gp.has(n):Y0(n))||(s||It(e,"get",n),r)?a:qt(a)?o&&jl(n)?a:a.value:ct(a)?s?jp(a):ef(a):a}}class kp extends $p{constructor(e=!1){super(!1,e)}set(e,n,i,s){let r=e[n];if(!this._isShallow){const c=Ys(r);if(!Pn(i)&&!Ys(i)&&(r=Ke(r),i=Ke(i)),!Ie(e)&&qt(r)&&!qt(i))return c?!1:(r.value=i,!0)}const o=Ie(e)&&jl(n)?Number(n)t,lo=t=>Reflect.getPrototypeOf(t);function t_(t,e,n){return function(...i){const s=this.__v_raw,r=Ke(s),o=Gs(r),a=t==="entries"||t===Symbol.iterator&&o,c=t==="keys"&&o,l=s[t](...i),f=n?xl:e?Ml:Zt;return!e&&It(r,"iterate",c?vl:ss),{next(){const{value:u,done:h}=l.next();return h?{value:u,done:h}:{value:a?[f(u[0]),f(u[1])]:f(u),done:h}},[Symbol.iterator](){return this}}}}function fo(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function n_(t,e){const n={get(s){const r=this.__v_raw,o=Ke(r),a=Ke(s);t||(is(s,a)&&It(o,"get",s),It(o,"get",a));const{has:c}=lo(o),l=e?xl:t?Ml:Zt;if(c.call(o,s))return l(r.get(s));if(c.call(o,a))return l(r.get(a));r!==o&&r.get(s)},get size(){const s=this.__v_raw;return!t&&It(Ke(s),"iterate",ss),Reflect.get(s,"size",s)},has(s){const r=this.__v_raw,o=Ke(r),a=Ke(s);return t||(is(s,a)&&It(o,"has",s),It(o,"has",a)),s===a?r.has(s):r.has(s)||r.has(a)},forEach(s,r){const o=this,a=o.__v_raw,c=Ke(a),l=e?xl:t?Ml:Zt;return!t&&It(c,"iterate",ss),a.forEach((f,u)=>s.call(r,l(f),l(u),o))}};return Rt(n,t?{add:fo("add"),set:fo("set"),delete:fo("delete"),clear:fo("clear")}:{add(s){!e&&!Pn(s)&&!Ys(s)&&(s=Ke(s));const r=Ke(this);return lo(r).has.call(r,s)||(r.add(s),si(r,"add",s,s)),this},set(s,r){!e&&!Pn(r)&&!Ys(r)&&(r=Ke(r));const o=Ke(this),{has:a,get:c}=lo(o);let l=a.call(o,s);l||(s=Ke(s),l=a.call(o,s));const f=c.call(o,s);return o.set(s,r),l?is(r,f)&&si(o,"set",s,r):si(o,"add",s,r),this},delete(s){const r=Ke(this),{has:o,get:a}=lo(r);let c=o.call(r,s);c||(s=Ke(s),c=o.call(r,s)),a&&a.call(r,s);const l=r.delete(s);return c&&si(r,"delete",s,void 0),l},clear(){const s=Ke(this),r=s.size!==0,o=s.clear();return r&&si(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=t_(s,t,e)}),n}function Ql(t,e){const n=n_(t,e);return(i,s,r)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?i:Reflect.get(Ze(n,s)&&s in i?n:i,s,r)}const i_={get:Ql(!1,!1)},s_={get:Ql(!1,!0)},r_={get:Ql(!0,!1)};const Wp=new WeakMap,Xp=new WeakMap,qp=new WeakMap,o_=new WeakMap;function a_(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function c_(t){return t.__v_skip||!Object.isExtensible(t)?0:a_(U0(t))}function ef(t){return Ys(t)?t:tf(t,!1,J0,i_,Wp)}function l_(t){return tf(t,!1,e_,s_,Xp)}function jp(t){return tf(t,!0,Q0,r_,qp)}function tf(t,e,n,i,s){if(!ct(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=s.get(t);if(r)return r;const o=c_(t);if(o===0)return t;const a=new Proxy(t,o===2?i:n);return s.set(t,a),a}function $s(t){return Ys(t)?$s(t.__v_raw):!!(t&&t.__v_isReactive)}function Ys(t){return!!(t&&t.__v_isReadonly)}function Pn(t){return!!(t&&t.__v_isShallow)}function nf(t){return t?!!t.__v_raw:!1}function Ke(t){const e=t&&t.__v_raw;return e?Ke(e):t}function f_(t){return!Ze(t,"__v_skip")&&Object.isExtensible(t)&&Rp(t,"__v_skip",!0),t}const Zt=t=>ct(t)?ef(t):t,Ml=t=>ct(t)?jp(t):t;function qt(t){return t?t.__v_isRef===!0:!1}function u_(t){return qt(t)?t.value:t}const h_={get:(t,e,n)=>e==="__v_raw"?t:u_(Reflect.get(t,e,n)),set:(t,e,n,i)=>{const s=t[e];return qt(s)&&!qt(n)?(s.value=n,!0):Reflect.set(t,e,n,i)}};function Yp(t){return $s(t)?t:new Proxy(t,h_)}class d_{constructor(e,n,i){this.fn=e,this.setter=n,this._value=void 0,this.dep=new Hp(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Gr-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&rt!==this)return Np(this,!0),!0}get value(){const e=this.dep.track();return Bp(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function p_(t,e,n=!1){let i,s;return Oe(t)?i=t:(i=t.get,s=t.set),new d_(i,s,n)}const uo={},ia=new WeakMap;let Xi;function m_(t,e=!1,n=Xi){if(n){let i=ia.get(n);i||ia.set(n,i=[]),i.push(t)}}function g_(t,e,n=it){const{immediate:i,deep:s,once:r,scheduler:o,augmentJob:a,call:c}=n,l=x=>s?x:Pn(x)||s===!1||s===0?ri(x,1):ri(x);let f,u,h,d,_=!1,g=!1;if(qt(t)?(u=()=>t.value,_=Pn(t)):$s(t)?(u=()=>l(t),_=!0):Ie(t)?(g=!0,_=t.some(x=>$s(x)||Pn(x)),u=()=>t.map(x=>{if(qt(x))return x.value;if($s(x))return l(x);if(Oe(x))return c?c(x,2):x()})):Oe(t)?e?u=c?()=>c(t,2):t:u=()=>{if(h){Di();try{h()}finally{Ui()}}const x=Xi;Xi=f;try{return c?c(t,3,[d]):t(d)}finally{Xi=x}}:u=Vn,e&&s){const x=u,M=s===!0?1/0:s;u=()=>ri(x(),M)}const m=k0(),p=()=>{f.stop(),m&&m.active&&ql(m.effects,f)};if(r&&e){const x=e;e=(...M)=>{x(...M),p()}}let y=g?new Array(t.length).fill(uo):uo;const E=x=>{if(!(!(f.flags&1)||!f.dirty&&!x))if(e){const M=f.run();if(s||_||(g?M.some((b,w)=>is(b,y[w])):is(M,y))){h&&h();const b=Xi;Xi=f;try{const w=[M,y===uo?void 0:g&&y[0]===uo?[]:y,d];c?c(e,3,w):e(...w),y=M}finally{Xi=b}}}else f.run()};return a&&a(E),f=new Up(u),f.scheduler=o?()=>o(E,!1):E,d=x=>m_(x,!1,f),h=f.onStop=()=>{const x=ia.get(f);if(x){if(c)c(x,4);else for(const M of x)M();ia.delete(f)}},e?i?E(!0):y=f.run():o?o(E.bind(null,!0),!0):f.run(),p.pause=f.pause.bind(f),p.resume=f.resume.bind(f),p.stop=p,p}function ri(t,e=1/0,n){if(e<=0||!ct(t)||t.__v_skip||(n=n||new Set,n.has(t)))return t;if(n.add(t),e--,qt(t))ri(t.value,e,n);else if(Ie(t))for(let i=0;i{ri(i,e,n)});else if(Ap(t)){for(const i in t)ri(t[i],e,n);for(const i of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,i)&&ri(t[i],e,n)}return t}/** * @vue/runtime-core v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/function Hr(t,e,n,i){try{return i?t(...i):t()}catch(s){ra(s,e,n)}}function On(t,e,n,i){if(Fe(t)){const s=Hr(t,e,n,i);return s&&tp(s)&&s.catch(r=>{ra(r,e,n)}),s}if(Oe(t)){const s=[];for(let r=0;r>>1,s=$t[i],r=Dr(s);r=Dr(n)?$t.push(t):$t.splice(O0(e),0,t),t.flags|=1,Sp()}}function Sp(){Wo||(Wo=Ep.then(bp))}function B0(t){Oe(t)?Ps.push(...t):Mi&&t.id===-1?Mi.splice(bs+1,0,t):t.flags&1||(Ps.push(t),t.flags|=1),Sp()}function _f(t,e,n=Ln+1){for(;n<$t.length;n++){const i=$t[n];if(i&&i.flags&2){if(t&&i.id!==t.uid)continue;$t.splice(n,1),n--,i.flags&4&&(i.flags&=-2),i(),i.flags&4||(i.flags&=-2)}}}function yp(t){if(Ps.length){const e=[...new Set(Ps)].sort((n,i)=>Dr(n)-Dr(i));if(Ps.length=0,Mi){Mi.push(...e);return}for(Mi=e,bs=0;bst.id==null?t.flags&2?-1:1/0:t.id;function bp(t){try{for(Ln=0;Ln<$t.length;Ln++){const e=$t[Ln];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Hr(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Ln<$t.length;Ln++){const e=$t[Ln];e&&(e.flags&=-2)}Ln=-1,$t.length=0,yp(),Wo=null,($t.length||Ps.length)&&bp()}}let an=null,Tp=null;function Xo(t){const e=an;return an=t,Tp=t&&t.type.__scopeId||null,e}function z0(t,e=an,n){if(!e||t._n)return t;const i=(...s)=>{i._d&&Rf(-1);const r=Xo(e);let o;try{o=t(...s)}finally{Xo(r),i._d&&Rf(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function Qr(t,e){if(an===null)return t;const n=la(an),i=t.dirs||(t.dirs=[]);for(let s=0;st.__isTeleport;function Fl(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Fl(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function wp(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function qo(t,e,n,i,s=!1){if(Oe(t)){t.forEach((_,g)=>qo(_,e&&(Oe(e)?e[g]:e),n,i,s));return}if(br(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&qo(t,e,n,i.component.subTree);return}const r=i.shapeFlag&4?la(i.component):i.el,o=s?null:r,{i:a,r:c}=t,l=e&&e.r,f=a.refs===nt?a.refs={}:a.refs,u=a.setupState,h=Je(u),d=u===nt?()=>!1:_=>Ze(h,_);if(l!=null&&l!==c&&(Tt(l)?(f[l]=null,d(l)&&(u[l]=null)):Wt(l)&&(l.value=null)),Fe(c))Hr(c,a,12,[o,f]);else{const _=Tt(c),g=Wt(c);if(_||g){const m=()=>{if(t.f){const p=_?d(c)?u[c]:f[c]:c.value;s?Oe(p)&&yl(p,r):Oe(p)?p.includes(r)||p.push(r):_?(f[c]=[r],d(c)&&(u[c]=f[c])):(c.value=[r],t.k&&(f[t.k]=c.value))}else _?(f[c]=o,d(c)&&(u[c]=o)):g&&(c.value=o,t.k&&(f[t.k]=o))};o?(m.id=-1,sn(m,n)):m()}}}sa().requestIdleCallback;sa().cancelIdleCallback;const br=t=>!!t.type.__asyncLoader,Ap=t=>t.type.__isKeepAlive;function G0(t,e){Rp(t,"a",e)}function $0(t,e){Rp(t,"da",e)}function Rp(t,e,n=Ut){const i=t.__wdc||(t.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(oa(e,i,n),n){let s=n.parent;for(;s&&s.parent;)Ap(s.parent.vnode)&&k0(i,e,n,s),s=s.parent}}function k0(t,e,n,i){const s=oa(e,t,i,!0);Cp(()=>{yl(i[e],s)},n)}function oa(t,e,n=Ut,i=!1){if(n){const s=n[t]||(n[t]=[]),r=e.__weh||(e.__weh=(...o)=>{Ti();const a=Gr(n),c=On(e,n,t,o);return a(),wi(),c});return i?s.unshift(r):s.push(r),r}}const ci=t=>(e,n=Ut)=>{(!Nr||t==="sp")&&oa(t,(...i)=>e(...i),n)},W0=ci("bm"),X0=ci("m"),q0=ci("bu"),Y0=ci("u"),j0=ci("bum"),Cp=ci("um"),Z0=ci("sp"),K0=ci("rtg"),J0=ci("rtc");function Q0(t,e=Ut){oa("ec",t,e)}const e_="components";function vf(t,e){return n_(e_,t,!0,e)||t}const t_=Symbol.for("v-ndc");function n_(t,e,n=!0,i=!1){const s=an||Ut;if(s){const r=s.type;{const a=W_(r,!1);if(a&&(a===e||a===mn(e)||a===ia(mn(e))))return r}const o=xf(s[t]||r[t],e)||xf(s.appContext[t],e);return!o&&i?r:o}}function xf(t,e){return t&&(t[e]||t[mn(e)]||t[ia(mn(e))])}const Jc=t=>t?Zp(t)?la(t):Jc(t.parent):null,Tr=Xt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Jc(t.parent),$root:t=>Jc(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Lp(t),$forceUpdate:t=>t.f||(t.f=()=>{Nl(t.update)}),$nextTick:t=>t.n||(t.n=F0.bind(t.proxy)),$watch:t=>b_.bind(t)}),Da=(t,e)=>t!==nt&&!t.__isScriptSetup&&Ze(t,e),i_={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:i,data:s,props:r,accessCache:o,type:a,appContext:c}=t;let l;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return i[e];case 2:return s[e];case 4:return n[e];case 3:return r[e]}else{if(Da(i,e))return o[e]=1,i[e];if(s!==nt&&Ze(s,e))return o[e]=2,s[e];if((l=t.propsOptions[0])&&Ze(l,e))return o[e]=3,r[e];if(n!==nt&&Ze(n,e))return o[e]=4,n[e];Qc&&(o[e]=0)}}const f=Tr[e];let u,h;if(f)return e==="$attrs"&&Dt(t.attrs,"get",""),f(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(n!==nt&&Ze(n,e))return o[e]=4,n[e];if(h=c.config.globalProperties,Ze(h,e))return h[e]},set({_:t},e,n){const{data:i,setupState:s,ctx:r}=t;return Da(s,e)?(s[e]=n,!0):i!==nt&&Ze(i,e)?(i[e]=n,!0):Ze(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:i,appContext:s,propsOptions:r}},o){let a;return!!n[o]||t!==nt&&Ze(t,o)||Da(e,o)||(a=r[0])&&Ze(a,o)||Ze(i,o)||Ze(Tr,o)||Ze(s.config.globalProperties,o)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:Ze(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Mf(t){return Oe(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}let Qc=!0;function s_(t){const e=Lp(t),n=t.proxy,i=t.ctx;Qc=!1,e.beforeCreate&&Ef(e.beforeCreate,t,"bc");const{data:s,computed:r,methods:o,watch:a,provide:c,inject:l,created:f,beforeMount:u,mounted:h,beforeUpdate:d,updated:_,activated:g,deactivated:m,beforeDestroy:p,beforeUnmount:y,destroyed:E,unmounted:v,render:M,renderTracked:b,renderTriggered:w,errorCaptured:D,serverPrefetch:x,expose:T,inheritAttrs:I,components:B,directives:U,filters:F}=e;if(l&&r_(l,i,null),o)for(const $ in o){const k=o[$];Fe(k)&&(i[$]=k.bind(n))}if(s){const $=s.call(n,n);gt($)&&(t.data=Dl($))}if(Qc=!0,r)for(const $ in r){const k=r[$],le=Fe(k)?k.bind(n,n):Fe(k.get)?k.get.bind(n,n):Nn,ie=!Fe(k)&&Fe(k.set)?k.set.bind(n):Nn,we=q_({get:le,set:ie});Object.defineProperty(i,$,{enumerable:!0,configurable:!0,get:()=>we.value,set:ce=>we.value=ce})}if(a)for(const $ in a)Pp(a[$],i,n,$);if(c){const $=Fe(c)?c.call(n):c;Reflect.ownKeys($).forEach(k=>{u_(k,$[k])})}f&&Ef(f,t,"c");function H($,k){Oe(k)?k.forEach(le=>$(le.bind(n))):k&&$(k.bind(n))}if(H(W0,u),H(X0,h),H(q0,d),H(Y0,_),H(G0,g),H($0,m),H(Q0,D),H(J0,b),H(K0,w),H(j0,y),H(Cp,v),H(Z0,x),Oe(T))if(T.length){const $=t.exposed||(t.exposed={});T.forEach(k=>{Object.defineProperty($,k,{get:()=>n[k],set:le=>n[k]=le})})}else t.exposed||(t.exposed={});M&&t.render===Nn&&(t.render=M),I!=null&&(t.inheritAttrs=I),B&&(t.components=B),U&&(t.directives=U),x&&wp(t)}function r_(t,e,n=Nn){Oe(t)&&(t=el(t));for(const i in t){const s=t[i];let r;gt(s)?"default"in s?r=Bo(s.from||i,s.default,!0):r=Bo(s.from||i):r=Bo(s),Wt(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function Ef(t,e,n){On(Oe(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function Pp(t,e,n,i){let s=i.includes(".")?Wp(n,i):()=>n[i];if(Tt(t)){const r=e[t];Fe(r)&&Ia(s,r)}else if(Fe(t))Ia(s,t.bind(n));else if(gt(t))if(Oe(t))t.forEach(r=>Pp(r,e,n,i));else{const r=Fe(t.handler)?t.handler.bind(n):e[t.handler];Fe(r)&&Ia(s,r,t)}}function Lp(t){const e=t.type,{mixins:n,extends:i}=e,{mixins:s,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,a=r.get(e);let c;return a?c=a:!s.length&&!n&&!i?c=e:(c={},s.length&&s.forEach(l=>Yo(c,l,o,!0)),Yo(c,e,o)),gt(e)&&r.set(e,c),c}function Yo(t,e,n,i=!1){const{mixins:s,extends:r}=e;r&&Yo(t,r,n,!0),s&&s.forEach(o=>Yo(t,o,n,!0));for(const o in e)if(!(i&&o==="expose")){const a=o_[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const o_={data:Sf,props:yf,emits:yf,methods:dr,computed:dr,beforeCreate:zt,created:zt,beforeMount:zt,mounted:zt,beforeUpdate:zt,updated:zt,beforeDestroy:zt,beforeUnmount:zt,destroyed:zt,unmounted:zt,activated:zt,deactivated:zt,errorCaptured:zt,serverPrefetch:zt,components:dr,directives:dr,watch:c_,provide:Sf,inject:a_};function Sf(t,e){return e?t?function(){return Xt(Fe(t)?t.call(this,this):t,Fe(e)?e.call(this,this):e)}:e:t}function a_(t,e){return dr(el(t),el(e))}function el(t){if(Oe(t)){const e={};for(let n=0;n1)return n&&Fe(e)?e.call(i&&i.proxy):e}}const Up={},Ip=()=>Object.create(Up),Np=t=>Object.getPrototypeOf(t)===Up;function h_(t,e,n,i=!1){const s={},r=Ip();t.propsDefaults=Object.create(null),Fp(t,e,s,r);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);n?t.props=i?s:A0(s):t.type.props?t.props=s:t.props=r,t.attrs=r}function d_(t,e,n,i){const{props:s,attrs:r,vnode:{patchFlag:o}}=t,a=Je(s),[c]=t.propsOptions;let l=!1;if((i||o>0)&&!(o&16)){if(o&8){const f=t.vnode.dynamicProps;for(let u=0;u{c=!0;const[h,d]=Op(u,e,!0);Xt(o,h),d&&a.push(...d)};!n&&e.mixins.length&&e.mixins.forEach(f),t.extends&&f(t.extends),t.mixins&&t.mixins.forEach(f)}if(!r&&!c)return gt(t)&&i.set(t,Cs),Cs;if(Oe(r))for(let f=0;ft[0]==="_"||t==="$stable",Ol=t=>Oe(t)?t.map(Dn):[Dn(t)],m_=(t,e,n)=>{if(e._n)return e;const i=z0((...s)=>Ol(e(...s)),n);return i._c=!1,i},zp=(t,e,n)=>{const i=t._ctx;for(const s in t){if(Bp(s))continue;const r=t[s];if(Fe(r))e[s]=m_(s,r,i);else if(r!=null){const o=Ol(r);e[s]=()=>o}}},Vp=(t,e)=>{const n=Ol(e);t.slots.default=()=>n},Hp=(t,e,n)=>{for(const i in e)(n||i!=="_")&&(t[i]=e[i])},g_=(t,e,n)=>{const i=t.slots=Ip();if(t.vnode.shapeFlag&32){const s=e._;s?(Hp(i,e,n),n&&np(i,"_",s,!0)):zp(e,i)}else e&&Vp(t,e)},__=(t,e,n)=>{const{vnode:i,slots:s}=t;let r=!0,o=nt;if(i.shapeFlag&32){const a=e._;a?n&&a===1?r=!1:Hp(s,e,n):(r=!e.$stable,zp(e,s)),o=e}else e&&(Vp(t,e),o={default:1});if(r)for(const a in s)!Bp(a)&&o[a]==null&&delete s[a]},sn=L_;function v_(t){return x_(t)}function x_(t,e){const n=sa();n.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:c,setText:l,setElementText:f,parentNode:u,nextSibling:h,setScopeId:d=Nn,insertStaticContent:_}=t,g=(P,L,V,ne=null,Q=null,te=null,pe=void 0,se=null,ae=!!L.dynamicChildren)=>{if(P===L)return;P&&!er(P,L)&&(ne=R(P),ce(P,Q,te,!0),P=null),L.patchFlag===-2&&(ae=!1,L.dynamicChildren=null);const{type:oe,ref:A,shapeFlag:S}=L;switch(oe){case ca:m(P,L,V,ne);break;case Ur:p(P,L,V,ne);break;case Na:P==null&&y(L,V,ne,pe);break;case Qn:B(P,L,V,ne,Q,te,pe,se,ae);break;default:S&1?M(P,L,V,ne,Q,te,pe,se,ae):S&6?U(P,L,V,ne,Q,te,pe,se,ae):(S&64||S&128)&&oe.process(P,L,V,ne,Q,te,pe,se,ae,ue)}A!=null&&Q&&qo(A,P&&P.ref,te,L||P,!L)},m=(P,L,V,ne)=>{if(P==null)i(L.el=a(L.children),V,ne);else{const Q=L.el=P.el;L.children!==P.children&&l(Q,L.children)}},p=(P,L,V,ne)=>{P==null?i(L.el=c(L.children||""),V,ne):L.el=P.el},y=(P,L,V,ne)=>{[P.el,P.anchor]=_(P.children,L,V,ne,P.el,P.anchor)},E=({el:P,anchor:L},V,ne)=>{let Q;for(;P&&P!==L;)Q=h(P),i(P,V,ne),P=Q;i(L,V,ne)},v=({el:P,anchor:L})=>{let V;for(;P&&P!==L;)V=h(P),s(P),P=V;s(L)},M=(P,L,V,ne,Q,te,pe,se,ae)=>{L.type==="svg"?pe="svg":L.type==="math"&&(pe="mathml"),P==null?b(L,V,ne,Q,te,pe,se,ae):x(P,L,Q,te,pe,se,ae)},b=(P,L,V,ne,Q,te,pe,se)=>{let ae,oe;const{props:A,shapeFlag:S,transition:O,dirs:q}=P;if(ae=P.el=o(P.type,te,A&&A.is,A),S&8?f(ae,P.children):S&16&&D(P.children,ae,null,ne,Q,Ua(P,te),pe,se),q&&Pi(P,null,ne,"created"),w(ae,P,P.scopeId,pe,ne),A){for(const fe in A)fe!=="value"&&!Mr(fe)&&r(ae,fe,null,A[fe],te,ne);"value"in A&&r(ae,"value",null,A.value,te),(oe=A.onVnodeBeforeMount)&&An(oe,ne,P)}q&&Pi(P,null,ne,"beforeMount");const Z=M_(Q,O);Z&&O.beforeEnter(ae),i(ae,L,V),((oe=A&&A.onVnodeMounted)||Z||q)&&sn(()=>{oe&&An(oe,ne,P),Z&&O.enter(ae),q&&Pi(P,null,ne,"mounted")},Q)},w=(P,L,V,ne,Q)=>{if(V&&d(P,V),ne)for(let te=0;te{for(let oe=ae;oe{const se=L.el=P.el;let{patchFlag:ae,dynamicChildren:oe,dirs:A}=L;ae|=P.patchFlag&16;const S=P.props||nt,O=L.props||nt;let q;if(V&&Li(V,!1),(q=O.onVnodeBeforeUpdate)&&An(q,V,L,P),A&&Pi(L,P,V,"beforeUpdate"),V&&Li(V,!0),(S.innerHTML&&O.innerHTML==null||S.textContent&&O.textContent==null)&&f(se,""),oe?T(P.dynamicChildren,oe,se,V,ne,Ua(L,Q),te):pe||k(P,L,se,null,V,ne,Ua(L,Q),te,!1),ae>0){if(ae&16)I(se,S,O,V,Q);else if(ae&2&&S.class!==O.class&&r(se,"class",null,O.class,Q),ae&4&&r(se,"style",S.style,O.style,Q),ae&8){const Z=L.dynamicProps;for(let fe=0;fe{q&&An(q,V,L,P),A&&Pi(L,P,V,"updated")},ne)},T=(P,L,V,ne,Q,te,pe)=>{for(let se=0;se{if(L!==V){if(L!==nt)for(const te in L)!Mr(te)&&!(te in V)&&r(P,te,L[te],null,Q,ne);for(const te in V){if(Mr(te))continue;const pe=V[te],se=L[te];pe!==se&&te!=="value"&&r(P,te,se,pe,Q,ne)}"value"in V&&r(P,"value",L.value,V.value,Q)}},B=(P,L,V,ne,Q,te,pe,se,ae)=>{const oe=L.el=P?P.el:a(""),A=L.anchor=P?P.anchor:a("");let{patchFlag:S,dynamicChildren:O,slotScopeIds:q}=L;q&&(se=se?se.concat(q):q),P==null?(i(oe,V,ne),i(A,V,ne),D(L.children||[],V,A,Q,te,pe,se,ae)):S>0&&S&64&&O&&P.dynamicChildren?(T(P.dynamicChildren,O,V,Q,te,pe,se),(L.key!=null||Q&&L===Q.subTree)&&Gp(P,L,!0)):k(P,L,V,A,Q,te,pe,se,ae)},U=(P,L,V,ne,Q,te,pe,se,ae)=>{L.slotScopeIds=se,P==null?L.shapeFlag&512?Q.ctx.activate(L,V,ne,pe,ae):F(L,V,ne,Q,te,pe,ae):z(P,L,ae)},F=(P,L,V,ne,Q,te,pe)=>{const se=P.component=V_(P,ne,Q);if(Ap(P)&&(se.ctx.renderer=ue),H_(se,!1,pe),se.asyncDep){if(Q&&Q.registerDep(se,H,pe),!P.el){const ae=se.subTree=si(Ur);p(null,ae,L,V)}}else H(se,P,L,V,Q,te,pe)},z=(P,L,V)=>{const ne=L.component=P.component;if(C_(P,L,V))if(ne.asyncDep&&!ne.asyncResolved){$(ne,L,V);return}else ne.next=L,ne.update();else L.el=P.el,ne.vnode=L},H=(P,L,V,ne,Q,te,pe)=>{const se=()=>{if(P.isMounted){let{next:S,bu:O,u:q,parent:Z,vnode:fe}=P;{const Ae=$p(P);if(Ae){S&&(S.el=fe.el,$(P,S,pe)),Ae.asyncDep.then(()=>{P.isUnmounted||se()});return}}let xe=S,Me;Li(P,!1),S?(S.el=fe.el,$(P,S,pe)):S=fe,O&&Oo(O),(Me=S.props&&S.props.onVnodeBeforeUpdate)&&An(Me,Z,S,fe),Li(P,!0);const Y=wf(P),be=P.subTree;P.subTree=Y,g(be,Y,u(be.el),R(be),P,Q,te),S.el=Y.el,xe===null&&P_(P,Y.el),q&&sn(q,Q),(Me=S.props&&S.props.onVnodeUpdated)&&sn(()=>An(Me,Z,S,fe),Q)}else{let S;const{el:O,props:q}=L,{bm:Z,m:fe,parent:xe,root:Me,type:Y}=P,be=br(L);Li(P,!1),Z&&Oo(Z),!be&&(S=q&&q.onVnodeBeforeMount)&&An(S,xe,L),Li(P,!0);{Me.ce&&Me.ce._injectChildStyle(Y);const Ae=P.subTree=wf(P);g(null,Ae,V,ne,P,Q,te),L.el=Ae.el}if(fe&&sn(fe,Q),!be&&(S=q&&q.onVnodeMounted)){const Ae=L;sn(()=>An(S,xe,Ae),Q)}(L.shapeFlag&256||xe&&br(xe.vnode)&&xe.vnode.shapeFlag&256)&&P.a&&sn(P.a,Q),P.isMounted=!0,L=V=ne=null}};P.scope.on();const ae=P.effect=new sp(se);P.scope.off();const oe=P.update=ae.run.bind(ae),A=P.job=ae.runIfDirty.bind(ae);A.i=P,A.id=P.uid,ae.scheduler=()=>Nl(A),Li(P,!0),oe()},$=(P,L,V)=>{L.component=P;const ne=P.vnode.props;P.vnode=L,P.next=null,d_(P,L.props,ne,V),__(P,L.children,V),Ti(),_f(P),wi()},k=(P,L,V,ne,Q,te,pe,se,ae=!1)=>{const oe=P&&P.children,A=P?P.shapeFlag:0,S=L.children,{patchFlag:O,shapeFlag:q}=L;if(O>0){if(O&128){ie(oe,S,V,ne,Q,te,pe,se,ae);return}else if(O&256){le(oe,S,V,ne,Q,te,pe,se,ae);return}}q&8?(A&16&&ve(oe,Q,te),S!==oe&&f(V,S)):A&16?q&16?ie(oe,S,V,ne,Q,te,pe,se,ae):ve(oe,Q,te,!0):(A&8&&f(V,""),q&16&&D(S,V,ne,Q,te,pe,se,ae))},le=(P,L,V,ne,Q,te,pe,se,ae)=>{P=P||Cs,L=L||Cs;const oe=P.length,A=L.length,S=Math.min(oe,A);let O;for(O=0;OA?ve(P,Q,te,!0,!1,S):D(L,V,ne,Q,te,pe,se,ae,S)},ie=(P,L,V,ne,Q,te,pe,se,ae)=>{let oe=0;const A=L.length;let S=P.length-1,O=A-1;for(;oe<=S&&oe<=O;){const q=P[oe],Z=L[oe]=ae?Ei(L[oe]):Dn(L[oe]);if(er(q,Z))g(q,Z,V,null,Q,te,pe,se,ae);else break;oe++}for(;oe<=S&&oe<=O;){const q=P[S],Z=L[O]=ae?Ei(L[O]):Dn(L[O]);if(er(q,Z))g(q,Z,V,null,Q,te,pe,se,ae);else break;S--,O--}if(oe>S){if(oe<=O){const q=O+1,Z=qO)for(;oe<=S;)ce(P[oe],Q,te,!0),oe++;else{const q=oe,Z=oe,fe=new Map;for(oe=Z;oe<=O;oe++){const Ee=L[oe]=ae?Ei(L[oe]):Dn(L[oe]);Ee.key!=null&&fe.set(Ee.key,oe)}let xe,Me=0;const Y=O-Z+1;let be=!1,Ae=0;const Le=new Array(Y);for(oe=0;oe=Y){ce(Ee,Q,te,!0);continue}let Ie;if(Ee.key!=null)Ie=fe.get(Ee.key);else for(xe=Z;xe<=O;xe++)if(Le[xe-Z]===0&&er(Ee,L[xe])){Ie=xe;break}Ie===void 0?ce(Ee,Q,te,!0):(Le[Ie-Z]=oe+1,Ie>=Ae?Ae=Ie:be=!0,g(Ee,L[Ie],V,null,Q,te,pe,se,ae),Me++)}const Te=be?E_(Le):Cs;for(xe=Te.length-1,oe=Y-1;oe>=0;oe--){const Ee=Z+oe,Ie=L[Ee],je=Ee+1{const{el:te,type:pe,transition:se,children:ae,shapeFlag:oe}=P;if(oe&6){we(P.component.subTree,L,V,ne);return}if(oe&128){P.suspense.move(L,V,ne);return}if(oe&64){pe.move(P,L,V,ue);return}if(pe===Qn){i(te,L,V);for(let S=0;Sse.enter(te),Q);else{const{leave:S,delayLeave:O,afterLeave:q}=se,Z=()=>i(te,L,V),fe=()=>{S(te,()=>{Z(),q&&q()})};O?O(te,Z,fe):fe()}else i(te,L,V)},ce=(P,L,V,ne=!1,Q=!1)=>{const{type:te,props:pe,ref:se,children:ae,dynamicChildren:oe,shapeFlag:A,patchFlag:S,dirs:O,cacheIndex:q}=P;if(S===-2&&(Q=!1),se!=null&&qo(se,null,V,P,!0),q!=null&&(L.renderCache[q]=void 0),A&256){L.ctx.deactivate(P);return}const Z=A&1&&O,fe=!br(P);let xe;if(fe&&(xe=pe&&pe.onVnodeBeforeUnmount)&&An(xe,L,P),A&6)me(P.component,V,ne);else{if(A&128){P.suspense.unmount(V,ne);return}Z&&Pi(P,null,L,"beforeUnmount"),A&64?P.type.remove(P,L,V,ue,ne):oe&&!oe.hasOnce&&(te!==Qn||S>0&&S&64)?ve(oe,L,V,!1,!0):(te===Qn&&S&384||!Q&&A&16)&&ve(ae,L,V),ne&&j(P)}(fe&&(xe=pe&&pe.onVnodeUnmounted)||Z)&&sn(()=>{xe&&An(xe,L,P),Z&&Pi(P,null,L,"unmounted")},V)},j=P=>{const{type:L,el:V,anchor:ne,transition:Q}=P;if(L===Qn){re(V,ne);return}if(L===Na){v(P);return}const te=()=>{s(V),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(P.shapeFlag&1&&Q&&!Q.persisted){const{leave:pe,delayLeave:se}=Q,ae=()=>pe(V,te);se?se(P.el,te,ae):ae()}else te()},re=(P,L)=>{let V;for(;P!==L;)V=h(P),s(P),P=V;s(L)},me=(P,L,V)=>{const{bum:ne,scope:Q,job:te,subTree:pe,um:se,m:ae,a:oe}=P;Tf(ae),Tf(oe),ne&&Oo(ne),Q.stop(),te&&(te.flags|=8,ce(pe,P,L,V)),se&&sn(se,L),sn(()=>{P.isUnmounted=!0},L),L&&L.pendingBranch&&!L.isUnmounted&&P.asyncDep&&!P.asyncResolved&&P.suspenseId===L.pendingId&&(L.deps--,L.deps===0&&L.resolve())},ve=(P,L,V,ne=!1,Q=!1,te=0)=>{for(let pe=te;pe{if(P.shapeFlag&6)return R(P.component.subTree);if(P.shapeFlag&128)return P.suspense.next();const L=h(P.anchor||P.el),V=L&&L[V0];return V?h(V):L};let de=!1;const Se=(P,L,V)=>{P==null?L._vnode&&ce(L._vnode,null,null,!0):g(L._vnode||null,P,L,null,null,null,V),L._vnode=P,de||(de=!0,_f(),yp(),de=!1)},ue={p:g,um:ce,m:we,r:j,mt:F,mc:D,pc:k,pbc:T,n:R,o:t};return{render:Se,hydrate:void 0,createApp:f_(Se)}}function Ua({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function Li({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function M_(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Gp(t,e,n=!1){const i=t.children,s=e.children;if(Oe(i)&&Oe(s))for(let r=0;r>1,t[n[a]]0&&(e[i]=n[r-1]),n[r]=i)}}for(r=n.length,o=n[r-1];r-- >0;)n[r]=o,o=e[o];return n}function $p(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:$p(e)}function Tf(t){if(t)for(let e=0;eBo(S_);function Ia(t,e,n){return kp(t,e,n)}function kp(t,e,n=nt){const{immediate:i,deep:s,flush:r,once:o}=n,a=Xt({},n),c=e&&i||!e&&r!=="post";let l;if(Nr){if(r==="sync"){const d=y_();l=d.__watcherHandles||(d.__watcherHandles=[])}else if(!c){const d=()=>{};return d.stop=Nn,d.resume=Nn,d.pause=Nn,d}}const f=Ut;a.call=(d,_,g)=>On(d,f,_,g);let u=!1;r==="post"?a.scheduler=d=>{sn(d,f&&f.suspense)}:r!=="sync"&&(u=!0,a.scheduler=(d,_)=>{_?d():Nl(d)}),a.augmentJob=d=>{e&&(d.flags|=4),u&&(d.flags|=2,f&&(d.id=f.uid,d.i=f))};const h=I0(t,e,a);return Nr&&(l?l.push(h):c&&h()),h}function b_(t,e,n){const i=this.proxy,s=Tt(t)?t.includes(".")?Wp(i,t):()=>i[t]:t.bind(i,i);let r;Fe(e)?r=e:(r=e.handler,n=e);const o=Gr(this),a=kp(s,r.bind(i),n);return o(),a}function Wp(t,e){const n=e.split(".");return()=>{let i=t;for(let s=0;se==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${mn(e)}Modifiers`]||t[`${Qi(e)}Modifiers`];function w_(t,e,...n){if(t.isUnmounted)return;const i=t.vnode.props||nt;let s=n;const r=e.startsWith("update:"),o=r&&T_(i,e.slice(7));o&&(o.trim&&(s=n.map(f=>Tt(f)?f.trim():f)),o.number&&(s=n.map(Xc)));let a,c=i[a=Ra(e)]||i[a=Ra(mn(e))];!c&&r&&(c=i[a=Ra(Qi(e))]),c&&On(c,t,6,s);const l=i[a+"Once"];if(l){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,On(l,t,6,s)}}function Xp(t,e,n=!1){const i=e.emitsCache,s=i.get(t);if(s!==void 0)return s;const r=t.emits;let o={},a=!1;if(!Fe(t)){const c=l=>{const f=Xp(l,e,!0);f&&(a=!0,Xt(o,f))};!n&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}return!r&&!a?(gt(t)&&i.set(t,null),null):(Oe(r)?r.forEach(c=>o[c]=null):Xt(o,r),gt(t)&&i.set(t,o),o)}function aa(t,e){return!t||!ea(e)?!1:(e=e.slice(2).replace(/Once$/,""),Ze(t,e[0].toLowerCase()+e.slice(1))||Ze(t,Qi(e))||Ze(t,e))}function wf(t){const{type:e,vnode:n,proxy:i,withProxy:s,propsOptions:[r],slots:o,attrs:a,emit:c,render:l,renderCache:f,props:u,data:h,setupState:d,ctx:_,inheritAttrs:g}=t,m=Xo(t);let p,y;try{if(n.shapeFlag&4){const v=s||i,M=v;p=Dn(l.call(M,v,f,u,d,h,_)),y=a}else{const v=e;p=Dn(v.length>1?v(u,{attrs:a,slots:o,emit:c}):v(u,null)),y=e.props?a:A_(a)}}catch(v){wr.length=0,ra(v,t,1),p=si(Ur)}let E=p;if(y&&g!==!1){const v=Object.keys(y),{shapeFlag:M}=E;v.length&&M&7&&(r&&v.some(Sl)&&(y=R_(y,r)),E=Fs(E,y,!1,!0))}return n.dirs&&(E=Fs(E,null,!1,!0),E.dirs=E.dirs?E.dirs.concat(n.dirs):n.dirs),n.transition&&Fl(E,n.transition),p=E,Xo(m),p}const A_=t=>{let e;for(const n in t)(n==="class"||n==="style"||ea(n))&&((e||(e={}))[n]=t[n]);return e},R_=(t,e)=>{const n={};for(const i in t)(!Sl(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function C_(t,e,n){const{props:i,children:s,component:r}=t,{props:o,children:a,patchFlag:c}=e,l=r.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return i?Af(i,o,l):!!o;if(c&8){const f=e.dynamicProps;for(let u=0;ut.__isSuspense;function L_(t,e){e&&e.pendingBranch?Oe(t)?e.effects.push(...t):e.effects.push(t):B0(t)}const Qn=Symbol.for("v-fgt"),ca=Symbol.for("v-txt"),Ur=Symbol.for("v-cmt"),Na=Symbol.for("v-stc"),wr=[];let cn=null;function Bl(t=!1){wr.push(cn=t?null:[])}function D_(){wr.pop(),cn=wr[wr.length-1]||null}let Ir=1;function Rf(t,e=!1){Ir+=t,t<0&&cn&&e&&(cn.hasOnce=!0)}function U_(t){return t.dynamicChildren=Ir>0?cn||Cs:null,D_(),Ir>0&&cn&&cn.push(t),t}function zl(t,e,n,i,s,r){return U_(ft(t,e,n,i,s,r,!0))}function Yp(t){return t?t.__v_isVNode===!0:!1}function er(t,e){return t.type===e.type&&t.key===e.key}const jp=({key:t})=>t??null,zo=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?Tt(t)||Wt(t)||Fe(t)?{i:an,r:t,k:e,f:!!n}:t:null);function ft(t,e=null,n=null,i=0,s=null,r=t===Qn?0:1,o=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&jp(e),ref:e&&zo(e),scopeId:Tp,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:an};return a?(Vl(c,n),r&128&&t.normalize(c)):n&&(c.shapeFlag|=Tt(n)?8:16),Ir>0&&!o&&cn&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&cn.push(c),c}const si=I_;function I_(t,e=null,n=null,i=0,s=null,r=!1){if((!t||t===t_)&&(t=Ur),Yp(t)){const a=Fs(t,e,!0);return n&&Vl(a,n),Ir>0&&!r&&cn&&(a.shapeFlag&6?cn[cn.indexOf(t)]=a:cn.push(a)),a.patchFlag=-2,a}if(X_(t)&&(t=t.__vccOpts),e){e=N_(e);let{class:a,style:c}=e;a&&!Tt(a)&&(e.class=wl(a)),gt(c)&&(Il(c)&&!Oe(c)&&(c=Xt({},c)),e.style=Tl(c))}const o=Tt(t)?1:qp(t)?128:H0(t)?64:gt(t)?4:Fe(t)?2:0;return ft(t,e,n,i,s,o,r,!0)}function N_(t){return t?Il(t)||Np(t)?Xt({},t):t:null}function Fs(t,e,n=!1,i=!1){const{props:s,ref:r,patchFlag:o,children:a,transition:c}=t,l=e?O_(s||{},e):s,f={__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&jp(l),ref:e&&e.ref?n&&r?Oe(r)?r.concat(zo(e)):[r,zo(e)]:zo(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Qn?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:c,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Fs(t.ssContent),ssFallback:t.ssFallback&&Fs(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return c&&i&&Fl(f,c.clone(f)),f}function F_(t=" ",e=0){return si(ca,null,t,e)}function Dn(t){return t==null||typeof t=="boolean"?si(Ur):Oe(t)?si(Qn,null,t.slice()):Yp(t)?Ei(t):si(ca,null,String(t))}function Ei(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Fs(t)}function Vl(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(Oe(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Vl(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!Np(e)?e._ctx=an:s===3&&an&&(an.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Fe(e)?(e={default:e,_ctx:an},n=32):(e=String(e),i&64?(n=16,e=[F_(e)]):n=8);t.children=e,t.shapeFlag|=n}function O_(...t){const e={};for(let n=0;n{let s;return(s=t[n])||(s=t[n]=[]),s.push(i),r=>{s.length>1?s.forEach(o=>o(r)):s[0](r)}};jo=e("__VUE_INSTANCE_SETTERS__",n=>Ut=n),nl=e("__VUE_SSR_SETTERS__",n=>Nr=n)}const Gr=t=>{const e=Ut;return jo(t),t.scope.on(),()=>{t.scope.off(),jo(e)}},Cf=()=>{Ut&&Ut.scope.off(),jo(null)};function Zp(t){return t.vnode.shapeFlag&4}let Nr=!1;function H_(t,e=!1,n=!1){e&&nl(e);const{props:i,children:s}=t.vnode,r=Zp(t);h_(t,i,r,e),g_(t,s,n);const o=r?G_(t,e):void 0;return e&&nl(!1),o}function G_(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,i_);const{setup:i}=n;if(i){Ti();const s=t.setupContext=i.length>1?k_(t):null,r=Gr(t),o=Hr(i,t,0,[t.props,s]),a=tp(o);if(wi(),r(),(a||t.sp)&&!br(t)&&wp(t),a){if(o.then(Cf,Cf),e)return o.then(c=>{Pf(t,c)}).catch(c=>{ra(c,t,0)});t.asyncDep=o}else Pf(t,o)}else Kp(t)}function Pf(t,e,n){Fe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:gt(e)&&(t.setupState=Mp(e)),Kp(t)}function Kp(t,e,n){const i=t.type;t.render||(t.render=i.render||Nn);{const s=Gr(t);Ti();try{s_(t)}finally{wi(),s()}}}const $_={get(t,e){return Dt(t,"get",""),t[e]}};function k_(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,$_),slots:t.slots,emit:t.emit,expose:e}}function la(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Mp(R0(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in Tr)return Tr[n](t)},has(e,n){return n in e||n in Tr}})):t.proxy}function W_(t,e=!0){return Fe(t)?t.displayName||t.name:t.name||e&&t.__name}function X_(t){return Fe(t)&&"__vccOpts"in t}const q_=(t,e)=>D0(t,e,Nr),Y_="3.5.13";/** +**/function eo(t,e,n,i){try{return i?t(...i):t()}catch(s){Sa(s,e,n)}}function Ln(t,e,n,i){if(Oe(t)){const s=eo(t,e,n,i);return s&&Tp(s)&&s.catch(r=>{Sa(r,e,n)}),s}if(Ie(t)){const s=[];for(let r=0;r>>1,s=kt[i],r=kr(s);r=kr(n)?kt.push(t):kt.splice(x_(e),0,t),t.flags|=1,Kp()}}function Kp(){sa||(sa=Zp.then(Qp))}function M_(t){Ie(t)?ks.push(...t):bi&&t.id===-1?bi.splice(Fs+1,0,t):t.flags&1||(ks.push(t),t.flags|=1),Kp()}function Nf(t,e,n=On+1){for(;nkr(n)-kr(i));if(ks.length=0,bi){bi.push(...e);return}for(bi=e,Fs=0;Fst.id==null?t.flags&2?-1:1/0:t.id;function Qp(t){try{for(On=0;On{i._d&&Xf(-1);const r=ra(e);let o;try{o=t(...s)}finally{ra(r),i._d&&Xf(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function wr(t,e){if(Jt===null)return t;const n=Aa(Jt),i=t.dirs||(t.dirs=[]);for(let s=0;st.__isTeleport,Ti=Symbol("_leaveCb"),ho=Symbol("_enterCb");function S_(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return fm(()=>{t.isMounted=!0}),um(()=>{t.isUnmounting=!0}),t}const dn=[Function,Array],im={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:dn,onEnter:dn,onAfterEnter:dn,onEnterCancelled:dn,onBeforeLeave:dn,onLeave:dn,onAfterLeave:dn,onLeaveCancelled:dn,onBeforeAppear:dn,onAppear:dn,onAfterAppear:dn,onAppearCancelled:dn},sm=t=>{const e=t.subTree;return e.component?sm(e.component):e},y_={name:"BaseTransition",props:im,setup(t,{slots:e}){const n=yv(),i=S_();return()=>{const s=e.default&&am(e.default(),!0);if(!s||!s.length)return;const r=rm(s),o=Ke(t),{mode:a}=o;if(i.isLeaving)return Ja(r);const c=Ff(r);if(!c)return Ja(r);let l=El(c,o,i,n,u=>l=u);c.type!==_n&&Wr(c,l);let f=n.subTree&&Ff(n.subTree);if(f&&f.type!==_n&&!Yi(c,f)&&sm(n).type!==_n){let u=El(f,o,i,n);if(Wr(f,u),a==="out-in"&&c.type!==_n)return i.isLeaving=!0,u.afterLeave=()=>{i.isLeaving=!1,n.job.flags&8||n.update(),delete u.afterLeave,f=void 0},Ja(r);a==="in-out"&&c.type!==_n?u.delayLeave=(h,d,_)=>{const g=om(i,f);g[String(f.key)]=f,h[Ti]=()=>{d(),h[Ti]=void 0,delete l.delayedLeave,f=void 0},l.delayedLeave=()=>{_(),delete l.delayedLeave,f=void 0}}:f=void 0}else f&&(f=void 0);return r}}};function rm(t){let e=t[0];if(t.length>1){for(const n of t)if(n.type!==_n){e=n;break}}return e}const b_=y_;function om(t,e){const{leavingVNodes:n}=t;let i=n.get(e.type);return i||(i=Object.create(null),n.set(e.type,i)),i}function El(t,e,n,i,s){const{appear:r,mode:o,persisted:a=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:f,onEnterCancelled:u,onBeforeLeave:h,onLeave:d,onAfterLeave:_,onLeaveCancelled:g,onBeforeAppear:m,onAppear:p,onAfterAppear:y,onAppearCancelled:E}=e,x=String(t.key),M=om(n,t),b=(v,T)=>{v&&Ln(v,i,9,T)},w=(v,T)=>{const N=T[1];b(v,T),Ie(v)?v.every(U=>U.length<=1)&&N():v.length<=1&&N()},D={mode:o,persisted:a,beforeEnter(v){let T=c;if(!n.isMounted)if(r)T=m||c;else return;v[Ti]&&v[Ti](!0);const N=M[x];N&&Yi(t,N)&&N.el[Ti]&&N.el[Ti](),b(T,[v])},enter(v){let T=l,N=f,U=u;if(!n.isMounted)if(r)T=p||l,N=y||f,U=E||u;else return;let I=!1;const F=v[ho]=B=>{I||(I=!0,B?b(U,[v]):b(N,[v]),D.delayedLeave&&D.delayedLeave(),v[ho]=void 0)};T?w(T,[v,F]):F()},leave(v,T){const N=String(t.key);if(v[ho]&&v[ho](!0),n.isUnmounting)return T();b(h,[v]);let U=!1;const I=v[Ti]=F=>{U||(U=!0,T(),F?b(g,[v]):b(_,[v]),v[Ti]=void 0,M[N]===t&&delete M[N])};M[N]=t,d?w(d,[v,I]):I()},clone(v){const T=El(v,e,n,i,s);return s&&s(T),T}};return D}function Ja(t){if(ya(t))return t=Ci(t),t.children=null,t}function Ff(t){if(!ya(t))return nm(t.type)&&t.children?rm(t.children):t;const{shapeFlag:e,children:n}=t;if(n){if(e&16)return n[0];if(e&32&&Oe(n.default))return n.default()}}function Wr(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Wr(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function am(t,e=!1,n){let i=[],s=0;for(let r=0;r1)for(let r=0;roa(_,e&&(Ie(e)?e[g]:e),n,i,s));return}if(Fr(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&oa(t,e,n,i.component.subTree);return}const r=i.shapeFlag&4?Aa(i.component):i.el,o=s?null:r,{i:a,r:c}=t,l=e&&e.r,f=a.refs===it?a.refs={}:a.refs,u=a.setupState,h=Ke(u),d=u===it?()=>!1:_=>Ze(h,_);if(l!=null&&l!==c&&(ht(l)?(f[l]=null,d(l)&&(u[l]=null)):qt(l)&&(l.value=null)),Oe(c))eo(c,a,12,[o,f]);else{const _=ht(c),g=qt(c);if(_||g){const m=()=>{if(t.f){const p=_?d(c)?u[c]:f[c]:c.value;s?Ie(p)&&ql(p,r):Ie(p)?p.includes(r)||p.push(r):_?(f[c]=[r],d(c)&&(u[c]=f[c])):(c.value=[r],t.k&&(f[t.k]=c.value))}else _?(f[c]=o,d(c)&&(u[c]=o)):g&&(c.value=o,t.k&&(f[t.k]=o))};o?(m.id=-1,an(m,n)):m()}}}xa().requestIdleCallback;xa().cancelIdleCallback;const Fr=t=>!!t.type.__asyncLoader,ya=t=>t.type.__isKeepAlive;function T_(t,e){lm(t,"a",e)}function w_(t,e){lm(t,"da",e)}function lm(t,e,n=At){const i=t.__wdc||(t.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(ba(e,i,n),n){let s=n.parent;for(;s&&s.parent;)ya(s.parent.vnode)&&A_(i,e,n,s),s=s.parent}}function A_(t,e,n,i){const s=ba(e,t,i,!0);hm(()=>{ql(i[e],s)},n)}function ba(t,e,n=At,i=!1){if(n){const s=n[t]||(n[t]=[]),r=e.__weh||(e.__weh=(...o)=>{Di();const a=to(n),c=Ln(e,n,t,o);return a(),Ui(),c});return i?s.unshift(r):s.push(r),r}}const ui=t=>(e,n=At)=>{(!qr||t==="sp")&&ba(t,(...i)=>e(...i),n)},R_=ui("bm"),fm=ui("m"),C_=ui("bu"),P_=ui("u"),um=ui("bum"),hm=ui("um"),L_=ui("sp"),D_=ui("rtg"),U_=ui("rtc");function I_(t,e=At){ba("ec",t,e)}const N_="components";function Qa(t,e){return O_(N_,t,!0,e)||t}const F_=Symbol.for("v-ndc");function O_(t,e,n=!0,i=!1){const s=Jt||At;if(s){const r=s.type;{const a=Rv(r,!1);if(a&&(a===e||a===vn(e)||a===va(vn(e))))return r}const o=Of(s[t]||r[t],e)||Of(s.appContext[t],e);return!o&&i?r:o}}function Of(t,e){return t&&(t[e]||t[vn(e)]||t[va(vn(e))])}function B_(t,e,n,i){let s;const r=n,o=Ie(t);if(o||ht(t)){const a=o&&$s(t);let c=!1;a&&(c=!Pn(t),t=Ea(t)),s=new Array(t.length);for(let l=0,f=t.length;le(a,c,void 0,r));else{const a=Object.keys(t);s=new Array(a.length);for(let c=0,l=a.length;ct?Dm(t)?Aa(t):Sl(t.parent):null,Or=Rt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Sl(t.parent),$root:t=>Sl(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>pm(t),$forceUpdate:t=>t.f||(t.f=()=>{sf(t.update)}),$nextTick:t=>t.n||(t.n=v_.bind(t.proxy)),$watch:t=>ov.bind(t)}),ec=(t,e)=>t!==it&&!t.__isScriptSetup&&Ze(t,e),z_={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:i,data:s,props:r,accessCache:o,type:a,appContext:c}=t;let l;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return i[e];case 2:return s[e];case 4:return n[e];case 3:return r[e]}else{if(ec(i,e))return o[e]=1,i[e];if(s!==it&&Ze(s,e))return o[e]=2,s[e];if((l=t.propsOptions[0])&&Ze(l,e))return o[e]=3,r[e];if(n!==it&&Ze(n,e))return o[e]=4,n[e];yl&&(o[e]=0)}}const f=Or[e];let u,h;if(f)return e==="$attrs"&&It(t.attrs,"get",""),f(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(n!==it&&Ze(n,e))return o[e]=4,n[e];if(h=c.config.globalProperties,Ze(h,e))return h[e]},set({_:t},e,n){const{data:i,setupState:s,ctx:r}=t;return ec(s,e)?(s[e]=n,!0):i!==it&&Ze(i,e)?(i[e]=n,!0):Ze(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:i,appContext:s,propsOptions:r}},o){let a;return!!n[o]||t!==it&&Ze(t,o)||ec(e,o)||(a=r[0])&&Ze(a,o)||Ze(i,o)||Ze(Or,o)||Ze(s.config.globalProperties,o)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:Ze(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Bf(t){return Ie(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}let yl=!0;function H_(t){const e=pm(t),n=t.proxy,i=t.ctx;yl=!1,e.beforeCreate&&zf(e.beforeCreate,t,"bc");const{data:s,computed:r,methods:o,watch:a,provide:c,inject:l,created:f,beforeMount:u,mounted:h,beforeUpdate:d,updated:_,activated:g,deactivated:m,beforeDestroy:p,beforeUnmount:y,destroyed:E,unmounted:x,render:M,renderTracked:b,renderTriggered:w,errorCaptured:D,serverPrefetch:v,expose:T,inheritAttrs:N,components:U,directives:I,filters:F}=e;if(l&&V_(l,i,null),o)for(const $ in o){const k=o[$];Oe(k)&&(i[$]=k.bind(n))}if(s){const $=s.call(n,n);ct($)&&(t.data=ef($))}if(yl=!0,r)for(const $ in r){const k=r[$],le=Oe(k)?k.bind(n,n):Oe(k.get)?k.get.bind(n,n):Vn,ie=!Oe(k)&&Oe(k.set)?k.set.bind(n):Vn,we=Pv({get:le,set:ie});Object.defineProperty(i,$,{enumerable:!0,configurable:!0,get:()=>we.value,set:ce=>we.value=ce})}if(a)for(const $ in a)dm(a[$],i,n,$);if(c){const $=Oe(c)?c.call(n):c;Reflect.ownKeys($).forEach(k=>{q_(k,$[k])})}f&&zf(f,t,"c");function V($,k){Ie(k)?k.forEach(le=>$(le.bind(n))):k&&$(k.bind(n))}if(V(R_,u),V(fm,h),V(C_,d),V(P_,_),V(T_,g),V(w_,m),V(I_,D),V(U_,b),V(D_,w),V(um,y),V(hm,x),V(L_,v),Ie(T))if(T.length){const $=t.exposed||(t.exposed={});T.forEach(k=>{Object.defineProperty($,k,{get:()=>n[k],set:le=>n[k]=le})})}else t.exposed||(t.exposed={});M&&t.render===Vn&&(t.render=M),N!=null&&(t.inheritAttrs=N),U&&(t.components=U),I&&(t.directives=I),v&&cm(t)}function V_(t,e,n=Vn){Ie(t)&&(t=bl(t));for(const i in t){const s=t[i];let r;ct(s)?"default"in s?r=Ko(s.from||i,s.default,!0):r=Ko(s.from||i):r=Ko(s),qt(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function zf(t,e,n){Ln(Ie(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function dm(t,e,n,i){let s=i.includes(".")?Rm(n,i):()=>n[i];if(ht(t)){const r=e[t];Oe(r)&&nc(s,r)}else if(Oe(t))nc(s,t.bind(n));else if(ct(t))if(Ie(t))t.forEach(r=>dm(r,e,n,i));else{const r=Oe(t.handler)?t.handler.bind(n):e[t.handler];Oe(r)&&nc(s,r,t)}}function pm(t){const e=t.type,{mixins:n,extends:i}=e,{mixins:s,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,a=r.get(e);let c;return a?c=a:!s.length&&!n&&!i?c=e:(c={},s.length&&s.forEach(l=>aa(c,l,o,!0)),aa(c,e,o)),ct(e)&&r.set(e,c),c}function aa(t,e,n,i=!1){const{mixins:s,extends:r}=e;r&&aa(t,r,n,!0),s&&s.forEach(o=>aa(t,o,n,!0));for(const o in e)if(!(i&&o==="expose")){const a=G_[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const G_={data:Hf,props:Vf,emits:Vf,methods:Ar,computed:Ar,beforeCreate:Ht,created:Ht,beforeMount:Ht,mounted:Ht,beforeUpdate:Ht,updated:Ht,beforeDestroy:Ht,beforeUnmount:Ht,destroyed:Ht,unmounted:Ht,activated:Ht,deactivated:Ht,errorCaptured:Ht,serverPrefetch:Ht,components:Ar,directives:Ar,watch:k_,provide:Hf,inject:$_};function Hf(t,e){return e?t?function(){return Rt(Oe(t)?t.call(this,this):t,Oe(e)?e.call(this,this):e)}:e:t}function $_(t,e){return Ar(bl(t),bl(e))}function bl(t){if(Ie(t)){const e={};for(let n=0;n1)return n&&Oe(e)?e.call(i&&i.proxy):e}}const gm={},_m=()=>Object.create(gm),vm=t=>Object.getPrototypeOf(t)===gm;function j_(t,e,n,i=!1){const s={},r=_m();t.propsDefaults=Object.create(null),xm(t,e,s,r);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);n?t.props=i?s:l_(s):t.type.props?t.props=s:t.props=r,t.attrs=r}function Y_(t,e,n,i){const{props:s,attrs:r,vnode:{patchFlag:o}}=t,a=Ke(s),[c]=t.propsOptions;let l=!1;if((i||o>0)&&!(o&16)){if(o&8){const f=t.vnode.dynamicProps;for(let u=0;u{c=!0;const[h,d]=Mm(u,e,!0);Rt(o,h),d&&a.push(...d)};!n&&e.mixins.length&&e.mixins.forEach(f),t.extends&&f(t.extends),t.mixins&&t.mixins.forEach(f)}if(!r&&!c)return ct(t)&&i.set(t,Vs),Vs;if(Ie(r))for(let f=0;ft[0]==="_"||t==="$stable",rf=t=>Ie(t)?t.map(Bn):[Bn(t)],K_=(t,e,n)=>{if(e._n)return e;const i=tm((...s)=>rf(e(...s)),n);return i._c=!1,i},Sm=(t,e,n)=>{const i=t._ctx;for(const s in t){if(Em(s))continue;const r=t[s];if(Oe(r))e[s]=K_(s,r,i);else if(r!=null){const o=rf(r);e[s]=()=>o}}},ym=(t,e)=>{const n=rf(e);t.slots.default=()=>n},bm=(t,e,n)=>{for(const i in e)(n||i!=="_")&&(t[i]=e[i])},J_=(t,e,n)=>{const i=t.slots=_m();if(t.vnode.shapeFlag&32){const s=e._;s?(bm(i,e,n),n&&Rp(i,"_",s,!0)):Sm(e,i)}else e&&ym(t,e)},Q_=(t,e,n)=>{const{vnode:i,slots:s}=t;let r=!0,o=it;if(i.shapeFlag&32){const a=e._;a?n&&a===1?r=!1:bm(s,e,n):(r=!e.$stable,Sm(e,s)),o=e}else e&&(ym(t,e),o={default:1});if(r)for(const a in s)!Em(a)&&o[a]==null&&delete s[a]},an=dv;function ev(t){return tv(t)}function tv(t,e){const n=xa();n.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:c,setText:l,setElementText:f,parentNode:u,nextSibling:h,setScopeId:d=Vn,insertStaticContent:_}=t,g=(P,L,H,ne=null,Q=null,te=null,pe=void 0,se=null,ae=!!L.dynamicChildren)=>{if(P===L)return;P&&!Yi(P,L)&&(ne=R(P),ce(P,Q,te,!0),P=null),L.patchFlag===-2&&(ae=!1,L.dynamicChildren=null);const{type:oe,ref:A,shapeFlag:S}=L;switch(oe){case wa:m(P,L,H,ne);break;case _n:p(P,L,H,ne);break;case ic:P==null&&y(L,H,ne,pe);break;case Tn:U(P,L,H,ne,Q,te,pe,se,ae);break;default:S&1?M(P,L,H,ne,Q,te,pe,se,ae):S&6?I(P,L,H,ne,Q,te,pe,se,ae):(S&64||S&128)&&oe.process(P,L,H,ne,Q,te,pe,se,ae,ue)}A!=null&&Q&&oa(A,P&&P.ref,te,L||P,!L)},m=(P,L,H,ne)=>{if(P==null)i(L.el=a(L.children),H,ne);else{const Q=L.el=P.el;L.children!==P.children&&l(Q,L.children)}},p=(P,L,H,ne)=>{P==null?i(L.el=c(L.children||""),H,ne):L.el=P.el},y=(P,L,H,ne)=>{[P.el,P.anchor]=_(P.children,L,H,ne,P.el,P.anchor)},E=({el:P,anchor:L},H,ne)=>{let Q;for(;P&&P!==L;)Q=h(P),i(P,H,ne),P=Q;i(L,H,ne)},x=({el:P,anchor:L})=>{let H;for(;P&&P!==L;)H=h(P),s(P),P=H;s(L)},M=(P,L,H,ne,Q,te,pe,se,ae)=>{L.type==="svg"?pe="svg":L.type==="math"&&(pe="mathml"),P==null?b(L,H,ne,Q,te,pe,se,ae):v(P,L,Q,te,pe,se,ae)},b=(P,L,H,ne,Q,te,pe,se)=>{let ae,oe;const{props:A,shapeFlag:S,transition:z,dirs:q}=P;if(ae=P.el=o(P.type,te,A&&A.is,A),S&8?f(ae,P.children):S&16&&D(P.children,ae,null,ne,Q,tc(P,te),pe,se),q&&Oi(P,null,ne,"created"),w(ae,P,P.scopeId,pe,ne),A){for(const fe in A)fe!=="value"&&!Ur(fe)&&r(ae,fe,null,A[fe],te,ne);"value"in A&&r(ae,"value",null,A.value,te),(oe=A.onVnodeBeforeMount)&&Un(oe,ne,P)}q&&Oi(P,null,ne,"beforeMount");const Z=nv(Q,z);Z&&z.beforeEnter(ae),i(ae,L,H),((oe=A&&A.onVnodeMounted)||Z||q)&&an(()=>{oe&&Un(oe,ne,P),Z&&z.enter(ae),q&&Oi(P,null,ne,"mounted")},Q)},w=(P,L,H,ne,Q)=>{if(H&&d(P,H),ne)for(let te=0;te{for(let oe=ae;oe{const se=L.el=P.el;let{patchFlag:ae,dynamicChildren:oe,dirs:A}=L;ae|=P.patchFlag&16;const S=P.props||it,z=L.props||it;let q;if(H&&Bi(H,!1),(q=z.onVnodeBeforeUpdate)&&Un(q,H,L,P),A&&Oi(L,P,H,"beforeUpdate"),H&&Bi(H,!0),(S.innerHTML&&z.innerHTML==null||S.textContent&&z.textContent==null)&&f(se,""),oe?T(P.dynamicChildren,oe,se,H,ne,tc(L,Q),te):pe||k(P,L,se,null,H,ne,tc(L,Q),te,!1),ae>0){if(ae&16)N(se,S,z,H,Q);else if(ae&2&&S.class!==z.class&&r(se,"class",null,z.class,Q),ae&4&&r(se,"style",S.style,z.style,Q),ae&8){const Z=L.dynamicProps;for(let fe=0;fe{q&&Un(q,H,L,P),A&&Oi(L,P,H,"updated")},ne)},T=(P,L,H,ne,Q,te,pe)=>{for(let se=0;se{if(L!==H){if(L!==it)for(const te in L)!Ur(te)&&!(te in H)&&r(P,te,L[te],null,Q,ne);for(const te in H){if(Ur(te))continue;const pe=H[te],se=L[te];pe!==se&&te!=="value"&&r(P,te,se,pe,Q,ne)}"value"in H&&r(P,"value",L.value,H.value,Q)}},U=(P,L,H,ne,Q,te,pe,se,ae)=>{const oe=L.el=P?P.el:a(""),A=L.anchor=P?P.anchor:a("");let{patchFlag:S,dynamicChildren:z,slotScopeIds:q}=L;q&&(se=se?se.concat(q):q),P==null?(i(oe,H,ne),i(A,H,ne),D(L.children||[],H,A,Q,te,pe,se,ae)):S>0&&S&64&&z&&P.dynamicChildren?(T(P.dynamicChildren,z,H,Q,te,pe,se),(L.key!=null||Q&&L===Q.subTree)&&Tm(P,L,!0)):k(P,L,H,A,Q,te,pe,se,ae)},I=(P,L,H,ne,Q,te,pe,se,ae)=>{L.slotScopeIds=se,P==null?L.shapeFlag&512?Q.ctx.activate(L,H,ne,pe,ae):F(L,H,ne,Q,te,pe,ae):B(P,L,ae)},F=(P,L,H,ne,Q,te,pe)=>{const se=P.component=Sv(P,ne,Q);if(ya(P)&&(se.ctx.renderer=ue),bv(se,!1,pe),se.asyncDep){if(Q&&Q.registerDep(se,V,pe),!P.el){const ae=se.subTree=Xt(_n);p(null,ae,L,H)}}else V(se,P,L,H,Q,te,pe)},B=(P,L,H)=>{const ne=L.component=P.component;if(uv(P,L,H))if(ne.asyncDep&&!ne.asyncResolved){$(ne,L,H);return}else ne.next=L,ne.update();else L.el=P.el,ne.vnode=L},V=(P,L,H,ne,Q,te,pe)=>{const se=()=>{if(P.isMounted){let{next:S,bu:z,u:q,parent:Z,vnode:fe}=P;{const Ae=wm(P);if(Ae){S&&(S.el=fe.el,$(P,S,pe)),Ae.asyncDep.then(()=>{P.isUnmounted||se()});return}}let xe=S,Me;Bi(P,!1),S?(S.el=fe.el,$(P,S,pe)):S=fe,z&&Zo(z),(Me=S.props&&S.props.onVnodeBeforeUpdate)&&Un(Me,Z,S,fe),Bi(P,!0);const j=kf(P),be=P.subTree;P.subTree=j,g(be,j,u(be.el),R(be),P,Q,te),S.el=j.el,xe===null&&hv(P,j.el),q&&an(q,Q),(Me=S.props&&S.props.onVnodeUpdated)&&an(()=>Un(Me,Z,S,fe),Q)}else{let S;const{el:z,props:q}=L,{bm:Z,m:fe,parent:xe,root:Me,type:j}=P,be=Fr(L);Bi(P,!1),Z&&Zo(Z),!be&&(S=q&&q.onVnodeBeforeMount)&&Un(S,xe,L),Bi(P,!0);{Me.ce&&Me.ce._injectChildStyle(j);const Ae=P.subTree=kf(P);g(null,Ae,H,ne,P,Q,te),L.el=Ae.el}if(fe&&an(fe,Q),!be&&(S=q&&q.onVnodeMounted)){const Ae=L;an(()=>Un(S,xe,Ae),Q)}(L.shapeFlag&256||xe&&Fr(xe.vnode)&&xe.vnode.shapeFlag&256)&&P.a&&an(P.a,Q),P.isMounted=!0,L=H=ne=null}};P.scope.on();const ae=P.effect=new Up(se);P.scope.off();const oe=P.update=ae.run.bind(ae),A=P.job=ae.runIfDirty.bind(ae);A.i=P,A.id=P.uid,ae.scheduler=()=>sf(A),Bi(P,!0),oe()},$=(P,L,H)=>{L.component=P;const ne=P.vnode.props;P.vnode=L,P.next=null,Y_(P,L.props,ne,H),Q_(P,L.children,H),Di(),Nf(P),Ui()},k=(P,L,H,ne,Q,te,pe,se,ae=!1)=>{const oe=P&&P.children,A=P?P.shapeFlag:0,S=L.children,{patchFlag:z,shapeFlag:q}=L;if(z>0){if(z&128){ie(oe,S,H,ne,Q,te,pe,se,ae);return}else if(z&256){le(oe,S,H,ne,Q,te,pe,se,ae);return}}q&8?(A&16&&ve(oe,Q,te),S!==oe&&f(H,S)):A&16?q&16?ie(oe,S,H,ne,Q,te,pe,se,ae):ve(oe,Q,te,!0):(A&8&&f(H,""),q&16&&D(S,H,ne,Q,te,pe,se,ae))},le=(P,L,H,ne,Q,te,pe,se,ae)=>{P=P||Vs,L=L||Vs;const oe=P.length,A=L.length,S=Math.min(oe,A);let z;for(z=0;zA?ve(P,Q,te,!0,!1,S):D(L,H,ne,Q,te,pe,se,ae,S)},ie=(P,L,H,ne,Q,te,pe,se,ae)=>{let oe=0;const A=L.length;let S=P.length-1,z=A-1;for(;oe<=S&&oe<=z;){const q=P[oe],Z=L[oe]=ae?wi(L[oe]):Bn(L[oe]);if(Yi(q,Z))g(q,Z,H,null,Q,te,pe,se,ae);else break;oe++}for(;oe<=S&&oe<=z;){const q=P[S],Z=L[z]=ae?wi(L[z]):Bn(L[z]);if(Yi(q,Z))g(q,Z,H,null,Q,te,pe,se,ae);else break;S--,z--}if(oe>S){if(oe<=z){const q=z+1,Z=qz)for(;oe<=S;)ce(P[oe],Q,te,!0),oe++;else{const q=oe,Z=oe,fe=new Map;for(oe=Z;oe<=z;oe++){const Ee=L[oe]=ae?wi(L[oe]):Bn(L[oe]);Ee.key!=null&&fe.set(Ee.key,oe)}let xe,Me=0;const j=z-Z+1;let be=!1,Ae=0;const Le=new Array(j);for(oe=0;oe=j){ce(Ee,Q,te,!0);continue}let Ne;if(Ee.key!=null)Ne=fe.get(Ee.key);else for(xe=Z;xe<=z;xe++)if(Le[xe-Z]===0&&Yi(Ee,L[xe])){Ne=xe;break}Ne===void 0?ce(Ee,Q,te,!0):(Le[Ne-Z]=oe+1,Ne>=Ae?Ae=Ne:be=!0,g(Ee,L[Ne],H,null,Q,te,pe,se,ae),Me++)}const Te=be?iv(Le):Vs;for(xe=Te.length-1,oe=j-1;oe>=0;oe--){const Ee=Z+oe,Ne=L[Ee],Ye=Ee+1{const{el:te,type:pe,transition:se,children:ae,shapeFlag:oe}=P;if(oe&6){we(P.component.subTree,L,H,ne);return}if(oe&128){P.suspense.move(L,H,ne);return}if(oe&64){pe.move(P,L,H,ue);return}if(pe===Tn){i(te,L,H);for(let S=0;Sse.enter(te),Q);else{const{leave:S,delayLeave:z,afterLeave:q}=se,Z=()=>i(te,L,H),fe=()=>{S(te,()=>{Z(),q&&q()})};z?z(te,Z,fe):fe()}else i(te,L,H)},ce=(P,L,H,ne=!1,Q=!1)=>{const{type:te,props:pe,ref:se,children:ae,dynamicChildren:oe,shapeFlag:A,patchFlag:S,dirs:z,cacheIndex:q}=P;if(S===-2&&(Q=!1),se!=null&&oa(se,null,H,P,!0),q!=null&&(L.renderCache[q]=void 0),A&256){L.ctx.deactivate(P);return}const Z=A&1&&z,fe=!Fr(P);let xe;if(fe&&(xe=pe&&pe.onVnodeBeforeUnmount)&&Un(xe,L,P),A&6)me(P.component,H,ne);else{if(A&128){P.suspense.unmount(H,ne);return}Z&&Oi(P,null,L,"beforeUnmount"),A&64?P.type.remove(P,L,H,ue,ne):oe&&!oe.hasOnce&&(te!==Tn||S>0&&S&64)?ve(oe,L,H,!1,!0):(te===Tn&&S&384||!Q&&A&16)&&ve(ae,L,H),ne&&Y(P)}(fe&&(xe=pe&&pe.onVnodeUnmounted)||Z)&&an(()=>{xe&&Un(xe,L,P),Z&&Oi(P,null,L,"unmounted")},H)},Y=P=>{const{type:L,el:H,anchor:ne,transition:Q}=P;if(L===Tn){re(H,ne);return}if(L===ic){x(P);return}const te=()=>{s(H),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(P.shapeFlag&1&&Q&&!Q.persisted){const{leave:pe,delayLeave:se}=Q,ae=()=>pe(H,te);se?se(P.el,te,ae):ae()}else te()},re=(P,L)=>{let H;for(;P!==L;)H=h(P),s(P),P=H;s(L)},me=(P,L,H)=>{const{bum:ne,scope:Q,job:te,subTree:pe,um:se,m:ae,a:oe}=P;$f(ae),$f(oe),ne&&Zo(ne),Q.stop(),te&&(te.flags|=8,ce(pe,P,L,H)),se&&an(se,L),an(()=>{P.isUnmounted=!0},L),L&&L.pendingBranch&&!L.isUnmounted&&P.asyncDep&&!P.asyncResolved&&P.suspenseId===L.pendingId&&(L.deps--,L.deps===0&&L.resolve())},ve=(P,L,H,ne=!1,Q=!1,te=0)=>{for(let pe=te;pe{if(P.shapeFlag&6)return R(P.component.subTree);if(P.shapeFlag&128)return P.suspense.next();const L=h(P.anchor||P.el),H=L&&L[E_];return H?h(H):L};let de=!1;const Se=(P,L,H)=>{P==null?L._vnode&&ce(L._vnode,null,null,!0):g(L._vnode||null,P,L,null,null,null,H),L._vnode=P,de||(de=!0,Nf(),Jp(),de=!1)},ue={p:g,um:ce,m:we,r:Y,mt:F,mc:D,pc:k,pbc:T,n:R,o:t};return{render:Se,hydrate:void 0,createApp:X_(Se)}}function tc({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function Bi({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function nv(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Tm(t,e,n=!1){const i=t.children,s=e.children;if(Ie(i)&&Ie(s))for(let r=0;r>1,t[n[a]]0&&(e[i]=n[r-1]),n[r]=i)}}for(r=n.length,o=n[r-1];r-- >0;)n[r]=o,o=e[o];return n}function wm(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:wm(e)}function $f(t){if(t)for(let e=0;eKo(sv);function nc(t,e,n){return Am(t,e,n)}function Am(t,e,n=it){const{immediate:i,deep:s,flush:r,once:o}=n,a=Rt({},n),c=e&&i||!e&&r!=="post";let l;if(qr){if(r==="sync"){const d=rv();l=d.__watcherHandles||(d.__watcherHandles=[])}else if(!c){const d=()=>{};return d.stop=Vn,d.resume=Vn,d.pause=Vn,d}}const f=At;a.call=(d,_,g)=>Ln(d,f,_,g);let u=!1;r==="post"?a.scheduler=d=>{an(d,f&&f.suspense)}:r!=="sync"&&(u=!0,a.scheduler=(d,_)=>{_?d():sf(d)}),a.augmentJob=d=>{e&&(d.flags|=4),u&&(d.flags|=2,f&&(d.id=f.uid,d.i=f))};const h=g_(t,e,a);return qr&&(l?l.push(h):c&&h()),h}function ov(t,e,n){const i=this.proxy,s=ht(t)?t.includes(".")?Rm(i,t):()=>i[t]:t.bind(i,i);let r;Oe(e)?r=e:(r=e.handler,n=e);const o=to(this),a=Am(s,r.bind(i),n);return o(),a}function Rm(t,e){const n=e.split(".");return()=>{let i=t;for(let s=0;se==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${vn(e)}Modifiers`]||t[`${us(e)}Modifiers`];function cv(t,e,...n){if(t.isUnmounted)return;const i=t.vnode.props||it;let s=n;const r=e.startsWith("update:"),o=r&&av(i,e.slice(7));o&&(o.trim&&(s=n.map(f=>ht(f)?f.trim():f)),o.number&&(s=n.map(ml)));let a,c=i[a=qa(e)]||i[a=qa(vn(e))];!c&&r&&(c=i[a=qa(us(e))]),c&&Ln(c,t,6,s);const l=i[a+"Once"];if(l){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,Ln(l,t,6,s)}}function Cm(t,e,n=!1){const i=e.emitsCache,s=i.get(t);if(s!==void 0)return s;const r=t.emits;let o={},a=!1;if(!Oe(t)){const c=l=>{const f=Cm(l,e,!0);f&&(a=!0,Rt(o,f))};!n&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}return!r&&!a?(ct(t)&&i.set(t,null),null):(Ie(r)?r.forEach(c=>o[c]=null):Rt(o,r),ct(t)&&i.set(t,o),o)}function Ta(t,e){return!t||!ma(e)?!1:(e=e.slice(2).replace(/Once$/,""),Ze(t,e[0].toLowerCase()+e.slice(1))||Ze(t,us(e))||Ze(t,e))}function kf(t){const{type:e,vnode:n,proxy:i,withProxy:s,propsOptions:[r],slots:o,attrs:a,emit:c,render:l,renderCache:f,props:u,data:h,setupState:d,ctx:_,inheritAttrs:g}=t,m=ra(t);let p,y;try{if(n.shapeFlag&4){const x=s||i,M=x;p=Bn(l.call(M,x,f,u,d,h,_)),y=a}else{const x=e;p=Bn(x.length>1?x(u,{attrs:a,slots:o,emit:c}):x(u,null)),y=e.props?a:lv(a)}}catch(x){Br.length=0,Sa(x,t,1),p=Xt(_n)}let E=p;if(y&&g!==!1){const x=Object.keys(y),{shapeFlag:M}=E;x.length&&M&7&&(r&&x.some(Xl)&&(y=fv(y,r)),E=Ci(E,y,!1,!0))}return n.dirs&&(E=Ci(E,null,!1,!0),E.dirs=E.dirs?E.dirs.concat(n.dirs):n.dirs),n.transition&&Wr(E,n.transition),p=E,ra(m),p}const lv=t=>{let e;for(const n in t)(n==="class"||n==="style"||ma(n))&&((e||(e={}))[n]=t[n]);return e},fv=(t,e)=>{const n={};for(const i in t)(!Xl(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function uv(t,e,n){const{props:i,children:s,component:r}=t,{props:o,children:a,patchFlag:c}=e,l=r.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return i?Wf(i,o,l):!!o;if(c&8){const f=e.dynamicProps;for(let u=0;ut.__isSuspense;function dv(t,e){e&&e.pendingBranch?Ie(t)?e.effects.push(...t):e.effects.push(t):M_(t)}const Tn=Symbol.for("v-fgt"),wa=Symbol.for("v-txt"),_n=Symbol.for("v-cmt"),ic=Symbol.for("v-stc"),Br=[];let ln=null;function Qi(t=!1){Br.push(ln=t?null:[])}function pv(){Br.pop(),ln=Br[Br.length-1]||null}let Xr=1;function Xf(t,e=!1){Xr+=t,t<0&&ln&&e&&(ln.hasOnce=!0)}function mv(t){return t.dynamicChildren=Xr>0?ln||Vs:null,pv(),Xr>0&&ln&&ln.push(t),t}function es(t,e,n,i,s,r){return mv(nt(t,e,n,i,s,r,!0))}function ca(t){return t?t.__v_isVNode===!0:!1}function Yi(t,e){return t.type===e.type&&t.key===e.key}const Lm=({key:t})=>t??null,Jo=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?ht(t)||qt(t)||Oe(t)?{i:Jt,r:t,k:e,f:!!n}:t:null);function nt(t,e=null,n=null,i=0,s=null,r=t===Tn?0:1,o=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Lm(e),ref:e&&Jo(e),scopeId:em,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Jt};return a?(of(c,n),r&128&&t.normalize(c)):n&&(c.shapeFlag|=ht(n)?8:16),Xr>0&&!o&&ln&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&ln.push(c),c}const Xt=gv;function gv(t,e=null,n=null,i=0,s=null,r=!1){if((!t||t===F_)&&(t=_n),ca(t)){const a=Ci(t,e,!0);return n&&of(a,n),Xr>0&&!r&&ln&&(a.shapeFlag&6?ln[ln.indexOf(t)]=a:ln.push(a)),a.patchFlag=-2,a}if(Cv(t)&&(t=t.__vccOpts),e){e=_v(e);let{class:a,style:c}=e;a&&!ht(a)&&(e.class=Ma(a)),ct(c)&&(nf(c)&&!Ie(c)&&(c=Rt({},c)),e.style=Yl(c))}const o=ht(t)?1:Pm(t)?128:nm(t)?64:ct(t)?4:Oe(t)?2:0;return nt(t,e,n,i,s,o,r,!0)}function _v(t){return t?nf(t)||vm(t)?Rt({},t):t:null}function Ci(t,e,n=!1,i=!1){const{props:s,ref:r,patchFlag:o,children:a,transition:c}=t,l=e?xv(s||{},e):s,f={__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&Lm(l),ref:e&&e.ref?n&&r?Ie(r)?r.concat(Jo(e)):[r,Jo(e)]:Jo(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Tn?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:c,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ci(t.ssContent),ssFallback:t.ssFallback&&Ci(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return c&&i&&Wr(f,c.clone(f)),f}function vv(t=" ",e=0){return Xt(wa,null,t,e)}function Bn(t){return t==null||typeof t=="boolean"?Xt(_n):Ie(t)?Xt(Tn,null,t.slice()):ca(t)?wi(t):Xt(wa,null,String(t))}function wi(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ci(t)}function of(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(Ie(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),of(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!vm(e)?e._ctx=Jt:s===3&&Jt&&(Jt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Oe(e)?(e={default:e,_ctx:Jt},n=32):(e=String(e),i&64?(n=16,e=[vv(e)]):n=8);t.children=e,t.shapeFlag|=n}function xv(...t){const e={};for(let n=0;nAt||Jt;let la,wl;{const t=xa(),e=(n,i)=>{let s;return(s=t[n])||(s=t[n]=[]),s.push(i),r=>{s.length>1?s.forEach(o=>o(r)):s[0](r)}};la=e("__VUE_INSTANCE_SETTERS__",n=>At=n),wl=e("__VUE_SSR_SETTERS__",n=>qr=n)}const to=t=>{const e=At;return la(t),t.scope.on(),()=>{t.scope.off(),la(e)}},qf=()=>{At&&At.scope.off(),la(null)};function Dm(t){return t.vnode.shapeFlag&4}let qr=!1;function bv(t,e=!1,n=!1){e&&wl(e);const{props:i,children:s}=t.vnode,r=Dm(t);j_(t,i,r,e),J_(t,s,n);const o=r?Tv(t,e):void 0;return e&&wl(!1),o}function Tv(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,z_);const{setup:i}=n;if(i){Di();const s=t.setupContext=i.length>1?Av(t):null,r=to(t),o=eo(i,t,0,[t.props,s]),a=Tp(o);if(Ui(),r(),(a||t.sp)&&!Fr(t)&&cm(t),a){if(o.then(qf,qf),e)return o.then(c=>{jf(t,c)}).catch(c=>{Sa(c,t,0)});t.asyncDep=o}else jf(t,o)}else Um(t)}function jf(t,e,n){Oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ct(e)&&(t.setupState=Yp(e)),Um(t)}function Um(t,e,n){const i=t.type;t.render||(t.render=i.render||Vn);{const s=to(t);Di();try{H_(t)}finally{Ui(),s()}}}const wv={get(t,e){return It(t,"get",""),t[e]}};function Av(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,wv),slots:t.slots,emit:t.emit,expose:e}}function Aa(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Yp(f_(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in Or)return Or[n](t)},has(e,n){return n in e||n in Or}})):t.proxy}function Rv(t,e=!0){return Oe(t)?t.displayName||t.name:t.name||e&&t.__name}function Cv(t){return Oe(t)&&"__vccOpts"in t}const Pv=(t,e)=>p_(t,e,qr);function Lv(t,e,n){const i=arguments.length;return i===2?ct(e)&&!Ie(e)?ca(e)?Xt(t,null,[e]):Xt(t,e):Xt(t,null,e):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&ca(n)&&(n=[n]),Xt(t,e,n))}const Dv="3.5.13";/** * @vue/runtime-dom v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let il;const Lf=typeof window<"u"&&window.trustedTypes;if(Lf)try{il=Lf.createPolicy("vue",{createHTML:t=>t})}catch{}const Jp=il?t=>il.createHTML(t):t=>t,j_="http://www.w3.org/2000/svg",Z_="http://www.w3.org/1998/Math/MathML",Jn=typeof document<"u"?document:null,Df=Jn&&Jn.createElement("template"),K_={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,i)=>{const s=e==="svg"?Jn.createElementNS(j_,t):e==="mathml"?Jn.createElementNS(Z_,t):n?Jn.createElement(t,{is:n}):Jn.createElement(t);return t==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:t=>Jn.createTextNode(t),createComment:t=>Jn.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Jn.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,i,s,r){const o=n?n.previousSibling:e.lastChild;if(s&&(s===r||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),n),!(s===r||!(s=s.nextSibling)););else{Df.innerHTML=Jp(i==="svg"?`${t}`:i==="mathml"?`${t}`:t);const a=Df.content;if(i==="svg"||i==="mathml"){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}e.insertBefore(a,n)}return[o?o.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}},J_=Symbol("_vtc");function Q_(t,e,n){const i=t[J_];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const Uf=Symbol("_vod"),ev=Symbol("_vsh"),tv=Symbol(""),nv=/(^|;)\s*display\s*:/;function iv(t,e,n){const i=t.style,s=Tt(n);let r=!1;if(n&&!s){if(e)if(Tt(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&Vo(i,a,"")}else for(const o in e)n[o]==null&&Vo(i,o,"");for(const o in n)o==="display"&&(r=!0),Vo(i,o,n[o])}else if(s){if(e!==n){const o=i[tv];o&&(n+=";"+o),i.cssText=n,r=nv.test(n)}}else e&&t.removeAttribute("style");Uf in t&&(t[Uf]=r?i.display:"",t[ev]&&(i.display="none"))}const If=/\s*!important$/;function Vo(t,e,n){if(Oe(n))n.forEach(i=>Vo(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=sv(t,e);If.test(n)?t.setProperty(Qi(i),n.replace(If,""),"important"):t[i]=n}}const Nf=["Webkit","Moz","ms"],Fa={};function sv(t,e){const n=Fa[e];if(n)return n;let i=mn(e);if(i!=="filter"&&i in t)return Fa[e]=i;i=ia(i);for(let s=0;sOa||(cv.then(()=>Oa=0),Oa=Date.now());function fv(t,e){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;On(uv(i,n.value),e,5,[i])};return n.value=t,n.attached=lv(),n}function uv(t,e){if(Oe(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(i=>s=>!s._stopped&&i&&i(s))}else return e}const Hf=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,hv=(t,e,n,i,s,r)=>{const o=s==="svg";e==="class"?Q_(t,i,o):e==="style"?iv(t,n,i):ea(e)?Sl(e)||ov(t,e,n,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):dv(t,e,i,o))?(Bf(t,e,i),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Of(t,e,i,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!Tt(i))?Bf(t,mn(e),i,r,e):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),Of(t,e,i,o))};function dv(t,e,n,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in t&&Hf(e)&&Fe(n));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=t.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Hf(e)&&Tt(n)?!1:e in t}const Gf=t=>{const e=t.props["onUpdate:modelValue"]||!1;return Oe(e)?n=>Oo(e,n):e};function pv(t){t.target.composing=!0}function $f(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Ba=Symbol("_assign"),eo={created(t,{modifiers:{lazy:e,trim:n,number:i}},s){t[Ba]=Gf(s);const r=i||s.props&&s.props.type==="number";Ts(t,e?"change":"input",o=>{if(o.target.composing)return;let a=t.value;n&&(a=a.trim()),r&&(a=Xc(a)),t[Ba](a)}),n&&Ts(t,"change",()=>{t.value=t.value.trim()}),e||(Ts(t,"compositionstart",pv),Ts(t,"compositionend",$f),Ts(t,"change",$f))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:n,modifiers:{lazy:i,trim:s,number:r}},o){if(t[Ba]=Gf(o),t.composing)return;const a=(r||t.type==="number")&&!/^0\d/.test(t.value)?Xc(t.value):t.value,c=e??"";a!==c&&(document.activeElement===t&&t.type!=="range"&&(i&&e===n||s&&t.value.trim()===c)||(t.value=c))}},mv=["ctrl","shift","alt","meta"],gv={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>mv.some(n=>t[`${n}Key`]&&!e.includes(n))},_v=(t,e)=>{const n=t._withMods||(t._withMods={}),i=e.join(".");return n[i]||(n[i]=(s,...r)=>{for(let o=0;o{const e=xv().createApp(...t),{mount:n}=e;return e.mount=i=>{const s=Sv(i);if(!s)return;const r=e._component;!Fe(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=n(s,!1,Ev(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e};function Ev(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Sv(t){return Tt(t)?document.querySelector(t):t}const Hl=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n},yv={name:"InputForm",props:{initialWidth:{type:Number,default:155},initialLength:{type:Number,default:105},initialSafety:{type:Number,default:0}},data(){return{localWidth:this.initialWidth,localLength:this.initialLength,localSafety:this.initialSafety}},methods:{emitValues(){this.$emit("update-dimensions",{width:this.localWidth,length:this.localLength,safety:this.localSafety})}}},bv={class:"flex-1 mb-4 sm:mb-0"},Tv={class:"flex-1 mb-4 sm:mb-0"},wv={class:"flex-1 mb-4 sm:mb-0"},Av={class:"flex items-center space-x-2 mt-1"};function Rv(t,e,n,i,s,r){return Bl(),zl("form",{onSubmit:e[4]||(e[4]=_v((...o)=>r.emitValues&&r.emitValues(...o),["prevent"])),class:"flex flex-col sm:flex-row sm:space-x-4 items-end",style:{width:"100%","max-width":"600px",margin:"0 auto","box-sizing":"border-box"}},[ft("div",bv,[e[5]||(e[5]=ft("label",{class:"block text-sm font-medium text-gray-700"},"Width (mm):",-1)),Qr(ft("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>s.localWidth=o),type:"number",placeholder:"Enter width",class:"mt-1 p-2 border border-gray-300 rounded-md w-full"},null,512),[[eo,s.localWidth,void 0,{number:!0}]])]),ft("div",Tv,[e[6]||(e[6]=ft("label",{class:"block text-sm font-medium text-gray-700"},"Length (mm):",-1)),Qr(ft("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>s.localLength=o),type:"number",placeholder:"Enter length",class:"mt-1 p-2 border border-gray-300 rounded-md w-full"},null,512),[[eo,s.localLength,void 0,{number:!0}]])]),ft("div",wv,[e[7]||(e[7]=ft("label",{class:"block text-sm font-medium text-gray-700"}," Safety Offset (mm): ",-1)),ft("div",Av,[Qr(ft("input",{type:"range","onUpdate:modelValue":e[2]||(e[2]=o=>s.localSafety=o),min:"-2",max:"2",step:"0.1",class:"w-full"},null,512),[[eo,s.localSafety,void 0,{number:!0}]]),Qr(ft("input",{type:"number","onUpdate:modelValue":e[3]||(e[3]=o=>s.localSafety=o),min:"-2",max:"2",step:"0.1",class:"p-2 border border-gray-300 rounded-md w-16"},null,512),[[eo,s.localSafety,void 0,{number:!0}]])])]),e[8]||(e[8]=ft("div",null,[ft("button",{type:"submit",class:"mt-4 sm:mt-0 px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600"}," Update ")],-1))],32)}const Cv=Hl(yv,[["render",Rv]]);/** +**/let Al;const Yf=typeof window<"u"&&window.trustedTypes;if(Yf)try{Al=Yf.createPolicy("vue",{createHTML:t=>t})}catch{}const Im=Al?t=>Al.createHTML(t):t=>t,Uv="http://www.w3.org/2000/svg",Iv="http://www.w3.org/1998/Math/MathML",ii=typeof document<"u"?document:null,Zf=ii&&ii.createElement("template"),Nv={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,i)=>{const s=e==="svg"?ii.createElementNS(Uv,t):e==="mathml"?ii.createElementNS(Iv,t):n?ii.createElement(t,{is:n}):ii.createElement(t);return t==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:t=>ii.createTextNode(t),createComment:t=>ii.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>ii.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,i,s,r){const o=n?n.previousSibling:e.lastChild;if(s&&(s===r||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),n),!(s===r||!(s=s.nextSibling)););else{Zf.innerHTML=Im(i==="svg"?`${t}`:i==="mathml"?`${t}`:t);const a=Zf.content;if(i==="svg"||i==="mathml"){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}e.insertBefore(a,n)}return[o?o.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}},pi="transition",hr="animation",jr=Symbol("_vtc"),Nm={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Fv=Rt({},im,Nm),Ov=t=>(t.displayName="Transition",t.props=Fv,t),Bv=Ov((t,{slots:e})=>Lv(b_,zv(t),e)),zi=(t,e=[])=>{Ie(t)?t.forEach(n=>n(...e)):t&&t(...e)},Kf=t=>t?Ie(t)?t.some(e=>e.length>1):t.length>1:!1;function zv(t){const e={};for(const U in t)U in Nm||(e[U]=t[U]);if(t.css===!1)return e;const{name:n="v",type:i,duration:s,enterFromClass:r=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:c=r,appearActiveClass:l=o,appearToClass:f=a,leaveFromClass:u=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:d=`${n}-leave-to`}=t,_=Hv(s),g=_&&_[0],m=_&&_[1],{onBeforeEnter:p,onEnter:y,onEnterCancelled:E,onLeave:x,onLeaveCancelled:M,onBeforeAppear:b=p,onAppear:w=y,onAppearCancelled:D=E}=e,v=(U,I,F,B)=>{U._enterCancelled=B,Hi(U,I?f:a),Hi(U,I?l:o),F&&F()},T=(U,I)=>{U._isLeaving=!1,Hi(U,u),Hi(U,d),Hi(U,h),I&&I()},N=U=>(I,F)=>{const B=U?w:y,V=()=>v(I,U,F);zi(B,[I,V]),Jf(()=>{Hi(I,U?c:r),kn(I,U?f:a),Kf(B)||Qf(I,i,g,V)})};return Rt(e,{onBeforeEnter(U){zi(p,[U]),kn(U,r),kn(U,o)},onBeforeAppear(U){zi(b,[U]),kn(U,c),kn(U,l)},onEnter:N(!1),onAppear:N(!0),onLeave(U,I){U._isLeaving=!0;const F=()=>T(U,I);kn(U,u),U._enterCancelled?(kn(U,h),nu()):(nu(),kn(U,h)),Jf(()=>{U._isLeaving&&(Hi(U,u),kn(U,d),Kf(x)||Qf(U,i,m,F))}),zi(x,[U,F])},onEnterCancelled(U){v(U,!1,void 0,!0),zi(E,[U])},onAppearCancelled(U){v(U,!0,void 0,!0),zi(D,[U])},onLeaveCancelled(U){T(U),zi(M,[U])}})}function Hv(t){if(t==null)return null;if(ct(t))return[sc(t.enter),sc(t.leave)];{const e=sc(t);return[e,e]}}function sc(t){return F0(t)}function kn(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.add(n)),(t[jr]||(t[jr]=new Set)).add(e)}function Hi(t,e){e.split(/\s+/).forEach(i=>i&&t.classList.remove(i));const n=t[jr];n&&(n.delete(e),n.size||(t[jr]=void 0))}function Jf(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let Vv=0;function Qf(t,e,n,i){const s=t._endId=++Vv,r=()=>{s===t._endId&&i()};if(n!=null)return setTimeout(r,n);const{type:o,timeout:a,propCount:c}=Gv(t,e);if(!o)return i();const l=o+"end";let f=0;const u=()=>{t.removeEventListener(l,h),r()},h=d=>{d.target===t&&++f>=c&&u()};setTimeout(()=>{f(n[_]||"").split(", "),s=i(`${pi}Delay`),r=i(`${pi}Duration`),o=eu(s,r),a=i(`${hr}Delay`),c=i(`${hr}Duration`),l=eu(a,c);let f=null,u=0,h=0;e===pi?o>0&&(f=pi,u=o,h=r.length):e===hr?l>0&&(f=hr,u=l,h=c.length):(u=Math.max(o,l),f=u>0?o>l?pi:hr:null,h=f?f===pi?r.length:c.length:0);const d=f===pi&&/\b(transform|all)(,|$)/.test(i(`${pi}Property`).toString());return{type:f,timeout:u,propCount:h,hasTransform:d}}function eu(t,e){for(;t.lengthtu(n)+tu(t[i])))}function tu(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function nu(){return document.body.offsetHeight}function $v(t,e,n){const i=t[jr];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const fa=Symbol("_vod"),Fm=Symbol("_vsh"),kv={beforeMount(t,{value:e},{transition:n}){t[fa]=t.style.display==="none"?"":t.style.display,n&&e?n.beforeEnter(t):dr(t,e)},mounted(t,{value:e},{transition:n}){n&&e&&n.enter(t)},updated(t,{value:e,oldValue:n},{transition:i}){!e!=!n&&(i?e?(i.beforeEnter(t),dr(t,!0),i.enter(t)):i.leave(t,()=>{dr(t,!1)}):dr(t,e))},beforeUnmount(t,{value:e}){dr(t,e)}};function dr(t,e){t.style.display=e?t[fa]:"none",t[Fm]=!e}const Wv=Symbol(""),Xv=/(^|;)\s*display\s*:/;function qv(t,e,n){const i=t.style,s=ht(n);let r=!1;if(n&&!s){if(e)if(ht(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&Qo(i,a,"")}else for(const o in e)n[o]==null&&Qo(i,o,"");for(const o in n)o==="display"&&(r=!0),Qo(i,o,n[o])}else if(s){if(e!==n){const o=i[Wv];o&&(n+=";"+o),i.cssText=n,r=Xv.test(n)}}else e&&t.removeAttribute("style");fa in t&&(t[fa]=r?i.display:"",t[Fm]&&(i.display="none"))}const iu=/\s*!important$/;function Qo(t,e,n){if(Ie(n))n.forEach(i=>Qo(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=jv(t,e);iu.test(n)?t.setProperty(us(i),n.replace(iu,""),"important"):t[i]=n}}const su=["Webkit","Moz","ms"],rc={};function jv(t,e){const n=rc[e];if(n)return n;let i=vn(e);if(i!=="filter"&&i in t)return rc[e]=i;i=va(i);for(let s=0;soc||(Jv.then(()=>oc=0),oc=Date.now());function ex(t,e){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;Ln(tx(i,n.value),e,5,[i])};return n.value=t,n.attached=Qv(),n}function tx(t,e){if(Ie(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(i=>s=>!s._stopped&&i&&i(s))}else return e}const fu=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,nx=(t,e,n,i,s,r)=>{const o=s==="svg";e==="class"?$v(t,i,o):e==="style"?qv(t,n,i):ma(e)?Xl(e)||Zv(t,e,n,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ix(t,e,i,o))?(au(t,e,i),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&ou(t,e,i,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ht(i))?au(t,vn(e),i,r,e):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),ou(t,e,i,o))};function ix(t,e,n,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in t&&fu(e)&&Oe(n));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=t.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return fu(e)&&ht(n)?!1:e in t}const uu=t=>{const e=t.props["onUpdate:modelValue"]||!1;return Ie(e)?n=>Zo(e,n):e};function sx(t){t.target.composing=!0}function hu(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const ac=Symbol("_assign"),po={created(t,{modifiers:{lazy:e,trim:n,number:i}},s){t[ac]=uu(s);const r=i||s.props&&s.props.type==="number";Os(t,e?"change":"input",o=>{if(o.target.composing)return;let a=t.value;n&&(a=a.trim()),r&&(a=ml(a)),t[ac](a)}),n&&Os(t,"change",()=>{t.value=t.value.trim()}),e||(Os(t,"compositionstart",sx),Os(t,"compositionend",hu),Os(t,"change",hu))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:n,modifiers:{lazy:i,trim:s,number:r}},o){if(t[ac]=uu(o),t.composing)return;const a=(r||t.type==="number")&&!/^0\d/.test(t.value)?ml(t.value):t.value,c=e??"";a!==c&&(document.activeElement===t&&t.type!=="range"&&(i&&e===n||s&&t.value.trim()===c)||(t.value=c))}},rx=["ctrl","shift","alt","meta"],ox={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>rx.some(n=>t[`${n}Key`]&&!e.includes(n))},ax=(t,e)=>{const n=t._withMods||(t._withMods={}),i=e.join(".");return n[i]||(n[i]=(s,...r)=>{for(let o=0;o{const e=lx().createApp(...t),{mount:n}=e;return e.mount=i=>{const s=hx(i);if(!s)return;const r=e._component;!Oe(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=n(s,!1,ux(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e};function ux(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function hx(t){return ht(t)?document.querySelector(t):t}const Ra=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n},dx={name:"InputForm",props:{initialWidth:{type:Number,default:155},initialLength:{type:Number,default:105},initialSafety:{type:Number,default:0}},data(){return{localWidth:this.initialWidth,localLength:this.initialLength,localSafety:this.initialSafety}},methods:{emitValues(){this.$emit("update-dimensions",{width:this.localWidth,length:this.localLength,safety:this.localSafety})}}},px={class:"flex-1 mb-4 sm:mb-0"},mx={class:"flex-1 mb-4 sm:mb-0"},gx={class:"flex-1 mb-4 sm:mb-0"},_x={class:"flex items-center space-x-2 mt-1"};function vx(t,e,n,i,s,r){return Qi(),es("form",{onSubmit:e[4]||(e[4]=ax((...o)=>r.emitValues&&r.emitValues(...o),["prevent"])),class:"flex flex-col sm:flex-row sm:space-x-4 items-end",style:{width:"100%","max-width":"600px",margin:"0 auto","box-sizing":"border-box"}},[nt("div",px,[e[5]||(e[5]=nt("label",{class:"block text-sm font-medium text-gray-700"},"Width (mm):",-1)),wr(nt("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>s.localWidth=o),type:"number",placeholder:"Enter width",class:"mt-1 p-2 border border-gray-300 rounded-md w-full"},null,512),[[po,s.localWidth,void 0,{number:!0}]])]),nt("div",mx,[e[6]||(e[6]=nt("label",{class:"block text-sm font-medium text-gray-700"},"Length (mm):",-1)),wr(nt("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>s.localLength=o),type:"number",placeholder:"Enter length",class:"mt-1 p-2 border border-gray-300 rounded-md w-full"},null,512),[[po,s.localLength,void 0,{number:!0}]])]),nt("div",gx,[e[7]||(e[7]=nt("label",{class:"block text-sm font-medium text-gray-700"}," Safety Offset (mm): ",-1)),nt("div",_x,[wr(nt("input",{type:"range","onUpdate:modelValue":e[2]||(e[2]=o=>s.localSafety=o),min:"-2",max:"2",step:"0.1",class:"w-full"},null,512),[[po,s.localSafety,void 0,{number:!0}]]),wr(nt("input",{type:"number","onUpdate:modelValue":e[3]||(e[3]=o=>s.localSafety=o),min:"-2",max:"2",step:"0.1",class:"p-2 border border-gray-300 rounded-md w-16"},null,512),[[po,s.localSafety,void 0,{number:!0}]])])]),e[8]||(e[8]=nt("div",null,[nt("button",{type:"submit",class:"mt-4 sm:mt-0 px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600"}," Update ")],-1))],32)}const xx=Ra(dx,[["render",vx]]);/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const Gl="152",za={ROTATE:0,DOLLY:1,PAN:2},Pv=0,Wf=1,Lv=2,Qp=1,Dv=2,Kn=3,bi=0,Zt=1,ni=2,yi=0,Ds=1,Xf=2,qf=3,Yf=4,Uv=5,ws=100,Iv=101,Nv=102,jf=103,Zf=104,Fv=200,Ov=201,Bv=202,zv=203,em=204,tm=205,Vv=206,Hv=207,Gv=208,$v=209,kv=210,Wv=0,Xv=1,qv=2,sl=3,Yv=4,jv=5,Zv=6,Kv=7,nm=0,Jv=1,Qv=2,ri=0,ex=1,tx=2,nx=3,ix=4,sx=5,im=300,Os=301,Bs=302,rl=303,ol=304,fa=306,al=1e3,yn=1001,cl=1002,Gt=1003,Kf=1004,Va=1005,dn=1006,rx=1007,Fr=1008,Zi=1009,ox=1010,ax=1011,sm=1012,cx=1013,$i=1014,ki=1015,Or=1016,lx=1017,fx=1018,Us=1020,ux=1021,bn=1023,hx=1024,dx=1025,qi=1026,zs=1027,px=1028,mx=1029,gx=1030,_x=1031,vx=1033,Ha=33776,Ga=33777,$a=33778,ka=33779,Jf=35840,Qf=35841,eu=35842,tu=35843,xx=36196,nu=37492,iu=37496,su=37808,ru=37809,ou=37810,au=37811,cu=37812,lu=37813,fu=37814,uu=37815,hu=37816,du=37817,pu=37818,mu=37819,gu=37820,_u=37821,Wa=36492,Mx=36283,vu=36284,xu=36285,Mu=36286,rm=3e3,Yi=3001,Ex=3200,Sx=3201,om=0,yx=1,ji="",Be="srgb",Bn="srgb-linear",am="display-p3",Xa=7680,bx=519,Eu=35044,Su="300 es",ll=1035;class es{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r>8&255]+Pt[t>>16&255]+Pt[t>>24&255]+"-"+Pt[e&255]+Pt[e>>8&255]+"-"+Pt[e>>16&15|64]+Pt[e>>24&255]+"-"+Pt[n&63|128]+Pt[n>>8&255]+"-"+Pt[n>>16&255]+Pt[n>>24&255]+Pt[i&255]+Pt[i>>8&255]+Pt[i>>16&255]+Pt[i>>24&255]).toLowerCase()}function kt(t,e,n){return Math.max(e,Math.min(n,t))}function $l(t,e){return(t%e+e)%e}function Tx(t,e,n,i,s){return i+(t-e)*(s-i)/(n-e)}function wx(t,e,n){return t!==e?(n-t)/(e-t):0}function Rr(t,e,n){return(1-n)*t+n*e}function Ax(t,e,n,i){return Rr(t,e,1-Math.exp(-n*i))}function Rx(t,e=1){return e-Math.abs($l(t,e*2)-e)}function Cx(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Px(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Lx(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Dx(t,e){return t+Math.random()*(e-t)}function Ux(t){return t*(.5-Math.random())}function Ix(t){t!==void 0&&(yu=t);let e=yu+=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 Nx(t){return t*Ar}function Fx(t){return t*Br}function fl(t){return(t&t-1)===0&&t!==0}function Ox(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function cm(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Bx(t,e,n,i,s){const r=Math.cos,o=Math.sin,a=r(n/2),c=o(n/2),l=r((e+i)/2),f=o((e+i)/2),u=r((e-i)/2),h=o((e-i)/2),d=r((i-e)/2),_=o((i-e)/2);switch(s){case"XYX":t.set(a*f,c*u,c*h,a*l);break;case"YZY":t.set(c*h,a*f,c*u,a*l);break;case"ZXZ":t.set(c*u,c*h,a*f,a*l);break;case"XZX":t.set(a*f,c*_,c*d,a*l);break;case"YXY":t.set(c*d,a*f,c*_,a*l);break;case"ZYZ":t.set(c*_,c*d,a*f,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function pr(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Yt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const bu={DEG2RAD:Ar,RAD2DEG:Br,generateUUID:Ws,clamp:kt,euclideanModulo:$l,mapLinear:Tx,inverseLerp:wx,lerp:Rr,damp:Ax,pingpong:Rx,smoothstep:Cx,smootherstep:Px,randInt:Lx,randFloat:Dx,randFloatSpread:Ux,seededRandom:Ix,degToRad:Nx,radToDeg:Fx,isPowerOfTwo:fl,ceilPowerOfTwo:Ox,floorPowerOfTwo:cm,setQuaternionFromProperEuler:Bx,normalize:Yt,denormalize:pr};class He{constructor(e=0,n=0){He.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,i=this.y,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6],this.y=s[1]*n+s[4]*i+s[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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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 n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(kt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),s=Math.sin(n),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qe{constructor(){qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,n,i,s,r,o,a,c,l){const f=this.elements;return f[0]=e,f[1]=s,f[2]=a,f[3]=n,f[4]=r,f[5]=c,f[6]=i,f[7]=o,f[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,r=this.elements,o=i[0],a=i[3],c=i[6],l=i[1],f=i[4],u=i[7],h=i[2],d=i[5],_=i[8],g=s[0],m=s[3],p=s[6],y=s[1],E=s[4],v=s[7],M=s[2],b=s[5],w=s[8];return r[0]=o*g+a*y+c*M,r[3]=o*m+a*E+c*b,r[6]=o*p+a*v+c*w,r[1]=l*g+f*y+u*M,r[4]=l*m+f*E+u*b,r[7]=l*p+f*v+u*w,r[2]=h*g+d*y+_*M,r[5]=h*m+d*E+_*b,r[8]=h*p+d*v+_*w,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8];return n*o*f-n*a*l-i*r*f+i*a*c+s*r*l-s*o*c}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],u=f*o-a*l,h=a*c-f*r,d=l*r-o*c,_=n*u+i*h+s*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=u*g,e[1]=(s*l-f*i)*g,e[2]=(a*i-s*o)*g,e[3]=h*g,e[4]=(f*n-s*c)*g,e[5]=(s*r-a*n)*g,e[6]=d*g,e[7]=(i*c-l*n)*g,e[8]=(o*n-i*r)*g,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,s,r,o,a){const c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*o+l*a)+o+e,-s*l,s*c,-s*(-l*o+c*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(qa.makeScale(e,n)),this}rotate(e){return this.premultiply(qa.makeRotation(-e)),this}translate(e,n){return this.premultiply(qa.makeTranslation(e,n)),this}makeTranslation(e,n){return this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<9;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const qa=new qe;function lm(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Zo(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const Tu={};function Cr(t){t in Tu||(Tu[t]=!0,console.warn(t))}function Is(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Ya(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const zx=new qe().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Vx=new qe().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function Hx(t){return t.convertSRGBToLinear().applyMatrix3(Vx)}function Gx(t){return t.applyMatrix3(zx).convertLinearToSRGB()}const $x={[Bn]:t=>t,[Be]:t=>t.convertSRGBToLinear(),[am]:Hx},kx={[Bn]:t=>t,[Be]:t=>t.convertLinearToSRGB(),[am]:Gx},_n={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return Bn},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const i=$x[e],s=kx[n];if(i===void 0||s===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${n}".`);return s(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}};let ss;class fm{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ss===void 0&&(ss=Zo("canvas")),ss.width=e.width,ss.height=e.height;const i=ss.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=ss}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Zo("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==im)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case al:e.x=e.x-Math.floor(e.x);break;case yn:e.x=e.x<0?0:1;break;case cl: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 al:e.y=e.y-Math.floor(e.y);break;case yn:e.y=e.y<0?0:1;break;case cl: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)}get encoding(){return Cr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Be?Yi:rm}set encoding(e){Cr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Yi?Be:ji}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=im;ln.DEFAULT_ANISOTROPY=1;class bt{constructor(e=0,n=0,i=0,s=1){bt.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,s){return this.x=e,this.y=n,this.z=i,this.w=s,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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 n=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*n+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*n+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*n+o[7]*i+o[11]*s+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,s,r;const c=e.elements,l=c[0],f=c[4],u=c[8],h=c[1],d=c[5],_=c[9],g=c[2],m=c[6],p=c[10];if(Math.abs(f-h)<.01&&Math.abs(u-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(f+h)<.1&&Math.abs(u+g)<.1&&Math.abs(_+m)<.1&&Math.abs(l+d+p-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const E=(l+1)/2,v=(d+1)/2,M=(p+1)/2,b=(f+h)/4,w=(u+g)/4,D=(_+m)/4;return E>v&&E>M?E<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(E),s=b/i,r=w/i):v>M?v<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(v),i=b/s,r=D/s):M<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(M),i=w/r,s=D/r),this.set(i,s,r,n),this}let y=Math.sqrt((m-_)*(m-_)+(u-g)*(u-g)+(h-f)*(h-f));return Math.abs(y)<.001&&(y=1),this.x=(m-_)/y,this.y=(u-g)/y,this.z=(h-f)/y,this.w=Math.acos((l+d+p-1)/2),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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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 Ki extends es{constructor(e=1,n=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new bt(0,0,e,n),this.scissorTest=!1,this.viewport=new bt(0,0,e,n);const s={width:e,height:n,depth:1};i.encoding!==void 0&&(Cr("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Yi?Be:ji),this.texture=new ln(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:dn,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,n,i=1){(this.width!==e||this.height!==n||this.depth!==i)&&(this.width=e,this.height=n,this.depth=i,this.texture.image.width=e,this.texture.image.height=n,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}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.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new um(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class hm extends ln{constructor(e=null,n=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xx extends ln{constructor(e=null,n=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=Gt,this.minFilter=Gt,this.wrapR=yn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xs{constructor(e=0,n=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=s}static slerpFlat(e,n,i,s,r,o,a){let c=i[s+0],l=i[s+1],f=i[s+2],u=i[s+3];const h=r[o+0],d=r[o+1],_=r[o+2],g=r[o+3];if(a===0){e[n+0]=c,e[n+1]=l,e[n+2]=f,e[n+3]=u;return}if(a===1){e[n+0]=h,e[n+1]=d,e[n+2]=_,e[n+3]=g;return}if(u!==g||c!==h||l!==d||f!==_){let m=1-a;const p=c*h+l*d+f*_+u*g,y=p>=0?1:-1,E=1-p*p;if(E>Number.EPSILON){const M=Math.sqrt(E),b=Math.atan2(M,p*y);m=Math.sin(m*b)/M,a=Math.sin(a*b)/M}const v=a*y;if(c=c*m+h*v,l=l*m+d*v,f=f*m+_*v,u=u*m+g*v,m===1-a){const M=1/Math.sqrt(c*c+l*l+f*f+u*u);c*=M,l*=M,f*=M,u*=M}}e[n]=c,e[n+1]=l,e[n+2]=f,e[n+3]=u}static multiplyQuaternionsFlat(e,n,i,s,r,o){const a=i[s],c=i[s+1],l=i[s+2],f=i[s+3],u=r[o],h=r[o+1],d=r[o+2],_=r[o+3];return e[n]=a*_+f*u+c*d-l*h,e[n+1]=c*_+f*h+l*u-a*d,e[n+2]=l*_+f*d+a*h-c*u,e[n+3]=f*_-a*u-c*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,s){return this._x=e,this._y=n,this._z=i,this._w=s,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,n){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(i/2),f=a(s/2),u=a(r/2),h=c(i/2),d=c(s/2),_=c(r/2);switch(o){case"XYZ":this._x=h*f*u+l*d*_,this._y=l*d*u-h*f*_,this._z=l*f*_+h*d*u,this._w=l*f*u-h*d*_;break;case"YXZ":this._x=h*f*u+l*d*_,this._y=l*d*u-h*f*_,this._z=l*f*_-h*d*u,this._w=l*f*u+h*d*_;break;case"ZXY":this._x=h*f*u-l*d*_,this._y=l*d*u+h*f*_,this._z=l*f*_+h*d*u,this._w=l*f*u-h*d*_;break;case"ZYX":this._x=h*f*u-l*d*_,this._y=l*d*u+h*f*_,this._z=l*f*_-h*d*u,this._w=l*f*u+h*d*_;break;case"YZX":this._x=h*f*u+l*d*_,this._y=l*d*u+h*f*_,this._z=l*f*_-h*d*u,this._w=l*f*u-h*d*_;break;case"XZY":this._x=h*f*u-l*d*_,this._y=l*d*u-h*f*_,this._z=l*f*_+h*d*u,this._w=l*f*u+h*d*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],s=n[4],r=n[8],o=n[1],a=n[5],c=n[9],l=n[2],f=n[6],u=n[10],h=i+a+u;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(f-c)*d,this._y=(r-l)*d,this._z=(o-s)*d}else if(i>a&&i>u){const d=2*Math.sqrt(1+i-a-u);this._w=(f-c)/d,this._x=.25*d,this._y=(s+o)/d,this._z=(r+l)/d}else if(a>u){const d=2*Math.sqrt(1+a-i-u);this._w=(r-l)/d,this._x=(s+o)/d,this._y=.25*d,this._z=(c+f)/d}else{const d=2*Math.sqrt(1+u-i-a);this._w=(o-s)/d,this._x=(r+l)/d,this._y=(c+f)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(kt(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,n/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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,n){const i=e._x,s=e._y,r=e._z,o=e._w,a=n._x,c=n._y,l=n._z,f=n._w;return this._x=i*f+o*a+s*l-r*c,this._y=s*f+o*c+r*a-i*l,this._z=r*f+o*l+i*c-s*a,this._w=o*f-i*a-s*c-r*l,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*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=i,this._y=s,this._z=r,this;const c=1-a*a;if(c<=Number.EPSILON){const d=1-n;return this._w=d*o+n*this._w,this._x=d*i+n*this._x,this._y=d*s+n*this._y,this._z=d*r+n*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(c),f=Math.atan2(l,a),u=Math.sin((1-n)*f)/l,h=Math.sin(n*f)/l;return this._w=o*u+this._w*h,this._x=i*u+this._x*h,this._y=s*u+this._y*h,this._z=r*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(n*Math.cos(s),i*Math.sin(r),i*Math.cos(r),n*Math.sin(s))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),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 W{constructor(e=0,n=0,i=0){W.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(wu.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(wu.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6]*s,this.y=r[1]*n+r[4]*i+r[7]*s,this.z=r[2]*n+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*n+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*n+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*n+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const n=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=c*n+o*s-a*i,f=c*i+a*n-r*s,u=c*s+r*i-o*n,h=-r*n-o*i-a*s;return this.x=l*c+h*-r+f*-a-u*-o,this.y=f*c+h*-o+u*-r-l*-a,this.z=u*c+h*-a+l*-o-f*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*n+r[4]*i+r[8]*s,this.y=r[1]*n+r[5]*i+r[9]*s,this.z=r[2]*n+r[6]*i+r[10]*s,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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,s=e.y,r=e.z,o=n.x,a=n.y,c=n.z;return this.x=s*c-r*a,this.y=r*o-i*c,this.z=i*a-s*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Za.copy(this).projectOnVector(e),this.sub(Za)}reflect(e){return this.sub(Za.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(kt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return n*n+i*i+s*s}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,n,i){const s=Math.sin(n)*e;return this.x=s*Math.sin(i),this.y=Math.cos(n)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=s,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(n),this.y=i*Math.sin(n),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Za=new W,wu=new Xs;class $r{constructor(e=new W(1/0,1/0,1/0),n=new W(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;nthis.max.x||e.ythis.max.y||e.zthis.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,n){return n.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Hn),Hn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(tr),to.subVectors(this.max,tr),os.subVectors(e.a,tr),as.subVectors(e.b,tr),cs.subVectors(e.c,tr),ui.subVectors(as,os),hi.subVectors(cs,as),Di.subVectors(os,cs);let n=[0,-ui.z,ui.y,0,-hi.z,hi.y,0,-Di.z,Di.y,ui.z,0,-ui.x,hi.z,0,-hi.x,Di.z,0,-Di.x,-ui.y,ui.x,0,-hi.y,hi.x,0,-Di.y,Di.x,0];return!Ka(n,os,as,cs,to)||(n=[1,0,0,0,1,0,0,0,1],!Ka(n,os,as,cs,to))?!1:(no.crossVectors(ui,hi),n=[no.x,no.y,no.z],Ka(n,os,as,cs,to))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Hn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Hn).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:(Vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vn),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 Vn=[new W,new W,new W,new W,new W,new W,new W,new W],Hn=new W,rs=new $r,os=new W,as=new W,cs=new W,ui=new W,hi=new W,Di=new W,tr=new W,to=new W,no=new W,Ui=new W;function Ka(t,e,n,i,s){for(let r=0,o=t.length-3;r<=o;r+=3){Ui.fromArray(t,r);const a=s.x*Math.abs(Ui.x)+s.y*Math.abs(Ui.y)+s.z*Math.abs(Ui.z),c=e.dot(Ui),l=n.dot(Ui),f=i.dot(Ui);if(Math.max(-Math.max(c,l,f),Math.min(c,l,f))>a)return!1}return!0}const qx=new $r,nr=new W,Ja=new W;class kl{constructor(e=new W,n=-1){this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):qx.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;nr.subVectors(e,this.center);const n=nr.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(nr,s/i),this.radius+=s}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):(Ja.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(nr.copy(e.center).add(Ja)),this.expandByPoint(nr.copy(e.center).sub(Ja))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Gn=new W,Qa=new W,io=new W,di=new W,ec=new W,so=new W,tc=new W;class Yx{constructor(e=new W,n=new W(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,Gn)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Gn.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Gn.copy(this.origin).addScaledVector(this.direction,n),Gn.distanceToSquared(e))}distanceSqToSegment(e,n,i,s){Qa.copy(e).add(n).multiplyScalar(.5),io.copy(n).sub(e).normalize(),di.copy(this.origin).sub(Qa);const r=e.distanceTo(n)*.5,o=-this.direction.dot(io),a=di.dot(this.direction),c=-di.dot(io),l=di.lengthSq(),f=Math.abs(1-o*o);let u,h,d,_;if(f>0)if(u=o*c-a,h=o*a-c,_=r*f,u>=0)if(h>=-_)if(h<=_){const g=1/f;u*=g,h*=g,d=u*(u+o*h+2*a)+h*(o*u+h+2*c)+l}else h=r,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*c)+l;else h=-r,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*c)+l;else h<=-_?(u=Math.max(0,-(-o*r+a)),h=u>0?-r:Math.min(Math.max(-r,-c),r),d=-u*u+h*(h+2*c)+l):h<=_?(u=0,h=Math.min(Math.max(-r,-c),r),d=h*(h+2*c)+l):(u=Math.max(0,-(o*r+a)),h=u>0?r:Math.min(Math.max(-r,-c),r),d=-u*u+h*(h+2*c)+l);else h=o>0?-r:r,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(Qa).addScaledVector(io,h),d}intersectSphere(e,n){Gn.subVectors(e.center,this.origin);const i=Gn.dot(this.direction),s=Gn.dot(Gn)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,c=i+o;return c<0?null:a<0?this.at(c,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,s,r,o,a,c;const l=1/this.direction.x,f=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(i=(e.min.x-h.x)*l,s=(e.max.x-h.x)*l):(i=(e.max.x-h.x)*l,s=(e.min.x-h.x)*l),f>=0?(r=(e.min.y-h.y)*f,o=(e.max.y-h.y)*f):(r=(e.max.y-h.y)*f,o=(e.min.y-h.y)*f),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-h.z)*u,c=(e.max.z-h.z)*u):(a=(e.max.z-h.z)*u,c=(e.min.z-h.z)*u),i>c||a>s)||((a>i||i!==i)&&(i=a),(c=0?i:s,n)}intersectsBox(e){return this.intersectBox(e,Gn)!==null}intersectTriangle(e,n,i,s,r){ec.subVectors(n,e),so.subVectors(i,e),tc.crossVectors(ec,so);let o=this.direction.dot(tc),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;di.subVectors(this.origin,e);const c=a*this.direction.dot(so.crossVectors(di,so));if(c<0)return null;const l=a*this.direction.dot(ec.cross(di));if(l<0||c+l>o)return null;const f=-a*di.dot(tc);return f<0?null:this.at(f/o,r)}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 _t{constructor(){_t.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,n,i,s,r,o,a,c,l,f,u,h,d,_,g,m){const p=this.elements;return p[0]=e,p[4]=n,p[8]=i,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=f,p[10]=u,p[14]=h,p[3]=d,p[7]=_,p[11]=g,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new _t().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,s=1/ls.setFromMatrixColumn(e,0).length(),r=1/ls.setFromMatrixColumn(e,1).length(),o=1/ls.setFromMatrixColumn(e,2).length();return n[0]=i[0]*s,n[1]=i[1]*s,n[2]=i[2]*s,n[3]=0,n[4]=i[4]*r,n[5]=i[5]*r,n[6]=i[6]*r,n[7]=0,n[8]=i[8]*o,n[9]=i[9]*o,n[10]=i[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(s),l=Math.sin(s),f=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const h=o*f,d=o*u,_=a*f,g=a*u;n[0]=c*f,n[4]=-c*u,n[8]=l,n[1]=d+_*l,n[5]=h-g*l,n[9]=-a*c,n[2]=g-h*l,n[6]=_+d*l,n[10]=o*c}else if(e.order==="YXZ"){const h=c*f,d=c*u,_=l*f,g=l*u;n[0]=h+g*a,n[4]=_*a-d,n[8]=o*l,n[1]=o*u,n[5]=o*f,n[9]=-a,n[2]=d*a-_,n[6]=g+h*a,n[10]=o*c}else if(e.order==="ZXY"){const h=c*f,d=c*u,_=l*f,g=l*u;n[0]=h-g*a,n[4]=-o*u,n[8]=_+d*a,n[1]=d+_*a,n[5]=o*f,n[9]=g-h*a,n[2]=-o*l,n[6]=a,n[10]=o*c}else if(e.order==="ZYX"){const h=o*f,d=o*u,_=a*f,g=a*u;n[0]=c*f,n[4]=_*l-d,n[8]=h*l+g,n[1]=c*u,n[5]=g*l+h,n[9]=d*l-_,n[2]=-l,n[6]=a*c,n[10]=o*c}else if(e.order==="YZX"){const h=o*c,d=o*l,_=a*c,g=a*l;n[0]=c*f,n[4]=g-h*u,n[8]=_*u+d,n[1]=u,n[5]=o*f,n[9]=-a*f,n[2]=-l*f,n[6]=d*u+_,n[10]=h-g*u}else if(e.order==="XZY"){const h=o*c,d=o*l,_=a*c,g=a*l;n[0]=c*f,n[4]=-u,n[8]=l*f,n[1]=h*u+g,n[5]=o*f,n[9]=d*u-_,n[2]=_*u-d,n[6]=a*f,n[10]=g*u+h}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(jx,e,Zx)}lookAt(e,n,i){const s=this.elements;return Jt.subVectors(e,n),Jt.lengthSq()===0&&(Jt.z=1),Jt.normalize(),pi.crossVectors(i,Jt),pi.lengthSq()===0&&(Math.abs(i.z)===1?Jt.x+=1e-4:Jt.z+=1e-4,Jt.normalize(),pi.crossVectors(i,Jt)),pi.normalize(),ro.crossVectors(Jt,pi),s[0]=pi.x,s[4]=ro.x,s[8]=Jt.x,s[1]=pi.y,s[5]=ro.y,s[9]=Jt.y,s[2]=pi.z,s[6]=ro.z,s[10]=Jt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,r=this.elements,o=i[0],a=i[4],c=i[8],l=i[12],f=i[1],u=i[5],h=i[9],d=i[13],_=i[2],g=i[6],m=i[10],p=i[14],y=i[3],E=i[7],v=i[11],M=i[15],b=s[0],w=s[4],D=s[8],x=s[12],T=s[1],I=s[5],B=s[9],U=s[13],F=s[2],z=s[6],H=s[10],$=s[14],k=s[3],le=s[7],ie=s[11],we=s[15];return r[0]=o*b+a*T+c*F+l*k,r[4]=o*w+a*I+c*z+l*le,r[8]=o*D+a*B+c*H+l*ie,r[12]=o*x+a*U+c*$+l*we,r[1]=f*b+u*T+h*F+d*k,r[5]=f*w+u*I+h*z+d*le,r[9]=f*D+u*B+h*H+d*ie,r[13]=f*x+u*U+h*$+d*we,r[2]=_*b+g*T+m*F+p*k,r[6]=_*w+g*I+m*z+p*le,r[10]=_*D+g*B+m*H+p*ie,r[14]=_*x+g*U+m*$+p*we,r[3]=y*b+E*T+v*F+M*k,r[7]=y*w+E*I+v*z+M*le,r[11]=y*D+E*B+v*H+M*ie,r[15]=y*x+E*U+v*$+M*we,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],f=e[2],u=e[6],h=e[10],d=e[14],_=e[3],g=e[7],m=e[11],p=e[15];return _*(+r*c*u-s*l*u-r*a*h+i*l*h+s*a*d-i*c*d)+g*(+n*c*d-n*l*h+r*o*h-s*o*d+s*l*f-r*c*f)+m*(+n*l*u-n*a*d-r*o*u+i*o*d+r*a*f-i*l*f)+p*(-s*a*f-n*c*u+n*a*h+s*o*u-i*o*h+i*c*f)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=n,s[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],u=e[9],h=e[10],d=e[11],_=e[12],g=e[13],m=e[14],p=e[15],y=u*m*l-g*h*l+g*c*d-a*m*d-u*c*p+a*h*p,E=_*h*l-f*m*l-_*c*d+o*m*d+f*c*p-o*h*p,v=f*g*l-_*u*l+_*a*d-o*g*d-f*a*p+o*u*p,M=_*u*c-f*g*c-_*a*h+o*g*h+f*a*m-o*u*m,b=n*y+i*E+s*v+r*M;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=y*w,e[1]=(g*h*r-u*m*r-g*s*d+i*m*d+u*s*p-i*h*p)*w,e[2]=(a*m*r-g*c*r+g*s*l-i*m*l-a*s*p+i*c*p)*w,e[3]=(u*c*r-a*h*r-u*s*l+i*h*l+a*s*d-i*c*d)*w,e[4]=E*w,e[5]=(f*m*r-_*h*r+_*s*d-n*m*d-f*s*p+n*h*p)*w,e[6]=(_*c*r-o*m*r-_*s*l+n*m*l+o*s*p-n*c*p)*w,e[7]=(o*h*r-f*c*r+f*s*l-n*h*l-o*s*d+n*c*d)*w,e[8]=v*w,e[9]=(_*u*r-f*g*r-_*i*d+n*g*d+f*i*p-n*u*p)*w,e[10]=(o*g*r-_*a*r+_*i*l-n*g*l-o*i*p+n*a*p)*w,e[11]=(f*a*r-o*u*r-f*i*l+n*u*l+o*i*d-n*a*d)*w,e[12]=M*w,e[13]=(f*g*s-_*u*s+_*i*h-n*g*h-f*i*m+n*u*m)*w,e[14]=(_*a*s-o*g*s-_*i*c+n*g*c+o*i*m-n*a*m)*w,e[15]=(o*u*s-f*a*s+f*i*c-n*u*c-o*i*h+n*a*h)*w,this}scale(e){const n=this.elements,i=e.x,s=e.y,r=e.z;return n[0]*=i,n[4]*=s,n[8]*=r,n[1]*=i,n[5]*=s,n[9]*=r,n[2]*=i,n[6]*=s,n[10]*=r,n[3]*=i,n[7]*=s,n[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,s))}makeTranslation(e,n,i){return this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),s=Math.sin(n),r=1-i,o=e.x,a=e.y,c=e.z,l=r*o,f=r*a;return this.set(l*o+i,l*a-s*c,l*c+s*a,0,l*a+s*c,f*a+i,f*c-s*o,0,l*c-s*a,f*c+s*o,r*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,n,s,1,0,0,0,0,1),this}compose(e,n,i){const s=this.elements,r=n._x,o=n._y,a=n._z,c=n._w,l=r+r,f=o+o,u=a+a,h=r*l,d=r*f,_=r*u,g=o*f,m=o*u,p=a*u,y=c*l,E=c*f,v=c*u,M=i.x,b=i.y,w=i.z;return s[0]=(1-(g+p))*M,s[1]=(d+v)*M,s[2]=(_-E)*M,s[3]=0,s[4]=(d-v)*b,s[5]=(1-(h+p))*b,s[6]=(m+y)*b,s[7]=0,s[8]=(_+E)*w,s[9]=(m-y)*w,s[10]=(1-(h+g))*w,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,n,i){const s=this.elements;let r=ls.set(s[0],s[1],s[2]).length();const o=ls.set(s[4],s[5],s[6]).length(),a=ls.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],vn.copy(this);const l=1/r,f=1/o,u=1/a;return vn.elements[0]*=l,vn.elements[1]*=l,vn.elements[2]*=l,vn.elements[4]*=f,vn.elements[5]*=f,vn.elements[6]*=f,vn.elements[8]*=u,vn.elements[9]*=u,vn.elements[10]*=u,n.setFromRotationMatrix(vn),i.x=r,i.y=o,i.z=a,this}makePerspective(e,n,i,s,r,o){const a=this.elements,c=2*r/(n-e),l=2*r/(i-s),f=(n+e)/(n-e),u=(i+s)/(i-s),h=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=c,a[4]=0,a[8]=f,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,n,i,s,r,o){const a=this.elements,c=1/(n-e),l=1/(i-s),f=1/(o-r),u=(n+e)*c,h=(i+s)*l,d=(o+r)*f;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*f,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<16;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const ls=new W,vn=new _t,jx=new W(0,0,0),Zx=new W(1,1,1),pi=new W,ro=new W,Jt=new W,Au=new _t,Ru=new Xs;class ua{constructor(e=0,n=0,i=0,s=ua.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=s}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,n,i,s=this._order){return this._x=e,this._y=n,this._z=i,this._order=s,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,n=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],c=s[1],l=s[5],f=s[9],u=s[2],h=s[6],d=s[10];switch(n){case"XYZ":this._y=Math.asin(kt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-kt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(kt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-kt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(kt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-kt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-f,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return Au.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Au,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Ru.setFromEuler(this),this.setFromQuaternion(Ru,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}}ua.DEFAULT_ORDER="XYZ";class dm{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let i=0;i0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ir,e,Jx),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ir,Qx,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,s=n.length;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON()));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,f=c.length;l0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),f.length>0&&(i.images=f),u.length>0&&(i.shapes=u),h.length>0&&(i.skeletons=h),d.length>0&&(i.animations=d),_.length>0&&(i.nodes=_)}return i.object=s,i;function o(a){const c=[];for(const l in a){const f=a[l];delete f.metadata,c.push(f)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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,this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,n,i,s,r){xn.subVectors(s,n),kn.subVectors(i,n),nc.subVectors(e,n);const o=xn.dot(xn),a=xn.dot(kn),c=xn.dot(nc),l=kn.dot(kn),f=kn.dot(nc),u=o*l-a*a;if(u===0)return r.set(-2,-1,-1);const h=1/u,d=(l*c-a*f)*h,_=(o*f-a*c)*h;return r.set(1-d-_,_,d)}static containsPoint(e,n,i,s){return this.getBarycoord(e,n,i,s,Wn),Wn.x>=0&&Wn.y>=0&&Wn.x+Wn.y<=1}static getUV(e,n,i,s,r,o,a,c){return ao===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ao=!0),this.getInterpolation(e,n,i,s,r,o,a,c)}static getInterpolation(e,n,i,s,r,o,a,c){return this.getBarycoord(e,n,i,s,Wn),c.setScalar(0),c.addScaledVector(r,Wn.x),c.addScaledVector(o,Wn.y),c.addScaledVector(a,Wn.z),c}static isFrontFacing(e,n,i,s){return xn.subVectors(i,n),kn.subVectors(e,n),xn.cross(kn).dot(s)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,s){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,n,i,s){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),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 xn.subVectors(this.c,this.b),kn.subVectors(this.a,this.b),xn.cross(kn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Sn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Sn.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,i,s,r){return ao===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ao=!0),Sn.getInterpolation(e,this.a,this.b,this.c,n,i,s,r)}getInterpolation(e,n,i,s,r){return Sn.getInterpolation(e,this.a,this.b,this.c,n,i,s,r)}containsPoint(e){return Sn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Sn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,s=this.b,r=this.c;let o,a;us.subVectors(s,i),hs.subVectors(r,i),ic.subVectors(e,i);const c=us.dot(ic),l=hs.dot(ic);if(c<=0&&l<=0)return n.copy(i);sc.subVectors(e,s);const f=us.dot(sc),u=hs.dot(sc);if(f>=0&&u<=f)return n.copy(s);const h=c*u-f*l;if(h<=0&&c>=0&&f<=0)return o=c/(c-f),n.copy(i).addScaledVector(us,o);rc.subVectors(e,r);const d=us.dot(rc),_=hs.dot(rc);if(_>=0&&d<=_)return n.copy(r);const g=d*l-c*_;if(g<=0&&l>=0&&_<=0)return a=l/(l-_),n.copy(i).addScaledVector(hs,a);const m=f*_-d*u;if(m<=0&&u-f>=0&&d-_>=0)return Iu.subVectors(r,s),a=(u-f)/(u-f+(d-_)),n.copy(s).addScaledVector(Iu,a);const p=1/(m+g+h);return o=g*p,a=h*p,n.copy(i).addScaledVector(us,o).addScaledVector(hs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let t1=0;class kr extends es{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:t1++}),this.uuid=Ws(),this.name="",this.type="Material",this.blending=Ds,this.side=bi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=em,this.blendDst=tm,this.blendEquation=ws,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=sl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Xa,this.stencilZFail=Xa,this.stencilZPass=Xa,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.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}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const s=this[n];if(s===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ds&&(i.blending=this.blending),this.side!==bi&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const c=r[a];delete c.metadata,o.push(c)}return o}if(n){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}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.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 n=e.clippingPlanes;let i=null;if(n!==null){const s=n.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=n[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.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++}}const pm={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},Mn={h:0,s:0,l:0},co={h:0,s:0,l:0};function oc(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class it{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,n===void 0&&i===void 0?this.set(e):this.setRGB(e,n,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Be){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,_n.toWorkingColorSpace(this,n),this}setRGB(e,n,i,s=_n.workingColorSpace){return this.r=e,this.g=n,this.b=i,_n.toWorkingColorSpace(this,s),this}setHSL(e,n,i,s=_n.workingColorSpace){if(e=$l(e,1),n=kt(n,0,1),i=kt(i,0,1),n===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=oc(o,r,e+1/3),this.g=oc(o,r,e),this.b=oc(o,r,e-1/3)}return _n.toWorkingColorSpace(this,s),this}setStyle(e,n=Be){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(r,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Be){const i=pm[e.toLowerCase()];return i!==void 0?this.setHex(i,n):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=Is(e.r),this.g=Is(e.g),this.b=Is(e.b),this}copyLinearToSRGB(e){return this.r=Ya(e.r),this.g=Ya(e.g),this.b=Ya(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Be){return _n.fromWorkingColorSpace(Lt.copy(this),e),Math.round(kt(Lt.r*255,0,255))*65536+Math.round(kt(Lt.g*255,0,255))*256+Math.round(kt(Lt.b*255,0,255))}getHexString(e=Be){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=_n.workingColorSpace){_n.fromWorkingColorSpace(Lt.copy(this),n);const i=Lt.r,s=Lt.g,r=Lt.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let c,l;const f=(a+o)/2;if(a===o)c=0,l=0;else{const u=o-a;switch(l=f<=.5?u/(o+a):u/(2-o-a),o){case i:c=(s-r)/u+(s0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const c in i){const l=i[c];e.data.attributes[c]=l.toJSON(e.data)}const s={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],f=[];for(let u=0,h=l.length;u0&&(s[c]=f,r=!0)}r&&(e.data.morphAttributes=s,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={center:a.center.toArray(),radius:a.radius}),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 n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(n));const s=e.attributes;for(const l in s){const f=s[l];this.setAttribute(l,f.clone(n))}const r=e.morphAttributes;for(const l in r){const f=[],u=r[l];for(let h=0,d=u.length;h0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(Nu.copy(r).invert(),Rn.copy(e.ray).applyMatrix4(Nu),!(i.boundingBox!==null&&Rn.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n)))}_computeIntersections(e,n){let i;const s=this.geometry,r=this.material,o=s.index,a=s.attributes.position,c=s.attributes.uv,l=s.attributes.uv1,f=s.attributes.normal,u=s.groups,h=s.drawRange;if(o!==null)if(Array.isArray(r))for(let d=0,_=u.length;d<_;d++){const g=u[d],m=r[g.materialIndex],p=Math.max(g.start,h.start),y=Math.min(o.count,Math.min(g.start+g.count,h.start+h.count));for(let E=p,v=y;En.far?null:{distance:l,point:_o.clone(),object:t}}function vo(t,e,n,i,s,r,o,a,c,l){t.getVertexPosition(a,ps),t.getVertexPosition(c,ms),t.getVertexPosition(l,gs);const f=i1(t,e,n,i,ps,ms,gs,go);if(f){s&&(ho.fromBufferAttribute(s,a),po.fromBufferAttribute(s,c),mo.fromBufferAttribute(s,l),f.uv=Sn.getInterpolation(go,ps,ms,gs,ho,po,mo,new He)),r&&(ho.fromBufferAttribute(r,a),po.fromBufferAttribute(r,c),mo.fromBufferAttribute(r,l),f.uv1=Sn.getInterpolation(go,ps,ms,gs,ho,po,mo,new He),f.uv2=f.uv1),o&&(Ou.fromBufferAttribute(o,a),Bu.fromBufferAttribute(o,c),zu.fromBufferAttribute(o,l),f.normal=Sn.getInterpolation(go,ps,ms,gs,Ou,Bu,zu,new W),f.normal.dot(i.direction)>0&&f.normal.multiplyScalar(-1));const u={a,b:c,c:l,normal:new W,materialIndex:0};Sn.getNormal(ps,ms,gs,u.normal),f.face=u}return f}class Wr extends ai{constructor(e=1,n=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const c=[],l=[],f=[],u=[];let h=0,d=0;_("z","y","x",-1,-1,i,n,e,o,r,0),_("z","y","x",1,-1,i,n,-e,o,r,1),_("x","z","y",1,1,e,i,n,s,o,2),_("x","z","y",1,-1,e,i,-n,s,o,3),_("x","y","z",1,-1,e,n,i,s,r,4),_("x","y","z",-1,-1,e,n,-i,s,r,5),this.setIndex(c),this.setAttribute("position",new oi(l,3)),this.setAttribute("normal",new oi(f,3)),this.setAttribute("uv",new oi(u,2));function _(g,m,p,y,E,v,M,b,w,D,x){const T=v/w,I=M/D,B=v/2,U=M/2,F=b/2,z=w+1,H=D+1;let $=0,k=0;const le=new W;for(let ie=0;ie0?1:-1,f.push(le.x,le.y,le.z),u.push(ce/w),u.push(1-ie/D),$+=1}}for(let ie=0;ie>8&255]+Dt[t>>16&255]+Dt[t>>24&255]+"-"+Dt[e&255]+Dt[e>>8&255]+"-"+Dt[e>>16&15|64]+Dt[e>>24&255]+"-"+Dt[n&63|128]+Dt[n>>8&255]+"-"+Dt[n>>16&255]+Dt[n>>24&255]+Dt[i&255]+Dt[i>>8&255]+Dt[i>>16&255]+Dt[i>>24&255]).toLowerCase()}function Wt(t,e,n){return Math.max(e,Math.min(n,t))}function cf(t,e){return(t%e+e)%e}function m1(t,e,n,i,s){return i+(t-e)*(s-i)/(n-e)}function g1(t,e,n){return t!==e?(n-t)/(e-t):0}function Hr(t,e,n){return(1-n)*t+n*e}function _1(t,e,n,i){return Hr(t,e,1-Math.exp(-n*i))}function v1(t,e=1){return e-Math.abs(cf(t,e*2)-e)}function x1(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function M1(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function E1(t,e){return t+Math.floor(Math.random()*(e-t+1))}function S1(t,e){return t+Math.random()*(e-t)}function y1(t){return t*(.5-Math.random())}function b1(t){t!==void 0&&(Xu=t);let e=Xu+=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 T1(t){return t*zr}function w1(t){return t*Kr}function Il(t){return(t&t-1)===0&&t!==0}function A1(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Xm(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function R1(t,e,n,i,s){const r=Math.cos,o=Math.sin,a=r(n/2),c=o(n/2),l=r((e+i)/2),f=o((e+i)/2),u=r((e-i)/2),h=o((e-i)/2),d=r((i-e)/2),_=o((i-e)/2);switch(s){case"XYX":t.set(a*f,c*u,c*h,a*l);break;case"YZY":t.set(c*h,a*f,c*u,a*l);break;case"ZXZ":t.set(c*u,c*h,a*f,a*l);break;case"XZX":t.set(a*f,c*_,c*d,a*l);break;case"YXY":t.set(c*d,a*f,c*_,a*l);break;case"ZYZ":t.set(c*_,c*d,a*f,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function Rr(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Yt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const qu={DEG2RAD:zr,RAD2DEG:Kr,generateUUID:ir,clamp:Wt,euclideanModulo:cf,mapLinear:m1,inverseLerp:g1,lerp:Hr,damp:_1,pingpong:v1,smoothstep:x1,smootherstep:M1,randInt:E1,randFloat:S1,randFloatSpread:y1,seededRandom:b1,degToRad:T1,radToDeg:w1,isPowerOfTwo:Il,ceilPowerOfTwo:A1,floorPowerOfTwo:Xm,setQuaternionFromProperEuler:R1,normalize:Yt,denormalize:Rr};class Ve{constructor(e=0,n=0){Ve.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,i=this.y,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6],this.y=s[1]*n+s[4]*i+s[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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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 n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Wt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),s=Math.sin(n),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qe{constructor(){qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,n,i,s,r,o,a,c,l){const f=this.elements;return f[0]=e,f[1]=s,f[2]=a,f[3]=n,f[4]=r,f[5]=c,f[6]=i,f[7]=o,f[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,r=this.elements,o=i[0],a=i[3],c=i[6],l=i[1],f=i[4],u=i[7],h=i[2],d=i[5],_=i[8],g=s[0],m=s[3],p=s[6],y=s[1],E=s[4],x=s[7],M=s[2],b=s[5],w=s[8];return r[0]=o*g+a*y+c*M,r[3]=o*m+a*E+c*b,r[6]=o*p+a*x+c*w,r[1]=l*g+f*y+u*M,r[4]=l*m+f*E+u*b,r[7]=l*p+f*x+u*w,r[2]=h*g+d*y+_*M,r[5]=h*m+d*E+_*b,r[8]=h*p+d*x+_*w,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8];return n*o*f-n*a*l-i*r*f+i*a*c+s*r*l-s*o*c}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],u=f*o-a*l,h=a*c-f*r,d=l*r-o*c,_=n*u+i*h+s*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=u*g,e[1]=(s*l-f*i)*g,e[2]=(a*i-s*o)*g,e[3]=h*g,e[4]=(f*n-s*c)*g,e[5]=(s*r-a*n)*g,e[6]=d*g,e[7]=(i*c-l*n)*g,e[8]=(o*n-i*r)*g,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,s,r,o,a){const c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*o+l*a)+o+e,-s*l,s*c,-s*(-l*o+c*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(gc.makeScale(e,n)),this}rotate(e){return this.premultiply(gc.makeRotation(-e)),this}translate(e,n){return this.premultiply(gc.makeTranslation(e,n)),this}makeTranslation(e,n){return this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<9;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const gc=new qe;function qm(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ua(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const ju={};function Vr(t){t in ju||(ju[t]=!0,console.warn(t))}function js(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function _c(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const C1=new qe().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),P1=new qe().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function L1(t){return t.convertSRGBToLinear().applyMatrix3(P1)}function D1(t){return t.applyMatrix3(C1).convertLinearToSRGB()}const U1={[Gn]:t=>t,[Be]:t=>t.convertSRGBToLinear(),[Wm]:L1},I1={[Gn]:t=>t,[Be]:t=>t.convertLinearToSRGB(),[Wm]:D1},Mn={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return Gn},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const i=U1[e],s=I1[n];if(i===void 0||s===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${n}".`);return s(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}};let gs;class jm{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{gs===void 0&&(gs=ua("canvas")),gs.width=e.width,gs.height=e.height;const i=gs.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=gs}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=ua("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Vm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ll:e.x=e.x-Math.floor(e.x);break;case An:e.x=e.x<0?0:1;break;case Dl: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 Ll:e.y=e.y-Math.floor(e.y);break;case An:e.y=e.y<0?0:1;break;case Dl: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)}get encoding(){return Vr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Be?os:$m}set encoding(e){Vr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===os?Be:as}}fn.DEFAULT_IMAGE=null;fn.DEFAULT_MAPPING=Vm;fn.DEFAULT_ANISOTROPY=1;class Tt{constructor(e=0,n=0,i=0,s=1){Tt.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,s){return this.x=e,this.y=n,this.z=i,this.w=s,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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 n=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*n+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*n+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*n+o[7]*i+o[11]*s+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,s,r;const c=e.elements,l=c[0],f=c[4],u=c[8],h=c[1],d=c[5],_=c[9],g=c[2],m=c[6],p=c[10];if(Math.abs(f-h)<.01&&Math.abs(u-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(f+h)<.1&&Math.abs(u+g)<.1&&Math.abs(_+m)<.1&&Math.abs(l+d+p-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const E=(l+1)/2,x=(d+1)/2,M=(p+1)/2,b=(f+h)/4,w=(u+g)/4,D=(_+m)/4;return E>x&&E>M?E<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(E),s=b/i,r=w/i):x>M?x<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(x),i=b/s,r=D/s):M<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(M),i=w/r,s=D/r),this.set(i,s,r,n),this}let y=Math.sqrt((m-_)*(m-_)+(u-g)*(u-g)+(h-f)*(h-f));return Math.abs(y)<.001&&(y=1),this.x=(m-_)/y,this.y=(u-g)/y,this.z=(h-f)/y,this.w=Math.acos((l+d+p-1)/2),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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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 ls extends hs{constructor(e=1,n=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Tt(0,0,e,n),this.scissorTest=!1,this.viewport=new Tt(0,0,e,n);const s={width:e,height:n,depth:1};i.encoding!==void 0&&(Vr("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===os?Be:as),this.texture=new fn(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:mn,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,n,i=1){(this.width!==e||this.height!==n||this.depth!==i)&&(this.width=e,this.height=n,this.depth=i,this.texture.image.width=e,this.texture.image.height=n,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}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.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new Ym(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Zm extends fn{constructor(e=null,n=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=$t,this.minFilter=$t,this.wrapR=An,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class F1 extends fn{constructor(e=null,n=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=$t,this.minFilter=$t,this.wrapR=An,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class sr{constructor(e=0,n=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=s}static slerpFlat(e,n,i,s,r,o,a){let c=i[s+0],l=i[s+1],f=i[s+2],u=i[s+3];const h=r[o+0],d=r[o+1],_=r[o+2],g=r[o+3];if(a===0){e[n+0]=c,e[n+1]=l,e[n+2]=f,e[n+3]=u;return}if(a===1){e[n+0]=h,e[n+1]=d,e[n+2]=_,e[n+3]=g;return}if(u!==g||c!==h||l!==d||f!==_){let m=1-a;const p=c*h+l*d+f*_+u*g,y=p>=0?1:-1,E=1-p*p;if(E>Number.EPSILON){const M=Math.sqrt(E),b=Math.atan2(M,p*y);m=Math.sin(m*b)/M,a=Math.sin(a*b)/M}const x=a*y;if(c=c*m+h*x,l=l*m+d*x,f=f*m+_*x,u=u*m+g*x,m===1-a){const M=1/Math.sqrt(c*c+l*l+f*f+u*u);c*=M,l*=M,f*=M,u*=M}}e[n]=c,e[n+1]=l,e[n+2]=f,e[n+3]=u}static multiplyQuaternionsFlat(e,n,i,s,r,o){const a=i[s],c=i[s+1],l=i[s+2],f=i[s+3],u=r[o],h=r[o+1],d=r[o+2],_=r[o+3];return e[n]=a*_+f*u+c*d-l*h,e[n+1]=c*_+f*h+l*u-a*d,e[n+2]=l*_+f*d+a*h-c*u,e[n+3]=f*_-a*u-c*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,s){return this._x=e,this._y=n,this._z=i,this._w=s,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,n){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(i/2),f=a(s/2),u=a(r/2),h=c(i/2),d=c(s/2),_=c(r/2);switch(o){case"XYZ":this._x=h*f*u+l*d*_,this._y=l*d*u-h*f*_,this._z=l*f*_+h*d*u,this._w=l*f*u-h*d*_;break;case"YXZ":this._x=h*f*u+l*d*_,this._y=l*d*u-h*f*_,this._z=l*f*_-h*d*u,this._w=l*f*u+h*d*_;break;case"ZXY":this._x=h*f*u-l*d*_,this._y=l*d*u+h*f*_,this._z=l*f*_+h*d*u,this._w=l*f*u-h*d*_;break;case"ZYX":this._x=h*f*u-l*d*_,this._y=l*d*u+h*f*_,this._z=l*f*_-h*d*u,this._w=l*f*u+h*d*_;break;case"YZX":this._x=h*f*u+l*d*_,this._y=l*d*u+h*f*_,this._z=l*f*_-h*d*u,this._w=l*f*u-h*d*_;break;case"XZY":this._x=h*f*u-l*d*_,this._y=l*d*u-h*f*_,this._z=l*f*_+h*d*u,this._w=l*f*u+h*d*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],s=n[4],r=n[8],o=n[1],a=n[5],c=n[9],l=n[2],f=n[6],u=n[10],h=i+a+u;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(f-c)*d,this._y=(r-l)*d,this._z=(o-s)*d}else if(i>a&&i>u){const d=2*Math.sqrt(1+i-a-u);this._w=(f-c)/d,this._x=.25*d,this._y=(s+o)/d,this._z=(r+l)/d}else if(a>u){const d=2*Math.sqrt(1+a-i-u);this._w=(r-l)/d,this._x=(s+o)/d,this._y=.25*d,this._z=(c+f)/d}else{const d=2*Math.sqrt(1+u-i-a);this._w=(o-s)/d,this._x=(r+l)/d,this._y=(c+f)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Wt(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,n/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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,n){const i=e._x,s=e._y,r=e._z,o=e._w,a=n._x,c=n._y,l=n._z,f=n._w;return this._x=i*f+o*a+s*l-r*c,this._y=s*f+o*c+r*a-i*l,this._z=r*f+o*l+i*c-s*a,this._w=o*f-i*a-s*c-r*l,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*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=i,this._y=s,this._z=r,this;const c=1-a*a;if(c<=Number.EPSILON){const d=1-n;return this._w=d*o+n*this._w,this._x=d*i+n*this._x,this._y=d*s+n*this._y,this._z=d*r+n*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(c),f=Math.atan2(l,a),u=Math.sin((1-n)*f)/l,h=Math.sin(n*f)/l;return this._w=o*u+this._w*h,this._x=i*u+this._x*h,this._y=s*u+this._y*h,this._z=r*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(n*Math.cos(s),i*Math.sin(r),i*Math.cos(r),n*Math.sin(s))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),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 W{constructor(e=0,n=0,i=0){W.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(Yu.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Yu.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6]*s,this.y=r[1]*n+r[4]*i+r[7]*s,this.z=r[2]*n+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*n+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*n+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*n+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const n=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=c*n+o*s-a*i,f=c*i+a*n-r*s,u=c*s+r*i-o*n,h=-r*n-o*i-a*s;return this.x=l*c+h*-r+f*-a-u*-o,this.y=f*c+h*-o+u*-r-l*-a,this.z=u*c+h*-a+l*-o-f*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*n+r[4]*i+r[8]*s,this.y=r[1]*n+r[5]*i+r[9]*s,this.z=r[2]*n+r[6]*i+r[10]*s,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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,s=e.y,r=e.z,o=n.x,a=n.y,c=n.z;return this.x=s*c-r*a,this.y=r*o-i*c,this.z=i*a-s*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return xc.copy(this).projectOnVector(e),this.sub(xc)}reflect(e){return this.sub(xc.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Wt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return n*n+i*i+s*s}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,n,i){const s=Math.sin(n)*e;return this.x=s*Math.sin(i),this.y=Math.cos(n)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=s,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(n),this.y=i*Math.sin(n),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const xc=new W,Yu=new sr;class no{constructor(e=new W(1/0,1/0,1/0),n=new W(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;nthis.max.x||e.ythis.max.y||e.zthis.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,n){return n.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Xn),Xn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(pr),mo.subVectors(this.max,pr),vs.subVectors(e.a,pr),xs.subVectors(e.b,pr),Ms.subVectors(e.c,pr),mi.subVectors(xs,vs),gi.subVectors(Ms,xs),Vi.subVectors(vs,Ms);let n=[0,-mi.z,mi.y,0,-gi.z,gi.y,0,-Vi.z,Vi.y,mi.z,0,-mi.x,gi.z,0,-gi.x,Vi.z,0,-Vi.x,-mi.y,mi.x,0,-gi.y,gi.x,0,-Vi.y,Vi.x,0];return!Mc(n,vs,xs,Ms,mo)||(n=[1,0,0,0,1,0,0,0,1],!Mc(n,vs,xs,Ms,mo))?!1:(go.crossVectors(mi,gi),n=[go.x,go.y,go.z],Mc(n,vs,xs,Ms,mo))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xn).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:(Wn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wn),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 Wn=[new W,new W,new W,new W,new W,new W,new W,new W],Xn=new W,_s=new no,vs=new W,xs=new W,Ms=new W,mi=new W,gi=new W,Vi=new W,pr=new W,mo=new W,go=new W,Gi=new W;function Mc(t,e,n,i,s){for(let r=0,o=t.length-3;r<=o;r+=3){Gi.fromArray(t,r);const a=s.x*Math.abs(Gi.x)+s.y*Math.abs(Gi.y)+s.z*Math.abs(Gi.z),c=e.dot(Gi),l=n.dot(Gi),f=i.dot(Gi);if(Math.max(-Math.max(c,l,f),Math.min(c,l,f))>a)return!1}return!0}const O1=new no,mr=new W,Ec=new W;class lf{constructor(e=new W,n=-1){this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):O1.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;mr.subVectors(e,this.center);const n=mr.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(mr,s/i),this.radius+=s}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):(Ec.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(mr.copy(e.center).add(Ec)),this.expandByPoint(mr.copy(e.center).sub(Ec))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const qn=new W,Sc=new W,_o=new W,_i=new W,yc=new W,vo=new W,bc=new W;class B1{constructor(e=new W,n=new W(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,qn)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=qn.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(qn.copy(this.origin).addScaledVector(this.direction,n),qn.distanceToSquared(e))}distanceSqToSegment(e,n,i,s){Sc.copy(e).add(n).multiplyScalar(.5),_o.copy(n).sub(e).normalize(),_i.copy(this.origin).sub(Sc);const r=e.distanceTo(n)*.5,o=-this.direction.dot(_o),a=_i.dot(this.direction),c=-_i.dot(_o),l=_i.lengthSq(),f=Math.abs(1-o*o);let u,h,d,_;if(f>0)if(u=o*c-a,h=o*a-c,_=r*f,u>=0)if(h>=-_)if(h<=_){const g=1/f;u*=g,h*=g,d=u*(u+o*h+2*a)+h*(o*u+h+2*c)+l}else h=r,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*c)+l;else h=-r,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*c)+l;else h<=-_?(u=Math.max(0,-(-o*r+a)),h=u>0?-r:Math.min(Math.max(-r,-c),r),d=-u*u+h*(h+2*c)+l):h<=_?(u=0,h=Math.min(Math.max(-r,-c),r),d=h*(h+2*c)+l):(u=Math.max(0,-(o*r+a)),h=u>0?r:Math.min(Math.max(-r,-c),r),d=-u*u+h*(h+2*c)+l);else h=o>0?-r:r,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(Sc).addScaledVector(_o,h),d}intersectSphere(e,n){qn.subVectors(e.center,this.origin);const i=qn.dot(this.direction),s=qn.dot(qn)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,c=i+o;return c<0?null:a<0?this.at(c,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,s,r,o,a,c;const l=1/this.direction.x,f=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(i=(e.min.x-h.x)*l,s=(e.max.x-h.x)*l):(i=(e.max.x-h.x)*l,s=(e.min.x-h.x)*l),f>=0?(r=(e.min.y-h.y)*f,o=(e.max.y-h.y)*f):(r=(e.max.y-h.y)*f,o=(e.min.y-h.y)*f),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-h.z)*u,c=(e.max.z-h.z)*u):(a=(e.max.z-h.z)*u,c=(e.min.z-h.z)*u),i>c||a>s)||((a>i||i!==i)&&(i=a),(c=0?i:s,n)}intersectsBox(e){return this.intersectBox(e,qn)!==null}intersectTriangle(e,n,i,s,r){yc.subVectors(n,e),vo.subVectors(i,e),bc.crossVectors(yc,vo);let o=this.direction.dot(bc),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;_i.subVectors(this.origin,e);const c=a*this.direction.dot(vo.crossVectors(_i,vo));if(c<0)return null;const l=a*this.direction.dot(yc.cross(_i));if(l<0||c+l>o)return null;const f=-a*_i.dot(bc);return f<0?null:this.at(f/o,r)}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 vt{constructor(){vt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,n,i,s,r,o,a,c,l,f,u,h,d,_,g,m){const p=this.elements;return p[0]=e,p[4]=n,p[8]=i,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=f,p[10]=u,p[14]=h,p[3]=d,p[7]=_,p[11]=g,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new vt().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,s=1/Es.setFromMatrixColumn(e,0).length(),r=1/Es.setFromMatrixColumn(e,1).length(),o=1/Es.setFromMatrixColumn(e,2).length();return n[0]=i[0]*s,n[1]=i[1]*s,n[2]=i[2]*s,n[3]=0,n[4]=i[4]*r,n[5]=i[5]*r,n[6]=i[6]*r,n[7]=0,n[8]=i[8]*o,n[9]=i[9]*o,n[10]=i[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(s),l=Math.sin(s),f=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const h=o*f,d=o*u,_=a*f,g=a*u;n[0]=c*f,n[4]=-c*u,n[8]=l,n[1]=d+_*l,n[5]=h-g*l,n[9]=-a*c,n[2]=g-h*l,n[6]=_+d*l,n[10]=o*c}else if(e.order==="YXZ"){const h=c*f,d=c*u,_=l*f,g=l*u;n[0]=h+g*a,n[4]=_*a-d,n[8]=o*l,n[1]=o*u,n[5]=o*f,n[9]=-a,n[2]=d*a-_,n[6]=g+h*a,n[10]=o*c}else if(e.order==="ZXY"){const h=c*f,d=c*u,_=l*f,g=l*u;n[0]=h-g*a,n[4]=-o*u,n[8]=_+d*a,n[1]=d+_*a,n[5]=o*f,n[9]=g-h*a,n[2]=-o*l,n[6]=a,n[10]=o*c}else if(e.order==="ZYX"){const h=o*f,d=o*u,_=a*f,g=a*u;n[0]=c*f,n[4]=_*l-d,n[8]=h*l+g,n[1]=c*u,n[5]=g*l+h,n[9]=d*l-_,n[2]=-l,n[6]=a*c,n[10]=o*c}else if(e.order==="YZX"){const h=o*c,d=o*l,_=a*c,g=a*l;n[0]=c*f,n[4]=g-h*u,n[8]=_*u+d,n[1]=u,n[5]=o*f,n[9]=-a*f,n[2]=-l*f,n[6]=d*u+_,n[10]=h-g*u}else if(e.order==="XZY"){const h=o*c,d=o*l,_=a*c,g=a*l;n[0]=c*f,n[4]=-u,n[8]=l*f,n[1]=h*u+g,n[5]=o*f,n[9]=d*u-_,n[2]=_*u-d,n[6]=a*f,n[10]=g*u+h}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(z1,e,H1)}lookAt(e,n,i){const s=this.elements;return tn.subVectors(e,n),tn.lengthSq()===0&&(tn.z=1),tn.normalize(),vi.crossVectors(i,tn),vi.lengthSq()===0&&(Math.abs(i.z)===1?tn.x+=1e-4:tn.z+=1e-4,tn.normalize(),vi.crossVectors(i,tn)),vi.normalize(),xo.crossVectors(tn,vi),s[0]=vi.x,s[4]=xo.x,s[8]=tn.x,s[1]=vi.y,s[5]=xo.y,s[9]=tn.y,s[2]=vi.z,s[6]=xo.z,s[10]=tn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,r=this.elements,o=i[0],a=i[4],c=i[8],l=i[12],f=i[1],u=i[5],h=i[9],d=i[13],_=i[2],g=i[6],m=i[10],p=i[14],y=i[3],E=i[7],x=i[11],M=i[15],b=s[0],w=s[4],D=s[8],v=s[12],T=s[1],N=s[5],U=s[9],I=s[13],F=s[2],B=s[6],V=s[10],$=s[14],k=s[3],le=s[7],ie=s[11],we=s[15];return r[0]=o*b+a*T+c*F+l*k,r[4]=o*w+a*N+c*B+l*le,r[8]=o*D+a*U+c*V+l*ie,r[12]=o*v+a*I+c*$+l*we,r[1]=f*b+u*T+h*F+d*k,r[5]=f*w+u*N+h*B+d*le,r[9]=f*D+u*U+h*V+d*ie,r[13]=f*v+u*I+h*$+d*we,r[2]=_*b+g*T+m*F+p*k,r[6]=_*w+g*N+m*B+p*le,r[10]=_*D+g*U+m*V+p*ie,r[14]=_*v+g*I+m*$+p*we,r[3]=y*b+E*T+x*F+M*k,r[7]=y*w+E*N+x*B+M*le,r[11]=y*D+E*U+x*V+M*ie,r[15]=y*v+E*I+x*$+M*we,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],f=e[2],u=e[6],h=e[10],d=e[14],_=e[3],g=e[7],m=e[11],p=e[15];return _*(+r*c*u-s*l*u-r*a*h+i*l*h+s*a*d-i*c*d)+g*(+n*c*d-n*l*h+r*o*h-s*o*d+s*l*f-r*c*f)+m*(+n*l*u-n*a*d-r*o*u+i*o*d+r*a*f-i*l*f)+p*(-s*a*f-n*c*u+n*a*h+s*o*u-i*o*h+i*c*f)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=n,s[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],u=e[9],h=e[10],d=e[11],_=e[12],g=e[13],m=e[14],p=e[15],y=u*m*l-g*h*l+g*c*d-a*m*d-u*c*p+a*h*p,E=_*h*l-f*m*l-_*c*d+o*m*d+f*c*p-o*h*p,x=f*g*l-_*u*l+_*a*d-o*g*d-f*a*p+o*u*p,M=_*u*c-f*g*c-_*a*h+o*g*h+f*a*m-o*u*m,b=n*y+i*E+s*x+r*M;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=y*w,e[1]=(g*h*r-u*m*r-g*s*d+i*m*d+u*s*p-i*h*p)*w,e[2]=(a*m*r-g*c*r+g*s*l-i*m*l-a*s*p+i*c*p)*w,e[3]=(u*c*r-a*h*r-u*s*l+i*h*l+a*s*d-i*c*d)*w,e[4]=E*w,e[5]=(f*m*r-_*h*r+_*s*d-n*m*d-f*s*p+n*h*p)*w,e[6]=(_*c*r-o*m*r-_*s*l+n*m*l+o*s*p-n*c*p)*w,e[7]=(o*h*r-f*c*r+f*s*l-n*h*l-o*s*d+n*c*d)*w,e[8]=x*w,e[9]=(_*u*r-f*g*r-_*i*d+n*g*d+f*i*p-n*u*p)*w,e[10]=(o*g*r-_*a*r+_*i*l-n*g*l-o*i*p+n*a*p)*w,e[11]=(f*a*r-o*u*r-f*i*l+n*u*l+o*i*d-n*a*d)*w,e[12]=M*w,e[13]=(f*g*s-_*u*s+_*i*h-n*g*h-f*i*m+n*u*m)*w,e[14]=(_*a*s-o*g*s-_*i*c+n*g*c+o*i*m-n*a*m)*w,e[15]=(o*u*s-f*a*s+f*i*c-n*u*c-o*i*h+n*a*h)*w,this}scale(e){const n=this.elements,i=e.x,s=e.y,r=e.z;return n[0]*=i,n[4]*=s,n[8]*=r,n[1]*=i,n[5]*=s,n[9]*=r,n[2]*=i,n[6]*=s,n[10]*=r,n[3]*=i,n[7]*=s,n[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,s))}makeTranslation(e,n,i){return this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),s=Math.sin(n),r=1-i,o=e.x,a=e.y,c=e.z,l=r*o,f=r*a;return this.set(l*o+i,l*a-s*c,l*c+s*a,0,l*a+s*c,f*a+i,f*c-s*o,0,l*c-s*a,f*c+s*o,r*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,n,s,1,0,0,0,0,1),this}compose(e,n,i){const s=this.elements,r=n._x,o=n._y,a=n._z,c=n._w,l=r+r,f=o+o,u=a+a,h=r*l,d=r*f,_=r*u,g=o*f,m=o*u,p=a*u,y=c*l,E=c*f,x=c*u,M=i.x,b=i.y,w=i.z;return s[0]=(1-(g+p))*M,s[1]=(d+x)*M,s[2]=(_-E)*M,s[3]=0,s[4]=(d-x)*b,s[5]=(1-(h+p))*b,s[6]=(m+y)*b,s[7]=0,s[8]=(_+E)*w,s[9]=(m-y)*w,s[10]=(1-(h+g))*w,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,n,i){const s=this.elements;let r=Es.set(s[0],s[1],s[2]).length();const o=Es.set(s[4],s[5],s[6]).length(),a=Es.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],En.copy(this);const l=1/r,f=1/o,u=1/a;return En.elements[0]*=l,En.elements[1]*=l,En.elements[2]*=l,En.elements[4]*=f,En.elements[5]*=f,En.elements[6]*=f,En.elements[8]*=u,En.elements[9]*=u,En.elements[10]*=u,n.setFromRotationMatrix(En),i.x=r,i.y=o,i.z=a,this}makePerspective(e,n,i,s,r,o){const a=this.elements,c=2*r/(n-e),l=2*r/(i-s),f=(n+e)/(n-e),u=(i+s)/(i-s),h=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=c,a[4]=0,a[8]=f,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,n,i,s,r,o){const a=this.elements,c=1/(n-e),l=1/(i-s),f=1/(o-r),u=(n+e)*c,h=(i+s)*l,d=(o+r)*f;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*f,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<16;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const Es=new W,En=new vt,z1=new W(0,0,0),H1=new W(1,1,1),vi=new W,xo=new W,tn=new W,Zu=new vt,Ku=new sr;class Pa{constructor(e=0,n=0,i=0,s=Pa.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=s}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,n,i,s=this._order){return this._x=e,this._y=n,this._z=i,this._order=s,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,n=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],c=s[1],l=s[5],f=s[9],u=s[2],h=s[6],d=s[10];switch(n){case"XYZ":this._y=Math.asin(Wt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Wt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Wt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Wt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Wt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Wt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-f,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return Zu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Zu,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Ku.setFromEuler(this),this.setFromQuaternion(Ku,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}}Pa.DEFAULT_ORDER="XYZ";class Km{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let i=0;i0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gr,e,G1),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gr,$1,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,s=n.length;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON()));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,f=c.length;l0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),f.length>0&&(i.images=f),u.length>0&&(i.shapes=u),h.length>0&&(i.skeletons=h),d.length>0&&(i.animations=d),_.length>0&&(i.nodes=_)}return i.object=s,i;function o(a){const c=[];for(const l in a){const f=a[l];delete f.metadata,c.push(f)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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,this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,n,i,s,r){Sn.subVectors(s,n),Yn.subVectors(i,n),Tc.subVectors(e,n);const o=Sn.dot(Sn),a=Sn.dot(Yn),c=Sn.dot(Tc),l=Yn.dot(Yn),f=Yn.dot(Tc),u=o*l-a*a;if(u===0)return r.set(-2,-1,-1);const h=1/u,d=(l*c-a*f)*h,_=(o*f-a*c)*h;return r.set(1-d-_,_,d)}static containsPoint(e,n,i,s){return this.getBarycoord(e,n,i,s,Zn),Zn.x>=0&&Zn.y>=0&&Zn.x+Zn.y<=1}static getUV(e,n,i,s,r,o,a,c){return Eo===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Eo=!0),this.getInterpolation(e,n,i,s,r,o,a,c)}static getInterpolation(e,n,i,s,r,o,a,c){return this.getBarycoord(e,n,i,s,Zn),c.setScalar(0),c.addScaledVector(r,Zn.x),c.addScaledVector(o,Zn.y),c.addScaledVector(a,Zn.z),c}static isFrontFacing(e,n,i,s){return Sn.subVectors(i,n),Yn.subVectors(e,n),Sn.cross(Yn).dot(s)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,s){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,n,i,s){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),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 Sn.subVectors(this.c,this.b),Yn.subVectors(this.a,this.b),Sn.cross(Yn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return wn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return wn.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,i,s,r){return Eo===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Eo=!0),wn.getInterpolation(e,this.a,this.b,this.c,n,i,s,r)}getInterpolation(e,n,i,s,r){return wn.getInterpolation(e,this.a,this.b,this.c,n,i,s,r)}containsPoint(e){return wn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return wn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,s=this.b,r=this.c;let o,a;ys.subVectors(s,i),bs.subVectors(r,i),wc.subVectors(e,i);const c=ys.dot(wc),l=bs.dot(wc);if(c<=0&&l<=0)return n.copy(i);Ac.subVectors(e,s);const f=ys.dot(Ac),u=bs.dot(Ac);if(f>=0&&u<=f)return n.copy(s);const h=c*u-f*l;if(h<=0&&c>=0&&f<=0)return o=c/(c-f),n.copy(i).addScaledVector(ys,o);Rc.subVectors(e,r);const d=ys.dot(Rc),_=bs.dot(Rc);if(_>=0&&d<=_)return n.copy(r);const g=d*l-c*_;if(g<=0&&l>=0&&_<=0)return a=l/(l-_),n.copy(i).addScaledVector(bs,a);const m=f*_-d*u;if(m<=0&&u-f>=0&&d-_>=0)return ih.subVectors(r,s),a=(u-f)/(u-f+(d-_)),n.copy(s).addScaledVector(ih,a);const p=1/(m+g+h);return o=g*p,a=h*p,n.copy(i).addScaledVector(ys,o).addScaledVector(bs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let W1=0;class io extends hs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:W1++}),this.uuid=ir(),this.name="",this.type="Material",this.blending=Xs,this.side=Pi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Bm,this.blendDst=zm,this.blendEquation=Bs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Rl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=p1,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=mc,this.stencilZFail=mc,this.stencilZPass=mc,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.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}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const s=this[n];if(s===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Xs&&(i.blending=this.blending),this.side!==Pi&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const c=r[a];delete c.metadata,o.push(c)}return o}if(n){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}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.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 n=e.clippingPlanes;let i=null;if(n!==null){const s=n.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=n[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.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++}}const Jm={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},yn={h:0,s:0,l:0},So={h:0,s:0,l:0};function Cc(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class st{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,n===void 0&&i===void 0?this.set(e):this.setRGB(e,n,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Be){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Mn.toWorkingColorSpace(this,n),this}setRGB(e,n,i,s=Mn.workingColorSpace){return this.r=e,this.g=n,this.b=i,Mn.toWorkingColorSpace(this,s),this}setHSL(e,n,i,s=Mn.workingColorSpace){if(e=cf(e,1),n=Wt(n,0,1),i=Wt(i,0,1),n===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=Cc(o,r,e+1/3),this.g=Cc(o,r,e),this.b=Cc(o,r,e-1/3)}return Mn.toWorkingColorSpace(this,s),this}setStyle(e,n=Be){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(r,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Be){const i=Jm[e.toLowerCase()];return i!==void 0?this.setHex(i,n):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=js(e.r),this.g=js(e.g),this.b=js(e.b),this}copyLinearToSRGB(e){return this.r=_c(e.r),this.g=_c(e.g),this.b=_c(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Be){return Mn.fromWorkingColorSpace(Ut.copy(this),e),Math.round(Wt(Ut.r*255,0,255))*65536+Math.round(Wt(Ut.g*255,0,255))*256+Math.round(Wt(Ut.b*255,0,255))}getHexString(e=Be){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Mn.workingColorSpace){Mn.fromWorkingColorSpace(Ut.copy(this),n);const i=Ut.r,s=Ut.g,r=Ut.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let c,l;const f=(a+o)/2;if(a===o)c=0,l=0;else{const u=o-a;switch(l=f<=.5?u/(o+a):u/(2-o-a),o){case i:c=(s-r)/u+(s0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const c in i){const l=i[c];e.data.attributes[c]=l.toJSON(e.data)}const s={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],f=[];for(let u=0,h=l.length;u0&&(s[c]=f,r=!0)}r&&(e.data.morphAttributes=s,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={center:a.center.toArray(),radius:a.radius}),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 n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(n));const s=e.attributes;for(const l in s){const f=s[l];this.setAttribute(l,f.clone(n))}const r=e.morphAttributes;for(const l in r){const f=[],u=r[l];for(let h=0,d=u.length;h0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(sh.copy(r).invert(),In.copy(e.ray).applyMatrix4(sh),!(i.boundingBox!==null&&In.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n)))}_computeIntersections(e,n){let i;const s=this.geometry,r=this.material,o=s.index,a=s.attributes.position,c=s.attributes.uv,l=s.attributes.uv1,f=s.attributes.normal,u=s.groups,h=s.drawRange;if(o!==null)if(Array.isArray(r))for(let d=0,_=u.length;d<_;d++){const g=u[d],m=r[g.materialIndex],p=Math.max(g.start,h.start),y=Math.min(o.count,Math.min(g.start+g.count,h.start+h.count));for(let E=p,x=y;En.far?null:{distance:l,point:Po.clone(),object:t}}function Lo(t,e,n,i,s,r,o,a,c,l){t.getVertexPosition(a,ws),t.getVertexPosition(c,As),t.getVertexPosition(l,Rs);const f=q1(t,e,n,i,ws,As,Rs,Co);if(f){s&&(wo.fromBufferAttribute(s,a),Ao.fromBufferAttribute(s,c),Ro.fromBufferAttribute(s,l),f.uv=wn.getInterpolation(Co,ws,As,Rs,wo,Ao,Ro,new Ve)),r&&(wo.fromBufferAttribute(r,a),Ao.fromBufferAttribute(r,c),Ro.fromBufferAttribute(r,l),f.uv1=wn.getInterpolation(Co,ws,As,Rs,wo,Ao,Ro,new Ve),f.uv2=f.uv1),o&&(oh.fromBufferAttribute(o,a),ah.fromBufferAttribute(o,c),ch.fromBufferAttribute(o,l),f.normal=wn.getInterpolation(Co,ws,As,Rs,oh,ah,ch,new W),f.normal.dot(i.direction)>0&&f.normal.multiplyScalar(-1));const u={a,b:c,c:l,normal:new W,materialIndex:0};wn.getNormal(ws,As,Rs,u.normal),f.face=u}return f}class so extends fi{constructor(e=1,n=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const c=[],l=[],f=[],u=[];let h=0,d=0;_("z","y","x",-1,-1,i,n,e,o,r,0),_("z","y","x",1,-1,i,n,-e,o,r,1),_("x","z","y",1,1,e,i,n,s,o,2),_("x","z","y",1,-1,e,i,-n,s,o,3),_("x","y","z",1,-1,e,n,i,s,r,4),_("x","y","z",-1,-1,e,n,-i,s,r,5),this.setIndex(c),this.setAttribute("position",new li(l,3)),this.setAttribute("normal",new li(f,3)),this.setAttribute("uv",new li(u,2));function _(g,m,p,y,E,x,M,b,w,D,v){const T=x/w,N=M/D,U=x/2,I=M/2,F=b/2,B=w+1,V=D+1;let $=0,k=0;const le=new W;for(let ie=0;ie0?1:-1,f.push(le.x,le.y,le.z),u.push(ce/w),u.push(1-ie/D),$+=1}}for(let ie=0;ie0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}}class xm extends It{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new _t,this.projectionMatrix=new _t,this.projectionMatrixInverse=new _t}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(-n[8],-n[9],-n[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class pn extends xm{constructor(e=50,n=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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 n=.5*this.getFilmHeight()/e;this.fov=Br*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ar*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Br*2*Math.atan(Math.tan(Ar*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,n,i,s,r,o){this.aspect=e/n,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=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Ar*.5*this.fov)/this.zoom,i=2*n,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,l=o.fullHeight;r+=o.offsetX*s/c,n-=o.offsetY*i/l,s*=o.width/c,i*=o.height/l}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,n,n-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const _s=-90,vs=1;class c1 extends It{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i;const s=new pn(_s,vs,e,n);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(1,0,0),this.add(s);const r=new pn(_s,vs,e,n);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);const o=new pn(_s,vs,e,n);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new pn(_s,vs,e,n);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const c=new pn(_s,vs,e,n);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,1),this.add(c);const l=new pn(_s,vs,e,n);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,n){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[s,r,o,a,c,l]=this.children,f=e.getRenderTarget(),u=e.toneMapping,h=e.xr.enabled;e.toneMapping=ri,e.xr.enabled=!1;const d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(n,s),e.setRenderTarget(i,1),e.render(n,r),e.setRenderTarget(i,2),e.render(n,o),e.setRenderTarget(i,3),e.render(n,a),e.setRenderTarget(i,4),e.render(n,c),i.texture.generateMipmaps=d,e.setRenderTarget(i,5),e.render(n,l),e.setRenderTarget(f),e.toneMapping=u,e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class Mm extends ln{constructor(e,n,i,s,r,o,a,c,l,f){e=e!==void 0?e:[],n=n!==void 0?n:Os,super(e,n,i,s,r,o,a,c,l,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class l1 extends Ki{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];n.encoding!==void 0&&(Cr("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Yi?Be:ji),this.texture=new Mm(s,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:dn}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class fs extends io{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Z1,this.fragmentShader=K1,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!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=Qs(e.uniforms),this.uniformsGroups=j1(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 n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?n.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[s]={type:"m4",value:o.toArray()}:n.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}}class ig extends Nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new vt,this.projectionMatrix=new vt,this.projectionMatrixInverse=new vt}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(-n[8],-n[9],-n[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class gn extends ig{constructor(e=50,n=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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 n=.5*this.getFilmHeight()/e;this.fov=Kr*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(zr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Kr*2*Math.atan(Math.tan(zr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,n,i,s,r,o){this.aspect=e/n,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=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(zr*.5*this.fov)/this.zoom,i=2*n,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,l=o.fullHeight;r+=o.offsetX*s/c,n-=o.offsetY*i/l,s*=o.width/c,i*=o.height/l}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,n,n-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Cs=-90,Ps=1;class J1 extends Nt{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i;const s=new gn(Cs,Ps,e,n);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(1,0,0),this.add(s);const r=new gn(Cs,Ps,e,n);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);const o=new gn(Cs,Ps,e,n);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new gn(Cs,Ps,e,n);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const c=new gn(Cs,Ps,e,n);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,1),this.add(c);const l=new gn(Cs,Ps,e,n);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,n){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[s,r,o,a,c,l]=this.children,f=e.getRenderTarget(),u=e.toneMapping,h=e.xr.enabled;e.toneMapping=ci,e.xr.enabled=!1;const d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(n,s),e.setRenderTarget(i,1),e.render(n,r),e.setRenderTarget(i,2),e.render(n,o),e.setRenderTarget(i,3),e.render(n,a),e.setRenderTarget(i,4),e.render(n,c),i.texture.generateMipmaps=d,e.setRenderTarget(i,5),e.render(n,l),e.setRenderTarget(f),e.toneMapping=u,e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class sg extends fn{constructor(e,n,i,s,r,o,a,c,l,f){e=e!==void 0?e:[],n=n!==void 0?n:Zs,super(e,n,i,s,r,o,a,c,l,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Q1 extends ls{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];n.encoding!==void 0&&(Vr("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===os?Be:as),this.texture=new sg(s,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:mn}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -57,28 +57,28 @@ gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},s=new Wr(5,5,5),r=new Ji({name:"CubemapFromEquirect",uniforms:Vs(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Zt,blending:yi});r.uniforms.tEquirect.value=n;const o=new ii(s,r),a=n.minFilter;return n.minFilter===Fr&&(n.minFilter=dn),new c1(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,i,s){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,i,s);e.setRenderTarget(r)}}const lc=new W,f1=new W,u1=new qe;class Bi{constructor(e=new W(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,s){return this.normal.set(e,n,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const s=lc.subVectors(i,n).cross(f1.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(s,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,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(lc),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:n.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>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,n){const i=n||u1.getNormalMatrix(e),s=this.coplanarPoint(lc).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ii=new kl,xo=new W;class Wl{constructor(e=new Bi,n=new Bi,i=new Bi,s=new Bi,r=new Bi,o=new Bi){this.planes=[e,n,i,s,r,o]}set(e,n,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const n=this.planes,i=e.elements,s=i[0],r=i[1],o=i[2],a=i[3],c=i[4],l=i[5],f=i[6],u=i[7],h=i[8],d=i[9],_=i[10],g=i[11],m=i[12],p=i[13],y=i[14],E=i[15];return n[0].setComponents(a-s,u-c,g-h,E-m).normalize(),n[1].setComponents(a+s,u+c,g+h,E+m).normalize(),n[2].setComponents(a+r,u+l,g+d,E+p).normalize(),n[3].setComponents(a-r,u-l,g-d,E-p).normalize(),n[4].setComponents(a-o,u-f,g-_,E-y).normalize(),n[5].setComponents(a+o,u+f,g+_,E+y).normalize(),this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ii.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Ii.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ii)}intersectsSprite(e){return Ii.center.set(0,0,0),Ii.radius=.7071067811865476,Ii.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ii)}intersectsSphere(e){const n=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(n[r].distanceToPoint(i)0?e.max.x:e.min.x,xo.y=s.normal.y>0?e.max.y:e.min.y,xo.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(xo)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Em(){let t=null,e=!1,n=null,i=null;function s(r,o){n(r,o),i=t.requestAnimationFrame(s)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(s),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){n=r},setContext:function(r){t=r}}}function h1(t,e){const n=e.isWebGL2,i=new WeakMap;function s(l,f){const u=l.array,h=l.usage,d=t.createBuffer();t.bindBuffer(f,d),t.bufferData(f,u,h),l.onUploadCallback();let _;if(u instanceof Float32Array)_=t.FLOAT;else if(u instanceof Uint16Array)if(l.isFloat16BufferAttribute)if(n)_=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=t.UNSIGNED_SHORT;else if(u instanceof Int16Array)_=t.SHORT;else if(u instanceof Uint32Array)_=t.UNSIGNED_INT;else if(u instanceof Int32Array)_=t.INT;else if(u instanceof Int8Array)_=t.BYTE;else if(u instanceof Uint8Array)_=t.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)_=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:d,type:_,bytesPerElement:u.BYTES_PER_ELEMENT,version:l.version}}function r(l,f,u){const h=f.array,d=f.updateRange;t.bindBuffer(u,l),d.count===-1?t.bufferSubData(u,0,h):(n?t.bufferSubData(u,d.offset*h.BYTES_PER_ELEMENT,h,d.offset,d.count):t.bufferSubData(u,d.offset*h.BYTES_PER_ELEMENT,h.subarray(d.offset,d.offset+d.count)),d.count=-1),f.onUploadCallback()}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const f=i.get(l);f&&(t.deleteBuffer(f.buffer),i.delete(l))}function c(l,f){if(l.isGLBufferAttribute){const h=i.get(l);(!h||h.version1?null:n.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>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,n){const i=n||tM.getNormalMatrix(e),s=this.coplanarPoint(Dc).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),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 $i=new lf,Do=new W;class ff{constructor(e=new qi,n=new qi,i=new qi,s=new qi,r=new qi,o=new qi){this.planes=[e,n,i,s,r,o]}set(e,n,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const n=this.planes,i=e.elements,s=i[0],r=i[1],o=i[2],a=i[3],c=i[4],l=i[5],f=i[6],u=i[7],h=i[8],d=i[9],_=i[10],g=i[11],m=i[12],p=i[13],y=i[14],E=i[15];return n[0].setComponents(a-s,u-c,g-h,E-m).normalize(),n[1].setComponents(a+s,u+c,g+h,E+m).normalize(),n[2].setComponents(a+r,u+l,g+d,E+p).normalize(),n[3].setComponents(a-r,u-l,g-d,E-p).normalize(),n[4].setComponents(a-o,u-f,g-_,E-y).normalize(),n[5].setComponents(a+o,u+f,g+_,E+y).normalize(),this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),$i.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),$i.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($i)}intersectsSprite(e){return $i.center.set(0,0,0),$i.radius=.7071067811865476,$i.applyMatrix4(e.matrixWorld),this.intersectsSphere($i)}intersectsSphere(e){const n=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(n[r].distanceToPoint(i)0?e.max.x:e.min.x,Do.y=s.normal.y>0?e.max.y:e.min.y,Do.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(Do)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function rg(){let t=null,e=!1,n=null,i=null;function s(r,o){n(r,o),i=t.requestAnimationFrame(s)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(s),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){n=r},setContext:function(r){t=r}}}function nM(t,e){const n=e.isWebGL2,i=new WeakMap;function s(l,f){const u=l.array,h=l.usage,d=t.createBuffer();t.bindBuffer(f,d),t.bufferData(f,u,h),l.onUploadCallback();let _;if(u instanceof Float32Array)_=t.FLOAT;else if(u instanceof Uint16Array)if(l.isFloat16BufferAttribute)if(n)_=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=t.UNSIGNED_SHORT;else if(u instanceof Int16Array)_=t.SHORT;else if(u instanceof Uint32Array)_=t.UNSIGNED_INT;else if(u instanceof Int32Array)_=t.INT;else if(u instanceof Int8Array)_=t.BYTE;else if(u instanceof Uint8Array)_=t.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)_=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:d,type:_,bytesPerElement:u.BYTES_PER_ELEMENT,version:l.version}}function r(l,f,u){const h=f.array,d=f.updateRange;t.bindBuffer(u,l),d.count===-1?t.bufferSubData(u,0,h):(n?t.bufferSubData(u,d.offset*h.BYTES_PER_ELEMENT,h,d.offset,d.count):t.bufferSubData(u,d.offset*h.BYTES_PER_ELEMENT,h.subarray(d.offset,d.offset+d.count)),d.count=-1),f.onUploadCallback()}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const f=i.get(l);f&&(t.deleteBuffer(f.buffer),i.delete(l))}function c(l,f){if(l.isGLBufferAttribute){const h=i.get(l);(!h||h.version 0 +#endif`,pM=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { @@ -195,26 +195,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #pragma unroll_loop_end if ( clipped ) discard; #endif -#endif`,T1=`#if NUM_CLIPPING_PLANES > 0 +#endif`,mM=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,w1=`#if NUM_CLIPPING_PLANES > 0 +#endif`,gM=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,A1=`#if NUM_CLIPPING_PLANES > 0 +#endif`,_M=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,R1=`#if defined( USE_COLOR_ALPHA ) +#endif`,vM=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,C1=`#if defined( USE_COLOR_ALPHA ) +#endif`,xM=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,P1=`#if defined( USE_COLOR_ALPHA ) +#endif`,MM=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,L1=`#if defined( USE_COLOR_ALPHA ) +#endif`,EM=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); @@ -224,7 +224,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; -#endif`,D1=`#define PI 3.141592653589793 +#endif`,SM=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -307,7 +307,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,U1=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,yM=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -405,7 +405,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,I1=`vec3 transformedNormal = objectNormal; +#endif`,bM=`vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 m = mat3( instanceMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); @@ -420,23 +420,23 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,N1=`#ifdef USE_DISPLACEMENTMAP +#endif`,TM=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,F1=`#ifdef USE_DISPLACEMENTMAP +#endif`,wM=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,O1=`#ifdef USE_EMISSIVEMAP +#endif`,AM=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,B1=`#ifdef USE_EMISSIVEMAP +#endif`,RM=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,z1="gl_FragColor = linearToOutputTexel( gl_FragColor );",V1=`vec4 LinearToLinear( in vec4 value ) { +#endif`,CM="gl_FragColor = linearToOutputTexel( gl_FragColor );",PM=`vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( in vec4 value ) { 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 ); -}`,H1=`#ifdef USE_ENVMAP +}`,LM=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -465,7 +465,7 @@ vec4 LinearTosRGB( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,G1=`#ifdef USE_ENVMAP +#endif`,DM=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE @@ -474,7 +474,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,$1=`#ifdef USE_ENVMAP +#endif`,UM=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -485,7 +485,7 @@ vec4 LinearTosRGB( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,k1=`#ifdef USE_ENVMAP +#endif`,IM=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -496,7 +496,7 @@ vec4 LinearTosRGB( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,W1=`#ifdef USE_ENVMAP +#endif`,NM=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -513,18 +513,18 @@ vec4 LinearTosRGB( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,X1=`#ifdef USE_FOG +#endif`,FM=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,q1=`#ifdef USE_FOG +#endif`,OM=`#ifdef USE_FOG varying float vFogDepth; -#endif`,Y1=`#ifdef USE_FOG +#endif`,BM=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,j1=`#ifdef USE_FOG +#endif`,zM=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -533,7 +533,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,Z1=`#ifdef USE_GRADIENTMAP +#endif`,HM=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -545,16 +545,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,K1=`#ifdef USE_LIGHTMAP +}`,VM=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,J1=`#ifdef USE_LIGHTMAP +#endif`,GM=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,Q1=`LambertMaterial material; +#endif`,$M=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,eM=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,kM=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -568,7 +568,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricCon reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,tM=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,WM=`uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { @@ -689,7 +689,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,nM=`#if defined( USE_ENVMAP ) +#endif`,XM=`#if defined( USE_ENVMAP ) vec3 getIBLIrradiance( const in vec3 normal ) { #if defined( ENVMAP_TYPE_CUBE_UV ) vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -710,8 +710,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi return vec3( 0.0 ); #endif } -#endif`,iM=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,sM=`varying vec3 vViewPosition; +#endif`,qM=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,jM=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -723,11 +723,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContex reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,rM=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,YM=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,oM=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,ZM=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -744,7 +744,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in Geometric reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,aM=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,KM=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -808,7 +808,7 @@ material.roughness = min( material.roughness, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif -#endif`,cM=`struct PhysicalMaterial { +#endif`,JM=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1074,7 +1074,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,lM=` +}`,QM=` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; @@ -1187,7 +1187,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,fM=`#if defined( RE_IndirectDiffuse ) +#endif`,eE=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1202,25 +1202,25 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,uM=`#if defined( RE_IndirectDiffuse ) +#endif`,tE=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`,hM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,nE=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,dM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,iE=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,pM=`#ifdef USE_LOGDEPTHBUF +#endif`,sE=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,mM=`#ifdef USE_LOGDEPTHBUF +#endif`,rE=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); @@ -1230,11 +1230,11 @@ IncidentLight directLight; gl_Position.z *= gl_Position.w; } #endif -#endif`,gM=`#ifdef USE_MAP +#endif`,oE=`#ifdef USE_MAP diffuseColor *= texture2D( map, vMapUv ); -#endif`,_M=`#ifdef USE_MAP +#endif`,aE=`#ifdef USE_MAP uniform sampler2D map; -#endif`,vM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,cE=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1246,7 +1246,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,xM=`#if defined( USE_POINTS_UV ) +#endif`,lE=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1258,13 +1258,13 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,MM=`float metalnessFactor = metalness; +#endif`,fE=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,EM=`#ifdef USE_METALNESSMAP +#endif`,uE=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,SM=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,hE=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1273,7 +1273,7 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,yM=`#ifdef USE_MORPHNORMALS +#endif`,dE=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1285,7 +1285,7 @@ IncidentLight directLight; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif -#endif`,bM=`#ifdef USE_MORPHTARGETS +#endif`,pE=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1305,7 +1305,7 @@ IncidentLight directLight; uniform float morphTargetInfluences[ 4 ]; #endif #endif -#endif`,TM=`#ifdef USE_MORPHTARGETS +#endif`,mE=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1323,7 +1323,7 @@ IncidentLight directLight; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif -#endif`,wM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,gE=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1356,7 +1356,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 geometryNormal = normal;`,AM=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 geometryNormal = normal;`,_E=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1371,25 +1371,25 @@ vec3 geometryNormal = normal;`,AM=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,RM=`#ifndef FLAT_SHADED +#endif`,vE=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,CM=`#ifndef FLAT_SHADED +#endif`,xE=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,PM=`#ifndef FLAT_SHADED +#endif`,ME=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,LM=`#ifdef USE_NORMALMAP +#endif`,EE=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1411,13 +1411,13 @@ vec3 geometryNormal = normal;`,AM=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,DM=`#ifdef USE_CLEARCOAT +#endif`,SE=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; -#endif`,UM=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,yE=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,IM=`#ifdef USE_CLEARCOATMAP +#endif`,bE=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1426,18 +1426,18 @@ vec3 geometryNormal = normal;`,AM=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,NM=`#ifdef USE_IRIDESCENCEMAP +#endif`,TE=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,FM=`#ifdef OPAQUE +#endif`,wE=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha + 0.1; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,OM=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,AE=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1478,29 +1478,29 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,BM=`#ifdef PREMULTIPLIED_ALPHA +}`,RE=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,zM=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,CE=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,VM=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,PE=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,HM=`#ifdef DITHERING +#endif`,LE=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,GM=`float roughnessFactor = roughness; +#endif`,DE=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,$M=`#ifdef USE_ROUGHNESSMAP +#endif`,UE=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,kM=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,IE=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -1677,7 +1677,7 @@ gl_Position = projectionMatrix * mvPosition;`,VM=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,WM=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,NE=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -1715,7 +1715,7 @@ gl_Position = projectionMatrix * mvPosition;`,VM=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,XM=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,FE=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -1747,7 +1747,7 @@ gl_Position = projectionMatrix * mvPosition;`,VM=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,qM=`float getShadowMask() { +#endif`,OE=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -1779,12 +1779,12 @@ gl_Position = projectionMatrix * mvPosition;`,VM=`#ifdef DITHERING #endif #endif return shadow; -}`,YM=`#ifdef USE_SKINNING +}`,BE=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,jM=`#ifdef USE_SKINNING +#endif`,zE=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -1803,7 +1803,7 @@ gl_Position = projectionMatrix * mvPosition;`,VM=`#ifdef DITHERING mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } -#endif`,ZM=`#ifdef USE_SKINNING +#endif`,HE=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -1811,7 +1811,7 @@ gl_Position = projectionMatrix * mvPosition;`,VM=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,KM=`#ifdef USE_SKINNING +#endif`,VE=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -1822,17 +1822,17 @@ gl_Position = projectionMatrix * mvPosition;`,VM=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,JM=`float specularStrength; +#endif`,GE=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,QM=`#ifdef USE_SPECULARMAP +#endif`,$E=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,eE=`#if defined( TONE_MAPPING ) +#endif`,kE=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,tE=`#ifndef saturate +#endif`,WE=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -1868,7 +1868,7 @@ vec3 ACESFilmicToneMapping( vec3 color ) { color = ACESOutputMat * color; return saturate( color ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,nE=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,XE=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -1889,7 +1889,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nE=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); -#endif`,iE=`#ifdef USE_TRANSMISSION +#endif`,qE=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -1993,7 +1993,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nE=`#ifdef USE_TRANSMISS vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } -#endif`,sE=`#ifdef USE_UV +#endif`,jE=`#ifdef USE_UV varying vec2 vUv; #endif #ifdef USE_MAP @@ -2060,7 +2060,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nE=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,rE=`#ifdef USE_UV +#endif`,YE=`#ifdef USE_UV varying vec2 vUv; #endif #ifdef USE_MAP @@ -2150,7 +2150,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nE=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,oE=`#ifdef USE_UV +#endif`,ZE=`#ifdef USE_UV vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2218,18 +2218,18 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,nE=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,aE=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,KE=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const cE=`varying vec2 vUv; +#endif`;const JE=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,lE=`uniform sampler2D t2D; +}`,QE=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2238,14 +2238,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,fE=`varying vec3 vWorldDirection; +}`,eS=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,uE=`#ifdef ENVMAP_TYPE_CUBE +}`,tS=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2267,14 +2267,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,hE=`varying vec3 vWorldDirection; +}`,nS=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,dE=`uniform samplerCube tCube; +}`,iS=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2284,7 +2284,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,pE=`#include +}`,sS=`#include #include #include #include @@ -2308,7 +2308,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,mE=`#if DEPTH_PACKING == 3200 +}`,rS=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2336,7 +2336,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,gE=`#define DISTANCE +}`,oS=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2360,7 +2360,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,_E=`#define DISTANCE +}`,aS=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2382,13 +2382,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,vE=`varying vec3 vWorldDirection; +}`,cS=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,xE=`uniform sampler2D tEquirect; +}`,lS=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2397,7 +2397,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,ME=`uniform float scale; +}`,fS=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2418,7 +2418,7 @@ void main() { #include #include #include -}`,EE=`uniform vec3 diffuse; +}`,uS=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2446,7 +2446,7 @@ void main() { #include #include #include -}`,SE=`#include +}`,hS=`#include #include #include #include @@ -2475,7 +2475,7 @@ void main() { #include #include #include -}`,yE=`uniform vec3 diffuse; +}`,dS=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2521,7 +2521,7 @@ void main() { #include #include #include -}`,bE=`#define LAMBERT +}`,pS=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2557,7 +2557,7 @@ void main() { #include #include #include -}`,TE=`#define LAMBERT +}`,mS=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -2612,7 +2612,7 @@ void main() { #include #include #include -}`,wE=`#define MATCAP +}`,gS=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -2643,7 +2643,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,AE=`#define MATCAP +}`,_S=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -2687,7 +2687,7 @@ void main() { #include #include #include -}`,RE=`#define NORMAL +}`,vS=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -2717,7 +2717,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,CE=`#define NORMAL +}`,xS=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -2738,7 +2738,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,PE=`#define PHONG +}`,MS=`#define PHONG varying vec3 vViewPosition; #include #include @@ -2774,7 +2774,7 @@ void main() { #include #include #include -}`,LE=`#define PHONG +}`,ES=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -2831,7 +2831,7 @@ void main() { #include #include #include -}`,DE=`#define STANDARD +}`,SS=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -2871,7 +2871,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,UE=`#define STANDARD +}`,yS=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -2985,7 +2985,7 @@ void main() { #include #include #include -}`,IE=`#define TOON +}`,bS=`#define TOON varying vec3 vViewPosition; #include #include @@ -3019,7 +3019,7 @@ void main() { #include #include #include -}`,NE=`#define TOON +}`,TS=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3070,7 +3070,7 @@ void main() { #include #include #include -}`,FE=`uniform float size; +}`,wS=`uniform float size; uniform float scale; #include #include @@ -3100,7 +3100,7 @@ void main() { #include #include #include -}`,OE=`uniform vec3 diffuse; +}`,AS=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3123,7 +3123,7 @@ void main() { #include #include #include -}`,BE=`#include +}`,RS=`#include #include #include #include @@ -3143,7 +3143,7 @@ void main() { #include #include #include -}`,zE=`uniform vec3 color; +}`,CS=`uniform vec3 color; uniform float opacity; #include #include @@ -3159,7 +3159,7 @@ void main() { #include #include #include -}`,VE=`uniform float rotation; +}`,PS=`uniform float rotation; uniform vec2 center; #include #include @@ -3185,7 +3185,7 @@ void main() { #include #include #include -}`,HE=`uniform vec3 diffuse; +}`,LS=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3208,7 +3208,7 @@ void main() { #include #include #include -}`,Ve={alphamap_fragment:d1,alphamap_pars_fragment:p1,alphatest_fragment:m1,alphatest_pars_fragment:g1,aomap_fragment:_1,aomap_pars_fragment:v1,begin_vertex:x1,beginnormal_vertex:M1,bsdfs:E1,iridescence_fragment:S1,bumpmap_pars_fragment:y1,clipping_planes_fragment:b1,clipping_planes_pars_fragment:T1,clipping_planes_pars_vertex:w1,clipping_planes_vertex:A1,color_fragment:R1,color_pars_fragment:C1,color_pars_vertex:P1,color_vertex:L1,common:D1,cube_uv_reflection_fragment:U1,defaultnormal_vertex:I1,displacementmap_pars_vertex:N1,displacementmap_vertex:F1,emissivemap_fragment:O1,emissivemap_pars_fragment:B1,encodings_fragment:z1,encodings_pars_fragment:V1,envmap_fragment:H1,envmap_common_pars_fragment:G1,envmap_pars_fragment:$1,envmap_pars_vertex:k1,envmap_physical_pars_fragment:nM,envmap_vertex:W1,fog_vertex:X1,fog_pars_vertex:q1,fog_fragment:Y1,fog_pars_fragment:j1,gradientmap_pars_fragment:Z1,lightmap_fragment:K1,lightmap_pars_fragment:J1,lights_lambert_fragment:Q1,lights_lambert_pars_fragment:eM,lights_pars_begin:tM,lights_toon_fragment:iM,lights_toon_pars_fragment:sM,lights_phong_fragment:rM,lights_phong_pars_fragment:oM,lights_physical_fragment:aM,lights_physical_pars_fragment:cM,lights_fragment_begin:lM,lights_fragment_maps:fM,lights_fragment_end:uM,logdepthbuf_fragment:hM,logdepthbuf_pars_fragment:dM,logdepthbuf_pars_vertex:pM,logdepthbuf_vertex:mM,map_fragment:gM,map_pars_fragment:_M,map_particle_fragment:vM,map_particle_pars_fragment:xM,metalnessmap_fragment:MM,metalnessmap_pars_fragment:EM,morphcolor_vertex:SM,morphnormal_vertex:yM,morphtarget_pars_vertex:bM,morphtarget_vertex:TM,normal_fragment_begin:wM,normal_fragment_maps:AM,normal_pars_fragment:RM,normal_pars_vertex:CM,normal_vertex:PM,normalmap_pars_fragment:LM,clearcoat_normal_fragment_begin:DM,clearcoat_normal_fragment_maps:UM,clearcoat_pars_fragment:IM,iridescence_pars_fragment:NM,output_fragment:FM,packing:OM,premultiplied_alpha_fragment:BM,project_vertex:zM,dithering_fragment:VM,dithering_pars_fragment:HM,roughnessmap_fragment:GM,roughnessmap_pars_fragment:$M,shadowmap_pars_fragment:kM,shadowmap_pars_vertex:WM,shadowmap_vertex:XM,shadowmask_pars_fragment:qM,skinbase_vertex:YM,skinning_pars_vertex:jM,skinning_vertex:ZM,skinnormal_vertex:KM,specularmap_fragment:JM,specularmap_pars_fragment:QM,tonemapping_fragment:eE,tonemapping_pars_fragment:tE,transmission_fragment:nE,transmission_pars_fragment:iE,uv_pars_fragment:sE,uv_pars_vertex:rE,uv_vertex:oE,worldpos_vertex:aE,background_vert:cE,background_frag:lE,backgroundCube_vert:fE,backgroundCube_frag:uE,cube_vert:hE,cube_frag:dE,depth_vert:pE,depth_frag:mE,distanceRGBA_vert:gE,distanceRGBA_frag:_E,equirect_vert:vE,equirect_frag:xE,linedashed_vert:ME,linedashed_frag:EE,meshbasic_vert:SE,meshbasic_frag:yE,meshlambert_vert:bE,meshlambert_frag:TE,meshmatcap_vert:wE,meshmatcap_frag:AE,meshnormal_vert:RE,meshnormal_frag:CE,meshphong_vert:PE,meshphong_frag:LE,meshphysical_vert:DE,meshphysical_frag:UE,meshtoon_vert:IE,meshtoon_frag:NE,points_vert:FE,points_frag:OE,shadow_vert:BE,shadow_frag:zE,sprite_vert:VE,sprite_frag:HE},_e={common:{diffuse:{value:new it(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qe}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qe},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new it(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 it(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new qe}},sprite:{diffuse:{value:new it(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaTest:{value:0}}},Un={basic:{uniforms:Vt([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.fog]),vertexShader:Ve.meshbasic_vert,fragmentShader:Ve.meshbasic_frag},lambert:{uniforms:Vt([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,_e.lights,{emissive:{value:new it(0)}}]),vertexShader:Ve.meshlambert_vert,fragmentShader:Ve.meshlambert_frag},phong:{uniforms:Vt([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,_e.lights,{emissive:{value:new it(0)},specular:{value:new it(1118481)},shininess:{value:30}}]),vertexShader:Ve.meshphong_vert,fragmentShader:Ve.meshphong_frag},standard:{uniforms:Vt([_e.common,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.roughnessmap,_e.metalnessmap,_e.fog,_e.lights,{emissive:{value:new it(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag},toon:{uniforms:Vt([_e.common,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.gradientmap,_e.fog,_e.lights,{emissive:{value:new it(0)}}]),vertexShader:Ve.meshtoon_vert,fragmentShader:Ve.meshtoon_frag},matcap:{uniforms:Vt([_e.common,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,{matcap:{value:null}}]),vertexShader:Ve.meshmatcap_vert,fragmentShader:Ve.meshmatcap_frag},points:{uniforms:Vt([_e.points,_e.fog]),vertexShader:Ve.points_vert,fragmentShader:Ve.points_frag},dashed:{uniforms:Vt([_e.common,_e.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ve.linedashed_vert,fragmentShader:Ve.linedashed_frag},depth:{uniforms:Vt([_e.common,_e.displacementmap]),vertexShader:Ve.depth_vert,fragmentShader:Ve.depth_frag},normal:{uniforms:Vt([_e.common,_e.bumpmap,_e.normalmap,_e.displacementmap,{opacity:{value:1}}]),vertexShader:Ve.meshnormal_vert,fragmentShader:Ve.meshnormal_frag},sprite:{uniforms:Vt([_e.sprite,_e.fog]),vertexShader:Ve.sprite_vert,fragmentShader:Ve.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ve.background_vert,fragmentShader:Ve.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ve.backgroundCube_vert,fragmentShader:Ve.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ve.cube_vert,fragmentShader:Ve.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ve.equirect_vert,fragmentShader:Ve.equirect_frag},distanceRGBA:{uniforms:Vt([_e.common,_e.displacementmap,{referencePosition:{value:new W},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ve.distanceRGBA_vert,fragmentShader:Ve.distanceRGBA_frag},shadow:{uniforms:Vt([_e.lights,_e.fog,{color:{value:new it(0)},opacity:{value:1}}]),vertexShader:Ve.shadow_vert,fragmentShader:Ve.shadow_frag}};Un.physical={uniforms:Vt([Un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qe},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qe},sheen:{value:0},sheenColor:{value:new it(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qe},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new it(0)},specularColor:{value:new it(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag};const Mo={r:0,b:0,g:0};function GE(t,e,n,i,s,r,o){const a=new it(0);let c=r===!0?0:1,l,f,u=null,h=0,d=null;function _(m,p){let y=!1,E=p.isScene===!0?p.background:null;switch(E&&E.isTexture&&(E=(p.backgroundBlurriness>0?n:e).get(E)),E===null?g(a,c):E&&E.isColor&&(g(E,1),y=!0),t.xr.getEnvironmentBlendMode()){case"opaque":y=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,o),y=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,o),y=!0;break}(t.autoClear||y)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),E&&(E.isCubeTexture||E.mapping===fa)?(f===void 0&&(f=new ii(new Wr(1,1,1),new Ji({name:"BackgroundCubeMaterial",uniforms:Vs(Un.backgroundCube.uniforms),vertexShader:Un.backgroundCube.vertexShader,fragmentShader:Un.backgroundCube.fragmentShader,side:Zt,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(b,w,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(f)),f.material.uniforms.envMap.value=E,f.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,f.material.toneMapped=E.colorSpace!==Be,(u!==E||h!==E.version||d!==t.toneMapping)&&(f.material.needsUpdate=!0,u=E,h=E.version,d=t.toneMapping),f.layers.enableAll(),m.unshift(f,f.geometry,f.material,0,0,null)):E&&E.isTexture&&(l===void 0&&(l=new ii(new Xl(2,2),new Ji({name:"BackgroundMaterial",uniforms:Vs(Un.background.uniforms),vertexShader:Un.background.vertexShader,fragmentShader:Un.background.fragmentShader,side:bi,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=E,l.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,l.material.toneMapped=E.colorSpace!==Be,E.matrixAutoUpdate===!0&&E.updateMatrix(),l.material.uniforms.uvTransform.value.copy(E.matrix),(u!==E||h!==E.version||d!==t.toneMapping)&&(l.material.needsUpdate=!0,u=E,h=E.version,d=t.toneMapping),l.layers.enableAll(),m.unshift(l,l.geometry,l.material,0,0,null))}function g(m,p){m.getRGB(Mo,vm(t)),i.buffers.color.setClear(Mo.r,Mo.g,Mo.b,p,o)}return{getClearColor:function(){return a},setClearColor:function(m,p=1){a.set(m),c=p,g(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(m){c=m,g(a,c)},render:_}}function $E(t,e,n,i){const s=t.getParameter(t.MAX_VERTEX_ATTRIBS),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},c=m(null);let l=c,f=!1;function u(F,z,H,$,k){let le=!1;if(o){const ie=g($,H,z);l!==ie&&(l=ie,d(l.object)),le=p(F,$,H,k),le&&y(F,$,H,k)}else{const ie=z.wireframe===!0;(l.geometry!==$.id||l.program!==H.id||l.wireframe!==ie)&&(l.geometry=$.id,l.program=H.id,l.wireframe=ie,le=!0)}k!==null&&n.update(k,t.ELEMENT_ARRAY_BUFFER),(le||f)&&(f=!1,D(F,z,H,$),k!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(k).buffer))}function h(){return i.isWebGL2?t.createVertexArray():r.createVertexArrayOES()}function d(F){return i.isWebGL2?t.bindVertexArray(F):r.bindVertexArrayOES(F)}function _(F){return i.isWebGL2?t.deleteVertexArray(F):r.deleteVertexArrayOES(F)}function g(F,z,H){const $=H.wireframe===!0;let k=a[F.id];k===void 0&&(k={},a[F.id]=k);let le=k[z.id];le===void 0&&(le={},k[z.id]=le);let ie=le[$];return ie===void 0&&(ie=m(h()),le[$]=ie),ie}function m(F){const z=[],H=[],$=[];for(let k=0;k=0){const re=k[ce];let me=le[ce];if(me===void 0&&(ce==="instanceMatrix"&&F.instanceMatrix&&(me=F.instanceMatrix),ce==="instanceColor"&&F.instanceColor&&(me=F.instanceColor)),re===void 0||re.attribute!==me||me&&re.data!==me.data)return!0;ie++}return l.attributesNum!==ie||l.index!==$}function y(F,z,H,$){const k={},le=z.attributes;let ie=0;const we=H.getAttributes();for(const ce in we)if(we[ce].location>=0){let re=le[ce];re===void 0&&(ce==="instanceMatrix"&&F.instanceMatrix&&(re=F.instanceMatrix),ce==="instanceColor"&&F.instanceColor&&(re=F.instanceColor));const me={};me.attribute=re,re&&re.data&&(me.data=re.data),k[ce]=me,ie++}l.attributes=k,l.attributesNum=ie,l.index=$}function E(){const F=l.newAttributes;for(let z=0,H=F.length;z=0){let j=k[we];if(j===void 0&&(we==="instanceMatrix"&&F.instanceMatrix&&(j=F.instanceMatrix),we==="instanceColor"&&F.instanceColor&&(j=F.instanceColor)),j!==void 0){const re=j.normalized,me=j.itemSize,ve=n.get(j);if(ve===void 0)continue;const R=ve.buffer,de=ve.type,Se=ve.bytesPerElement;if(j.isInterleavedBufferAttribute){const ue=j.data,Ce=ue.stride,P=j.offset;if(ue.isInstancedInterleavedBuffer){for(let L=0;L0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let a=n.precision!==void 0?n.precision:"highp";const c=r(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const l=o||e.has("WEBGL_draw_buffers"),f=n.logarithmicDepthBuffer===!0,u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_TEXTURE_SIZE),_=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),g=t.getParameter(t.MAX_VERTEX_ATTRIBS),m=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),p=t.getParameter(t.MAX_VARYING_VECTORS),y=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),E=h>0,v=o||e.has("OES_texture_float"),M=E&&v,b=o?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:f,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:m,maxVaryings:p,maxFragmentUniforms:y,vertexTextures:E,floatFragmentTextures:v,floatVertexTextures:M,maxSamples:b}}function XE(t){const e=this;let n=null,i=0,s=!1,r=!1;const o=new Bi,a=new qe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h){const d=u.length!==0||h||i!==0||s;return s=h,i=u.length,d},this.beginShadows=function(){r=!0,f(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,h){n=f(u,h,0)},this.setState=function(u,h,d){const _=u.clippingPlanes,g=u.clipIntersection,m=u.clipShadows,p=t.get(u);if(!s||_===null||_.length===0||r&&!m)r?f(null):l();else{const y=r?0:i,E=y*4;let v=p.clippingState||null;c.value=v,v=f(_,h,E,d);for(let M=0;M!==E;++M)v[M]=n[M];p.clippingState=v,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=y}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function f(u,h,d,_){const g=u!==null?u.length:0;let m=null;if(g!==0){if(m=c.value,_!==!0||m===null){const p=d+g*4,y=h.matrixWorldInverse;a.getNormalMatrix(y),(m===null||m.length0){const l=new l1(c.height/2);return l.fromEquirectangularTexture(t,o),e.set(o,l),o.addEventListener("dispose",s),n(l.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}class Sm extends xm{constructor(e=-1,n=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,i,s,r,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=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,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),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+n,c=s-n;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,o=r+l*this.view.width,a-=f*this.view.offsetY,c=a-f*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,c,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const As=4,Vu=[.125,.215,.35,.446,.526,.582],Vi=20,fc=new Sm,Hu=new it;let uc=null;const zi=(1+Math.sqrt(5))/2,xs=1/zi,Gu=[new W(1,1,1),new W(-1,1,1),new W(1,1,-1),new W(-1,1,-1),new W(0,zi,xs),new W(0,zi,-xs),new W(xs,0,zi),new W(-xs,0,zi),new W(zi,xs,0),new W(-zi,xs,0)];class $u{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,n=0,i=.1,s=100){uc=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),n>0&&this._blur(r,0,0,n),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Xu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Wu(),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;e2?E:0,E,E),f.setRenderTarget(s),g&&f.render(_,a),f.render(e,a)}_.geometry.dispose(),_.material.dispose(),f.toneMapping=h,f.autoClear=u,e.background=m}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===Os||e.mapping===Bs;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Xu()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Wu());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new ii(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const c=this._cubeSize;Eo(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(o,fc)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;for(let s=1;sVi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Vi}`);const p=[];let y=0;for(let w=0;wE-As?s-E+As:0),b=4*(this._cubeSize-v);Eo(n,M,b,3*v,2*v),c.setRenderTarget(n),c.render(u,fc)}}function YE(t){const e=[],n=[],i=[];let s=t;const r=t-As+1+Vu.length;for(let o=0;ot-As?c=Vu[o-t+As-1]:o===0&&(c=0),i.push(c);const l=1/(a-2),f=-l,u=1+l,h=[f,f,u,f,u,u,f,f,u,u,f,u],d=6,_=6,g=3,m=2,p=1,y=new Float32Array(g*_*d),E=new Float32Array(m*_*d),v=new Float32Array(p*_*d);for(let b=0;b2?0:-1,x=[w,D,0,w+2/3,D,0,w+2/3,D+1,0,w,D,0,w+2/3,D+1,0,w,D+1,0];y.set(x,g*_*b),E.set(h,m*_*b);const T=[b,b,b,b,b,b];v.set(T,p*_*b)}const M=new ai;M.setAttribute("position",new fn(y,g)),M.setAttribute("uv",new fn(E,m)),M.setAttribute("faceIndex",new fn(v,p)),e.push(M),s>As&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function ku(t,e,n){const i=new Ki(t,e,n);return i.texture.mapping=fa,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Eo(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function jE(t,e,n){const i=new Float32Array(Vi),s=new W(0,1,0);return new Ji({name:"SphericalGaussianBlur",defines:{n:Vi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:ql(),fragmentShader:` +}`,He={alphamap_fragment:iM,alphamap_pars_fragment:sM,alphatest_fragment:rM,alphatest_pars_fragment:oM,aomap_fragment:aM,aomap_pars_fragment:cM,begin_vertex:lM,beginnormal_vertex:fM,bsdfs:uM,iridescence_fragment:hM,bumpmap_pars_fragment:dM,clipping_planes_fragment:pM,clipping_planes_pars_fragment:mM,clipping_planes_pars_vertex:gM,clipping_planes_vertex:_M,color_fragment:vM,color_pars_fragment:xM,color_pars_vertex:MM,color_vertex:EM,common:SM,cube_uv_reflection_fragment:yM,defaultnormal_vertex:bM,displacementmap_pars_vertex:TM,displacementmap_vertex:wM,emissivemap_fragment:AM,emissivemap_pars_fragment:RM,encodings_fragment:CM,encodings_pars_fragment:PM,envmap_fragment:LM,envmap_common_pars_fragment:DM,envmap_pars_fragment:UM,envmap_pars_vertex:IM,envmap_physical_pars_fragment:XM,envmap_vertex:NM,fog_vertex:FM,fog_pars_vertex:OM,fog_fragment:BM,fog_pars_fragment:zM,gradientmap_pars_fragment:HM,lightmap_fragment:VM,lightmap_pars_fragment:GM,lights_lambert_fragment:$M,lights_lambert_pars_fragment:kM,lights_pars_begin:WM,lights_toon_fragment:qM,lights_toon_pars_fragment:jM,lights_phong_fragment:YM,lights_phong_pars_fragment:ZM,lights_physical_fragment:KM,lights_physical_pars_fragment:JM,lights_fragment_begin:QM,lights_fragment_maps:eE,lights_fragment_end:tE,logdepthbuf_fragment:nE,logdepthbuf_pars_fragment:iE,logdepthbuf_pars_vertex:sE,logdepthbuf_vertex:rE,map_fragment:oE,map_pars_fragment:aE,map_particle_fragment:cE,map_particle_pars_fragment:lE,metalnessmap_fragment:fE,metalnessmap_pars_fragment:uE,morphcolor_vertex:hE,morphnormal_vertex:dE,morphtarget_pars_vertex:pE,morphtarget_vertex:mE,normal_fragment_begin:gE,normal_fragment_maps:_E,normal_pars_fragment:vE,normal_pars_vertex:xE,normal_vertex:ME,normalmap_pars_fragment:EE,clearcoat_normal_fragment_begin:SE,clearcoat_normal_fragment_maps:yE,clearcoat_pars_fragment:bE,iridescence_pars_fragment:TE,output_fragment:wE,packing:AE,premultiplied_alpha_fragment:RE,project_vertex:CE,dithering_fragment:PE,dithering_pars_fragment:LE,roughnessmap_fragment:DE,roughnessmap_pars_fragment:UE,shadowmap_pars_fragment:IE,shadowmap_pars_vertex:NE,shadowmap_vertex:FE,shadowmask_pars_fragment:OE,skinbase_vertex:BE,skinning_pars_vertex:zE,skinning_vertex:HE,skinnormal_vertex:VE,specularmap_fragment:GE,specularmap_pars_fragment:$E,tonemapping_fragment:kE,tonemapping_pars_fragment:WE,transmission_fragment:XE,transmission_pars_fragment:qE,uv_pars_fragment:jE,uv_pars_vertex:YE,uv_vertex:ZE,worldpos_vertex:KE,background_vert:JE,background_frag:QE,backgroundCube_vert:eS,backgroundCube_frag:tS,cube_vert:nS,cube_frag:iS,depth_vert:sS,depth_frag:rS,distanceRGBA_vert:oS,distanceRGBA_frag:aS,equirect_vert:cS,equirect_frag:lS,linedashed_vert:fS,linedashed_frag:uS,meshbasic_vert:hS,meshbasic_frag:dS,meshlambert_vert:pS,meshlambert_frag:mS,meshmatcap_vert:gS,meshmatcap_frag:_S,meshnormal_vert:vS,meshnormal_frag:xS,meshphong_vert:MS,meshphong_frag:ES,meshphysical_vert:SS,meshphysical_frag:yS,meshtoon_vert:bS,meshtoon_frag:TS,points_vert:wS,points_frag:AS,shadow_vert:RS,shadow_frag:CS,sprite_vert:PS,sprite_frag:LS},_e={common:{diffuse:{value:new st(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qe}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qe},normalScale:{value:new Ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new st(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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},alphaTest:{value:0},uvTransform:{value:new qe}},sprite:{diffuse:{value:new st(16777215)},opacity:{value:1},center:{value:new Ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaTest:{value:0}}},zn={basic:{uniforms:Vt([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.fog]),vertexShader:He.meshbasic_vert,fragmentShader:He.meshbasic_frag},lambert:{uniforms:Vt([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,_e.lights,{emissive:{value:new st(0)}}]),vertexShader:He.meshlambert_vert,fragmentShader:He.meshlambert_frag},phong:{uniforms:Vt([_e.common,_e.specularmap,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,_e.lights,{emissive:{value:new st(0)},specular:{value:new st(1118481)},shininess:{value:30}}]),vertexShader:He.meshphong_vert,fragmentShader:He.meshphong_frag},standard:{uniforms:Vt([_e.common,_e.envmap,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.roughnessmap,_e.metalnessmap,_e.fog,_e.lights,{emissive:{value:new st(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag},toon:{uniforms:Vt([_e.common,_e.aomap,_e.lightmap,_e.emissivemap,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.gradientmap,_e.fog,_e.lights,{emissive:{value:new st(0)}}]),vertexShader:He.meshtoon_vert,fragmentShader:He.meshtoon_frag},matcap:{uniforms:Vt([_e.common,_e.bumpmap,_e.normalmap,_e.displacementmap,_e.fog,{matcap:{value:null}}]),vertexShader:He.meshmatcap_vert,fragmentShader:He.meshmatcap_frag},points:{uniforms:Vt([_e.points,_e.fog]),vertexShader:He.points_vert,fragmentShader:He.points_frag},dashed:{uniforms:Vt([_e.common,_e.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:He.linedashed_vert,fragmentShader:He.linedashed_frag},depth:{uniforms:Vt([_e.common,_e.displacementmap]),vertexShader:He.depth_vert,fragmentShader:He.depth_frag},normal:{uniforms:Vt([_e.common,_e.bumpmap,_e.normalmap,_e.displacementmap,{opacity:{value:1}}]),vertexShader:He.meshnormal_vert,fragmentShader:He.meshnormal_frag},sprite:{uniforms:Vt([_e.sprite,_e.fog]),vertexShader:He.sprite_vert,fragmentShader:He.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:He.background_vert,fragmentShader:He.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:He.backgroundCube_vert,fragmentShader:He.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:He.cube_vert,fragmentShader:He.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:He.equirect_vert,fragmentShader:He.equirect_frag},distanceRGBA:{uniforms:Vt([_e.common,_e.displacementmap,{referencePosition:{value:new W},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:He.distanceRGBA_vert,fragmentShader:He.distanceRGBA_frag},shadow:{uniforms:Vt([_e.lights,_e.fog,{color:{value:new st(0)},opacity:{value:1}}]),vertexShader:He.shadow_vert,fragmentShader:He.shadow_frag}};zn.physical={uniforms:Vt([zn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new Ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qe},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qe},sheen:{value:0},sheenColor:{value:new st(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qe},transmissionSamplerSize:{value:new Ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new st(0)},specularColor:{value:new st(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag};const Uo={r:0,b:0,g:0};function DS(t,e,n,i,s,r,o){const a=new st(0);let c=r===!0?0:1,l,f,u=null,h=0,d=null;function _(m,p){let y=!1,E=p.isScene===!0?p.background:null;switch(E&&E.isTexture&&(E=(p.backgroundBlurriness>0?n:e).get(E)),E===null?g(a,c):E&&E.isColor&&(g(E,1),y=!0),t.xr.getEnvironmentBlendMode()){case"opaque":y=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,o),y=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,o),y=!0;break}(t.autoClear||y)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),E&&(E.isCubeTexture||E.mapping===Ca)?(f===void 0&&(f=new ai(new so(1,1,1),new fs({name:"BackgroundCubeMaterial",uniforms:Qs(zn.backgroundCube.uniforms),vertexShader:zn.backgroundCube.vertexShader,fragmentShader:zn.backgroundCube.fragmentShader,side:Qt,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(b,w,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(f)),f.material.uniforms.envMap.value=E,f.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,f.material.toneMapped=E.colorSpace!==Be,(u!==E||h!==E.version||d!==t.toneMapping)&&(f.material.needsUpdate=!0,u=E,h=E.version,d=t.toneMapping),f.layers.enableAll(),m.unshift(f,f.geometry,f.material,0,0,null)):E&&E.isTexture&&(l===void 0&&(l=new ai(new uf(2,2),new fs({name:"BackgroundMaterial",uniforms:Qs(zn.background.uniforms),vertexShader:zn.background.vertexShader,fragmentShader:zn.background.fragmentShader,side:Pi,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=E,l.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,l.material.toneMapped=E.colorSpace!==Be,E.matrixAutoUpdate===!0&&E.updateMatrix(),l.material.uniforms.uvTransform.value.copy(E.matrix),(u!==E||h!==E.version||d!==t.toneMapping)&&(l.material.needsUpdate=!0,u=E,h=E.version,d=t.toneMapping),l.layers.enableAll(),m.unshift(l,l.geometry,l.material,0,0,null))}function g(m,p){m.getRGB(Uo,ng(t)),i.buffers.color.setClear(Uo.r,Uo.g,Uo.b,p,o)}return{getClearColor:function(){return a},setClearColor:function(m,p=1){a.set(m),c=p,g(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(m){c=m,g(a,c)},render:_}}function US(t,e,n,i){const s=t.getParameter(t.MAX_VERTEX_ATTRIBS),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},c=m(null);let l=c,f=!1;function u(F,B,V,$,k){let le=!1;if(o){const ie=g($,V,B);l!==ie&&(l=ie,d(l.object)),le=p(F,$,V,k),le&&y(F,$,V,k)}else{const ie=B.wireframe===!0;(l.geometry!==$.id||l.program!==V.id||l.wireframe!==ie)&&(l.geometry=$.id,l.program=V.id,l.wireframe=ie,le=!0)}k!==null&&n.update(k,t.ELEMENT_ARRAY_BUFFER),(le||f)&&(f=!1,D(F,B,V,$),k!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(k).buffer))}function h(){return i.isWebGL2?t.createVertexArray():r.createVertexArrayOES()}function d(F){return i.isWebGL2?t.bindVertexArray(F):r.bindVertexArrayOES(F)}function _(F){return i.isWebGL2?t.deleteVertexArray(F):r.deleteVertexArrayOES(F)}function g(F,B,V){const $=V.wireframe===!0;let k=a[F.id];k===void 0&&(k={},a[F.id]=k);let le=k[B.id];le===void 0&&(le={},k[B.id]=le);let ie=le[$];return ie===void 0&&(ie=m(h()),le[$]=ie),ie}function m(F){const B=[],V=[],$=[];for(let k=0;k=0){const re=k[ce];let me=le[ce];if(me===void 0&&(ce==="instanceMatrix"&&F.instanceMatrix&&(me=F.instanceMatrix),ce==="instanceColor"&&F.instanceColor&&(me=F.instanceColor)),re===void 0||re.attribute!==me||me&&re.data!==me.data)return!0;ie++}return l.attributesNum!==ie||l.index!==$}function y(F,B,V,$){const k={},le=B.attributes;let ie=0;const we=V.getAttributes();for(const ce in we)if(we[ce].location>=0){let re=le[ce];re===void 0&&(ce==="instanceMatrix"&&F.instanceMatrix&&(re=F.instanceMatrix),ce==="instanceColor"&&F.instanceColor&&(re=F.instanceColor));const me={};me.attribute=re,re&&re.data&&(me.data=re.data),k[ce]=me,ie++}l.attributes=k,l.attributesNum=ie,l.index=$}function E(){const F=l.newAttributes;for(let B=0,V=F.length;B=0){let Y=k[we];if(Y===void 0&&(we==="instanceMatrix"&&F.instanceMatrix&&(Y=F.instanceMatrix),we==="instanceColor"&&F.instanceColor&&(Y=F.instanceColor)),Y!==void 0){const re=Y.normalized,me=Y.itemSize,ve=n.get(Y);if(ve===void 0)continue;const R=ve.buffer,de=ve.type,Se=ve.bytesPerElement;if(Y.isInterleavedBufferAttribute){const ue=Y.data,Ce=ue.stride,P=Y.offset;if(ue.isInstancedInterleavedBuffer){for(let L=0;L0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let a=n.precision!==void 0?n.precision:"highp";const c=r(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const l=o||e.has("WEBGL_draw_buffers"),f=n.logarithmicDepthBuffer===!0,u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_TEXTURE_SIZE),_=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),g=t.getParameter(t.MAX_VERTEX_ATTRIBS),m=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),p=t.getParameter(t.MAX_VARYING_VECTORS),y=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),E=h>0,x=o||e.has("OES_texture_float"),M=E&&x,b=o?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:f,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:m,maxVaryings:p,maxFragmentUniforms:y,vertexTextures:E,floatFragmentTextures:x,floatVertexTextures:M,maxSamples:b}}function FS(t){const e=this;let n=null,i=0,s=!1,r=!1;const o=new qi,a=new qe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h){const d=u.length!==0||h||i!==0||s;return s=h,i=u.length,d},this.beginShadows=function(){r=!0,f(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,h){n=f(u,h,0)},this.setState=function(u,h,d){const _=u.clippingPlanes,g=u.clipIntersection,m=u.clipShadows,p=t.get(u);if(!s||_===null||_.length===0||r&&!m)r?f(null):l();else{const y=r?0:i,E=y*4;let x=p.clippingState||null;c.value=x,x=f(_,h,E,d);for(let M=0;M!==E;++M)x[M]=n[M];p.clippingState=x,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=y}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function f(u,h,d,_){const g=u!==null?u.length:0;let m=null;if(g!==0){if(m=c.value,_!==!0||m===null){const p=d+g*4,y=h.matrixWorldInverse;a.getNormalMatrix(y),(m===null||m.length0){const l=new Q1(c.height/2);return l.fromEquirectangularTexture(t,o),e.set(o,l),o.addEventListener("dispose",s),n(l.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}class og extends ig{constructor(e=-1,n=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,i,s,r,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=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,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),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+n,c=s-n;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,o=r+l*this.view.width,a-=f*this.view.offsetY,c=a-f*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,c,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const zs=4,lh=[.125,.215,.35,.446,.526,.582],Zi=20,Uc=new og,fh=new st;let Ic=null;const ji=(1+Math.sqrt(5))/2,Ls=1/ji,uh=[new W(1,1,1),new W(-1,1,1),new W(1,1,-1),new W(-1,1,-1),new W(0,ji,Ls),new W(0,ji,-Ls),new W(Ls,0,ji),new W(-Ls,0,ji),new W(ji,Ls,0),new W(-ji,Ls,0)];class hh{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,n=0,i=.1,s=100){Ic=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),n>0&&this._blur(r,0,0,n),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=mh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ph(),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;e2?E:0,E,E),f.setRenderTarget(s),g&&f.render(_,a),f.render(e,a)}_.geometry.dispose(),_.material.dispose(),f.toneMapping=h,f.autoClear=u,e.background=m}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===Zs||e.mapping===Ks;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=mh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ph());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new ai(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const c=this._cubeSize;Io(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(o,Uc)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;for(let s=1;sZi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Zi}`);const p=[];let y=0;for(let w=0;wE-zs?s-E+zs:0),b=4*(this._cubeSize-x);Io(n,M,b,3*x,2*x),c.setRenderTarget(n),c.render(u,Uc)}}function BS(t){const e=[],n=[],i=[];let s=t;const r=t-zs+1+lh.length;for(let o=0;ot-zs?c=lh[o-t+zs-1]:o===0&&(c=0),i.push(c);const l=1/(a-2),f=-l,u=1+l,h=[f,f,u,f,u,u,f,f,u,u,f,u],d=6,_=6,g=3,m=2,p=1,y=new Float32Array(g*_*d),E=new Float32Array(m*_*d),x=new Float32Array(p*_*d);for(let b=0;b2?0:-1,v=[w,D,0,w+2/3,D,0,w+2/3,D+1,0,w,D,0,w+2/3,D+1,0,w,D+1,0];y.set(v,g*_*b),E.set(h,m*_*b);const T=[b,b,b,b,b,b];x.set(T,p*_*b)}const M=new fi;M.setAttribute("position",new un(y,g)),M.setAttribute("uv",new un(E,m)),M.setAttribute("faceIndex",new un(x,p)),e.push(M),s>zs&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function dh(t,e,n){const i=new ls(t,e,n);return i.texture.mapping=Ca,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Io(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function zS(t,e,n){const i=new Float32Array(Zi),s=new W(0,1,0);return new fs({name:"SphericalGaussianBlur",defines:{n:Zi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:hf(),fragmentShader:` precision mediump float; precision mediump int; @@ -3268,7 +3268,7 @@ void main() { } } - `,blending:yi,depthTest:!1,depthWrite:!1})}function Wu(){return new Ji({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ql(),fragmentShader:` + `,blending:Ri,depthTest:!1,depthWrite:!1})}function ph(){return new fs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:hf(),fragmentShader:` precision mediump float; precision mediump int; @@ -3287,7 +3287,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:yi,depthTest:!1,depthWrite:!1})}function Xu(){return new Ji({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ql(),fragmentShader:` + `,blending:Ri,depthTest:!1,depthWrite:!1})}function mh(){return new fs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:hf(),fragmentShader:` precision mediump float; precision mediump int; @@ -3303,7 +3303,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:yi,depthTest:!1,depthWrite:!1})}function ql(){return` + `,blending:Ri,depthTest:!1,depthWrite:!1})}function hf(){return` precision mediump float; precision mediump int; @@ -3358,39 +3358,39 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function ZE(t){let e=new WeakMap,n=null;function i(a){if(a&&a.isTexture){const c=a.mapping,l=c===rl||c===ol,f=c===Os||c===Bs;if(l||f)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let u=e.get(a);return n===null&&(n=new $u(t)),u=l?n.fromEquirectangular(a,u):n.fromCubemap(a,u),e.set(a,u),u.texture}else{if(e.has(a))return e.get(a).texture;{const u=a.image;if(l&&u&&u.height>0||f&&u&&s(u)){n===null&&(n=new $u(t));const h=l?n.fromEquirectangular(a):n.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",r),h.texture}else return null}}}return a}function s(a){let c=0;const l=6;for(let f=0;fe.maxTextureSize&&(I=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const B=new Float32Array(T*I*4*g),U=new hm(B,T,I,g);U.type=ki,U.needsUpdate=!0;const F=x*4;for(let H=0;H0)return t;const s=e*n;let r=qu[s];if(r===void 0&&(r=new Float32Array(s),qu[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(r,a)}return r}function vt(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n0||f&&u&&s(u)){n===null&&(n=new hh(t));const h=l?n.fromEquirectangular(a):n.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",r),h.texture}else return null}}}return a}function s(a){let c=0;const l=6;for(let f=0;fe.maxTextureSize&&(N=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const U=new Float32Array(T*N*4*g),I=new Zm(U,T,N,g);I.type=ns,I.needsUpdate=!0;const F=v*4;for(let V=0;V0)return t;const s=e*n;let r=gh[s];if(r===void 0&&(r=new Float32Array(s),gh[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(r,a)}return r}function xt(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${a}: ${n[o]}`)}return i.join(` -`)}function KS(t){switch(t){case Bn:return["Linear","( value )"];case Be:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),["Linear","( value )"]}}function eh(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return n.toUpperCase()+` +`)}function Vy(t){switch(t){case Gn:return["Linear","( value )"];case Be:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),["Linear","( value )"]}}function yh(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return n.toUpperCase()+` `+s+` -`+ZS(t.getShaderSource(e),o)}else return s}function JS(t,e){const n=KS(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function QS(t,e){let n;switch(e){case ex:n="Linear";break;case tx:n="Reinhard";break;case nx:n="OptimizedCineon";break;case ix:n="ACESFilmic";break;case sx:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function ey(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||t.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(mr).join(` -`)}function ty(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(` -`)}function ny(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function ul(t){return t.replace(iy,sy)}function sy(t,e){const n=Ve[e];if(n===void 0)throw new Error("Can not resolve #include <"+e+">");return ul(n)}const ry=/#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 ih(t){return t.replace(ry,oy)}function oy(t,e,n,i){let s="";for(let r=parseInt(e);r/gm;function Nl(t){return t.replace(qy,jy)}function jy(t,e){const n=He[e];if(n===void 0)throw new Error("Can not resolve #include <"+e+">");return Nl(n)}const Yy=/#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 wh(t){return t.replace(Yy,Zy)}function Zy(t,e,n,i){let s="";for(let r=parseInt(e);r0&&(m+=` -`),p=[d,_].filter(mr).join(` +`),p=[d,_].filter(Cr).join(` `),p.length>0&&(p+=` -`)):(m=[sh(n),"#define SHADER_NAME "+n.shaderName,_,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(mr).join(` -`),p=[d,sh(n),"#define SHADER_NAME "+n.shaderName,_,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+f:"",n.envMap?"#define "+u:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ri?"#define TONE_MAPPING":"",n.toneMapping!==ri?Ve.tonemapping_pars_fragment:"",n.toneMapping!==ri?QS("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ve.encodings_pars_fragment,JS("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` -`].filter(mr).join(` -`)),o=ul(o),o=th(o,n),o=nh(o,n),a=ul(a),a=th(a,n),a=nh(a,n),o=ih(o),a=ih(a),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(y=`#version 300 es +`)):(m=[Ah(n),"#define SHADER_NAME "+n.shaderName,_,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(Cr).join(` +`),p=[d,Ah(n),"#define SHADER_NAME "+n.shaderName,_,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+f:"",n.envMap?"#define "+u:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ci?"#define TONE_MAPPING":"",n.toneMapping!==ci?He.tonemapping_pars_fragment:"",n.toneMapping!==ci?$y("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",He.encodings_pars_fragment,Gy("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` +`].filter(Cr).join(` +`)),o=Nl(o),o=bh(o,n),o=Th(o,n),a=Nl(a),a=bh(a,n),a=Th(a,n),o=wh(o),a=wh(a),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(y=`#version 300 es `,m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+m,p=["#define varying in",n.glslVersion===Su?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Su?"":"#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(` +`+m,p=["#define varying in",n.glslVersion===Wu?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Wu?"":"#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(` `)+` -`+p);const E=y+m+o,v=y+p+a,M=Qu(s,s.VERTEX_SHADER,E),b=Qu(s,s.FRAGMENT_SHADER,v);if(s.attachShader(g,M),s.attachShader(g,b),n.index0AttributeName!==void 0?s.bindAttribLocation(g,0,n.index0AttributeName):n.morphTargets===!0&&s.bindAttribLocation(g,0,"position"),s.linkProgram(g),t.debug.checkShaderErrors){const x=s.getProgramInfoLog(g).trim(),T=s.getShaderInfoLog(M).trim(),I=s.getShaderInfoLog(b).trim();let B=!0,U=!0;if(s.getProgramParameter(g,s.LINK_STATUS)===!1)if(B=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(s,g,M,b);else{const F=eh(s,M,"vertex"),z=eh(s,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(g,s.VALIDATE_STATUS)+` +`+p);const E=y+m+o,x=y+p+a,M=Sh(s,s.VERTEX_SHADER,E),b=Sh(s,s.FRAGMENT_SHADER,x);if(s.attachShader(g,M),s.attachShader(g,b),n.index0AttributeName!==void 0?s.bindAttribLocation(g,0,n.index0AttributeName):n.morphTargets===!0&&s.bindAttribLocation(g,0,"position"),s.linkProgram(g),t.debug.checkShaderErrors){const v=s.getProgramInfoLog(g).trim(),T=s.getShaderInfoLog(M).trim(),N=s.getShaderInfoLog(b).trim();let U=!0,I=!0;if(s.getProgramParameter(g,s.LINK_STATUS)===!1)if(U=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(s,g,M,b);else{const F=yh(s,M,"vertex"),B=yh(s,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(g,s.VALIDATE_STATUS)+` -Program Info Log: `+x+` +Program Info Log: `+v+` `+F+` -`+z)}else x!==""?console.warn("THREE.WebGLProgram: Program Info Log:",x):(T===""||I==="")&&(U=!1);U&&(this.diagnostics={runnable:B,programLog:x,vertexShader:{log:T,prefix:m},fragmentShader:{log:I,prefix:p}})}s.deleteShader(M),s.deleteShader(b);let w;this.getUniforms=function(){return w===void 0&&(w=new Ho(s,g)),w};let D;return this.getAttributes=function(){return D===void 0&&(D=ny(s,g)),D},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=jS++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=M,this.fragmentShader=b,this}let dy=0;class py{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(n),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new my(e),n.set(e,i)),i}}class my{constructor(e){this.id=dy++,this.code=e,this.usedTimes=0}}function gy(t,e,n,i,s,r,o){const a=new dm,c=new py,l=[],f=s.isWebGL2,u=s.logarithmicDepthBuffer,h=s.vertexTextures;let d=s.precision;const _={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 g(x){return x===1?"uv1":x===2?"uv2":x===3?"uv3":"uv"}function m(x,T,I,B,U){const F=B.fog,z=U.geometry,H=x.isMeshStandardMaterial?B.environment:null,$=(x.isMeshStandardMaterial?n:e).get(x.envMap||H),k=$&&$.mapping===fa?$.image.height:null,le=_[x.type];x.precision!==null&&(d=s.getMaxPrecision(x.precision),d!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",d,"instead."));const ie=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,we=ie!==void 0?ie.length:0;let ce=0;z.morphAttributes.position!==void 0&&(ce=1),z.morphAttributes.normal!==void 0&&(ce=2),z.morphAttributes.color!==void 0&&(ce=3);let j,re,me,ve;if(le){const et=Un[le];j=et.vertexShader,re=et.fragmentShader}else j=x.vertexShader,re=x.fragmentShader,c.update(x),me=c.getVertexShaderID(x),ve=c.getFragmentShaderID(x);const R=t.getRenderTarget(),de=U.isInstancedMesh===!0,Se=!!x.map,ue=!!x.matcap,Ce=!!$,P=!!x.aoMap,L=!!x.lightMap,V=!!x.bumpMap,ne=!!x.normalMap,Q=!!x.displacementMap,te=!!x.emissiveMap,pe=!!x.metalnessMap,se=!!x.roughnessMap,ae=x.clearcoat>0,oe=x.iridescence>0,A=x.sheen>0,S=x.transmission>0,O=ae&&!!x.clearcoatMap,q=ae&&!!x.clearcoatNormalMap,Z=ae&&!!x.clearcoatRoughnessMap,fe=oe&&!!x.iridescenceMap,xe=oe&&!!x.iridescenceThicknessMap,Me=A&&!!x.sheenColorMap,Y=A&&!!x.sheenRoughnessMap,be=!!x.specularMap,Ae=!!x.specularColorMap,Le=!!x.specularIntensityMap,Te=S&&!!x.transmissionMap,Ee=S&&!!x.thicknessMap,Ie=!!x.gradientMap,je=!!x.alphaMap,at=x.alphaTest>0,N=!!x.extensions,K=!!z.attributes.uv1,he=!!z.attributes.uv2,ye=!!z.attributes.uv3;return{isWebGL2:f,shaderID:le,shaderName:x.type,vertexShader:j,fragmentShader:re,defines:x.defines,customVertexShaderID:me,customFragmentShaderID:ve,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:d,instancing:de,instancingColor:de&&U.instanceColor!==null,supportsVertexTextures:h,outputColorSpace:R===null?t.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:Bn,map:Se,matcap:ue,envMap:Ce,envMapMode:Ce&&$.mapping,envMapCubeUVHeight:k,aoMap:P,lightMap:L,bumpMap:V,normalMap:ne,displacementMap:h&&Q,emissiveMap:te,normalMapObjectSpace:ne&&x.normalMapType===yx,normalMapTangentSpace:ne&&x.normalMapType===om,metalnessMap:pe,roughnessMap:se,clearcoat:ae,clearcoatMap:O,clearcoatNormalMap:q,clearcoatRoughnessMap:Z,iridescence:oe,iridescenceMap:fe,iridescenceThicknessMap:xe,sheen:A,sheenColorMap:Me,sheenRoughnessMap:Y,specularMap:be,specularColorMap:Ae,specularIntensityMap:Le,transmission:S,transmissionMap:Te,thicknessMap:Ee,gradientMap:Ie,opaque:x.transparent===!1&&x.blending===Ds,alphaMap:je,alphaTest:at,combine:x.combine,mapUv:Se&&g(x.map.channel),aoMapUv:P&&g(x.aoMap.channel),lightMapUv:L&&g(x.lightMap.channel),bumpMapUv:V&&g(x.bumpMap.channel),normalMapUv:ne&&g(x.normalMap.channel),displacementMapUv:Q&&g(x.displacementMap.channel),emissiveMapUv:te&&g(x.emissiveMap.channel),metalnessMapUv:pe&&g(x.metalnessMap.channel),roughnessMapUv:se&&g(x.roughnessMap.channel),clearcoatMapUv:O&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:q&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Z&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:fe&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:xe&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:Me&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:Y&&g(x.sheenRoughnessMap.channel),specularMapUv:be&&g(x.specularMap.channel),specularColorMapUv:Ae&&g(x.specularColorMap.channel),specularIntensityMapUv:Le&&g(x.specularIntensityMap.channel),transmissionMapUv:Te&&g(x.transmissionMap.channel),thicknessMapUv:Ee&&g(x.thicknessMap.channel),alphaMapUv:je&&g(x.alphaMap.channel),vertexTangents:ne&&!!z.attributes.tangent,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,vertexUv1s:K,vertexUv2s:he,vertexUv3s:ye,pointsUvs:U.isPoints===!0&&!!z.attributes.uv&&(Se||je),fog:!!F,useFog:x.fog===!0,fogExp2:F&&F.isFogExp2,flatShading:x.flatShading===!0,sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:U.isSkinnedMesh===!0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:we,morphTextureStride:ce,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:x.dithering,shadowMapEnabled:t.shadowMap.enabled&&I.length>0,shadowMapType:t.shadowMap.type,toneMapping:x.toneMapped?t.toneMapping:ri,useLegacyLights:t.useLegacyLights,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===ni,flipSided:x.side===Zt,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionDerivatives:N&&x.extensions.derivatives===!0,extensionFragDepth:N&&x.extensions.fragDepth===!0,extensionDrawBuffers:N&&x.extensions.drawBuffers===!0,extensionShaderTextureLOD:N&&x.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:f||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||i.has("EXT_shader_texture_lod"),customProgramCacheKey:x.customProgramCacheKey()}}function p(x){const T=[];if(x.shaderID?T.push(x.shaderID):(T.push(x.customVertexShaderID),T.push(x.customFragmentShaderID)),x.defines!==void 0)for(const I in x.defines)T.push(I),T.push(x.defines[I]);return x.isRawShaderMaterial===!1&&(y(T,x),E(T,x),T.push(t.outputColorSpace)),T.push(x.customProgramCacheKey),T.join()}function y(x,T){x.push(T.precision),x.push(T.outputColorSpace),x.push(T.envMapMode),x.push(T.envMapCubeUVHeight),x.push(T.mapUv),x.push(T.alphaMapUv),x.push(T.lightMapUv),x.push(T.aoMapUv),x.push(T.bumpMapUv),x.push(T.normalMapUv),x.push(T.displacementMapUv),x.push(T.emissiveMapUv),x.push(T.metalnessMapUv),x.push(T.roughnessMapUv),x.push(T.clearcoatMapUv),x.push(T.clearcoatNormalMapUv),x.push(T.clearcoatRoughnessMapUv),x.push(T.iridescenceMapUv),x.push(T.iridescenceThicknessMapUv),x.push(T.sheenColorMapUv),x.push(T.sheenRoughnessMapUv),x.push(T.specularMapUv),x.push(T.specularColorMapUv),x.push(T.specularIntensityMapUv),x.push(T.transmissionMapUv),x.push(T.thicknessMapUv),x.push(T.combine),x.push(T.fogExp2),x.push(T.sizeAttenuation),x.push(T.morphTargetsCount),x.push(T.morphAttributeCount),x.push(T.numDirLights),x.push(T.numPointLights),x.push(T.numSpotLights),x.push(T.numSpotLightMaps),x.push(T.numHemiLights),x.push(T.numRectAreaLights),x.push(T.numDirLightShadows),x.push(T.numPointLightShadows),x.push(T.numSpotLightShadows),x.push(T.numSpotLightShadowsWithMaps),x.push(T.shadowMapType),x.push(T.toneMapping),x.push(T.numClippingPlanes),x.push(T.numClipIntersection),x.push(T.depthPacking)}function E(x,T){a.disableAll(),T.isWebGL2&&a.enable(0),T.supportsVertexTextures&&a.enable(1),T.instancing&&a.enable(2),T.instancingColor&&a.enable(3),T.matcap&&a.enable(4),T.envMap&&a.enable(5),T.normalMapObjectSpace&&a.enable(6),T.normalMapTangentSpace&&a.enable(7),T.clearcoat&&a.enable(8),T.iridescence&&a.enable(9),T.alphaTest&&a.enable(10),T.vertexColors&&a.enable(11),T.vertexAlphas&&a.enable(12),T.vertexUv1s&&a.enable(13),T.vertexUv2s&&a.enable(14),T.vertexUv3s&&a.enable(15),T.vertexTangents&&a.enable(16),x.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.skinning&&a.enable(4),T.morphTargets&&a.enable(5),T.morphNormals&&a.enable(6),T.morphColors&&a.enable(7),T.premultipliedAlpha&&a.enable(8),T.shadowMapEnabled&&a.enable(9),T.useLegacyLights&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),x.push(a.mask)}function v(x){const T=_[x.type];let I;if(T){const B=Un[T];I=r1.clone(B.uniforms)}else I=x.uniforms;return I}function M(x,T){let I;for(let B=0,U=l.length;B0?i.push(p):d.transparent===!0?s.push(p):n.push(p)}function c(u,h,d,_,g,m){const p=o(u,h,d,_,g,m);d.transmission>0?i.unshift(p):d.transparent===!0?s.unshift(p):n.unshift(p)}function l(u,h){n.length>1&&n.sort(u||vy),i.length>1&&i.sort(h||rh),s.length>1&&s.sort(h||rh)}function f(){for(let u=e,h=t.length;u=r.length?(o=new oh,r.push(o)):o=r[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function My(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new W,color:new it};break;case"SpotLight":n={position:new W,direction:new W,color:new it,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new W,color:new it,distance:0,decay:0};break;case"HemisphereLight":n={direction:new W,skyColor:new it,groundColor:new it};break;case"RectAreaLight":n={color:new it,position:new W,halfWidth:new W,halfHeight:new W};break}return t[e.id]=n,n}}}function Ey(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Sy=0;function yy(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function by(t,e){const n=new My,i=Ey(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let f=0;f<9;f++)s.probe.push(new W);const r=new W,o=new _t,a=new _t;function c(f,u){let h=0,d=0,_=0;for(let I=0;I<9;I++)s.probe[I].set(0,0,0);let g=0,m=0,p=0,y=0,E=0,v=0,M=0,b=0,w=0,D=0;f.sort(yy);const x=u===!0?Math.PI:1;for(let I=0,B=f.length;I0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=_e.LTC_FLOAT_1,s.rectAreaLTC2=_e.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=_e.LTC_HALF_1,s.rectAreaLTC2=_e.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=h,s.ambient[1]=d,s.ambient[2]=_;const T=s.hash;(T.directionalLength!==g||T.pointLength!==m||T.spotLength!==p||T.rectAreaLength!==y||T.hemiLength!==E||T.numDirectionalShadows!==v||T.numPointShadows!==M||T.numSpotShadows!==b||T.numSpotMaps!==w)&&(s.directional.length=g,s.spot.length=p,s.rectArea.length=y,s.point.length=m,s.hemi.length=E,s.directionalShadow.length=v,s.directionalShadowMap.length=v,s.pointShadow.length=M,s.pointShadowMap.length=M,s.spotShadow.length=b,s.spotShadowMap.length=b,s.directionalShadowMatrix.length=v,s.pointShadowMatrix.length=M,s.spotLightMatrix.length=b+w-D,s.spotLightMap.length=w,s.numSpotLightShadowsWithMaps=D,T.directionalLength=g,T.pointLength=m,T.spotLength=p,T.rectAreaLength=y,T.hemiLength=E,T.numDirectionalShadows=v,T.numPointShadows=M,T.numSpotShadows=b,T.numSpotMaps=w,s.version=Sy++)}function l(f,u){let h=0,d=0,_=0,g=0,m=0;const p=u.matrixWorldInverse;for(let y=0,E=f.length;y=a.length?(c=new ah(t,e),a.push(c)):c=a[o],c}function s(){n=new WeakMap}return{get:i,dispose:s}}class wy extends kr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ex,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 Ay extends kr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Ry=`void main() { +`+B)}else v!==""?console.warn("THREE.WebGLProgram: Program Info Log:",v):(T===""||N==="")&&(I=!1);I&&(this.diagnostics={runnable:U,programLog:v,vertexShader:{log:T,prefix:m},fragmentShader:{log:N,prefix:p}})}s.deleteShader(M),s.deleteShader(b);let w;this.getUniforms=function(){return w===void 0&&(w=new ea(s,g)),w};let D;return this.getAttributes=function(){return D===void 0&&(D=Xy(s,g)),D},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=zy++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=M,this.fragmentShader=b,this}let ib=0;class sb{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(n),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new rb(e),n.set(e,i)),i}}class rb{constructor(e){this.id=ib++,this.code=e,this.usedTimes=0}}function ob(t,e,n,i,s,r,o){const a=new Km,c=new sb,l=[],f=s.isWebGL2,u=s.logarithmicDepthBuffer,h=s.vertexTextures;let d=s.precision;const _={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 g(v){return v===1?"uv1":v===2?"uv2":v===3?"uv3":"uv"}function m(v,T,N,U,I){const F=U.fog,B=I.geometry,V=v.isMeshStandardMaterial?U.environment:null,$=(v.isMeshStandardMaterial?n:e).get(v.envMap||V),k=$&&$.mapping===Ca?$.image.height:null,le=_[v.type];v.precision!==null&&(d=s.getMaxPrecision(v.precision),d!==v.precision&&console.warn("THREE.WebGLProgram.getParameters:",v.precision,"not supported, using",d,"instead."));const ie=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,we=ie!==void 0?ie.length:0;let ce=0;B.morphAttributes.position!==void 0&&(ce=1),B.morphAttributes.normal!==void 0&&(ce=2),B.morphAttributes.color!==void 0&&(ce=3);let Y,re,me,ve;if(le){const et=zn[le];Y=et.vertexShader,re=et.fragmentShader}else Y=v.vertexShader,re=v.fragmentShader,c.update(v),me=c.getVertexShaderID(v),ve=c.getFragmentShaderID(v);const R=t.getRenderTarget(),de=I.isInstancedMesh===!0,Se=!!v.map,ue=!!v.matcap,Ce=!!$,P=!!v.aoMap,L=!!v.lightMap,H=!!v.bumpMap,ne=!!v.normalMap,Q=!!v.displacementMap,te=!!v.emissiveMap,pe=!!v.metalnessMap,se=!!v.roughnessMap,ae=v.clearcoat>0,oe=v.iridescence>0,A=v.sheen>0,S=v.transmission>0,z=ae&&!!v.clearcoatMap,q=ae&&!!v.clearcoatNormalMap,Z=ae&&!!v.clearcoatRoughnessMap,fe=oe&&!!v.iridescenceMap,xe=oe&&!!v.iridescenceThicknessMap,Me=A&&!!v.sheenColorMap,j=A&&!!v.sheenRoughnessMap,be=!!v.specularMap,Ae=!!v.specularColorMap,Le=!!v.specularIntensityMap,Te=S&&!!v.transmissionMap,Ee=S&&!!v.thicknessMap,Ne=!!v.gradientMap,Ye=!!v.alphaMap,lt=v.alphaTest>0,O=!!v.extensions,K=!!B.attributes.uv1,he=!!B.attributes.uv2,ye=!!B.attributes.uv3;return{isWebGL2:f,shaderID:le,shaderName:v.type,vertexShader:Y,fragmentShader:re,defines:v.defines,customVertexShaderID:me,customFragmentShaderID:ve,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:d,instancing:de,instancingColor:de&&I.instanceColor!==null,supportsVertexTextures:h,outputColorSpace:R===null?t.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:Gn,map:Se,matcap:ue,envMap:Ce,envMapMode:Ce&&$.mapping,envMapCubeUVHeight:k,aoMap:P,lightMap:L,bumpMap:H,normalMap:ne,displacementMap:h&&Q,emissiveMap:te,normalMapObjectSpace:ne&&v.normalMapType===d1,normalMapTangentSpace:ne&&v.normalMapType===km,metalnessMap:pe,roughnessMap:se,clearcoat:ae,clearcoatMap:z,clearcoatNormalMap:q,clearcoatRoughnessMap:Z,iridescence:oe,iridescenceMap:fe,iridescenceThicknessMap:xe,sheen:A,sheenColorMap:Me,sheenRoughnessMap:j,specularMap:be,specularColorMap:Ae,specularIntensityMap:Le,transmission:S,transmissionMap:Te,thicknessMap:Ee,gradientMap:Ne,opaque:v.transparent===!1&&v.blending===Xs,alphaMap:Ye,alphaTest:lt,combine:v.combine,mapUv:Se&&g(v.map.channel),aoMapUv:P&&g(v.aoMap.channel),lightMapUv:L&&g(v.lightMap.channel),bumpMapUv:H&&g(v.bumpMap.channel),normalMapUv:ne&&g(v.normalMap.channel),displacementMapUv:Q&&g(v.displacementMap.channel),emissiveMapUv:te&&g(v.emissiveMap.channel),metalnessMapUv:pe&&g(v.metalnessMap.channel),roughnessMapUv:se&&g(v.roughnessMap.channel),clearcoatMapUv:z&&g(v.clearcoatMap.channel),clearcoatNormalMapUv:q&&g(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Z&&g(v.clearcoatRoughnessMap.channel),iridescenceMapUv:fe&&g(v.iridescenceMap.channel),iridescenceThicknessMapUv:xe&&g(v.iridescenceThicknessMap.channel),sheenColorMapUv:Me&&g(v.sheenColorMap.channel),sheenRoughnessMapUv:j&&g(v.sheenRoughnessMap.channel),specularMapUv:be&&g(v.specularMap.channel),specularColorMapUv:Ae&&g(v.specularColorMap.channel),specularIntensityMapUv:Le&&g(v.specularIntensityMap.channel),transmissionMapUv:Te&&g(v.transmissionMap.channel),thicknessMapUv:Ee&&g(v.thicknessMap.channel),alphaMapUv:Ye&&g(v.alphaMap.channel),vertexTangents:ne&&!!B.attributes.tangent,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,vertexUv1s:K,vertexUv2s:he,vertexUv3s:ye,pointsUvs:I.isPoints===!0&&!!B.attributes.uv&&(Se||Ye),fog:!!F,useFog:v.fog===!0,fogExp2:F&&F.isFogExp2,flatShading:v.flatShading===!0,sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:I.isSkinnedMesh===!0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:we,morphTextureStride:ce,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:v.dithering,shadowMapEnabled:t.shadowMap.enabled&&N.length>0,shadowMapType:t.shadowMap.type,toneMapping:v.toneMapped?t.toneMapping:ci,useLegacyLights:t.useLegacyLights,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===oi,flipSided:v.side===Qt,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionDerivatives:O&&v.extensions.derivatives===!0,extensionFragDepth:O&&v.extensions.fragDepth===!0,extensionDrawBuffers:O&&v.extensions.drawBuffers===!0,extensionShaderTextureLOD:O&&v.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:f||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||i.has("EXT_shader_texture_lod"),customProgramCacheKey:v.customProgramCacheKey()}}function p(v){const T=[];if(v.shaderID?T.push(v.shaderID):(T.push(v.customVertexShaderID),T.push(v.customFragmentShaderID)),v.defines!==void 0)for(const N in v.defines)T.push(N),T.push(v.defines[N]);return v.isRawShaderMaterial===!1&&(y(T,v),E(T,v),T.push(t.outputColorSpace)),T.push(v.customProgramCacheKey),T.join()}function y(v,T){v.push(T.precision),v.push(T.outputColorSpace),v.push(T.envMapMode),v.push(T.envMapCubeUVHeight),v.push(T.mapUv),v.push(T.alphaMapUv),v.push(T.lightMapUv),v.push(T.aoMapUv),v.push(T.bumpMapUv),v.push(T.normalMapUv),v.push(T.displacementMapUv),v.push(T.emissiveMapUv),v.push(T.metalnessMapUv),v.push(T.roughnessMapUv),v.push(T.clearcoatMapUv),v.push(T.clearcoatNormalMapUv),v.push(T.clearcoatRoughnessMapUv),v.push(T.iridescenceMapUv),v.push(T.iridescenceThicknessMapUv),v.push(T.sheenColorMapUv),v.push(T.sheenRoughnessMapUv),v.push(T.specularMapUv),v.push(T.specularColorMapUv),v.push(T.specularIntensityMapUv),v.push(T.transmissionMapUv),v.push(T.thicknessMapUv),v.push(T.combine),v.push(T.fogExp2),v.push(T.sizeAttenuation),v.push(T.morphTargetsCount),v.push(T.morphAttributeCount),v.push(T.numDirLights),v.push(T.numPointLights),v.push(T.numSpotLights),v.push(T.numSpotLightMaps),v.push(T.numHemiLights),v.push(T.numRectAreaLights),v.push(T.numDirLightShadows),v.push(T.numPointLightShadows),v.push(T.numSpotLightShadows),v.push(T.numSpotLightShadowsWithMaps),v.push(T.shadowMapType),v.push(T.toneMapping),v.push(T.numClippingPlanes),v.push(T.numClipIntersection),v.push(T.depthPacking)}function E(v,T){a.disableAll(),T.isWebGL2&&a.enable(0),T.supportsVertexTextures&&a.enable(1),T.instancing&&a.enable(2),T.instancingColor&&a.enable(3),T.matcap&&a.enable(4),T.envMap&&a.enable(5),T.normalMapObjectSpace&&a.enable(6),T.normalMapTangentSpace&&a.enable(7),T.clearcoat&&a.enable(8),T.iridescence&&a.enable(9),T.alphaTest&&a.enable(10),T.vertexColors&&a.enable(11),T.vertexAlphas&&a.enable(12),T.vertexUv1s&&a.enable(13),T.vertexUv2s&&a.enable(14),T.vertexUv3s&&a.enable(15),T.vertexTangents&&a.enable(16),v.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.skinning&&a.enable(4),T.morphTargets&&a.enable(5),T.morphNormals&&a.enable(6),T.morphColors&&a.enable(7),T.premultipliedAlpha&&a.enable(8),T.shadowMapEnabled&&a.enable(9),T.useLegacyLights&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),v.push(a.mask)}function x(v){const T=_[v.type];let N;if(T){const U=zn[T];N=Y1.clone(U.uniforms)}else N=v.uniforms;return N}function M(v,T){let N;for(let U=0,I=l.length;U0?i.push(p):d.transparent===!0?s.push(p):n.push(p)}function c(u,h,d,_,g,m){const p=o(u,h,d,_,g,m);d.transmission>0?i.unshift(p):d.transparent===!0?s.unshift(p):n.unshift(p)}function l(u,h){n.length>1&&n.sort(u||cb),i.length>1&&i.sort(h||Rh),s.length>1&&s.sort(h||Rh)}function f(){for(let u=e,h=t.length;u=r.length?(o=new Ch,r.push(o)):o=r[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function fb(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new W,color:new st};break;case"SpotLight":n={position:new W,direction:new W,color:new st,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new W,color:new st,distance:0,decay:0};break;case"HemisphereLight":n={direction:new W,skyColor:new st,groundColor:new st};break;case"RectAreaLight":n={color:new st,position:new W,halfWidth:new W,halfHeight:new W};break}return t[e.id]=n,n}}}function ub(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let hb=0;function db(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function pb(t,e){const n=new fb,i=ub(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let f=0;f<9;f++)s.probe.push(new W);const r=new W,o=new vt,a=new vt;function c(f,u){let h=0,d=0,_=0;for(let N=0;N<9;N++)s.probe[N].set(0,0,0);let g=0,m=0,p=0,y=0,E=0,x=0,M=0,b=0,w=0,D=0;f.sort(db);const v=u===!0?Math.PI:1;for(let N=0,U=f.length;N0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=_e.LTC_FLOAT_1,s.rectAreaLTC2=_e.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=_e.LTC_HALF_1,s.rectAreaLTC2=_e.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=h,s.ambient[1]=d,s.ambient[2]=_;const T=s.hash;(T.directionalLength!==g||T.pointLength!==m||T.spotLength!==p||T.rectAreaLength!==y||T.hemiLength!==E||T.numDirectionalShadows!==x||T.numPointShadows!==M||T.numSpotShadows!==b||T.numSpotMaps!==w)&&(s.directional.length=g,s.spot.length=p,s.rectArea.length=y,s.point.length=m,s.hemi.length=E,s.directionalShadow.length=x,s.directionalShadowMap.length=x,s.pointShadow.length=M,s.pointShadowMap.length=M,s.spotShadow.length=b,s.spotShadowMap.length=b,s.directionalShadowMatrix.length=x,s.pointShadowMatrix.length=M,s.spotLightMatrix.length=b+w-D,s.spotLightMap.length=w,s.numSpotLightShadowsWithMaps=D,T.directionalLength=g,T.pointLength=m,T.spotLength=p,T.rectAreaLength=y,T.hemiLength=E,T.numDirectionalShadows=x,T.numPointShadows=M,T.numSpotShadows=b,T.numSpotMaps=w,s.version=hb++)}function l(f,u){let h=0,d=0,_=0,g=0,m=0;const p=u.matrixWorldInverse;for(let y=0,E=f.length;y=a.length?(c=new Ph(t,e),a.push(c)):c=a[o],c}function s(){n=new WeakMap}return{get:i,dispose:s}}class gb extends io{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=u1,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 _b extends io{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const vb=`void main() { gl_Position = vec4( position, 1.0 ); -}`,Cy=`uniform sampler2D shadow_pass; +}`,xb=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3416,29 +3416,33 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function Py(t,e,n){let i=new Wl;const s=new He,r=new He,o=new bt,a=new wy({depthPacking:Sx}),c=new Ay,l={},f=n.maxTextureSize,u={[bi]:Zt,[Zt]:bi,[ni]:ni},h=new Ji({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:Ry,fragmentShader:Cy}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const _=new ai;_.setAttribute("position",new fn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new ii(_,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Qp;let p=this.type;this.render=function(M,b,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||M.length===0)return;const D=t.getRenderTarget(),x=t.getActiveCubeFace(),T=t.getActiveMipmapLevel(),I=t.state;I.setBlending(yi),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);const B=p!==Kn&&this.type===Kn,U=p===Kn&&this.type!==Kn;for(let F=0,z=M.length;Ff||s.y>f)&&(s.x>f&&(r.x=Math.floor(f/k.x),s.x=r.x*k.x,$.mapSize.x=r.x),s.y>f&&(r.y=Math.floor(f/k.y),s.y=r.y*k.y,$.mapSize.y=r.y)),$.map===null||B===!0||U===!0){const ie=this.type!==Kn?{minFilter:Gt,magFilter:Gt}:{};$.map!==null&&$.map.dispose(),$.map=new Ki(s.x,s.y,ie),$.map.texture.name=H.name+".shadowMap",$.camera.updateProjectionMatrix()}t.setRenderTarget($.map),t.clear();const le=$.getViewportCount();for(let ie=0;ie0||b.map&&b.alphaTest>0){const I=x.uuid,B=b.uuid;let U=l[I];U===void 0&&(U={},l[I]=U);let F=U[B];F===void 0&&(F=x.clone(),U[B]=F),x=F}if(x.visible=b.visible,x.wireframe=b.wireframe,D===Kn?x.side=b.shadowSide!==null?b.shadowSide:b.side:x.side=b.shadowSide!==null?b.shadowSide:u[b.side],x.alphaMap=b.alphaMap,x.alphaTest=b.alphaTest,x.map=b.map,x.clipShadows=b.clipShadows,x.clippingPlanes=b.clippingPlanes,x.clipIntersection=b.clipIntersection,x.displacementMap=b.displacementMap,x.displacementScale=b.displacementScale,x.displacementBias=b.displacementBias,x.wireframeLinewidth=b.wireframeLinewidth,x.linewidth=b.linewidth,w.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const I=t.properties.get(x);I.light=w}return x}function v(M,b,w,D,x){if(M.visible===!1)return;if(M.layers.test(b.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&x===Kn)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,M.matrixWorld);const B=e.update(M),U=M.material;if(Array.isArray(U)){const F=B.groups;for(let z=0,H=F.length;z=1):k.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),H=$>=2);let le=null,ie={};const we=t.getParameter(t.SCISSOR_BOX),ce=t.getParameter(t.VIEWPORT),j=new bt().fromArray(we),re=new bt().fromArray(ce);function me(N,K,he,ye){const Pe=new Uint8Array(4),et=t.createTexture();t.bindTexture(N,et),t.texParameteri(N,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(N,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let tt=0;tt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let g;const m=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(A,S){return p?new OffscreenCanvas(A,S):Zo("canvas")}function E(A,S,O,q){let Z=1;if((A.width>q||A.height>q)&&(Z=q/Math.max(A.width,A.height)),Z<1||S===!0)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const fe=S?cm:Math.floor,xe=fe(Z*A.width),Me=fe(Z*A.height);g===void 0&&(g=y(xe,Me));const Y=O?y(xe,Me):g;return Y.width=xe,Y.height=Me,Y.getContext("2d").drawImage(A,0,0,xe,Me),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+xe+"x"+Me+")."),Y}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+A.width+"x"+A.height+")."),A;return A}function v(A){return fl(A.width)&&fl(A.height)}function M(A){return a?!1:A.wrapS!==yn||A.wrapT!==yn||A.minFilter!==Gt&&A.minFilter!==dn}function b(A,S){return A.generateMipmaps&&S&&A.minFilter!==Gt&&A.minFilter!==dn}function w(A){t.generateMipmap(A)}function D(A,S,O,q,Z=!1){if(a===!1)return S;if(A!==null){if(t[A]!==void 0)return t[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let fe=S;return S===t.RED&&(O===t.FLOAT&&(fe=t.R32F),O===t.HALF_FLOAT&&(fe=t.R16F),O===t.UNSIGNED_BYTE&&(fe=t.R8)),S===t.RG&&(O===t.FLOAT&&(fe=t.RG32F),O===t.HALF_FLOAT&&(fe=t.RG16F),O===t.UNSIGNED_BYTE&&(fe=t.RG8)),S===t.RGBA&&(O===t.FLOAT&&(fe=t.RGBA32F),O===t.HALF_FLOAT&&(fe=t.RGBA16F),O===t.UNSIGNED_BYTE&&(fe=q===Be&&Z===!1?t.SRGB8_ALPHA8:t.RGBA8),O===t.UNSIGNED_SHORT_4_4_4_4&&(fe=t.RGBA4),O===t.UNSIGNED_SHORT_5_5_5_1&&(fe=t.RGB5_A1)),(fe===t.R16F||fe===t.R32F||fe===t.RG16F||fe===t.RG32F||fe===t.RGBA16F||fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function x(A,S,O){return b(A,O)===!0||A.isFramebufferTexture&&A.minFilter!==Gt&&A.minFilter!==dn?Math.log2(Math.max(S.width,S.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?S.mipmaps.length:1}function T(A){return A===Gt||A===Kf||A===Va?t.NEAREST:t.LINEAR}function I(A){const S=A.target;S.removeEventListener("dispose",I),U(S),S.isVideoTexture&&_.delete(S)}function B(A){const S=A.target;S.removeEventListener("dispose",B),z(S)}function U(A){const S=i.get(A);if(S.__webglInit===void 0)return;const O=A.source,q=m.get(O);if(q){const Z=q[S.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&F(A),Object.keys(q).length===0&&m.delete(O)}i.remove(A)}function F(A){const S=i.get(A);t.deleteTexture(S.__webglTexture);const O=A.source,q=m.get(O);delete q[S.__cacheKey],o.memory.textures--}function z(A){const S=A.texture,O=i.get(A),q=i.get(S);if(q.__webglTexture!==void 0&&(t.deleteTexture(q.__webglTexture),o.memory.textures--),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++)t.deleteFramebuffer(O.__webglFramebuffer[Z]),O.__webglDepthbuffer&&t.deleteRenderbuffer(O.__webglDepthbuffer[Z]);else{if(t.deleteFramebuffer(O.__webglFramebuffer),O.__webglDepthbuffer&&t.deleteRenderbuffer(O.__webglDepthbuffer),O.__webglMultisampledFramebuffer&&t.deleteFramebuffer(O.__webglMultisampledFramebuffer),O.__webglColorRenderbuffer)for(let Z=0;Z=c&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+c),H+=1,A}function le(A){const S=[];return S.push(A.wrapS),S.push(A.wrapT),S.push(A.wrapR||0),S.push(A.magFilter),S.push(A.minFilter),S.push(A.anisotropy),S.push(A.internalFormat),S.push(A.format),S.push(A.type),S.push(A.generateMipmaps),S.push(A.premultiplyAlpha),S.push(A.flipY),S.push(A.unpackAlignment),S.push(A.colorSpace),S.join()}function ie(A,S){const O=i.get(A);if(A.isVideoTexture&&ae(A),A.isRenderTargetTexture===!1&&A.version>0&&O.__version!==A.version){const q=A.image;if(q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{de(O,A,S);return}}n.bindTexture(t.TEXTURE_2D,O.__webglTexture,t.TEXTURE0+S)}function we(A,S){const O=i.get(A);if(A.version>0&&O.__version!==A.version){de(O,A,S);return}n.bindTexture(t.TEXTURE_2D_ARRAY,O.__webglTexture,t.TEXTURE0+S)}function ce(A,S){const O=i.get(A);if(A.version>0&&O.__version!==A.version){de(O,A,S);return}n.bindTexture(t.TEXTURE_3D,O.__webglTexture,t.TEXTURE0+S)}function j(A,S){const O=i.get(A);if(A.version>0&&O.__version!==A.version){Se(O,A,S);return}n.bindTexture(t.TEXTURE_CUBE_MAP,O.__webglTexture,t.TEXTURE0+S)}const re={[al]:t.REPEAT,[yn]:t.CLAMP_TO_EDGE,[cl]:t.MIRRORED_REPEAT},me={[Gt]:t.NEAREST,[Kf]:t.NEAREST_MIPMAP_NEAREST,[Va]:t.NEAREST_MIPMAP_LINEAR,[dn]:t.LINEAR,[rx]:t.LINEAR_MIPMAP_NEAREST,[Fr]:t.LINEAR_MIPMAP_LINEAR};function ve(A,S,O){if(O?(t.texParameteri(A,t.TEXTURE_WRAP_S,re[S.wrapS]),t.texParameteri(A,t.TEXTURE_WRAP_T,re[S.wrapT]),(A===t.TEXTURE_3D||A===t.TEXTURE_2D_ARRAY)&&t.texParameteri(A,t.TEXTURE_WRAP_R,re[S.wrapR]),t.texParameteri(A,t.TEXTURE_MAG_FILTER,me[S.magFilter]),t.texParameteri(A,t.TEXTURE_MIN_FILTER,me[S.minFilter])):(t.texParameteri(A,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(A,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(A===t.TEXTURE_3D||A===t.TEXTURE_2D_ARRAY)&&t.texParameteri(A,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(S.wrapS!==yn||S.wrapT!==yn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(A,t.TEXTURE_MAG_FILTER,T(S.magFilter)),t.texParameteri(A,t.TEXTURE_MIN_FILTER,T(S.minFilter)),S.minFilter!==Gt&&S.minFilter!==dn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const q=e.get("EXT_texture_filter_anisotropic");if(S.magFilter===Gt||S.minFilter!==Va&&S.minFilter!==Fr||S.type===ki&&e.has("OES_texture_float_linear")===!1||a===!1&&S.type===Or&&e.has("OES_texture_half_float_linear")===!1)return;(S.anisotropy>1||i.get(S).__currentAnisotropy)&&(t.texParameterf(A,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,s.getMaxAnisotropy())),i.get(S).__currentAnisotropy=S.anisotropy)}}function R(A,S){let O=!1;A.__webglInit===void 0&&(A.__webglInit=!0,S.addEventListener("dispose",I));const q=S.source;let Z=m.get(q);Z===void 0&&(Z={},m.set(q,Z));const fe=le(S);if(fe!==A.__cacheKey){Z[fe]===void 0&&(Z[fe]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,O=!0),Z[fe].usedTimes++;const xe=Z[A.__cacheKey];xe!==void 0&&(Z[A.__cacheKey].usedTimes--,xe.usedTimes===0&&F(S)),A.__cacheKey=fe,A.__webglTexture=Z[fe].texture}return O}function de(A,S,O){let q=t.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(q=t.TEXTURE_2D_ARRAY),S.isData3DTexture&&(q=t.TEXTURE_3D);const Z=R(A,S),fe=S.source;n.bindTexture(q,A.__webglTexture,t.TEXTURE0+O);const xe=i.get(fe);if(fe.version!==xe.__version||Z===!0){n.activeTexture(t.TEXTURE0+O),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,S.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,S.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const Me=M(S)&&v(S.image)===!1;let Y=E(S.image,Me,!1,f);Y=oe(S,Y);const be=v(Y)||a,Ae=r.convert(S.format,S.colorSpace);let Le=r.convert(S.type),Te=D(S.internalFormat,Ae,Le,S.colorSpace);ve(q,S,be);let Ee;const Ie=S.mipmaps,je=a&&S.isVideoTexture!==!0,at=xe.__version===void 0||Z===!0,N=x(S,Y,be);if(S.isDepthTexture)Te=t.DEPTH_COMPONENT,a?S.type===ki?Te=t.DEPTH_COMPONENT32F:S.type===$i?Te=t.DEPTH_COMPONENT24:S.type===Us?Te=t.DEPTH24_STENCIL8:Te=t.DEPTH_COMPONENT16:S.type===ki&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),S.format===qi&&Te===t.DEPTH_COMPONENT&&S.type!==sm&&S.type!==$i&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),S.type=$i,Le=r.convert(S.type)),S.format===zs&&Te===t.DEPTH_COMPONENT&&(Te=t.DEPTH_STENCIL,S.type!==Us&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),S.type=Us,Le=r.convert(S.type))),at&&(je?n.texStorage2D(t.TEXTURE_2D,1,Te,Y.width,Y.height):n.texImage2D(t.TEXTURE_2D,0,Te,Y.width,Y.height,0,Ae,Le,null));else if(S.isDataTexture)if(Ie.length>0&&be){je&&at&&n.texStorage2D(t.TEXTURE_2D,N,Te,Ie[0].width,Ie[0].height);for(let K=0,he=Ie.length;K>=1,he>>=1}}else if(Ie.length>0&&be){je&&at&&n.texStorage2D(t.TEXTURE_2D,N,Te,Ie[0].width,Ie[0].height);for(let K=0,he=Ie.length;K0&&at++,n.texStorage2D(t.TEXTURE_CUBE_MAP,at,Ee,Y[0].width,Y[0].height));for(let K=0;K<6;K++)if(Me){Ie?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,Y[K].width,Y[K].height,Le,Te,Y[K].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,Ee,Y[K].width,Y[K].height,0,Le,Te,Y[K].data);for(let he=0;he=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,q,Z,i.get(O).__webglTexture,0),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ce(A,S,O){if(t.bindRenderbuffer(t.RENDERBUFFER,A),S.depthBuffer&&!S.stencilBuffer){let q=t.DEPTH_COMPONENT16;if(O||se(S)){const Z=S.depthTexture;Z&&Z.isDepthTexture&&(Z.type===ki?q=t.DEPTH_COMPONENT32F:Z.type===$i&&(q=t.DEPTH_COMPONENT24));const fe=pe(S);se(S)?h.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,fe,q,S.width,S.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,fe,q,S.width,S.height)}else t.renderbufferStorage(t.RENDERBUFFER,q,S.width,S.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,A)}else if(S.depthBuffer&&S.stencilBuffer){const q=pe(S);O&&se(S)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,q,t.DEPTH24_STENCIL8,S.width,S.height):se(S)?h.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,q,t.DEPTH24_STENCIL8,S.width,S.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,S.width,S.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,A)}else{const q=S.isWebGLMultipleRenderTargets===!0?S.texture:[S.texture];for(let Z=0;Z0&&se(A)===!1){const Me=fe?S:[S];O.__webglMultisampledFramebuffer=t.createFramebuffer(),O.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let Y=0;Y0&&se(A)===!1){const S=A.isWebGLMultipleRenderTargets?A.texture:[A.texture],O=A.width,q=A.height;let Z=t.COLOR_BUFFER_BIT;const fe=[],xe=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Me=i.get(A),Y=A.isWebGLMultipleRenderTargets===!0;if(Y)for(let be=0;be0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function ae(A){const S=o.render.frame;_.get(A)!==S&&(_.set(A,S),A.update())}function oe(A,S){const O=A.colorSpace,q=A.format,Z=A.type;return A.isCompressedTexture===!0||A.format===ll||O!==Bn&&O!==ji&&(O===Be?a===!1?e.has("EXT_sRGB")===!0&&q===bn?(A.format=ll,A.minFilter=dn,A.generateMipmaps=!1):S=fm.sRGBToLinear(S):(q!==bn||Z!==Zi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",O)),S}this.allocateTextureUnit=k,this.resetTextureUnits=$,this.setTexture2D=ie,this.setTexture2DArray=we,this.setTexture3D=ce,this.setTextureCube=j,this.rebindTextures=V,this.setupRenderTarget=ne,this.updateRenderTargetMipmap=Q,this.updateMultisampleRenderTarget=te,this.setupDepthRenderbuffer=L,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=se}function Uy(t,e,n){const i=n.isWebGL2;function s(r,o=ji){let a;if(r===Zi)return t.UNSIGNED_BYTE;if(r===lx)return t.UNSIGNED_SHORT_4_4_4_4;if(r===fx)return t.UNSIGNED_SHORT_5_5_5_1;if(r===ox)return t.BYTE;if(r===ax)return t.SHORT;if(r===sm)return t.UNSIGNED_SHORT;if(r===cx)return t.INT;if(r===$i)return t.UNSIGNED_INT;if(r===ki)return t.FLOAT;if(r===Or)return i?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===ux)return t.ALPHA;if(r===bn)return t.RGBA;if(r===hx)return t.LUMINANCE;if(r===dx)return t.LUMINANCE_ALPHA;if(r===qi)return t.DEPTH_COMPONENT;if(r===zs)return t.DEPTH_STENCIL;if(r===ll)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===px)return t.RED;if(r===mx)return t.RED_INTEGER;if(r===gx)return t.RG;if(r===_x)return t.RG_INTEGER;if(r===vx)return t.RGBA_INTEGER;if(r===Ha||r===Ga||r===$a||r===ka)if(o===Be)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Ha)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Ga)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===$a)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===ka)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Ha)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Ga)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===$a)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===ka)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Jf||r===Qf||r===eu||r===tu)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===Jf)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Qf)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===eu)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===tu)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===xx)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===nu||r===iu)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===nu)return o===Be?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===iu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===su||r===ru||r===ou||r===au||r===cu||r===lu||r===fu||r===uu||r===hu||r===du||r===pu||r===mu||r===gu||r===_u)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===su)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===ru)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===ou)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===au)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===cu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===lu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===fu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===uu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===hu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===du)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===pu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===mu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===gu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===_u)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Wa)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===Wa)return o===Be?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===Mx||r===vu||r===xu||r===Mu)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===Wa)return a.COMPRESSED_RED_RGTC1_EXT;if(r===vu)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===xu)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Mu)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Us?i?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):t[r]!==void 0?t[r]:null}return{convert:s}}class Iy extends pn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class So extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ny={type:"move"};class dc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new So,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new So,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new W,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new W),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new So,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new W,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new W),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 n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}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,n,i){let s=null,r=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const g of e.hand.values()){const m=n.getJointPose(g,i),p=this._getHandJoint(l,g);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const f=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],h=f.position.distanceTo(u.position),d=.02,_=.005;l.inputState.pinching&&h>d+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&h<=d-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=n.getPose(e.gripSpace,i),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(s=n.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Ny)))}return a!==null&&(a.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new So;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class Fy extends ln{constructor(e,n,i,s,r,o,a,c,l,f){if(f=f!==void 0?f:qi,f!==qi&&f!==zs)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&f===qi&&(i=$i),i===void 0&&f===zs&&(i=Us),super(null,s,r,o,a,c,f,i,l),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=a!==void 0?a:Gt,this.minFilter=c!==void 0?c:Gt,this.flipY=!1,this.generateMipmaps=!1}}class Oy extends es{constructor(e,n){super();const i=this;let s=null,r=1,o=null,a="local-floor",c=1,l=null,f=null,u=null,h=null,d=null,_=null;const g=n.getContextAttributes();let m=null,p=null;const y=[],E=[],v=new Set,M=new Map,b=new pn;b.layers.enable(1),b.viewport=new bt;const w=new pn;w.layers.enable(2),w.viewport=new bt;const D=[b,w],x=new Iy;x.layers.enable(1),x.layers.enable(2);let T=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let re=y[j];return re===void 0&&(re=new dc,y[j]=re),re.getTargetRaySpace()},this.getControllerGrip=function(j){let re=y[j];return re===void 0&&(re=new dc,y[j]=re),re.getGripSpace()},this.getHand=function(j){let re=y[j];return re===void 0&&(re=new dc,y[j]=re),re.getHandSpace()};function B(j){const re=E.indexOf(j.inputSource);if(re===-1)return;const me=y[re];me!==void 0&&(me.update(j.inputSource,j.frame,l||o),me.dispatchEvent({type:j.type,data:j.inputSource}))}function U(){s.removeEventListener("select",B),s.removeEventListener("selectstart",B),s.removeEventListener("selectend",B),s.removeEventListener("squeeze",B),s.removeEventListener("squeezestart",B),s.removeEventListener("squeezeend",B),s.removeEventListener("end",U),s.removeEventListener("inputsourceschange",F);for(let j=0;j=0&&(E[ve]=null,y[ve].disconnect(me))}for(let re=0;re=E.length){E.push(me),ve=de;break}else if(E[de]===null){E[de]=me,ve=de;break}if(ve===-1)break}const R=y[ve];R&&R.connect(me)}}const z=new W,H=new W;function $(j,re,me){z.setFromMatrixPosition(re.matrixWorld),H.setFromMatrixPosition(me.matrixWorld);const ve=z.distanceTo(H),R=re.projectionMatrix.elements,de=me.projectionMatrix.elements,Se=R[14]/(R[10]-1),ue=R[14]/(R[10]+1),Ce=(R[9]+1)/R[5],P=(R[9]-1)/R[5],L=(R[8]-1)/R[0],V=(de[8]+1)/de[0],ne=Se*L,Q=Se*V,te=ve/(-L+V),pe=te*-L;re.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(pe),j.translateZ(te),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert();const se=Se+te,ae=ue+te,oe=ne-pe,A=Q+(ve-pe),S=Ce*ue/ae*se,O=P*ue/ae*se;j.projectionMatrix.makePerspective(oe,A,S,O,se,ae),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}function k(j,re){re===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(re.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(s===null)return;x.near=w.near=b.near=j.near,x.far=w.far=b.far=j.far,(T!==x.near||I!==x.far)&&(s.updateRenderState({depthNear:x.near,depthFar:x.far}),T=x.near,I=x.far);const re=j.parent,me=x.cameras;k(x,re);for(let ve=0;veR&&(M.set(ve,ve.lastChangedTime),i.dispatchEvent({type:"planechanged",data:ve}))}}_=null}const ce=new Em;ce.setAnimationLoop(we),this.setAnimationLoop=function(j){ie=j},this.dispose=function(){}}}function By(t,e){function n(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function i(m,p){p.color.getRGB(m.fogColor.value,vm(t)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function s(m,p,y,E,v){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(m,p):p.isMeshToonMaterial?(r(m,p),u(m,p)):p.isMeshPhongMaterial?(r(m,p),f(m,p)):p.isMeshStandardMaterial?(r(m,p),h(m,p),p.isMeshPhysicalMaterial&&d(m,p,v)):p.isMeshMatcapMaterial?(r(m,p),_(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),g(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?c(m,p,y,E):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,n(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,n(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,n(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Zt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,n(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Zt&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,n(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,n(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,n(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const y=e.get(p).envMap;if(y&&(m.envMap.value=y,m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap){m.lightMap.value=p.lightMap;const E=t.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=p.lightMapIntensity*E,n(p.lightMap,m.lightMapTransform)}p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,n(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,n(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,y,E){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*y,m.scale.value=E*.5,p.map&&(m.map.value=p.map,n(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,n(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function f(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function h(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,m.roughnessMapTransform)),e.get(p).envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,y){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,n(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,n(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,n(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,n(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,n(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Zt&&m.clearcoatNormalScale.value.negate())),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,n(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,n(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,n(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,n(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,n(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,n(p.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,p){p.matcap&&(m.matcap.value=p.matcap)}function g(m,p){const y=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function zy(t,e,n,i){let s={},r={},o=[];const a=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(y,E){const v=E.program;i.uniformBlockBinding(y,v)}function l(y,E){let v=s[y.id];v===void 0&&(_(y),v=f(y),s[y.id]=v,y.addEventListener("dispose",m));const M=E.program;i.updateUBOMapping(y,M);const b=e.render.frame;r[y.id]!==b&&(h(y),r[y.id]=b)}function f(y){const E=u();y.__bindingPointIndex=E;const v=t.createBuffer(),M=y.__size,b=y.usage;return t.bindBuffer(t.UNIFORM_BUFFER,v),t.bufferData(t.UNIFORM_BUFFER,M,b),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,E,v),v}function u(){for(let y=0;y0){b=v%M;const B=M-b;b!==0&&B-T.boundary<0&&(v+=M-b,x.__offset=v)}v+=T.storage}return b=v%M,b>0&&(v+=M-b),y.__size=v,y.__cache={},this}function g(y){const E={boundary:0,storage:0};return typeof y=="number"?(E.boundary=4,E.storage=4):y.isVector2?(E.boundary=8,E.storage=8):y.isVector3||y.isColor?(E.boundary=16,E.storage=12):y.isVector4?(E.boundary=16,E.storage=16):y.isMatrix3?(E.boundary=48,E.storage=48):y.isMatrix4?(E.boundary=64,E.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),E}function m(y){const E=y.target;E.removeEventListener("dispose",m);const v=o.indexOf(E.__bindingPointIndex);o.splice(v,1),t.deleteBuffer(s[E.id]),delete s[E.id],delete r[E.id]}function p(){for(const y in s)t.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:c,update:l,dispose:p}}function Vy(){const t=Zo("canvas");return t.style.display="block",t}class Am{constructor(e={}){const{canvas:n=Vy(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let h;i!==null?h=i.getContextAttributes().alpha:h=o;let d=null,_=null;const g=[],m=[];this.domElement=n,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.outputColorSpace=Be,this.useLegacyLights=!0,this.toneMapping=ri,this.toneMappingExposure=1;const p=this;let y=!1,E=0,v=0,M=null,b=-1,w=null;const D=new bt,x=new bt;let T=null,I=n.width,B=n.height,U=1,F=null,z=null;const H=new bt(0,0,I,B),$=new bt(0,0,I,B);let k=!1;const le=new Wl;let ie=!1,we=!1,ce=null;const j=new _t,re=new W,me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ve(){return M===null?U:1}let R=i;function de(C,X){for(let J=0;J0?_=m[m.length-1]:_=null,g.pop(),g.length>0?d=g[g.length-1]:d=null};function Ct(C,X,J,G){if(C.visible===!1)return;if(C.layers.test(X.layers)){if(C.isGroup)J=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(X);else if(C.isLight)_.pushLight(C),C.castShadow&&_.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||le.intersectsSprite(C)){G&&re.setFromMatrixPosition(C.matrixWorld).applyMatrix4(j);const Ue=se.update(C),Ne=C.material;Ne.visible&&d.push(C,Ue,Ne,J,re.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||le.intersectsObject(C))){C.isSkinnedMesh&&C.skeleton.frame!==P.render.frame&&(C.skeleton.update(),C.skeleton.frame=P.render.frame);const Ue=se.update(C),Ne=C.material;if(G&&(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),re.copy(Ue.boundingSphere.center).applyMatrix4(C.matrixWorld).applyMatrix4(j)),Array.isArray(Ne)){const ze=Ue.groups;for(let $e=0,ke=ze.length;$e0&&ct(ee,De,X,J),G&&Ce.viewport(D.copy(G)),ee.length>0&&un(ee,X,J),De.length>0&&un(De,X,J),Ue.length>0&&un(Ue,X,J),Ce.buffers.depth.setTest(!0),Ce.buffers.depth.setMask(!0),Ce.buffers.color.setMask(!0),Ce.setPolygonOffset(!1)}function ct(C,X,J,G){if(ce===null){const Ne=ue.isWebGL2;ce=new Ki(1024,1024,{generateMipmaps:!0,type:Se.has("EXT_color_buffer_half_float")?Or:Zi,minFilter:Fr,samples:Ne&&a===!0?4:0})}const ee=p.getRenderTarget();p.setRenderTarget(ce),p.clear();const De=p.toneMapping;p.toneMapping=ri,un(C,J,G),V.updateMultisampleRenderTarget(ce),V.updateRenderTargetMipmap(ce);let Ue=!1;for(let Ne=0,ze=X.length;Ne0&&V.useMultisampledRTT(C)===!1?ee=L.get(C).__webglMultisampledFramebuffer:ee=ke,D.copy(C.viewport),x.copy(C.scissor),T=C.scissorTest}else D.copy(H).multiplyScalar(U).floor(),x.copy($).multiplyScalar(U).floor(),T=k;if(Ce.bindFramebuffer(R.FRAMEBUFFER,ee)&&ue.drawBuffers&&G&&Ce.drawBuffers(C,ee),Ce.viewport(D),Ce.scissor(x),Ce.setScissorTest(T),De){const ze=L.get(C.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+X,ze.__webglTexture,J)}else if(Ue){const ze=L.get(C.texture),$e=X||0;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,ze.__webglTexture,J||0,$e)}b=-1},this.readRenderTargetPixels=function(C,X,J,G,ee,De,Ue){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ne=L.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ue!==void 0&&(Ne=Ne[Ue]),Ne){Ce.bindFramebuffer(R.FRAMEBUFFER,Ne);try{const ze=C.texture,$e=ze.format,ke=ze.type;if($e!==bn&&Y.convert($e)!==R.getParameter(R.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Xe=ke===Or&&(Se.has("EXT_color_buffer_half_float")||ue.isWebGL2&&Se.has("EXT_color_buffer_float"));if(ke!==Zi&&Y.convert(ke)!==R.getParameter(R.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ke===ki&&(ue.isWebGL2||Se.has("OES_texture_float")||Se.has("WEBGL_color_buffer_float")))&&!Xe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=C.width-G&&J>=0&&J<=C.height-ee&&R.readPixels(X,J,G,ee,Y.convert($e),Y.convert(ke),De)}finally{const ze=M!==null?L.get(M).__webglFramebuffer:null;Ce.bindFramebuffer(R.FRAMEBUFFER,ze)}}},this.copyFramebufferToTexture=function(C,X,J=0){const G=Math.pow(2,-J),ee=Math.floor(X.image.width*G),De=Math.floor(X.image.height*G);V.setTexture2D(X,0),R.copyTexSubImage2D(R.TEXTURE_2D,J,0,0,C.x,C.y,ee,De),Ce.unbindTexture()},this.copyTextureToTexture=function(C,X,J,G=0){const ee=X.image.width,De=X.image.height,Ue=Y.convert(J.format),Ne=Y.convert(J.type);V.setTexture2D(J,0),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,J.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,J.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,J.unpackAlignment),X.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,G,C.x,C.y,ee,De,Ue,Ne,X.image.data):X.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,G,C.x,C.y,X.mipmaps[0].width,X.mipmaps[0].height,Ue,X.mipmaps[0].data):R.texSubImage2D(R.TEXTURE_2D,G,C.x,C.y,Ue,Ne,X.image),G===0&&J.generateMipmaps&&R.generateMipmap(R.TEXTURE_2D),Ce.unbindTexture()},this.copyTextureToTexture3D=function(C,X,J,G,ee=0){if(p.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const De=C.max.x-C.min.x+1,Ue=C.max.y-C.min.y+1,Ne=C.max.z-C.min.z+1,ze=Y.convert(G.format),$e=Y.convert(G.type);let ke;if(G.isData3DTexture)V.setTexture3D(G,0),ke=R.TEXTURE_3D;else if(G.isDataArrayTexture)V.setTexture2DArray(G,0),ke=R.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,G.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,G.unpackAlignment);const Xe=R.getParameter(R.UNPACK_ROW_LENGTH),Ke=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Nt=R.getParameter(R.UNPACK_SKIP_PIXELS),gn=R.getParameter(R.UNPACK_SKIP_ROWS),Ai=R.getParameter(R.UNPACK_SKIP_IMAGES),ht=J.isCompressedTexture?J.mipmaps[0]:J.image;R.pixelStorei(R.UNPACK_ROW_LENGTH,ht.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,ht.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,C.min.x),R.pixelStorei(R.UNPACK_SKIP_ROWS,C.min.y),R.pixelStorei(R.UNPACK_SKIP_IMAGES,C.min.z),J.isDataTexture||J.isData3DTexture?R.texSubImage3D(ke,ee,X.x,X.y,X.z,De,Ue,Ne,ze,$e,ht.data):J.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),R.compressedTexSubImage3D(ke,ee,X.x,X.y,X.z,De,Ue,Ne,ze,ht.data)):R.texSubImage3D(ke,ee,X.x,X.y,X.z,De,Ue,Ne,ze,$e,ht),R.pixelStorei(R.UNPACK_ROW_LENGTH,Xe),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,Ke),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Nt),R.pixelStorei(R.UNPACK_SKIP_ROWS,gn),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Ai),ee===0&&G.generateMipmaps&&R.generateMipmap(ke),Ce.unbindTexture()},this.initTexture=function(C){C.isCubeTexture?V.setTextureCube(C,0):C.isData3DTexture?V.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?V.setTexture2DArray(C,0):V.setTexture2D(C,0),Ce.unbindTexture()},this.resetState=function(){E=0,v=0,M=null,Ce.reset(),be.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Be?Yi:rm}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Yi?Be:Bn}}class Hy extends Am{}Hy.prototype.isWebGL1Renderer=!0;class Gy extends It{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),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,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class $y extends kr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new it(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 it(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=om,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,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.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}}const ch={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ky{constructor(e,n,i){const s=this;let r=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=i,this.itemStart=function(f){a++,r===!1&&s.onStart!==void 0&&s.onStart(f,o,a),r=!0},this.itemEnd=function(f){o++,s.onProgress!==void 0&&s.onProgress(f,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(f){s.onError!==void 0&&s.onError(f)},this.resolveURL=function(f){return c?c(f):f},this.setURLModifier=function(f){return c=f,this},this.addHandler=function(f,u){return l.push(f,u),this},this.removeHandler=function(f){const u=l.indexOf(f);return u!==-1&&l.splice(u,2),this},this.getHandler=function(f){for(let u=0,h=l.length;u{n&&n(r),this.manager.itemEnd(e)},0),r;if(Xn[e]!==void 0){Xn[e].push({onLoad:n,onProgress:i,onError:s});return}Xn[e]=[],Xn[e].push({onLoad:n,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const f=Xn[e],u=l.body.getReader(),h=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),d=h?parseInt(h):0,_=d!==0;let g=0;const m=new ReadableStream({start(p){y();function y(){u.read().then(({done:E,value:v})=>{if(E)p.close();else{g+=v.byteLength;const M=new ProgressEvent("progress",{lengthComputable:_,loaded:g,total:d});for(let b=0,w=f.length;b{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(f=>new DOMParser().parseFromString(f,a));case"json":return l.json();default:if(a===void 0)return l.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),h=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(h);return l.arrayBuffer().then(_=>d.decode(_))}}}).then(l=>{ch.add(e,l);const f=Xn[e];delete Xn[e];for(let u=0,h=f.length;u{const f=Xn[e];if(f===void 0)throw this.manager.itemError(e),l;delete Xn[e];for(let u=0,h=f.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Cm extends It{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new it(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),n}}const pc=new _t,lh=new W,fh=new W;class Yy{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new He(512,512),this.map=null,this.mapPass=null,this.matrix=new _t,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Wl,this._frameExtents=new He(1,1),this._viewportCount=1,this._viewports=[new bt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;lh.setFromMatrixPosition(e.matrixWorld),n.position.copy(lh),fh.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(fh),n.updateMatrixWorld(),pc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pc),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(pc)}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.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return 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 jy extends Yy{constructor(){super(new Sm(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Zy extends Cm{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.shadow=new jy}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Ky extends Cm{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Gl}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Gl);class uh extends Rm{constructor(e){super(e)}load(e,n,i,s){const r=this,o=new qy(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(r.parse(a))}catch(c){s?s(c):console.error(c),r.manager.itemError(e)}},i,s)}parse(e){function n(l){const f=new DataView(l),u=32/8*3+32/8*3*3+16/8,h=f.getUint32(80,!0);if(80+32/8+h*u===f.byteLength)return!0;const _=[115,111,108,105,100];for(let g=0;g<5;g++)if(i(_,f,g))return!1;return!0}function i(l,f,u){for(let h=0,d=l.length;h>5&31)/31,_=(z>>10&31)/31)}for(let z=1;z<=3;z++){const H=I+z*12,$=T*3*3+(z-1)*3;D[$]=f.getFloat32(H,!0),D[$+1]=f.getFloat32(H+4,!0),D[$+2]=f.getFloat32(H+8,!0),x[$]=B,x[$+1]=U,x[$+2]=F,g&&(m[$]=h,m[$+1]=d,m[$+2]=_)}}return w.setAttribute("position",new fn(D,3)),w.setAttribute("normal",new fn(x,3)),g&&(w.setAttribute("color",new fn(m,3)),w.hasColors=!0,w.alpha=v),w}function r(l){const f=new ai,u=/solid([\s\S]*?)endsolid/g,h=/facet([\s\S]*?)endfacet/g;let d=0;const _=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,g=new RegExp("vertex"+_+_+_,"g"),m=new RegExp("normal"+_+_+_,"g"),p=[],y=[],E=new W;let v,M=0,b=0,w=0;for(;(v=u.exec(l))!==null;){b=w;const D=v[0];for(;(v=h.exec(D))!==null;){let I=0,B=0;const U=v[0];for(;(v=m.exec(U))!==null;)E.x=parseFloat(v[1]),E.y=parseFloat(v[2]),E.z=parseFloat(v[3]),B++;for(;(v=g.exec(U))!==null;)p.push(parseFloat(v[1]),parseFloat(v[2]),parseFloat(v[3])),y.push(E.x,E.y,E.z),I++,w++;B!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+d),I!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+d),d++}const x=b,T=w-b;f.addGroup(x,T,M),M++}return f.setAttribute("position",new oi(p,3)),f.setAttribute("normal",new oi(y,3)),f}function o(l){return typeof l!="string"?new TextDecoder().decode(l):l}function a(l){if(typeof l=="string"){const f=new Uint8Array(l.length);for(let u=0;u0&&(i.object.isPerspectiveCamera?d.multiplyScalar(R):i.object.isOrthographicCamera?(i.object.zoom=bu.clamp(i.object.zoom/R,i.minZoom,i.maxZoom),a!==i.object.zoom&&i.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),i.staticMoving?p.copy(y):p.y+=(y.y-p.y)*this.dynamicDampingFactor)},this.panCamera=function(){const R=new He,de=new W,Se=new W;return function(){if(R.copy(v).sub(E),R.lengthSq()){if(i.object.isOrthographicCamera){const Ce=(i.object.right-i.object.left)/i.object.zoom/i.domElement.clientWidth,P=(i.object.top-i.object.bottom)/i.object.zoom/i.domElement.clientWidth;R.x*=Ce,R.y*=P}R.multiplyScalar(d.length()*i.panSpeed),Se.copy(d).cross(i.object.up).setLength(R.x),Se.add(de.copy(i.object.up).setLength(R.y)),i.object.position.add(Se),i.target.add(Se),i.staticMoving?E.copy(v):E.add(R.subVectors(v,E).multiplyScalar(i.dynamicDampingFactor))}}}(),this.checkDistances=function(){(!i.noZoom||!i.noPan)&&(d.lengthSq()>i.maxDistance*i.maxDistance&&(i.object.position.addVectors(i.target,d.setLength(i.maxDistance)),p.copy(y)),d.lengthSq()r&&(i.dispatchEvent(mc),o.copy(i.object.position))):i.object.isOrthographicCamera?(i.object.lookAt(i.target),(o.distanceToSquared(i.object.position)>r||a!==i.object.zoom)&&(i.dispatchEvent(mc),o.copy(i.object.position),a=i.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type")},this.reset=function(){c=s.NONE,l=s.NONE,i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.up.copy(i.up0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),d.subVectors(i.object.position,i.target),i.object.lookAt(i.target),i.dispatchEvent(mc),o.copy(i.object.position),a=i.object.zoom};function x(R){i.enabled!==!1&&(M.length===0&&(i.domElement.setPointerCapture(R.pointerId),i.domElement.addEventListener("pointermove",T),i.domElement.addEventListener("pointerup",I)),j(R),R.pointerType==="touch"?le(R):z(R))}function T(R){i.enabled!==!1&&(R.pointerType==="touch"?ie(R):H(R))}function I(R){i.enabled!==!1&&(R.pointerType==="touch"?we(R):$(),re(R),M.length===0&&(i.domElement.releasePointerCapture(R.pointerId),i.domElement.removeEventListener("pointermove",T),i.domElement.removeEventListener("pointerup",I)))}function B(R){re(R)}function U(R){i.enabled!==!1&&(window.removeEventListener("keydown",U),l===s.NONE&&(R.code===i.keys[s.ROTATE]&&!i.noRotate?l=s.ROTATE:R.code===i.keys[s.ZOOM]&&!i.noZoom?l=s.ZOOM:R.code===i.keys[s.PAN]&&!i.noPan&&(l=s.PAN)))}function F(){i.enabled!==!1&&(l=s.NONE,window.addEventListener("keydown",U))}function z(R){if(c===s.NONE)switch(R.button){case i.mouseButtons.LEFT:c=s.ROTATE;break;case i.mouseButtons.MIDDLE:c=s.ZOOM;break;case i.mouseButtons.RIGHT:c=s.PAN;break}const de=l!==s.NONE?l:c;de===s.ROTATE&&!i.noRotate?(g.copy(D(R.pageX,R.pageY)),_.copy(g)):de===s.ZOOM&&!i.noZoom?(p.copy(w(R.pageX,R.pageY)),y.copy(p)):de===s.PAN&&!i.noPan&&(E.copy(w(R.pageX,R.pageY)),v.copy(E)),i.dispatchEvent(gc)}function H(R){const de=l!==s.NONE?l:c;de===s.ROTATE&&!i.noRotate?(_.copy(g),g.copy(D(R.pageX,R.pageY))):de===s.ZOOM&&!i.noZoom?y.copy(w(R.pageX,R.pageY)):de===s.PAN&&!i.noPan&&v.copy(w(R.pageX,R.pageY))}function $(){c=s.NONE,i.dispatchEvent(_c)}function k(R){if(i.enabled!==!1&&i.noZoom!==!0){switch(R.preventDefault(),R.deltaMode){case 2:p.y-=R.deltaY*.025;break;case 1:p.y-=R.deltaY*.01;break;default:p.y-=R.deltaY*25e-5;break}i.dispatchEvent(gc),i.dispatchEvent(_c)}}function le(R){switch(me(R),M.length){case 1:c=s.TOUCH_ROTATE,g.copy(D(M[0].pageX,M[0].pageY)),_.copy(g);break;default:c=s.TOUCH_ZOOM_PAN;const de=M[0].pageX-M[1].pageX,Se=M[0].pageY-M[1].pageY;u=f=Math.sqrt(de*de+Se*Se);const ue=(M[0].pageX+M[1].pageX)/2,Ce=(M[0].pageY+M[1].pageY)/2;E.copy(w(ue,Ce)),v.copy(E);break}i.dispatchEvent(gc)}function ie(R){switch(me(R),M.length){case 1:_.copy(g),g.copy(D(R.pageX,R.pageY));break;default:const de=ve(R),Se=R.pageX-de.x,ue=R.pageY-de.y;u=Math.sqrt(Se*Se+ue*ue);const Ce=(R.pageX+de.x)/2,P=(R.pageY+de.y)/2;v.copy(w(Ce,P));break}}function we(R){switch(M.length){case 0:c=s.NONE;break;case 1:c=s.TOUCH_ROTATE,g.copy(D(R.pageX,R.pageY)),_.copy(g);break;case 2:c=s.TOUCH_ZOOM_PAN;for(let de=0;de(t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t);var ib=nb;const sb=(t,e,n)=>(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t);var rb=sb;const ob=t=>Math.atan2(t[1],t[0]);var Yl=ob,ab=Yl;const cb=Yl,lb=t=>cb(t)*57.29577951308232;var fb=lb;const ub=()=>[0,0];var da=ub;const hb=da,db=t=>{const e=hb();return e[0]=t[0],e[1]=t[1],e};var pb=db;const mb=(t,e)=>(t[0]=e[0],t[1]=e[1],t);var gb=mb;const _b=(t,e,n)=>(t[0]=0,t[1]=0,t[2]=e[0]*n[1]-e[1]*n[0],t);var vb=_b;const xb=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)};var Mb=xb;const Eb=(t,e,n)=>(t[0]=e[0]/n[0],t[1]=e[1]/n[1],t);var Sb=Eb;const yb=(t,e)=>t[0]*e[0]+t[1]*e[1];var bb=yb;const Tb=(t,e)=>t[0]===e[0]&&t[1]===e[1];var wb=Tb;const{NEPS:Ab}=Qe,Pm=t=>Math.abs(t)Pm(Math.sin(t)),Cb=t=>Pm(Math.cos(t));var qt={sin:Rb,cos:Cb};const{sin:Pb,cos:Lb}=qt,Db=(t,e)=>(t[0]=Lb(e),t[1]=Pb(e),t);var Lm=Db;const Ub=Lm,Ib=(t,e)=>Ub(t,e*.017453292519943295);var Nb=Ib;const Fb=(t,e)=>(t[0]=e,t[1]=e,t);var Ob=Fb;const Bb=da,zb=(t,e)=>{const n=Bb();return n[0]=t,n[1]=e,n};var Vb=zb;const Hb=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]);var Gb=Hb;const $b=(t,e,n,i)=>{const s=e[0],r=e[1];return t[0]=s+i*(n[0]-s),t[1]=r+i*(n[1]-r),t};var kb=$b;const Wb=(t,e,n)=>(t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t);var Xb=Wb;const qb=(t,e,n)=>(t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t);var Yb=qb;const jb=(t,e,n)=>(t[0]=e[0]*n[0],t[1]=e[1]*n[1],t);var Zb=jb;const Kb=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t);var Jb=Kb;const Qb=(t,e,n,i)=>{const s=e[0]-n[0],r=e[1]-n[1],o=Math.cos(i),a=Math.sin(i);return t[0]=s*o-r*a+n[0],t[1]=s*a+r*o+n[1],t};var Dm=Qb;const{TAU:eT}=Qe,tT=da,nT=Dm,iT=(t,e)=>nT(t,e,tT(),eT/4);var sT=iT;const rT=(t,e)=>{const n=e[0],i=e[1];let s=n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=n*s,t[1]=i*s,t};var oT=rT;const aT=(t,e,n)=>(t[0]=e[0]*n,t[1]=e[1]*n,t);var cT=aT;const lT=(t,e,n)=>(t[0]=Math.round(e[0]/n)*n+0,t[1]=Math.round(e[1]/n)*n+0,t);var fT=lT;const uT=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i};var hT=uT;const dT=t=>{const e=t[0],n=t[1];return e*e+n*n};var pT=dT;const mT=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t);var gT=mT;const _T=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}]`;var vT=_T;const xT=(t,e,n)=>{const i=e[0],s=e[1];return t[0]=n[0]*i+n[4]*s+n[12],t[1]=n[1]*i+n[5]*s+n[13],t};var MT=xT,We={abs:ib,add:rb,angle:ab,angleDegrees:fb,angleRadians:Yl,clone:pb,copy:gb,create:da,cross:vb,distance:Mb,divide:Sb,dot:bb,equals:wb,fromAngleDegrees:Nb,fromAngleRadians:Lm,fromScalar:Ob,fromValues:Vb,length:Gb,lerp:kb,max:Xb,min:Yb,multiply:Zb,negate:Jb,normal:sT,normalize:oT,rotate:Dm,scale:cT,snap:fT,squaredDistance:hT,squaredLength:pT,subtract:gT,toString:vT,transform:MT};const ET=t=>Object.assign({},t);var jl=ET;const{EPS:hh}=Qe,ST=We,yT=jl,bT=t=>{if(t.isClosed)return t;const e=yT(t);if(e.isClosed=!0,e.points.length>1){const n=e.points,i=n[0];let s=n[n.length-1];for(;ST.distance(i,s)(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t);var wT=TT;const AT=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];var Zl=AT;const RT=Zl,CT=t=>{const e=RT();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e};var PT=CT;const LT=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t);var Im=LT;const DT=(t,e)=>{const n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],u=e[9],h=e[10],d=e[11],_=e[12],g=e[13],m=e[14],p=e[15],y=n*a-i*o,E=n*c-s*o,v=n*l-r*o,M=i*c-s*a,b=i*l-r*a,w=s*l-r*c,D=f*g-u*_,x=f*m-h*_,T=f*p-d*_,I=u*m-h*g,B=u*p-d*g,U=h*p-d*m;let F=y*U-E*B+v*I+M*T-b*x+w*D;return F?(F=1/F,t[0]=(a*U-c*B+l*I)*F,t[1]=(s*B-i*U-r*I)*F,t[2]=(g*w-m*b+p*M)*F,t[3]=(h*b-u*w-d*M)*F,t[4]=(c*T-o*U-l*x)*F,t[5]=(n*U-s*T+r*x)*F,t[6]=(m*v-_*w-p*E)*F,t[7]=(f*w-h*v+d*E)*F,t[8]=(o*B-a*T+l*D)*F,t[9]=(i*T-n*B-r*D)*F,t[10]=(_*b-g*v+p*y)*F,t[11]=(u*v-f*b-d*y)*F,t[12]=(a*x-o*I-c*D)*F,t[13]=(n*I-i*x+s*D)*F,t[14]=(g*E-_*M-m*y)*F,t[15]=(f*M-u*E+h*y)*F,t):null};var UT=DT;const IT=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15];var NT=IT;const FT=t=>(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t);var Nm=FT;const{EPS:OT}=Qe,{sin:BT,cos:zT}=qt,VT=Nm,HT=(t,e,n)=>{let[i,s,r]=n;const o=i*i+s*s+r*r;if(Math.abs(o)(t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t);var $T=GT;const{sin:vc,cos:xc}=qt,kT=(t,e,n,i)=>{const s=vc(e),r=xc(e),o=vc(n),a=xc(n),c=vc(i),l=xc(i);return t[0]=a*r,t[1]=a*s,t[2]=-o,t[3]=0,t[4]=c*o*r-l*s,t[5]=l*r+c*o*s,t[6]=c*a,t[7]=0,t[8]=c*s+l*o*r,t[9]=l*o*s-c*r,t[10]=l*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var WT=kT;const XT=(t,e)=>(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t);var qT=XT;const YT=Zl,jT=(t,e,n,i,s,r,o,a,c,l,f,u,h,d,_,g)=>{const m=YT();return m[0]=t,m[1]=e,m[2]=n,m[3]=i,m[4]=s,m[5]=r,m[6]=o,m[7]=a,m[8]=c,m[9]=l,m[10]=f,m[11]=u,m[12]=h,m[13]=d,m[14]=_,m[15]=g,m};var ZT=jT;const KT=(t,e)=>(t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t);var Om=KT;const JT=(t,e,n)=>(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t);var Bm=JT;const QT=(t,e)=>t[0]*e[0]+t[1]*e[1]+t[2]*e[2];var pa=QT;const ew=pa,tw=(t,e)=>{const n=t[0],i=t[1],s=t[2],r=e[0],o=e[1],a=e[2],c=Math.sqrt(n*n+i*i+s*s),l=Math.sqrt(r*r+o*o+a*a),f=c*l,u=f&&ew(t,e)/f;return Math.acos(Math.min(Math.max(u,-1),1))};var nw=tw;const iw=()=>[0,0,0];var ma=iw;const sw=ma,rw=t=>{const e=sw();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e};var ow=rw;const aw=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t);var zm=aw;const cw=(t,e,n)=>{const i=e[0],s=e[1],r=e[2],o=n[0],a=n[1],c=n[2];return t[0]=s*c-r*a,t[1]=r*o-i*c,t[2]=i*a-s*o,t};var Xr=cw;const lw=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1],s=e[2]-t[2];return Math.sqrt(n*n+i*i+s*s)};var Vm=lw;const fw=(t,e,n)=>(t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t);var uw=fw;const hw=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2];var dw=hw;const pw=(t,e)=>(t[0]=e,t[1]=e,t[2]=e,t);var mw=pw;const gw=ma,_w=(t,e,n)=>{const i=gw();return i[0]=t,i[1]=e,i[2]=n,i};var vw=_w;const xw=(t,e,n=0)=>(t[0]=e[0],t[1]=e[1],t[2]=n,t);var Mw=xw;const Ew=t=>{const e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)};var Hm=Ew;const Sw=(t,e,n,i)=>(t[0]=e[0]+i*(n[0]-e[0]),t[1]=e[1]+i*(n[1]-e[1]),t[2]=e[2]+i*(n[2]-e[2]),t);var yw=Sw;const bw=(t,e,n)=>(t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t);var Tw=bw;const ww=(t,e,n)=>(t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t);var Aw=ww;const Rw=(t,e,n)=>(t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t);var Cw=Rw;const Pw=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t);var Lw=Pw;const Dw=(t,e)=>{const n=e[0],i=e[1],s=e[2];let r=n*n+i*i+s*s;return r>0&&(r=1/Math.sqrt(r)),t[0]=n*r,t[1]=i*r,t[2]=s*r,t};var Kl=Dw;const Uw=Om,Iw=ma,Nw=Xr,Fw=(t,e)=>{const n=Uw(Iw(),e),i=0+(n[0]{const s=[],r=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[2]-n[2],r[0]=s[0],r[1]=s[1]*Math.cos(i)-s[2]*Math.sin(i),r[2]=s[1]*Math.sin(i)+s[2]*Math.cos(i),t[0]=r[0]+n[0],t[1]=r[1]+n[1],t[2]=r[2]+n[2],t};var zw=Bw;const Vw=(t,e,n,i)=>{const s=[],r=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[2]-n[2],r[0]=s[2]*Math.sin(i)+s[0]*Math.cos(i),r[1]=s[1],r[2]=s[2]*Math.cos(i)-s[0]*Math.sin(i),t[0]=r[0]+n[0],t[1]=r[1]+n[1],t[2]=r[2]+n[2],t};var Hw=Vw;const Gw=(t,e,n,i)=>{const s=[],r=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],r[0]=s[0]*Math.cos(i)-s[1]*Math.sin(i),r[1]=s[0]*Math.sin(i)+s[1]*Math.cos(i),t[0]=r[0]+n[0],t[1]=r[1]+n[1],t[2]=e[2],t};var $w=Gw;const kw=(t,e,n)=>(t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t);var Gm=kw;const Ww=(t,e,n)=>(t[0]=Math.round(e[0]/n)*n+0,t[1]=Math.round(e[1]/n)*n+0,t[2]=Math.round(e[2]/n)*n+0,t);var Xw=Ww;const qw=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1],s=e[2]-t[2];return n*n+i*i+s*s};var $m=qw;const Yw=t=>{const e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i};var km=Yw;const jw=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t);var ga=jw;const Zw=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)}]`;var Kw=Zw;const Jw=(t,e,n)=>{const i=e[0],s=e[1],r=e[2];let o=n[3]*i+n[7]*s+n[11]*r+n[15];return o=o||1,t[0]=(n[0]*i+n[4]*s+n[8]*r+n[12])/o,t[1]=(n[1]*i+n[5]*s+n[9]*r+n[13])/o,t[2]=(n[2]*i+n[6]*s+n[10]*r+n[14])/o,t};var Qw=Jw,Ge={abs:Om,add:Bm,angle:nw,clone:ow,copy:zm,create:ma,cross:Xr,distance:Vm,divide:uw,dot:pa,equals:dw,fromScalar:mw,fromValues:vw,fromVec2:Mw,length:Hm,lerp:yw,max:Tw,min:Aw,multiply:Cw,negate:Lw,normalize:Kl,orthogonal:Ow,rotateX:zw,rotateY:Hw,rotateZ:$w,scale:Gm,snap:Xw,squaredDistance:$m,squaredLength:km,subtract:ga,toString:Kw,transform:Qw};const mi=Ge,eA=Fm,tA=(t,e,n)=>{const i=mi.normalize(mi.create(),e),s=mi.normalize(mi.create(),n),r=mi.cross(mi.create(),s,i),o=mi.dot(s,i);if(o===-1)return eA(t,Math.PI,mi.orthogonal(r,i));const a=1/(1+o);return t[0]=r[0]*r[0]*a+o,t[1]=r[1]*r[0]*a-r[2],t[2]=r[2]*r[0]*a+r[1],t[3]=0,t[4]=r[0]*r[1]*a+r[2],t[5]=r[1]*r[1]*a+o,t[6]=r[2]*r[1]*a-r[0],t[7]=0,t[8]=r[0]*r[2]*a-r[1],t[9]=r[1]*r[2]*a+r[0],t[10]=r[2]*r[2]*a+o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var nA=tA;const{sin:iA,cos:sA}=qt,rA=(t,e)=>{const n=iA(e),i=sA(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var oA=rA;const{sin:aA,cos:cA}=qt,lA=(t,e)=>{const n=aA(e),i=cA(e);return t[0]=i,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var fA=lA;const{sin:uA,cos:hA}=qt,dA=(t,e)=>{const n=uA(e),i=hA(e);return t[0]=i,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var pA=dA;const mA=t=>t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[7]===0&&t[8]===0&&t[9]===0&&t[10]===1&&t[11]===0&&t[12]===0&&t[13]===0&&t[14]===0&&t[15]===1;var gA=mA;const _A=t=>qn(t[1])&&qn(t[2])&&qn(t[3])&&qn(t[4])&&qn(t[6])&&qn(t[7])&&qn(t[8])&&qn(t[9])&&qn(t[11])&&t[15]===1,qn=t=>Math.abs(t){const e=t[4]*t[9]-t[8]*t[5],n=t[8]*t[1]-t[0]*t[9],i=t[0]*t[5]-t[4]*t[1];return e*t[2]+n*t[6]+i*t[10]<0};var MA=xA;const EA=(t,e)=>{const[n,i,s,r]=e;return t[0]=1-2*n*n,t[1]=-2*i*n,t[2]=-2*s*n,t[3]=0,t[4]=-2*n*i,t[5]=1-2*i*i,t[6]=-2*s*i,t[7]=0,t[8]=-2*n*s,t[9]=-2*i*s,t[10]=1-2*s*s,t[11]=0,t[12]=2*n*r,t[13]=2*i*r,t[14]=2*s*r,t[15]=1,t};var SA=EA;const yA=(t,e,n)=>{const i=e[0],s=e[1],r=e[2],o=e[3],a=e[4],c=e[5],l=e[6],f=e[7],u=e[8],h=e[9],d=e[10],_=e[11],g=e[12],m=e[13],p=e[14],y=e[15];let E=n[0],v=n[1],M=n[2],b=n[3];return t[0]=E*i+v*a+M*u+b*g,t[1]=E*s+v*c+M*h+b*m,t[2]=E*r+v*l+M*d+b*p,t[3]=E*o+v*f+M*_+b*y,E=n[4],v=n[5],M=n[6],b=n[7],t[4]=E*i+v*a+M*u+b*g,t[5]=E*s+v*c+M*h+b*m,t[6]=E*r+v*l+M*d+b*p,t[7]=E*o+v*f+M*_+b*y,E=n[8],v=n[9],M=n[10],b=n[11],t[8]=E*i+v*a+M*u+b*g,t[9]=E*s+v*c+M*h+b*m,t[10]=E*r+v*l+M*d+b*p,t[11]=E*o+v*f+M*_+b*y,E=n[12],v=n[13],M=n[14],b=n[15],t[12]=E*i+v*a+M*u+b*g,t[13]=E*s+v*c+M*h+b*m,t[14]=E*r+v*l+M*d+b*p,t[15]=E*o+v*f+M*_+b*y,t};var bA=yA;const{EPS:TA}=Qe,{sin:wA,cos:AA}=qt,RA=Im,CA=(t,e,n,i)=>{let[s,r,o]=i;const a=s*s+r*r+o*o;if(Math.abs(a){const i=LA(n),s=DA(n),r=e[4],o=e[5],a=e[6],c=e[7],l=e[8],f=e[9],u=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+l*i,t[5]=o*s+f*i,t[6]=a*s+u*i,t[7]=c*s+h*i,t[8]=l*s-r*i,t[9]=f*s-o*i,t[10]=u*s-a*i,t[11]=h*s-c*i,t};var IA=UA;const{sin:NA,cos:FA}=qt,OA=(t,e,n)=>{const i=NA(n),s=FA(n),r=e[0],o=e[1],a=e[2],c=e[3],l=e[8],f=e[9],u=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-l*i,t[1]=o*s-f*i,t[2]=a*s-u*i,t[3]=c*s-h*i,t[8]=r*i+l*s,t[9]=o*i+f*s,t[10]=a*i+u*s,t[11]=c*i+h*s,t};var BA=OA;const{sin:zA,cos:VA}=qt,HA=(t,e,n)=>{const i=zA(n),s=VA(n),r=e[0],o=e[1],a=e[2],c=e[3],l=e[4],f=e[5],u=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+l*i,t[1]=o*s+f*i,t[2]=a*s+u*i,t[3]=c*s+h*i,t[4]=l*s-r*i,t[5]=f*s-o*i,t[6]=u*s-a*i,t[7]=h*s-c*i,t};var GA=HA;const $A=(t,e,n)=>{const i=n[0],s=n[1],r=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t};var kA=$A;const WA=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t);var XA=WA;const qA=t=>t.map(e=>e.toFixed(7)).toString();var YA=qA;const jA=(t,e,n)=>{const i=n[0],s=n[1],r=n[2];let o,a,c,l,f,u,h,d,_,g,m,p;return e===t?(t[12]=e[0]*i+e[4]*s+e[8]*r+e[12],t[13]=e[1]*i+e[5]*s+e[9]*r+e[13],t[14]=e[2]*i+e[6]*s+e[10]*r+e[14],t[15]=e[3]*i+e[7]*s+e[11]*r+e[15]):(o=e[0],a=e[1],c=e[2],l=e[3],f=e[4],u=e[5],h=e[6],d=e[7],_=e[8],g=e[9],m=e[10],p=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=l,t[4]=f,t[5]=u,t[6]=h,t[7]=d,t[8]=_,t[9]=g,t[10]=m,t[11]=p,t[12]=o*i+f*s+_*r+e[12],t[13]=a*i+u*s+g*r+e[13],t[14]=c*i+h*s+m*r+e[14],t[15]=l*i+d*s+p*r+e[15]),t};var ZA=jA,ut={add:wT,clone:PT,copy:Im,create:Zl,invert:UT,equals:NT,fromRotation:Fm,fromScaling:$T,fromTaitBryanRotation:WT,fromTranslation:qT,fromValues:ZT,fromVectorRotation:nA,fromXRotation:oA,fromYRotation:fA,fromZRotation:pA,identity:Nm,isIdentity:gA,isOnlyTransformScale:vA,isMirroring:MA,mirrorByPlane:SA,multiply:bA,rotate:PA,rotateX:IA,rotateY:BA,rotateZ:GA,scale:kA,subtract:XA,toString:YA,translate:ZA};const KA=ut,JA=t=>(t===void 0&&(t=[]),{points:t,isClosed:!1,transforms:KA.create()});var _a=JA;const{EPS:dh}=Qe,ph=We,QA=Um,e2=_a,t2=(t,e)=>{const n={closed:!1};let{closed:i}=Object.assign({},n,t),s=e2();if(s.points=e.map(r=>ph.clone(r)),s.points.length>1){const r=s.points[0],o=s.points[s.points.length-1];ph.distance(r,o)(mh.isIdentity(t.transforms)||(t.points=t.points.map(e=>gh.transform(gh.create(),e,t.transforms)),t.transforms=mh.create()),t);var i2=n2;const s2=i2,r2=t=>s2(t).points;var Ys=r2;const{TAU:yo}=Qe,pt=We,o2=Jl,a2=Ys,c2=(t,e)=>{const n={radius:[0,0],xaxisrotation:0,clockwise:!1,large:!1,segments:16};let{endpoint:i,radius:s,xaxisrotation:r,clockwise:o,large:a,segments:c}=Object.assign({},n,t);if(!Array.isArray(i))throw new Error("endpoint must be an array of X and Y values");if(i.length<2)throw new Error("endpoint must contain X and Y values");if(i=pt.clone(i),!Array.isArray(s))throw new Error("radius must be an array of X and Y values");if(s.length<2)throw new Error("radius must contain X and Y values");if(c<4)throw new Error("segments must be four or more");const l=1e5;if(e.isClosed)throw new Error("the given path cannot be closed");const f=a2(e);if(f.length<1)throw new Error("the given path must contain one or more points (as the starting point for the arc)");let u=s[0],h=s[1];const d=f[f.length-1];u=Math.round(u*l)/l,h=Math.round(h*l)/l,i=pt.fromValues(Math.round(i[0]*l)/l,Math.round(i[1]*l)/l);const _=!o;let g=[];if(u===0||h===0)g.push(i);else{u=Math.abs(u),h=Math.abs(h);const p=r,y=Math.cos(p),E=Math.sin(p),v=pt.subtract(pt.create(),d,i);pt.scale(v,v,.5);const M=Math.round((y*v[0]+E*v[1])*l)/l,b=Math.round((-E*v[0]+y*v[1])*l)/l,w=pt.fromValues(M,b),D=w[0]*w[0]/(u*u)+w[1]*w[1]/(h*h);if(D>1){const k=Math.sqrt(D);u*=k,h*=k,u=Math.round(u*l)/l,h=Math.round(h*l)/l}let x=Math.sqrt((u*u*h*h-u*u*w[1]*w[1]-h*h*w[0]*w[0])/(u*u*w[1]*w[1]+h*h*w[0]*w[0]));_===a&&(x=-x);const T=pt.fromValues(u*w[1]/h,-h*w[0]/u);pt.scale(T,T,x);let I=pt.fromValues(y*T[0]-E*T[1],E*T[0]+y*T[1]);I=pt.add(I,I,pt.scale(pt.create(),pt.add(pt.create(),d,i),.5));const B=pt.fromValues((w[0]-T[0])/u,(w[1]-T[1])/h),U=pt.fromValues((-w[0]-T[0])/u,(-w[1]-T[1])/h),F=pt.angleRadians(B);let H=pt.angleRadians(U)-F;H=H%yo,!_&&H>0?H-=yo:_&&H<0&&(H+=yo);let $=Math.ceil(Math.abs(H)/yo*c)+1;$<1&&($=1);for(let k=1;k<$;k++){const le=F+k/$*H,ie=Math.cos(le),we=Math.sin(le),ce=pt.fromValues(y*u*ie-E*h*we,E*u*ie+y*h*we);pt.add(ce,ce,I),g.push(ce)}$&&g.push(t.endpoint)}return g=f.concat(g),o2({},g)};var l2=c2;const f2=Jl,u2=Ys,{equals:h2}=We,d2=(...t)=>{let e=!1,n=[];return t.forEach((i,s)=>{const r=u2(i).slice();if(n.length>0&&r.length>0&&h2(r[0],n[n.length-1])&&r.shift(),r.length>0&&e)throw new Error(`Cannot concatenate to a closed path; check the ${s}th path`);e=i.isClosed,n=n.concat(r)}),f2({closed:e},n)};var Wm=d2;const p2=Wm,m2=_a,g2=(t,e)=>p2(e,m2(t));var Xm=g2;const{TAU:_2}=Qe,en=We,v2=We,x2=Xm,M2=Ys,E2=(t,e)=>{const n={segments:16};let{controlPoints:i,segments:s}=Object.assign({},n,t);if(!Array.isArray(i))throw new Error("controlPoints must be an array of one or more points");if(i.length<1)throw new Error("controlPoints must be an array of one or more points");if(s<4)throw new Error("segments must be four or more");if(e.isClosed)throw new Error("the given geometry cannot be closed");const r=M2(e);if(r.length<1)throw new Error("the given path must contain one or more points (as the starting point for the bezier curve)");if(i=i.slice(),i[0]===null){if(i.length<2)throw new Error("a null control point must be passed with one more control points");let b=r[r.length-2];if("lastBezierControlPoint"in e&&(b=e.lastBezierControlPoint),!Array.isArray(b))throw new Error("the given path must contain TWO or more points if given a null control point");const w=en.scale(en.create(),r[r.length-1],2);en.subtract(w,w,b),i[0]=w}i.unshift(r[r.length-1]);const a=i.length-1,c=[];let l=1;for(let b=0;b<=a;++b)b>0&&(l*=b),c.push(l);const f=[];for(let b=0;b<=a;++b){const w=c[a]/(c[b]*c[a-b]);f.push(w)}const u=en.create(),h=en.create(),d=v2.create(),_=b=>{let w=1,D=Math.pow(1-b,a);const x=b!==1?1/(1-b):1,T=en.create();for(let I=0;I<=a;++I){I===a&&(D=1);const B=f[I]*w*D,U=en.scale(u,i[I],B);en.add(T,T,U),w*=b,D*=x}return T},g=[],m=[],p=a+1;for(let b=0;bv){const x=m[y-1],T=m[y+1],I=x+(T-x)*1/3,B=x+(T-x)*2/3,U=_(I),F=_(B);g.splice(y,1,U,F),m.splice(y,1,I,B),y--,y<1&&(y=1)}else++y}g.shift();const M=x2(g,e);return M.lastBezierControlPoint=i[i.length-2],M};var S2=E2;const y2=We,_h=Ys,b2=(t,e)=>{if(t.isClosed!==e.isClosed||t.points.length!==e.points.length)return!1;const n=_h(t),i=_h(e),s=n.length;let r=0;do{let o=!1;for(let a=0;a{if(t[0]!==2)throw new Error("invalid compact binary data");const e=R2();e.transforms=w2.clone(t.slice(1,17)),e.isClosed=!!t[17];for(let n=22;n=0&&(e.color=[t[18],t[19],t[20],t[21]]),e};var P2=C2;const L2=t=>!!(t&&typeof t=="object"&&"points"in t&&"transforms"in t&&"isClosed"in t&&Array.isArray(t.points)&&"length"in t.transforms);var qm=L2;const D2=jl,U2=t=>{const e=D2(t);return e.points=t.points.slice().reverse(),e};var I2=U2;const N2=We,F2=Ys,O2=t=>{const e=F2(t);let n="path ("+e.length+" points, "+t.isClosed+`): +}`;function Mb(t,e,n){let i=new ff;const s=new Ve,r=new Ve,o=new Tt,a=new gb({depthPacking:h1}),c=new _b,l={},f=n.maxTextureSize,u={[Pi]:Qt,[Qt]:Pi,[oi]:oi},h=new fs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ve},radius:{value:4}},vertexShader:vb,fragmentShader:xb}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const _=new fi;_.setAttribute("position",new un(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new ai(_,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Om;let p=this.type;this.render=function(M,b,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||M.length===0)return;const D=t.getRenderTarget(),v=t.getActiveCubeFace(),T=t.getActiveMipmapLevel(),N=t.state;N.setBlending(Ri),N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);const U=p!==ni&&this.type===ni,I=p===ni&&this.type!==ni;for(let F=0,B=M.length;Ff||s.y>f)&&(s.x>f&&(r.x=Math.floor(f/k.x),s.x=r.x*k.x,$.mapSize.x=r.x),s.y>f&&(r.y=Math.floor(f/k.y),s.y=r.y*k.y,$.mapSize.y=r.y)),$.map===null||U===!0||I===!0){const ie=this.type!==ni?{minFilter:$t,magFilter:$t}:{};$.map!==null&&$.map.dispose(),$.map=new ls(s.x,s.y,ie),$.map.texture.name=V.name+".shadowMap",$.camera.updateProjectionMatrix()}t.setRenderTarget($.map),t.clear();const le=$.getViewportCount();for(let ie=0;ie0||b.map&&b.alphaTest>0){const N=v.uuid,U=b.uuid;let I=l[N];I===void 0&&(I={},l[N]=I);let F=I[U];F===void 0&&(F=v.clone(),I[U]=F),v=F}if(v.visible=b.visible,v.wireframe=b.wireframe,D===ni?v.side=b.shadowSide!==null?b.shadowSide:b.side:v.side=b.shadowSide!==null?b.shadowSide:u[b.side],v.alphaMap=b.alphaMap,v.alphaTest=b.alphaTest,v.map=b.map,v.clipShadows=b.clipShadows,v.clippingPlanes=b.clippingPlanes,v.clipIntersection=b.clipIntersection,v.displacementMap=b.displacementMap,v.displacementScale=b.displacementScale,v.displacementBias=b.displacementBias,v.wireframeLinewidth=b.wireframeLinewidth,v.linewidth=b.linewidth,w.isPointLight===!0&&v.isMeshDistanceMaterial===!0){const N=t.properties.get(v);N.light=w}return v}function x(M,b,w,D,v){if(M.visible===!1)return;if(M.layers.test(b.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&v===ni)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,M.matrixWorld);const U=e.update(M),I=M.material;if(Array.isArray(I)){const F=U.groups;for(let B=0,V=F.length;B=1):k.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),V=$>=2);let le=null,ie={};const we=t.getParameter(t.SCISSOR_BOX),ce=t.getParameter(t.VIEWPORT),Y=new Tt().fromArray(we),re=new Tt().fromArray(ce);function me(O,K,he,ye){const Pe=new Uint8Array(4),et=t.createTexture();t.bindTexture(O,et),t.texParameteri(O,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(O,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let tt=0;tt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let g;const m=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(A,S){return p?new OffscreenCanvas(A,S):ua("canvas")}function E(A,S,z,q){let Z=1;if((A.width>q||A.height>q)&&(Z=q/Math.max(A.width,A.height)),Z<1||S===!0)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const fe=S?Xm:Math.floor,xe=fe(Z*A.width),Me=fe(Z*A.height);g===void 0&&(g=y(xe,Me));const j=z?y(xe,Me):g;return j.width=xe,j.height=Me,j.getContext("2d").drawImage(A,0,0,xe,Me),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+xe+"x"+Me+")."),j}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+A.width+"x"+A.height+")."),A;return A}function x(A){return Il(A.width)&&Il(A.height)}function M(A){return a?!1:A.wrapS!==An||A.wrapT!==An||A.minFilter!==$t&&A.minFilter!==mn}function b(A,S){return A.generateMipmaps&&S&&A.minFilter!==$t&&A.minFilter!==mn}function w(A){t.generateMipmap(A)}function D(A,S,z,q,Z=!1){if(a===!1)return S;if(A!==null){if(t[A]!==void 0)return t[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let fe=S;return S===t.RED&&(z===t.FLOAT&&(fe=t.R32F),z===t.HALF_FLOAT&&(fe=t.R16F),z===t.UNSIGNED_BYTE&&(fe=t.R8)),S===t.RG&&(z===t.FLOAT&&(fe=t.RG32F),z===t.HALF_FLOAT&&(fe=t.RG16F),z===t.UNSIGNED_BYTE&&(fe=t.RG8)),S===t.RGBA&&(z===t.FLOAT&&(fe=t.RGBA32F),z===t.HALF_FLOAT&&(fe=t.RGBA16F),z===t.UNSIGNED_BYTE&&(fe=q===Be&&Z===!1?t.SRGB8_ALPHA8:t.RGBA8),z===t.UNSIGNED_SHORT_4_4_4_4&&(fe=t.RGBA4),z===t.UNSIGNED_SHORT_5_5_5_1&&(fe=t.RGB5_A1)),(fe===t.R16F||fe===t.R32F||fe===t.RG16F||fe===t.RG32F||fe===t.RGBA16F||fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function v(A,S,z){return b(A,z)===!0||A.isFramebufferTexture&&A.minFilter!==$t&&A.minFilter!==mn?Math.log2(Math.max(S.width,S.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?S.mipmaps.length:1}function T(A){return A===$t||A===Mu||A===lc?t.NEAREST:t.LINEAR}function N(A){const S=A.target;S.removeEventListener("dispose",N),I(S),S.isVideoTexture&&_.delete(S)}function U(A){const S=A.target;S.removeEventListener("dispose",U),B(S)}function I(A){const S=i.get(A);if(S.__webglInit===void 0)return;const z=A.source,q=m.get(z);if(q){const Z=q[S.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&F(A),Object.keys(q).length===0&&m.delete(z)}i.remove(A)}function F(A){const S=i.get(A);t.deleteTexture(S.__webglTexture);const z=A.source,q=m.get(z);delete q[S.__cacheKey],o.memory.textures--}function B(A){const S=A.texture,z=i.get(A),q=i.get(S);if(q.__webglTexture!==void 0&&(t.deleteTexture(q.__webglTexture),o.memory.textures--),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++)t.deleteFramebuffer(z.__webglFramebuffer[Z]),z.__webglDepthbuffer&&t.deleteRenderbuffer(z.__webglDepthbuffer[Z]);else{if(t.deleteFramebuffer(z.__webglFramebuffer),z.__webglDepthbuffer&&t.deleteRenderbuffer(z.__webglDepthbuffer),z.__webglMultisampledFramebuffer&&t.deleteFramebuffer(z.__webglMultisampledFramebuffer),z.__webglColorRenderbuffer)for(let Z=0;Z=c&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+c),V+=1,A}function le(A){const S=[];return S.push(A.wrapS),S.push(A.wrapT),S.push(A.wrapR||0),S.push(A.magFilter),S.push(A.minFilter),S.push(A.anisotropy),S.push(A.internalFormat),S.push(A.format),S.push(A.type),S.push(A.generateMipmaps),S.push(A.premultiplyAlpha),S.push(A.flipY),S.push(A.unpackAlignment),S.push(A.colorSpace),S.join()}function ie(A,S){const z=i.get(A);if(A.isVideoTexture&&ae(A),A.isRenderTargetTexture===!1&&A.version>0&&z.__version!==A.version){const q=A.image;if(q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{de(z,A,S);return}}n.bindTexture(t.TEXTURE_2D,z.__webglTexture,t.TEXTURE0+S)}function we(A,S){const z=i.get(A);if(A.version>0&&z.__version!==A.version){de(z,A,S);return}n.bindTexture(t.TEXTURE_2D_ARRAY,z.__webglTexture,t.TEXTURE0+S)}function ce(A,S){const z=i.get(A);if(A.version>0&&z.__version!==A.version){de(z,A,S);return}n.bindTexture(t.TEXTURE_3D,z.__webglTexture,t.TEXTURE0+S)}function Y(A,S){const z=i.get(A);if(A.version>0&&z.__version!==A.version){Se(z,A,S);return}n.bindTexture(t.TEXTURE_CUBE_MAP,z.__webglTexture,t.TEXTURE0+S)}const re={[Ll]:t.REPEAT,[An]:t.CLAMP_TO_EDGE,[Dl]:t.MIRRORED_REPEAT},me={[$t]:t.NEAREST,[Mu]:t.NEAREST_MIPMAP_NEAREST,[lc]:t.NEAREST_MIPMAP_LINEAR,[mn]:t.LINEAR,[Yx]:t.LINEAR_MIPMAP_NEAREST,[Yr]:t.LINEAR_MIPMAP_LINEAR};function ve(A,S,z){if(z?(t.texParameteri(A,t.TEXTURE_WRAP_S,re[S.wrapS]),t.texParameteri(A,t.TEXTURE_WRAP_T,re[S.wrapT]),(A===t.TEXTURE_3D||A===t.TEXTURE_2D_ARRAY)&&t.texParameteri(A,t.TEXTURE_WRAP_R,re[S.wrapR]),t.texParameteri(A,t.TEXTURE_MAG_FILTER,me[S.magFilter]),t.texParameteri(A,t.TEXTURE_MIN_FILTER,me[S.minFilter])):(t.texParameteri(A,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(A,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(A===t.TEXTURE_3D||A===t.TEXTURE_2D_ARRAY)&&t.texParameteri(A,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(S.wrapS!==An||S.wrapT!==An)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(A,t.TEXTURE_MAG_FILTER,T(S.magFilter)),t.texParameteri(A,t.TEXTURE_MIN_FILTER,T(S.minFilter)),S.minFilter!==$t&&S.minFilter!==mn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const q=e.get("EXT_texture_filter_anisotropic");if(S.magFilter===$t||S.minFilter!==lc&&S.minFilter!==Yr||S.type===ns&&e.has("OES_texture_float_linear")===!1||a===!1&&S.type===Zr&&e.has("OES_texture_half_float_linear")===!1)return;(S.anisotropy>1||i.get(S).__currentAnisotropy)&&(t.texParameterf(A,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,s.getMaxAnisotropy())),i.get(S).__currentAnisotropy=S.anisotropy)}}function R(A,S){let z=!1;A.__webglInit===void 0&&(A.__webglInit=!0,S.addEventListener("dispose",N));const q=S.source;let Z=m.get(q);Z===void 0&&(Z={},m.set(q,Z));const fe=le(S);if(fe!==A.__cacheKey){Z[fe]===void 0&&(Z[fe]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,z=!0),Z[fe].usedTimes++;const xe=Z[A.__cacheKey];xe!==void 0&&(Z[A.__cacheKey].usedTimes--,xe.usedTimes===0&&F(S)),A.__cacheKey=fe,A.__webglTexture=Z[fe].texture}return z}function de(A,S,z){let q=t.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(q=t.TEXTURE_2D_ARRAY),S.isData3DTexture&&(q=t.TEXTURE_3D);const Z=R(A,S),fe=S.source;n.bindTexture(q,A.__webglTexture,t.TEXTURE0+z);const xe=i.get(fe);if(fe.version!==xe.__version||Z===!0){n.activeTexture(t.TEXTURE0+z),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,S.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,S.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const Me=M(S)&&x(S.image)===!1;let j=E(S.image,Me,!1,f);j=oe(S,j);const be=x(j)||a,Ae=r.convert(S.format,S.colorSpace);let Le=r.convert(S.type),Te=D(S.internalFormat,Ae,Le,S.colorSpace);ve(q,S,be);let Ee;const Ne=S.mipmaps,Ye=a&&S.isVideoTexture!==!0,lt=xe.__version===void 0||Z===!0,O=v(S,j,be);if(S.isDepthTexture)Te=t.DEPTH_COMPONENT,a?S.type===ns?Te=t.DEPTH_COMPONENT32F:S.type===ts?Te=t.DEPTH_COMPONENT24:S.type===qs?Te=t.DEPTH24_STENCIL8:Te=t.DEPTH_COMPONENT16:S.type===ns&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),S.format===rs&&Te===t.DEPTH_COMPONENT&&S.type!==Gm&&S.type!==ts&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),S.type=ts,Le=r.convert(S.type)),S.format===Js&&Te===t.DEPTH_COMPONENT&&(Te=t.DEPTH_STENCIL,S.type!==qs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),S.type=qs,Le=r.convert(S.type))),lt&&(Ye?n.texStorage2D(t.TEXTURE_2D,1,Te,j.width,j.height):n.texImage2D(t.TEXTURE_2D,0,Te,j.width,j.height,0,Ae,Le,null));else if(S.isDataTexture)if(Ne.length>0&&be){Ye&<&&n.texStorage2D(t.TEXTURE_2D,O,Te,Ne[0].width,Ne[0].height);for(let K=0,he=Ne.length;K>=1,he>>=1}}else if(Ne.length>0&&be){Ye&<&&n.texStorage2D(t.TEXTURE_2D,O,Te,Ne[0].width,Ne[0].height);for(let K=0,he=Ne.length;K0&<++,n.texStorage2D(t.TEXTURE_CUBE_MAP,lt,Ee,j[0].width,j[0].height));for(let K=0;K<6;K++)if(Me){Ne?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,j[K].width,j[K].height,Le,Te,j[K].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,Ee,j[K].width,j[K].height,0,Le,Te,j[K].data);for(let he=0;he=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,q,Z,i.get(z).__webglTexture,0),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ce(A,S,z){if(t.bindRenderbuffer(t.RENDERBUFFER,A),S.depthBuffer&&!S.stencilBuffer){let q=t.DEPTH_COMPONENT16;if(z||se(S)){const Z=S.depthTexture;Z&&Z.isDepthTexture&&(Z.type===ns?q=t.DEPTH_COMPONENT32F:Z.type===ts&&(q=t.DEPTH_COMPONENT24));const fe=pe(S);se(S)?h.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,fe,q,S.width,S.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,fe,q,S.width,S.height)}else t.renderbufferStorage(t.RENDERBUFFER,q,S.width,S.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,A)}else if(S.depthBuffer&&S.stencilBuffer){const q=pe(S);z&&se(S)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,q,t.DEPTH24_STENCIL8,S.width,S.height):se(S)?h.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,q,t.DEPTH24_STENCIL8,S.width,S.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,S.width,S.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,A)}else{const q=S.isWebGLMultipleRenderTargets===!0?S.texture:[S.texture];for(let Z=0;Z0&&se(A)===!1){const Me=fe?S:[S];z.__webglMultisampledFramebuffer=t.createFramebuffer(),z.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let j=0;j0&&se(A)===!1){const S=A.isWebGLMultipleRenderTargets?A.texture:[A.texture],z=A.width,q=A.height;let Z=t.COLOR_BUFFER_BIT;const fe=[],xe=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Me=i.get(A),j=A.isWebGLMultipleRenderTargets===!0;if(j)for(let be=0;be0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function ae(A){const S=o.render.frame;_.get(A)!==S&&(_.set(A,S),A.update())}function oe(A,S){const z=A.colorSpace,q=A.format,Z=A.type;return A.isCompressedTexture===!0||A.format===Ul||z!==Gn&&z!==as&&(z===Be?a===!1?e.has("EXT_sRGB")===!0&&q===Rn?(A.format=Ul,A.minFilter=mn,A.generateMipmaps=!1):S=jm.sRGBToLinear(S):(q!==Rn||Z!==cs)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),S}this.allocateTextureUnit=k,this.resetTextureUnits=$,this.setTexture2D=ie,this.setTexture2DArray=we,this.setTexture3D=ce,this.setTextureCube=Y,this.rebindTextures=H,this.setupRenderTarget=ne,this.updateRenderTargetMipmap=Q,this.updateMultisampleRenderTarget=te,this.setupDepthRenderbuffer=L,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=se}function yb(t,e,n){const i=n.isWebGL2;function s(r,o=as){let a;if(r===cs)return t.UNSIGNED_BYTE;if(r===Qx)return t.UNSIGNED_SHORT_4_4_4_4;if(r===e1)return t.UNSIGNED_SHORT_5_5_5_1;if(r===Zx)return t.BYTE;if(r===Kx)return t.SHORT;if(r===Gm)return t.UNSIGNED_SHORT;if(r===Jx)return t.INT;if(r===ts)return t.UNSIGNED_INT;if(r===ns)return t.FLOAT;if(r===Zr)return i?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===t1)return t.ALPHA;if(r===Rn)return t.RGBA;if(r===n1)return t.LUMINANCE;if(r===i1)return t.LUMINANCE_ALPHA;if(r===rs)return t.DEPTH_COMPONENT;if(r===Js)return t.DEPTH_STENCIL;if(r===Ul)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===s1)return t.RED;if(r===r1)return t.RED_INTEGER;if(r===o1)return t.RG;if(r===a1)return t.RG_INTEGER;if(r===c1)return t.RGBA_INTEGER;if(r===fc||r===uc||r===hc||r===dc)if(o===Be)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===fc)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===uc)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===hc)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===dc)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===fc)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===uc)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===hc)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===dc)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Eu||r===Su||r===yu||r===bu)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===Eu)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Su)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===yu)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===bu)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===l1)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===Tu||r===wu)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===Tu)return o===Be?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===wu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Au||r===Ru||r===Cu||r===Pu||r===Lu||r===Du||r===Uu||r===Iu||r===Nu||r===Fu||r===Ou||r===Bu||r===zu||r===Hu)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===Au)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Ru)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Cu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Pu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Lu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Du)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Uu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Iu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===Nu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===Fu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Ou)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Bu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===zu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Hu)return o===Be?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===pc)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===pc)return o===Be?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===f1||r===Vu||r===Gu||r===$u)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===pc)return a.COMPRESSED_RED_RGTC1_EXT;if(r===Vu)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===Gu)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===$u)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===qs?i?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):t[r]!==void 0?t[r]:null}return{convert:s}}class bb extends gn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class No extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Tb={type:"move"};class Fc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new No,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 No,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new W,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new W),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new No,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new W,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new W),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 n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}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,n,i){let s=null,r=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const g of e.hand.values()){const m=n.getJointPose(g,i),p=this._getHandJoint(l,g);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const f=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],h=f.position.distanceTo(u.position),d=.02,_=.005;l.inputState.pinching&&h>d+_?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&h<=d-_&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=n.getPose(e.gripSpace,i),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(s=n.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Tb)))}return a!==null&&(a.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new No;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class wb extends fn{constructor(e,n,i,s,r,o,a,c,l,f){if(f=f!==void 0?f:rs,f!==rs&&f!==Js)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&f===rs&&(i=ts),i===void 0&&f===Js&&(i=qs),super(null,s,r,o,a,c,f,i,l),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=a!==void 0?a:$t,this.minFilter=c!==void 0?c:$t,this.flipY=!1,this.generateMipmaps=!1}}class Ab extends hs{constructor(e,n){super();const i=this;let s=null,r=1,o=null,a="local-floor",c=1,l=null,f=null,u=null,h=null,d=null,_=null;const g=n.getContextAttributes();let m=null,p=null;const y=[],E=[],x=new Set,M=new Map,b=new gn;b.layers.enable(1),b.viewport=new Tt;const w=new gn;w.layers.enable(2),w.viewport=new Tt;const D=[b,w],v=new bb;v.layers.enable(1),v.layers.enable(2);let T=null,N=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let re=y[Y];return re===void 0&&(re=new Fc,y[Y]=re),re.getTargetRaySpace()},this.getControllerGrip=function(Y){let re=y[Y];return re===void 0&&(re=new Fc,y[Y]=re),re.getGripSpace()},this.getHand=function(Y){let re=y[Y];return re===void 0&&(re=new Fc,y[Y]=re),re.getHandSpace()};function U(Y){const re=E.indexOf(Y.inputSource);if(re===-1)return;const me=y[re];me!==void 0&&(me.update(Y.inputSource,Y.frame,l||o),me.dispatchEvent({type:Y.type,data:Y.inputSource}))}function I(){s.removeEventListener("select",U),s.removeEventListener("selectstart",U),s.removeEventListener("selectend",U),s.removeEventListener("squeeze",U),s.removeEventListener("squeezestart",U),s.removeEventListener("squeezeend",U),s.removeEventListener("end",I),s.removeEventListener("inputsourceschange",F);for(let Y=0;Y=0&&(E[ve]=null,y[ve].disconnect(me))}for(let re=0;re=E.length){E.push(me),ve=de;break}else if(E[de]===null){E[de]=me,ve=de;break}if(ve===-1)break}const R=y[ve];R&&R.connect(me)}}const B=new W,V=new W;function $(Y,re,me){B.setFromMatrixPosition(re.matrixWorld),V.setFromMatrixPosition(me.matrixWorld);const ve=B.distanceTo(V),R=re.projectionMatrix.elements,de=me.projectionMatrix.elements,Se=R[14]/(R[10]-1),ue=R[14]/(R[10]+1),Ce=(R[9]+1)/R[5],P=(R[9]-1)/R[5],L=(R[8]-1)/R[0],H=(de[8]+1)/de[0],ne=Se*L,Q=Se*H,te=ve/(-L+H),pe=te*-L;re.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(pe),Y.translateZ(te),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert();const se=Se+te,ae=ue+te,oe=ne-pe,A=Q+(ve-pe),S=Ce*ue/ae*se,z=P*ue/ae*se;Y.projectionMatrix.makePerspective(oe,A,S,z,se,ae),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}function k(Y,re){re===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(re.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(s===null)return;v.near=w.near=b.near=Y.near,v.far=w.far=b.far=Y.far,(T!==v.near||N!==v.far)&&(s.updateRenderState({depthNear:v.near,depthFar:v.far}),T=v.near,N=v.far);const re=Y.parent,me=v.cameras;k(v,re);for(let ve=0;veR&&(M.set(ve,ve.lastChangedTime),i.dispatchEvent({type:"planechanged",data:ve}))}}_=null}const ce=new rg;ce.setAnimationLoop(we),this.setAnimationLoop=function(Y){ie=Y},this.dispose=function(){}}}function Rb(t,e){function n(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function i(m,p){p.color.getRGB(m.fogColor.value,ng(t)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function s(m,p,y,E,x){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(m,p):p.isMeshToonMaterial?(r(m,p),u(m,p)):p.isMeshPhongMaterial?(r(m,p),f(m,p)):p.isMeshStandardMaterial?(r(m,p),h(m,p),p.isMeshPhysicalMaterial&&d(m,p,x)):p.isMeshMatcapMaterial?(r(m,p),_(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),g(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?c(m,p,y,E):p.isSpriteMaterial?l(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,n(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,n(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,n(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Qt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,n(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Qt&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,n(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,n(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,n(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const y=e.get(p).envMap;if(y&&(m.envMap.value=y,m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap){m.lightMap.value=p.lightMap;const E=t.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=p.lightMapIntensity*E,n(p.lightMap,m.lightMapTransform)}p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,n(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,n(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function c(m,p,y,E){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*y,m.scale.value=E*.5,p.map&&(m.map.value=p.map,n(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function l(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,n(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function f(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function h(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,m.roughnessMapTransform)),e.get(p).envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,y){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,n(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,n(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,n(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,n(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,n(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Qt&&m.clearcoatNormalScale.value.negate())),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,n(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,n(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,n(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,n(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,n(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,n(p.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,p){p.matcap&&(m.matcap.value=p.matcap)}function g(m,p){const y=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function Cb(t,e,n,i){let s={},r={},o=[];const a=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(y,E){const x=E.program;i.uniformBlockBinding(y,x)}function l(y,E){let x=s[y.id];x===void 0&&(_(y),x=f(y),s[y.id]=x,y.addEventListener("dispose",m));const M=E.program;i.updateUBOMapping(y,M);const b=e.render.frame;r[y.id]!==b&&(h(y),r[y.id]=b)}function f(y){const E=u();y.__bindingPointIndex=E;const x=t.createBuffer(),M=y.__size,b=y.usage;return t.bindBuffer(t.UNIFORM_BUFFER,x),t.bufferData(t.UNIFORM_BUFFER,M,b),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,E,x),x}function u(){for(let y=0;y0){b=x%M;const U=M-b;b!==0&&U-T.boundary<0&&(x+=M-b,v.__offset=x)}x+=T.storage}return b=x%M,b>0&&(x+=M-b),y.__size=x,y.__cache={},this}function g(y){const E={boundary:0,storage:0};return typeof y=="number"?(E.boundary=4,E.storage=4):y.isVector2?(E.boundary=8,E.storage=8):y.isVector3||y.isColor?(E.boundary=16,E.storage=12):y.isVector4?(E.boundary=16,E.storage=16):y.isMatrix3?(E.boundary=48,E.storage=48):y.isMatrix4?(E.boundary=64,E.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),E}function m(y){const E=y.target;E.removeEventListener("dispose",m);const x=o.indexOf(E.__bindingPointIndex);o.splice(x,1),t.deleteBuffer(s[E.id]),delete s[E.id],delete r[E.id]}function p(){for(const y in s)t.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:c,update:l,dispose:p}}function Pb(){const t=ua("canvas");return t.style.display="block",t}class ug{constructor(e={}){const{canvas:n=Pb(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let h;i!==null?h=i.getContextAttributes().alpha:h=o;let d=null,_=null;const g=[],m=[];this.domElement=n,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.outputColorSpace=Be,this.useLegacyLights=!0,this.toneMapping=ci,this.toneMappingExposure=1;const p=this;let y=!1,E=0,x=0,M=null,b=-1,w=null;const D=new Tt,v=new Tt;let T=null,N=n.width,U=n.height,I=1,F=null,B=null;const V=new Tt(0,0,N,U),$=new Tt(0,0,N,U);let k=!1;const le=new ff;let ie=!1,we=!1,ce=null;const Y=new vt,re=new W,me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ve(){return M===null?I:1}let R=i;function de(C,X){for(let J=0;J0?_=m[m.length-1]:_=null,g.pop(),g.length>0?d=g[g.length-1]:d=null};function Lt(C,X,J,G){if(C.visible===!1)return;if(C.layers.test(X.layers)){if(C.isGroup)J=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(X);else if(C.isLight)_.pushLight(C),C.castShadow&&_.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||le.intersectsSprite(C)){G&&re.setFromMatrixPosition(C.matrixWorld).applyMatrix4(Y);const Ue=se.update(C),Fe=C.material;Fe.visible&&d.push(C,Ue,Fe,J,re.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||le.intersectsObject(C))){C.isSkinnedMesh&&C.skeleton.frame!==P.render.frame&&(C.skeleton.update(),C.skeleton.frame=P.render.frame);const Ue=se.update(C),Fe=C.material;if(G&&(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),re.copy(Ue.boundingSphere.center).applyMatrix4(C.matrixWorld).applyMatrix4(Y)),Array.isArray(Fe)){const ze=Ue.groups;for(let $e=0,ke=ze.length;$e0&&ft(ee,De,X,J),G&&Ce.viewport(D.copy(G)),ee.length>0&&hn(ee,X,J),De.length>0&&hn(De,X,J),Ue.length>0&&hn(Ue,X,J),Ce.buffers.depth.setTest(!0),Ce.buffers.depth.setMask(!0),Ce.buffers.color.setMask(!0),Ce.setPolygonOffset(!1)}function ft(C,X,J,G){if(ce===null){const Fe=ue.isWebGL2;ce=new ls(1024,1024,{generateMipmaps:!0,type:Se.has("EXT_color_buffer_half_float")?Zr:cs,minFilter:Yr,samples:Fe&&a===!0?4:0})}const ee=p.getRenderTarget();p.setRenderTarget(ce),p.clear();const De=p.toneMapping;p.toneMapping=ci,hn(C,J,G),H.updateMultisampleRenderTarget(ce),H.updateRenderTargetMipmap(ce);let Ue=!1;for(let Fe=0,ze=X.length;Fe0&&H.useMultisampledRTT(C)===!1?ee=L.get(C).__webglMultisampledFramebuffer:ee=ke,D.copy(C.viewport),v.copy(C.scissor),T=C.scissorTest}else D.copy(V).multiplyScalar(I).floor(),v.copy($).multiplyScalar(I).floor(),T=k;if(Ce.bindFramebuffer(R.FRAMEBUFFER,ee)&&ue.drawBuffers&&G&&Ce.drawBuffers(C,ee),Ce.viewport(D),Ce.scissor(v),Ce.setScissorTest(T),De){const ze=L.get(C.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+X,ze.__webglTexture,J)}else if(Ue){const ze=L.get(C.texture),$e=X||0;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,ze.__webglTexture,J||0,$e)}b=-1},this.readRenderTargetPixels=function(C,X,J,G,ee,De,Ue){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=L.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ue!==void 0&&(Fe=Fe[Ue]),Fe){Ce.bindFramebuffer(R.FRAMEBUFFER,Fe);try{const ze=C.texture,$e=ze.format,ke=ze.type;if($e!==Rn&&j.convert($e)!==R.getParameter(R.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Xe=ke===Zr&&(Se.has("EXT_color_buffer_half_float")||ue.isWebGL2&&Se.has("EXT_color_buffer_float"));if(ke!==cs&&j.convert(ke)!==R.getParameter(R.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ke===ns&&(ue.isWebGL2||Se.has("OES_texture_float")||Se.has("WEBGL_color_buffer_float")))&&!Xe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=C.width-G&&J>=0&&J<=C.height-ee&&R.readPixels(X,J,G,ee,j.convert($e),j.convert(ke),De)}finally{const ze=M!==null?L.get(M).__webglFramebuffer:null;Ce.bindFramebuffer(R.FRAMEBUFFER,ze)}}},this.copyFramebufferToTexture=function(C,X,J=0){const G=Math.pow(2,-J),ee=Math.floor(X.image.width*G),De=Math.floor(X.image.height*G);H.setTexture2D(X,0),R.copyTexSubImage2D(R.TEXTURE_2D,J,0,0,C.x,C.y,ee,De),Ce.unbindTexture()},this.copyTextureToTexture=function(C,X,J,G=0){const ee=X.image.width,De=X.image.height,Ue=j.convert(J.format),Fe=j.convert(J.type);H.setTexture2D(J,0),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,J.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,J.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,J.unpackAlignment),X.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,G,C.x,C.y,ee,De,Ue,Fe,X.image.data):X.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,G,C.x,C.y,X.mipmaps[0].width,X.mipmaps[0].height,Ue,X.mipmaps[0].data):R.texSubImage2D(R.TEXTURE_2D,G,C.x,C.y,Ue,Fe,X.image),G===0&&J.generateMipmaps&&R.generateMipmap(R.TEXTURE_2D),Ce.unbindTexture()},this.copyTextureToTexture3D=function(C,X,J,G,ee=0){if(p.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const De=C.max.x-C.min.x+1,Ue=C.max.y-C.min.y+1,Fe=C.max.z-C.min.z+1,ze=j.convert(G.format),$e=j.convert(G.type);let ke;if(G.isData3DTexture)H.setTexture3D(G,0),ke=R.TEXTURE_3D;else if(G.isDataArrayTexture)H.setTexture2DArray(G,0),ke=R.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,G.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,G.unpackAlignment);const Xe=R.getParameter(R.UNPACK_ROW_LENGTH),Je=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Ft=R.getParameter(R.UNPACK_SKIP_PIXELS),xn=R.getParameter(R.UNPACK_SKIP_ROWS),Ii=R.getParameter(R.UNPACK_SKIP_IMAGES),pt=J.isCompressedTexture?J.mipmaps[0]:J.image;R.pixelStorei(R.UNPACK_ROW_LENGTH,pt.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,pt.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,C.min.x),R.pixelStorei(R.UNPACK_SKIP_ROWS,C.min.y),R.pixelStorei(R.UNPACK_SKIP_IMAGES,C.min.z),J.isDataTexture||J.isData3DTexture?R.texSubImage3D(ke,ee,X.x,X.y,X.z,De,Ue,Fe,ze,$e,pt.data):J.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),R.compressedTexSubImage3D(ke,ee,X.x,X.y,X.z,De,Ue,Fe,ze,pt.data)):R.texSubImage3D(ke,ee,X.x,X.y,X.z,De,Ue,Fe,ze,$e,pt),R.pixelStorei(R.UNPACK_ROW_LENGTH,Xe),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,Je),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Ft),R.pixelStorei(R.UNPACK_SKIP_ROWS,xn),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Ii),ee===0&&G.generateMipmaps&&R.generateMipmap(ke),Ce.unbindTexture()},this.initTexture=function(C){C.isCubeTexture?H.setTextureCube(C,0):C.isData3DTexture?H.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?H.setTexture2DArray(C,0):H.setTexture2D(C,0),Ce.unbindTexture()},this.resetState=function(){E=0,x=0,M=null,Ce.reset(),be.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Be?os:$m}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===os?Be:Gn}}class Lb extends ug{}Lb.prototype.isWebGL1Renderer=!0;class Db extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),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,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Ub extends io{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",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=km,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,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.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}}const Lh={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Ib{constructor(e,n,i){const s=this;let r=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=i,this.itemStart=function(f){a++,r===!1&&s.onStart!==void 0&&s.onStart(f,o,a),r=!0},this.itemEnd=function(f){o++,s.onProgress!==void 0&&s.onProgress(f,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(f){s.onError!==void 0&&s.onError(f)},this.resolveURL=function(f){return c?c(f):f},this.setURLModifier=function(f){return c=f,this},this.addHandler=function(f,u){return l.push(f,u),this},this.removeHandler=function(f){const u=l.indexOf(f);return u!==-1&&l.splice(u,2),this},this.getHandler=function(f){for(let u=0,h=l.length;u{n&&n(r),this.manager.itemEnd(e)},0),r;if(Kn[e]!==void 0){Kn[e].push({onLoad:n,onProgress:i,onError:s});return}Kn[e]=[],Kn[e].push({onLoad:n,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const f=Kn[e],u=l.body.getReader(),h=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),d=h?parseInt(h):0,_=d!==0;let g=0;const m=new ReadableStream({start(p){y();function y(){u.read().then(({done:E,value:x})=>{if(E)p.close();else{g+=x.byteLength;const M=new ProgressEvent("progress",{lengthComputable:_,loaded:g,total:d});for(let b=0,w=f.length;b{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(f=>new DOMParser().parseFromString(f,a));case"json":return l.json();default:if(a===void 0)return l.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),h=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(h);return l.arrayBuffer().then(_=>d.decode(_))}}}).then(l=>{Lh.add(e,l);const f=Kn[e];delete Kn[e];for(let u=0,h=f.length;u{const f=Kn[e];if(f===void 0)throw this.manager.itemError(e),l;delete Kn[e];for(let u=0,h=f.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class dg extends Nt{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new st(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),n}}const Oc=new vt,Dh=new W,Uh=new W;class Bb{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ve(512,512),this.map=null,this.mapPass=null,this.matrix=new vt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ff,this._frameExtents=new Ve(1,1),this._viewportCount=1,this._viewports=[new Tt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;Dh.setFromMatrixPosition(e.matrixWorld),n.position.copy(Dh),Uh.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(Uh),n.updateMatrixWorld(),Oc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Oc),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Oc)}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.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return 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 zb extends Bb{constructor(){super(new og(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Hb extends dg{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.shadow=new zb}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Vb extends dg{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:af}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=af);class Ih extends hg{constructor(e){super(e)}load(e,n,i,s){const r=this,o=new Ob(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(r.parse(a))}catch(c){s?s(c):console.error(c),r.manager.itemError(e)}},i,s)}parse(e){function n(l){const f=new DataView(l),u=32/8*3+32/8*3*3+16/8,h=f.getUint32(80,!0);if(80+32/8+h*u===f.byteLength)return!0;const _=[115,111,108,105,100];for(let g=0;g<5;g++)if(i(_,f,g))return!1;return!0}function i(l,f,u){for(let h=0,d=l.length;h>5&31)/31,_=(B>>10&31)/31)}for(let B=1;B<=3;B++){const V=N+B*12,$=T*3*3+(B-1)*3;D[$]=f.getFloat32(V,!0),D[$+1]=f.getFloat32(V+4,!0),D[$+2]=f.getFloat32(V+8,!0),v[$]=U,v[$+1]=I,v[$+2]=F,g&&(m[$]=h,m[$+1]=d,m[$+2]=_)}}return w.setAttribute("position",new un(D,3)),w.setAttribute("normal",new un(v,3)),g&&(w.setAttribute("color",new un(m,3)),w.hasColors=!0,w.alpha=x),w}function r(l){const f=new fi,u=/solid([\s\S]*?)endsolid/g,h=/facet([\s\S]*?)endfacet/g;let d=0;const _=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,g=new RegExp("vertex"+_+_+_,"g"),m=new RegExp("normal"+_+_+_,"g"),p=[],y=[],E=new W;let x,M=0,b=0,w=0;for(;(x=u.exec(l))!==null;){b=w;const D=x[0];for(;(x=h.exec(D))!==null;){let N=0,U=0;const I=x[0];for(;(x=m.exec(I))!==null;)E.x=parseFloat(x[1]),E.y=parseFloat(x[2]),E.z=parseFloat(x[3]),U++;for(;(x=g.exec(I))!==null;)p.push(parseFloat(x[1]),parseFloat(x[2]),parseFloat(x[3])),y.push(E.x,E.y,E.z),N++,w++;U!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+d),N!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+d),d++}const v=b,T=w-b;f.addGroup(v,T,M),M++}return f.setAttribute("position",new li(p,3)),f.setAttribute("normal",new li(y,3)),f}function o(l){return typeof l!="string"?new TextDecoder().decode(l):l}function a(l){if(typeof l=="string"){const f=new Uint8Array(l.length);for(let u=0;u0&&(i.object.isPerspectiveCamera?d.multiplyScalar(R):i.object.isOrthographicCamera?(i.object.zoom=qu.clamp(i.object.zoom/R,i.minZoom,i.maxZoom),a!==i.object.zoom&&i.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),i.staticMoving?p.copy(y):p.y+=(y.y-p.y)*this.dynamicDampingFactor)},this.panCamera=function(){const R=new Ve,de=new W,Se=new W;return function(){if(R.copy(x).sub(E),R.lengthSq()){if(i.object.isOrthographicCamera){const Ce=(i.object.right-i.object.left)/i.object.zoom/i.domElement.clientWidth,P=(i.object.top-i.object.bottom)/i.object.zoom/i.domElement.clientWidth;R.x*=Ce,R.y*=P}R.multiplyScalar(d.length()*i.panSpeed),Se.copy(d).cross(i.object.up).setLength(R.x),Se.add(de.copy(i.object.up).setLength(R.y)),i.object.position.add(Se),i.target.add(Se),i.staticMoving?E.copy(x):E.add(R.subVectors(x,E).multiplyScalar(i.dynamicDampingFactor))}}}(),this.checkDistances=function(){(!i.noZoom||!i.noPan)&&(d.lengthSq()>i.maxDistance*i.maxDistance&&(i.object.position.addVectors(i.target,d.setLength(i.maxDistance)),p.copy(y)),d.lengthSq()r&&(i.dispatchEvent(Bc),o.copy(i.object.position))):i.object.isOrthographicCamera?(i.object.lookAt(i.target),(o.distanceToSquared(i.object.position)>r||a!==i.object.zoom)&&(i.dispatchEvent(Bc),o.copy(i.object.position),a=i.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type")},this.reset=function(){c=s.NONE,l=s.NONE,i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.up.copy(i.up0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),d.subVectors(i.object.position,i.target),i.object.lookAt(i.target),i.dispatchEvent(Bc),o.copy(i.object.position),a=i.object.zoom};function v(R){i.enabled!==!1&&(M.length===0&&(i.domElement.setPointerCapture(R.pointerId),i.domElement.addEventListener("pointermove",T),i.domElement.addEventListener("pointerup",N)),Y(R),R.pointerType==="touch"?le(R):B(R))}function T(R){i.enabled!==!1&&(R.pointerType==="touch"?ie(R):V(R))}function N(R){i.enabled!==!1&&(R.pointerType==="touch"?we(R):$(),re(R),M.length===0&&(i.domElement.releasePointerCapture(R.pointerId),i.domElement.removeEventListener("pointermove",T),i.domElement.removeEventListener("pointerup",N)))}function U(R){re(R)}function I(R){i.enabled!==!1&&(window.removeEventListener("keydown",I),l===s.NONE&&(R.code===i.keys[s.ROTATE]&&!i.noRotate?l=s.ROTATE:R.code===i.keys[s.ZOOM]&&!i.noZoom?l=s.ZOOM:R.code===i.keys[s.PAN]&&!i.noPan&&(l=s.PAN)))}function F(){i.enabled!==!1&&(l=s.NONE,window.addEventListener("keydown",I))}function B(R){if(c===s.NONE)switch(R.button){case i.mouseButtons.LEFT:c=s.ROTATE;break;case i.mouseButtons.MIDDLE:c=s.ZOOM;break;case i.mouseButtons.RIGHT:c=s.PAN;break}const de=l!==s.NONE?l:c;de===s.ROTATE&&!i.noRotate?(g.copy(D(R.pageX,R.pageY)),_.copy(g)):de===s.ZOOM&&!i.noZoom?(p.copy(w(R.pageX,R.pageY)),y.copy(p)):de===s.PAN&&!i.noPan&&(E.copy(w(R.pageX,R.pageY)),x.copy(E)),i.dispatchEvent(zc)}function V(R){const de=l!==s.NONE?l:c;de===s.ROTATE&&!i.noRotate?(_.copy(g),g.copy(D(R.pageX,R.pageY))):de===s.ZOOM&&!i.noZoom?y.copy(w(R.pageX,R.pageY)):de===s.PAN&&!i.noPan&&x.copy(w(R.pageX,R.pageY))}function $(){c=s.NONE,i.dispatchEvent(Hc)}function k(R){if(i.enabled!==!1&&i.noZoom!==!0){switch(R.preventDefault(),R.deltaMode){case 2:p.y-=R.deltaY*.025;break;case 1:p.y-=R.deltaY*.01;break;default:p.y-=R.deltaY*25e-5;break}i.dispatchEvent(zc),i.dispatchEvent(Hc)}}function le(R){switch(me(R),M.length){case 1:c=s.TOUCH_ROTATE,g.copy(D(M[0].pageX,M[0].pageY)),_.copy(g);break;default:c=s.TOUCH_ZOOM_PAN;const de=M[0].pageX-M[1].pageX,Se=M[0].pageY-M[1].pageY;u=f=Math.sqrt(de*de+Se*Se);const ue=(M[0].pageX+M[1].pageX)/2,Ce=(M[0].pageY+M[1].pageY)/2;E.copy(w(ue,Ce)),x.copy(E);break}i.dispatchEvent(zc)}function ie(R){switch(me(R),M.length){case 1:_.copy(g),g.copy(D(R.pageX,R.pageY));break;default:const de=ve(R),Se=R.pageX-de.x,ue=R.pageY-de.y;u=Math.sqrt(Se*Se+ue*ue);const Ce=(R.pageX+de.x)/2,P=(R.pageY+de.y)/2;x.copy(w(Ce,P));break}}function we(R){switch(M.length){case 0:c=s.NONE;break;case 1:c=s.TOUCH_ROTATE,g.copy(D(R.pageX,R.pageY)),_.copy(g);break;case 2:c=s.TOUCH_ZOOM_PAN;for(let de=0;de(t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t);var qb=Xb;const jb=(t,e,n)=>(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t);var Yb=jb;const Zb=t=>Math.atan2(t[1],t[0]);var df=Zb,Kb=df;const Jb=df,Qb=t=>Jb(t)*57.29577951308232;var eT=Qb;const tT=()=>[0,0];var Da=tT;const nT=Da,iT=t=>{const e=nT();return e[0]=t[0],e[1]=t[1],e};var sT=iT;const rT=(t,e)=>(t[0]=e[0],t[1]=e[1],t);var oT=rT;const aT=(t,e,n)=>(t[0]=0,t[1]=0,t[2]=e[0]*n[1]-e[1]*n[0],t);var cT=aT;const lT=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)};var fT=lT;const uT=(t,e,n)=>(t[0]=e[0]/n[0],t[1]=e[1]/n[1],t);var hT=uT;const dT=(t,e)=>t[0]*e[0]+t[1]*e[1];var pT=dT;const mT=(t,e)=>t[0]===e[0]&&t[1]===e[1];var gT=mT;const{NEPS:_T}=Qe,pg=t=>Math.abs(t)<_T?0:t,vT=t=>pg(Math.sin(t)),xT=t=>pg(Math.cos(t));var jt={sin:vT,cos:xT};const{sin:MT,cos:ET}=jt,ST=(t,e)=>(t[0]=ET(e),t[1]=MT(e),t);var mg=ST;const yT=mg,bT=(t,e)=>yT(t,e*.017453292519943295);var TT=bT;const wT=(t,e)=>(t[0]=e,t[1]=e,t);var AT=wT;const RT=Da,CT=(t,e)=>{const n=RT();return n[0]=t,n[1]=e,n};var PT=CT;const LT=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]);var DT=LT;const UT=(t,e,n,i)=>{const s=e[0],r=e[1];return t[0]=s+i*(n[0]-s),t[1]=r+i*(n[1]-r),t};var IT=UT;const NT=(t,e,n)=>(t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t);var FT=NT;const OT=(t,e,n)=>(t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t);var BT=OT;const zT=(t,e,n)=>(t[0]=e[0]*n[0],t[1]=e[1]*n[1],t);var HT=zT;const VT=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t);var GT=VT;const $T=(t,e,n,i)=>{const s=e[0]-n[0],r=e[1]-n[1],o=Math.cos(i),a=Math.sin(i);return t[0]=s*o-r*a+n[0],t[1]=s*a+r*o+n[1],t};var gg=$T;const{TAU:kT}=Qe,WT=Da,XT=gg,qT=(t,e)=>XT(t,e,WT(),kT/4);var jT=qT;const YT=(t,e)=>{const n=e[0],i=e[1];let s=n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=n*s,t[1]=i*s,t};var ZT=YT;const KT=(t,e,n)=>(t[0]=e[0]*n,t[1]=e[1]*n,t);var JT=KT;const QT=(t,e,n)=>(t[0]=Math.round(e[0]/n)*n+0,t[1]=Math.round(e[1]/n)*n+0,t);var ew=QT;const tw=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i};var nw=tw;const iw=t=>{const e=t[0],n=t[1];return e*e+n*n};var sw=iw;const rw=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t);var ow=rw;const aw=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}]`;var cw=aw;const lw=(t,e,n)=>{const i=e[0],s=e[1];return t[0]=n[0]*i+n[4]*s+n[12],t[1]=n[1]*i+n[5]*s+n[13],t};var fw=lw,We={abs:qb,add:Yb,angle:Kb,angleDegrees:eT,angleRadians:df,clone:sT,copy:oT,create:Da,cross:cT,distance:fT,divide:hT,dot:pT,equals:gT,fromAngleDegrees:TT,fromAngleRadians:mg,fromScalar:AT,fromValues:PT,length:DT,lerp:IT,max:FT,min:BT,multiply:HT,negate:GT,normal:jT,normalize:ZT,rotate:gg,scale:JT,snap:ew,squaredDistance:nw,squaredLength:sw,subtract:ow,toString:cw,transform:fw};const uw=t=>Object.assign({},t);var pf=uw;const{EPS:Nh}=Qe,hw=We,dw=pf,pw=t=>{if(t.isClosed)return t;const e=dw(t);if(e.isClosed=!0,e.points.length>1){const n=e.points,i=n[0];let s=n[n.length-1];for(;hw.distance(i,s)(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t);var gw=mw;const _w=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];var mf=_w;const vw=mf,xw=t=>{const e=vw();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e};var Mw=xw;const Ew=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t);var vg=Ew;const Sw=(t,e)=>{const n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],f=e[8],u=e[9],h=e[10],d=e[11],_=e[12],g=e[13],m=e[14],p=e[15],y=n*a-i*o,E=n*c-s*o,x=n*l-r*o,M=i*c-s*a,b=i*l-r*a,w=s*l-r*c,D=f*g-u*_,v=f*m-h*_,T=f*p-d*_,N=u*m-h*g,U=u*p-d*g,I=h*p-d*m;let F=y*I-E*U+x*N+M*T-b*v+w*D;return F?(F=1/F,t[0]=(a*I-c*U+l*N)*F,t[1]=(s*U-i*I-r*N)*F,t[2]=(g*w-m*b+p*M)*F,t[3]=(h*b-u*w-d*M)*F,t[4]=(c*T-o*I-l*v)*F,t[5]=(n*I-s*T+r*v)*F,t[6]=(m*x-_*w-p*E)*F,t[7]=(f*w-h*x+d*E)*F,t[8]=(o*U-a*T+l*D)*F,t[9]=(i*T-n*U-r*D)*F,t[10]=(_*b-g*x+p*y)*F,t[11]=(u*x-f*b-d*y)*F,t[12]=(a*v-o*N-c*D)*F,t[13]=(n*N-i*v+s*D)*F,t[14]=(g*E-_*M-m*y)*F,t[15]=(f*M-u*E+h*y)*F,t):null};var yw=Sw;const bw=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15];var Tw=bw;const ww=t=>(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t);var xg=ww;const{EPS:Aw}=Qe,{sin:Rw,cos:Cw}=jt,Pw=xg,Lw=(t,e,n)=>{let[i,s,r]=n;const o=i*i+s*s+r*r;if(Math.abs(o)(t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t);var Uw=Dw;const{sin:Vc,cos:Gc}=jt,Iw=(t,e,n,i)=>{const s=Vc(e),r=Gc(e),o=Vc(n),a=Gc(n),c=Vc(i),l=Gc(i);return t[0]=a*r,t[1]=a*s,t[2]=-o,t[3]=0,t[4]=c*o*r-l*s,t[5]=l*r+c*o*s,t[6]=c*a,t[7]=0,t[8]=c*s+l*o*r,t[9]=l*o*s-c*r,t[10]=l*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var Nw=Iw;const Fw=(t,e)=>(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t);var Ow=Fw;const Bw=mf,zw=(t,e,n,i,s,r,o,a,c,l,f,u,h,d,_,g)=>{const m=Bw();return m[0]=t,m[1]=e,m[2]=n,m[3]=i,m[4]=s,m[5]=r,m[6]=o,m[7]=a,m[8]=c,m[9]=l,m[10]=f,m[11]=u,m[12]=h,m[13]=d,m[14]=_,m[15]=g,m};var Hw=zw;const Vw=(t,e)=>(t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t);var Eg=Vw;const Gw=(t,e,n)=>(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t);var Sg=Gw;const $w=(t,e)=>t[0]*e[0]+t[1]*e[1]+t[2]*e[2];var Ua=$w;const kw=Ua,Ww=(t,e)=>{const n=t[0],i=t[1],s=t[2],r=e[0],o=e[1],a=e[2],c=Math.sqrt(n*n+i*i+s*s),l=Math.sqrt(r*r+o*o+a*a),f=c*l,u=f&&kw(t,e)/f;return Math.acos(Math.min(Math.max(u,-1),1))};var Xw=Ww;const qw=()=>[0,0,0];var Ia=qw;const jw=Ia,Yw=t=>{const e=jw();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e};var Zw=Yw;const Kw=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t);var yg=Kw;const Jw=(t,e,n)=>{const i=e[0],s=e[1],r=e[2],o=n[0],a=n[1],c=n[2];return t[0]=s*c-r*a,t[1]=r*o-i*c,t[2]=i*a-s*o,t};var ro=Jw;const Qw=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1],s=e[2]-t[2];return Math.sqrt(n*n+i*i+s*s)};var bg=Qw;const eA=(t,e,n)=>(t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t);var tA=eA;const nA=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2];var iA=nA;const sA=(t,e)=>(t[0]=e,t[1]=e,t[2]=e,t);var rA=sA;const oA=Ia,aA=(t,e,n)=>{const i=oA();return i[0]=t,i[1]=e,i[2]=n,i};var cA=aA;const lA=(t,e,n=0)=>(t[0]=e[0],t[1]=e[1],t[2]=n,t);var fA=lA;const uA=t=>{const e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)};var Tg=uA;const hA=(t,e,n,i)=>(t[0]=e[0]+i*(n[0]-e[0]),t[1]=e[1]+i*(n[1]-e[1]),t[2]=e[2]+i*(n[2]-e[2]),t);var dA=hA;const pA=(t,e,n)=>(t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t);var mA=pA;const gA=(t,e,n)=>(t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t);var _A=gA;const vA=(t,e,n)=>(t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t);var xA=vA;const MA=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t);var EA=MA;const SA=(t,e)=>{const n=e[0],i=e[1],s=e[2];let r=n*n+i*i+s*s;return r>0&&(r=1/Math.sqrt(r)),t[0]=n*r,t[1]=i*r,t[2]=s*r,t};var gf=SA;const yA=Eg,bA=Ia,TA=ro,wA=(t,e)=>{const n=yA(bA(),e),i=0+(n[0]{const s=[],r=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[2]-n[2],r[0]=s[0],r[1]=s[1]*Math.cos(i)-s[2]*Math.sin(i),r[2]=s[1]*Math.sin(i)+s[2]*Math.cos(i),t[0]=r[0]+n[0],t[1]=r[1]+n[1],t[2]=r[2]+n[2],t};var CA=RA;const PA=(t,e,n,i)=>{const s=[],r=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[2]-n[2],r[0]=s[2]*Math.sin(i)+s[0]*Math.cos(i),r[1]=s[1],r[2]=s[2]*Math.cos(i)-s[0]*Math.sin(i),t[0]=r[0]+n[0],t[1]=r[1]+n[1],t[2]=r[2]+n[2],t};var LA=PA;const DA=(t,e,n,i)=>{const s=[],r=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],r[0]=s[0]*Math.cos(i)-s[1]*Math.sin(i),r[1]=s[0]*Math.sin(i)+s[1]*Math.cos(i),t[0]=r[0]+n[0],t[1]=r[1]+n[1],t[2]=e[2],t};var UA=DA;const IA=(t,e,n)=>(t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t);var wg=IA;const NA=(t,e,n)=>(t[0]=Math.round(e[0]/n)*n+0,t[1]=Math.round(e[1]/n)*n+0,t[2]=Math.round(e[2]/n)*n+0,t);var FA=NA;const OA=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1],s=e[2]-t[2];return n*n+i*i+s*s};var Ag=OA;const BA=t=>{const e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i};var Rg=BA;const zA=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t);var Na=zA;const HA=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)}]`;var VA=HA;const GA=(t,e,n)=>{const i=e[0],s=e[1],r=e[2];let o=n[3]*i+n[7]*s+n[11]*r+n[15];return o=o||1,t[0]=(n[0]*i+n[4]*s+n[8]*r+n[12])/o,t[1]=(n[1]*i+n[5]*s+n[9]*r+n[13])/o,t[2]=(n[2]*i+n[6]*s+n[10]*r+n[14])/o,t};var $A=GA,Ge={abs:Eg,add:Sg,angle:Xw,clone:Zw,copy:yg,create:Ia,cross:ro,distance:bg,divide:tA,dot:Ua,equals:iA,fromScalar:rA,fromValues:cA,fromVec2:fA,length:Tg,lerp:dA,max:mA,min:_A,multiply:xA,negate:EA,normalize:gf,orthogonal:AA,rotateX:CA,rotateY:LA,rotateZ:UA,scale:wg,snap:FA,squaredDistance:Ag,squaredLength:Rg,subtract:Na,toString:VA,transform:$A};const xi=Ge,kA=Mg,WA=(t,e,n)=>{const i=xi.normalize(xi.create(),e),s=xi.normalize(xi.create(),n),r=xi.cross(xi.create(),s,i),o=xi.dot(s,i);if(o===-1)return kA(t,Math.PI,xi.orthogonal(r,i));const a=1/(1+o);return t[0]=r[0]*r[0]*a+o,t[1]=r[1]*r[0]*a-r[2],t[2]=r[2]*r[0]*a+r[1],t[3]=0,t[4]=r[0]*r[1]*a+r[2],t[5]=r[1]*r[1]*a+o,t[6]=r[2]*r[1]*a-r[0],t[7]=0,t[8]=r[0]*r[2]*a-r[1],t[9]=r[1]*r[2]*a+r[0],t[10]=r[2]*r[2]*a+o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var XA=WA;const{sin:qA,cos:jA}=jt,YA=(t,e)=>{const n=qA(e),i=jA(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var ZA=YA;const{sin:KA,cos:JA}=jt,QA=(t,e)=>{const n=KA(e),i=JA(e);return t[0]=i,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var e2=QA;const{sin:t2,cos:n2}=jt,i2=(t,e)=>{const n=t2(e),i=n2(e);return t[0]=i,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var s2=i2;const r2=t=>t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[7]===0&&t[8]===0&&t[9]===0&&t[10]===1&&t[11]===0&&t[12]===0&&t[13]===0&&t[14]===0&&t[15]===1;var o2=r2;const a2=t=>Jn(t[1])&&Jn(t[2])&&Jn(t[3])&&Jn(t[4])&&Jn(t[6])&&Jn(t[7])&&Jn(t[8])&&Jn(t[9])&&Jn(t[11])&&t[15]===1,Jn=t=>Math.abs(t){const e=t[4]*t[9]-t[8]*t[5],n=t[8]*t[1]-t[0]*t[9],i=t[0]*t[5]-t[4]*t[1];return e*t[2]+n*t[6]+i*t[10]<0};var f2=l2;const u2=(t,e)=>{const[n,i,s,r]=e;return t[0]=1-2*n*n,t[1]=-2*i*n,t[2]=-2*s*n,t[3]=0,t[4]=-2*n*i,t[5]=1-2*i*i,t[6]=-2*s*i,t[7]=0,t[8]=-2*n*s,t[9]=-2*i*s,t[10]=1-2*s*s,t[11]=0,t[12]=2*n*r,t[13]=2*i*r,t[14]=2*s*r,t[15]=1,t};var h2=u2;const d2=(t,e,n)=>{const i=e[0],s=e[1],r=e[2],o=e[3],a=e[4],c=e[5],l=e[6],f=e[7],u=e[8],h=e[9],d=e[10],_=e[11],g=e[12],m=e[13],p=e[14],y=e[15];let E=n[0],x=n[1],M=n[2],b=n[3];return t[0]=E*i+x*a+M*u+b*g,t[1]=E*s+x*c+M*h+b*m,t[2]=E*r+x*l+M*d+b*p,t[3]=E*o+x*f+M*_+b*y,E=n[4],x=n[5],M=n[6],b=n[7],t[4]=E*i+x*a+M*u+b*g,t[5]=E*s+x*c+M*h+b*m,t[6]=E*r+x*l+M*d+b*p,t[7]=E*o+x*f+M*_+b*y,E=n[8],x=n[9],M=n[10],b=n[11],t[8]=E*i+x*a+M*u+b*g,t[9]=E*s+x*c+M*h+b*m,t[10]=E*r+x*l+M*d+b*p,t[11]=E*o+x*f+M*_+b*y,E=n[12],x=n[13],M=n[14],b=n[15],t[12]=E*i+x*a+M*u+b*g,t[13]=E*s+x*c+M*h+b*m,t[14]=E*r+x*l+M*d+b*p,t[15]=E*o+x*f+M*_+b*y,t};var p2=d2;const{EPS:m2}=Qe,{sin:g2,cos:_2}=jt,v2=vg,x2=(t,e,n,i)=>{let[s,r,o]=i;const a=s*s+r*r+o*o;if(Math.abs(a){const i=E2(n),s=S2(n),r=e[4],o=e[5],a=e[6],c=e[7],l=e[8],f=e[9],u=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+l*i,t[5]=o*s+f*i,t[6]=a*s+u*i,t[7]=c*s+h*i,t[8]=l*s-r*i,t[9]=f*s-o*i,t[10]=u*s-a*i,t[11]=h*s-c*i,t};var b2=y2;const{sin:T2,cos:w2}=jt,A2=(t,e,n)=>{const i=T2(n),s=w2(n),r=e[0],o=e[1],a=e[2],c=e[3],l=e[8],f=e[9],u=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-l*i,t[1]=o*s-f*i,t[2]=a*s-u*i,t[3]=c*s-h*i,t[8]=r*i+l*s,t[9]=o*i+f*s,t[10]=a*i+u*s,t[11]=c*i+h*s,t};var R2=A2;const{sin:C2,cos:P2}=jt,L2=(t,e,n)=>{const i=C2(n),s=P2(n),r=e[0],o=e[1],a=e[2],c=e[3],l=e[4],f=e[5],u=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+l*i,t[1]=o*s+f*i,t[2]=a*s+u*i,t[3]=c*s+h*i,t[4]=l*s-r*i,t[5]=f*s-o*i,t[6]=u*s-a*i,t[7]=h*s-c*i,t};var D2=L2;const U2=(t,e,n)=>{const i=n[0],s=n[1],r=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t};var I2=U2;const N2=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t);var F2=N2;const O2=t=>t.map(e=>e.toFixed(7)).toString();var B2=O2;const z2=(t,e,n)=>{const i=n[0],s=n[1],r=n[2];let o,a,c,l,f,u,h,d,_,g,m,p;return e===t?(t[12]=e[0]*i+e[4]*s+e[8]*r+e[12],t[13]=e[1]*i+e[5]*s+e[9]*r+e[13],t[14]=e[2]*i+e[6]*s+e[10]*r+e[14],t[15]=e[3]*i+e[7]*s+e[11]*r+e[15]):(o=e[0],a=e[1],c=e[2],l=e[3],f=e[4],u=e[5],h=e[6],d=e[7],_=e[8],g=e[9],m=e[10],p=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=l,t[4]=f,t[5]=u,t[6]=h,t[7]=d,t[8]=_,t[9]=g,t[10]=m,t[11]=p,t[12]=o*i+f*s+_*r+e[12],t[13]=a*i+u*s+g*r+e[13],t[14]=c*i+h*s+m*r+e[14],t[15]=l*i+d*s+p*r+e[15]),t};var H2=z2,dt={add:gw,clone:Mw,copy:vg,create:mf,invert:yw,equals:Tw,fromRotation:Mg,fromScaling:Uw,fromTaitBryanRotation:Nw,fromTranslation:Ow,fromValues:Hw,fromVectorRotation:XA,fromXRotation:ZA,fromYRotation:e2,fromZRotation:s2,identity:xg,isIdentity:o2,isOnlyTransformScale:c2,isMirroring:f2,mirrorByPlane:h2,multiply:p2,rotate:M2,rotateX:b2,rotateY:R2,rotateZ:D2,scale:I2,subtract:F2,toString:B2,translate:H2};const V2=dt,G2=t=>(t===void 0&&(t=[]),{points:t,isClosed:!1,transforms:V2.create()});var Fa=G2;const{EPS:Fh}=Qe,Oh=We,$2=_g,k2=Fa,W2=(t,e)=>{const n={closed:!1};let{closed:i}=Object.assign({},n,t),s=k2();if(s.points=e.map(r=>Oh.clone(r)),s.points.length>1){const r=s.points[0],o=s.points[s.points.length-1];Oh.distance(r,o)(Bh.isIdentity(t.transforms)||(t.points=t.points.map(e=>zh.transform(zh.create(),e,t.transforms)),t.transforms=Bh.create()),t);var q2=X2;const j2=q2,Y2=t=>j2(t).points;var or=Y2;const{TAU:Fo}=Qe,gt=We,Z2=_f,K2=or,J2=(t,e)=>{const n={radius:[0,0],xaxisrotation:0,clockwise:!1,large:!1,segments:16};let{endpoint:i,radius:s,xaxisrotation:r,clockwise:o,large:a,segments:c}=Object.assign({},n,t);if(!Array.isArray(i))throw new Error("endpoint must be an array of X and Y values");if(i.length<2)throw new Error("endpoint must contain X and Y values");if(i=gt.clone(i),!Array.isArray(s))throw new Error("radius must be an array of X and Y values");if(s.length<2)throw new Error("radius must contain X and Y values");if(c<4)throw new Error("segments must be four or more");const l=1e5;if(e.isClosed)throw new Error("the given path cannot be closed");const f=K2(e);if(f.length<1)throw new Error("the given path must contain one or more points (as the starting point for the arc)");let u=s[0],h=s[1];const d=f[f.length-1];u=Math.round(u*l)/l,h=Math.round(h*l)/l,i=gt.fromValues(Math.round(i[0]*l)/l,Math.round(i[1]*l)/l);const _=!o;let g=[];if(u===0||h===0)g.push(i);else{u=Math.abs(u),h=Math.abs(h);const p=r,y=Math.cos(p),E=Math.sin(p),x=gt.subtract(gt.create(),d,i);gt.scale(x,x,.5);const M=Math.round((y*x[0]+E*x[1])*l)/l,b=Math.round((-E*x[0]+y*x[1])*l)/l,w=gt.fromValues(M,b),D=w[0]*w[0]/(u*u)+w[1]*w[1]/(h*h);if(D>1){const k=Math.sqrt(D);u*=k,h*=k,u=Math.round(u*l)/l,h=Math.round(h*l)/l}let v=Math.sqrt((u*u*h*h-u*u*w[1]*w[1]-h*h*w[0]*w[0])/(u*u*w[1]*w[1]+h*h*w[0]*w[0]));_===a&&(v=-v);const T=gt.fromValues(u*w[1]/h,-h*w[0]/u);gt.scale(T,T,v);let N=gt.fromValues(y*T[0]-E*T[1],E*T[0]+y*T[1]);N=gt.add(N,N,gt.scale(gt.create(),gt.add(gt.create(),d,i),.5));const U=gt.fromValues((w[0]-T[0])/u,(w[1]-T[1])/h),I=gt.fromValues((-w[0]-T[0])/u,(-w[1]-T[1])/h),F=gt.angleRadians(U);let V=gt.angleRadians(I)-F;V=V%Fo,!_&&V>0?V-=Fo:_&&V<0&&(V+=Fo);let $=Math.ceil(Math.abs(V)/Fo*c)+1;$<1&&($=1);for(let k=1;k<$;k++){const le=F+k/$*V,ie=Math.cos(le),we=Math.sin(le),ce=gt.fromValues(y*u*ie-E*h*we,E*u*ie+y*h*we);gt.add(ce,ce,N),g.push(ce)}$&&g.push(t.endpoint)}return g=f.concat(g),Z2({},g)};var Q2=J2;const eR=_f,tR=or,{equals:nR}=We,iR=(...t)=>{let e=!1,n=[];return t.forEach((i,s)=>{const r=tR(i).slice();if(n.length>0&&r.length>0&&nR(r[0],n[n.length-1])&&r.shift(),r.length>0&&e)throw new Error(`Cannot concatenate to a closed path; check the ${s}th path`);e=i.isClosed,n=n.concat(r)}),eR({closed:e},n)};var Cg=iR;const sR=Cg,rR=Fa,oR=(t,e)=>sR(e,rR(t));var Pg=oR;const{TAU:aR}=Qe,sn=We,cR=We,lR=Pg,fR=or,uR=(t,e)=>{const n={segments:16};let{controlPoints:i,segments:s}=Object.assign({},n,t);if(!Array.isArray(i))throw new Error("controlPoints must be an array of one or more points");if(i.length<1)throw new Error("controlPoints must be an array of one or more points");if(s<4)throw new Error("segments must be four or more");if(e.isClosed)throw new Error("the given geometry cannot be closed");const r=fR(e);if(r.length<1)throw new Error("the given path must contain one or more points (as the starting point for the bezier curve)");if(i=i.slice(),i[0]===null){if(i.length<2)throw new Error("a null control point must be passed with one more control points");let b=r[r.length-2];if("lastBezierControlPoint"in e&&(b=e.lastBezierControlPoint),!Array.isArray(b))throw new Error("the given path must contain TWO or more points if given a null control point");const w=sn.scale(sn.create(),r[r.length-1],2);sn.subtract(w,w,b),i[0]=w}i.unshift(r[r.length-1]);const a=i.length-1,c=[];let l=1;for(let b=0;b<=a;++b)b>0&&(l*=b),c.push(l);const f=[];for(let b=0;b<=a;++b){const w=c[a]/(c[b]*c[a-b]);f.push(w)}const u=sn.create(),h=sn.create(),d=cR.create(),_=b=>{let w=1,D=Math.pow(1-b,a);const v=b!==1?1/(1-b):1,T=sn.create();for(let N=0;N<=a;++N){N===a&&(D=1);const U=f[N]*w*D,I=sn.scale(u,i[N],U);sn.add(T,T,I),w*=b,D*=v}return T},g=[],m=[],p=a+1;for(let b=0;bx){const v=m[y-1],T=m[y+1],N=v+(T-v)*1/3,U=v+(T-v)*2/3,I=_(N),F=_(U);g.splice(y,1,I,F),m.splice(y,1,N,U),y--,y<1&&(y=1)}else++y}g.shift();const M=lR(g,e);return M.lastBezierControlPoint=i[i.length-2],M};var hR=uR;const dR=We,Hh=or,pR=(t,e)=>{if(t.isClosed!==e.isClosed||t.points.length!==e.points.length)return!1;const n=Hh(t),i=Hh(e),s=n.length;let r=0;do{let o=!1;for(let a=0;a{if(t[0]!==2)throw new Error("invalid compact binary data");const e=vR();e.transforms=gR.clone(t.slice(1,17)),e.isClosed=!!t[17];for(let n=22;n=0&&(e.color=[t[18],t[19],t[20],t[21]]),e};var MR=xR;const ER=t=>!!(t&&typeof t=="object"&&"points"in t&&"transforms"in t&&"isClosed"in t&&Array.isArray(t.points)&&"length"in t.transforms);var Lg=ER;const SR=pf,yR=t=>{const e=SR(t);return e.points=t.points.slice().reverse(),e};var bR=yR;const TR=We,wR=or,AR=t=>{const e=wR(t);let n="path ("+e.length+" points, "+t.isClosed+`): [ -`;return e.forEach(i=>{n+=" "+N2.toString(i)+`, +`;return e.forEach(i=>{n+=" "+TR.toString(i)+`, `}),n+=`] -`,n};var B2=O2;const z2=t=>{const e=t.points,n=t.transforms;let i=[-1,-1,-1,-1];t.color&&(i=t.color);const s=new Float32Array(22+e.length*2);s[0]=2,s[1]=n[0],s[2]=n[1],s[3]=n[2],s[4]=n[3],s[5]=n[4],s[6]=n[5],s[7]=n[6],s[8]=n[7],s[9]=n[8],s[10]=n[9],s[11]=n[10],s[12]=n[11],s[13]=n[12],s[14]=n[13],s[15]=n[14],s[16]=n[15],s[17]=t.isClosed?1:0,s[18]=i[0],s[19]=i[1],s[20]=i[2],s[21]=i[3];for(let r=0;r{const n=vh.multiply(vh.create(),t,e.transforms);return Object.assign({},e,{transforms:n})};var G2=H2;const $2=We,k2=qm,W2=t=>{if(!k2(t))throw new Error("invalid path2 structure");if(t.points.length>1){for(let e=0;e{if(!e.every(Number.isFinite))throw new Error(`path2 invalid point ${e}`)}),!t.transforms.every(Number.isFinite))throw new Error(`path2 invalid transforms ${t.transforms}`)};var X2=W2,li={appendArc:l2,appendBezier:S2,appendPoints:Xm,clone:jl,close:Um,concat:Wm,create:_a,equals:T2,fromPoints:Jl,fromCompactBinary:P2,isA:qm,reverse:I2,toPoints:Ys,toString:B2,toCompactBinary:V2,transform:G2,validate:X2};const q2=(t,e)=>Array.isArray(t)&&t.length>=e?t.every(n=>Number.isFinite(n)):!1,Y2=(t,e)=>Number.isFinite(t)&&t>e,j2=(t,e)=>Number.isFinite(t)&&t>=e;var Mt={isNumberArray:q2,isGT:Y2,isGTE:j2};const{EPS:xh,TAU:Ms}=Qe,Yn=We,Z2=li,{isGT:K2,isGTE:Mc,isNumberArray:J2}=Mt,Q2=t=>{const e={center:[0,0],radius:1,startAngle:0,endAngle:Ms,makeTangent:!1,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,makeTangent:o,segments:a}=Object.assign({},e,t);if(!J2(n,2))throw new Error("center must be an array of X and Y values");if(!K2(i,0))throw new Error("radius must be greater than zero");if(!Mc(s,0))throw new Error("startAngle must be positive");if(!Mc(r,0))throw new Error("endAngle must be positive");if(!Mc(a,4))throw new Error("segments must be four or more");s=s%Ms,r=r%Ms;let c=Ms;sr&&(c=r+(Ms-s));const l=Math.acos((i*i+i*i-xh*xh)/(2*i*i)),f=Yn.clone(n);let u;const h=[];if(c.25&&(_=.25);const g=o?d+2:d;for(let m=0;m<=g;m++){let p=m;o&&(p=(m-1)*(d-2*_)/d+_,p<0&&(p=0),p>d&&(p=d));const y=s+p*(c/d);u=Yn.fromAngleRadians(Yn.create(),y),Yn.scale(u,u,i),Yn.add(u,u,f),h.push(u)}}return Z2.fromPoints({closed:!1},h)};var eR=Q2;const tR=t=>Object.assign({},t);var nR=tR;const iR=ut,sR=t=>(t===void 0&&(t=[]),{sides:t,transforms:iR.create()});var va=sR;const Ec=We,rR=va,oR=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");let e=t.length;if(e<3)throw new Error("the given points must define a closed geometry with three or more points");Ec.equals(t[0],t[e-1])&&--e;const n=[];let i=t[e-1];for(let s=0;s{if(t[0]!==0)throw new Error("invalid compact binary data");const e=lR();e.transforms=cR.clone(t.slice(1,17));for(let n=21;n=0&&(e.color=[t[17],t[18],t[19],t[20]]),e};var uR=fR;const hR=t=>!!(t&&typeof t=="object"&&"sides"in t&&"transforms"in t&&Array.isArray(t.sides)&&"length"in t.transforms);var Ym=hR;const Eh=ut,bo=We,dR=t=>(Eh.isIdentity(t.transforms)||(t.sides=t.sides.map(e=>{const n=bo.transform(bo.create(),e[0],t.transforms),i=bo.transform(bo.create(),e[1],t.transforms);return[n,i]}),t.transforms=Eh.create()),t);var pR=dR;const mR=pR,gR=t=>mR(t).sides;var qr=gR;const _R=va,vR=qr,xR=t=>{const n=vR(t).map(i=>[i[1],i[0]]);return n.reverse(),_R(n)};var jm=xR;const rr=We,MR=qr,ER=t=>{const e=new Map,n=i=>{const s=i.toString();return e.has(s)?e.get(s):(e.set(s,i),i)};return t.map(i=>i.map(n))},SR=t=>{const e=new Map;return ER(t).forEach(i=>{e.has(i[0])?e.get(i[0]).push(i):e.set(i[0],[i])}),e},yR=t=>{const e=SR(MR(t)),n=[];for(;;){let i;for(const[o,a]of e){if(i=a.shift(),!i){e.delete(o);continue}break}if(i===void 0)break;const s=[],r=i[0];for(;;){s.push(i[0]);const o=i[1];if(o===r)break;const a=e.get(o);if(!a)throw new Error(`geometry is not closed at vertex ${o}`);const c=bR(i,a);a.length===0&&e.delete(o),i=c}s.length>0&&s.push(s.shift()),n.push(s)}return e.clear(),n},bR=(t,e)=>{if(e.length===1)return e.pop();const n=rr.create(),i=rr.angleDegrees(rr.subtract(n,t[1],t[0]));let s,r;e.forEach((a,c)=>{let f=rr.angleDegrees(rr.subtract(n,a[1],a[0]))-i;f<-180&&(f+=360),f>=180&&(f-=360),(r===void 0||f>s)&&(r=c,s=f)});const o=e[r];return e.splice(r,1),o};var Zm=yR;const TR=qr,wR=t=>{const n=TR(t).map(i=>i[0]);return n.length>0&&n.push(n.shift()),n};var AR=wR;const Sh=We,RR=qr,CR=t=>{const e=RR(t);let n="geom2 ("+e.length+` sides): +`,n};var RR=AR;const CR=t=>{const e=t.points,n=t.transforms;let i=[-1,-1,-1,-1];t.color&&(i=t.color);const s=new Float32Array(22+e.length*2);s[0]=2,s[1]=n[0],s[2]=n[1],s[3]=n[2],s[4]=n[3],s[5]=n[4],s[6]=n[5],s[7]=n[6],s[8]=n[7],s[9]=n[8],s[10]=n[9],s[11]=n[10],s[12]=n[11],s[13]=n[12],s[14]=n[13],s[15]=n[14],s[16]=n[15],s[17]=t.isClosed?1:0,s[18]=i[0],s[19]=i[1],s[20]=i[2],s[21]=i[3];for(let r=0;r{const n=Vh.multiply(Vh.create(),t,e.transforms);return Object.assign({},e,{transforms:n})};var DR=LR;const UR=We,IR=Lg,NR=t=>{if(!IR(t))throw new Error("invalid path2 structure");if(t.points.length>1){for(let e=0;e{if(!e.every(Number.isFinite))throw new Error(`path2 invalid point ${e}`)}),!t.transforms.every(Number.isFinite))throw new Error(`path2 invalid transforms ${t.transforms}`)};var FR=NR,hi={appendArc:Q2,appendBezier:hR,appendPoints:Pg,clone:pf,close:_g,concat:Cg,create:Fa,equals:mR,fromPoints:_f,fromCompactBinary:MR,isA:Lg,reverse:bR,toPoints:or,toString:RR,toCompactBinary:PR,transform:DR,validate:FR};const OR=(t,e)=>Array.isArray(t)&&t.length>=e?t.every(n=>Number.isFinite(n)):!1,BR=(t,e)=>Number.isFinite(t)&&t>e,zR=(t,e)=>Number.isFinite(t)&&t>=e;var Et={isNumberArray:OR,isGT:BR,isGTE:zR};const{EPS:Gh,TAU:Ds}=Qe,Qn=We,HR=hi,{isGT:VR,isGTE:$c,isNumberArray:GR}=Et,$R=t=>{const e={center:[0,0],radius:1,startAngle:0,endAngle:Ds,makeTangent:!1,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,makeTangent:o,segments:a}=Object.assign({},e,t);if(!GR(n,2))throw new Error("center must be an array of X and Y values");if(!VR(i,0))throw new Error("radius must be greater than zero");if(!$c(s,0))throw new Error("startAngle must be positive");if(!$c(r,0))throw new Error("endAngle must be positive");if(!$c(a,4))throw new Error("segments must be four or more");s=s%Ds,r=r%Ds;let c=Ds;sr&&(c=r+(Ds-s));const l=Math.acos((i*i+i*i-Gh*Gh)/(2*i*i)),f=Qn.clone(n);let u;const h=[];if(c.25&&(_=.25);const g=o?d+2:d;for(let m=0;m<=g;m++){let p=m;o&&(p=(m-1)*(d-2*_)/d+_,p<0&&(p=0),p>d&&(p=d));const y=s+p*(c/d);u=Qn.fromAngleRadians(Qn.create(),y),Qn.scale(u,u,i),Qn.add(u,u,f),h.push(u)}}return HR.fromPoints({closed:!1},h)};var kR=$R;const WR=t=>Object.assign({},t);var XR=WR;const qR=dt,jR=t=>(t===void 0&&(t=[]),{sides:t,transforms:qR.create()});var Oa=jR;const kc=We,YR=Oa,ZR=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");let e=t.length;if(e<3)throw new Error("the given points must define a closed geometry with three or more points");kc.equals(t[0],t[e-1])&&--e;const n=[];let i=t[e-1];for(let s=0;s{if(t[0]!==0)throw new Error("invalid compact binary data");const e=QR();e.transforms=JR.clone(t.slice(1,17));for(let n=21;n=0&&(e.color=[t[17],t[18],t[19],t[20]]),e};var tC=eC;const nC=t=>!!(t&&typeof t=="object"&&"sides"in t&&"transforms"in t&&Array.isArray(t.sides)&&"length"in t.transforms);var Dg=nC;const kh=dt,Oo=We,iC=t=>(kh.isIdentity(t.transforms)||(t.sides=t.sides.map(e=>{const n=Oo.transform(Oo.create(),e[0],t.transforms),i=Oo.transform(Oo.create(),e[1],t.transforms);return[n,i]}),t.transforms=kh.create()),t);var sC=iC;const rC=sC,oC=t=>rC(t).sides;var oo=oC;const aC=Oa,cC=oo,lC=t=>{const n=cC(t).map(i=>[i[1],i[0]]);return n.reverse(),aC(n)};var Ug=lC;const vr=We,fC=oo,uC=t=>{const e=new Map,n=i=>{const s=i.toString();return e.has(s)?e.get(s):(e.set(s,i),i)};return t.map(i=>i.map(n))},hC=t=>{const e=new Map;return uC(t).forEach(i=>{e.has(i[0])?e.get(i[0]).push(i):e.set(i[0],[i])}),e},dC=t=>{const e=hC(fC(t)),n=[];for(;;){let i;for(const[o,a]of e){if(i=a.shift(),!i){e.delete(o);continue}break}if(i===void 0)break;const s=[],r=i[0];for(;;){s.push(i[0]);const o=i[1];if(o===r)break;const a=e.get(o);if(!a)throw new Error(`geometry is not closed at vertex ${o}`);const c=pC(i,a);a.length===0&&e.delete(o),i=c}s.length>0&&s.push(s.shift()),n.push(s)}return e.clear(),n},pC=(t,e)=>{if(e.length===1)return e.pop();const n=vr.create(),i=vr.angleDegrees(vr.subtract(n,t[1],t[0]));let s,r;e.forEach((a,c)=>{let f=vr.angleDegrees(vr.subtract(n,a[1],a[0]))-i;f<-180&&(f+=360),f>=180&&(f-=360),(r===void 0||f>s)&&(r=c,s=f)});const o=e[r];return e.splice(r,1),o};var Ig=dC;const mC=oo,gC=t=>{const n=mC(t).map(i=>i[0]);return n.length>0&&n.push(n.shift()),n};var _C=gC;const Wh=We,vC=oo,xC=t=>{const e=vC(t);let n="geom2 ("+e.length+` sides): [ -`;return e.forEach(i=>{n+=" ["+Sh.toString(i[0])+", "+Sh.toString(i[1])+`] +`;return e.forEach(i=>{n+=" ["+Wh.toString(i[0])+", "+Wh.toString(i[1])+`] `}),n+=`] -`,n};var PR=CR;const LR=t=>{const e=t.sides,n=t.transforms;let i=[-1,-1,-1,-1];t.color&&(i=t.color);const s=new Float32Array(21+e.length*4);s[0]=0,s[1]=n[0],s[2]=n[1],s[3]=n[2],s[4]=n[3],s[5]=n[4],s[6]=n[5],s[7]=n[6],s[8]=n[7],s[9]=n[8],s[10]=n[9],s[11]=n[10],s[12]=n[11],s[13]=n[12],s[14]=n[13],s[15]=n[14],s[16]=n[15],s[17]=i[0],s[18]=i[1],s[19]=i[2],s[20]=i[3];for(let r=0;r{const n=yh.multiply(yh.create(),t,e.transforms),i=Object.assign({},e,{transforms:n});return t[0]*t[5]-t[4]*t[1]<0?UR(i):i};var NR=IR;const FR=We,OR=Ym,BR=Zm,zR=t=>{if(!OR(t))throw new Error("invalid geom2 structure");if(BR(t),t.sides.forEach(e=>{if(FR.equals(e[0],e[1]))throw new Error(`geom2 self-edge ${e[0]}`)}),!t.transforms.every(Number.isFinite))throw new Error(`geom2 invalid transforms ${t.transforms}`)};var VR=zR,At={clone:nR,create:va,fromPoints:aR,fromCompactBinary:uR,isA:Ym,reverse:jm,toOutlines:Zm,toPoints:AR,toSides:qr,toString:PR,toCompactBinary:DR,transform:NR,validate:VR};const{EPS:bh,TAU:gi}=Qe,Sc=We,Th=At,{sin:HR,cos:GR}=qt,{isGTE:yc,isNumberArray:wh}=Mt,$R=t=>{const e={center:[0,0],radius:[1,1],startAngle:0,endAngle:gi,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,segments:o}=Object.assign({},e,t);if(!wh(n,2))throw new Error("center must be an array of X and Y values");if(!wh(i,2))throw new Error("radius must be an array of X and Y values");if(!i.every(d=>d>=0))throw new Error("radius values must be positive");if(!yc(s,0))throw new Error("startAngle must be positive");if(!yc(r,0))throw new Error("endAngle must be positive");if(!yc(o,3))throw new Error("segments must be three or more");if(i[0]===0||i[1]===0)return Th.create();s=s%gi,r=r%gi;let a=gi;sr&&(a=r+(gi-s));const c=Math.min(i[0],i[1]),l=Math.acos((c*c+c*c-bh*bh)/(2*c*c));if(a{const e={center:[0,0],radius:1,startAngle:0,endAngle:kR,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,segments:o}=Object.assign({},e,t);if(!XR(i,0))throw new Error("radius must be positive");return i=[i,i],WR({center:n,radius:i,startAngle:s,endAngle:r,segments:o})};var Jm=qR;const YR=t=>Object.assign({},t);var jR=YR;const ZR=ut,KR=t=>(t===void 0&&(t=[]),{polygons:t,transforms:ZR.create()});var Yr=KR;const JR=Xr,Ah=ga,Rh=km,QR=(t,e,n)=>{const i=[],s=[],r=[];Ah(i,n,e),Ah(s,t,e);const o=Rh(JR(r,s,i)),a=Rh(i);if(a===0)throw Error("a and b are the same point");return o/a},eC=(t,e,n)=>Math.sqrt(QR(t,e,n));var tC=eC;const nC=Xr,iC=Kl,Ch=ga,sC=(t,e,n,i)=>{const s=[0,0,0];return Ch(t,e,n),Ch(s,n,i),nC(t,t,s),iC(t,t)};var rC=sC;let oC=class{constructor(){this.head=null,this.tail=null}clear(){this.head=this.tail=null}insertBefore(e,n){n.prev=e.prev,n.next=e,n.prev?n.prev.next=n:this.head=n,e.prev=n}insertAfter(e,n){n.prev=e,n.next=e.next,n.next?n.next.prev=n:this.tail=n,e.next=n}add(e){this.head?this.tail.next=e:this.head=e,e.prev=this.tail,e.next=null,this.tail=e}addAll(e){for(this.head?this.tail.next=e:this.head=e,e.prev=this.tail;e.next;)e=e.next;this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev}removeChain(e,n){e.prev?e.prev.next=n.next:this.head=n.next,n.next?n.next.prev=e.prev:this.tail=e.prev}first(){return this.head}isEmpty(){return!this.head}};var aC=oC;let cC=class{constructor(e,n){this.point=e,this.index=n,this.next=null,this.prev=null,this.face=null}};var lC=cC;const fC=Vm,uC=$m;let hC=class{constructor(e,n){this.vertex=e,this.face=n,this.next=null,this.prev=null,this.opposite=null}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){return this.tail()?fC(this.tail().point,this.head().point):-1}lengthSquared(){return this.tail()?uC(this.tail().point,this.head().point):-1}setOpposite(e){this.opposite=e,e.opposite=this}};var dC=hC;const bc=Bm,pC=zm,mC=Xr,Tc=pa,gC=Hm,_C=Kl,To=Gm,wc=ga,Ac=dC,Qm=0,vC=1,hl=2;let xC=class eg{constructor(){this.normal=[],this.centroid=[],this.offset=0,this.outside=null,this.mark=Qm,this.edge=null,this.nVertices=0}getEdge(e){if(typeof e!="number")throw Error("requires a number");let n=this.edge;for(;e>0;)n=n.next,e-=1;for(;e<0;)n=n.prev,e+=1;return n}computeNormal(){const e=this.edge,n=e.next;let i=n.next;const s=wc([],n.head().point,e.head().point),r=[],o=[];for(this.nVertices=2,this.normal=[0,0,0];i!==e;)pC(o,s),wc(s,i.head().point,e.head().point),bc(this.normal,this.normal,mC(r,o,s)),i=i.next,this.nVertices+=1;this.area=gC(this.normal),this.normal=To(this.normal,this.normal,1/this.area)}computeNormalMinArea(e){if(this.computeNormal(),this.areai&&(n=s,i=f),s=s.next}while(s!==this.edge);const r=n.tail().point,o=n.head().point,a=wc([],o,r),c=Math.sqrt(i);To(a,a,1/c);const l=Tc(this.normal,a);To(a,a,-l),bc(this.normal,this.normal,a),_C(this.normal,this.normal)}}computeCentroid(){this.centroid=[0,0,0];let e=this.edge;do bc(this.centroid,this.centroid,e.head().point),e=e.next;while(e!==this.edge);To(this.centroid,this.centroid,1/this.nVertices)}computeNormalAndCentroid(e){typeof e<"u"?this.computeNormalMinArea(e):this.computeNormal(),this.computeCentroid(),this.offset=Tc(this.normal,this.centroid)}distanceToPlane(e){return Tc(this.normal,e)-this.offset}connectHalfEdges(e,n){let i;if(e.opposite.face===n.opposite.face){const s=n.opposite.face;let r;e===this.edge&&(this.edge=n),s.nVertices===3?(r=n.opposite.prev.opposite,s.mark=hl,i=s):(r=n.opposite.next,s.edge===r.prev&&(s.edge=r),r.prev=r.prev.prev,r.prev.next=r),n.prev=e.prev,n.prev.next=n,n.setOpposite(r),s.computeNormalAndCentroid()}else e.next=n,n.prev=e;return i}mergeAdjacentFaces(e,n){const i=e.opposite,s=i.face;n.push(s),s.mark=hl;let r=e.prev,o=e.next,a=i.prev,c=i.next;for(;r.opposite.face===s;)r=r.prev,c=c.next;for(;o.opposite.face===s;)o=o.next,a=a.prev;let l;for(l=c;l!==a.next;l=l.next)l.face=this;this.edge=o;let f;return f=this.connectHalfEdges(a,o),f&&n.push(f),f=this.connectHalfEdges(r,c),f&&n.push(f),this.computeNormalAndCentroid(),n}collectIndices(){const e=[];let n=this.edge;do e.push(n.head().index),n=n.next;while(n!==this.edge);return e}static createTriangle(e,n,i,s=0){const r=new eg,o=new Ac(e,r),a=new Ac(n,r),c=new Ac(i,r);return o.next=c.prev=a,a.next=o.prev=c,c.next=a.prev=o,r.edge=o,r.computeNormalAndCentroid(s),r}};var MC={VISIBLE:Qm,NON_CONVEX:vC,DELETED:hl,Face:xC};const Rc=pa,EC=tC,SC=rC,Ph=aC,yC=lC,{Face:jn,VISIBLE:Es,NON_CONVEX:Lh,DELETED:bC}=MC,TC=1,Dh=2;let wC=class{constructor(e){if(!Array.isArray(e))throw TypeError("input is not a valid array");if(e.length<4)throw Error("cannot build a simplex out of <4 points");this.tolerance=-1,this.nFaces=0,this.nPoints=e.length,this.faces=[],this.newFaces=[],this.claimed=new Ph,this.unclaimed=new Ph,this.vertices=[];for(let n=0;nthis.tolerance?this.addVertexToFace(r,n):this.unclaimed.add(r)}}resolveUnclaimedPoints(e){let n=this.unclaimed.first();for(let i=n;i;i=n){n=i.next;let s=this.tolerance,r;for(let o=0;os&&(s=c,r=a),s>1e3*this.tolerance)break}}r&&this.addVertexToFace(i,r)}}computeExtremes(){const e=[],n=[],i=[],s=[];let r,o;for(r=0;r<3;r+=1)i[r]=s[r]=this.vertices[0];for(r=0;r<3;r+=1)e[r]=n[r]=this.vertices[0].point[r];for(r=1;rn[o]&&(n[o]=c[o],s[o]=a)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e[0]),Math.abs(n[0]))+Math.max(Math.abs(e[1]),Math.abs(n[1]))+Math.max(Math.abs(e[2]),Math.abs(n[2]))),[i,s]}createInitialSimplex(){const e=this.vertices,[n,i]=this.computeExtremes();let s,r,o,a,c=0,l=0;for(o=0;o<3;o+=1){const g=i[o].point[o]-n[o].point[o];g>c&&(c=g,l=o)}const f=n[l],u=i[l];for(c=0,o=0;oc&&(c=m,s=g)}}const h=SC([],f.point,u.point,s.point),d=Rc(f.point,h);for(c=-1,o=0;oc&&(c=m,r=g)}}const _=[];if(Rc(r.point,h)-d<0)for(_.push(jn.createTriangle(f,u,s),jn.createTriangle(r,u,f),jn.createTriangle(r,s,u),jn.createTriangle(r,f,s)),o=0;o<3;o+=1){const g=(o+1)%3;_[o+1].getEdge(2).setOpposite(_[0].getEdge(g)),_[o+1].getEdge(1).setOpposite(_[g+1].getEdge(0))}else for(_.push(jn.createTriangle(f,s,u),jn.createTriangle(r,f,u),jn.createTriangle(r,u,s),jn.createTriangle(r,s,f)),o=0;o<3;o+=1){const g=(o+1)%3;_[o+1].getEdge(2).setOpposite(_[0].getEdge((3-o)%3)),_[o+1].getEdge(0).setOpposite(_[g+1].getEdge(1))}for(o=0;o<4;o+=1)this.faces.push(_[o]);for(o=0;oc&&(c=p,m=_[a])}m&&this.addVertexToFace(g,m)}}}reindexFaceAndVertices(){const e=[];for(let n=0;ni&&(i=r,e=n)}return e}}computeHorizon(e,n,i,s){this.deleteFaceVertices(i),i.mark=bC;let r;n?r=n.next:r=n=i.getEdge(0);do{const o=r.opposite,a=o.face;a.mark===Es&&(a.distanceToPlane(e)>this.tolerance?this.computeHorizon(e,o,a,s):s.push(r)),r=r.next}while(r!==n)}addAdjoiningFace(e,n){const i=jn.createTriangle(e,n.tail(),n.head());return this.faces.push(i),i.getEdge(-1).setOpposite(n.opposite),i.getEdge(0)}addNewFaces(e,n){this.newFaces=[];let i,s;for(let r=0;r=e.nVertices)throw Error("merge recursion limit exceeded");const o=i.opposite.face;let a=!1;if(n===Dh?(this.oppositeFaceDistance(i)>-this.tolerance||this.oppositeFaceDistance(i.opposite)>-this.tolerance)&&(a=!0):e.area>o.area?this.oppositeFaceDistance(i)>-this.tolerance?a=!0:this.oppositeFaceDistance(i.opposite)>-this.tolerance&&(s=!1):this.oppositeFaceDistance(i.opposite)>-this.tolerance?a=!0:this.oppositeFaceDistance(i)>-this.tolerance&&(s=!1),a){const c=e.mergeAdjacentFaces(i,[]);for(let l=0;l{const n=new RC(t);return n.build(),n.collectFaces(e.skipTriangulation)};var PC=CC;const LC=t=>((t===void 0||t.length<3)&&(t=[]),{vertices:t});var js=LC;const DC=js,UC=Ge,IC=(...t)=>{let e,n;return t.length===1?(e=DC(),n=t[0]):(e=t[0],n=t[1]),e.vertices=n.vertices.map(i=>UC.clone(i)),e};var NC=IC;const FC=Ge,OC=js,BC=t=>{const e=t.map(n=>FC.clone(n));return OC(e)};var zC=BC;const VC=js,HC=(t,e)=>{const n=VC(t);return n.plane=e,n};var GC=HC;const $C=()=>[0,0,0,0];var xa=$C;const kC=xa,WC=t=>{const e=kC();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e};var tg=WC;const XC=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t);var ng=XC;const qC=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3];var ig=qC;const YC=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t);var sg=YC;const Cc=Ge,jC=(t,e,n)=>{const i=Cc.normalize(Cc.create(),e),s=Cc.dot(n,i);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=s,t};var rg=jC;const ZC=xa,KC=(t,e,n,i)=>{const s=ZC();return s[0]=t,s[1]=e,s[2]=n,s[3]=i,s};var og=KC;const tn=Ge,JC=rg,QC=(t,...e)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0;const n=e.length;e.forEach(d=>{tn.add(t,t,d)}),tn.scale(t,t,1/n);let i=0,s=0,r=0,o=0,a=0,c=0;const l=tn.create();e.forEach(d=>{tn.subtract(l,d,t),i+=l[0]*l[0],s+=l[0]*l[1],r+=l[0]*l[2],o+=l[1]*l[1],a+=l[1]*l[2],c+=l[2]*l[2]}),i/=n,s/=n,r/=n,o/=n,a/=n,c/=n,l[0]=0,l[1]=0,l[2]=0;const f=tn.create();let u=o*c-a*a;f[0]=u,f[1]=r*a-s*c,f[2]=s*a-r*o;let h=u*u;return tn.add(l,l,tn.scale(f,f,h)),u=i*c-r*r,f[0]=r*a-s*c,f[1]=u,f[2]=s*r-a*i,h=u*u,tn.dot(l,f)<0&&(h=-h),tn.add(l,l,tn.scale(f,f,h)),u=i*o-s*s,f[0]=s*a-r*o,f[1]=s*r-a*i,f[2]=u,h=u*u,tn.dot(l,f)<0&&(h=-h),tn.add(l,l,tn.scale(f,f,h)),JC(t,l,t)};var eP=QC;const Cn=Ge,tP=(t,...e)=>{const n=e.length,i=Cn.create(),s=Cn.create(),r=o=>{const a=e[o],c=e[(o+1)%n],l=e[(o+2)%n];return Cn.subtract(i,c,a),Cn.subtract(s,l,a),Cn.cross(i,i,s),Cn.normalize(i,i),i};return t[0]=0,t[1]=0,t[2]=0,n===3?Cn.copy(t,r(0)):(e.forEach((o,a)=>{Cn.add(t,t,r(a))}),Cn.normalize(t,t)),t[3]=Cn.dot(t,e[0]),t};var ag=tP;const{EPS:Pc}=Qe,Ot=Ge,nP=(t,e,n,i)=>{let s=Ot.subtract(Ot.create(),n,e),r=Ot.subtract(Ot.create(),i,e);Ot.length(s){const n=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]-t[3],i=e[0]-n*t[0],s=e[1]-n*t[1],r=e[2]-n*t[2];return sP.fromValues(i,s,r)};var oP=rP;const aP=Ge,cP=(t,e)=>aP.dot(t,e)-t[3];var cg=cP;const lP=t=>`(${t[0].toFixed(9)}, ${t[1].toFixed(9)}, ${t[2].toFixed(9)}, ${t[3].toFixed(9)})`;var lg=lP;const fP=ut,Bt=Ge,uP=ag,hP=sg,dP=(t,e,n)=>{const i=fP.isMirroring(n),s=Bt.orthogonal(Bt.create(),e),r=Bt.cross(s,e,s),o=Bt.cross(Bt.create(),e,r);let a=Bt.fromScalar(Bt.create(),e[3]);Bt.multiply(a,a,e);let c=Bt.add(Bt.create(),a,r),l=Bt.add(Bt.create(),a,o);return a=Bt.transform(a,a,n),c=Bt.transform(c,c,n),l=Bt.transform(l,l,n),uP(t,a,c,l),i&&hP(t,t),t};var pP=dP,Zs={clone:tg,copy:ng,create:xa,equals:ig,flip:sg,fromNormalAndPoint:rg,fromValues:og,fromNoisyPoints:eP,fromPoints:ag,fromPointsRandom:iP,projectionOfPoint:oP,signedDistanceToPoint:cg,toString:lg,transform:pP};const Uh=Zs,mP=js,gP=t=>{const e=t.vertices.slice().reverse(),n=mP(e);return t.plane&&(n.plane=Uh.flip(Uh.create(),t.plane)),n};var _P=gP;const vP=t=>!!(t&&typeof t=="object"&&"vertices"in t&&Array.isArray(t.vertices));var fg=vP;const Ih=Zs,Ni=Ge,xP=t=>MP(t.vertices),MP=t=>{const e=t.length;if(e>2){const n=Ih.fromPoints(Ih.create(),...t);let i=t[e-2],s=t[e-1];for(let r=0;r{const s=Ni.cross(Ni.create(),Ni.subtract(Ni.create(),e,t),Ni.subtract(Ni.create(),n,e));return Ni.dot(s,i)>=0};var ug=xP;const Nh=Zs,SP=t=>(t.plane||(t.plane=Nh.fromPoints(Nh.create(),...t.vertices)),t.plane);var Ql=SP;const yP=Ql,bP=t=>{const e=t.vertices.length;if(e<3)return 0;const n=t.vertices,i=yP(t),s=Math.abs(i[0]),r=Math.abs(i[1]),o=Math.abs(i[2]);if(s+r+o===0)return 0;let a=3;s>r&&s>o?a=1:r>o&&(a=2);let c=0,l=0,f=1,u=2;switch(a){case 1:for(f=1;f{const e=t.vertices,n=e.length,i=n===0?or.create():or.clone(e[0]),s=or.clone(i);for(let r=1;rt[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3];var RP=AP;const CP=(t,e)=>(t[0]=e,t[1]=e,t[2]=e,t[3]=e,t);var PP=CP;const LP=(t,e,n)=>{const[i,s,r,o]=e;return t[0]=n[0]*i+n[4]*s+n[8]*r+n[12]*o,t[1]=n[1]*i+n[5]*s+n[9]*r+n[13]*o,t[2]=n[2]*i+n[6]*s+n[10]*r+n[14]*o,t[3]=n[3]*i+n[7]*s+n[11]*r+n[15]*o,t};var DP=LP,UP={clone:tg,copy:ng,create:xa,dot:RP,equals:ig,fromScalar:PP,fromValues:og,toString:lg,transform:DP};const IP=UP,Fh=new WeakMap,NP=t=>{const e=Fh.get(t);if(e)return e;const n=t.vertices,i=IP.create();if(n.length===0)return i[0]=0,i[1]=0,i[2]=0,i[3]=0,i;let s=n[0],r=s,o=s,a=s,c=s,l=s;n.forEach(d=>{s[0]>d[0]&&(s=d),r[1]>d[1]&&(r=d),o[2]>d[2]&&(o=d),a[0]{let e=0;const n=t.vertices,i=Lc.create();for(let s=0;st.vertices;var VP=zP;const HP=Ge,GP=t=>{let e="poly3: vertices: [";return t.vertices.forEach(n=>{e+=`${HP.toString(n)}, `}),e+="]",e};var $P=GP;const kP=ut,Oh=Ge,WP=js,XP=(t,e)=>{const n=e.vertices.map(i=>Oh.transform(Oh.create(),i,t));return kP.isMirroring(t)&&n.reverse(),WP(n)};var qP=XP;const YP=cg,{NEPS:jP}=Qe,ZP=Ge,KP=fg,JP=ug,QP=hg,eL=Ql,tL=t=>{if(!KP(t))throw new Error("invalid poly3 structure");if(t.vertices.length<3)throw new Error(`poly3 not enough vertices ${t.vertices.length}`);if(QP(t)<=0)throw new Error("poly3 area must be greater than zero");for(let e=0;e{if(!e.every(Number.isFinite))throw new Error(`poly3 invalid vertex ${e}`)}),t.vertices.length>3){const e=eL(t);t.vertices.forEach(n=>{const i=Math.abs(YP(e,n));if(i>jP)throw new Error(`poly3 must be coplanar: vertex ${n} distance ${i}`)})}};var nL=tL,rt={clone:NC,create:js,fromPoints:zC,fromPointsAndPlane:GC,invert:_P,isA:fg,isConvex:ug,measureArea:hg,measureBoundingBox:wP,measureBoundingSphere:FP,measureSignedVolume:BP,plane:Ql,toPoints:VP,toString:$P,transform:qP,validate:nL};const iL=PC,sL=Yr,rL=rt,oL=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");const n=iL(t,{skipTriangulation:!0}).map(i=>{const s=i.map(r=>t[r]);return rL.create(s)});return sL(n)};var aL=oL;const cL=rt,lL=Yr,fL=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");const e=t.map((i,s)=>cL.create(i));return lL(e)};var uL=fL;const hL=Ge,dL=ut,pL=rt,mL=Yr,gL=t=>{if(t[0]!==1)throw new Error("invalid compact binary data");const e=mL();e.transforms=dL.clone(t.slice(1,17));const n=t[21];let i=22,s=t.length-n*3;for(;s=0&&(e.color=[t[17],t[18],t[19],t[20]]),e};var _L=gL;const Bh=ut,vL=rt,xL=t=>(Bh.isIdentity(t.transforms)||(t.polygons=t.polygons.map(e=>vL.transform(t.transforms,e)),t.transforms=Bh.create()),t);var ML=xL;const EL=ML,SL=t=>EL(t).polygons;var Ma=SL;const yL=rt,bL=Yr,TL=Ma,wL=t=>{const n=TL(t).map(i=>yL.invert(i));return bL(n)};var AL=wL;const RL=t=>!!(t&&typeof t=="object"&&"polygons"in t&&"transforms"in t&&Array.isArray(t.polygons)&&"length"in t.transforms);var dg=RL;const CL=rt,PL=Ma,LL=t=>PL(t).map(i=>CL.toPoints(i));var DL=LL;const UL=rt,IL=Ma,NL=t=>{const e=IL(t);let n="geom3 ("+e.length+` polygons): -`;return e.forEach(i=>{n+=" "+UL.toString(i)+` -`}),n};var FL=NL;const OL=rt,BL=t=>{const e=t.polygons,n=t.transforms,i=e.length,s=e.reduce((l,f)=>l+f.vertices.length,0);let r=[-1,-1,-1,-1];t.color&&(r=t.color);const o=new Float32Array(22+i+s*3);o[0]=1,o[1]=n[0],o[2]=n[1],o[3]=n[2],o[4]=n[3],o[5]=n[4],o[6]=n[5],o[7]=n[6],o[8]=n[7],o[9]=n[8],o[10]=n[9],o[11]=n[10],o[12]=n[11],o[13]=n[12],o[14]=n[13],o[15]=n[14],o[16]=n[15],o[17]=r[0],o[18]=r[1],o[19]=r[2],o[20]=r[3],o[21]=s;let a=22,c=a+i;return e.forEach(l=>{const f=OL.toPoints(l);o[a]=f.length,a++;for(let u=0;u{const n=zh.multiply(zh.create(),t,e.transforms);return Object.assign({},e,{transforms:n})};var HL=VL;const GL=rt,$L=dg,kL=t=>{if(!$L(t))throw new Error("invalid geom3 structure");if(t.polygons.forEach(GL.validate),WL(t),!t.transforms.every(Number.isFinite))throw new Error(`geom3 invalid transforms ${t.transforms}`)},WL=t=>{const e=new Map;t.polygons.forEach(({vertices:i})=>{i.forEach((s,r)=>{const o=`${s}`,a=`${i[(r+1)%i.length]}`,c=`${o}/${a}`,l=e.has(c)?e.get(c):0;e.set(c,l+1)})});const n=[];if(e.forEach((i,s)=>{const r=s.split("/").reverse().join("/"),o=e.get(r);i!==o&&n.push(s.replace("/"," -> "))}),n.length>0)throw new Error(`non-manifold edges ${n.length} +`,n};var MC=xC;const EC=t=>{const e=t.sides,n=t.transforms;let i=[-1,-1,-1,-1];t.color&&(i=t.color);const s=new Float32Array(21+e.length*4);s[0]=0,s[1]=n[0],s[2]=n[1],s[3]=n[2],s[4]=n[3],s[5]=n[4],s[6]=n[5],s[7]=n[6],s[8]=n[7],s[9]=n[8],s[10]=n[9],s[11]=n[10],s[12]=n[11],s[13]=n[12],s[14]=n[13],s[15]=n[14],s[16]=n[15],s[17]=i[0],s[18]=i[1],s[19]=i[2],s[20]=i[3];for(let r=0;r{const n=Xh.multiply(Xh.create(),t,e.transforms),i=Object.assign({},e,{transforms:n});return t[0]*t[5]-t[4]*t[1]<0?yC(i):i};var TC=bC;const wC=We,AC=Dg,RC=Ig,CC=t=>{if(!AC(t))throw new Error("invalid geom2 structure");if(RC(t),t.sides.forEach(e=>{if(wC.equals(e[0],e[1]))throw new Error(`geom2 self-edge ${e[0]}`)}),!t.transforms.every(Number.isFinite))throw new Error(`geom2 invalid transforms ${t.transforms}`)};var PC=CC,Ct={clone:XR,create:Oa,fromPoints:KR,fromCompactBinary:tC,isA:Dg,reverse:Ug,toOutlines:Ig,toPoints:_C,toSides:oo,toString:MC,toCompactBinary:SC,transform:TC,validate:PC};const{EPS:qh,TAU:Mi}=Qe,Wc=We,jh=Ct,{sin:LC,cos:DC}=jt,{isGTE:Xc,isNumberArray:Yh}=Et,UC=t=>{const e={center:[0,0],radius:[1,1],startAngle:0,endAngle:Mi,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,segments:o}=Object.assign({},e,t);if(!Yh(n,2))throw new Error("center must be an array of X and Y values");if(!Yh(i,2))throw new Error("radius must be an array of X and Y values");if(!i.every(d=>d>=0))throw new Error("radius values must be positive");if(!Xc(s,0))throw new Error("startAngle must be positive");if(!Xc(r,0))throw new Error("endAngle must be positive");if(!Xc(o,3))throw new Error("segments must be three or more");if(i[0]===0||i[1]===0)return jh.create();s=s%Mi,r=r%Mi;let a=Mi;sr&&(a=r+(Mi-s));const c=Math.min(i[0],i[1]),l=Math.acos((c*c+c*c-qh*qh)/(2*c*c));if(a{const e={center:[0,0],radius:1,startAngle:0,endAngle:IC,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,segments:o}=Object.assign({},e,t);if(!FC(i,0))throw new Error("radius must be positive");return i=[i,i],NC({center:n,radius:i,startAngle:s,endAngle:r,segments:o})};var Fg=OC;const BC=t=>Object.assign({},t);var zC=BC;const HC=dt,VC=t=>(t===void 0&&(t=[]),{polygons:t,transforms:HC.create()});var ao=VC;const GC=ro,Zh=Na,Kh=Rg,$C=(t,e,n)=>{const i=[],s=[],r=[];Zh(i,n,e),Zh(s,t,e);const o=Kh(GC(r,s,i)),a=Kh(i);if(a===0)throw Error("a and b are the same point");return o/a},kC=(t,e,n)=>Math.sqrt($C(t,e,n));var WC=kC;const XC=ro,qC=gf,Jh=Na,jC=(t,e,n,i)=>{const s=[0,0,0];return Jh(t,e,n),Jh(s,n,i),XC(t,t,s),qC(t,t)};var YC=jC;let ZC=class{constructor(){this.head=null,this.tail=null}clear(){this.head=this.tail=null}insertBefore(e,n){n.prev=e.prev,n.next=e,n.prev?n.prev.next=n:this.head=n,e.prev=n}insertAfter(e,n){n.prev=e,n.next=e.next,n.next?n.next.prev=n:this.tail=n,e.next=n}add(e){this.head?this.tail.next=e:this.head=e,e.prev=this.tail,e.next=null,this.tail=e}addAll(e){for(this.head?this.tail.next=e:this.head=e,e.prev=this.tail;e.next;)e=e.next;this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev}removeChain(e,n){e.prev?e.prev.next=n.next:this.head=n.next,n.next?n.next.prev=e.prev:this.tail=e.prev}first(){return this.head}isEmpty(){return!this.head}};var KC=ZC;let JC=class{constructor(e,n){this.point=e,this.index=n,this.next=null,this.prev=null,this.face=null}};var QC=JC;const eP=bg,tP=Ag;let nP=class{constructor(e,n){this.vertex=e,this.face=n,this.next=null,this.prev=null,this.opposite=null}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){return this.tail()?eP(this.tail().point,this.head().point):-1}lengthSquared(){return this.tail()?tP(this.tail().point,this.head().point):-1}setOpposite(e){this.opposite=e,e.opposite=this}};var iP=nP;const qc=Sg,sP=yg,rP=ro,jc=Ua,oP=Tg,aP=gf,Bo=wg,Yc=Na,Zc=iP,Og=0,cP=1,Fl=2;let lP=class Bg{constructor(){this.normal=[],this.centroid=[],this.offset=0,this.outside=null,this.mark=Og,this.edge=null,this.nVertices=0}getEdge(e){if(typeof e!="number")throw Error("requires a number");let n=this.edge;for(;e>0;)n=n.next,e-=1;for(;e<0;)n=n.prev,e+=1;return n}computeNormal(){const e=this.edge,n=e.next;let i=n.next;const s=Yc([],n.head().point,e.head().point),r=[],o=[];for(this.nVertices=2,this.normal=[0,0,0];i!==e;)sP(o,s),Yc(s,i.head().point,e.head().point),qc(this.normal,this.normal,rP(r,o,s)),i=i.next,this.nVertices+=1;this.area=oP(this.normal),this.normal=Bo(this.normal,this.normal,1/this.area)}computeNormalMinArea(e){if(this.computeNormal(),this.areai&&(n=s,i=f),s=s.next}while(s!==this.edge);const r=n.tail().point,o=n.head().point,a=Yc([],o,r),c=Math.sqrt(i);Bo(a,a,1/c);const l=jc(this.normal,a);Bo(a,a,-l),qc(this.normal,this.normal,a),aP(this.normal,this.normal)}}computeCentroid(){this.centroid=[0,0,0];let e=this.edge;do qc(this.centroid,this.centroid,e.head().point),e=e.next;while(e!==this.edge);Bo(this.centroid,this.centroid,1/this.nVertices)}computeNormalAndCentroid(e){typeof e<"u"?this.computeNormalMinArea(e):this.computeNormal(),this.computeCentroid(),this.offset=jc(this.normal,this.centroid)}distanceToPlane(e){return jc(this.normal,e)-this.offset}connectHalfEdges(e,n){let i;if(e.opposite.face===n.opposite.face){const s=n.opposite.face;let r;e===this.edge&&(this.edge=n),s.nVertices===3?(r=n.opposite.prev.opposite,s.mark=Fl,i=s):(r=n.opposite.next,s.edge===r.prev&&(s.edge=r),r.prev=r.prev.prev,r.prev.next=r),n.prev=e.prev,n.prev.next=n,n.setOpposite(r),s.computeNormalAndCentroid()}else e.next=n,n.prev=e;return i}mergeAdjacentFaces(e,n){const i=e.opposite,s=i.face;n.push(s),s.mark=Fl;let r=e.prev,o=e.next,a=i.prev,c=i.next;for(;r.opposite.face===s;)r=r.prev,c=c.next;for(;o.opposite.face===s;)o=o.next,a=a.prev;let l;for(l=c;l!==a.next;l=l.next)l.face=this;this.edge=o;let f;return f=this.connectHalfEdges(a,o),f&&n.push(f),f=this.connectHalfEdges(r,c),f&&n.push(f),this.computeNormalAndCentroid(),n}collectIndices(){const e=[];let n=this.edge;do e.push(n.head().index),n=n.next;while(n!==this.edge);return e}static createTriangle(e,n,i,s=0){const r=new Bg,o=new Zc(e,r),a=new Zc(n,r),c=new Zc(i,r);return o.next=c.prev=a,a.next=o.prev=c,c.next=a.prev=o,r.edge=o,r.computeNormalAndCentroid(s),r}};var fP={VISIBLE:Og,NON_CONVEX:cP,DELETED:Fl,Face:lP};const Kc=Ua,uP=WC,hP=YC,Qh=KC,dP=QC,{Face:ei,VISIBLE:Us,NON_CONVEX:ed,DELETED:pP}=fP,mP=1,td=2;let gP=class{constructor(e){if(!Array.isArray(e))throw TypeError("input is not a valid array");if(e.length<4)throw Error("cannot build a simplex out of <4 points");this.tolerance=-1,this.nFaces=0,this.nPoints=e.length,this.faces=[],this.newFaces=[],this.claimed=new Qh,this.unclaimed=new Qh,this.vertices=[];for(let n=0;nthis.tolerance?this.addVertexToFace(r,n):this.unclaimed.add(r)}}resolveUnclaimedPoints(e){let n=this.unclaimed.first();for(let i=n;i;i=n){n=i.next;let s=this.tolerance,r;for(let o=0;os&&(s=c,r=a),s>1e3*this.tolerance)break}}r&&this.addVertexToFace(i,r)}}computeExtremes(){const e=[],n=[],i=[],s=[];let r,o;for(r=0;r<3;r+=1)i[r]=s[r]=this.vertices[0];for(r=0;r<3;r+=1)e[r]=n[r]=this.vertices[0].point[r];for(r=1;rn[o]&&(n[o]=c[o],s[o]=a)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e[0]),Math.abs(n[0]))+Math.max(Math.abs(e[1]),Math.abs(n[1]))+Math.max(Math.abs(e[2]),Math.abs(n[2]))),[i,s]}createInitialSimplex(){const e=this.vertices,[n,i]=this.computeExtremes();let s,r,o,a,c=0,l=0;for(o=0;o<3;o+=1){const g=i[o].point[o]-n[o].point[o];g>c&&(c=g,l=o)}const f=n[l],u=i[l];for(c=0,o=0;oc&&(c=m,s=g)}}const h=hP([],f.point,u.point,s.point),d=Kc(f.point,h);for(c=-1,o=0;oc&&(c=m,r=g)}}const _=[];if(Kc(r.point,h)-d<0)for(_.push(ei.createTriangle(f,u,s),ei.createTriangle(r,u,f),ei.createTriangle(r,s,u),ei.createTriangle(r,f,s)),o=0;o<3;o+=1){const g=(o+1)%3;_[o+1].getEdge(2).setOpposite(_[0].getEdge(g)),_[o+1].getEdge(1).setOpposite(_[g+1].getEdge(0))}else for(_.push(ei.createTriangle(f,s,u),ei.createTriangle(r,f,u),ei.createTriangle(r,u,s),ei.createTriangle(r,s,f)),o=0;o<3;o+=1){const g=(o+1)%3;_[o+1].getEdge(2).setOpposite(_[0].getEdge((3-o)%3)),_[o+1].getEdge(0).setOpposite(_[g+1].getEdge(1))}for(o=0;o<4;o+=1)this.faces.push(_[o]);for(o=0;oc&&(c=p,m=_[a])}m&&this.addVertexToFace(g,m)}}}reindexFaceAndVertices(){const e=[];for(let n=0;ni&&(i=r,e=n)}return e}}computeHorizon(e,n,i,s){this.deleteFaceVertices(i),i.mark=pP;let r;n?r=n.next:r=n=i.getEdge(0);do{const o=r.opposite,a=o.face;a.mark===Us&&(a.distanceToPlane(e)>this.tolerance?this.computeHorizon(e,o,a,s):s.push(r)),r=r.next}while(r!==n)}addAdjoiningFace(e,n){const i=ei.createTriangle(e,n.tail(),n.head());return this.faces.push(i),i.getEdge(-1).setOpposite(n.opposite),i.getEdge(0)}addNewFaces(e,n){this.newFaces=[];let i,s;for(let r=0;r=e.nVertices)throw Error("merge recursion limit exceeded");const o=i.opposite.face;let a=!1;if(n===td?(this.oppositeFaceDistance(i)>-this.tolerance||this.oppositeFaceDistance(i.opposite)>-this.tolerance)&&(a=!0):e.area>o.area?this.oppositeFaceDistance(i)>-this.tolerance?a=!0:this.oppositeFaceDistance(i.opposite)>-this.tolerance&&(s=!1):this.oppositeFaceDistance(i.opposite)>-this.tolerance?a=!0:this.oppositeFaceDistance(i)>-this.tolerance&&(s=!1),a){const c=e.mergeAdjacentFaces(i,[]);for(let l=0;l{const n=new vP(t);return n.build(),n.collectFaces(e.skipTriangulation)};var MP=xP;const EP=t=>((t===void 0||t.length<3)&&(t=[]),{vertices:t});var ar=EP;const SP=ar,yP=Ge,bP=(...t)=>{let e,n;return t.length===1?(e=SP(),n=t[0]):(e=t[0],n=t[1]),e.vertices=n.vertices.map(i=>yP.clone(i)),e};var TP=bP;const wP=Ge,AP=ar,RP=t=>{const e=t.map(n=>wP.clone(n));return AP(e)};var CP=RP;const PP=ar,LP=(t,e)=>{const n=PP(t);return n.plane=e,n};var DP=LP;const UP=()=>[0,0,0,0];var Ba=UP;const IP=Ba,NP=t=>{const e=IP();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e};var zg=NP;const FP=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t);var Hg=FP;const OP=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3];var Vg=OP;const BP=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t);var Gg=BP;const Jc=Ge,zP=(t,e,n)=>{const i=Jc.normalize(Jc.create(),e),s=Jc.dot(n,i);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=s,t};var $g=zP;const HP=Ba,VP=(t,e,n,i)=>{const s=HP();return s[0]=t,s[1]=e,s[2]=n,s[3]=i,s};var kg=VP;const rn=Ge,GP=$g,$P=(t,...e)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0;const n=e.length;e.forEach(d=>{rn.add(t,t,d)}),rn.scale(t,t,1/n);let i=0,s=0,r=0,o=0,a=0,c=0;const l=rn.create();e.forEach(d=>{rn.subtract(l,d,t),i+=l[0]*l[0],s+=l[0]*l[1],r+=l[0]*l[2],o+=l[1]*l[1],a+=l[1]*l[2],c+=l[2]*l[2]}),i/=n,s/=n,r/=n,o/=n,a/=n,c/=n,l[0]=0,l[1]=0,l[2]=0;const f=rn.create();let u=o*c-a*a;f[0]=u,f[1]=r*a-s*c,f[2]=s*a-r*o;let h=u*u;return rn.add(l,l,rn.scale(f,f,h)),u=i*c-r*r,f[0]=r*a-s*c,f[1]=u,f[2]=s*r-a*i,h=u*u,rn.dot(l,f)<0&&(h=-h),rn.add(l,l,rn.scale(f,f,h)),u=i*o-s*s,f[0]=s*a-r*o,f[1]=s*r-a*i,f[2]=u,h=u*u,rn.dot(l,f)<0&&(h=-h),rn.add(l,l,rn.scale(f,f,h)),GP(t,l,t)};var kP=$P;const Nn=Ge,WP=(t,...e)=>{const n=e.length,i=Nn.create(),s=Nn.create(),r=o=>{const a=e[o],c=e[(o+1)%n],l=e[(o+2)%n];return Nn.subtract(i,c,a),Nn.subtract(s,l,a),Nn.cross(i,i,s),Nn.normalize(i,i),i};return t[0]=0,t[1]=0,t[2]=0,n===3?Nn.copy(t,r(0)):(e.forEach((o,a)=>{Nn.add(t,t,r(a))}),Nn.normalize(t,t)),t[3]=Nn.dot(t,e[0]),t};var Wg=WP;const{EPS:Qc}=Qe,Bt=Ge,XP=(t,e,n,i)=>{let s=Bt.subtract(Bt.create(),n,e),r=Bt.subtract(Bt.create(),i,e);Bt.length(s){const n=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]-t[3],i=e[0]-n*t[0],s=e[1]-n*t[1],r=e[2]-n*t[2];return jP.fromValues(i,s,r)};var ZP=YP;const KP=Ge,JP=(t,e)=>KP.dot(t,e)-t[3];var Xg=JP;const QP=t=>`(${t[0].toFixed(9)}, ${t[1].toFixed(9)}, ${t[2].toFixed(9)}, ${t[3].toFixed(9)})`;var qg=QP;const eL=dt,zt=Ge,tL=Wg,nL=Gg,iL=(t,e,n)=>{const i=eL.isMirroring(n),s=zt.orthogonal(zt.create(),e),r=zt.cross(s,e,s),o=zt.cross(zt.create(),e,r);let a=zt.fromScalar(zt.create(),e[3]);zt.multiply(a,a,e);let c=zt.add(zt.create(),a,r),l=zt.add(zt.create(),a,o);return a=zt.transform(a,a,n),c=zt.transform(c,c,n),l=zt.transform(l,l,n),tL(t,a,c,l),i&&nL(t,t),t};var sL=iL,cr={clone:zg,copy:Hg,create:Ba,equals:Vg,flip:Gg,fromNormalAndPoint:$g,fromValues:kg,fromNoisyPoints:kP,fromPoints:Wg,fromPointsRandom:qP,projectionOfPoint:ZP,signedDistanceToPoint:Xg,toString:qg,transform:sL};const nd=cr,rL=ar,oL=t=>{const e=t.vertices.slice().reverse(),n=rL(e);return t.plane&&(n.plane=nd.flip(nd.create(),t.plane)),n};var aL=oL;const cL=t=>!!(t&&typeof t=="object"&&"vertices"in t&&Array.isArray(t.vertices));var jg=cL;const id=cr,ki=Ge,lL=t=>fL(t.vertices),fL=t=>{const e=t.length;if(e>2){const n=id.fromPoints(id.create(),...t);let i=t[e-2],s=t[e-1];for(let r=0;r{const s=ki.cross(ki.create(),ki.subtract(ki.create(),e,t),ki.subtract(ki.create(),n,e));return ki.dot(s,i)>=0};var Yg=lL;const sd=cr,hL=t=>(t.plane||(t.plane=sd.fromPoints(sd.create(),...t.vertices)),t.plane);var vf=hL;const dL=vf,pL=t=>{const e=t.vertices.length;if(e<3)return 0;const n=t.vertices,i=dL(t),s=Math.abs(i[0]),r=Math.abs(i[1]),o=Math.abs(i[2]);if(s+r+o===0)return 0;let a=3;s>r&&s>o?a=1:r>o&&(a=2);let c=0,l=0,f=1,u=2;switch(a){case 1:for(f=1;f{const e=t.vertices,n=e.length,i=n===0?xr.create():xr.clone(e[0]),s=xr.clone(i);for(let r=1;rt[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3];var vL=_L;const xL=(t,e)=>(t[0]=e,t[1]=e,t[2]=e,t[3]=e,t);var ML=xL;const EL=(t,e,n)=>{const[i,s,r,o]=e;return t[0]=n[0]*i+n[4]*s+n[8]*r+n[12]*o,t[1]=n[1]*i+n[5]*s+n[9]*r+n[13]*o,t[2]=n[2]*i+n[6]*s+n[10]*r+n[14]*o,t[3]=n[3]*i+n[7]*s+n[11]*r+n[15]*o,t};var SL=EL,yL={clone:zg,copy:Hg,create:Ba,dot:vL,equals:Vg,fromScalar:ML,fromValues:kg,toString:qg,transform:SL};const bL=yL,rd=new WeakMap,TL=t=>{const e=rd.get(t);if(e)return e;const n=t.vertices,i=bL.create();if(n.length===0)return i[0]=0,i[1]=0,i[2]=0,i[3]=0,i;let s=n[0],r=s,o=s,a=s,c=s,l=s;n.forEach(d=>{s[0]>d[0]&&(s=d),r[1]>d[1]&&(r=d),o[2]>d[2]&&(o=d),a[0]{let e=0;const n=t.vertices,i=el.create();for(let s=0;st.vertices;var PL=CL;const LL=Ge,DL=t=>{let e="poly3: vertices: [";return t.vertices.forEach(n=>{e+=`${LL.toString(n)}, `}),e+="]",e};var UL=DL;const IL=dt,od=Ge,NL=ar,FL=(t,e)=>{const n=e.vertices.map(i=>od.transform(od.create(),i,t));return IL.isMirroring(t)&&n.reverse(),NL(n)};var OL=FL;const BL=Xg,{NEPS:zL}=Qe,HL=Ge,VL=jg,GL=Yg,$L=Zg,kL=vf,WL=t=>{if(!VL(t))throw new Error("invalid poly3 structure");if(t.vertices.length<3)throw new Error(`poly3 not enough vertices ${t.vertices.length}`);if($L(t)<=0)throw new Error("poly3 area must be greater than zero");for(let e=0;e{if(!e.every(Number.isFinite))throw new Error(`poly3 invalid vertex ${e}`)}),t.vertices.length>3){const e=kL(t);t.vertices.forEach(n=>{const i=Math.abs(BL(e,n));if(i>zL)throw new Error(`poly3 must be coplanar: vertex ${n} distance ${i}`)})}};var XL=WL,ot={clone:TP,create:ar,fromPoints:CP,fromPointsAndPlane:DP,invert:aL,isA:jg,isConvex:Yg,measureArea:Zg,measureBoundingBox:gL,measureBoundingSphere:wL,measureSignedVolume:RL,plane:vf,toPoints:PL,toString:UL,transform:OL,validate:XL};const qL=MP,jL=ao,YL=ot,ZL=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");const n=qL(t,{skipTriangulation:!0}).map(i=>{const s=i.map(r=>t[r]);return YL.create(s)});return jL(n)};var KL=ZL;const JL=ot,QL=ao,e3=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");const e=t.map((i,s)=>JL.create(i));return QL(e)};var t3=e3;const n3=Ge,i3=dt,s3=ot,r3=ao,o3=t=>{if(t[0]!==1)throw new Error("invalid compact binary data");const e=r3();e.transforms=i3.clone(t.slice(1,17));const n=t[21];let i=22,s=t.length-n*3;for(;s=0&&(e.color=[t[17],t[18],t[19],t[20]]),e};var a3=o3;const ad=dt,c3=ot,l3=t=>(ad.isIdentity(t.transforms)||(t.polygons=t.polygons.map(e=>c3.transform(t.transforms,e)),t.transforms=ad.create()),t);var f3=l3;const u3=f3,h3=t=>u3(t).polygons;var za=h3;const d3=ot,p3=ao,m3=za,g3=t=>{const n=m3(t).map(i=>d3.invert(i));return p3(n)};var _3=g3;const v3=t=>!!(t&&typeof t=="object"&&"polygons"in t&&"transforms"in t&&Array.isArray(t.polygons)&&"length"in t.transforms);var Kg=v3;const x3=ot,M3=za,E3=t=>M3(t).map(i=>x3.toPoints(i));var S3=E3;const y3=ot,b3=za,T3=t=>{const e=b3(t);let n="geom3 ("+e.length+` polygons): +`;return e.forEach(i=>{n+=" "+y3.toString(i)+` +`}),n};var w3=T3;const A3=ot,R3=t=>{const e=t.polygons,n=t.transforms,i=e.length,s=e.reduce((l,f)=>l+f.vertices.length,0);let r=[-1,-1,-1,-1];t.color&&(r=t.color);const o=new Float32Array(22+i+s*3);o[0]=1,o[1]=n[0],o[2]=n[1],o[3]=n[2],o[4]=n[3],o[5]=n[4],o[6]=n[5],o[7]=n[6],o[8]=n[7],o[9]=n[8],o[10]=n[9],o[11]=n[10],o[12]=n[11],o[13]=n[12],o[14]=n[13],o[15]=n[14],o[16]=n[15],o[17]=r[0],o[18]=r[1],o[19]=r[2],o[20]=r[3],o[21]=s;let a=22,c=a+i;return e.forEach(l=>{const f=A3.toPoints(l);o[a]=f.length,a++;for(let u=0;u{const n=cd.multiply(cd.create(),t,e.transforms);return Object.assign({},e,{transforms:n})};var L3=P3;const D3=ot,U3=Kg,I3=t=>{if(!U3(t))throw new Error("invalid geom3 structure");if(t.polygons.forEach(D3.validate),N3(t),!t.transforms.every(Number.isFinite))throw new Error(`geom3 invalid transforms ${t.transforms}`)},N3=t=>{const e=new Map;t.polygons.forEach(({vertices:i})=>{i.forEach((s,r)=>{const o=`${s}`,a=`${i[(r+1)%i.length]}`,c=`${o}/${a}`,l=e.has(c)?e.get(c):0;e.set(c,l+1)})});const n=[];if(e.forEach((i,s)=>{const r=s.split("/").reverse().join("/"),o=e.get(r);i!==o&&n.push(s.replace("/"," -> "))}),n.length>0)throw new Error(`non-manifold edges ${n.length} ${n.join(` -`)}`)};var XL=kL,Rt={clone:jR,create:Yr,fromPointsConvex:aL,fromPoints:uL,fromCompactBinary:_L,invert:AL,isA:dg,toPoints:DL,toPolygons:Ma,toString:FL,toCompactBinary:zL,transform:HL,validate:XL};const Vh=Rt,qL=rt,{isNumberArray:Hh}=Mt,YL=t=>{const e={center:[0,0,0],size:[2,2,2]},{center:n,size:i}=Object.assign({},e,t);if(!Hh(n,3))throw new Error("center must be an array of X, Y and Z values");if(!Hh(i,3))throw new Error("size must be an array of width, depth and height values");if(!i.every(r=>r>=0))throw new Error("size values must be positive");return i[0]===0||i[1]===0||i[2]===0?Vh.create():Vh.create([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(r=>{const o=r[0].map(a=>[n[0]+i[0]/2*(2*!!(a&1)-1),n[1]+i[1]/2*(2*!!(a&2)-1),n[2]+i[2]/2*(2*!!(a&4)-1)]);return qL.create(o)}))};var ef=YL;const jL=ef,{isGTE:ZL}=Mt,KL=t=>{const e={center:[0,0,0],size:2};let{center:n,size:i}=Object.assign({},e,t);if(!ZL(i,0))throw new Error("size must be positive");return i=[i,i,i],jL({center:n,size:i})};var JL=KL;const{EPS:Gh,TAU:_i}=Qe,yt=Ge,QL=Rt,e3=rt,{sin:t3,cos:n3}=qt,{isGT:i3,isGTE:Dc,isNumberArray:Uc}=Mt,s3=t=>{const e={center:[0,0,0],height:2,startRadius:[1,1],startAngle:0,endRadius:[1,1],endAngle:_i,segments:32};let{center:n,height:i,startRadius:s,startAngle:r,endRadius:o,endAngle:a,segments:c}=Object.assign({},e,t);if(!Uc(n,3))throw new Error("center must be an array of X, Y and Z values");if(!i3(i,0))throw new Error("height must be greater then zero");if(!Uc(s,2))throw new Error("startRadius must be an array of X and Y values");if(!s.every(x=>x>=0))throw new Error("startRadius values must be positive");if(!Uc(o,2))throw new Error("endRadius must be an array of X and Y values");if(!o.every(x=>x>=0))throw new Error("endRadius values must be positive");if(o.every(x=>x===0)&&s.every(x=>x===0))throw new Error("at least one radius must be positive");if(!Dc(r,0))throw new Error("startAngle must be positive");if(!Dc(a,0))throw new Error("endAngle must be positive");if(!Dc(c,4))throw new Error("segments must be four or more");r=r%_i,a=a%_i;let l=_i;ra&&(l=a+(_i-r));const f=Math.min(s[0],s[1],o[0],o[1]),u=Math.acos((f*f+f*f-Gh*Gh)/(2*f*f));if(l{const B=T*l+r;return yt.scale(y,m,I[0]*n3(B)),yt.scale(E,p,I[1]*t3(B)),yt.add(y,y,E),yt.scale(v,g,x),yt.add(v,v,d),yt.add(yt.create(),y,v)},b=(...x)=>{const T=x.map(I=>yt.add(yt.create(),I,n));return e3.create(T)},w=[];for(let x=0;x0&&s[1]>0&&w.push(b(d,M(0,I,s),M(0,T,s))),(s[0]>0||s[1]>0)&&w.push(b(M(0,T,s),M(0,I,s),M(1,T,o))),o[0]>0&&o[1]>0&&w.push(b(_,M(1,T,o),M(1,I,o))),(o[0]>0||o[1]>0)&&w.push(b(M(1,T,o),M(0,I,s),M(1,I,o))))}return l<_i&&(w.push(b(d,M(0,0,s),_)),w.push(b(M(0,0,s),M(1,0,o),_)),w.push(b(d,_,M(0,1,s))),w.push(b(M(0,1,s),_,M(1,1,o)))),QL.create(w)};var pg=s3;const r3=Rt,o3=pg,{isGTE:a3}=Mt,c3=t=>{const e={center:[0,0,0],height:2,radius:1,segments:32},{center:n,height:i,radius:s,segments:r}=Object.assign({},e,t);if(!a3(s,0))throw new Error("radius must be positive");return i===0||s===0?r3.create():o3({center:n,height:i,startRadius:[s,s],endRadius:[s,s],segments:r})};var mg=c3;const{TAU:$h}=Qe,Re=Ge,kh=Rt,Wh=rt,{sin:Xh,cos:qh}=qt,{isGTE:l3,isNumberArray:Yh}=Mt,f3=t=>{const e={center:[0,0,0],radius:[1,1,1],segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]},{center:n,radius:i,segments:s,axes:r}=Object.assign({},e,t);if(!Yh(n,3))throw new Error("center must be an array of X, Y and Z values");if(!Yh(i,3))throw new Error("radius must be an array of X, Y and Z values");if(!i.every(_=>_>=0))throw new Error("radius values must be positive");if(!l3(s,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0||i[2]===0)return kh.create();const o=Re.scale(Re.create(),Re.normalize(Re.create(),r[0]),i[0]),a=Re.scale(Re.create(),Re.normalize(Re.create(),r[1]),i[1]),c=Re.scale(Re.create(),Re.normalize(Re.create(),r[2]),i[2]),l=Math.round(s/4);let f;const u=[],h=Re.create(),d=Re.create();for(let _=0;_<=s;_++){const g=$h*_/s,m=Re.add(Re.create(),Re.scale(h,o,qh(g)),Re.scale(d,a,Xh(g)));if(_>0){let p,y;for(let E=0;E<=l;E++){const v=$h/4*E/l,M=qh(v),b=Xh(v);if(E>0){let w=[],D;D=Re.subtract(Re.create(),Re.scale(h,f,p),Re.scale(d,c,y)),w.push(Re.add(D,D,n)),D=Re.subtract(Re.create(),Re.scale(h,m,p),Re.scale(d,c,y)),w.push(Re.add(D,D,n)),E{const e={points:[],faces:[],colors:void 0,orientation:"outward"},{points:n,faces:i,colors:s,orientation:r}=Object.assign({},e,t);if(!(Array.isArray(n)&&Array.isArray(i)))throw new Error("points and faces must be arrays");if(n.length<3)throw new Error("three or more points are required");if(i.length<1)throw new Error("one or more faces are required");if(s){if(!Array.isArray(s))throw new Error("colors must be an array");if(s.length!==i.length)throw new Error("faces and colors must have the same length")}n.forEach((a,c)=>{if(!jh(a,3))throw new Error(`point ${c} must be an array of X, Y, Z values`)}),i.forEach((a,c)=>{if(a.length<3)throw new Error(`face ${c} must contain 3 or more indexes`);if(!jh(a,a.length))throw new Error(`face ${c} must be an array of numbers`)}),r!=="outward"&&i.forEach(a=>a.reverse());const o=i.map((a,c)=>{const l=h3.create(a.map(f=>n[f]));return s&&s[c]&&(l.color=s[c]),l});return u3.create(o)};var _g=d3;const Zh=ut,Kh=Ge,Jh=Rt,p3=_g,{isGTE:Qh}=Mt,m3=t=>{const e={radius:1,frequency:6};let{radius:n,frequency:i}=Object.assign({},e,t);if(!Qh(n,0))throw new Error("radius must be positive");if(!Qh(i,6))throw new Error("frequency must be six or more");if(n===0)return Jh.create();i=Math.floor(i/6);const s=[[.850651,0,-.525731],[.850651,-0,.525731],[-.850651,-0,.525731],[-.850651,0,-.525731],[0,-.525731,.850651],[0,.525731,.850651],[0,.525731,-.850651],[0,-.525731,-.850651],[-.525731,-.850651,-0],[.525731,-.850651,-0],[.525731,.850651,0],[-.525731,.850651,0]],r=[[0,9,1],[1,10,0],[6,7,0],[10,6,0],[7,9,0],[5,1,4],[4,1,9],[5,10,1],[2,8,3],[3,11,2],[2,5,4],[4,8,2],[2,11,5],[3,7,6],[6,11,3],[8,7,3],[9,8,4],[11,10,5],[10,11,6],[8,9,7]],o=(h,d,_)=>{const g=h[0],m=h[1],p=h[2];let y=_;const E=[],v=[];for(let M=0;M{const g=1-_,m=[];for(let p=0;p<3;p++)m[p]=h[p]*g+d[p]*_;return m};let c=[],l=[],f=0;for(let h=0;h{if(!Array.isArray(t))throw new Error("points must be an array");return _3.fromPoints({},t)};var x3=v3;const wo=At,M3=t=>{const e={points:[],paths:[],orientation:"counterclockwise"},{points:n,paths:i,orientation:s}=Object.assign({},e,t);if(!(Array.isArray(n)&&Array.isArray(i)))throw new Error("points and paths must be arrays");let r=n;Array.isArray(n[0])&&(Array.isArray(n[0][0])||(r=[n])),r.forEach((f,u)=>{if(!Array.isArray(f))throw new Error("list of points "+u+" must be an array");if(f.length<3)throw new Error("list of points "+u+" must contain three or more points");f.forEach((h,d)=>{if(!Array.isArray(h))throw new Error("list of points "+u+", point "+d+" must be an array");if(h.length<2)throw new Error("list of points "+u+", point "+d+" must contain by X and Y values")})});let o=i;if(i.length===0){let f=0;o=r.map(u=>u.map(h=>f++))}const a=[];r.forEach(f=>f.forEach(u=>a.push(u)));let c=[];o.forEach(f=>{const u=f.map(d=>a[d]),h=wo.fromPoints(u);c=c.concat(wo.toSides(h))});let l=wo.create(c);return s==="clockwise"&&(l=wo.reverse(l)),l};var E3=M3;const vi=We,ed=At,{isNumberArray:td}=Mt,S3=t=>{const e={center:[0,0],size:[2,2]},{center:n,size:i}=Object.assign({},e,t);if(!td(n,2))throw new Error("center must be an array of X and Y values");if(!td(i,2))throw new Error("size must be an array of X and Y values");if(!i.every(a=>a>=0))throw new Error("size values must be positive");if(i[0]===0||i[1]===0)return ed.create();const s=[i[0]/2,i[1]/2],r=[s[0],-s[1]],o=[vi.subtract(vi.create(),n,s),vi.add(vi.create(),n,r),vi.add(vi.create(),n,s),vi.subtract(vi.create(),n,r)];return ed.fromPoints(o)};var tf=S3;const{EPS:Go,TAU:ar}=Qe,Ic=We,lt=Ge,nd=Rt,Hs=rt,{sin:y3,cos:b3}=qt,{isGTE:id,isNumberArray:sd}=Mt,T3=ef,rd=(t,e,n,i,s,r)=>{const o=ar/4*s/i,a=b3(o),c=y3(o),l=i-s;let f=n*a,u=e[2]-(n-n*c);r||(u=n-n*c-e[2]),f=f>Go?f:0;const h=lt.add(lt.create(),t,[e[0]-n,e[1]-n,u]),d=lt.add(lt.create(),t,[n-e[0],e[1]-n,u]),_=lt.add(lt.create(),t,[n-e[0],n-e[1],u]),g=lt.add(lt.create(),t,[e[0]-n,n-e[1],u]),m=[],p=[],y=[],E=[];for(let v=0;v<=l;v++){const M=l>0?ar/4*v/l:0,b=Ic.fromAngleRadians(Ic.create(),M);Ic.scale(b,b,f);const w=lt.fromVec2(lt.create(),b);m.push(lt.add(lt.create(),h,w)),lt.rotateZ(w,w,[0,0,0],ar/4),p.push(lt.add(lt.create(),d,w)),lt.rotateZ(w,w,[0,0,0],ar/4),y.push(lt.add(lt.create(),_,w)),lt.rotateZ(w,w,[0,0,0],ar/4),E.push(lt.add(lt.create(),g,w))}return r?[m,p,y,E]:(m.reverse(),p.reverse(),y.reverse(),E.reverse(),[E,y,p,m])},od=(t,e)=>{const n=[];for(let i=0;i{const n=[];for(let i=0;i{t=[t[3],t[2],t[1],t[0]],t=t.map(r=>r.slice().reverse());const n=[];t.forEach(r=>{r.forEach(o=>n.push(o))});const i=[];e.forEach(r=>{r.forEach(o=>i.push(o))});const s=[];for(let r=0;r{const e={center:[0,0,0],size:[2,2,2],roundRadius:.2,segments:32};let{center:n,size:i,roundRadius:s,segments:r}=Object.assign({},e,t);if(!sd(n,3))throw new Error("center must be an array of X, Y and Z values");if(!sd(i,3))throw new Error("size must be an array of X, Y and Z values");if(!i.every(l=>l>=0))throw new Error("size values must be positive");if(!id(s,0))throw new Error("roundRadius must be positive");if(!id(r,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0||i[2]===0)return nd.create();if(s===0)return T3({center:n,size:i});if(i=i.map(l=>l/2),s>i[0]-Go||s>i[1]-Go||s>i[2]-Go)throw new Error("roundRadius must be smaller than the radius of all dimensions");r=Math.floor(r/4);let o=null,a=null,c=[];for(let l=0;l<=r;l++){const f=rd(n,i,s,r,l,!0),u=rd(n,i,s,r,l,!1);if(l===0&&(c=c.concat(w3(u,f))),o&&(c=c.concat(od(o,f),ad(o,f))),a&&(c=c.concat(od(a,u),ad(a,u))),l===r){let h=f.map(d=>d[0]);c.push(Hs.create(h)),h=u.map(d=>d[0]),c.push(Hs.create(h))}o=f,a=u}return nd.create(c)};var R3=A3;const{EPS:C3,TAU:cd}=Qe,ge=Ge,ld=Rt,P3=rt,{sin:fd,cos:ud}=qt,{isGTE:Ao,isNumberArray:L3}=Mt,D3=mg,U3=t=>{const e={center:[0,0,0],height:2,radius:1,roundRadius:.2,segments:32},{center:n,height:i,radius:s,roundRadius:r,segments:o}=Object.assign({},e,t);if(!L3(n,3))throw new Error("center must be an array of X, Y and Z values");if(!Ao(i,0))throw new Error("height must be positive");if(!Ao(s,0))throw new Error("radius must be positive");if(!Ao(r,0))throw new Error("roundRadius must be positive");if(r>s)throw new Error("roundRadius must be smaller than the radius");if(!Ao(o,4))throw new Error("segments must be four or more");if(i===0||s===0)return ld.create();if(r===0)return D3({center:n,height:i,radius:s});const a=[0,0,-(i/2)],c=[0,0,i/2],l=ge.subtract(ge.create(),c,a),f=ge.length(l);if(2*r>f-C3)throw new Error("height must be larger than twice roundRadius");let u;Math.abs(l[0])>Math.abs(l[1])?u=ge.fromValues(0,1,0):u=ge.fromValues(1,0,0);const h=ge.scale(ge.create(),ge.normalize(ge.create(),l),r),d=ge.scale(ge.create(),ge.normalize(ge.create(),ge.cross(ge.create(),h,u)),s),_=ge.scale(ge.create(),ge.normalize(ge.create(),ge.cross(ge.create(),d,h)),s);ge.add(a,a,h),ge.subtract(c,c,h);const g=Math.floor(.25*o),m=b=>{const w=b.map(D=>ge.add(D,D,n));return P3.create(w)},p=[],y=ge.create(),E=ge.create();let v;for(let b=0;b<=o;b++){const w=cd*b/o,D=ge.add(ge.create(),ge.scale(y,d,ud(w)),ge.scale(E,_,fd(w)));if(b>0){let x=[];x.push(ge.add(ge.create(),a,D)),x.push(ge.add(ge.create(),a,v)),x.push(ge.add(ge.create(),c,v)),x.push(ge.add(ge.create(),c,D)),p.push(m(x));let T,I;for(let B=0;B<=g;B++){const U=cd/4*B/g,F=ud(U),z=fd(U);if(B>0){x=[];let H;H=ge.add(ge.create(),a,ge.subtract(y,ge.scale(y,v,T),ge.scale(E,h,I))),x.push(H),H=ge.add(ge.create(),a,ge.subtract(y,ge.scale(y,D,T),ge.scale(E,h,I))),x.push(H),B{const e={center:[0,0],size:[2,2],roundRadius:.2,segments:32};let{center:n,size:i,roundRadius:s,segments:r}=Object.assign({},e,t);if(!md(n,2))throw new Error("center must be an array of X and Y values");if(!md(i,2))throw new Error("size must be an array of X and Y values");if(!i.every(g=>g>=0))throw new Error("size values must be positive");if(!pd(s,0))throw new Error("roundRadius must be positive");if(!pd(r,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0)return dd.create();if(s===0)return N3({center:n,size:i});if(i=i.map(g=>g/2),s>i[0]-hd||s>i[1]-hd)throw new Error("roundRadius must be smaller than the radius of all dimensions");const o=Math.floor(r/4),a=ot.add(ot.create(),n,[i[0]-s,i[1]-s]),c=ot.add(ot.create(),n,[s-i[0],i[1]-s]),l=ot.add(ot.create(),n,[s-i[0],s-i[1]]),f=ot.add(ot.create(),n,[i[0]-s,s-i[1]]),u=[],h=[],d=[],_=[];for(let g=0;g<=o;g++){const m=Ro/4*g/o,p=ot.fromAngleRadians(ot.create(),m);ot.scale(p,p,s),u.push(ot.add(ot.create(),a,p)),ot.rotate(p,p,ot.create(),Ro/4),h.push(ot.add(ot.create(),c,p)),ot.rotate(p,p,ot.create(),Ro/4),d.push(ot.add(ot.create(),l,p)),ot.rotate(p,p,ot.create(),Ro/4),_.push(ot.add(ot.create(),f,p))}return dd.fromPoints(u.concat(h,d,_))};var O3=F3;const B3=gg,{isGTE:z3}=Mt,V3=t=>{const e={center:[0,0,0],radius:1,segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]};let{center:n,radius:i,segments:s,axes:r}=Object.assign({},e,t);if(!z3(i,0))throw new Error("radius must be positive");return i=[i,i,i],B3({center:n,radius:i,segments:s,axes:r})};var H3=V3;const G3=tf,{isGTE:$3}=Mt,k3=t=>{const e={center:[0,0],size:2};let{center:n,size:i}=Object.assign({},e,t);if(!$3(i,0))throw new Error("size must be positive");return i=[i,i],G3({center:n,size:i})};var W3=k3;const{TAU:vg}=Qe,gr=We,X3=At,{isGT:q3,isGTE:Co,isNumberArray:Y3}=Mt,j3=(t,e)=>t>0&&e>1&&e{const s=vg/t,r=[];for(let o=0;o{const e={center:[0,0],vertices:5,outerRadius:1,innerRadius:0,density:2,startAngle:0};let{center:n,vertices:i,outerRadius:s,innerRadius:r,density:o,startAngle:a}=Object.assign({},e,t);if(!Y3(n,2))throw new Error("center must be an array of X and Y values");if(!Co(i,2))throw new Error("vertices must be two or more");if(!q3(s,0))throw new Error("outerRadius must be greater than zero");if(!Co(r,0))throw new Error("innerRadius must be greater than zero");if(!Co(a,0))throw new Error("startAngle must be greater than zero");if(i=Math.floor(i),o=Math.floor(o),a=a%vg,r===0){if(!Co(o,2))throw new Error("density must be two or more");r=s*j3(i,o)}const c=gr.clone(n),l=gd(i,s,a,c),f=gd(i,r,a+Math.PI/i,c),u=[];for(let h=0;ht.reduce((e,n)=>Array.isArray(n)?e.concat(xg(n)):e.concat(n),[]);var ts=xg;const J3=ts,_d=ut,vd=Zs,xd=At,Md=Rt,Ed=li,Q3=(t,...e)=>{const n={origin:[0,0,0],normal:[0,0,1]},{origin:i,normal:s}=Object.assign({},n,t);if(e=J3(e),e.length===0)throw new Error("wrong number of arguments");const r=vd.fromNormalAndPoint(vd.create(),s,i);if(Number.isNaN(r[0]))throw new Error("the given origin and normal do not define a proper plane");const o=_d.mirrorByPlane(_d.create(),r),a=e.map(c=>Ed.isA(c)?Ed.transform(o,c):xd.isA(c)?xd.transform(o,c):Md.isA(c)?Md.transform(o,c):c);return a.length===1?a[0]:a},eD=(...t)=>Q3({normal:[1,0,0]},t);var tD={mirrorX:eD};const Sd=Zs,Fi=Ge,nD=t=>{const e=t.edges;if(e.length<3)throw new Error("slices must have 3 or more edges to calculate a plane");const n=e.reduce((o,a)=>Fi.add(Fi.create(),o,a[0]),Fi.create());Fi.scale(n,n,1/e.length);let i,s=0;e.forEach(o=>{if(!Fi.equals(o[0],o[1])){const a=Fi.squaredDistance(n,o[0]);a>s&&(i=o,s=a)}});const r=e.find(o=>Fi.equals(o[1],i[0]));return Sd.fromPoints(Sd.create(),r[0],i[0],i[1])};var Mg=nD;const iD=t=>(t||(t=[]),{edges:t});var ns=iD;const sD=ns,yd=Ge,rD=(...t)=>{let e,n;return t.length===1?(e=sD(),n=t[0]):(e=t[0],n=t[1]),e.edges=n.edges.map(i=>[yd.clone(i[0]),yd.clone(i[1])]),e};var oD=rD;const aD=Ge,cD=(t,e)=>{const n=t.edges,i=e.edges;return n.length!==i.length?!1:n.reduce((r,o,a)=>{const c=i[a],l=aD.squaredDistance(o[0],c[0]);return r&&l{if(!Array.isArray(t))throw new Error("the given points must be an array");if(t.length<3)throw new Error("the given points must contain THREE or more points");const e=[];let n=t[t.length-1];return t.forEach(i=>{i.length===2&&e.push([Po.fromVec2(Po.create(),n),Po.fromVec2(Po.create(),i)]),i.length===3&&e.push([n,i]),n=i}),fD(e)};var hD=uD;const Lo=Ge,dD=ns,pD=t=>{if(!Array.isArray(t))throw new Error("the given sides must be an array");const e=[];return t.forEach(n=>{e.push([Lo.fromVec2(Lo.create(),n[0]),Lo.fromVec2(Lo.create(),n[1])])}),dD(e)};var mD=pD;const gD=t=>!!(t&&typeof t=="object"&&"edges"in t&&Array.isArray(t.edges));var _D=gD;const vD=ns,xD=(...t)=>{let e,n;return t.length===1?(e=vD(),n=t[0]):(e=t[0],n=t[1]),e.edges=n.edges.map(i=>[i[1],i[0]]),e};var MD=xD;const ED=t=>t.edges;var SD=ED;const yD=(t,e)=>{let n,i,s,r,o,a=1;do{i=t,t=null;let c=null;for(o=0;i;){o++,s=i;let l=0;for(n=0;n0||f>0&&s;)l!==0&&(f===0||!s||e(i)<=e(s))?(r=i,i=i.nextZ,l--):(r=s,s=s.nextZ,f--),c?c.nextZ=r:t=r,r.prevZ=c,c=r;i=s}c.nextZ=null,a*=2}while(o>1);return t};var bD=yD;const TD=bD;let Eg=class{constructor(e,n,i){this.i=e,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}};const wD=(t,e,n,i)=>{const s=new Eg(t,e,n);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s},AD=t=>{t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)};var Sg={Node:Eg,insertNode:wD,removeNode:AD,sortLinked:TD};const RD=(t,e,n,i,s,r,o,a)=>(s-o)*(e-a)-(t-o)*(r-a)>=0&&(t-o)*(i-a)-(n-o)*(e-a)>=0&&(n-o)*(r-a)-(s-o)*(i-a)>=0,CD=(t,e,n)=>(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);var nf={area:CD,pointInTriangle:RD};const{Node:bd,insertNode:Td,removeNode:Ko}=Sg,{area:jt}=nf,PD=(t,e,n,i,s)=>{let r;if(s===FD(t,e,n,i)>0)for(let o=e;o=e;o-=i)r=Td(o,t[o],t[o+1],r);return r&&Ea(r,r.next)&&(Ko(r),r=r.next),r},yg=(t,e)=>{if(!t)return t;e||(e=t);let n=t,i;do if(i=!1,!n.steiner&&(Ea(n,n.next)||jt(n.prev,n,n.next)===0)){if(Ko(n),n=e=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==e);return e},LD=(t,e,n)=>{let i=t;do{const s=i.prev,r=i.next.next;!Ea(s,r)&&bg(s,i,i.next,r)&&zr(s,r)&&zr(r,s)&&(e.push(s.i/n),e.push(i.i/n),e.push(r.i/n),Ko(i),Ko(i.next),i=t=r),i=i.next}while(i!==t);return yg(i)},DD=(t,e)=>{let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&bg(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1},zr=(t,e)=>jt(t.prev,t,t.next)<0?jt(t,e,t.next)>=0&&jt(t,t.prev,e)>=0:jt(t,e,t.prev)<0||jt(t,t.next,e)<0,UD=(t,e)=>{let n=t,i=!1;const s=(t.x+e.x)/2,r=(t.y+e.y)/2;do n.y>r!=n.next.y>r&&n.next.y!==n.y&&s<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==t);return i},ID=(t,e)=>{const n=new bd(t.i,t.x,t.y),i=new bd(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,n.next=s,s.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i},ND=(t,e)=>t.next.i!==e.i&&t.prev.i!==e.i&&!DD(t,e)&&(zr(t,e)&&zr(e,t)&&UD(t,e)&&(jt(t.prev,t,e.prev)||jt(t,e.prev,e))||Ea(t,e)&&jt(t.prev,t,t.next)>0&&jt(e.prev,e,e.next)>0),bg=(t,e,n,i)=>{const s=Math.sign(jt(t,e,n)),r=Math.sign(jt(t,e,i)),o=Math.sign(jt(n,i,t)),a=Math.sign(jt(n,i,e));return!!(s!==r&&o!==a||s===0&&Do(t,n,e)||r===0&&Do(t,i,e)||o===0&&Do(n,t,i)||a===0&&Do(n,e,i))},Do=(t,e,n)=>e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y),FD=(t,e,n,i)=>{let s=0;for(let r=e,o=n-i;rt.x===e.x&&t.y===e.y;var Tg={cureLocalIntersections:LD,filterPoints:yg,isValidDiagonal:ND,linkedPolygon:PD,locallyInside:zr,splitPolygon:ID};const{filterPoints:dl,linkedPolygon:OD,locallyInside:BD,splitPolygon:zD}=Tg,{area:wd,pointInTriangle:VD}=nf,HD=(t,e,n,i)=>{const s=[];for(let r=0,o=e.length;rr.x-o.x);for(let r=0;r{const n=$D(t,e);if(!n)return e;const i=zD(n,t),s=dl(n,n.next);return dl(i,i.next),e===n?s:e},$D=(t,e)=>{let n=e;const i=t.x,s=t.y;let r=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){const u=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(u<=i&&u>r){if(r=u,u===i){if(s===n.y)return n;if(s===n.next.y)return n.next}o=n.x=n.x&&n.x>=c&&i!==n.x&&VD(so.x||n.x===o.x&&kD(o,n)))&&(o=n,f=u)}n=n.next}while(n!==a);return o},kD=(t,e)=>wd(t.prev,t,e.prev)<0&&wd(e.next,t,t.next)<0,WD=t=>{let e=t,n=t;do(e.x{const i=e&&e.length,s=i?e[0]*n:t.length;let r=JD(t,0,s,n,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,f,u;if(i&&(r=qD(t,e,r,n)),t.length>80*n){a=l=t[0],c=f=t[1];for(let h=n;hl&&(l=d),_>f&&(f=_)}u=Math.max(l-a,f-c),u=u!==0?1/u:0}return Vr(r,o,n,a,c,u),o},Vr=(t,e,n,i,s,r,o)=>{if(!t)return;!o&&r&&sU(t,i,s,r);let a=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,r?nU(t,i,s,r):tU(t)){e.push(c.i/n),e.push(t.i/n),e.push(l.i/n),YD(t),t=l.next,a=l.next;continue}if(t=l,t===a){o?o===1?(t=ZD(Jo(t),e,n),Vr(t,e,n,i,s,r,2)):o===2&&iU(t,e,n,i,s,r):Vr(Jo(t),e,n,i,s,r,1);break}}},tU=t=>{const e=t.prev,n=t,i=t.next;if(Hi(e,n,i)>=0)return!1;let s=t.next.next;for(;s!==t.prev;){if(_r(e.x,e.y,n.x,n.y,i.x,i.y,s.x,s.y)&&Hi(s.prev,s,s.next)>=0)return!1;s=s.next}return!0},nU=(t,e,n,i)=>{const s=t.prev,r=t,o=t.next;if(Hi(s,r,o)>=0)return!1;const a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,f=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,u=pl(a,c,e,n,i),h=pl(l,f,e,n,i);let d=t.prevZ,_=t.nextZ;for(;d&&d.z>=u&&_&&_.z<=h;){if(d!==t.prev&&d!==t.next&&_r(s.x,s.y,r.x,r.y,o.x,o.y,d.x,d.y)&&Hi(d.prev,d,d.next)>=0||(d=d.prevZ,_!==t.prev&&_!==t.next&&_r(s.x,s.y,r.x,r.y,o.x,o.y,_.x,_.y)&&Hi(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&_r(s.x,s.y,r.x,r.y,o.x,o.y,d.x,d.y)&&Hi(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;_&&_.z<=h;){if(_!==t.prev&&_!==t.next&&_r(s.x,s.y,r.x,r.y,o.x,o.y,_.x,_.y)&&Hi(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0},iU=(t,e,n,i,s,r)=>{let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&KD(o,a)){let c=QD(o,a);o=Jo(o,o.next),c=Jo(c,c.next),Vr(o,e,n,i,s,r),Vr(c,e,n,i,s,r);return}a=a.next}o=o.next}while(o!==t)},sU=(t,e,n,i)=>{let s=t;do s.z===null&&(s.z=pl(s.x,s.y,e,n,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,jD(s,r=>r.z)},pl=(t,e,n,i,s)=>(t=32767*(t-n)*s,e=32767*(e-i)*s,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1);var rU=eU;const{NEPS:Nc}=Qe,oU=(t,e)=>Math.abs(t[0]-e[0])<=Nc&&Math.abs(t[1]-e[1])<=Nc&&Math.abs(t[2]-e[2])<=Nc;var aU=oU;const cU=t=>{let e=0;for(let n=0;n{let i=n-t[1],s=e[1]-t[1];s<0&&(i=-i,s=-s);let r;return i<=0?r=0:i>=s?r=1:s<1e-10?r=.5:r=i/s,t[0]+r*(e[0]-t[0])};var fU=lU;const uU=(t,e,n,i,s,r)=>{const a=1/(t*i-e*n);let c=s*i-e*r,l=-s*n+t*r;return c*=a,l*=a,[c,l]};var hU=uU,Ag={area:wg,solve2Linear:hU};const dU=wg,pU=t=>dU(t.vertices);var mU=pU;const gU=t=>((t===void 0||t.length<3)&&(t=[]),{vertices:t});var _U=gU;const vU=_U,xU=t=>{const e=t.vertices.slice().reverse();return vU(e)};var MU=xU;const EU=mU,SU=MU,yU=(t,e)=>{if(t.length===0)return 0;const n=e.vertices;return n.length<3?0:(EU(e)<0&&(e=SU(e)),t.reduce((s,r)=>s+bU(r,n),0)===t.length?1:0)},bU=(t,e)=>{const n=e.length,i=t[0],s=t[1];let r=e[n-1],o=e[0],a=r[1]>s,c=0,l=0;for(let f=n+1;--f;){const u=o[1]>s;if(a!==u){const h=r[0]>i,d=o[0]>i;(h&&d||o[0]-(o[1]-s)*(r[0]-o[0])/(r[1]-o[1])>=i)&&(c=!c)}a=u,r=o,o=e[++l]}return c};var TU=yU,wU={arePointsInside:TU};const{area:AU}=Ag,{toOutlines:RU}=At,{arePointsInside:CU}=wU,PU=t=>{const e=RU(t),n=[],i=[];e.forEach((o,a)=>{const c=AU(o);c<0?i.push(a):c>0&&n.push(a)});const s=[],r=[];return n.forEach((o,a)=>{const c=e[o];s[a]=[],i.forEach((l,f)=>{const u=e[l];CU([u[0]],{vertices:c})&&(s[a].push(l),r[f]||(r[f]=[]),r[f].push(a))})}),i.forEach((o,a)=>{if(r[a]&&r[a].length>1){const c=LU(r[a],l=>s[l].length);r[a].forEach((l,f)=>{f!==c&&(s[l]=s[l].filter(u=>u!==o))})}}),s.map((o,a)=>({solid:e[n[a]],holes:o.map(c=>e[c])}))},LU=(t,e)=>{let n,i;return t.forEach((s,r)=>{const o=e(s);(i===void 0||oo.map(a=>this.to2D(a))),r=UU.create(s);this.roots=FU(r)}to2D(e){const n=IU.fromValues(wt.dot(e,this.u),wt.dot(e,this.v));return this.basisMap.set(n,e),n}to3D(e){const n=this.basisMap.get(e);if(n)return n;{console.log("Warning: point not in original slice");const i=wt.scale(wt.create(),this.u,e[0]),s=wt.scale(wt.create(),this.v,e[1]),r=wt.scale(wt.create(),Ad,Ad[3]),o=wt.add(i,i,r);return wt.add(s,s,o)}}};var BU=OU;const zU=rt,VU=rU,HU=BU,GU=t=>{const e=new HU(t),n=[];return e.roots.forEach(({solid:i,holes:s})=>{let r=i.length;const o=[];s.forEach((u,h)=>{o.push(r),r+=u.length});const a=[i,...s].flat(),c=a.flat(),l=u=>e.to3D(a[u]),f=VU(c,o);for(let u=0;ut.reduce((e,n)=>e+=`[${Rd.toString(n[0])}, ${Rd.toString(n[1])}], `,""),WU=t=>`[${kU(t.edges)}]`;var XU=WU;const Uo=Ge,qU=ns,YU=(t,e)=>{const n=e.edges.map(i=>[Uo.transform(Uo.create(),i[0],t),Uo.transform(Uo.create(),i[1],t)]);return qU(n)};var jU=YU,sf={calculatePlane:Mg,clone:oD,create:ns,equals:lD,fromPoints:hD,fromSides:mD,isA:_D,reverse:MD,toEdges:SD,toPolygons:$U,toString:XU,transform:jU};const Cd=Ge,ZU=ns,KU=t=>{if(!t.edges)return t;let e=t.edges;const n=new Map,i=new Map;e=e.filter(o=>!Cd.equals(o[0],o[1])),e.forEach(o=>{const a=o[0].toString(),c=o[1].toString();n.set(a,o[0]),n.set(c,o[1]),i.set(a,(i.get(a)||0)+1),i.set(c,(i.get(c)||0)-1)});const s=[],r=[];return i.forEach((o,a)=>{o<0&&s.push(a),o>0&&r.push(a)}),s.forEach(o=>{const a=n.get(o);let c=1/0,l;r.forEach(f=>{const u=n.get(f),h=Cd.distance(a,u);hf[0].toString()===o?[l,f[1]]:f[1].toString()===o?[f[0],l]:f)}),ZU(e)};var JU=KU;const{EPS:Pd}=Qe,Ss=Ge,Io=rt,Ld=sf,ml=(t,e)=>t===e?t:tt*e/ml(t,e),Dd=(t,e)=>{const n=t/e.length;if(n===1)return e;const i=Ss.fromValues(n,n,n),s=[];return e.forEach(r=>{const o=Ss.subtract(Ss.create(),r[1],r[0]);Ss.divide(o,o,i);let a=r[0];for(let c=1;c<=n;++c){const l=Ss.add(Ss.create(),a,o);s.push([a,l]),a=l}}),s},Ud=Pd*Pd/2*Math.sin(Math.PI/3),eI=(t,e)=>{let n=Ld.toEdges(t),i=Ld.toEdges(e);if(n.length!==i.length){const r=QU(n.length,i.length);r!==n.length&&(n=Dd(r,n)),r!==i.length&&(i=Dd(r,i))}const s=[];return n.forEach((r,o)=>{const a=i[o],c=Io.create([r[0],r[1],a[1]]),l=Io.measureArea(c);Number.isFinite(l)&&l>Ud&&s.push(c);const f=Io.create([r[0],a[1],a[0]]),u=Io.measureArea(f);Number.isFinite(u)&&u>Ud&&s.push(f)}),s};var tI=eI;const Id=ut,Nd=At,nI=Rt,gl=rt,Si=sf,iI=JU,Fd=tI,sI=(t,e,n)=>{let i=null;return Nd.isA(n)&&(i=Si.fromSides(Nd.toSides(n))),gl.isA(n)&&(i=Si.fromPoints(gl.toPoints(n))),t===0||t===1?Si.transform(Id.fromTranslation(Id.create(),[0,0,t]),i):null},rI=(t,e)=>{const n={numberOfSlices:2,capStart:!0,capEnd:!0,close:!1,repair:!0,callback:sI},{numberOfSlices:i,capStart:s,capEnd:r,close:o,repair:a,callback:c}=Object.assign({},n,t);if(i<2)throw new Error("numberOfSlices must be 2 or more");a&&(e=iI(e));const l=i-1;let f=null,u=null,h=null,d=[];for(let _=0;_{const n={segments:12,startAngle:0,angle:nn,overflow:"cap"};let{segments:i,startAngle:s,angle:r,overflow:o}=Object.assign({},n,t);if(i<3)throw new Error("segments must be greater then 3");s=Math.abs(s)>nn?s%nn:s,r=Math.abs(r)>nn?r%nn:r;let a=s+r;if(a=Math.abs(a)>nn?a%nn:a,ai*y&&i++}let l=No.toSides(e);if(l.length===0)throw new Error("the given geometry cannot be empty");const f=l.filter(y=>y[0][0]<0),u=l.filter(y=>y[0][0]>=0);f.length>0&&u.length>0&&o==="cap"&&(f.length>u.length?(l=l.map(y=>{let E=y[0],v=y[1];return E=[Math.min(E[0],0),E[1]],v=[Math.min(v[0],0),v[1]],[E,v]}),e=No.create(l),e=aI(e)):u.length>=f.length&&(l=l.map(y=>{let E=y[0],v=y[1];return E=[Math.max(E[0],0),E[1]],v=[Math.max(v[0],0),v[1]],[E,v]}),e=No.create(l)));const d=c/i,_=Math.abs(c){let M=d*E+s;return c===nn&&E===i&&(M=s),cr.multiply(m,cr.fromZRotation(m,M),cr.fromXRotation(cr.create(),nn/4)),Fc.transform(m,v)};return t={numberOfSlices:i+1,capStart:_,capEnd:_,close:!_,callback:p},cI(t,g)};var fI=lI;const uI=ts,Od=ut,Bd=At,zd=Rt,Vd=li,hI=(t,...e)=>{if(!Array.isArray(t))throw new Error("angles must be an array");if(e=uI(e),e.length===0)throw new Error("wrong number of arguments");for(t=t.slice();t.length<3;)t.push(0);const n=t[2],i=t[1],s=t[0],r=Od.fromTaitBryanRotation(Od.create(),n,i,s),o=e.map(a=>Vd.isA(a)?Vd.transform(r,a):Bd.isA(a)?Bd.transform(r,a):zd.isA(a)?zd.transform(r,a):a);return o.length===1?o[0]:o};var dI={rotate:hI};const pI=ts,Hd=ut,Gd=At,$d=Rt,kd=li,Sa=(t,...e)=>{if(!Array.isArray(t))throw new Error("offset must be an array");if(e=pI(e),e.length===0)throw new Error("wrong number of arguments");for(t=t.slice();t.length<3;)t.push(0);const n=Hd.fromTranslation(Hd.create(),t),i=e.map(s=>kd.isA(s)?kd.transform(n,s):Gd.isA(s)?Gd.transform(n,s):$d.isA(s)?$d.transform(n,s):s);return i.length===1?i[0]:i},mI=(t,...e)=>Sa([t,0,0],e),gI=(t,...e)=>Sa([0,t,0],e),_I=(t,...e)=>Sa([0,0,t],e);var vr={translate:Sa,translateX:mI,translateY:gI,translateZ:_I};const{TAU:vI}=Qe,xI=fI,{rotate:MI}=dI,{translate:EI}=vr,SI=Jm,{isGT:Oc,isGTE:Bc}=Mt,yI=t=>{const e={innerRadius:1,innerSegments:32,outerRadius:4,outerSegments:32,innerRotation:0,startAngle:0,outerRotation:vI},{innerRadius:n,innerSegments:i,outerRadius:s,outerSegments:r,innerRotation:o,startAngle:a,outerRotation:c}=Object.assign({},e,t);if(!Oc(n,0))throw new Error("innerRadius must be greater than zero");if(!Bc(i,3))throw new Error("innerSegments must be three or more");if(!Oc(s,0))throw new Error("outerRadius must be greater than zero");if(!Bc(r,3))throw new Error("outerSegments must be three or more");if(!Bc(a,0))throw new Error("startAngle must be positive");if(!Oc(c,0))throw new Error("outerRotation must be greater than zero");if(n>=s)throw new Error("inner circle is too large to rotate about the outer circle");let l=SI({radius:n,segments:i});return o!==0&&(l=MI([0,0,o],l)),l=EI([s,0],l),xI({startAngle:a,angle:c,segments:r},l)};var bI=yI;const{NEPS:Gs}=Qe,lr=We,TI=At,{isNumberArray:wI}=Mt,_l=(t,e,n)=>Math.acos((t*t+e*e-n*n)/(2*t*e)),AI=(t,e,n)=>e>Gs?Math.sqrt(t*t+n*n-2*t*n*Math.cos(e)):Math.sqrt((t-n)*(t-n)+t*n*e*e*(1-e*e/12)),RI=t=>{if(Math.abs(t[0]+t[1]+t[2]-Math.PI)>Gs)throw new Error("AAA triangles require angles that sum to PI");const n=t[0],i=t[1],s=Math.PI-n-i,r=1,o=r/Math.sin(s)*Math.sin(n),a=r/Math.sin(s)*Math.sin(i);return Ks(n,i,s,o,a,r)},CI=t=>{const e=t[0],n=t[1],i=Math.PI+Gs-e-n;if(i{const e=t[0],n=t[2],i=Math.PI+Gs-e-n;if(i{const e=t[0],n=t[1],i=t[2],s=AI(e,n,i),r=_l(s,e,i),o=Math.PI-r-n;return Ks(r,n,o,i,s,e)},DI=t=>{const e=t[0],n=t[1],i=t[2],s=Math.asin(n*Math.sin(i)/e),r=Math.PI-s-i,o=e/Math.sin(i)*Math.sin(r);return Ks(s,r,i,n,o,e)},UI=t=>{const e=t[1],n=t[2],i=t[0];if(e+n<=i||n+i<=e||i+e<=n)throw new Error("SSS triangle is incorrect, as the longest side is longer than the sum of the other sides");const s=_l(n,i,e),r=_l(i,e,n),o=Math.PI-s-r;return Ks(s,r,o,e,n,i)},Ks=(t,e,n,i,s,r)=>{const o=lr.fromValues(0,0),a=lr.fromValues(r,0),c=lr.fromValues(i,0);return lr.add(c,lr.rotate(c,c,[0,0],Math.PI-e),a),TI.fromPoints([o,a,c])},II=t=>{const e={type:"SSS",values:[1,1,1]};let{type:n,values:i}=Object.assign({},e,t);if(typeof n!="string")throw new Error("triangle type must be a string");if(n=n.toUpperCase(),!((n[0]==="A"||n[0]==="S")&&(n[1]==="A"||n[1]==="S")&&(n[2]==="A"||n[2]==="S")))throw new Error("triangle type must contain three letters; A or S");if(!wI(i,3))throw new Error("triangle values must contain three values");if(!i.every(s=>s>0))throw new Error("triangle values must be greater than zero");switch(n){case"AAA":return RI(i);case"AAS":return CI(i);case"ASA":return PI(i);case"SAS":return LI(i);case"SSA":return DI(i);case"SSS":return UI(i);default:throw new Error("invalid triangle type, try again")}};var NI=II,Fo={arc:eR,circle:Jm,cube:JL,cuboid:ef,cylinder:mg,cylinderElliptic:pg,ellipse:Km,ellipsoid:gg,geodesicSphere:g3,line:x3,polygon:E3,polyhedron:_g,rectangle:tf,roundedCuboid:R3,roundedCylinder:I3,roundedRectangle:O3,sphere:H3,square:W3,star:K3,torus:bI,triangle:NI};function FI({width:t,length:e,safety:n=0}){const o=t+n,a=e+n,c=vr.translate([0,a/2+2.5/2,0],Fo.cuboid({size:[o+5,2.5,10]})),l=vr.translate([0,-a/2-2.5/2,0],Fo.cuboid({size:[o+5,2.5,10]})),f=vr.translate([o/2+2.5/2,0,0],Fo.cuboid({size:[2.5,a+5,10]})),u=vr.translate([-o/2-2.5/2,0,0],Fo.cuboid({size:[2.5,a+5,10]}));return[c,l,f,u]}var Rg={geom2:At,geom3:Rt,path2:li,poly3:rt};const OI=()=>[0,1,0];var rf=OI;const BI=rf,zI=t=>{const e=BI();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e};var VI=zI;const zc=We,HI=t=>{const e=zc.normal(zc.create(),t);return zc.negate(e,e),e};var of=HI;const Wd=We,GI=t=>Wd.scale(Wd.create(),t,t[2]);var ya=GI;const fr=We,$I=of,kI=ya,WI=(t,e)=>{const n=kI(t),i=$I(t),s=fr.subtract(fr.create(),e,n),r=fr.dot(s,i);return fr.scale(s,i,r),fr.add(s,s,n),s};var XI=WI;const qI=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t);var Cg=qI;const YI=We,jI=(t,e)=>{let n=YI.dot(e,t);return n=Math.abs(n-t[2]),n};var ZI=jI;const KI=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2];var JI=KI;const ur=We,QI=(t,e,n)=>{const i=ur.subtract(ur.create(),n,e);ur.normal(i,i),ur.normalize(i,i);const s=ur.dot(e,i);return t[0]=i[0],t[1]=i[1],t[2]=s,t};var Pg=QI;const eN=rf,tN=(t,e,n)=>{const i=eN();return i[0]=t,i[1]=e,i[2]=n,i};var Lg=tN;const nN=We,{solve2Linear:iN}=Ag,sN=(t,e)=>{const n=iN(t[0],t[1],e[0],e[1],t[2],e[2]);return nN.clone(n)};var rN=sN;const Xd=We,oN=Cg,aN=Lg,cN=(t,e)=>{const n=Xd.negate(Xd.create(),e),i=-e[2];return oN(t,aN(n[0],n[1],i))};var lN=cN;const fN=t=>`line2: (${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)})`;var uN=fN;const qd=We,hN=Pg,dN=ya,pN=of,mN=(t,e,n)=>{const i=dN(e),s=pN(e);return qd.transform(i,i,n),qd.transform(s,s,n),hN(t,i,s)};var gN=mN;const _N=ya,vN=(t,e)=>{let n=(t[2]-t[1]*e)/t[0];return Number.isNaN(n)&&(n=_N(t)[0]),n};var xN=vN,MN={clone:VI,closestPoint:XI,copy:Cg,create:rf,direction:of,distanceToPoint:ZI,equals:JI,fromPoints:Pg,fromValues:Lg,intersectPointOfLines:rN,origin:ya,reverse:lN,toString:uN,transform:gN,xAtY:xN};const EN=ts,In=We,hr=Ge,Dg=At,Ug=Rt,Ig=li,Yd=rt,$s=new WeakMap,SN=t=>{let e=$s.get(t);if(e)return e;const n=Ig.toPoints(t);let i;n.length===0?i=In.create():i=In.clone(n[0]);let s=In.clone(i);return n.forEach(r=>{In.min(i,i,r),In.max(s,s,r)}),i=[i[0],i[1],0],s=[s[0],s[1],0],e=[i,s],$s.set(t,e),e},yN=t=>{let e=$s.get(t);if(e)return e;const n=Dg.toPoints(t);let i;n.length===0?i=In.create():i=In.clone(n[0]);let s=In.clone(i);return n.forEach(r=>{In.min(i,i,r),In.max(s,s,r)}),i=[i[0],i[1],0],s=[s[0],s[1],0],e=[i,s],$s.set(t,e),e},bN=t=>{let e=$s.get(t);if(e)return e;const n=Ug.toPolygons(t);let i=hr.create();if(n.length>0){const r=Yd.toPoints(n[0]);hr.copy(i,r[0])}let s=hr.clone(i);return n.forEach(r=>{Yd.toPoints(r).forEach(o=>{hr.min(i,i,o),hr.max(s,s,o)})}),i=[i[0],i[1],i[2]],s=[s[0],s[1],s[2]],e=[i,s],$s.set(t,e),e},TN=(...t)=>{if(t=EN(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>Ig.isA(n)?SN(n):Dg.isA(n)?yN(n):Ug.isA(n)?bN(n):[[0,0,0],[0,0,0]]);return e.length===1?e[0]:e};var wN=TN;const{EPS:AN}=Qe,RN=(t,e)=>{let n=0;for(let i=0;iaf(cf(t),2),NN=t=>af(cf(t),2),FN=t=>af(cf(t),3),ON=(...t)=>{if(t=PN(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>UN.isA(n)?IN(n):LN.isA(n)?NN(n):DN.isA(n)?FN(n):0);return e.length===1?e[0]:e};var Ng=ON;const BN=(t,e)=>t-e;var zN=BN;const VN=(t,e,n)=>{let i=0,s=t.length;for(;s>i;){const r=Math.floor((i+s)/2),o=t[r];n(e,o)>0?i=r+1:s=r}t.splice(i,0,e)};var HN=VN,GN={fnNumberSort:zN,insertSorted:HN};const jd=ut,$N=We,mt=Ge,Fg=function(t,e){arguments.length<2&&(e=mt.orthogonal(mt.create(),t)),this.v=mt.normalize(mt.create(),mt.cross(mt.create(),t,e)),this.u=mt.cross(mt.create(),this.v,t),this.plane=t,this.planeorigin=mt.scale(mt.create(),t,t[3])};Fg.prototype={getProjectionMatrix:function(){return jd.fromValues(this.u[0],this.v[0],this.plane[0],0,this.u[1],this.v[1],this.plane[1],0,this.u[2],this.v[2],this.plane[2],0,0,0,-this.plane[3],1)},getInverseProjectionMatrix:function(){const t=mt.scale(mt.create(),this.plane,this.plane[3]);return jd.fromValues(this.u[0],this.u[1],this.u[2],0,this.v[0],this.v[1],this.v[2],0,this.plane[0],this.plane[1],this.plane[2],0,t[0],t[1],t[2],1)},to2D:function(t){return $N.fromValues(mt.dot(t,this.u),mt.dot(t,this.v))},to3D:function(t){const e=mt.scale(mt.create(),this.u,t[0]),n=mt.scale(mt.create(),this.v,t[1]),i=mt.add(e,e,this.planeorigin);return mt.add(n,n,i)}};var kN=Fg;const{EPS:Zn}=Qe,xi=MN,En=We,WN=kN,ys=fU,{insertSorted:XN,fnNumberSort:qN}=GN,Zd=rt,YN=t=>{if(t.length<2)return t;const e=[],n=t.length,i=Zd.plane(t[0]),s=new WN(i),r=[],o=[],a=new Map,c=new Map,l=new Map,f=10/Zn;for(let _=0;_0){let E,v;for(let M=0;Mv)&&(v=x);let T=c.get(x);T||(T={},c.set(x,T)),T[_]=!0}if(E>=v)m=[],p=0,y=-1;else{let M=a.get(E);M||(M=[],a.set(E,M)),M.push(_)}}m.reverse(),y=p-y-1,r.push(m),o.push(y)}const u=[];c.forEach((_,g)=>u.push(g)),u.sort(qN);let h=[],d=[];for(let _=0;_=w&&(I=0),b[I][1]!==m)break;D=I}let T=x-1;if(T<0&&(T=w-1),b[T][1]===m&&(x=T),D!==v.leftvertexindex&&D===x)h.splice(E,1),--E;else{v.leftvertexindex=D,v.rightvertexindex=x,v.topleft=b[D],v.topright=b[x];let I=D+1;I>=w&&(I=0),v.bottomleft=b[I];let B=x-1;B<0&&(B=w-1),v.bottomright=b[B]}}}let y;if(_>=u.length-1)h=[],y=null;else{y=Number(u[_+1]);const E=.5*(m+y),v=a.get(m);for(const M in v){const b=v[M],w=r[b],D=w.length,x=o[b];let T=x;for(;;){let z=T+1;if(z>=D&&(z=0),w[z][1]!==m||z===x)break;T=z}let I=x;for(;;){let z=I-1;if(z<0&&(z=D-1),w[z][1]!==m||z===T)break;I=z}let B=T+1;B>=D&&(B=0);let U=I-1;U<0&&(U=D-1);const F={polygonindex:b,leftvertexindex:T,rightvertexindex:I,topleft:w[T],topright:w[I],bottomleft:w[B],bottomright:w[U]};XN(h,F,(z,H)=>{const $=ys(z.topleft,z.bottomleft,E),k=ys(H.topleft,H.bottomleft,E);return $>k?1:$0){const I=g[g.length-1],B=En.distance(T.topleft,I.topright),U=En.distance(T.bottomleft,I.bottomright);B0){const E=new Set,v=new Set;for(let M=0;M=0,k=H||F>=0;$&&k&&(b.outpolygon=D.outpolygon,b.leftlinecontinues=z,b.rightlinecontinues=H,E.add(w));break}}}for(let M=0;MZn&&b.outpolygon.leftpoints.push(b.bottomleft),b.outpolygon.leftpoints.reverse();const D=b.outpolygon.rightpoints.concat(b.outpolygon.leftpoints).map(T=>s.to3D(T)),x=Zd.fromPointsAndPlane(D,i);x.vertices.length&&e.push(x)}}for(let E=0;EZn&&v.outpolygon.rightpoints.push(v.topright))}d=g}return e};var jN=YN;const Kd=Rt,ZN=rt,{NEPS:KN}=Qe,JN=jN,QN=t=>{if(t.isRetesselated)return t;const e=Kd.toPolygons(t).map((r,o)=>({vertices:r.vertices,plane:ZN.plane(r),index:o})),n=eF(e),i=[];n.forEach(r=>{if(Array.isArray(r)){const o=JN(r);i.push(...o)}else i.push(r)});const s=Kd.create(i);return s.isRetesselated=!0,s},eF=t=>{let e=[t];const n=[];for(let s=3;s>=0;s--){const r=[],o=s===3?15e-9:KN;e.forEach(a=>{a.sort(tF(s,o));let c=0;for(let l=1;lo&&(l-c===1?n.push(a[c]):r.push(a.slice(c,l)),c=l);a.length-c===1?n.push(a[c]):r.push(a.slice(c))}),e=r}const i=[];return e.forEach(s=>{s[0]&&(i[s[0].index]=s)}),n.forEach(s=>{i[s.index]=s}),i},tF=(t,e)=>(n,i)=>n.plane[t]-i.plane[t]>e?1:i.plane[t]-n.plane[t]>e?-1:0;var nF=QN;const Vc=Ge,Og=rt,iF=(t,e)=>{const n=Math.abs(Og.measureArea(e));return Number.isFinite(n)&&n>t},sF=(t,e)=>{let n=e.map(s=>{const r=s.vertices.map(c=>Vc.snap(Vc.create(),c,t)),o=[];for(let c=0;ciF(i,s)),n};var Bg=sF;const rF=aU,Rs=Ge,Qo=rt,oF=t=>{const e=Qo.toPoints(t),n=[];for(let i=0;i{const n=`${e.v1}:${e.v2}`;t.set(n,e)},Hc=(t,e)=>{const n=`${e.v1}:${e.v2}`;t.delete(n)},cF=(t,e)=>{const n=`${e.v2}:${e.v1}`;return t.get(n)},lF=(t,e,n)=>{let i=t.prev.v1,s=t.prev.v2,r=e.next.v2;const o=Jd(i,s,r,n);i=e.prev.v1,s=e.prev.v2,r=t.next.v2;const a=Jd(i,s,r,n);return[o,a]},fF=Rs.create(),uF=Rs.create(),Jd=(t,e,n,i)=>{const s=Rs.subtract(fF,e,t),r=Rs.subtract(uF,n,e);return Rs.cross(s,s,r),Rs.dot(s,i)},hF=t=>{let e;const n=[];for(;t.next;){const i=t.next;n.push(t.v1),t.v1=null,t.v2=null,t.next=null,t.prev=null,t=i}return n.length>0&&(e=Qo.create(n)),e},dF=t=>{if(t.length<2)return t;const e=t[0].plane,n=t.slice(),i=new Map;for(;n.length>0;){const r=n.shift(),o=oF(r);for(let a=0;a=0&&f[1]>=0){const u=l.next,h=c.next;c.prev.next=l.next,c.next.prev=l.prev,l.prev.next=c.next,l.next.prev=c.prev,c.v1=null,c.v2=null,c.next=null,c.prev=null,Hc(i,l),l.v1=null,l.v2=null,l.next=null,l.prev=null;const d=(_,g,m)=>{const p={v1:m.v1,v2:g.v2,next:g.next,prev:m.prev};m.prev.next=p,g.next.prev=p,Hc(_,g),g.v1=null,g.v2=null,g.next=null,g.prev=null,Hc(_,m),m.v1=null,m.v2=null,m.next=null,m.prev=null};f[0]===0&&d(i,u,u.prev),f[1]===0&&d(i,h,h.prev)}}else c.next&&aF(i,c)}}const s=[];return i.forEach(r=>{const o=hF(r);o&&s.push(o)}),i.clear(),s},pF=(t,e)=>Math.abs(t[3]-e[3])<15e-8?rF(t,e):!1,mF=(t,e)=>{const n=[];e.forEach(s=>{const r=n.find(o=>pF(o[0],Qo.plane(s)));r?r[1].push(s):n.push([Qo.plane(s),[s]])});let i=[];return n.forEach(s=>{const r=s[1],o=dF(r);i=i.concat(o)}),i};var gF=mF;const Qd=Qe,Pn=Ge,_F=rt,Ht=t=>`${t}`,ep=(t,e,n,i,s,r)=>{const o=Ht(i),a=Ht(s),c=`${o}/${a}`,l=`${a}/${o}`;if(t.has(l))return $o(t,e,n,s,i,null),null;const f={vertex0:i,vertex1:s,polygonindex:r};return t.has(c)?t.get(c).push(f):t.set(c,[f]),e.has(o)?e.get(o).push(c):e.set(o,[c]),n.has(a)?n.get(a).push(c):n.set(a,[c]),c},$o=(t,e,n,i,s,r)=>{const o=Ht(i),a=Ht(s),c=`${o}/${a}`;let l=-1;const f=t.get(c);for(let u=0;u{const e=new Map;for(let n=0;n=3){let r=i.vertices[0],o=Ht(r);for(let a=0;a0){const n=new Map,i=new Map,s=new Map;for(const[o,a]of e)s.set(o,!0),a.forEach(c=>{const l=Ht(c.vertex0),f=Ht(c.vertex1);n.has(l)?n.get(l).push(o):n.set(l,[o]),i.has(f)?i.get(f).push(o):i.set(f,[o])});const r=t.slice(0);for(;e.size!==0;){for(const a of e.keys())s.set(a,!0);let o=!1;for(;;){const a=Array.from(s.keys());if(a.length===0)break;const c=a[0];let l=!0;if(e.has(c)){const u=e.get(c)[0];for(let h=0;h<2;h++){const d=h===0?u.vertex0:u.vertex1,_=h===0?u.vertex1:u.vertex0,g=Ht(d),m=Ht(_);let p=[];h===0?i.has(g)&&(p=i.get(g)):n.has(g)&&(p=n.get(g));for(let y=0;y0&&I<1){const B=Pn.scale(Pn.create(),T,I);if(Pn.add(B,B,w),Pn.squaredDistance(B,D){const i=e.vertices.length;if(i>3){if(i>4){const o=[0,0,0];e.vertices.forEach(a=>Gc.add(o,o,a)),Gc.snap(o,Gc.divide(o,o,[i,i,i]),t);for(let a=0;a{const n=[];return e.forEach(i=>{MF(t,i,n)}),n};var SF=EF;const yF=ts,bF=Ng,TF=At,zg=Rt,wF=li,AF=Bg,RF=gF,CF=xF,PF=SF,LF=(t,e)=>e,DF=(t,e)=>e,UF=(t,e)=>{const n={snap:!1,simplify:!1,triangulate:!1},{snap:i,simplify:s,triangulate:r}=Object.assign({},n,t),o=bF(e);let a=zg.toPolygons(e);i&&(a=AF(o,a)),s&&(a=RF(o,a)),r&&(a=CF(a),a=PF(o,a));const c=Object.assign({},e);return c.polygons=a,c},IF=(t,...e)=>{if(e=yF(e),e.length===0)throw new Error("wrong number of arguments");const n=e.map(i=>{if(wF.isA(i))return LF(t,i);if(TF.isA(i))return DF(t,i);if(zg.isA(i))return UF(t,i);throw new Error("invalid geometry")});return n.length===1?n[0]:n};var NF=IF;const FF=ts,Gi=We,vl=At,xl=Rt,Ml=li,lf=Ng,OF=Bg,BF=t=>{const e=lf(t),i=Ml.toPoints(t).map(s=>Gi.snap(Gi.create(),s,e));return Ml.create(i)},zF=t=>{const e=lf(t);let i=vl.toSides(t).map(s=>[Gi.snap(Gi.create(),s[0],e),Gi.snap(Gi.create(),s[1],e)]);return i=i.filter(s=>!Gi.equals(s[0],s[1])),vl.create(i)},VF=t=>{const e=lf(t),n=xl.toPolygons(t),i=OF(e,n);return xl.create(i)},HF=(...t)=>{if(t=FF(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>Ml.isA(n)?BF(n):vl.isA(n)?zF(n):xl.isA(n)?VF(n):n);return e.length===1?e[0]:e};var GF=HF,$F={generalize:NF,snap:GF,retessellate:nF},ff={geometries:Rg,modifiers:$F};const Vg=t=>t.reduce((e,n)=>Array.isArray(n)?e.concat(Vg(n)):e.concat(n),[]);var kF=Vg;const WF=t=>Array.isArray(t)?t:t==null?[]:[t];var XF=WF,qF={flatten:kF,toArray:XF};const{geometries:kc}=ff,YF=(t,e)=>{e.statusCallback&&e.statusCallback({progress:0});const n=new ArrayBuffer(4),i=new Int32Array(n,0,1),s=new Int8Array(n,0,4);if(i[0]=287454020,s[0]!==68)throw new Error("Binary STL output is currently only supported on little-endian (Intel) processors");let r=0,o=0;t.forEach((m,p)=>{kc.geom3.toPolygons(m).forEach(E=>{const v=E.vertices.length,M=v>=3?v-2:0;r+=M,o+=1})});const a=new Uint8Array(80);for(let m=0;m<80;m++)a[m]=65;const c=new Uint32Array(1);c[0]=r;const l=new ArrayBuffer(50*r),f=new Int8Array(l),u=new ArrayBuffer(50),h=new Int8Array(u),d=new Float32Array(u,0,12),_=new Uint16Array(u,48,1);let g=0;return t.forEach(m=>{kc.geom3.toPolygons(m).forEach((y,E)=>{const v=y.vertices,M=v.length,b=kc.poly3.plane(y);for(let w=0;w0?w:0),I=v[T];d[D++]=I[0],d[D++]=I[1],d[D++]=I[2]}_[0]=0,f.set(h,g),g+=50}e.statusCallback&&e.statusCallback({progress:100*E/o})})}),e.statusCallback&&e.statusCallback({progress:100}),[a.buffer,c.buffer,l]};var jF={serializeBinary:YF};const{geometries:Hg}=ff,ZF=(t,e)=>{e.statusCallback&&e.statusCallback({progress:0});const n=`solid JSCAD -${KF(t,e)} +`)}`)};var F3=I3,Pt={clone:zC,create:ao,fromPointsConvex:KL,fromPoints:t3,fromCompactBinary:a3,invert:_3,isA:Kg,toPoints:S3,toPolygons:za,toString:w3,toCompactBinary:C3,transform:L3,validate:F3};const ld=Pt,O3=ot,{isNumberArray:fd}=Et,B3=t=>{const e={center:[0,0,0],size:[2,2,2]},{center:n,size:i}=Object.assign({},e,t);if(!fd(n,3))throw new Error("center must be an array of X, Y and Z values");if(!fd(i,3))throw new Error("size must be an array of width, depth and height values");if(!i.every(r=>r>=0))throw new Error("size values must be positive");return i[0]===0||i[1]===0||i[2]===0?ld.create():ld.create([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(r=>{const o=r[0].map(a=>[n[0]+i[0]/2*(2*!!(a&1)-1),n[1]+i[1]/2*(2*!!(a&2)-1),n[2]+i[2]/2*(2*!!(a&4)-1)]);return O3.create(o)}))};var xf=B3;const z3=xf,{isGTE:H3}=Et,V3=t=>{const e={center:[0,0,0],size:2};let{center:n,size:i}=Object.assign({},e,t);if(!H3(i,0))throw new Error("size must be positive");return i=[i,i,i],z3({center:n,size:i})};var G3=V3;const{EPS:ud,TAU:Ei}=Qe,bt=Ge,$3=Pt,k3=ot,{sin:W3,cos:X3}=jt,{isGT:q3,isGTE:tl,isNumberArray:nl}=Et,j3=t=>{const e={center:[0,0,0],height:2,startRadius:[1,1],startAngle:0,endRadius:[1,1],endAngle:Ei,segments:32};let{center:n,height:i,startRadius:s,startAngle:r,endRadius:o,endAngle:a,segments:c}=Object.assign({},e,t);if(!nl(n,3))throw new Error("center must be an array of X, Y and Z values");if(!q3(i,0))throw new Error("height must be greater then zero");if(!nl(s,2))throw new Error("startRadius must be an array of X and Y values");if(!s.every(v=>v>=0))throw new Error("startRadius values must be positive");if(!nl(o,2))throw new Error("endRadius must be an array of X and Y values");if(!o.every(v=>v>=0))throw new Error("endRadius values must be positive");if(o.every(v=>v===0)&&s.every(v=>v===0))throw new Error("at least one radius must be positive");if(!tl(r,0))throw new Error("startAngle must be positive");if(!tl(a,0))throw new Error("endAngle must be positive");if(!tl(c,4))throw new Error("segments must be four or more");r=r%Ei,a=a%Ei;let l=Ei;ra&&(l=a+(Ei-r));const f=Math.min(s[0],s[1],o[0],o[1]),u=Math.acos((f*f+f*f-ud*ud)/(2*f*f));if(l{const U=T*l+r;return bt.scale(y,m,N[0]*X3(U)),bt.scale(E,p,N[1]*W3(U)),bt.add(y,y,E),bt.scale(x,g,v),bt.add(x,x,d),bt.add(bt.create(),y,x)},b=(...v)=>{const T=v.map(N=>bt.add(bt.create(),N,n));return k3.create(T)},w=[];for(let v=0;v0&&s[1]>0&&w.push(b(d,M(0,N,s),M(0,T,s))),(s[0]>0||s[1]>0)&&w.push(b(M(0,T,s),M(0,N,s),M(1,T,o))),o[0]>0&&o[1]>0&&w.push(b(_,M(1,T,o),M(1,N,o))),(o[0]>0||o[1]>0)&&w.push(b(M(1,T,o),M(0,N,s),M(1,N,o))))}return l{const e={center:[0,0,0],height:2,radius:1,segments:32},{center:n,height:i,radius:s,segments:r}=Object.assign({},e,t);if(!K3(s,0))throw new Error("radius must be positive");return i===0||s===0?Y3.create():Z3({center:n,height:i,startRadius:[s,s],endRadius:[s,s],segments:r})};var Qg=J3;const{TAU:hd}=Qe,Re=Ge,dd=Pt,pd=ot,{sin:md,cos:gd}=jt,{isGTE:Q3,isNumberArray:_d}=Et,eD=t=>{const e={center:[0,0,0],radius:[1,1,1],segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]},{center:n,radius:i,segments:s,axes:r}=Object.assign({},e,t);if(!_d(n,3))throw new Error("center must be an array of X, Y and Z values");if(!_d(i,3))throw new Error("radius must be an array of X, Y and Z values");if(!i.every(_=>_>=0))throw new Error("radius values must be positive");if(!Q3(s,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0||i[2]===0)return dd.create();const o=Re.scale(Re.create(),Re.normalize(Re.create(),r[0]),i[0]),a=Re.scale(Re.create(),Re.normalize(Re.create(),r[1]),i[1]),c=Re.scale(Re.create(),Re.normalize(Re.create(),r[2]),i[2]),l=Math.round(s/4);let f;const u=[],h=Re.create(),d=Re.create();for(let _=0;_<=s;_++){const g=hd*_/s,m=Re.add(Re.create(),Re.scale(h,o,gd(g)),Re.scale(d,a,md(g)));if(_>0){let p,y;for(let E=0;E<=l;E++){const x=hd/4*E/l,M=gd(x),b=md(x);if(E>0){let w=[],D;D=Re.subtract(Re.create(),Re.scale(h,f,p),Re.scale(d,c,y)),w.push(Re.add(D,D,n)),D=Re.subtract(Re.create(),Re.scale(h,m,p),Re.scale(d,c,y)),w.push(Re.add(D,D,n)),E{const e={points:[],faces:[],colors:void 0,orientation:"outward"},{points:n,faces:i,colors:s,orientation:r}=Object.assign({},e,t);if(!(Array.isArray(n)&&Array.isArray(i)))throw new Error("points and faces must be arrays");if(n.length<3)throw new Error("three or more points are required");if(i.length<1)throw new Error("one or more faces are required");if(s){if(!Array.isArray(s))throw new Error("colors must be an array");if(s.length!==i.length)throw new Error("faces and colors must have the same length")}n.forEach((a,c)=>{if(!vd(a,3))throw new Error(`point ${c} must be an array of X, Y, Z values`)}),i.forEach((a,c)=>{if(a.length<3)throw new Error(`face ${c} must contain 3 or more indexes`);if(!vd(a,a.length))throw new Error(`face ${c} must be an array of numbers`)}),r!=="outward"&&i.forEach(a=>a.reverse());const o=i.map((a,c)=>{const l=nD.create(a.map(f=>n[f]));return s&&s[c]&&(l.color=s[c]),l});return tD.create(o)};var t0=iD;const xd=dt,Md=Ge,Ed=Pt,sD=t0,{isGTE:Sd}=Et,rD=t=>{const e={radius:1,frequency:6};let{radius:n,frequency:i}=Object.assign({},e,t);if(!Sd(n,0))throw new Error("radius must be positive");if(!Sd(i,6))throw new Error("frequency must be six or more");if(n===0)return Ed.create();i=Math.floor(i/6);const s=[[.850651,0,-.525731],[.850651,-0,.525731],[-.850651,-0,.525731],[-.850651,0,-.525731],[0,-.525731,.850651],[0,.525731,.850651],[0,.525731,-.850651],[0,-.525731,-.850651],[-.525731,-.850651,-0],[.525731,-.850651,-0],[.525731,.850651,0],[-.525731,.850651,0]],r=[[0,9,1],[1,10,0],[6,7,0],[10,6,0],[7,9,0],[5,1,4],[4,1,9],[5,10,1],[2,8,3],[3,11,2],[2,5,4],[4,8,2],[2,11,5],[3,7,6],[6,11,3],[8,7,3],[9,8,4],[11,10,5],[10,11,6],[8,9,7]],o=(h,d,_)=>{const g=h[0],m=h[1],p=h[2];let y=_;const E=[],x=[];for(let M=0;M{const g=1-_,m=[];for(let p=0;p<3;p++)m[p]=h[p]*g+d[p]*_;return m};let c=[],l=[],f=0;for(let h=0;h{if(!Array.isArray(t))throw new Error("points must be an array");return aD.fromPoints({},t)};var lD=cD;const zo=Ct,fD=t=>{const e={points:[],paths:[],orientation:"counterclockwise"},{points:n,paths:i,orientation:s}=Object.assign({},e,t);if(!(Array.isArray(n)&&Array.isArray(i)))throw new Error("points and paths must be arrays");let r=n;Array.isArray(n[0])&&(Array.isArray(n[0][0])||(r=[n])),r.forEach((f,u)=>{if(!Array.isArray(f))throw new Error("list of points "+u+" must be an array");if(f.length<3)throw new Error("list of points "+u+" must contain three or more points");f.forEach((h,d)=>{if(!Array.isArray(h))throw new Error("list of points "+u+", point "+d+" must be an array");if(h.length<2)throw new Error("list of points "+u+", point "+d+" must contain by X and Y values")})});let o=i;if(i.length===0){let f=0;o=r.map(u=>u.map(h=>f++))}const a=[];r.forEach(f=>f.forEach(u=>a.push(u)));let c=[];o.forEach(f=>{const u=f.map(d=>a[d]),h=zo.fromPoints(u);c=c.concat(zo.toSides(h))});let l=zo.create(c);return s==="clockwise"&&(l=zo.reverse(l)),l};var uD=fD;const Si=We,yd=Ct,{isNumberArray:bd}=Et,hD=t=>{const e={center:[0,0],size:[2,2]},{center:n,size:i}=Object.assign({},e,t);if(!bd(n,2))throw new Error("center must be an array of X and Y values");if(!bd(i,2))throw new Error("size must be an array of X and Y values");if(!i.every(a=>a>=0))throw new Error("size values must be positive");if(i[0]===0||i[1]===0)return yd.create();const s=[i[0]/2,i[1]/2],r=[s[0],-s[1]],o=[Si.subtract(Si.create(),n,s),Si.add(Si.create(),n,r),Si.add(Si.create(),n,s),Si.subtract(Si.create(),n,r)];return yd.fromPoints(o)};var Mf=hD;const{EPS:ta,TAU:Mr}=Qe,il=We,ut=Ge,Td=Pt,er=ot,{sin:dD,cos:pD}=jt,{isGTE:wd,isNumberArray:Ad}=Et,mD=xf,Rd=(t,e,n,i,s,r)=>{const o=Mr/4*s/i,a=pD(o),c=dD(o),l=i-s;let f=n*a,u=e[2]-(n-n*c);r||(u=n-n*c-e[2]),f=f>ta?f:0;const h=ut.add(ut.create(),t,[e[0]-n,e[1]-n,u]),d=ut.add(ut.create(),t,[n-e[0],e[1]-n,u]),_=ut.add(ut.create(),t,[n-e[0],n-e[1],u]),g=ut.add(ut.create(),t,[e[0]-n,n-e[1],u]),m=[],p=[],y=[],E=[];for(let x=0;x<=l;x++){const M=l>0?Mr/4*x/l:0,b=il.fromAngleRadians(il.create(),M);il.scale(b,b,f);const w=ut.fromVec2(ut.create(),b);m.push(ut.add(ut.create(),h,w)),ut.rotateZ(w,w,[0,0,0],Mr/4),p.push(ut.add(ut.create(),d,w)),ut.rotateZ(w,w,[0,0,0],Mr/4),y.push(ut.add(ut.create(),_,w)),ut.rotateZ(w,w,[0,0,0],Mr/4),E.push(ut.add(ut.create(),g,w))}return r?[m,p,y,E]:(m.reverse(),p.reverse(),y.reverse(),E.reverse(),[E,y,p,m])},Cd=(t,e)=>{const n=[];for(let i=0;i{const n=[];for(let i=0;i{t=[t[3],t[2],t[1],t[0]],t=t.map(r=>r.slice().reverse());const n=[];t.forEach(r=>{r.forEach(o=>n.push(o))});const i=[];e.forEach(r=>{r.forEach(o=>i.push(o))});const s=[];for(let r=0;r{const e={center:[0,0,0],size:[2,2,2],roundRadius:.2,segments:32};let{center:n,size:i,roundRadius:s,segments:r}=Object.assign({},e,t);if(!Ad(n,3))throw new Error("center must be an array of X, Y and Z values");if(!Ad(i,3))throw new Error("size must be an array of X, Y and Z values");if(!i.every(l=>l>=0))throw new Error("size values must be positive");if(!wd(s,0))throw new Error("roundRadius must be positive");if(!wd(r,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0||i[2]===0)return Td.create();if(s===0)return mD({center:n,size:i});if(i=i.map(l=>l/2),s>i[0]-ta||s>i[1]-ta||s>i[2]-ta)throw new Error("roundRadius must be smaller than the radius of all dimensions");r=Math.floor(r/4);let o=null,a=null,c=[];for(let l=0;l<=r;l++){const f=Rd(n,i,s,r,l,!0),u=Rd(n,i,s,r,l,!1);if(l===0&&(c=c.concat(gD(u,f))),o&&(c=c.concat(Cd(o,f),Pd(o,f))),a&&(c=c.concat(Cd(a,u),Pd(a,u))),l===r){let h=f.map(d=>d[0]);c.push(er.create(h)),h=u.map(d=>d[0]),c.push(er.create(h))}o=f,a=u}return Td.create(c)};var vD=_D;const{EPS:xD,TAU:Ld}=Qe,ge=Ge,Dd=Pt,MD=ot,{sin:Ud,cos:Id}=jt,{isGTE:Ho,isNumberArray:ED}=Et,SD=Qg,yD=t=>{const e={center:[0,0,0],height:2,radius:1,roundRadius:.2,segments:32},{center:n,height:i,radius:s,roundRadius:r,segments:o}=Object.assign({},e,t);if(!ED(n,3))throw new Error("center must be an array of X, Y and Z values");if(!Ho(i,0))throw new Error("height must be positive");if(!Ho(s,0))throw new Error("radius must be positive");if(!Ho(r,0))throw new Error("roundRadius must be positive");if(r>s)throw new Error("roundRadius must be smaller than the radius");if(!Ho(o,4))throw new Error("segments must be four or more");if(i===0||s===0)return Dd.create();if(r===0)return SD({center:n,height:i,radius:s});const a=[0,0,-(i/2)],c=[0,0,i/2],l=ge.subtract(ge.create(),c,a),f=ge.length(l);if(2*r>f-xD)throw new Error("height must be larger than twice roundRadius");let u;Math.abs(l[0])>Math.abs(l[1])?u=ge.fromValues(0,1,0):u=ge.fromValues(1,0,0);const h=ge.scale(ge.create(),ge.normalize(ge.create(),l),r),d=ge.scale(ge.create(),ge.normalize(ge.create(),ge.cross(ge.create(),h,u)),s),_=ge.scale(ge.create(),ge.normalize(ge.create(),ge.cross(ge.create(),d,h)),s);ge.add(a,a,h),ge.subtract(c,c,h);const g=Math.floor(.25*o),m=b=>{const w=b.map(D=>ge.add(D,D,n));return MD.create(w)},p=[],y=ge.create(),E=ge.create();let x;for(let b=0;b<=o;b++){const w=Ld*b/o,D=ge.add(ge.create(),ge.scale(y,d,Id(w)),ge.scale(E,_,Ud(w)));if(b>0){let v=[];v.push(ge.add(ge.create(),a,D)),v.push(ge.add(ge.create(),a,x)),v.push(ge.add(ge.create(),c,x)),v.push(ge.add(ge.create(),c,D)),p.push(m(v));let T,N;for(let U=0;U<=g;U++){const I=Ld/4*U/g,F=Id(I),B=Ud(I);if(U>0){v=[];let V;V=ge.add(ge.create(),a,ge.subtract(y,ge.scale(y,x,T),ge.scale(E,h,N))),v.push(V),V=ge.add(ge.create(),a,ge.subtract(y,ge.scale(y,D,T),ge.scale(E,h,N))),v.push(V),U{const e={center:[0,0],size:[2,2],roundRadius:.2,segments:32};let{center:n,size:i,roundRadius:s,segments:r}=Object.assign({},e,t);if(!Bd(n,2))throw new Error("center must be an array of X and Y values");if(!Bd(i,2))throw new Error("size must be an array of X and Y values");if(!i.every(g=>g>=0))throw new Error("size values must be positive");if(!Od(s,0))throw new Error("roundRadius must be positive");if(!Od(r,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0)return Fd.create();if(s===0)return TD({center:n,size:i});if(i=i.map(g=>g/2),s>i[0]-Nd||s>i[1]-Nd)throw new Error("roundRadius must be smaller than the radius of all dimensions");const o=Math.floor(r/4),a=at.add(at.create(),n,[i[0]-s,i[1]-s]),c=at.add(at.create(),n,[s-i[0],i[1]-s]),l=at.add(at.create(),n,[s-i[0],s-i[1]]),f=at.add(at.create(),n,[i[0]-s,s-i[1]]),u=[],h=[],d=[],_=[];for(let g=0;g<=o;g++){const m=Vo/4*g/o,p=at.fromAngleRadians(at.create(),m);at.scale(p,p,s),u.push(at.add(at.create(),a,p)),at.rotate(p,p,at.create(),Vo/4),h.push(at.add(at.create(),c,p)),at.rotate(p,p,at.create(),Vo/4),d.push(at.add(at.create(),l,p)),at.rotate(p,p,at.create(),Vo/4),_.push(at.add(at.create(),f,p))}return Fd.fromPoints(u.concat(h,d,_))};var AD=wD;const RD=e0,{isGTE:CD}=Et,PD=t=>{const e={center:[0,0,0],radius:1,segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]};let{center:n,radius:i,segments:s,axes:r}=Object.assign({},e,t);if(!CD(i,0))throw new Error("radius must be positive");return i=[i,i,i],RD({center:n,radius:i,segments:s,axes:r})};var LD=PD;const DD=Mf,{isGTE:UD}=Et,ID=t=>{const e={center:[0,0],size:2};let{center:n,size:i}=Object.assign({},e,t);if(!UD(i,0))throw new Error("size must be positive");return i=[i,i],DD({center:n,size:i})};var ND=ID;const{TAU:n0}=Qe,Pr=We,FD=Ct,{isGT:OD,isGTE:Go,isNumberArray:BD}=Et,zD=(t,e)=>t>0&&e>1&&e{const s=n0/t,r=[];for(let o=0;o{const e={center:[0,0],vertices:5,outerRadius:1,innerRadius:0,density:2,startAngle:0};let{center:n,vertices:i,outerRadius:s,innerRadius:r,density:o,startAngle:a}=Object.assign({},e,t);if(!BD(n,2))throw new Error("center must be an array of X and Y values");if(!Go(i,2))throw new Error("vertices must be two or more");if(!OD(s,0))throw new Error("outerRadius must be greater than zero");if(!Go(r,0))throw new Error("innerRadius must be greater than zero");if(!Go(a,0))throw new Error("startAngle must be greater than zero");if(i=Math.floor(i),o=Math.floor(o),a=a%n0,r===0){if(!Go(o,2))throw new Error("density must be two or more");r=s*zD(i,o)}const c=Pr.clone(n),l=zd(i,s,a,c),f=zd(i,r,a+Math.PI/i,c),u=[];for(let h=0;ht.reduce((e,n)=>Array.isArray(n)?e.concat(i0(n)):e.concat(n),[]);var ds=i0;const GD=ds,Hd=dt,Vd=cr,Gd=Ct,$d=Pt,kd=hi,$D=(t,...e)=>{const n={origin:[0,0,0],normal:[0,0,1]},{origin:i,normal:s}=Object.assign({},n,t);if(e=GD(e),e.length===0)throw new Error("wrong number of arguments");const r=Vd.fromNormalAndPoint(Vd.create(),s,i);if(Number.isNaN(r[0]))throw new Error("the given origin and normal do not define a proper plane");const o=Hd.mirrorByPlane(Hd.create(),r),a=e.map(c=>kd.isA(c)?kd.transform(o,c):Gd.isA(c)?Gd.transform(o,c):$d.isA(c)?$d.transform(o,c):c);return a.length===1?a[0]:a},kD=(...t)=>$D({normal:[1,0,0]},t);var WD={mirrorX:kD};const Wd=cr,Wi=Ge,XD=t=>{const e=t.edges;if(e.length<3)throw new Error("slices must have 3 or more edges to calculate a plane");const n=e.reduce((o,a)=>Wi.add(Wi.create(),o,a[0]),Wi.create());Wi.scale(n,n,1/e.length);let i,s=0;e.forEach(o=>{if(!Wi.equals(o[0],o[1])){const a=Wi.squaredDistance(n,o[0]);a>s&&(i=o,s=a)}});const r=e.find(o=>Wi.equals(o[1],i[0]));return Wd.fromPoints(Wd.create(),r[0],i[0],i[1])};var s0=XD;const qD=t=>(t||(t=[]),{edges:t});var ps=qD;const jD=ps,Xd=Ge,YD=(...t)=>{let e,n;return t.length===1?(e=jD(),n=t[0]):(e=t[0],n=t[1]),e.edges=n.edges.map(i=>[Xd.clone(i[0]),Xd.clone(i[1])]),e};var ZD=YD;const KD=Ge,JD=(t,e)=>{const n=t.edges,i=e.edges;return n.length!==i.length?!1:n.reduce((r,o,a)=>{const c=i[a],l=KD.squaredDistance(o[0],c[0]);return r&&l{if(!Array.isArray(t))throw new Error("the given points must be an array");if(t.length<3)throw new Error("the given points must contain THREE or more points");const e=[];let n=t[t.length-1];return t.forEach(i=>{i.length===2&&e.push([$o.fromVec2($o.create(),n),$o.fromVec2($o.create(),i)]),i.length===3&&e.push([n,i]),n=i}),eU(e)};var nU=tU;const ko=Ge,iU=ps,sU=t=>{if(!Array.isArray(t))throw new Error("the given sides must be an array");const e=[];return t.forEach(n=>{e.push([ko.fromVec2(ko.create(),n[0]),ko.fromVec2(ko.create(),n[1])])}),iU(e)};var rU=sU;const oU=t=>!!(t&&typeof t=="object"&&"edges"in t&&Array.isArray(t.edges));var aU=oU;const cU=ps,lU=(...t)=>{let e,n;return t.length===1?(e=cU(),n=t[0]):(e=t[0],n=t[1]),e.edges=n.edges.map(i=>[i[1],i[0]]),e};var fU=lU;const uU=t=>t.edges;var hU=uU;const dU=(t,e)=>{let n,i,s,r,o,a=1;do{i=t,t=null;let c=null;for(o=0;i;){o++,s=i;let l=0;for(n=0;n0||f>0&&s;)l!==0&&(f===0||!s||e(i)<=e(s))?(r=i,i=i.nextZ,l--):(r=s,s=s.nextZ,f--),c?c.nextZ=r:t=r,r.prevZ=c,c=r;i=s}c.nextZ=null,a*=2}while(o>1);return t};var pU=dU;const mU=pU;let r0=class{constructor(e,n,i){this.i=e,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}};const gU=(t,e,n,i)=>{const s=new r0(t,e,n);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s},_U=t=>{t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)};var o0={Node:r0,insertNode:gU,removeNode:_U,sortLinked:mU};const vU=(t,e,n,i,s,r,o,a)=>(s-o)*(e-a)-(t-o)*(r-a)>=0&&(t-o)*(i-a)-(n-o)*(e-a)>=0&&(n-o)*(r-a)-(s-o)*(i-a)>=0,xU=(t,e,n)=>(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);var Ef={area:xU,pointInTriangle:vU};const{Node:qd,insertNode:jd,removeNode:ha}=o0,{area:Kt}=Ef,MU=(t,e,n,i,s)=>{let r;if(s===wU(t,e,n,i)>0)for(let o=e;o=e;o-=i)r=jd(o,t[o],t[o+1],r);return r&&Ha(r,r.next)&&(ha(r),r=r.next),r},a0=(t,e)=>{if(!t)return t;e||(e=t);let n=t,i;do if(i=!1,!n.steiner&&(Ha(n,n.next)||Kt(n.prev,n,n.next)===0)){if(ha(n),n=e=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==e);return e},EU=(t,e,n)=>{let i=t;do{const s=i.prev,r=i.next.next;!Ha(s,r)&&c0(s,i,i.next,r)&&Jr(s,r)&&Jr(r,s)&&(e.push(s.i/n),e.push(i.i/n),e.push(r.i/n),ha(i),ha(i.next),i=t=r),i=i.next}while(i!==t);return a0(i)},SU=(t,e)=>{let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&c0(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1},Jr=(t,e)=>Kt(t.prev,t,t.next)<0?Kt(t,e,t.next)>=0&&Kt(t,t.prev,e)>=0:Kt(t,e,t.prev)<0||Kt(t,t.next,e)<0,yU=(t,e)=>{let n=t,i=!1;const s=(t.x+e.x)/2,r=(t.y+e.y)/2;do n.y>r!=n.next.y>r&&n.next.y!==n.y&&s<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==t);return i},bU=(t,e)=>{const n=new qd(t.i,t.x,t.y),i=new qd(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,n.next=s,s.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i},TU=(t,e)=>t.next.i!==e.i&&t.prev.i!==e.i&&!SU(t,e)&&(Jr(t,e)&&Jr(e,t)&&yU(t,e)&&(Kt(t.prev,t,e.prev)||Kt(t,e.prev,e))||Ha(t,e)&&Kt(t.prev,t,t.next)>0&&Kt(e.prev,e,e.next)>0),c0=(t,e,n,i)=>{const s=Math.sign(Kt(t,e,n)),r=Math.sign(Kt(t,e,i)),o=Math.sign(Kt(n,i,t)),a=Math.sign(Kt(n,i,e));return!!(s!==r&&o!==a||s===0&&Wo(t,n,e)||r===0&&Wo(t,i,e)||o===0&&Wo(n,t,i)||a===0&&Wo(n,e,i))},Wo=(t,e,n)=>e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y),wU=(t,e,n,i)=>{let s=0;for(let r=e,o=n-i;rt.x===e.x&&t.y===e.y;var l0={cureLocalIntersections:EU,filterPoints:a0,isValidDiagonal:TU,linkedPolygon:MU,locallyInside:Jr,splitPolygon:bU};const{filterPoints:Ol,linkedPolygon:AU,locallyInside:RU,splitPolygon:CU}=l0,{area:Yd,pointInTriangle:PU}=Ef,LU=(t,e,n,i)=>{const s=[];for(let r=0,o=e.length;rr.x-o.x);for(let r=0;r{const n=UU(t,e);if(!n)return e;const i=CU(n,t),s=Ol(n,n.next);return Ol(i,i.next),e===n?s:e},UU=(t,e)=>{let n=e;const i=t.x,s=t.y;let r=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){const u=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(u<=i&&u>r){if(r=u,u===i){if(s===n.y)return n;if(s===n.next.y)return n.next}o=n.x=n.x&&n.x>=c&&i!==n.x&&PU(so.x||n.x===o.x&&IU(o,n)))&&(o=n,f=u)}n=n.next}while(n!==a);return o},IU=(t,e)=>Yd(t.prev,t,e.prev)<0&&Yd(e.next,t,t.next)<0,NU=t=>{let e=t,n=t;do(e.x{const i=e&&e.length,s=i?e[0]*n:t.length;let r=GU(t,0,s,n,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,f,u;if(i&&(r=OU(t,e,r,n)),t.length>80*n){a=l=t[0],c=f=t[1];for(let h=n;hl&&(l=d),_>f&&(f=_)}u=Math.max(l-a,f-c),u=u!==0?1/u:0}return Qr(r,o,n,a,c,u),o},Qr=(t,e,n,i,s,r,o)=>{if(!t)return;!o&&r&&jU(t,i,s,r);let a=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,r?XU(t,i,s,r):WU(t)){e.push(c.i/n),e.push(t.i/n),e.push(l.i/n),BU(t),t=l.next,a=l.next;continue}if(t=l,t===a){o?o===1?(t=HU(da(t),e,n),Qr(t,e,n,i,s,r,2)):o===2&&qU(t,e,n,i,s,r):Qr(da(t),e,n,i,s,r,1);break}}},WU=t=>{const e=t.prev,n=t,i=t.next;if(Ki(e,n,i)>=0)return!1;let s=t.next.next;for(;s!==t.prev;){if(Lr(e.x,e.y,n.x,n.y,i.x,i.y,s.x,s.y)&&Ki(s.prev,s,s.next)>=0)return!1;s=s.next}return!0},XU=(t,e,n,i)=>{const s=t.prev,r=t,o=t.next;if(Ki(s,r,o)>=0)return!1;const a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,f=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,u=Bl(a,c,e,n,i),h=Bl(l,f,e,n,i);let d=t.prevZ,_=t.nextZ;for(;d&&d.z>=u&&_&&_.z<=h;){if(d!==t.prev&&d!==t.next&&Lr(s.x,s.y,r.x,r.y,o.x,o.y,d.x,d.y)&&Ki(d.prev,d,d.next)>=0||(d=d.prevZ,_!==t.prev&&_!==t.next&&Lr(s.x,s.y,r.x,r.y,o.x,o.y,_.x,_.y)&&Ki(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&Lr(s.x,s.y,r.x,r.y,o.x,o.y,d.x,d.y)&&Ki(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;_&&_.z<=h;){if(_!==t.prev&&_!==t.next&&Lr(s.x,s.y,r.x,r.y,o.x,o.y,_.x,_.y)&&Ki(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0},qU=(t,e,n,i,s,r)=>{let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&VU(o,a)){let c=$U(o,a);o=da(o,o.next),c=da(c,c.next),Qr(o,e,n,i,s,r),Qr(c,e,n,i,s,r);return}a=a.next}o=o.next}while(o!==t)},jU=(t,e,n,i)=>{let s=t;do s.z===null&&(s.z=Bl(s.x,s.y,e,n,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,zU(s,r=>r.z)},Bl=(t,e,n,i,s)=>(t=32767*(t-n)*s,e=32767*(e-i)*s,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1);var YU=kU;const{NEPS:sl}=Qe,ZU=(t,e)=>Math.abs(t[0]-e[0])<=sl&&Math.abs(t[1]-e[1])<=sl&&Math.abs(t[2]-e[2])<=sl;var KU=ZU;const JU=t=>{let e=0;for(let n=0;n{let i=n-t[1],s=e[1]-t[1];s<0&&(i=-i,s=-s);let r;return i<=0?r=0:i>=s?r=1:s<1e-10?r=.5:r=i/s,t[0]+r*(e[0]-t[0])};var eI=QU;const tI=(t,e,n,i,s,r)=>{const a=1/(t*i-e*n);let c=s*i-e*r,l=-s*n+t*r;return c*=a,l*=a,[c,l]};var nI=tI,u0={area:f0,solve2Linear:nI};const iI=f0,sI=t=>iI(t.vertices);var rI=sI;const oI=t=>((t===void 0||t.length<3)&&(t=[]),{vertices:t});var aI=oI;const cI=aI,lI=t=>{const e=t.vertices.slice().reverse();return cI(e)};var fI=lI;const uI=rI,hI=fI,dI=(t,e)=>{if(t.length===0)return 0;const n=e.vertices;return n.length<3?0:(uI(e)<0&&(e=hI(e)),t.reduce((s,r)=>s+pI(r,n),0)===t.length?1:0)},pI=(t,e)=>{const n=e.length,i=t[0],s=t[1];let r=e[n-1],o=e[0],a=r[1]>s,c=0,l=0;for(let f=n+1;--f;){const u=o[1]>s;if(a!==u){const h=r[0]>i,d=o[0]>i;(h&&d||o[0]-(o[1]-s)*(r[0]-o[0])/(r[1]-o[1])>=i)&&(c=!c)}a=u,r=o,o=e[++l]}return c};var mI=dI,gI={arePointsInside:mI};const{area:_I}=u0,{toOutlines:vI}=Ct,{arePointsInside:xI}=gI,MI=t=>{const e=vI(t),n=[],i=[];e.forEach((o,a)=>{const c=_I(o);c<0?i.push(a):c>0&&n.push(a)});const s=[],r=[];return n.forEach((o,a)=>{const c=e[o];s[a]=[],i.forEach((l,f)=>{const u=e[l];xI([u[0]],{vertices:c})&&(s[a].push(l),r[f]||(r[f]=[]),r[f].push(a))})}),i.forEach((o,a)=>{if(r[a]&&r[a].length>1){const c=EI(r[a],l=>s[l].length);r[a].forEach((l,f)=>{f!==c&&(s[l]=s[l].filter(u=>u!==o))})}}),s.map((o,a)=>({solid:e[n[a]],holes:o.map(c=>e[c])}))},EI=(t,e)=>{let n,i;return t.forEach((s,r)=>{const o=e(s);(i===void 0||oo.map(a=>this.to2D(a))),r=yI.create(s);this.roots=wI(r)}to2D(e){const n=bI.fromValues(wt.dot(e,this.u),wt.dot(e,this.v));return this.basisMap.set(n,e),n}to3D(e){const n=this.basisMap.get(e);if(n)return n;{console.log("Warning: point not in original slice");const i=wt.scale(wt.create(),this.u,e[0]),s=wt.scale(wt.create(),this.v,e[1]),r=wt.scale(wt.create(),Zd,Zd[3]),o=wt.add(i,i,r);return wt.add(s,s,o)}}};var RI=AI;const CI=ot,PI=YU,LI=RI,DI=t=>{const e=new LI(t),n=[];return e.roots.forEach(({solid:i,holes:s})=>{let r=i.length;const o=[];s.forEach((u,h)=>{o.push(r),r+=u.length});const a=[i,...s].flat(),c=a.flat(),l=u=>e.to3D(a[u]),f=PI(c,o);for(let u=0;ut.reduce((e,n)=>e+=`[${Kd.toString(n[0])}, ${Kd.toString(n[1])}], `,""),NI=t=>`[${II(t.edges)}]`;var FI=NI;const Xo=Ge,OI=ps,BI=(t,e)=>{const n=e.edges.map(i=>[Xo.transform(Xo.create(),i[0],t),Xo.transform(Xo.create(),i[1],t)]);return OI(n)};var zI=BI,Sf={calculatePlane:s0,clone:ZD,create:ps,equals:QD,fromPoints:nU,fromSides:rU,isA:aU,reverse:fU,toEdges:hU,toPolygons:UI,toString:FI,transform:zI};const Jd=Ge,HI=ps,VI=t=>{if(!t.edges)return t;let e=t.edges;const n=new Map,i=new Map;e=e.filter(o=>!Jd.equals(o[0],o[1])),e.forEach(o=>{const a=o[0].toString(),c=o[1].toString();n.set(a,o[0]),n.set(c,o[1]),i.set(a,(i.get(a)||0)+1),i.set(c,(i.get(c)||0)-1)});const s=[],r=[];return i.forEach((o,a)=>{o<0&&s.push(a),o>0&&r.push(a)}),s.forEach(o=>{const a=n.get(o);let c=1/0,l;r.forEach(f=>{const u=n.get(f),h=Jd.distance(a,u);hf[0].toString()===o?[l,f[1]]:f[1].toString()===o?[f[0],l]:f)}),HI(e)};var GI=VI;const{EPS:Qd}=Qe,Is=Ge,qo=ot,ep=Sf,zl=(t,e)=>t===e?t:tt*e/zl(t,e),tp=(t,e)=>{const n=t/e.length;if(n===1)return e;const i=Is.fromValues(n,n,n),s=[];return e.forEach(r=>{const o=Is.subtract(Is.create(),r[1],r[0]);Is.divide(o,o,i);let a=r[0];for(let c=1;c<=n;++c){const l=Is.add(Is.create(),a,o);s.push([a,l]),a=l}}),s},np=Qd*Qd/2*Math.sin(Math.PI/3),kI=(t,e)=>{let n=ep.toEdges(t),i=ep.toEdges(e);if(n.length!==i.length){const r=$I(n.length,i.length);r!==n.length&&(n=tp(r,n)),r!==i.length&&(i=tp(r,i))}const s=[];return n.forEach((r,o)=>{const a=i[o],c=qo.create([r[0],r[1],a[1]]),l=qo.measureArea(c);Number.isFinite(l)&&l>np&&s.push(c);const f=qo.create([r[0],a[1],a[0]]),u=qo.measureArea(f);Number.isFinite(u)&&u>np&&s.push(f)}),s};var WI=kI;const ip=dt,sp=Ct,XI=Pt,Hl=ot,Ai=Sf,qI=GI,rp=WI,jI=(t,e,n)=>{let i=null;return sp.isA(n)&&(i=Ai.fromSides(sp.toSides(n))),Hl.isA(n)&&(i=Ai.fromPoints(Hl.toPoints(n))),t===0||t===1?Ai.transform(ip.fromTranslation(ip.create(),[0,0,t]),i):null},YI=(t,e)=>{const n={numberOfSlices:2,capStart:!0,capEnd:!0,close:!1,repair:!0,callback:jI},{numberOfSlices:i,capStart:s,capEnd:r,close:o,repair:a,callback:c}=Object.assign({},n,t);if(i<2)throw new Error("numberOfSlices must be 2 or more");a&&(e=qI(e));const l=i-1;let f=null,u=null,h=null,d=[];for(let _=0;_{const n={segments:12,startAngle:0,angle:on,overflow:"cap"};let{segments:i,startAngle:s,angle:r,overflow:o}=Object.assign({},n,t);if(i<3)throw new Error("segments must be greater then 3");s=Math.abs(s)>on?s%on:s,r=Math.abs(r)>on?r%on:r;let a=s+r;if(a=Math.abs(a)>on?a%on:a,ai*y&&i++}let l=jo.toSides(e);if(l.length===0)throw new Error("the given geometry cannot be empty");const f=l.filter(y=>y[0][0]<0),u=l.filter(y=>y[0][0]>=0);f.length>0&&u.length>0&&o==="cap"&&(f.length>u.length?(l=l.map(y=>{let E=y[0],x=y[1];return E=[Math.min(E[0],0),E[1]],x=[Math.min(x[0],0),x[1]],[E,x]}),e=jo.create(l),e=KI(e)):u.length>=f.length&&(l=l.map(y=>{let E=y[0],x=y[1];return E=[Math.max(E[0],0),E[1]],x=[Math.max(x[0],0),x[1]],[E,x]}),e=jo.create(l)));const d=c/i,_=Math.abs(c){let M=d*E+s;return c===on&&E===i&&(M=s),Er.multiply(m,Er.fromZRotation(m,M),Er.fromXRotation(Er.create(),on/4)),rl.transform(m,x)};return t={numberOfSlices:i+1,capStart:_,capEnd:_,close:!_,callback:p},JI(t,g)};var eN=QI;const tN=ds,op=dt,ap=Ct,cp=Pt,lp=hi,nN=(t,...e)=>{if(!Array.isArray(t))throw new Error("angles must be an array");if(e=tN(e),e.length===0)throw new Error("wrong number of arguments");for(t=t.slice();t.length<3;)t.push(0);const n=t[2],i=t[1],s=t[0],r=op.fromTaitBryanRotation(op.create(),n,i,s),o=e.map(a=>lp.isA(a)?lp.transform(r,a):ap.isA(a)?ap.transform(r,a):cp.isA(a)?cp.transform(r,a):a);return o.length===1?o[0]:o};var iN={rotate:nN};const sN=ds,fp=dt,up=Ct,hp=Pt,dp=hi,Va=(t,...e)=>{if(!Array.isArray(t))throw new Error("offset must be an array");if(e=sN(e),e.length===0)throw new Error("wrong number of arguments");for(t=t.slice();t.length<3;)t.push(0);const n=fp.fromTranslation(fp.create(),t),i=e.map(s=>dp.isA(s)?dp.transform(n,s):up.isA(s)?up.transform(n,s):hp.isA(s)?hp.transform(n,s):s);return i.length===1?i[0]:i},rN=(t,...e)=>Va([t,0,0],e),oN=(t,...e)=>Va([0,t,0],e),aN=(t,...e)=>Va([0,0,t],e);var Dr={translate:Va,translateX:rN,translateY:oN,translateZ:aN};const{TAU:cN}=Qe,lN=eN,{rotate:fN}=iN,{translate:uN}=Dr,hN=Fg,{isGT:ol,isGTE:al}=Et,dN=t=>{const e={innerRadius:1,innerSegments:32,outerRadius:4,outerSegments:32,innerRotation:0,startAngle:0,outerRotation:cN},{innerRadius:n,innerSegments:i,outerRadius:s,outerSegments:r,innerRotation:o,startAngle:a,outerRotation:c}=Object.assign({},e,t);if(!ol(n,0))throw new Error("innerRadius must be greater than zero");if(!al(i,3))throw new Error("innerSegments must be three or more");if(!ol(s,0))throw new Error("outerRadius must be greater than zero");if(!al(r,3))throw new Error("outerSegments must be three or more");if(!al(a,0))throw new Error("startAngle must be positive");if(!ol(c,0))throw new Error("outerRotation must be greater than zero");if(n>=s)throw new Error("inner circle is too large to rotate about the outer circle");let l=hN({radius:n,segments:i});return o!==0&&(l=fN([0,0,o],l)),l=uN([s,0],l),lN({startAngle:a,angle:c,segments:r},l)};var pN=dN;const{NEPS:tr}=Qe,Sr=We,mN=Ct,{isNumberArray:gN}=Et,Vl=(t,e,n)=>Math.acos((t*t+e*e-n*n)/(2*t*e)),_N=(t,e,n)=>e>tr?Math.sqrt(t*t+n*n-2*t*n*Math.cos(e)):Math.sqrt((t-n)*(t-n)+t*n*e*e*(1-e*e/12)),vN=t=>{if(Math.abs(t[0]+t[1]+t[2]-Math.PI)>tr)throw new Error("AAA triangles require angles that sum to PI");const n=t[0],i=t[1],s=Math.PI-n-i,r=1,o=r/Math.sin(s)*Math.sin(n),a=r/Math.sin(s)*Math.sin(i);return lr(n,i,s,o,a,r)},xN=t=>{const e=t[0],n=t[1],i=Math.PI+tr-e-n;if(i{const e=t[0],n=t[2],i=Math.PI+tr-e-n;if(i{const e=t[0],n=t[1],i=t[2],s=_N(e,n,i),r=Vl(s,e,i),o=Math.PI-r-n;return lr(r,n,o,i,s,e)},SN=t=>{const e=t[0],n=t[1],i=t[2],s=Math.asin(n*Math.sin(i)/e),r=Math.PI-s-i,o=e/Math.sin(i)*Math.sin(r);return lr(s,r,i,n,o,e)},yN=t=>{const e=t[1],n=t[2],i=t[0];if(e+n<=i||n+i<=e||i+e<=n)throw new Error("SSS triangle is incorrect, as the longest side is longer than the sum of the other sides");const s=Vl(n,i,e),r=Vl(i,e,n),o=Math.PI-s-r;return lr(s,r,o,e,n,i)},lr=(t,e,n,i,s,r)=>{const o=Sr.fromValues(0,0),a=Sr.fromValues(r,0),c=Sr.fromValues(i,0);return Sr.add(c,Sr.rotate(c,c,[0,0],Math.PI-e),a),mN.fromPoints([o,a,c])},bN=t=>{const e={type:"SSS",values:[1,1,1]};let{type:n,values:i}=Object.assign({},e,t);if(typeof n!="string")throw new Error("triangle type must be a string");if(n=n.toUpperCase(),!((n[0]==="A"||n[0]==="S")&&(n[1]==="A"||n[1]==="S")&&(n[2]==="A"||n[2]==="S")))throw new Error("triangle type must contain three letters; A or S");if(!gN(i,3))throw new Error("triangle values must contain three values");if(!i.every(s=>s>0))throw new Error("triangle values must be greater than zero");switch(n){case"AAA":return vN(i);case"AAS":return xN(i);case"ASA":return MN(i);case"SAS":return EN(i);case"SSA":return SN(i);case"SSS":return yN(i);default:throw new Error("invalid triangle type, try again")}};var TN=bN,Yo={arc:kR,circle:Fg,cube:G3,cuboid:xf,cylinder:Qg,cylinderElliptic:Jg,ellipse:Ng,ellipsoid:e0,geodesicSphere:oD,line:lD,polygon:uD,polyhedron:t0,rectangle:Mf,roundedCuboid:vD,roundedCylinder:bD,roundedRectangle:AD,sphere:LD,square:ND,star:VD,torus:pN,triangle:TN};function wN({width:t,length:e,safety:n=0}){const o=t+n,a=e+n,c=Dr.translate([0,a/2+2.5/2,0],Yo.cuboid({size:[o+5,2.5,10]})),l=Dr.translate([0,-a/2-2.5/2,0],Yo.cuboid({size:[o+5,2.5,10]})),f=Dr.translate([o/2+2.5/2,0,0],Yo.cuboid({size:[2.5,a+5,10]})),u=Dr.translate([-o/2-2.5/2,0,0],Yo.cuboid({size:[2.5,a+5,10]}));return[c,l,f,u]}var h0={geom2:Ct,geom3:Pt,path2:hi,poly3:ot};const AN=()=>[0,1,0];var yf=AN;const RN=yf,CN=t=>{const e=RN();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e};var PN=CN;const cl=We,LN=t=>{const e=cl.normal(cl.create(),t);return cl.negate(e,e),e};var bf=LN;const pp=We,DN=t=>pp.scale(pp.create(),t,t[2]);var Ga=DN;const yr=We,UN=bf,IN=Ga,NN=(t,e)=>{const n=IN(t),i=UN(t),s=yr.subtract(yr.create(),e,n),r=yr.dot(s,i);return yr.scale(s,i,r),yr.add(s,s,n),s};var FN=NN;const ON=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t);var d0=ON;const BN=We,zN=(t,e)=>{let n=BN.dot(e,t);return n=Math.abs(n-t[2]),n};var HN=zN;const VN=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2];var GN=VN;const br=We,$N=(t,e,n)=>{const i=br.subtract(br.create(),n,e);br.normal(i,i),br.normalize(i,i);const s=br.dot(e,i);return t[0]=i[0],t[1]=i[1],t[2]=s,t};var p0=$N;const kN=yf,WN=(t,e,n)=>{const i=kN();return i[0]=t,i[1]=e,i[2]=n,i};var m0=WN;const XN=We,{solve2Linear:qN}=u0,jN=(t,e)=>{const n=qN(t[0],t[1],e[0],e[1],t[2],e[2]);return XN.clone(n)};var YN=jN;const mp=We,ZN=d0,KN=m0,JN=(t,e)=>{const n=mp.negate(mp.create(),e),i=-e[2];return ZN(t,KN(n[0],n[1],i))};var QN=JN;const eF=t=>`line2: (${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)})`;var tF=eF;const gp=We,nF=p0,iF=Ga,sF=bf,rF=(t,e,n)=>{const i=iF(e),s=sF(e);return gp.transform(i,i,n),gp.transform(s,s,n),nF(t,i,s)};var oF=rF;const aF=Ga,cF=(t,e)=>{let n=(t[2]-t[1]*e)/t[0];return Number.isNaN(n)&&(n=aF(t)[0]),n};var lF=cF,fF={clone:PN,closestPoint:FN,copy:d0,create:yf,direction:bf,distanceToPoint:HN,equals:GN,fromPoints:p0,fromValues:m0,intersectPointOfLines:YN,origin:Ga,reverse:QN,toString:tF,transform:oF,xAtY:lF};const uF=ds,Hn=We,Tr=Ge,g0=Ct,_0=Pt,v0=hi,_p=ot,nr=new WeakMap,hF=t=>{let e=nr.get(t);if(e)return e;const n=v0.toPoints(t);let i;n.length===0?i=Hn.create():i=Hn.clone(n[0]);let s=Hn.clone(i);return n.forEach(r=>{Hn.min(i,i,r),Hn.max(s,s,r)}),i=[i[0],i[1],0],s=[s[0],s[1],0],e=[i,s],nr.set(t,e),e},dF=t=>{let e=nr.get(t);if(e)return e;const n=g0.toPoints(t);let i;n.length===0?i=Hn.create():i=Hn.clone(n[0]);let s=Hn.clone(i);return n.forEach(r=>{Hn.min(i,i,r),Hn.max(s,s,r)}),i=[i[0],i[1],0],s=[s[0],s[1],0],e=[i,s],nr.set(t,e),e},pF=t=>{let e=nr.get(t);if(e)return e;const n=_0.toPolygons(t);let i=Tr.create();if(n.length>0){const r=_p.toPoints(n[0]);Tr.copy(i,r[0])}let s=Tr.clone(i);return n.forEach(r=>{_p.toPoints(r).forEach(o=>{Tr.min(i,i,o),Tr.max(s,s,o)})}),i=[i[0],i[1],i[2]],s=[s[0],s[1],s[2]],e=[i,s],nr.set(t,e),e},mF=(...t)=>{if(t=uF(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>v0.isA(n)?hF(n):g0.isA(n)?dF(n):_0.isA(n)?pF(n):[[0,0,0],[0,0,0]]);return e.length===1?e[0]:e};var gF=mF;const{EPS:_F}=Qe,vF=(t,e)=>{let n=0;for(let i=0;iTf(wf(t),2),TF=t=>Tf(wf(t),2),wF=t=>Tf(wf(t),3),AF=(...t)=>{if(t=MF(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>yF.isA(n)?bF(n):EF.isA(n)?TF(n):SF.isA(n)?wF(n):0);return e.length===1?e[0]:e};var x0=AF;const RF=(t,e)=>t-e;var CF=RF;const PF=(t,e,n)=>{let i=0,s=t.length;for(;s>i;){const r=Math.floor((i+s)/2),o=t[r];n(e,o)>0?i=r+1:s=r}t.splice(i,0,e)};var LF=PF,DF={fnNumberSort:CF,insertSorted:LF};const vp=dt,UF=We,_t=Ge,M0=function(t,e){arguments.length<2&&(e=_t.orthogonal(_t.create(),t)),this.v=_t.normalize(_t.create(),_t.cross(_t.create(),t,e)),this.u=_t.cross(_t.create(),this.v,t),this.plane=t,this.planeorigin=_t.scale(_t.create(),t,t[3])};M0.prototype={getProjectionMatrix:function(){return vp.fromValues(this.u[0],this.v[0],this.plane[0],0,this.u[1],this.v[1],this.plane[1],0,this.u[2],this.v[2],this.plane[2],0,0,0,-this.plane[3],1)},getInverseProjectionMatrix:function(){const t=_t.scale(_t.create(),this.plane,this.plane[3]);return vp.fromValues(this.u[0],this.u[1],this.u[2],0,this.v[0],this.v[1],this.v[2],0,this.plane[0],this.plane[1],this.plane[2],0,t[0],t[1],t[2],1)},to2D:function(t){return UF.fromValues(_t.dot(t,this.u),_t.dot(t,this.v))},to3D:function(t){const e=_t.scale(_t.create(),this.u,t[0]),n=_t.scale(_t.create(),this.v,t[1]),i=_t.add(e,e,this.planeorigin);return _t.add(n,n,i)}};var IF=M0;const{EPS:ti}=Qe,yi=fF,bn=We,NF=IF,Ns=eI,{insertSorted:FF,fnNumberSort:OF}=DF,xp=ot,BF=t=>{if(t.length<2)return t;const e=[],n=t.length,i=xp.plane(t[0]),s=new NF(i),r=[],o=[],a=new Map,c=new Map,l=new Map,f=10/ti;for(let _=0;_0){let E,x;for(let M=0;Mx)&&(x=v);let T=c.get(v);T||(T={},c.set(v,T)),T[_]=!0}if(E>=x)m=[],p=0,y=-1;else{let M=a.get(E);M||(M=[],a.set(E,M)),M.push(_)}}m.reverse(),y=p-y-1,r.push(m),o.push(y)}const u=[];c.forEach((_,g)=>u.push(g)),u.sort(OF);let h=[],d=[];for(let _=0;_=w&&(N=0),b[N][1]!==m)break;D=N}let T=v-1;if(T<0&&(T=w-1),b[T][1]===m&&(v=T),D!==x.leftvertexindex&&D===v)h.splice(E,1),--E;else{x.leftvertexindex=D,x.rightvertexindex=v,x.topleft=b[D],x.topright=b[v];let N=D+1;N>=w&&(N=0),x.bottomleft=b[N];let U=v-1;U<0&&(U=w-1),x.bottomright=b[U]}}}let y;if(_>=u.length-1)h=[],y=null;else{y=Number(u[_+1]);const E=.5*(m+y),x=a.get(m);for(const M in x){const b=x[M],w=r[b],D=w.length,v=o[b];let T=v;for(;;){let B=T+1;if(B>=D&&(B=0),w[B][1]!==m||B===v)break;T=B}let N=v;for(;;){let B=N-1;if(B<0&&(B=D-1),w[B][1]!==m||B===T)break;N=B}let U=T+1;U>=D&&(U=0);let I=N-1;I<0&&(I=D-1);const F={polygonindex:b,leftvertexindex:T,rightvertexindex:N,topleft:w[T],topright:w[N],bottomleft:w[U],bottomright:w[I]};FF(h,F,(B,V)=>{const $=Ns(B.topleft,B.bottomleft,E),k=Ns(V.topleft,V.bottomleft,E);return $>k?1:$0){const N=g[g.length-1],U=bn.distance(T.topleft,N.topright),I=bn.distance(T.bottomleft,N.bottomright);U0){const E=new Set,x=new Set;for(let M=0;M=0,k=V||F>=0;$&&k&&(b.outpolygon=D.outpolygon,b.leftlinecontinues=B,b.rightlinecontinues=V,E.add(w));break}}}for(let M=0;Mti&&b.outpolygon.leftpoints.push(b.bottomleft),b.outpolygon.leftpoints.reverse();const D=b.outpolygon.rightpoints.concat(b.outpolygon.leftpoints).map(T=>s.to3D(T)),v=xp.fromPointsAndPlane(D,i);v.vertices.length&&e.push(v)}}for(let E=0;Eti&&x.outpolygon.rightpoints.push(x.topright))}d=g}return e};var zF=BF;const Mp=Pt,HF=ot,{NEPS:VF}=Qe,GF=zF,$F=t=>{if(t.isRetesselated)return t;const e=Mp.toPolygons(t).map((r,o)=>({vertices:r.vertices,plane:HF.plane(r),index:o})),n=kF(e),i=[];n.forEach(r=>{if(Array.isArray(r)){const o=GF(r);i.push(...o)}else i.push(r)});const s=Mp.create(i);return s.isRetesselated=!0,s},kF=t=>{let e=[t];const n=[];for(let s=3;s>=0;s--){const r=[],o=s===3?15e-9:VF;e.forEach(a=>{a.sort(WF(s,o));let c=0;for(let l=1;lo&&(l-c===1?n.push(a[c]):r.push(a.slice(c,l)),c=l);a.length-c===1?n.push(a[c]):r.push(a.slice(c))}),e=r}const i=[];return e.forEach(s=>{s[0]&&(i[s[0].index]=s)}),n.forEach(s=>{i[s.index]=s}),i},WF=(t,e)=>(n,i)=>n.plane[t]-i.plane[t]>e?1:i.plane[t]-n.plane[t]>e?-1:0;var XF=$F;const ll=Ge,E0=ot,qF=(t,e)=>{const n=Math.abs(E0.measureArea(e));return Number.isFinite(n)&&n>t},jF=(t,e)=>{let n=e.map(s=>{const r=s.vertices.map(c=>ll.snap(ll.create(),c,t)),o=[];for(let c=0;cqF(i,s)),n};var S0=jF;const YF=KU,Hs=Ge,pa=ot,ZF=t=>{const e=pa.toPoints(t),n=[];for(let i=0;i{const n=`${e.v1}:${e.v2}`;t.set(n,e)},fl=(t,e)=>{const n=`${e.v1}:${e.v2}`;t.delete(n)},JF=(t,e)=>{const n=`${e.v2}:${e.v1}`;return t.get(n)},QF=(t,e,n)=>{let i=t.prev.v1,s=t.prev.v2,r=e.next.v2;const o=Ep(i,s,r,n);i=e.prev.v1,s=e.prev.v2,r=t.next.v2;const a=Ep(i,s,r,n);return[o,a]},eO=Hs.create(),tO=Hs.create(),Ep=(t,e,n,i)=>{const s=Hs.subtract(eO,e,t),r=Hs.subtract(tO,n,e);return Hs.cross(s,s,r),Hs.dot(s,i)},nO=t=>{let e;const n=[];for(;t.next;){const i=t.next;n.push(t.v1),t.v1=null,t.v2=null,t.next=null,t.prev=null,t=i}return n.length>0&&(e=pa.create(n)),e},iO=t=>{if(t.length<2)return t;const e=t[0].plane,n=t.slice(),i=new Map;for(;n.length>0;){const r=n.shift(),o=ZF(r);for(let a=0;a=0&&f[1]>=0){const u=l.next,h=c.next;c.prev.next=l.next,c.next.prev=l.prev,l.prev.next=c.next,l.next.prev=c.prev,c.v1=null,c.v2=null,c.next=null,c.prev=null,fl(i,l),l.v1=null,l.v2=null,l.next=null,l.prev=null;const d=(_,g,m)=>{const p={v1:m.v1,v2:g.v2,next:g.next,prev:m.prev};m.prev.next=p,g.next.prev=p,fl(_,g),g.v1=null,g.v2=null,g.next=null,g.prev=null,fl(_,m),m.v1=null,m.v2=null,m.next=null,m.prev=null};f[0]===0&&d(i,u,u.prev),f[1]===0&&d(i,h,h.prev)}}else c.next&&KF(i,c)}}const s=[];return i.forEach(r=>{const o=nO(r);o&&s.push(o)}),i.clear(),s},sO=(t,e)=>Math.abs(t[3]-e[3])<15e-8?YF(t,e):!1,rO=(t,e)=>{const n=[];e.forEach(s=>{const r=n.find(o=>sO(o[0],pa.plane(s)));r?r[1].push(s):n.push([pa.plane(s),[s]])});let i=[];return n.forEach(s=>{const r=s[1],o=iO(r);i=i.concat(o)}),i};var oO=rO;const Sp=Qe,Fn=Ge,aO=ot,Gt=t=>`${t}`,yp=(t,e,n,i,s,r)=>{const o=Gt(i),a=Gt(s),c=`${o}/${a}`,l=`${a}/${o}`;if(t.has(l))return na(t,e,n,s,i,null),null;const f={vertex0:i,vertex1:s,polygonindex:r};return t.has(c)?t.get(c).push(f):t.set(c,[f]),e.has(o)?e.get(o).push(c):e.set(o,[c]),n.has(a)?n.get(a).push(c):n.set(a,[c]),c},na=(t,e,n,i,s,r)=>{const o=Gt(i),a=Gt(s),c=`${o}/${a}`;let l=-1;const f=t.get(c);for(let u=0;u{const e=new Map;for(let n=0;n=3){let r=i.vertices[0],o=Gt(r);for(let a=0;a0){const n=new Map,i=new Map,s=new Map;for(const[o,a]of e)s.set(o,!0),a.forEach(c=>{const l=Gt(c.vertex0),f=Gt(c.vertex1);n.has(l)?n.get(l).push(o):n.set(l,[o]),i.has(f)?i.get(f).push(o):i.set(f,[o])});const r=t.slice(0);for(;e.size!==0;){for(const a of e.keys())s.set(a,!0);let o=!1;for(;;){const a=Array.from(s.keys());if(a.length===0)break;const c=a[0];let l=!0;if(e.has(c)){const u=e.get(c)[0];for(let h=0;h<2;h++){const d=h===0?u.vertex0:u.vertex1,_=h===0?u.vertex1:u.vertex0,g=Gt(d),m=Gt(_);let p=[];h===0?i.has(g)&&(p=i.get(g)):n.has(g)&&(p=n.get(g));for(let y=0;y0&&N<1){const U=Fn.scale(Fn.create(),T,N);if(Fn.add(U,U,w),Fn.squaredDistance(U,D){const i=e.vertices.length;if(i>3){if(i>4){const o=[0,0,0];e.vertices.forEach(a=>ul.add(o,o,a)),ul.snap(o,ul.divide(o,o,[i,i,i]),t);for(let a=0;a{const n=[];return e.forEach(i=>{fO(t,i,n)}),n};var hO=uO;const dO=ds,pO=x0,mO=Ct,y0=Pt,gO=hi,_O=S0,vO=oO,xO=lO,MO=hO,EO=(t,e)=>e,SO=(t,e)=>e,yO=(t,e)=>{const n={snap:!1,simplify:!1,triangulate:!1},{snap:i,simplify:s,triangulate:r}=Object.assign({},n,t),o=pO(e);let a=y0.toPolygons(e);i&&(a=_O(o,a)),s&&(a=vO(o,a)),r&&(a=xO(a),a=MO(o,a));const c=Object.assign({},e);return c.polygons=a,c},bO=(t,...e)=>{if(e=dO(e),e.length===0)throw new Error("wrong number of arguments");const n=e.map(i=>{if(gO.isA(i))return EO(t,i);if(mO.isA(i))return SO(t,i);if(y0.isA(i))return yO(t,i);throw new Error("invalid geometry")});return n.length===1?n[0]:n};var TO=bO;const wO=ds,Ji=We,Gl=Ct,$l=Pt,kl=hi,Af=x0,AO=S0,RO=t=>{const e=Af(t),i=kl.toPoints(t).map(s=>Ji.snap(Ji.create(),s,e));return kl.create(i)},CO=t=>{const e=Af(t);let i=Gl.toSides(t).map(s=>[Ji.snap(Ji.create(),s[0],e),Ji.snap(Ji.create(),s[1],e)]);return i=i.filter(s=>!Ji.equals(s[0],s[1])),Gl.create(i)},PO=t=>{const e=Af(t),n=$l.toPolygons(t),i=AO(e,n);return $l.create(i)},LO=(...t)=>{if(t=wO(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>kl.isA(n)?RO(n):Gl.isA(n)?CO(n):$l.isA(n)?PO(n):n);return e.length===1?e[0]:e};var DO=LO,UO={generalize:TO,snap:DO,retessellate:XF},Rf={geometries:h0,modifiers:UO};const b0=t=>t.reduce((e,n)=>Array.isArray(n)?e.concat(b0(n)):e.concat(n),[]);var IO=b0;const NO=t=>Array.isArray(t)?t:t==null?[]:[t];var FO=NO,OO={flatten:IO,toArray:FO};const{geometries:dl}=Rf,BO=(t,e)=>{e.statusCallback&&e.statusCallback({progress:0});const n=new ArrayBuffer(4),i=new Int32Array(n,0,1),s=new Int8Array(n,0,4);if(i[0]=287454020,s[0]!==68)throw new Error("Binary STL output is currently only supported on little-endian (Intel) processors");let r=0,o=0;t.forEach((m,p)=>{dl.geom3.toPolygons(m).forEach(E=>{const x=E.vertices.length,M=x>=3?x-2:0;r+=M,o+=1})});const a=new Uint8Array(80);for(let m=0;m<80;m++)a[m]=65;const c=new Uint32Array(1);c[0]=r;const l=new ArrayBuffer(50*r),f=new Int8Array(l),u=new ArrayBuffer(50),h=new Int8Array(u),d=new Float32Array(u,0,12),_=new Uint16Array(u,48,1);let g=0;return t.forEach(m=>{dl.geom3.toPolygons(m).forEach((y,E)=>{const x=y.vertices,M=x.length,b=dl.poly3.plane(y);for(let w=0;w0?w:0),N=x[T];d[D++]=N[0],d[D++]=N[1],d[D++]=N[2]}_[0]=0,f.set(h,g),g+=50}e.statusCallback&&e.statusCallback({progress:100*E/o})})}),e.statusCallback&&e.statusCallback({progress:100}),[a.buffer,c.buffer,l]};var zO={serializeBinary:BO};const{geometries:T0}=Rf,HO=(t,e)=>{e.statusCallback&&e.statusCallback({progress:0});const n=`solid JSCAD +${VO(t,e)} endsolid JSCAD -`;return e.statusCallback&&e.statusCallback({progress:100}),[n]},KF=(t,e)=>{const n=[];return t.forEach((i,s)=>{n.push(JF(i)),e.statusCallback&&e.statusCallback({progress:100*s/t.length})}),n.join(` -`)},JF=(t,e)=>{const n=[];return Hg.geom3.toPolygons(t).forEach((s,r)=>{n.push(QF(s))}),n.join(` -`)},Gg=t=>`${t[0]} ${t[1]} ${t[2]}`,Wc=t=>`vertex ${Gg(t)}`,QF=t=>{const e=[];if(t.vertices.length>=3){const n=Wc(t.vertices[0]);for(let i=0;i{const n=[];return t.forEach((i,s)=>{n.push(GO(i)),e.statusCallback&&e.statusCallback({progress:100*s/t.length})}),n.join(` +`)},GO=(t,e)=>{const n=[];return T0.geom3.toPolygons(t).forEach((s,r)=>{n.push($O(s))}),n.join(` +`)},w0=t=>`${t[0]} ${t[1]} ${t[2]}`,pl=t=>`vertex ${w0(t)}`,$O=t=>{const e=[];if(t.vertices.length>=3){const n=pl(t.vertices[0]);for(let i=0;i{t=Object.assign({},{binary:!0,statusCallback:null},t),e=iO(e);let i=e.filter(s=>tO.geom3.isA(s));if(i.length===0)throw new Error("only 3D geometries can be serialized to STL");return e.length!==i.length&&console.warn("some objects could not be serialized to STL"),i=sO(nO.generalize({snap:!0,triangulate:!0},i)),t.binary?rO(i,t):oO(i,t)};var lO={mimeType:aO,serialize:cO};const fO={props:["width","length","safety"],data(){return{stlData:null,currentWidth:0,currentLength:0,currentSafety:0,tweenDuration:1e3}},computed:{targetDimensions(){return{width:this.width,length:this.length,safety:this.safety}}},watch:{targetDimensions:{handler(t,e){!e||e.width===t.width&&e.length===t.length&&e.safety===t.safety||this.animateDimensionsTransition({width:this.currentWidth,length:this.currentLength,safety:this.currentSafety},t)},deep:!0}},created(){this.scene=null,this.camera=null,this.renderer=null,this.controls=null,this.mesh=null},mounted(){this.currentWidth=this.width,this.currentLength=this.length,this.currentSafety=this.safety,this.initScene(),this.createInitialMesh()},methods:{generateSTL(t,e,n){try{const i=FI({width:t,length:e,safety:n});return lO.serialize({binary:!1},i).join(` -`)}catch(i){return console.error("Error generating geometry or STL:",i),null}},createInitialMesh(){const t=this.generateSTL(this.width,this.length,this.safety);if(!t)return;this.stlData=t;const n=new uh().parse(t),i=new $y({color:30719});this.mesh=new ii(n,i),this.scene.add(this.mesh)},animateDimensionsTransition(t,e){const n=performance.now(),i=this.tweenDuration,s=new uh,r=o=>{const a=o-n,c=Math.min(a/i,1),l=t.width+(e.width-t.width)*c,f=t.length+(e.length-t.length)*c,u=t.safety+(e.safety-t.safety)*c,h=this.generateSTL(l,f,u);if(h){const d=s.parse(h);this.mesh&&(this.mesh.geometry.dispose(),this.mesh.geometry=d),this.stlData=h}c<1?requestAnimationFrame(r):(this.currentWidth=e.width,this.currentLength=e.length,this.currentSafety=e.safety)};requestAnimationFrame(r)},initScene(){this.scene=new Gy,this.camera=new pn(75,600/500,.1,1e3),this.camera.position.set(0,70,150),this.camera.lookAt(0,0,0),this.renderer=new Am({canvas:this.$refs.canvas,antialias:!0}),this.renderer.setSize(600,500),this.renderer.setClearColor(15790320);const n=new Ky(4210752);this.scene.add(n);const i=new Zy(16777215,1);i.position.set(1,1,1).normalize(),this.scene.add(i),this.controls=new Jy(this.camera,this.renderer.domElement),this.controls.rotateSpeed=1,this.controls.zoomSpeed=1.2,this.controls.panSpeed=.8,this.controls.noZoom=!1,this.controls.noPan=!1,this.controls.staticMoving=!1,this.controls.dynamicDampingFactor=.05,this.animate()},animate(){requestAnimationFrame(this.animate),this.controls&&this.controls.update(),this.renderer.render(this.scene,this.camera)},downloadSTL(){if(!this.stlData)return;const t=new Blob([this.stlData],{type:"application/octet-stream"}),e=document.createElement("a");e.href=URL.createObjectURL(t),e.download=`SynthArmor_cover_${this.width}x${this.length}_safety${this.safety}.stl`,e.click()}}},uO={class:"mt-6 flex flex-col items-center"},hO={ref:"canvas",class:"border border-gray-300 rounded-md w-full max-w-[600px]"};function dO(t,e,n,i,s,r){return Bl(),zl("div",uO,[ft("canvas",hO,null,512),ft("button",{onClick:e[0]||(e[0]=(...o)=>r.downloadSTL&&r.downloadSTL(...o)),class:"mt-4 px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600"}," Download STL ")])}const pO=Hl(fO,[["render",dO]]),mO={name:"App",components:{InputForm:Cv,ModelViewer:pO},data(){return{width:155,length:105,safety:0}},methods:{updateDimensions({width:t,length:e,safety:n}){this.width=t,this.length=e,this.safety=n}}},gO={class:"max-w-3xl mx-auto min-h-screen flex flex-col justify-center items-center p-6"},_O={class:"w-full max-w-[600px] bg-white rounded shadow p-6"};function vO(t,e,n,i,s,r){const o=vf("InputForm"),a=vf("ModelViewer");return Bl(),zl("div",gO,[e[0]||(e[0]=ft("div",{class:"mb-8 text-center"},[ft("h1",{class:"text-4xl font-bold mb-2"},"SynthArmor"),ft("p",{class:"text-gray-600"}," Modify the dimensions of a 3D model and download your custom design instantly. ")],-1)),ft("div",_O,[si(o,{"initial-width":s.width,"initial-length":s.length,"initial-safety":s.safety,onUpdateDimensions:r.updateDimensions},null,8,["initial-width","initial-length","initial-safety","onUpdateDimensions"]),si(a,{width:s.width,length:s.length,safety:s.safety},null,8,["width","length","safety"])])])}const xO=Hl(mO,[["render",vO]]);Mv(xO).mount("#app"); +`)};var kO={serializeText:HO};const{geometries:WO,modifiers:XO}=Rf,{flatten:qO,toArray:jO}=OO,{serializeBinary:YO}=zO,{serializeText:ZO}=kO,KO="application/sla",JO=(t,...e)=>{t=Object.assign({},{binary:!0,statusCallback:null},t),e=qO(e);let i=e.filter(s=>WO.geom3.isA(s));if(i.length===0)throw new Error("only 3D geometries can be serialized to STL");return e.length!==i.length&&console.warn("some objects could not be serialized to STL"),i=jO(XO.generalize({snap:!0,triangulate:!0},i)),t.binary?YO(i,t):ZO(i,t)};var QO={mimeType:KO,serialize:JO};const eB={props:["width","length","safety"],data(){return{stlData:null,currentWidth:0,currentLength:0,currentSafety:0,tweenDuration:1e3}},computed:{targetDimensions(){return{width:this.width,length:this.length,safety:this.safety}}},watch:{targetDimensions:{handler(t,e){!e||e.width===t.width&&e.length===t.length&&e.safety===t.safety||this.animateDimensionsTransition({width:this.currentWidth,length:this.currentLength,safety:this.currentSafety},t)},deep:!0}},created(){this.scene=null,this.camera=null,this.renderer=null,this.controls=null,this.mesh=null},mounted(){this.currentWidth=this.width,this.currentLength=this.length,this.currentSafety=this.safety,this.initScene(),this.createInitialMesh()},methods:{generateSTL(t,e,n){try{const i=wN({width:t,length:e,safety:n});return QO.serialize({binary:!1},i).join(` +`)}catch(i){return console.error("Error generating geometry or STL:",i),null}},createInitialMesh(){const t=this.generateSTL(this.width,this.length,this.safety);if(!t)return;this.stlData=t;const n=new Ih().parse(t),i=new Ub({color:30719});this.mesh=new ai(n,i),this.scene.add(this.mesh)},animateDimensionsTransition(t,e){const n=performance.now(),i=this.tweenDuration,s=new Ih,r=o=>{const a=o-n,c=Math.min(a/i,1),l=t.width+(e.width-t.width)*c,f=t.length+(e.length-t.length)*c,u=t.safety+(e.safety-t.safety)*c,h=this.generateSTL(l,f,u);if(h){const d=s.parse(h);this.mesh&&(this.mesh.geometry.dispose(),this.mesh.geometry=d),this.stlData=h}c<1?requestAnimationFrame(r):(this.currentWidth=e.width,this.currentLength=e.length,this.currentSafety=e.safety)};requestAnimationFrame(r)},initScene(){this.scene=new Db,this.camera=new gn(75,600/500,.1,1e3),this.camera.position.set(0,70,150),this.camera.lookAt(0,0,0),this.renderer=new ug({canvas:this.$refs.canvas,antialias:!0}),this.renderer.setSize(600,500),this.renderer.setClearColor(15790320);const n=new Vb(4210752);this.scene.add(n);const i=new Hb(16777215,1);i.position.set(1,1,1).normalize(),this.scene.add(i),this.controls=new Gb(this.camera,this.renderer.domElement),this.controls.rotateSpeed=1,this.controls.zoomSpeed=1.2,this.controls.panSpeed=.8,this.controls.noZoom=!1,this.controls.noPan=!1,this.controls.staticMoving=!1,this.controls.dynamicDampingFactor=.05,this.animate()},animate(){requestAnimationFrame(this.animate),this.controls&&this.controls.update(),this.renderer.render(this.scene,this.camera)},downloadSTL(){if(!this.stlData)return;const t=new Blob([this.stlData],{type:"application/octet-stream"}),e=document.createElement("a");e.href=URL.createObjectURL(t),e.download=`SynthArmor_cover_${this.width}x${this.length}_safety${this.safety}.stl`,e.click()}}},tB={class:"mt-6 flex flex-col items-center"},nB={ref:"canvas",class:"border border-gray-300 rounded-md w-full max-w-[600px]"};function iB(t,e,n,i,s,r){return Qi(),es("div",tB,[nt("canvas",nB,null,512),nt("button",{onClick:e[0]||(e[0]=(...o)=>r.downloadSTL&&r.downloadSTL(...o)),class:"mt-4 px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600"}," Download STL ")])}const sB=Ra(eB,[["render",iB]]),rB={name:"FAQ",data(){return{faqs:[{question:"What is this ?",answer:"This app is designed to help you generate 3D model of a generic cover protection for all your musical (and otherwise) gear. The resulting STL file can be downloaded and 3D printed.",open:!1},{question:"How does it work ?",answer:`Tweak the dimensions of the generic cover model to your needs: +
    +
  • Input the precise dimensions of the machine you want the cover to be for
  • +
  • Optionaly - Fine adjust dimensions using the slider.
  • +
`,open:!1}]}},methods:{toggle(t){this.faqs[t].open=!this.faqs[t].open}}},oB={class:"w-full max-w-[600px] mt-8"},aB=["onClick"],cB={class:"text-lg font-medium text-gray-700"},lB={class:"px-6 py-4 bg-gray-50"},fB=["innerHTML"];function uB(t,e,n,i,s,r){return Qi(),es("div",oB,[e[1]||(e[1]=nt("h2",{class:"text-2xl font-bold mb-6 text-gray-800 text-center"},"FAQ",-1)),(Qi(!0),es(Tn,null,B_(s.faqs,(o,a)=>(Qi(),es("div",{key:a,class:"mb-4 border border-gray-200 rounded-lg overflow-hidden shadow-sm"},[nt("button",{onClick:c=>r.toggle(a),class:"w-full flex items-center justify-between px-6 py-4 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors"},[nt("span",cB,Lp(o.question),1),(Qi(),es("svg",{class:Ma(["w-5 h-5 text-gray-500 transform transition-transform duration-300",{"rotate-180":o.open}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e[0]||(e[0]=[nt("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)]),2))],8,aB),Xt(Bv,{name:"faq-collapse"},{default:tm(()=>[wr(nt("div",lB,[nt("div",{innerHTML:o.answer,class:"text-gray-600"},null,8,fB)],512),[[kv,o.open]])]),_:2},1024)]))),128))])}const hB=Ra(rB,[["render",uB],["__scopeId","data-v-585f6811"]]),dB={name:"App",components:{InputForm:xx,ModelViewer:sB,FAQ:hB},data(){return{width:155,length:105,safety:0}},methods:{updateDimensions({width:t,length:e,safety:n}){this.width=t,this.length=e,this.safety=n}}},pB={class:"max-w-3xl mx-auto min-h-screen flex flex-col justify-center items-center p-6"},mB={class:"w-full max-w-[600px] bg-white rounded shadow p-6"};function gB(t,e,n,i,s,r){const o=Qa("InputForm"),a=Qa("ModelViewer"),c=Qa("FAQ");return Qi(),es("div",pB,[e[0]||(e[0]=nt("div",{class:"mb-8 text-center"},[nt("h1",{class:"text-4xl font-bold mb-2"},"SynthArmor"),nt("p",{class:"text-gray-600"}," Modify the dimensions of a 3D model and download your custom design instantly. ")],-1)),nt("div",mB,[Xt(o,{"initial-width":s.width,"initial-length":s.length,"initial-safety":s.safety,onUpdateDimensions:r.updateDimensions},null,8,["initial-width","initial-length","initial-safety","onUpdateDimensions"]),Xt(a,{width:s.width,length:s.length,safety:s.safety},null,8,["width","length","safety"])]),Xt(c)])}const _B=Ra(dB,[["render",gB]]);fx(_B).mount("#app"); diff --git a/index.html b/index.html index 1eab1e2..2c8cb9c 100644 --- a/index.html +++ b/index.html @@ -19,8 +19,8 @@ href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet" /> - - + +