From a7dfaf34d11586854bce581c8ce2fd11e0838085 Mon Sep 17 00:00:00 2001 From: davidferlay Date: Sun, 23 Feb 2025 22:36:53 +0000 Subject: [PATCH] deploy: 80653856b0336e550bc432bb40a9b1e6dd13326a --- .../{index-EizA3HDV.js => index-P7MnQJcI.js} | 342 +++++++++--------- index.html | 2 +- 2 files changed, 172 insertions(+), 172 deletions(-) rename assets/{index-EizA3HDV.js => index-P7MnQJcI.js} (79%) diff --git a/assets/index-EizA3HDV.js b/assets/index-P7MnQJcI.js similarity index 79% rename from assets/index-EizA3HDV.js rename to assets/index-P7MnQJcI.js index 9d03bd5..55189a8 100644 --- a/assets/index-EizA3HDV.js +++ b/assets/index-P7MnQJcI.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 _l(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const nt={},Ds=[],Nn=()=>{},Wg=()=>!1,Zo=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),vl=t=>t.startsWith("onUpdate:"),Xt=Object.assign,xl=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Xg=Object.prototype.hasOwnProperty,Ke=(t,e)=>Xg.call(t,e),Be=Array.isArray,xr=t=>Jo(t)==="[object Map]",qg=t=>Jo(t)==="[object Set]",Oe=t=>typeof t=="function",bt=t=>typeof t=="string",qs=t=>typeof t=="symbol",mt=t=>t!==null&&typeof t=="object",ep=t=>(mt(t)||Oe(t))&&Oe(t.then)&&Oe(t.catch),Yg=Object.prototype.toString,Jo=t=>Yg.call(t),jg=t=>Jo(t).slice(8,-1),Kg=t=>Jo(t)==="[object Object]",Ml=t=>bt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Mr=_l(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Qo=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},Zg=/-(\w)/g,mn=Qo(t=>t.replace(Zg,(e,n)=>n?n.toUpperCase():"")),Jg=/\B([A-Z])/g,es=Qo(t=>t.replace(Jg,"-$1").toLowerCase()),ea=Qo(t=>t.charAt(0).toUpperCase()+t.slice(1)),Ta=Qo(t=>t?`on${ea(t)}`:""),Wi=(t,e)=>!Object.is(t,e),Io=(t,...e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:i,value:n})},Gc=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let cu;const ta=()=>cu||(cu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function El(t){if(Be(t)){const e={};for(let n=0;n{if(n){const i=n.split(e0);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Sl(t){let e="";if(bt(t))e=t;else if(Be(t))for(let n=0;nn in e}const nt={},Ds=[],Nn=()=>{},Wg=()=>!1,Qo=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Ml=t=>t.startsWith("onUpdate:"),Xt=Object.assign,El=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Xg=Object.prototype.hasOwnProperty,Ke=(t,e)=>Xg.call(t,e),Be=Array.isArray,xr=t=>ea(t)==="[object Map]",qg=t=>ea(t)==="[object Set]",Oe=t=>typeof t=="function",Tt=t=>typeof t=="string",qs=t=>typeof t=="symbol",gt=t=>t!==null&&typeof t=="object",ep=t=>(gt(t)||Oe(t))&&Oe(t.then)&&Oe(t.catch),Yg=Object.prototype.toString,ea=t=>Yg.call(t),jg=t=>ea(t).slice(8,-1),Kg=t=>ea(t)==="[object Object]",Sl=t=>Tt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Mr=xl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ta=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},Zg=/-(\w)/g,mn=ta(t=>t.replace(Zg,(e,n)=>n?n.toUpperCase():"")),Jg=/\B([A-Z])/g,es=ta(t=>t.replace(Jg,"-$1").toLowerCase()),na=ta(t=>t.charAt(0).toUpperCase()+t.slice(1)),Aa=ta(t=>t?`on${na(t)}`:""),Wi=(t,e)=>!Object.is(t,e),Fo=(t,...e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:i,value:n})},kc=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let uu;const ia=()=>uu||(uu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function yl(t){if(Be(t)){const e={};for(let n=0;n{if(n){const i=n.split(e0);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function bl(t){let e="";if(Tt(t))e=t;else if(Be(t))for(let n=0;n0)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 op(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function ap(t){let e,n=t.depsTail,i=n;for(;i;){const s=i.prevDep;i.version===-1?(i===n&&(n=s),Tl(i),a0(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}t.deps=e,t.depsTail=n}function $c(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(cp(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function cp(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Rr))return;t.globalVersion=Rr;const e=t.dep;if(t.flags|=2,e.version>0&&!t.isSSR&&t.deps&&!$c(t)){t.flags&=-3;return}const n=st,i=Tn;st=t,Tn=!0;try{op(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,ap(t),t.flags&=-3}}function Tl(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)Tl(r,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function a0(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 lp=[];function Ti(){lp.push(Tn),Tn=!1}function wi(){const t=lp.pop();Tn=t===void 0?!0:t}function lu(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=st;st=void 0;try{e()}finally{st=n}}}let Rr=0;class c0{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 c0(st,this),st.deps?(n.prevDep=st.depsTail,st.depsTail.nextDep=n,st.depsTail=n):st.deps=st.depsTail=n,fp(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++,Rr++,this.notify(e)}notify(e){yl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{bl()}}}function fp(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)fp(i)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const kc=new WeakMap,Xi=Symbol(""),Wc=Symbol(""),Pr=Symbol("");function Dt(t,e,n){if(Tn&&st){let i=kc.get(t);i||kc.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=kc.get(t);if(!o){Rr++;return}const a=c=>{c&&c.trigger()};if(yl(),e==="clear")o.forEach(a);else{const c=Be(t),l=c&&Ml(n);if(c&&n==="length"){const u=Number(i);o.forEach((f,h)=>{(h==="length"||h===Pr||!qs(h)&&h>=u)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),l&&a(o.get(Pr)),e){case"add":c?l&&a(o.get("length")):(a(o.get(Xi)),xr(t)&&a(o.get(Wc)));break;case"delete":c||(a(o.get(Xi)),xr(t)&&a(o.get(Wc)));break;case"set":xr(t)&&a(o.get(Xi));break}}bl()}function ss(t){const e=Je(t);return e===t?e:(Dt(e,"iterate",Pr),Fn(t)?e:e.map(on))}function wl(t){return Dt(t=Je(t),"iterate",Pr),t}const l0={__proto__:null,[Symbol.iterator](){return Aa(this,Symbol.iterator,on)},concat(...t){return ss(this).concat(...t.map(e=>Be(e)?ss(e):e))},entries(){return Aa(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 Ra(this,"includes",t)},indexOf(...t){return Ra(this,"indexOf",t)},join(t){return ss(this).join(t)},lastIndexOf(...t){return Ra(this,"lastIndexOf",t)},map(t,e){return zn(this,"map",t,e,void 0,arguments)},pop(){return er(this,"pop")},push(...t){return er(this,"push",t)},reduce(t,...e){return uu(this,"reduce",t,e)},reduceRight(t,...e){return uu(this,"reduceRight",t,e)},shift(){return er(this,"shift")},some(t,e){return zn(this,"some",t,e,void 0,arguments)},splice(...t){return er(this,"splice",t)},toReversed(){return ss(this).toReversed()},toSorted(t){return ss(this).toSorted(t)},toSpliced(...t){return ss(this).toSpliced(...t)},unshift(...t){return er(this,"unshift",t)},values(){return Aa(this,"values",on)}};function Aa(t,e,n){const i=wl(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 u0=Array.prototype;function zn(t,e,n,i,s,r){const o=wl(t),a=o!==t&&!Fn(t),c=o[e];if(c!==u0[e]){const f=c.apply(t,r);return a?on(f):f}let l=n;o!==t&&(a?l=function(f,h){return n.call(this,on(f),h,t)}:n.length>2&&(l=function(f,h){return n.call(this,f,h,t)}));const u=c.call(o,l,i);return a&&s?s(u):u}function uu(t,e,n,i){const s=wl(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 Ra(t,e,n){const i=Je(t);Dt(i,"iterate",Pr);const s=i[e](...n);return(s===-1||s===!1)&&Cl(n[0])?(n[0]=Je(n[0]),i[e](...n)):s}function er(t,e,n=[]){Ti(),yl();const i=Je(t)[e].apply(t,n);return bl(),wi(),i}const f0=_l("__proto__,__v_isRef,__isVue"),hp=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(qs));function h0(t){qs(t)||(t=String(t));const e=Je(this);return Dt(e,"has",t),e.hasOwnProperty(t)}class dp{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?S0:_p:r?gp:mp).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=Be(e);if(!s){let c;if(o&&(c=l0[n]))return c;if(n==="hasOwnProperty")return h0}const a=Reflect.get(e,n,Wt(e)?e:i);return(qs(n)?hp.has(n):f0(n))||(s||Dt(e,"get",n),r)?a:Wt(a)?o&&Ml(n)?a:a.value:mt(a)?s?vp(a):Rl(a):a}}class pp extends dp{constructor(e=!1){super(!1,e)}set(e,n,i,s){let r=e[n];if(!this._isShallow){const c=Bs(r);if(!Fn(i)&&!Bs(i)&&(r=Je(r),i=Je(i)),!Be(e)&&Wt(r)&&!Wt(i))return c?!1:(r.value=i,!0)}const o=Be(e)&&Ml(n)?Number(n)t,Yr=t=>Reflect.getPrototypeOf(t);function _0(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),u=n?Xc:e?qc:on;return!e&&Dt(r,"iterate",c?Wc:Xi),{next(){const{value:f,done:h}=l.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function jr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function v0(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}=Yr(o),l=e?Xc:t?qc: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?Xc:t?qc:on;return!t&&Dt(c,"iterate",Xi),a.forEach((u,f)=>s.call(r,l(u),l(f),o))}};return Xt(n,t?{add:jr("add"),set:jr("set"),delete:jr("delete"),clear:jr("clear")}:{add(s){!e&&!Fn(s)&&!Bs(s)&&(s=Je(s));const r=Je(this);return Yr(r).has.call(r,s)||(r.add(s),ei(r,"add",s,s)),this},set(s,r){!e&&!Fn(r)&&!Bs(r)&&(r=Je(r));const o=Je(this),{has:a,get:c}=Yr(o);let l=a.call(o,s);l||(s=Je(s),l=a.call(o,s));const u=c.call(o,s);return o.set(s,r),l?Wi(r,u)&&ei(o,"set",s,r):ei(o,"add",s,r),this},delete(s){const r=Je(this),{has:o,get:a}=Yr(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]=_0(s,t,e)}),n}function Al(t,e){const n=v0(t,e);return(i,s,r)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?i:Reflect.get(Ke(n,s)&&s in i?n:i,s,r)}const x0={get:Al(!1,!1)},M0={get:Al(!1,!0)},E0={get:Al(!0,!1)};const mp=new WeakMap,gp=new WeakMap,_p=new WeakMap,S0=new WeakMap;function y0(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function b0(t){return t.__v_skip||!Object.isExtensible(t)?0:y0(jg(t))}function Rl(t){return Bs(t)?t:Pl(t,!1,p0,x0,mp)}function T0(t){return Pl(t,!1,g0,M0,gp)}function vp(t){return Pl(t,!0,m0,E0,_p)}function Pl(t,e,n,i,s){if(!mt(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=s.get(t);if(r)return r;const o=b0(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 Bs(t)?yr(t.__v_raw):!!(t&&t.__v_isReactive)}function Bs(t){return!!(t&&t.__v_isReadonly)}function Fn(t){return!!(t&&t.__v_isShallow)}function Cl(t){return t?!!t.__v_raw:!1}function Je(t){const e=t&&t.__v_raw;return e?Je(e):t}function w0(t){return!Ke(t,"__v_skip")&&Object.isExtensible(t)&&tp(t,"__v_skip",!0),t}const on=t=>mt(t)?Rl(t):t,qc=t=>mt(t)?vp(t):t;function Wt(t){return t?t.__v_isRef===!0:!1}function A0(t){return Wt(t)?t.value:t}const R0={get:(t,e,n)=>e==="__v_raw"?t:A0(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 xp(t){return yr(t)?t:new Proxy(t,R0)}class P0{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=Rr-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 rp(this,!0),!0}get value(){const e=this.dep.track();return cp(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function C0(t,e,n=!1){let i,s;return Oe(t)?i=t:(i=t.get,s=t.set),new P0(i,s,n)}const Kr={},Vo=new WeakMap;let Oi;function L0(t,e=!1,n=Oi){if(n){let i=Vo.get(n);i||Vo.set(n,i=[]),i.push(t)}}function D0(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 u,f,h,d,_=!1,g=!1;if(Wt(t)?(f=()=>t.value,_=Fn(t)):yr(t)?(f=()=>l(t),_=!0):Be(t)?(g=!0,_=t.some(v=>yr(v)||Fn(v)),f=()=>t.map(v=>{if(Wt(v))return v.value;if(yr(v))return l(v);if(Oe(v))return c?c(v,2):v()})):Oe(t)?e?f=c?()=>c(t,2):t:f=()=>{if(h){Ti();try{h()}finally{wi()}}const v=Oi;Oi=u;try{return c?c(t,3,[d]):t(d)}finally{Oi=v}}:f=Nn,e&&s){const v=f,M=s===!0?1/0:s;f=()=>ti(v(),M)}const m=o0(),p=()=>{u.stop(),m&&m.active&&xl(m.effects,u)};if(r&&e){const v=e;e=(...M)=>{v(...M),p()}}let y=g?new Array(t.length).fill(Kr):Kr;const E=v=>{if(!(!(u.flags&1)||!u.dirty&&!v))if(e){const M=u.run();if(s||_||(g?M.some((b,w)=>Wi(b,y[w])):Wi(M,y))){h&&h();const b=Oi;Oi=u;try{const w=[M,y===Kr?void 0:g&&y[0]===Kr?[]:y,d];c?c(e,3,w):e(...w),y=M}finally{Oi=b}}}else u.run()};return a&&a(E),u=new ip(f),u.scheduler=o?()=>o(E,!1):E,d=v=>L0(v,!1,u),h=u.onStop=()=>{const v=Vo.get(u);if(v){if(c)c(v,4);else for(const M of v)M();Vo.delete(u)}},e?i?E(!0):y=u.run():o?o(E.bind(null,!0),!0):u.run(),p.pause=u.pause.bind(u),p.resume=u.resume.bind(u),p.stop=p,p}function ti(t,e=1/0,n){if(e<=0||!mt(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(Be(t))for(let i=0;i{ti(i,e,n)});else if(Kg(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 rn;class r0{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 op(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function ap(t){let e,n=t.depsTail,i=n;for(;i;){const s=i.prevDep;i.version===-1?(i===n&&(n=s),Al(i),a0(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}t.deps=e,t.depsTail=n}function Wc(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(cp(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function cp(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Rr))return;t.globalVersion=Rr;const e=t.dep;if(t.flags|=2,e.version>0&&!t.isSSR&&t.deps&&!Wc(t)){t.flags&=-3;return}const n=st,i=Tn;st=t,Tn=!0;try{op(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,ap(t),t.flags&=-3}}function Al(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)Al(r,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function a0(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 lp=[];function Ti(){lp.push(Tn),Tn=!1}function wi(){const t=lp.pop();Tn=t===void 0?!0:t}function fu(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=st;st=void 0;try{e()}finally{st=n}}}let Rr=0;class c0{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 c0(st,this),st.deps?(n.prevDep=st.depsTail,st.depsTail.nextDep=n,st.depsTail=n):st.deps=st.depsTail=n,fp(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++,Rr++,this.notify(e)}notify(e){Tl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{wl()}}}function fp(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)fp(i)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const Xc=new WeakMap,Xi=Symbol(""),qc=Symbol(""),Pr=Symbol("");function Dt(t,e,n){if(Tn&&st){let i=Xc.get(t);i||Xc.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=Xc.get(t);if(!o){Rr++;return}const a=c=>{c&&c.trigger()};if(Tl(),e==="clear")o.forEach(a);else{const c=Be(t),l=c&&Sl(n);if(c&&n==="length"){const u=Number(i);o.forEach((f,h)=>{(h==="length"||h===Pr||!qs(h)&&h>=u)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),l&&a(o.get(Pr)),e){case"add":c?l&&a(o.get("length")):(a(o.get(Xi)),xr(t)&&a(o.get(qc)));break;case"delete":c||(a(o.get(Xi)),xr(t)&&a(o.get(qc)));break;case"set":xr(t)&&a(o.get(Xi));break}}wl()}function ss(t){const e=Je(t);return e===t?e:(Dt(e,"iterate",Pr),Fn(t)?e:e.map(on))}function Rl(t){return Dt(t=Je(t),"iterate",Pr),t}const l0={__proto__:null,[Symbol.iterator](){return Pa(this,Symbol.iterator,on)},concat(...t){return ss(this).concat(...t.map(e=>Be(e)?ss(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 Ca(this,"includes",t)},indexOf(...t){return Ca(this,"indexOf",t)},join(t){return ss(this).join(t)},lastIndexOf(...t){return Ca(this,"lastIndexOf",t)},map(t,e){return zn(this,"map",t,e,void 0,arguments)},pop(){return er(this,"pop")},push(...t){return er(this,"push",t)},reduce(t,...e){return hu(this,"reduce",t,e)},reduceRight(t,...e){return hu(this,"reduceRight",t,e)},shift(){return er(this,"shift")},some(t,e){return zn(this,"some",t,e,void 0,arguments)},splice(...t){return er(this,"splice",t)},toReversed(){return ss(this).toReversed()},toSorted(t){return ss(this).toSorted(t)},toSpliced(...t){return ss(this).toSpliced(...t)},unshift(...t){return er(this,"unshift",t)},values(){return Pa(this,"values",on)}};function Pa(t,e,n){const i=Rl(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 u0=Array.prototype;function zn(t,e,n,i,s,r){const o=Rl(t),a=o!==t&&!Fn(t),c=o[e];if(c!==u0[e]){const f=c.apply(t,r);return a?on(f):f}let l=n;o!==t&&(a?l=function(f,h){return n.call(this,on(f),h,t)}:n.length>2&&(l=function(f,h){return n.call(this,f,h,t)}));const u=c.call(o,l,i);return a&&s?s(u):u}function hu(t,e,n,i){const s=Rl(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 Ca(t,e,n){const i=Je(t);Dt(i,"iterate",Pr);const s=i[e](...n);return(s===-1||s===!1)&&Dl(n[0])?(n[0]=Je(n[0]),i[e](...n)):s}function er(t,e,n=[]){Ti(),Tl();const i=Je(t)[e].apply(t,n);return wl(),wi(),i}const f0=xl("__proto__,__v_isRef,__isVue"),hp=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(qs));function h0(t){qs(t)||(t=String(t));const e=Je(this);return Dt(e,"has",t),e.hasOwnProperty(t)}class dp{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?S0:_p:r?gp:mp).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=Be(e);if(!s){let c;if(o&&(c=l0[n]))return c;if(n==="hasOwnProperty")return h0}const a=Reflect.get(e,n,Wt(e)?e:i);return(qs(n)?hp.has(n):f0(n))||(s||Dt(e,"get",n),r)?a:Wt(a)?o&&Sl(n)?a:a.value:gt(a)?s?vp(a):Cl(a):a}}class pp extends dp{constructor(e=!1){super(!1,e)}set(e,n,i,s){let r=e[n];if(!this._isShallow){const c=Bs(r);if(!Fn(i)&&!Bs(i)&&(r=Je(r),i=Je(i)),!Be(e)&&Wt(r)&&!Wt(i))return c?!1:(r.value=i,!0)}const o=Be(e)&&Sl(n)?Number(n)t,Yr=t=>Reflect.getPrototypeOf(t);function _0(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),u=n?Yc:e?jc:on;return!e&&Dt(r,"iterate",c?qc:Xi),{next(){const{value:f,done:h}=l.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function jr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function v0(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}=Yr(o),l=e?Yc:t?jc: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?Yc:t?jc:on;return!t&&Dt(c,"iterate",Xi),a.forEach((u,f)=>s.call(r,l(u),l(f),o))}};return Xt(n,t?{add:jr("add"),set:jr("set"),delete:jr("delete"),clear:jr("clear")}:{add(s){!e&&!Fn(s)&&!Bs(s)&&(s=Je(s));const r=Je(this);return Yr(r).has.call(r,s)||(r.add(s),ei(r,"add",s,s)),this},set(s,r){!e&&!Fn(r)&&!Bs(r)&&(r=Je(r));const o=Je(this),{has:a,get:c}=Yr(o);let l=a.call(o,s);l||(s=Je(s),l=a.call(o,s));const u=c.call(o,s);return o.set(s,r),l?Wi(r,u)&&ei(o,"set",s,r):ei(o,"add",s,r),this},delete(s){const r=Je(this),{has:o,get:a}=Yr(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]=_0(s,t,e)}),n}function Pl(t,e){const n=v0(t,e);return(i,s,r)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?i:Reflect.get(Ke(n,s)&&s in i?n:i,s,r)}const x0={get:Pl(!1,!1)},M0={get:Pl(!1,!0)},E0={get:Pl(!0,!1)};const mp=new WeakMap,gp=new WeakMap,_p=new WeakMap,S0=new WeakMap;function y0(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function b0(t){return t.__v_skip||!Object.isExtensible(t)?0:y0(jg(t))}function Cl(t){return Bs(t)?t:Ll(t,!1,p0,x0,mp)}function T0(t){return Ll(t,!1,g0,M0,gp)}function vp(t){return Ll(t,!0,m0,E0,_p)}function Ll(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=b0(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 Bs(t)?yr(t.__v_raw):!!(t&&t.__v_isReactive)}function Bs(t){return!!(t&&t.__v_isReadonly)}function Fn(t){return!!(t&&t.__v_isShallow)}function Dl(t){return t?!!t.__v_raw:!1}function Je(t){const e=t&&t.__v_raw;return e?Je(e):t}function w0(t){return!Ke(t,"__v_skip")&&Object.isExtensible(t)&&tp(t,"__v_skip",!0),t}const on=t=>gt(t)?Cl(t):t,jc=t=>gt(t)?vp(t):t;function Wt(t){return t?t.__v_isRef===!0:!1}function A0(t){return Wt(t)?t.value:t}const R0={get:(t,e,n)=>e==="__v_raw"?t:A0(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 xp(t){return yr(t)?t:new Proxy(t,R0)}class P0{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=Rr-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 rp(this,!0),!0}get value(){const e=this.dep.track();return cp(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function C0(t,e,n=!1){let i,s;return Oe(t)?i=t:(i=t.get,s=t.set),new P0(i,s,n)}const Kr={},$o=new WeakMap;let Oi;function L0(t,e=!1,n=Oi){if(n){let i=$o.get(n);i||$o.set(n,i=[]),i.push(t)}}function D0(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 u,f,h,d,_=!1,g=!1;if(Wt(t)?(f=()=>t.value,_=Fn(t)):yr(t)?(f=()=>l(t),_=!0):Be(t)?(g=!0,_=t.some(v=>yr(v)||Fn(v)),f=()=>t.map(v=>{if(Wt(v))return v.value;if(yr(v))return l(v);if(Oe(v))return c?c(v,2):v()})):Oe(t)?e?f=c?()=>c(t,2):t:f=()=>{if(h){Ti();try{h()}finally{wi()}}const v=Oi;Oi=u;try{return c?c(t,3,[d]):t(d)}finally{Oi=v}}:f=Nn,e&&s){const v=f,M=s===!0?1/0:s;f=()=>ti(v(),M)}const m=o0(),p=()=>{u.stop(),m&&m.active&&El(m.effects,u)};if(r&&e){const v=e;e=(...M)=>{v(...M),p()}}let y=g?new Array(t.length).fill(Kr):Kr;const E=v=>{if(!(!(u.flags&1)||!u.dirty&&!v))if(e){const M=u.run();if(s||_||(g?M.some((b,w)=>Wi(b,y[w])):Wi(M,y))){h&&h();const b=Oi;Oi=u;try{const w=[M,y===Kr?void 0:g&&y[0]===Kr?[]:y,d];c?c(e,3,w):e(...w),y=M}finally{Oi=b}}}else u.run()};return a&&a(E),u=new ip(f),u.scheduler=o?()=>o(E,!1):E,d=v=>L0(v,!1,u),h=u.onStop=()=>{const v=$o.get(u);if(v){if(c)c(v,4);else for(const M of v)M();$o.delete(u)}},e?i?E(!0):y=u.run():o?o(E.bind(null,!0),!0):u.run(),p.pause=u.pause.bind(u),p.resume=u.resume.bind(u),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(Be(t))for(let i=0;i{ti(i,e,n)});else if(Kg(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}/** * @vue/runtime-core v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/function Br(t,e,n,i){try{return i?t(...i):t()}catch(s){na(s,e,n)}}function On(t,e,n,i){if(Oe(t)){const s=Br(t,e,n,i);return s&&ep(s)&&s.catch(r=>{na(r,e,n)}),s}if(Be(t)){const s=[];for(let r=0;r>>1,s=$t[i],r=Cr(s);r=Cr(n)?$t.push(t):$t.splice(N0(e),0,t),t.flags|=1,Ep()}}function Ep(){Go||(Go=Mp.then(yp))}function F0(t){Be(t)?Us.push(...t):Mi&&t.id===-1?Mi.splice(As+1,0,t):t.flags&1||(Us.push(t),t.flags|=1),Ep()}function fu(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 Sp(t){if(Us.length){const e=[...new Set(Us)].sort((n,i)=>Cr(n)-Cr(i));if(Us.length=0,Mi){Mi.push(...e);return}for(Mi=e,As=0;Ast.id==null?t.flags&2?-1:1/0:t.id;function yp(t){try{for(Ln=0;Ln<$t.length;Ln++){const e=$t[Ln];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Br(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,Sp(),Go=null,($t.length||Us.length)&&yp()}}let an=null,bp=null;function $o(t){const e=an;return an=t,bp=t&&t.type.__scopeId||null,e}function O0(t,e=an,n){if(!e||t._n)return t;const i=(...s)=>{i._d&&yu(-1);const r=$o(e);let o;try{o=t(...s)}finally{$o(r),i._d&&yu(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function hu(t,e){if(an===null)return t;const n=oa(an),i=t.dirs||(t.dirs=[]);for(let s=0;st.__isTeleport;function Dl(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Dl(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 Tp(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function ko(t,e,n,i,s=!1){if(Be(t)){t.forEach((_,g)=>ko(_,e&&(Be(e)?e[g]:e),n,i,s));return}if(br(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&ko(t,e,n,i.component.subTree);return}const r=i.shapeFlag&4?oa(i.component):i.el,o=s?null:r,{i:a,r:c}=t,l=e&&e.r,u=a.refs===nt?a.refs={}:a.refs,f=a.setupState,h=Je(f),d=f===nt?()=>!1:_=>Ke(h,_);if(l!=null&&l!==c&&(bt(l)?(u[l]=null,d(l)&&(f[l]=null)):Wt(l)&&(l.value=null)),Oe(c))Br(c,a,12,[o,u]);else{const _=bt(c),g=Wt(c);if(_||g){const m=()=>{if(t.f){const p=_?d(c)?f[c]:u[c]:c.value;s?Be(p)&&xl(p,r):Be(p)?p.includes(r)||p.push(r):_?(u[c]=[r],d(c)&&(f[c]=u[c])):(c.value=[r],t.k&&(u[t.k]=c.value))}else _?(u[c]=o,d(c)&&(f[c]=o)):g&&(c.value=o,t.k&&(u[t.k]=o))};o?(m.id=-1,sn(m,n)):m()}}}ta().requestIdleCallback;ta().cancelIdleCallback;const br=t=>!!t.type.__asyncLoader,wp=t=>t.type.__isKeepAlive;function H0(t,e){Ap(t,"a",e)}function V0(t,e){Ap(t,"da",e)}function Ap(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(ia(e,i,n),n){let s=n.parent;for(;s&&s.parent;)wp(s.parent.vnode)&&G0(i,e,n,s),s=s.parent}}function G0(t,e,n,i){const s=ia(e,t,i,!0);Rp(()=>{xl(i[e],s)},n)}function ia(t,e,n=Ut,i=!1){if(n){const s=n[t]||(n[t]=[]),r=e.__weh||(e.__weh=(...o)=>{Ti();const a=zr(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)=>{(!Ur||t==="sp")&&ia(t,(...i)=>e(...i),n)},$0=ci("bm"),k0=ci("m"),W0=ci("bu"),X0=ci("u"),q0=ci("bum"),Rp=ci("um"),Y0=ci("sp"),j0=ci("rtg"),K0=ci("rtc");function Z0(t,e=Ut){ia("ec",t,e)}const J0="components";function du(t,e){return e_(J0,t,!0,e)||t}const Q0=Symbol.for("v-ndc");function e_(t,e,n=!0,i=!1){const s=an||Ut;if(s){const r=s.type;{const a=$_(r,!1);if(a&&(a===e||a===mn(e)||a===ea(mn(e))))return r}const o=pu(s[t]||r[t],e)||pu(s.appContext[t],e);return!o&&i?r:o}}function pu(t,e){return t&&(t[e]||t[mn(e)]||t[ea(mn(e))])}const Yc=t=>t?jp(t)?oa(t):Yc(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=>Yc(t.parent),$root:t=>Yc(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Cp(t),$forceUpdate:t=>t.f||(t.f=()=>{Ll(t.update)}),$nextTick:t=>t.n||(t.n=I0.bind(t.proxy)),$watch:t=>S_.bind(t)}),Pa=(t,e)=>t!==nt&&!t.__isScriptSetup&&Ke(t,e),t_={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(Pa(i,e))return o[e]=1,i[e];if(s!==nt&&Ke(s,e))return o[e]=2,s[e];if((l=t.propsOptions[0])&&Ke(l,e))return o[e]=3,r[e];if(n!==nt&&Ke(n,e))return o[e]=4,n[e];jc&&(o[e]=0)}}const u=Tr[e];let f,h;if(u)return e==="$attrs"&&Dt(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==nt&&Ke(n,e))return o[e]=4,n[e];if(h=c.config.globalProperties,Ke(h,e))return h[e]},set({_:t},e,n){const{data:i,setupState:s,ctx:r}=t;return Pa(s,e)?(s[e]=n,!0):i!==nt&&Ke(i,e)?(i[e]=n,!0):Ke(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&&Ke(t,o)||Pa(e,o)||(a=r[0])&&Ke(a,o)||Ke(i,o)||Ke(Tr,o)||Ke(s.config.globalProperties,o)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:Ke(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function mu(t){return Be(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}let jc=!0;function n_(t){const e=Cp(t),n=t.proxy,i=t.ctx;jc=!1,e.beforeCreate&&gu(e.beforeCreate,t,"bc");const{data:s,computed:r,methods:o,watch:a,provide:c,inject:l,created:u,beforeMount:f,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:z,directives:U,filters:O}=e;if(l&&i_(l,i,null),o)for(const k in o){const W=o[k];Oe(W)&&(i[k]=W.bind(n))}if(s){const k=s.call(n,n);mt(k)&&(t.data=Rl(k))}if(jc=!0,r)for(const k in r){const W=r[k],ue=Oe(W)?W.bind(n,n):Oe(W.get)?W.get.bind(n,n):Nn,oe=!Oe(W)&&Oe(W.set)?W.set.bind(n):Nn,Te=W_({get:ue,set:oe});Object.defineProperty(i,k,{enumerable:!0,configurable:!0,get:()=>Te.value,set:fe=>Te.value=fe})}if(a)for(const k in a)Pp(a[k],i,n,k);if(c){const k=Oe(c)?c.call(n):c;Reflect.ownKeys(k).forEach(W=>{l_(W,k[W])})}u&&gu(u,t,"c");function G(k,W){Be(W)?W.forEach(ue=>k(ue.bind(n))):W&&k(W.bind(n))}if(G($0,f),G(k0,h),G(W0,d),G(X0,_),G(H0,g),G(V0,m),G(Z0,D),G(K0,b),G(j0,w),G(q0,y),G(Rp,v),G(Y0,x),Be(T))if(T.length){const k=t.exposed||(t.exposed={});T.forEach(W=>{Object.defineProperty(k,W,{get:()=>n[W],set:ue=>n[W]=ue})})}else t.exposed||(t.exposed={});M&&t.render===Nn&&(t.render=M),I!=null&&(t.inheritAttrs=I),z&&(t.components=z),U&&(t.directives=U),x&&Tp(t)}function i_(t,e,n=Nn){Be(t)&&(t=Kc(t));for(const i in t){const s=t[i];let r;mt(s)?"default"in s?r=No(s.from||i,s.default,!0):r=No(s.from||i):r=No(s),Wt(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function gu(t,e,n){On(Be(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function Pp(t,e,n,i){let s=i.includes(".")?kp(n,i):()=>n[i];if(bt(t)){const r=e[t];Oe(r)&&La(s,r)}else if(Oe(t))La(s,t.bind(n));else if(mt(t))if(Be(t))t.forEach(r=>Pp(r,e,n,i));else{const r=Oe(t.handler)?t.handler.bind(n):e[t.handler];Oe(r)&&La(s,r,t)}}function Cp(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=>Wo(c,l,o,!0)),Wo(c,e,o)),mt(e)&&r.set(e,c),c}function Wo(t,e,n,i=!1){const{mixins:s,extends:r}=e;r&&Wo(t,r,n,!0),s&&s.forEach(o=>Wo(t,o,n,!0));for(const o in e)if(!(i&&o==="expose")){const a=s_[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const s_={data:_u,props:vu,emits:vu,methods:pr,computed:pr,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:pr,directives:pr,watch:o_,provide:_u,inject:r_};function _u(t,e){return e?t?function(){return Xt(Oe(t)?t.call(this,this):t,Oe(e)?e.call(this,this):e)}:e:t}function r_(t,e){return pr(Kc(t),Kc(e))}function Kc(t){if(Be(t)){const e={};for(let n=0;n1)return n&&Oe(e)?e.call(i&&i.proxy):e}}const Dp={},Up=()=>Object.create(Dp),Ip=t=>Object.getPrototypeOf(t)===Dp;function u_(t,e,n,i=!1){const s={},r=Up();t.propsDefaults=Object.create(null),Np(t,e,s,r);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);n?t.props=i?s:T0(s):t.type.props?t.props=s:t.props=r,t.attrs=r}function f_(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 u=t.vnode.dynamicProps;for(let f=0;f{c=!0;const[h,d]=Fp(f,e,!0);Xt(o,h),d&&a.push(...d)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!r&&!c)return mt(t)&&i.set(t,Ds),Ds;if(Be(r))for(let u=0;ut[0]==="_"||t==="$stable",Ul=t=>Be(t)?t.map(Dn):[Dn(t)],d_=(t,e,n)=>{if(e._n)return e;const i=O0((...s)=>Ul(e(...s)),n);return i._c=!1,i},Bp=(t,e,n)=>{const i=t._ctx;for(const s in t){if(Op(s))continue;const r=t[s];if(Oe(r))e[s]=d_(s,r,i);else if(r!=null){const o=Ul(r);e[s]=()=>o}}},zp=(t,e)=>{const n=Ul(e);t.slots.default=()=>n},Hp=(t,e,n)=>{for(const i in e)(n||i!=="_")&&(t[i]=e[i])},p_=(t,e,n)=>{const i=t.slots=Up();if(t.vnode.shapeFlag&32){const s=e._;s?(Hp(i,e,n),n&&tp(i,"_",s,!0)):Bp(e,i)}else e&&zp(t,e)},m_=(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,Bp(e,s)),o=e}else e&&(zp(t,e),o={default:1});if(r)for(const a in s)!Op(a)&&o[a]==null&&delete s[a]},sn=P_;function g_(t){return __(t)}function __(t,e){const n=ta();n.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:c,setText:l,setElementText:u,parentNode:f,nextSibling:h,setScopeId:d=Nn,insertStaticContent:_}=t,g=(P,C,V,ie=null,Q=null,se=null,de=void 0,re=null,le=!!C.dynamicChildren)=>{if(P===C)return;P&&!tr(P,C)&&(ie=N(P),fe(P,Q,se,!0),P=null),C.patchFlag===-2&&(le=!1,C.dynamicChildren=null);const{type:ae,ref:A,shapeFlag:S}=C;switch(ae){case ra:m(P,C,V,ie);break;case Lr:p(P,C,V,ie);break;case Da:P==null&&y(C,V,ie,de);break;case Qn:z(P,C,V,ie,Q,se,de,re,le);break;default:S&1?M(P,C,V,ie,Q,se,de,re,le):S&6?U(P,C,V,ie,Q,se,de,re,le):(S&64||S&128)&&ae.process(P,C,V,ie,Q,se,de,re,le,me)}A!=null&&Q&&ko(A,P&&P.ref,se,C||P,!C)},m=(P,C,V,ie)=>{if(P==null)i(C.el=a(C.children),V,ie);else{const Q=C.el=P.el;C.children!==P.children&&l(Q,C.children)}},p=(P,C,V,ie)=>{P==null?i(C.el=c(C.children||""),V,ie):C.el=P.el},y=(P,C,V,ie)=>{[P.el,P.anchor]=_(P.children,C,V,ie,P.el,P.anchor)},E=({el:P,anchor:C},V,ie)=>{let Q;for(;P&&P!==C;)Q=h(P),i(P,V,ie),P=Q;i(C,V,ie)},v=({el:P,anchor:C})=>{let V;for(;P&&P!==C;)V=h(P),s(P),P=V;s(C)},M=(P,C,V,ie,Q,se,de,re,le)=>{C.type==="svg"?de="svg":C.type==="math"&&(de="mathml"),P==null?b(C,V,ie,Q,se,de,re,le):x(P,C,Q,se,de,re,le)},b=(P,C,V,ie,Q,se,de,re)=>{let le,ae;const{props:A,shapeFlag:S,transition:B,dirs:j}=P;if(le=P.el=o(P.type,se,A&&A.is,A),S&8?u(le,P.children):S&16&&D(P.children,le,null,ie,Q,Ca(P,se),de,re),j&&Ci(P,null,ie,"created"),w(le,P,P.scopeId,de,ie),A){for(const he in A)he!=="value"&&!Mr(he)&&r(le,he,null,A[he],se,ie);"value"in A&&r(le,"value",null,A.value,se),(ae=A.onVnodeBeforeMount)&&An(ae,ie,P)}j&&Ci(P,null,ie,"beforeMount");const Z=v_(Q,B);Z&&B.beforeEnter(le),i(le,C,V),((ae=A&&A.onVnodeMounted)||Z||j)&&sn(()=>{ae&&An(ae,ie,P),Z&&B.enter(le),j&&Ci(P,null,ie,"mounted")},Q)},w=(P,C,V,ie,Q)=>{if(V&&d(P,V),ie)for(let se=0;se{for(let ae=le;ae{const re=C.el=P.el;let{patchFlag:le,dynamicChildren:ae,dirs:A}=C;le|=P.patchFlag&16;const S=P.props||nt,B=C.props||nt;let j;if(V&&Li(V,!1),(j=B.onVnodeBeforeUpdate)&&An(j,V,C,P),A&&Ci(C,P,V,"beforeUpdate"),V&&Li(V,!0),(S.innerHTML&&B.innerHTML==null||S.textContent&&B.textContent==null)&&u(re,""),ae?T(P.dynamicChildren,ae,re,V,ie,Ca(C,Q),se):de||W(P,C,re,null,V,ie,Ca(C,Q),se,!1),le>0){if(le&16)I(re,S,B,V,Q);else if(le&2&&S.class!==B.class&&r(re,"class",null,B.class,Q),le&4&&r(re,"style",S.style,B.style,Q),le&8){const Z=C.dynamicProps;for(let he=0;he{j&&An(j,V,C,P),A&&Ci(C,P,V,"updated")},ie)},T=(P,C,V,ie,Q,se,de)=>{for(let re=0;re{if(C!==V){if(C!==nt)for(const se in C)!Mr(se)&&!(se in V)&&r(P,se,C[se],null,Q,ie);for(const se in V){if(Mr(se))continue;const de=V[se],re=C[se];de!==re&&se!=="value"&&r(P,se,re,de,Q,ie)}"value"in V&&r(P,"value",C.value,V.value,Q)}},z=(P,C,V,ie,Q,se,de,re,le)=>{const ae=C.el=P?P.el:a(""),A=C.anchor=P?P.anchor:a("");let{patchFlag:S,dynamicChildren:B,slotScopeIds:j}=C;j&&(re=re?re.concat(j):j),P==null?(i(ae,V,ie),i(A,V,ie),D(C.children||[],V,A,Q,se,de,re,le)):S>0&&S&64&&B&&P.dynamicChildren?(T(P.dynamicChildren,B,V,Q,se,de,re),(C.key!=null||Q&&C===Q.subTree)&&Vp(P,C,!0)):W(P,C,V,A,Q,se,de,re,le)},U=(P,C,V,ie,Q,se,de,re,le)=>{C.slotScopeIds=re,P==null?C.shapeFlag&512?Q.ctx.activate(C,V,ie,de,le):O(C,V,ie,Q,se,de,le):H(P,C,le)},O=(P,C,V,ie,Q,se,de)=>{const re=P.component=B_(P,ie,Q);if(wp(P)&&(re.ctx.renderer=me),z_(re,!1,de),re.asyncDep){if(Q&&Q.registerDep(re,G,de),!P.el){const le=re.subTree=si(Lr);p(null,le,C,V)}}else G(re,P,C,V,Q,se,de)},H=(P,C,V)=>{const ie=C.component=P.component;if(A_(P,C,V))if(ie.asyncDep&&!ie.asyncResolved){k(ie,C,V);return}else ie.next=C,ie.update();else C.el=P.el,ie.vnode=C},G=(P,C,V,ie,Q,se,de)=>{const re=()=>{if(P.isMounted){let{next:S,bu:B,u:j,parent:Z,vnode:he}=P;{const Ee=Gp(P);if(Ee){S&&(S.el=he.el,k(P,S,de)),Ee.asyncDep.then(()=>{P.isUnmounted||re()});return}}let L=S,J;Li(P,!1),S?(S.el=he.el,k(P,S,de)):S=he,B&&Io(B),(J=S.props&&S.props.onVnodeBeforeUpdate)&&An(J,Z,S,he),Li(P,!0);const X=Eu(P),ge=P.subTree;P.subTree=X,g(ge,X,f(ge.el),N(ge),P,Q,se),S.el=X.el,L===null&&R_(P,X.el),j&&sn(j,Q),(J=S.props&&S.props.onVnodeUpdated)&&sn(()=>An(J,Z,S,he),Q)}else{let S;const{el:B,props:j}=C,{bm:Z,m:he,parent:L,root:J,type:X}=P,ge=br(C);Li(P,!1),Z&&Io(Z),!ge&&(S=j&&j.onVnodeBeforeMount)&&An(S,L,C),Li(P,!0);{J.ce&&J.ce._injectChildStyle(X);const Ee=P.subTree=Eu(P);g(null,Ee,V,ie,P,Q,se),C.el=Ee.el}if(he&&sn(he,Q),!ge&&(S=j&&j.onVnodeMounted)){const Ee=C;sn(()=>An(S,L,Ee),Q)}(C.shapeFlag&256||L&&br(L.vnode)&&L.vnode.shapeFlag&256)&&P.a&&sn(P.a,Q),P.isMounted=!0,C=V=ie=null}};P.scope.on();const le=P.effect=new ip(re);P.scope.off();const ae=P.update=le.run.bind(le),A=P.job=le.runIfDirty.bind(le);A.i=P,A.id=P.uid,le.scheduler=()=>Ll(A),Li(P,!0),ae()},k=(P,C,V)=>{C.component=P;const ie=P.vnode.props;P.vnode=C,P.next=null,f_(P,C.props,ie,V),m_(P,C.children,V),Ti(),fu(P),wi()},W=(P,C,V,ie,Q,se,de,re,le=!1)=>{const ae=P&&P.children,A=P?P.shapeFlag:0,S=C.children,{patchFlag:B,shapeFlag:j}=C;if(B>0){if(B&128){oe(ae,S,V,ie,Q,se,de,re,le);return}else if(B&256){ue(ae,S,V,ie,Q,se,de,re,le);return}}j&8?(A&16&&xe(ae,Q,se),S!==ae&&u(V,S)):A&16?j&16?oe(ae,S,V,ie,Q,se,de,re,le):xe(ae,Q,se,!0):(A&8&&u(V,""),j&16&&D(S,V,ie,Q,se,de,re,le))},ue=(P,C,V,ie,Q,se,de,re,le)=>{P=P||Ds,C=C||Ds;const ae=P.length,A=C.length,S=Math.min(ae,A);let B;for(B=0;BA?xe(P,Q,se,!0,!1,S):D(C,V,ie,Q,se,de,re,le,S)},oe=(P,C,V,ie,Q,se,de,re,le)=>{let ae=0;const A=C.length;let S=P.length-1,B=A-1;for(;ae<=S&&ae<=B;){const j=P[ae],Z=C[ae]=le?Ei(C[ae]):Dn(C[ae]);if(tr(j,Z))g(j,Z,V,null,Q,se,de,re,le);else break;ae++}for(;ae<=S&&ae<=B;){const j=P[S],Z=C[B]=le?Ei(C[B]):Dn(C[B]);if(tr(j,Z))g(j,Z,V,null,Q,se,de,re,le);else break;S--,B--}if(ae>S){if(ae<=B){const j=B+1,Z=jB)for(;ae<=S;)fe(P[ae],Q,se,!0),ae++;else{const j=ae,Z=ae,he=new Map;for(ae=Z;ae<=B;ae++){const Se=C[ae]=le?Ei(C[ae]):Dn(C[ae]);Se.key!=null&&he.set(Se.key,ae)}let L,J=0;const X=B-Z+1;let ge=!1,Ee=0;const we=new Array(X);for(ae=0;ae=X){fe(Se,Q,se,!0);continue}let Pe;if(Se.key!=null)Pe=he.get(Se.key);else for(L=Z;L<=B;L++)if(we[L-Z]===0&&tr(Se,C[L])){Pe=L;break}Pe===void 0?fe(Se,Q,se,!0):(we[Pe-Z]=ae+1,Pe>=Ee?Ee=Pe:ge=!0,g(Se,C[Pe],V,null,Q,se,de,re,le),J++)}const ye=ge?x_(we):Ds;for(L=ye.length-1,ae=X-1;ae>=0;ae--){const Se=Z+ae,Pe=C[Se],Fe=Se+1{const{el:se,type:de,transition:re,children:le,shapeFlag:ae}=P;if(ae&6){Te(P.component.subTree,C,V,ie);return}if(ae&128){P.suspense.move(C,V,ie);return}if(ae&64){de.move(P,C,V,me);return}if(de===Qn){i(se,C,V);for(let S=0;Sre.enter(se),Q);else{const{leave:S,delayLeave:B,afterLeave:j}=re,Z=()=>i(se,C,V),he=()=>{S(se,()=>{Z(),j&&j()})};B?B(se,Z,he):he()}else i(se,C,V)},fe=(P,C,V,ie=!1,Q=!1)=>{const{type:se,props:de,ref:re,children:le,dynamicChildren:ae,shapeFlag:A,patchFlag:S,dirs:B,cacheIndex:j}=P;if(S===-2&&(Q=!1),re!=null&&ko(re,null,V,P,!0),j!=null&&(C.renderCache[j]=void 0),A&256){C.ctx.deactivate(P);return}const Z=A&1&&B,he=!br(P);let L;if(he&&(L=de&&de.onVnodeBeforeUnmount)&&An(L,C,P),A&6)_e(P.component,V,ie);else{if(A&128){P.suspense.unmount(V,ie);return}Z&&Ci(P,null,C,"beforeUnmount"),A&64?P.type.remove(P,C,V,me,ie):ae&&!ae.hasOnce&&(se!==Qn||S>0&&S&64)?xe(ae,C,V,!1,!0):(se===Qn&&S&384||!Q&&A&16)&&xe(le,C,V),ie&&K(P)}(he&&(L=de&&de.onVnodeUnmounted)||Z)&&sn(()=>{L&&An(L,C,P),Z&&Ci(P,null,C,"unmounted")},V)},K=P=>{const{type:C,el:V,anchor:ie,transition:Q}=P;if(C===Qn){ce(V,ie);return}if(C===Da){v(P);return}const se=()=>{s(V),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(P.shapeFlag&1&&Q&&!Q.persisted){const{leave:de,delayLeave:re}=Q,le=()=>de(V,se);re?re(P.el,se,le):le()}else se()},ce=(P,C)=>{let V;for(;P!==C;)V=h(P),s(P),P=V;s(C)},_e=(P,C,V)=>{const{bum:ie,scope:Q,job:se,subTree:de,um:re,m:le,a:ae}=P;Mu(le),Mu(ae),ie&&Io(ie),Q.stop(),se&&(se.flags|=8,fe(de,P,C,V)),re&&sn(re,C),sn(()=>{P.isUnmounted=!0},C),C&&C.pendingBranch&&!C.isUnmounted&&P.asyncDep&&!P.asyncResolved&&P.suspenseId===C.pendingId&&(C.deps--,C.deps===0&&C.resolve())},xe=(P,C,V,ie=!1,Q=!1,se=0)=>{for(let de=se;de{if(P.shapeFlag&6)return N(P.component.subTree);if(P.shapeFlag&128)return P.suspense.next();const C=h(P.anchor||P.el),V=C&&C[B0];return V?h(V):C};let Ie=!1;const De=(P,C,V)=>{P==null?C._vnode&&fe(C._vnode,null,null,!0):g(C._vnode||null,P,C,null,null,null,V),C._vnode=P,Ie||(Ie=!0,fu(),Sp(),Ie=!1)},me={p:g,um:fe,m:Te,r:K,mt:O,mc:D,pc:W,pbc:T,n:N,o:t};return{render:De,hydrate:void 0,createApp:c_(De)}}function Ca({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 v_(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Vp(t,e,n=!1){const i=t.children,s=e.children;if(Be(i)&&Be(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 Gp(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Gp(e)}function Mu(t){if(t)for(let e=0;eNo(M_);function La(t,e,n){return $p(t,e,n)}function $p(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(Ur){if(r==="sync"){const d=E_();l=d.__watcherHandles||(d.__watcherHandles=[])}else if(!c){const d=()=>{};return d.stop=Nn,d.resume=Nn,d.pause=Nn,d}}const u=Ut;a.call=(d,_,g)=>On(d,u,_,g);let f=!1;r==="post"?a.scheduler=d=>{sn(d,u&&u.suspense)}:r!=="sync"&&(f=!0,a.scheduler=(d,_)=>{_?d():Ll(d)}),a.augmentJob=d=>{e&&(d.flags|=4),f&&(d.flags|=2,u&&(d.id=u.uid,d.i=u))};const h=D0(t,e,a);return Ur&&(l?l.push(h):c&&h()),h}function S_(t,e,n){const i=this.proxy,s=bt(t)?t.includes(".")?kp(i,t):()=>i[t]:t.bind(i,i);let r;Oe(e)?r=e:(r=e.handler,n=e);const o=zr(this),a=$p(s,r.bind(i),n);return o(),a}function kp(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[`${es(e)}Modifiers`];function b_(t,e,...n){if(t.isUnmounted)return;const i=t.vnode.props||nt;let s=n;const r=e.startsWith("update:"),o=r&&y_(i,e.slice(7));o&&(o.trim&&(s=n.map(u=>bt(u)?u.trim():u)),o.number&&(s=n.map(Gc)));let a,c=i[a=Ta(e)]||i[a=Ta(mn(e))];!c&&r&&(c=i[a=Ta(es(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 Wp(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 u=Wp(l,e,!0);u&&(a=!0,Xt(o,u))};!n&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}return!r&&!a?(mt(t)&&i.set(t,null),null):(Be(r)?r.forEach(c=>o[c]=null):Xt(o,r),mt(t)&&i.set(t,o),o)}function sa(t,e){return!t||!Zo(e)?!1:(e=e.slice(2).replace(/Once$/,""),Ke(t,e[0].toLowerCase()+e.slice(1))||Ke(t,es(e))||Ke(t,e))}function Eu(t){const{type:e,vnode:n,proxy:i,withProxy:s,propsOptions:[r],slots:o,attrs:a,emit:c,render:l,renderCache:u,props:f,data:h,setupState:d,ctx:_,inheritAttrs:g}=t,m=$o(t);let p,y;try{if(n.shapeFlag&4){const v=s||i,M=v;p=Dn(l.call(M,v,u,f,d,h,_)),y=a}else{const v=e;p=Dn(v.length>1?v(f,{attrs:a,slots:o,emit:c}):v(f,null)),y=e.props?a:T_(a)}}catch(v){wr.length=0,na(v,t,1),p=si(Lr)}let E=p;if(y&&g!==!1){const v=Object.keys(y),{shapeFlag:M}=E;v.length&&M&7&&(r&&v.some(vl)&&(y=w_(y,r)),E=zs(E,y,!1,!0))}return n.dirs&&(E=zs(E,null,!1,!0),E.dirs=E.dirs?E.dirs.concat(n.dirs):n.dirs),n.transition&&Dl(E,n.transition),p=E,$o(m),p}const T_=t=>{let e;for(const n in t)(n==="class"||n==="style"||Zo(n))&&((e||(e={}))[n]=t[n]);return e},w_=(t,e)=>{const n={};for(const i in t)(!vl(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function A_(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?Su(i,o,l):!!o;if(c&8){const u=e.dynamicProps;for(let f=0;ft.__isSuspense;function P_(t,e){e&&e.pendingBranch?Be(t)?e.effects.push(...t):e.effects.push(t):F0(t)}const Qn=Symbol.for("v-fgt"),ra=Symbol.for("v-txt"),Lr=Symbol.for("v-cmt"),Da=Symbol.for("v-stc"),wr=[];let cn=null;function Il(t=!1){wr.push(cn=t?null:[])}function C_(){wr.pop(),cn=wr[wr.length-1]||null}let Dr=1;function yu(t,e=!1){Dr+=t,t<0&&cn&&e&&(cn.hasOnce=!0)}function L_(t){return t.dynamicChildren=Dr>0?cn||Ds:null,C_(),Dr>0&&cn&&cn.push(t),t}function Nl(t,e,n,i,s,r){return L_(Lt(t,e,n,i,s,r,!0))}function qp(t){return t?t.__v_isVNode===!0:!1}function tr(t,e){return t.type===e.type&&t.key===e.key}const Yp=({key:t})=>t??null,Fo=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?bt(t)||Wt(t)||Oe(t)?{i:an,r:t,k:e,f:!!n}:t:null);function Lt(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&&Yp(e),ref:e&&Fo(e),scopeId:bp,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?(Fl(c,n),r&128&&t.normalize(c)):n&&(c.shapeFlag|=bt(n)?8:16),Dr>0&&!o&&cn&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&cn.push(c),c}const si=D_;function D_(t,e=null,n=null,i=0,s=null,r=!1){if((!t||t===Q0)&&(t=Lr),qp(t)){const a=zs(t,e,!0);return n&&Fl(a,n),Dr>0&&!r&&cn&&(a.shapeFlag&6?cn[cn.indexOf(t)]=a:cn.push(a)),a.patchFlag=-2,a}if(k_(t)&&(t=t.__vccOpts),e){e=U_(e);let{class:a,style:c}=e;a&&!bt(a)&&(e.class=Sl(a)),mt(c)&&(Cl(c)&&!Be(c)&&(c=Xt({},c)),e.style=El(c))}const o=bt(t)?1:Xp(t)?128:z0(t)?64:mt(t)?4:Oe(t)?2:0;return Lt(t,e,n,i,s,o,r,!0)}function U_(t){return t?Cl(t)||Ip(t)?Xt({},t):t:null}function zs(t,e,n=!1,i=!1){const{props:s,ref:r,patchFlag:o,children:a,transition:c}=t,l=e?N_(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&Yp(l),ref:e&&e.ref?n&&r?Be(r)?r.concat(Fo(e)):[r,Fo(e)]:Fo(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&&zs(t.ssContent),ssFallback:t.ssFallback&&zs(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return c&&i&&Dl(u,c.clone(u)),u}function I_(t=" ",e=0){return si(ra,null,t,e)}function Dn(t){return t==null||typeof t=="boolean"?si(Lr):Be(t)?si(Qn,null,t.slice()):qp(t)?Ei(t):si(ra,null,String(t))}function Ei(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:zs(t)}function Fl(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(Be(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Fl(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!Ip(e)?e._ctx=an:s===3&&an&&(an.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Oe(e)?(e={default:e,_ctx:an},n=32):(e=String(e),i&64?(n=16,e=[I_(e)]):n=8);t.children=e,t.shapeFlag|=n}function N_(...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)}};Xo=e("__VUE_INSTANCE_SETTERS__",n=>Ut=n),Jc=e("__VUE_SSR_SETTERS__",n=>Ur=n)}const zr=t=>{const e=Ut;return Xo(t),t.scope.on(),()=>{t.scope.off(),Xo(e)}},bu=()=>{Ut&&Ut.scope.off(),Xo(null)};function jp(t){return t.vnode.shapeFlag&4}let Ur=!1;function z_(t,e=!1,n=!1){e&&Jc(e);const{props:i,children:s}=t.vnode,r=jp(t);u_(t,i,r,e),p_(t,s,n);const o=r?H_(t,e):void 0;return e&&Jc(!1),o}function H_(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,t_);const{setup:i}=n;if(i){Ti();const s=t.setupContext=i.length>1?G_(t):null,r=zr(t),o=Br(i,t,0,[t.props,s]),a=ep(o);if(wi(),r(),(a||t.sp)&&!br(t)&&Tp(t),a){if(o.then(bu,bu),e)return o.then(c=>{Tu(t,c)}).catch(c=>{na(c,t,0)});t.asyncDep=o}else Tu(t,o)}else Kp(t)}function Tu(t,e,n){Oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:mt(e)&&(t.setupState=xp(e)),Kp(t)}function Kp(t,e,n){const i=t.type;t.render||(t.render=i.render||Nn);{const s=zr(t);Ti();try{n_(t)}finally{wi(),s()}}}const V_={get(t,e){return Dt(t,"get",""),t[e]}};function G_(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,V_),slots:t.slots,emit:t.emit,expose:e}}function oa(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(xp(w0(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 $_(t,e=!0){return Oe(t)?t.displayName||t.name:t.name||e&&t.__name}function k_(t){return Oe(t)&&"__vccOpts"in t}const W_=(t,e)=>C0(t,e,Ur),X_="3.5.13";/** +**/function Br(t,e,n,i){try{return i?t(...i):t()}catch(s){sa(s,e,n)}}function On(t,e,n,i){if(Oe(t)){const s=Br(t,e,n,i);return s&&ep(s)&&s.catch(r=>{sa(r,e,n)}),s}if(Be(t)){const s=[];for(let r=0;r>>1,s=$t[i],r=Cr(s);r=Cr(n)?$t.push(t):$t.splice(N0(e),0,t),t.flags|=1,Ep()}}function Ep(){ko||(ko=Mp.then(yp))}function F0(t){Be(t)?Us.push(...t):Mi&&t.id===-1?Mi.splice(As+1,0,t):t.flags&1||(Us.push(t),t.flags|=1),Ep()}function du(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 Sp(t){if(Us.length){const e=[...new Set(Us)].sort((n,i)=>Cr(n)-Cr(i));if(Us.length=0,Mi){Mi.push(...e);return}for(Mi=e,As=0;Ast.id==null?t.flags&2?-1:1/0:t.id;function yp(t){try{for(Ln=0;Ln<$t.length;Ln++){const e=$t[Ln];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Br(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,Sp(),ko=null,($t.length||Us.length)&&yp()}}let an=null,bp=null;function Wo(t){const e=an;return an=t,bp=t&&t.type.__scopeId||null,e}function O0(t,e=an,n){if(!e||t._n)return t;const i=(...s)=>{i._d&&bu(-1);const r=Wo(e);let o;try{o=t(...s)}finally{Wo(r),i._d&&bu(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function Zr(t,e){if(an===null)return t;const n=ca(an),i=t.dirs||(t.dirs=[]);for(let s=0;st.__isTeleport;function Il(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Il(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 Tp(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Xo(t,e,n,i,s=!1){if(Be(t)){t.forEach((_,g)=>Xo(_,e&&(Be(e)?e[g]:e),n,i,s));return}if(br(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Xo(t,e,n,i.component.subTree);return}const r=i.shapeFlag&4?ca(i.component):i.el,o=s?null:r,{i:a,r:c}=t,l=e&&e.r,u=a.refs===nt?a.refs={}:a.refs,f=a.setupState,h=Je(f),d=f===nt?()=>!1:_=>Ke(h,_);if(l!=null&&l!==c&&(Tt(l)?(u[l]=null,d(l)&&(f[l]=null)):Wt(l)&&(l.value=null)),Oe(c))Br(c,a,12,[o,u]);else{const _=Tt(c),g=Wt(c);if(_||g){const m=()=>{if(t.f){const p=_?d(c)?f[c]:u[c]:c.value;s?Be(p)&&El(p,r):Be(p)?p.includes(r)||p.push(r):_?(u[c]=[r],d(c)&&(f[c]=u[c])):(c.value=[r],t.k&&(u[t.k]=c.value))}else _?(u[c]=o,d(c)&&(f[c]=o)):g&&(c.value=o,t.k&&(u[t.k]=o))};o?(m.id=-1,sn(m,n)):m()}}}ia().requestIdleCallback;ia().cancelIdleCallback;const br=t=>!!t.type.__asyncLoader,wp=t=>t.type.__isKeepAlive;function H0(t,e){Ap(t,"a",e)}function V0(t,e){Ap(t,"da",e)}function Ap(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(ra(e,i,n),n){let s=n.parent;for(;s&&s.parent;)wp(s.parent.vnode)&&G0(i,e,n,s),s=s.parent}}function G0(t,e,n,i){const s=ra(e,t,i,!0);Rp(()=>{El(i[e],s)},n)}function ra(t,e,n=Ut,i=!1){if(n){const s=n[t]||(n[t]=[]),r=e.__weh||(e.__weh=(...o)=>{Ti();const a=zr(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)=>{(!Ur||t==="sp")&&ra(t,(...i)=>e(...i),n)},$0=ci("bm"),k0=ci("m"),W0=ci("bu"),X0=ci("u"),q0=ci("bum"),Rp=ci("um"),Y0=ci("sp"),j0=ci("rtg"),K0=ci("rtc");function Z0(t,e=Ut){ra("ec",t,e)}const J0="components";function pu(t,e){return e_(J0,t,!0,e)||t}const Q0=Symbol.for("v-ndc");function e_(t,e,n=!0,i=!1){const s=an||Ut;if(s){const r=s.type;{const a=$_(r,!1);if(a&&(a===e||a===mn(e)||a===na(mn(e))))return r}const o=mu(s[t]||r[t],e)||mu(s.appContext[t],e);return!o&&i?r:o}}function mu(t,e){return t&&(t[e]||t[mn(e)]||t[na(mn(e))])}const Kc=t=>t?jp(t)?ca(t):Kc(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=>Kc(t.parent),$root:t=>Kc(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Cp(t),$forceUpdate:t=>t.f||(t.f=()=>{Ul(t.update)}),$nextTick:t=>t.n||(t.n=I0.bind(t.proxy)),$watch:t=>S_.bind(t)}),La=(t,e)=>t!==nt&&!t.__isScriptSetup&&Ke(t,e),t_={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(La(i,e))return o[e]=1,i[e];if(s!==nt&&Ke(s,e))return o[e]=2,s[e];if((l=t.propsOptions[0])&&Ke(l,e))return o[e]=3,r[e];if(n!==nt&&Ke(n,e))return o[e]=4,n[e];Zc&&(o[e]=0)}}const u=Tr[e];let f,h;if(u)return e==="$attrs"&&Dt(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==nt&&Ke(n,e))return o[e]=4,n[e];if(h=c.config.globalProperties,Ke(h,e))return h[e]},set({_:t},e,n){const{data:i,setupState:s,ctx:r}=t;return La(s,e)?(s[e]=n,!0):i!==nt&&Ke(i,e)?(i[e]=n,!0):Ke(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&&Ke(t,o)||La(e,o)||(a=r[0])&&Ke(a,o)||Ke(i,o)||Ke(Tr,o)||Ke(s.config.globalProperties,o)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:Ke(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function gu(t){return Be(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}let Zc=!0;function n_(t){const e=Cp(t),n=t.proxy,i=t.ctx;Zc=!1,e.beforeCreate&&_u(e.beforeCreate,t,"bc");const{data:s,computed:r,methods:o,watch:a,provide:c,inject:l,created:u,beforeMount:f,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:z,directives:U,filters:O}=e;if(l&&i_(l,i,null),o)for(const k in o){const W=o[k];Oe(W)&&(i[k]=W.bind(n))}if(s){const k=s.call(n,n);gt(k)&&(t.data=Cl(k))}if(Zc=!0,r)for(const k in r){const W=r[k],ue=Oe(W)?W.bind(n,n):Oe(W.get)?W.get.bind(n,n):Nn,oe=!Oe(W)&&Oe(W.set)?W.set.bind(n):Nn,Te=W_({get:ue,set:oe});Object.defineProperty(i,k,{enumerable:!0,configurable:!0,get:()=>Te.value,set:fe=>Te.value=fe})}if(a)for(const k in a)Pp(a[k],i,n,k);if(c){const k=Oe(c)?c.call(n):c;Reflect.ownKeys(k).forEach(W=>{l_(W,k[W])})}u&&_u(u,t,"c");function G(k,W){Be(W)?W.forEach(ue=>k(ue.bind(n))):W&&k(W.bind(n))}if(G($0,f),G(k0,h),G(W0,d),G(X0,_),G(H0,g),G(V0,m),G(Z0,D),G(K0,b),G(j0,w),G(q0,y),G(Rp,v),G(Y0,x),Be(T))if(T.length){const k=t.exposed||(t.exposed={});T.forEach(W=>{Object.defineProperty(k,W,{get:()=>n[W],set:ue=>n[W]=ue})})}else t.exposed||(t.exposed={});M&&t.render===Nn&&(t.render=M),I!=null&&(t.inheritAttrs=I),z&&(t.components=z),U&&(t.directives=U),x&&Tp(t)}function i_(t,e,n=Nn){Be(t)&&(t=Jc(t));for(const i in t){const s=t[i];let r;gt(s)?"default"in s?r=Oo(s.from||i,s.default,!0):r=Oo(s.from||i):r=Oo(s),Wt(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function _u(t,e,n){On(Be(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function Pp(t,e,n,i){let s=i.includes(".")?kp(n,i):()=>n[i];if(Tt(t)){const r=e[t];Oe(r)&&Ua(s,r)}else if(Oe(t))Ua(s,t.bind(n));else if(gt(t))if(Be(t))t.forEach(r=>Pp(r,e,n,i));else{const r=Oe(t.handler)?t.handler.bind(n):e[t.handler];Oe(r)&&Ua(s,r,t)}}function Cp(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=>qo(c,l,o,!0)),qo(c,e,o)),gt(e)&&r.set(e,c),c}function qo(t,e,n,i=!1){const{mixins:s,extends:r}=e;r&&qo(t,r,n,!0),s&&s.forEach(o=>qo(t,o,n,!0));for(const o in e)if(!(i&&o==="expose")){const a=s_[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const s_={data:vu,props:xu,emits:xu,methods:pr,computed:pr,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:pr,directives:pr,watch:o_,provide:vu,inject:r_};function vu(t,e){return e?t?function(){return Xt(Oe(t)?t.call(this,this):t,Oe(e)?e.call(this,this):e)}:e:t}function r_(t,e){return pr(Jc(t),Jc(e))}function Jc(t){if(Be(t)){const e={};for(let n=0;n1)return n&&Oe(e)?e.call(i&&i.proxy):e}}const Dp={},Up=()=>Object.create(Dp),Ip=t=>Object.getPrototypeOf(t)===Dp;function u_(t,e,n,i=!1){const s={},r=Up();t.propsDefaults=Object.create(null),Np(t,e,s,r);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);n?t.props=i?s:T0(s):t.type.props?t.props=s:t.props=r,t.attrs=r}function f_(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 u=t.vnode.dynamicProps;for(let f=0;f{c=!0;const[h,d]=Fp(f,e,!0);Xt(o,h),d&&a.push(...d)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!r&&!c)return gt(t)&&i.set(t,Ds),Ds;if(Be(r))for(let u=0;ut[0]==="_"||t==="$stable",Nl=t=>Be(t)?t.map(Dn):[Dn(t)],d_=(t,e,n)=>{if(e._n)return e;const i=O0((...s)=>Nl(e(...s)),n);return i._c=!1,i},Bp=(t,e,n)=>{const i=t._ctx;for(const s in t){if(Op(s))continue;const r=t[s];if(Oe(r))e[s]=d_(s,r,i);else if(r!=null){const o=Nl(r);e[s]=()=>o}}},zp=(t,e)=>{const n=Nl(e);t.slots.default=()=>n},Hp=(t,e,n)=>{for(const i in e)(n||i!=="_")&&(t[i]=e[i])},p_=(t,e,n)=>{const i=t.slots=Up();if(t.vnode.shapeFlag&32){const s=e._;s?(Hp(i,e,n),n&&tp(i,"_",s,!0)):Bp(e,i)}else e&&zp(t,e)},m_=(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,Bp(e,s)),o=e}else e&&(zp(t,e),o={default:1});if(r)for(const a in s)!Op(a)&&o[a]==null&&delete s[a]},sn=P_;function g_(t){return __(t)}function __(t,e){const n=ia();n.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:c,setText:l,setElementText:u,parentNode:f,nextSibling:h,setScopeId:d=Nn,insertStaticContent:_}=t,g=(P,C,V,ie=null,Q=null,se=null,de=void 0,re=null,le=!!C.dynamicChildren)=>{if(P===C)return;P&&!tr(P,C)&&(ie=N(P),fe(P,Q,se,!0),P=null),C.patchFlag===-2&&(le=!1,C.dynamicChildren=null);const{type:ae,ref:A,shapeFlag:S}=C;switch(ae){case aa:m(P,C,V,ie);break;case Lr:p(P,C,V,ie);break;case Ia:P==null&&y(C,V,ie,de);break;case Qn:z(P,C,V,ie,Q,se,de,re,le);break;default:S&1?M(P,C,V,ie,Q,se,de,re,le):S&6?U(P,C,V,ie,Q,se,de,re,le):(S&64||S&128)&&ae.process(P,C,V,ie,Q,se,de,re,le,me)}A!=null&&Q&&Xo(A,P&&P.ref,se,C||P,!C)},m=(P,C,V,ie)=>{if(P==null)i(C.el=a(C.children),V,ie);else{const Q=C.el=P.el;C.children!==P.children&&l(Q,C.children)}},p=(P,C,V,ie)=>{P==null?i(C.el=c(C.children||""),V,ie):C.el=P.el},y=(P,C,V,ie)=>{[P.el,P.anchor]=_(P.children,C,V,ie,P.el,P.anchor)},E=({el:P,anchor:C},V,ie)=>{let Q;for(;P&&P!==C;)Q=h(P),i(P,V,ie),P=Q;i(C,V,ie)},v=({el:P,anchor:C})=>{let V;for(;P&&P!==C;)V=h(P),s(P),P=V;s(C)},M=(P,C,V,ie,Q,se,de,re,le)=>{C.type==="svg"?de="svg":C.type==="math"&&(de="mathml"),P==null?b(C,V,ie,Q,se,de,re,le):x(P,C,Q,se,de,re,le)},b=(P,C,V,ie,Q,se,de,re)=>{let le,ae;const{props:A,shapeFlag:S,transition:B,dirs:j}=P;if(le=P.el=o(P.type,se,A&&A.is,A),S&8?u(le,P.children):S&16&&D(P.children,le,null,ie,Q,Da(P,se),de,re),j&&Ci(P,null,ie,"created"),w(le,P,P.scopeId,de,ie),A){for(const he in A)he!=="value"&&!Mr(he)&&r(le,he,null,A[he],se,ie);"value"in A&&r(le,"value",null,A.value,se),(ae=A.onVnodeBeforeMount)&&An(ae,ie,P)}j&&Ci(P,null,ie,"beforeMount");const Z=v_(Q,B);Z&&B.beforeEnter(le),i(le,C,V),((ae=A&&A.onVnodeMounted)||Z||j)&&sn(()=>{ae&&An(ae,ie,P),Z&&B.enter(le),j&&Ci(P,null,ie,"mounted")},Q)},w=(P,C,V,ie,Q)=>{if(V&&d(P,V),ie)for(let se=0;se{for(let ae=le;ae{const re=C.el=P.el;let{patchFlag:le,dynamicChildren:ae,dirs:A}=C;le|=P.patchFlag&16;const S=P.props||nt,B=C.props||nt;let j;if(V&&Li(V,!1),(j=B.onVnodeBeforeUpdate)&&An(j,V,C,P),A&&Ci(C,P,V,"beforeUpdate"),V&&Li(V,!0),(S.innerHTML&&B.innerHTML==null||S.textContent&&B.textContent==null)&&u(re,""),ae?T(P.dynamicChildren,ae,re,V,ie,Da(C,Q),se):de||W(P,C,re,null,V,ie,Da(C,Q),se,!1),le>0){if(le&16)I(re,S,B,V,Q);else if(le&2&&S.class!==B.class&&r(re,"class",null,B.class,Q),le&4&&r(re,"style",S.style,B.style,Q),le&8){const Z=C.dynamicProps;for(let he=0;he{j&&An(j,V,C,P),A&&Ci(C,P,V,"updated")},ie)},T=(P,C,V,ie,Q,se,de)=>{for(let re=0;re{if(C!==V){if(C!==nt)for(const se in C)!Mr(se)&&!(se in V)&&r(P,se,C[se],null,Q,ie);for(const se in V){if(Mr(se))continue;const de=V[se],re=C[se];de!==re&&se!=="value"&&r(P,se,re,de,Q,ie)}"value"in V&&r(P,"value",C.value,V.value,Q)}},z=(P,C,V,ie,Q,se,de,re,le)=>{const ae=C.el=P?P.el:a(""),A=C.anchor=P?P.anchor:a("");let{patchFlag:S,dynamicChildren:B,slotScopeIds:j}=C;j&&(re=re?re.concat(j):j),P==null?(i(ae,V,ie),i(A,V,ie),D(C.children||[],V,A,Q,se,de,re,le)):S>0&&S&64&&B&&P.dynamicChildren?(T(P.dynamicChildren,B,V,Q,se,de,re),(C.key!=null||Q&&C===Q.subTree)&&Vp(P,C,!0)):W(P,C,V,A,Q,se,de,re,le)},U=(P,C,V,ie,Q,se,de,re,le)=>{C.slotScopeIds=re,P==null?C.shapeFlag&512?Q.ctx.activate(C,V,ie,de,le):O(C,V,ie,Q,se,de,le):H(P,C,le)},O=(P,C,V,ie,Q,se,de)=>{const re=P.component=B_(P,ie,Q);if(wp(P)&&(re.ctx.renderer=me),z_(re,!1,de),re.asyncDep){if(Q&&Q.registerDep(re,G,de),!P.el){const le=re.subTree=si(Lr);p(null,le,C,V)}}else G(re,P,C,V,Q,se,de)},H=(P,C,V)=>{const ie=C.component=P.component;if(A_(P,C,V))if(ie.asyncDep&&!ie.asyncResolved){k(ie,C,V);return}else ie.next=C,ie.update();else C.el=P.el,ie.vnode=C},G=(P,C,V,ie,Q,se,de)=>{const re=()=>{if(P.isMounted){let{next:S,bu:B,u:j,parent:Z,vnode:he}=P;{const Ee=Gp(P);if(Ee){S&&(S.el=he.el,k(P,S,de)),Ee.asyncDep.then(()=>{P.isUnmounted||re()});return}}let L=S,J;Li(P,!1),S?(S.el=he.el,k(P,S,de)):S=he,B&&Fo(B),(J=S.props&&S.props.onVnodeBeforeUpdate)&&An(J,Z,S,he),Li(P,!0);const X=Su(P),ge=P.subTree;P.subTree=X,g(ge,X,f(ge.el),N(ge),P,Q,se),S.el=X.el,L===null&&R_(P,X.el),j&&sn(j,Q),(J=S.props&&S.props.onVnodeUpdated)&&sn(()=>An(J,Z,S,he),Q)}else{let S;const{el:B,props:j}=C,{bm:Z,m:he,parent:L,root:J,type:X}=P,ge=br(C);Li(P,!1),Z&&Fo(Z),!ge&&(S=j&&j.onVnodeBeforeMount)&&An(S,L,C),Li(P,!0);{J.ce&&J.ce._injectChildStyle(X);const Ee=P.subTree=Su(P);g(null,Ee,V,ie,P,Q,se),C.el=Ee.el}if(he&&sn(he,Q),!ge&&(S=j&&j.onVnodeMounted)){const Ee=C;sn(()=>An(S,L,Ee),Q)}(C.shapeFlag&256||L&&br(L.vnode)&&L.vnode.shapeFlag&256)&&P.a&&sn(P.a,Q),P.isMounted=!0,C=V=ie=null}};P.scope.on();const le=P.effect=new ip(re);P.scope.off();const ae=P.update=le.run.bind(le),A=P.job=le.runIfDirty.bind(le);A.i=P,A.id=P.uid,le.scheduler=()=>Ul(A),Li(P,!0),ae()},k=(P,C,V)=>{C.component=P;const ie=P.vnode.props;P.vnode=C,P.next=null,f_(P,C.props,ie,V),m_(P,C.children,V),Ti(),du(P),wi()},W=(P,C,V,ie,Q,se,de,re,le=!1)=>{const ae=P&&P.children,A=P?P.shapeFlag:0,S=C.children,{patchFlag:B,shapeFlag:j}=C;if(B>0){if(B&128){oe(ae,S,V,ie,Q,se,de,re,le);return}else if(B&256){ue(ae,S,V,ie,Q,se,de,re,le);return}}j&8?(A&16&&xe(ae,Q,se),S!==ae&&u(V,S)):A&16?j&16?oe(ae,S,V,ie,Q,se,de,re,le):xe(ae,Q,se,!0):(A&8&&u(V,""),j&16&&D(S,V,ie,Q,se,de,re,le))},ue=(P,C,V,ie,Q,se,de,re,le)=>{P=P||Ds,C=C||Ds;const ae=P.length,A=C.length,S=Math.min(ae,A);let B;for(B=0;BA?xe(P,Q,se,!0,!1,S):D(C,V,ie,Q,se,de,re,le,S)},oe=(P,C,V,ie,Q,se,de,re,le)=>{let ae=0;const A=C.length;let S=P.length-1,B=A-1;for(;ae<=S&&ae<=B;){const j=P[ae],Z=C[ae]=le?Ei(C[ae]):Dn(C[ae]);if(tr(j,Z))g(j,Z,V,null,Q,se,de,re,le);else break;ae++}for(;ae<=S&&ae<=B;){const j=P[S],Z=C[B]=le?Ei(C[B]):Dn(C[B]);if(tr(j,Z))g(j,Z,V,null,Q,se,de,re,le);else break;S--,B--}if(ae>S){if(ae<=B){const j=B+1,Z=jB)for(;ae<=S;)fe(P[ae],Q,se,!0),ae++;else{const j=ae,Z=ae,he=new Map;for(ae=Z;ae<=B;ae++){const Se=C[ae]=le?Ei(C[ae]):Dn(C[ae]);Se.key!=null&&he.set(Se.key,ae)}let L,J=0;const X=B-Z+1;let ge=!1,Ee=0;const we=new Array(X);for(ae=0;ae=X){fe(Se,Q,se,!0);continue}let Pe;if(Se.key!=null)Pe=he.get(Se.key);else for(L=Z;L<=B;L++)if(we[L-Z]===0&&tr(Se,C[L])){Pe=L;break}Pe===void 0?fe(Se,Q,se,!0):(we[Pe-Z]=ae+1,Pe>=Ee?Ee=Pe:ge=!0,g(Se,C[Pe],V,null,Q,se,de,re,le),J++)}const ye=ge?x_(we):Ds;for(L=ye.length-1,ae=X-1;ae>=0;ae--){const Se=Z+ae,Pe=C[Se],Fe=Se+1{const{el:se,type:de,transition:re,children:le,shapeFlag:ae}=P;if(ae&6){Te(P.component.subTree,C,V,ie);return}if(ae&128){P.suspense.move(C,V,ie);return}if(ae&64){de.move(P,C,V,me);return}if(de===Qn){i(se,C,V);for(let S=0;Sre.enter(se),Q);else{const{leave:S,delayLeave:B,afterLeave:j}=re,Z=()=>i(se,C,V),he=()=>{S(se,()=>{Z(),j&&j()})};B?B(se,Z,he):he()}else i(se,C,V)},fe=(P,C,V,ie=!1,Q=!1)=>{const{type:se,props:de,ref:re,children:le,dynamicChildren:ae,shapeFlag:A,patchFlag:S,dirs:B,cacheIndex:j}=P;if(S===-2&&(Q=!1),re!=null&&Xo(re,null,V,P,!0),j!=null&&(C.renderCache[j]=void 0),A&256){C.ctx.deactivate(P);return}const Z=A&1&&B,he=!br(P);let L;if(he&&(L=de&&de.onVnodeBeforeUnmount)&&An(L,C,P),A&6)_e(P.component,V,ie);else{if(A&128){P.suspense.unmount(V,ie);return}Z&&Ci(P,null,C,"beforeUnmount"),A&64?P.type.remove(P,C,V,me,ie):ae&&!ae.hasOnce&&(se!==Qn||S>0&&S&64)?xe(ae,C,V,!1,!0):(se===Qn&&S&384||!Q&&A&16)&&xe(le,C,V),ie&&K(P)}(he&&(L=de&&de.onVnodeUnmounted)||Z)&&sn(()=>{L&&An(L,C,P),Z&&Ci(P,null,C,"unmounted")},V)},K=P=>{const{type:C,el:V,anchor:ie,transition:Q}=P;if(C===Qn){ce(V,ie);return}if(C===Ia){v(P);return}const se=()=>{s(V),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(P.shapeFlag&1&&Q&&!Q.persisted){const{leave:de,delayLeave:re}=Q,le=()=>de(V,se);re?re(P.el,se,le):le()}else se()},ce=(P,C)=>{let V;for(;P!==C;)V=h(P),s(P),P=V;s(C)},_e=(P,C,V)=>{const{bum:ie,scope:Q,job:se,subTree:de,um:re,m:le,a:ae}=P;Eu(le),Eu(ae),ie&&Fo(ie),Q.stop(),se&&(se.flags|=8,fe(de,P,C,V)),re&&sn(re,C),sn(()=>{P.isUnmounted=!0},C),C&&C.pendingBranch&&!C.isUnmounted&&P.asyncDep&&!P.asyncResolved&&P.suspenseId===C.pendingId&&(C.deps--,C.deps===0&&C.resolve())},xe=(P,C,V,ie=!1,Q=!1,se=0)=>{for(let de=se;de{if(P.shapeFlag&6)return N(P.component.subTree);if(P.shapeFlag&128)return P.suspense.next();const C=h(P.anchor||P.el),V=C&&C[B0];return V?h(V):C};let Ie=!1;const De=(P,C,V)=>{P==null?C._vnode&&fe(C._vnode,null,null,!0):g(C._vnode||null,P,C,null,null,null,V),C._vnode=P,Ie||(Ie=!0,du(),Sp(),Ie=!1)},me={p:g,um:fe,m:Te,r:K,mt:O,mc:D,pc:W,pbc:T,n:N,o:t};return{render:De,hydrate:void 0,createApp:c_(De)}}function Da({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 v_(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Vp(t,e,n=!1){const i=t.children,s=e.children;if(Be(i)&&Be(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 Gp(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Gp(e)}function Eu(t){if(t)for(let e=0;eOo(M_);function Ua(t,e,n){return $p(t,e,n)}function $p(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(Ur){if(r==="sync"){const d=E_();l=d.__watcherHandles||(d.__watcherHandles=[])}else if(!c){const d=()=>{};return d.stop=Nn,d.resume=Nn,d.pause=Nn,d}}const u=Ut;a.call=(d,_,g)=>On(d,u,_,g);let f=!1;r==="post"?a.scheduler=d=>{sn(d,u&&u.suspense)}:r!=="sync"&&(f=!0,a.scheduler=(d,_)=>{_?d():Ul(d)}),a.augmentJob=d=>{e&&(d.flags|=4),f&&(d.flags|=2,u&&(d.id=u.uid,d.i=u))};const h=D0(t,e,a);return Ur&&(l?l.push(h):c&&h()),h}function S_(t,e,n){const i=this.proxy,s=Tt(t)?t.includes(".")?kp(i,t):()=>i[t]:t.bind(i,i);let r;Oe(e)?r=e:(r=e.handler,n=e);const o=zr(this),a=$p(s,r.bind(i),n);return o(),a}function kp(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[`${es(e)}Modifiers`];function b_(t,e,...n){if(t.isUnmounted)return;const i=t.vnode.props||nt;let s=n;const r=e.startsWith("update:"),o=r&&y_(i,e.slice(7));o&&(o.trim&&(s=n.map(u=>Tt(u)?u.trim():u)),o.number&&(s=n.map(kc)));let a,c=i[a=Aa(e)]||i[a=Aa(mn(e))];!c&&r&&(c=i[a=Aa(es(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 Wp(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 u=Wp(l,e,!0);u&&(a=!0,Xt(o,u))};!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):(Be(r)?r.forEach(c=>o[c]=null):Xt(o,r),gt(t)&&i.set(t,o),o)}function oa(t,e){return!t||!Qo(e)?!1:(e=e.slice(2).replace(/Once$/,""),Ke(t,e[0].toLowerCase()+e.slice(1))||Ke(t,es(e))||Ke(t,e))}function Su(t){const{type:e,vnode:n,proxy:i,withProxy:s,propsOptions:[r],slots:o,attrs:a,emit:c,render:l,renderCache:u,props:f,data:h,setupState:d,ctx:_,inheritAttrs:g}=t,m=Wo(t);let p,y;try{if(n.shapeFlag&4){const v=s||i,M=v;p=Dn(l.call(M,v,u,f,d,h,_)),y=a}else{const v=e;p=Dn(v.length>1?v(f,{attrs:a,slots:o,emit:c}):v(f,null)),y=e.props?a:T_(a)}}catch(v){wr.length=0,sa(v,t,1),p=si(Lr)}let E=p;if(y&&g!==!1){const v=Object.keys(y),{shapeFlag:M}=E;v.length&&M&7&&(r&&v.some(Ml)&&(y=w_(y,r)),E=zs(E,y,!1,!0))}return n.dirs&&(E=zs(E,null,!1,!0),E.dirs=E.dirs?E.dirs.concat(n.dirs):n.dirs),n.transition&&Il(E,n.transition),p=E,Wo(m),p}const T_=t=>{let e;for(const n in t)(n==="class"||n==="style"||Qo(n))&&((e||(e={}))[n]=t[n]);return e},w_=(t,e)=>{const n={};for(const i in t)(!Ml(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function A_(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?yu(i,o,l):!!o;if(c&8){const u=e.dynamicProps;for(let f=0;ft.__isSuspense;function P_(t,e){e&&e.pendingBranch?Be(t)?e.effects.push(...t):e.effects.push(t):F0(t)}const Qn=Symbol.for("v-fgt"),aa=Symbol.for("v-txt"),Lr=Symbol.for("v-cmt"),Ia=Symbol.for("v-stc"),wr=[];let cn=null;function Fl(t=!1){wr.push(cn=t?null:[])}function C_(){wr.pop(),cn=wr[wr.length-1]||null}let Dr=1;function bu(t,e=!1){Dr+=t,t<0&&cn&&e&&(cn.hasOnce=!0)}function L_(t){return t.dynamicChildren=Dr>0?cn||Ds:null,C_(),Dr>0&&cn&&cn.push(t),t}function Ol(t,e,n,i,s,r){return L_(ut(t,e,n,i,s,r,!0))}function qp(t){return t?t.__v_isVNode===!0:!1}function tr(t,e){return t.type===e.type&&t.key===e.key}const Yp=({key:t})=>t??null,Bo=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?Tt(t)||Wt(t)||Oe(t)?{i:an,r:t,k:e,f:!!n}:t:null);function ut(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&&Yp(e),ref:e&&Bo(e),scopeId:bp,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?(Bl(c,n),r&128&&t.normalize(c)):n&&(c.shapeFlag|=Tt(n)?8:16),Dr>0&&!o&&cn&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&cn.push(c),c}const si=D_;function D_(t,e=null,n=null,i=0,s=null,r=!1){if((!t||t===Q0)&&(t=Lr),qp(t)){const a=zs(t,e,!0);return n&&Bl(a,n),Dr>0&&!r&&cn&&(a.shapeFlag&6?cn[cn.indexOf(t)]=a:cn.push(a)),a.patchFlag=-2,a}if(k_(t)&&(t=t.__vccOpts),e){e=U_(e);let{class:a,style:c}=e;a&&!Tt(a)&&(e.class=bl(a)),gt(c)&&(Dl(c)&&!Be(c)&&(c=Xt({},c)),e.style=yl(c))}const o=Tt(t)?1:Xp(t)?128:z0(t)?64:gt(t)?4:Oe(t)?2:0;return ut(t,e,n,i,s,o,r,!0)}function U_(t){return t?Dl(t)||Ip(t)?Xt({},t):t:null}function zs(t,e,n=!1,i=!1){const{props:s,ref:r,patchFlag:o,children:a,transition:c}=t,l=e?N_(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&Yp(l),ref:e&&e.ref?n&&r?Be(r)?r.concat(Bo(e)):[r,Bo(e)]:Bo(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&&zs(t.ssContent),ssFallback:t.ssFallback&&zs(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return c&&i&&Il(u,c.clone(u)),u}function I_(t=" ",e=0){return si(aa,null,t,e)}function Dn(t){return t==null||typeof t=="boolean"?si(Lr):Be(t)?si(Qn,null,t.slice()):qp(t)?Ei(t):si(aa,null,String(t))}function Ei(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:zs(t)}function Bl(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(Be(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Bl(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!Ip(e)?e._ctx=an:s===3&&an&&(an.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Oe(e)?(e={default:e,_ctx:an},n=32):(e=String(e),i&64?(n=16,e=[I_(e)]):n=8);t.children=e,t.shapeFlag|=n}function N_(...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)}};Yo=e("__VUE_INSTANCE_SETTERS__",n=>Ut=n),el=e("__VUE_SSR_SETTERS__",n=>Ur=n)}const zr=t=>{const e=Ut;return Yo(t),t.scope.on(),()=>{t.scope.off(),Yo(e)}},Tu=()=>{Ut&&Ut.scope.off(),Yo(null)};function jp(t){return t.vnode.shapeFlag&4}let Ur=!1;function z_(t,e=!1,n=!1){e&&el(e);const{props:i,children:s}=t.vnode,r=jp(t);u_(t,i,r,e),p_(t,s,n);const o=r?H_(t,e):void 0;return e&&el(!1),o}function H_(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,t_);const{setup:i}=n;if(i){Ti();const s=t.setupContext=i.length>1?G_(t):null,r=zr(t),o=Br(i,t,0,[t.props,s]),a=ep(o);if(wi(),r(),(a||t.sp)&&!br(t)&&Tp(t),a){if(o.then(Tu,Tu),e)return o.then(c=>{wu(t,c)}).catch(c=>{sa(c,t,0)});t.asyncDep=o}else wu(t,o)}else Kp(t)}function wu(t,e,n){Oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:gt(e)&&(t.setupState=xp(e)),Kp(t)}function Kp(t,e,n){const i=t.type;t.render||(t.render=i.render||Nn);{const s=zr(t);Ti();try{n_(t)}finally{wi(),s()}}}const V_={get(t,e){return Dt(t,"get",""),t[e]}};function G_(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,V_),slots:t.slots,emit:t.emit,expose:e}}function ca(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(xp(w0(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 $_(t,e=!0){return Oe(t)?t.displayName||t.name:t.name||e&&t.__name}function k_(t){return Oe(t)&&"__vccOpts"in t}const W_=(t,e)=>C0(t,e,Ur),X_="3.5.13";/** * @vue/runtime-dom v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let Qc;const wu=typeof window<"u"&&window.trustedTypes;if(wu)try{Qc=wu.createPolicy("vue",{createHTML:t=>t})}catch{}const Zp=Qc?t=>Qc.createHTML(t):t=>t,q_="http://www.w3.org/2000/svg",Y_="http://www.w3.org/1998/Math/MathML",Jn=typeof document<"u"?document:null,Au=Jn&&Jn.createElement("template"),j_={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(q_,t):e==="mathml"?Jn.createElementNS(Y_,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{Au.innerHTML=Zp(i==="svg"?`${t}`:i==="mathml"?`${t}`:t);const a=Au.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]}},K_=Symbol("_vtc");function Z_(t,e,n){const i=t[K_];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const Ru=Symbol("_vod"),J_=Symbol("_vsh"),Q_=Symbol(""),ev=/(^|;)\s*display\s*:/;function tv(t,e,n){const i=t.style,s=bt(n);let r=!1;if(n&&!s){if(e)if(bt(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&Oo(i,a,"")}else for(const o in e)n[o]==null&&Oo(i,o,"");for(const o in n)o==="display"&&(r=!0),Oo(i,o,n[o])}else if(s){if(e!==n){const o=i[Q_];o&&(n+=";"+o),i.cssText=n,r=ev.test(n)}}else e&&t.removeAttribute("style");Ru in t&&(t[Ru]=r?i.display:"",t[J_]&&(i.display="none"))}const Pu=/\s*!important$/;function Oo(t,e,n){if(Be(n))n.forEach(i=>Oo(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=nv(t,e);Pu.test(n)?t.setProperty(es(i),n.replace(Pu,""),"important"):t[i]=n}}const Cu=["Webkit","Moz","ms"],Ua={};function nv(t,e){const n=Ua[e];if(n)return n;let i=mn(e);if(i!=="filter"&&i in t)return Ua[e]=i;i=ea(i);for(let s=0;sIa||(ov.then(()=>Ia=0),Ia=Date.now());function cv(t,e){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;On(lv(i,n.value),e,5,[i])};return n.value=t,n.attached=av(),n}function lv(t,e){if(Be(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,uv=(t,e,n,i,s,r)=>{const o=s==="svg";e==="class"?Z_(t,i,o):e==="style"?tv(t,n,i):Zo(e)?vl(e)||sv(t,e,n,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):fv(t,e,i,o))?(Uu(t,e,i),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Du(t,e,i,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!bt(i))?Uu(t,mn(e),i,r,e):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),Du(t,e,i,o))};function fv(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)&&bt(n)?!1:e in t}const Ou=t=>{const e=t.props["onUpdate:modelValue"]||!1;return Be(e)?n=>Io(e,n):e};function hv(t){t.target.composing=!0}function Bu(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Na=Symbol("_assign"),zu={created(t,{modifiers:{lazy:e,trim:n,number:i}},s){t[Na]=Ou(s);const r=i||s.props&&s.props.type==="number";Rs(t,e?"change":"input",o=>{if(o.target.composing)return;let a=t.value;n&&(a=a.trim()),r&&(a=Gc(a)),t[Na](a)}),n&&Rs(t,"change",()=>{t.value=t.value.trim()}),e||(Rs(t,"compositionstart",hv),Rs(t,"compositionend",Bu),Rs(t,"change",Bu))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:n,modifiers:{lazy:i,trim:s,number:r}},o){if(t[Na]=Ou(o),t.composing)return;const a=(r||t.type==="number")&&!/^0\d/.test(t.value)?Gc(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))}},dv=["ctrl","shift","alt","meta"],pv={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)=>dv.some(n=>t[`${n}Key`]&&!e.includes(n))},mv=(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=_v().createApp(...t),{mount:n}=e;return e.mount=i=>{const s=Mv(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,xv(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e};function xv(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Mv(t){return bt(t)?document.querySelector(t):t}const Ol=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n},Ev={data(){return{width:155,length:105}},methods:{emitValues(){this.$emit("update-dimensions",{width:this.width,length:this.length})}}},Sv={class:"flex-1"},yv={class:"flex-1"};function bv(t,e,n,i,s,r){return Il(),Nl("form",{onSubmit:e[2]||(e[2]=mv((...o)=>r.emitValues&&r.emitValues(...o),["prevent"])),style:{width:"100%","max-width":"600px",margin:"0 auto","box-sizing":"border-box"},class:"flex flex-col sm:flex-row sm:space-x-4 items-end"},[Lt("div",Sv,[e[3]||(e[3]=Lt("label",{class:"block text-sm font-medium text-gray-700"},"Width (mm):",-1)),hu(Lt("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>s.width=o),type:"number",placeholder:"Enter width",class:"mt-1 p-2 border border-gray-300 rounded-md w-full"},null,512),[[zu,s.width,void 0,{number:!0}]])]),Lt("div",yv,[e[4]||(e[4]=Lt("label",{class:"block text-sm font-medium text-gray-700"},"Length (mm):",-1)),hu(Lt("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>s.length=o),type:"number",placeholder:"Enter length",class:"mt-1 p-2 border border-gray-300 rounded-md w-full"},null,512),[[zu,s.length,void 0,{number:!0}]])]),e[5]||(e[5]=Lt("div",null,[Lt("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 Tv=Ol(Ev,[["render",bv]]);/** +**/let tl;const Au=typeof window<"u"&&window.trustedTypes;if(Au)try{tl=Au.createPolicy("vue",{createHTML:t=>t})}catch{}const Zp=tl?t=>tl.createHTML(t):t=>t,q_="http://www.w3.org/2000/svg",Y_="http://www.w3.org/1998/Math/MathML",Jn=typeof document<"u"?document:null,Ru=Jn&&Jn.createElement("template"),j_={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(q_,t):e==="mathml"?Jn.createElementNS(Y_,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{Ru.innerHTML=Zp(i==="svg"?`${t}`:i==="mathml"?`${t}`:t);const a=Ru.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]}},K_=Symbol("_vtc");function Z_(t,e,n){const i=t[K_];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const Pu=Symbol("_vod"),J_=Symbol("_vsh"),Q_=Symbol(""),ev=/(^|;)\s*display\s*:/;function tv(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&&zo(i,a,"")}else for(const o in e)n[o]==null&&zo(i,o,"");for(const o in n)o==="display"&&(r=!0),zo(i,o,n[o])}else if(s){if(e!==n){const o=i[Q_];o&&(n+=";"+o),i.cssText=n,r=ev.test(n)}}else e&&t.removeAttribute("style");Pu in t&&(t[Pu]=r?i.display:"",t[J_]&&(i.display="none"))}const Cu=/\s*!important$/;function zo(t,e,n){if(Be(n))n.forEach(i=>zo(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=nv(t,e);Cu.test(n)?t.setProperty(es(i),n.replace(Cu,""),"important"):t[i]=n}}const Lu=["Webkit","Moz","ms"],Na={};function nv(t,e){const n=Na[e];if(n)return n;let i=mn(e);if(i!=="filter"&&i in t)return Na[e]=i;i=na(i);for(let s=0;sFa||(ov.then(()=>Fa=0),Fa=Date.now());function cv(t,e){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;On(lv(i,n.value),e,5,[i])};return n.value=t,n.attached=av(),n}function lv(t,e){if(Be(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 Ou=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,uv=(t,e,n,i,s,r)=>{const o=s==="svg";e==="class"?Z_(t,i,o):e==="style"?tv(t,n,i):Qo(e)?Ml(e)||sv(t,e,n,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):fv(t,e,i,o))?(Iu(t,e,i),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Uu(t,e,i,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!Tt(i))?Iu(t,mn(e),i,r,e):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),Uu(t,e,i,o))};function fv(t,e,n,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in t&&Ou(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 Ou(e)&&Tt(n)?!1:e in t}const Bu=t=>{const e=t.props["onUpdate:modelValue"]||!1;return Be(e)?n=>Fo(e,n):e};function hv(t){t.target.composing=!0}function zu(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Oa=Symbol("_assign"),Jr={created(t,{modifiers:{lazy:e,trim:n,number:i}},s){t[Oa]=Bu(s);const r=i||s.props&&s.props.type==="number";Rs(t,e?"change":"input",o=>{if(o.target.composing)return;let a=t.value;n&&(a=a.trim()),r&&(a=kc(a)),t[Oa](a)}),n&&Rs(t,"change",()=>{t.value=t.value.trim()}),e||(Rs(t,"compositionstart",hv),Rs(t,"compositionend",zu),Rs(t,"change",zu))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:n,modifiers:{lazy:i,trim:s,number:r}},o){if(t[Oa]=Bu(o),t.composing)return;const a=(r||t.type==="number")&&!/^0\d/.test(t.value)?kc(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))}},dv=["ctrl","shift","alt","meta"],pv={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)=>dv.some(n=>t[`${n}Key`]&&!e.includes(n))},mv=(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=_v().createApp(...t),{mount:n}=e;return e.mount=i=>{const s=Mv(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,xv(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e};function xv(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Mv(t){return Tt(t)?document.querySelector(t):t}const zl=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n},Ev={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})}}},Sv={class:"flex-1 mb-4 sm:mb-0"},yv={class:"flex-1 mb-4 sm:mb-0"},bv={class:"flex-1 mb-4 sm:mb-0"},Tv={class:"flex items-center space-x-2 mt-1"};function wv(t,e,n,i,s,r){return Fl(),Ol("form",{onSubmit:e[4]||(e[4]=mv((...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"}},[ut("div",Sv,[e[5]||(e[5]=ut("label",{class:"block text-sm font-medium text-gray-700"},"Width (mm):",-1)),Zr(ut("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),[[Jr,s.localWidth,void 0,{number:!0}]])]),ut("div",yv,[e[6]||(e[6]=ut("label",{class:"block text-sm font-medium text-gray-700"},"Length (mm):",-1)),Zr(ut("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),[[Jr,s.localLength,void 0,{number:!0}]])]),ut("div",bv,[e[7]||(e[7]=ut("label",{class:"block text-sm font-medium text-gray-700"}," Safety Offset (mm): ",-1)),ut("div",Tv,[Zr(ut("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),[[Jr,s.localSafety,void 0,{number:!0}]]),Zr(ut("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),[[Jr,s.localSafety,void 0,{number:!0}]])])]),e[8]||(e[8]=ut("div",null,[ut("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 Av=zl(Ev,[["render",wv]]);/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const Bl="152",rs={ROTATE:0,DOLLY:1,PAN:2},os={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},wv=0,Vu=1,Av=2,Jp=1,Rv=2,Zn=3,bi=0,jt=1,ni=2,yi=0,Ns=1,Gu=2,$u=3,ku=4,Pv=5,Ps=100,Cv=101,Lv=102,Wu=103,Xu=104,Dv=200,Uv=201,Iv=202,Nv=203,Qp=204,em=205,Fv=206,Ov=207,Bv=208,zv=209,Hv=210,Vv=0,Gv=1,$v=2,el=3,kv=4,Wv=5,Xv=6,qv=7,tm=0,Yv=1,jv=2,ri=0,Kv=1,Zv=2,Jv=3,Qv=4,ex=5,nm=300,Hs=301,Vs=302,tl=303,nl=304,aa=306,il=1e3,yn=1001,sl=1002,Gt=1003,qu=1004,Fa=1005,dn=1006,tx=1007,Ir=1008,Ki=1009,nx=1010,ix=1011,im=1012,sx=1013,$i=1014,ki=1015,Nr=1016,rx=1017,ox=1018,Fs=1020,ax=1021,bn=1023,cx=1024,lx=1025,qi=1026,Gs=1027,ux=1028,fx=1029,hx=1030,dx=1031,px=1033,Oa=33776,Ba=33777,za=33778,Ha=33779,Yu=35840,ju=35841,Ku=35842,Zu=35843,mx=36196,Ju=37492,Qu=37496,ef=37808,tf=37809,nf=37810,sf=37811,rf=37812,of=37813,af=37814,cf=37815,lf=37816,uf=37817,ff=37818,hf=37819,df=37820,pf=37821,Va=36492,gx=36283,mf=36284,gf=36285,_f=36286,sm=3e3,Yi=3001,_x=3200,vx=3201,rm=0,xx=1,ji="",ze="srgb",Bn="srgb-linear",om="display-p3",Ga=7680,Mx=519,vf=35044,xf="300 es",rl=1035;class ts{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 Ex(t,e){return(t%e+e)%e}function ka(t,e,n){return(1-n)*t+n*e}function Mf(t){return(t&t-1)===0&&t!==0}function Sx(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Zr(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 Zt(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.")}}class Ge{constructor(e=0,n=0){Ge.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 Ye{constructor(){Ye.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 u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=n,u[4]=r,u[5]=c,u[6]=i,u[7]=o,u[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],u=i[4],f=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+u*y+f*M,r[4]=l*m+u*E+f*b,r[7]=l*p+u*v+f*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],u=e[8];return n*o*u-n*a*l-i*r*u+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],u=e[8],f=u*o-a*l,h=a*c-u*r,d=l*r-o*c,_=n*f+i*h+s*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=f*g,e[1]=(s*l-u*i)*g,e[2]=(a*i-s*o)*g,e[3]=h*g,e[4]=(u*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(Wa.makeScale(e,n)),this}rotate(e){return this.premultiply(Wa.makeRotation(-e)),this}translate(e,n){return this.premultiply(Wa.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 Wa=new Ye;function am(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function qo(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const Ef={};function Ar(t){t in Ef||(Ef[t]=!0,console.warn(t))}function Os(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Xa(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const yx=new Ye().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),bx=new Ye().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function Tx(t){return t.convertSRGBToLinear().applyMatrix3(bx)}function wx(t){return t.applyMatrix3(yx).convertLinearToSRGB()}const Ax={[Bn]:t=>t,[ze]:t=>t.convertSRGBToLinear(),[om]:Tx},Rx={[Bn]:t=>t,[ze]:t=>t.convertLinearToSRGB(),[om]:wx},_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=Ax[e],s=Rx[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 as;class cm{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{as===void 0&&(as=qo("canvas")),as.width=e.width,as.height=e.height;const i=as.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=as}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=qo("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!==nm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case il:e.x=e.x-Math.floor(e.x);break;case yn:e.x=e.x<0?0:1;break;case sl: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 il:e.y=e.y-Math.floor(e.y);break;case yn:e.y=e.y<0?0:1;break;case sl: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 Ar("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===ze?Yi:sm}set encoding(e){Ar("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Yi?ze:ji}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=nm;ln.DEFAULT_ANISOTROPY=1;class yt{constructor(e=0,n=0,i=0,s=1){yt.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],u=c[4],f=c[8],h=c[1],d=c[5],_=c[9],g=c[2],m=c[6],p=c[10];if(Math.abs(u-h)<.01&&Math.abs(f-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+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=(u+h)/4,w=(f+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-_)+(f-g)*(f-g)+(h-u)*(h-u));return Math.abs(y)<.001&&(y=1),this.x=(m-_)/y,this.y=(f-g)/y,this.z=(h-u)/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 Zi extends ts{constructor(e=1,n=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new yt(0,0,e,n),this.scissorTest=!1,this.viewport=new yt(0,0,e,n);const s={width:e,height:n,depth:1};i.encoding!==void 0&&(Ar("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Yi?ze: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 lm(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 um 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 Cx 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 Ji{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],u=i[s+2],f=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]=u,e[n+3]=f;return}if(a===1){e[n+0]=h,e[n+1]=d,e[n+2]=_,e[n+3]=g;return}if(f!==g||c!==h||l!==d||u!==_){let m=1-a;const p=c*h+l*d+u*_+f*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,u=u*m+_*v,f=f*m+g*v,m===1-a){const M=1/Math.sqrt(c*c+l*l+u*u+f*f);c*=M,l*=M,u*=M,f*=M}}e[n]=c,e[n+1]=l,e[n+2]=u,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,s,r,o){const a=i[s],c=i[s+1],l=i[s+2],u=i[s+3],f=r[o],h=r[o+1],d=r[o+2],_=r[o+3];return e[n]=a*_+u*f+c*d-l*h,e[n+1]=c*_+u*h+l*f-a*d,e[n+2]=l*_+u*d+a*h-c*f,e[n+3]=u*_-a*f-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),u=a(s/2),f=a(r/2),h=c(i/2),d=c(s/2),_=c(r/2);switch(o){case"XYZ":this._x=h*u*f+l*d*_,this._y=l*d*f-h*u*_,this._z=l*u*_+h*d*f,this._w=l*u*f-h*d*_;break;case"YXZ":this._x=h*u*f+l*d*_,this._y=l*d*f-h*u*_,this._z=l*u*_-h*d*f,this._w=l*u*f+h*d*_;break;case"ZXY":this._x=h*u*f-l*d*_,this._y=l*d*f+h*u*_,this._z=l*u*_+h*d*f,this._w=l*u*f-h*d*_;break;case"ZYX":this._x=h*u*f-l*d*_,this._y=l*d*f+h*u*_,this._z=l*u*_-h*d*f,this._w=l*u*f+h*d*_;break;case"YZX":this._x=h*u*f+l*d*_,this._y=l*d*f+h*u*_,this._z=l*u*_-h*d*f,this._w=l*u*f-h*d*_;break;case"XZY":this._x=h*u*f-l*d*_,this._y=l*d*f-h*u*_,this._z=l*u*_+h*d*f,this._w=l*u*f+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],u=n[6],f=n[10],h=i+a+f;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-c)*d,this._y=(r-l)*d,this._z=(o-s)*d}else if(i>a&&i>f){const d=2*Math.sqrt(1+i-a-f);this._w=(u-c)/d,this._x=.25*d,this._y=(s+o)/d,this._z=(r+l)/d}else if(a>f){const d=2*Math.sqrt(1+a-i-f);this._w=(r-l)/d,this._x=(s+o)/d,this._y=.25*d,this._z=(c+u)/d}else{const d=2*Math.sqrt(1+f-i-a);this._w=(o-s)/d,this._x=(r+l)/d,this._y=(c+u)/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,u=n._w;return this._x=i*u+o*a+s*l-r*c,this._y=s*u+o*c+r*a-i*l,this._z=r*u+o*l+i*c-s*a,this._w=o*u-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),u=Math.atan2(l,a),f=Math.sin((1-n)*u)/l,h=Math.sin(n*u)/l;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=s*f+this._y*h,this._z=r*f+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 Y{constructor(e=0,n=0,i=0){Y.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(Sf.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Sf.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,u=c*i+a*n-r*s,f=c*s+r*i-o*n,h=-r*n-o*i-a*s;return this.x=l*c+h*-r+u*-a-f*-o,this.y=u*c+h*-o+f*-r-l*-a,this.z=f*c+h*-a+l*-o-u*-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 Ya.copy(this).projectOnVector(e),this.sub(Ya)}reflect(e){return this.sub(Ya.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 Ya=new Y,Sf=new Ji;class Vr{constructor(e=new Y(1/0,1/0,1/0),n=new Y(-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,Vn),Vn.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(nr),Jr.subVectors(this.max,nr),ls.subVectors(e.a,nr),us.subVectors(e.b,nr),fs.subVectors(e.c,nr),fi.subVectors(us,ls),hi.subVectors(fs,us),Di.subVectors(ls,fs);let n=[0,-fi.z,fi.y,0,-hi.z,hi.y,0,-Di.z,Di.y,fi.z,0,-fi.x,hi.z,0,-hi.x,Di.z,0,-Di.x,-fi.y,fi.x,0,-hi.y,hi.x,0,-Di.y,Di.x,0];return!ja(n,ls,us,fs,Jr)||(n=[1,0,0,0,1,0,0,0,1],!ja(n,ls,us,fs,Jr))?!1:(Qr.crossVectors(fi,hi),n=[Qr.x,Qr.y,Qr.z],ja(n,ls,us,fs,Jr))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Vn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Vn).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:(Hn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Hn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Hn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Hn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Hn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Hn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Hn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Hn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Hn),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 Hn=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Vn=new Y,cs=new Vr,ls=new Y,us=new Y,fs=new Y,fi=new Y,hi=new Y,Di=new Y,nr=new Y,Jr=new Y,Qr=new Y,Ui=new Y;function ja(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),u=i.dot(Ui);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const Lx=new Vr,ir=new Y,Ka=new Y;class zl{constructor(e=new Y,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):Lx.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;ir.subVectors(e,this.center);const n=ir.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(ir,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):(Ka.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ir.copy(e.center).add(Ka)),this.expandByPoint(ir.copy(e.center).sub(Ka))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Gn=new Y,Za=new Y,eo=new Y,di=new Y,Ja=new Y,to=new Y,Qa=new Y;class Dx{constructor(e=new Y,n=new Y(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){Za.copy(e).add(n).multiplyScalar(.5),eo.copy(n).sub(e).normalize(),di.copy(this.origin).sub(Za);const r=e.distanceTo(n)*.5,o=-this.direction.dot(eo),a=di.dot(this.direction),c=-di.dot(eo),l=di.lengthSq(),u=Math.abs(1-o*o);let f,h,d,_;if(u>0)if(f=o*c-a,h=o*a-c,_=r*u,f>=0)if(h>=-_)if(h<=_){const g=1/u;f*=g,h*=g,d=f*(f+o*h+2*a)+h*(o*f+h+2*c)+l}else h=r,f=Math.max(0,-(o*h+a)),d=-f*f+h*(h+2*c)+l;else h=-r,f=Math.max(0,-(o*h+a)),d=-f*f+h*(h+2*c)+l;else h<=-_?(f=Math.max(0,-(-o*r+a)),h=f>0?-r:Math.min(Math.max(-r,-c),r),d=-f*f+h*(h+2*c)+l):h<=_?(f=0,h=Math.min(Math.max(-r,-c),r),d=h*(h+2*c)+l):(f=Math.max(0,-(o*r+a)),h=f>0?r:Math.min(Math.max(-r,-c),r),d=-f*f+h*(h+2*c)+l);else h=o>0?-r:r,f=Math.max(0,-(o*h+a)),d=-f*f+h*(h+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,f),s&&s.copy(Za).addScaledVector(eo,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,u=1/this.direction.y,f=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),u>=0?(r=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-h.z)*f,c=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,c=(e.min.z-h.z)*f),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){Ja.subVectors(n,e),to.subVectors(i,e),Qa.crossVectors(Ja,to);let o=this.direction.dot(Qa),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(to.crossVectors(di,to));if(c<0)return null;const l=a*this.direction.dot(Ja.cross(di));if(l<0||c+l>o)return null;const u=-a*di.dot(Qa);return u<0?null:this.at(u/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 gt{constructor(){gt.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,u,f,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]=u,p[10]=f,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 gt().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/hs.setFromMatrixColumn(e,0).length(),r=1/hs.setFromMatrixColumn(e,1).length(),o=1/hs.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),u=Math.cos(r),f=Math.sin(r);if(e.order==="XYZ"){const h=o*u,d=o*f,_=a*u,g=a*f;n[0]=c*u,n[4]=-c*f,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*u,d=c*f,_=l*u,g=l*f;n[0]=h+g*a,n[4]=_*a-d,n[8]=o*l,n[1]=o*f,n[5]=o*u,n[9]=-a,n[2]=d*a-_,n[6]=g+h*a,n[10]=o*c}else if(e.order==="ZXY"){const h=c*u,d=c*f,_=l*u,g=l*f;n[0]=h-g*a,n[4]=-o*f,n[8]=_+d*a,n[1]=d+_*a,n[5]=o*u,n[9]=g-h*a,n[2]=-o*l,n[6]=a,n[10]=o*c}else if(e.order==="ZYX"){const h=o*u,d=o*f,_=a*u,g=a*f;n[0]=c*u,n[4]=_*l-d,n[8]=h*l+g,n[1]=c*f,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*u,n[4]=g-h*f,n[8]=_*f+d,n[1]=f,n[5]=o*u,n[9]=-a*u,n[2]=-l*u,n[6]=d*f+_,n[10]=h-g*f}else if(e.order==="XZY"){const h=o*c,d=o*l,_=a*c,g=a*l;n[0]=c*u,n[4]=-f,n[8]=l*u,n[1]=h*f+g,n[5]=o*u,n[9]=d*f-_,n[2]=_*f-d,n[6]=a*u,n[10]=g*f+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(Ux,e,Ix)}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(),no.crossVectors(Jt,pi),s[0]=pi.x,s[4]=no.x,s[8]=Jt.x,s[1]=pi.y,s[5]=no.y,s[9]=Jt.y,s[2]=pi.z,s[6]=no.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],u=i[1],f=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],z=s[9],U=s[13],O=s[2],H=s[6],G=s[10],k=s[14],W=s[3],ue=s[7],oe=s[11],Te=s[15];return r[0]=o*b+a*T+c*O+l*W,r[4]=o*w+a*I+c*H+l*ue,r[8]=o*D+a*z+c*G+l*oe,r[12]=o*x+a*U+c*k+l*Te,r[1]=u*b+f*T+h*O+d*W,r[5]=u*w+f*I+h*H+d*ue,r[9]=u*D+f*z+h*G+d*oe,r[13]=u*x+f*U+h*k+d*Te,r[2]=_*b+g*T+m*O+p*W,r[6]=_*w+g*I+m*H+p*ue,r[10]=_*D+g*z+m*G+p*oe,r[14]=_*x+g*U+m*k+p*Te,r[3]=y*b+E*T+v*O+M*W,r[7]=y*w+E*I+v*H+M*ue,r[11]=y*D+E*z+v*G+M*oe,r[15]=y*x+E*U+v*k+M*Te,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],u=e[2],f=e[6],h=e[10],d=e[14],_=e[3],g=e[7],m=e[11],p=e[15];return _*(+r*c*f-s*l*f-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*u-r*c*u)+m*(+n*l*f-n*a*d-r*o*f+i*o*d+r*a*u-i*l*u)+p*(-s*a*u-n*c*f+n*a*h+s*o*f-i*o*h+i*c*u)}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],u=e[8],f=e[9],h=e[10],d=e[11],_=e[12],g=e[13],m=e[14],p=e[15],y=f*m*l-g*h*l+g*c*d-a*m*d-f*c*p+a*h*p,E=_*h*l-u*m*l-_*c*d+o*m*d+u*c*p-o*h*p,v=u*g*l-_*f*l+_*a*d-o*g*d-u*a*p+o*f*p,M=_*f*c-u*g*c-_*a*h+o*g*h+u*a*m-o*f*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-f*m*r-g*s*d+i*m*d+f*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]=(f*c*r-a*h*r-f*s*l+i*h*l+a*s*d-i*c*d)*w,e[4]=E*w,e[5]=(u*m*r-_*h*r+_*s*d-n*m*d-u*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-u*c*r+u*s*l-n*h*l-o*s*d+n*c*d)*w,e[8]=v*w,e[9]=(_*f*r-u*g*r-_*i*d+n*g*d+u*i*p-n*f*p)*w,e[10]=(o*g*r-_*a*r+_*i*l-n*g*l-o*i*p+n*a*p)*w,e[11]=(u*a*r-o*f*r-u*i*l+n*f*l+o*i*d-n*a*d)*w,e[12]=M*w,e[13]=(u*g*s-_*f*s+_*i*h-n*g*h-u*i*m+n*f*m)*w,e[14]=(_*a*s-o*g*s-_*i*c+n*g*c+o*i*m-n*a*m)*w,e[15]=(o*f*s-u*a*s+u*i*c-n*f*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,u=r*a;return this.set(l*o+i,l*a-s*c,l*c+s*a,0,l*a+s*c,u*a+i,u*c-s*o,0,l*c-s*a,u*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,u=o+o,f=a+a,h=r*l,d=r*u,_=r*f,g=o*u,m=o*f,p=a*f,y=c*l,E=c*u,v=c*f,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=hs.set(s[0],s[1],s[2]).length();const o=hs.set(s[4],s[5],s[6]).length(),a=hs.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,u=1/o,f=1/a;return vn.elements[0]*=l,vn.elements[1]*=l,vn.elements[2]*=l,vn.elements[4]*=u,vn.elements[5]*=u,vn.elements[6]*=u,vn.elements[8]*=f,vn.elements[9]*=f,vn.elements[10]*=f,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),u=(n+e)/(n-e),f=(i+s)/(i-s),h=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=c,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=l,a[9]=f,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),u=1/(o-r),f=(n+e)*c,h=(i+s)*l,d=(o+r)*u;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-f,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*u,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 hs=new Y,vn=new gt,Ux=new Y(0,0,0),Ix=new Y(1,1,1),pi=new Y,no=new Y,Jt=new Y,yf=new gt,bf=new Ji;class ca{constructor(e=0,n=0,i=0,s=ca.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],u=s[9],f=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(-u,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-kt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,r),this._z=0);break;case"ZXY":this._x=Math.asin(kt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-kt(f,-1,1)),Math.abs(f)<.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(-u,l),this._y=Math.atan2(-f,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(-u,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 yf.makeRotationFromQuaternion(e),this.setFromRotationMatrix(yf,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return bf.setFromEuler(this),this.setFromQuaternion(bf,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}}ca.DEFAULT_ORDER="XYZ";class fm{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(sr,e,Fx),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sr,Ox,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,u=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),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),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 u=a[l];delete u.metadata,c.push(u)}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),ec.subVectors(e,n);const o=xn.dot(xn),a=xn.dot(kn),c=xn.dot(ec),l=kn.dot(kn),u=kn.dot(ec),f=o*l-a*a;if(f===0)return r.set(-2,-1,-1);const h=1/f,d=(l*c-a*u)*h,_=(o*u-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 so===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),so=!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 so===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),so=!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;ps.subVectors(s,i),ms.subVectors(r,i),tc.subVectors(e,i);const c=ps.dot(tc),l=ms.dot(tc);if(c<=0&&l<=0)return n.copy(i);nc.subVectors(e,s);const u=ps.dot(nc),f=ms.dot(nc);if(u>=0&&f<=u)return n.copy(s);const h=c*f-u*l;if(h<=0&&c>=0&&u<=0)return o=c/(c-u),n.copy(i).addScaledVector(ps,o);ic.subVectors(e,r);const d=ps.dot(ic),_=ms.dot(ic);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(ms,a);const m=u*_-d*f;if(m<=0&&f-u>=0&&d-_>=0)return Cf.subVectors(r,s),a=(f-u)/(f-u+(d-_)),n.copy(s).addScaledVector(Cf,a);const p=1/(m+g+h);return o=g*p,a=h*p,n.copy(i).addScaledVector(ps,o).addScaledVector(ms,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let zx=0;class Gr extends ts{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zx++}),this.uuid=Hr(),this.name="",this.type="Material",this.blending=Ns,this.side=bi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Qp,this.blendDst=em,this.blendEquation=Ps,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=el,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Mx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ga,this.stencilZFail=Ga,this.stencilZPass=Ga,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!==Ns&&(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 hm={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},ro={h:0,s:0,l:0};function sc(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=ze){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=Ex(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=sc(o,r,e+1/3),this.g=sc(o,r,e),this.b=sc(o,r,e-1/3)}return _n.toWorkingColorSpace(this,s),this}setStyle(e,n=ze){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=ze){const i=hm[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=Os(e.r),this.g=Os(e.g),this.b=Os(e.b),this}copyLinearToSRGB(e){return this.r=Xa(e.r),this.g=Xa(e.g),this.b=Xa(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ze){return _n.fromWorkingColorSpace(Ct.copy(this),e),Math.round(kt(Ct.r*255,0,255))*65536+Math.round(kt(Ct.g*255,0,255))*256+Math.round(kt(Ct.b*255,0,255))}getHexString(e=ze){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=_n.workingColorSpace){_n.fromWorkingColorSpace(Ct.copy(this),n);const i=Ct.r,s=Ct.g,r=Ct.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let c,l;const u=(a+o)/2;if(a===o)c=0,l=0;else{const f=o-a;switch(l=u<=.5?f/(o+a):f/(2-o-a),o){case i:c=(s-r)/f+(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],u=[];for(let f=0,h=l.length;f0&&(s[c]=u,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 u=s[l];this.setAttribute(l,u.clone(n))}const r=e.morphAttributes;for(const l in r){const u=[],f=r[l];for(let h=0,d=f.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))&&(Lf.copy(r).invert(),Rn.copy(e.ray).applyMatrix4(Lf),!(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,u=s.attributes.normal,f=s.groups,h=s.drawRange;if(o!==null)if(Array.isArray(r))for(let d=0,_=f.length;d<_;d++){const g=f[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:po.clone(),object:t}}function mo(t,e,n,i,s,r,o,a,c,l){t.getVertexPosition(a,_s),t.getVertexPosition(c,vs),t.getVertexPosition(l,xs);const u=Vx(t,e,n,i,_s,vs,xs,ho);if(u){s&&(lo.fromBufferAttribute(s,a),uo.fromBufferAttribute(s,c),fo.fromBufferAttribute(s,l),u.uv=Sn.getInterpolation(ho,_s,vs,xs,lo,uo,fo,new Ge)),r&&(lo.fromBufferAttribute(r,a),uo.fromBufferAttribute(r,c),fo.fromBufferAttribute(r,l),u.uv1=Sn.getInterpolation(ho,_s,vs,xs,lo,uo,fo,new Ge),u.uv2=u.uv1),o&&(Uf.fromBufferAttribute(o,a),If.fromBufferAttribute(o,c),Nf.fromBufferAttribute(o,l),u.normal=Sn.getInterpolation(ho,_s,vs,xs,Uf,If,Nf,new Y),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:c,c:l,normal:new Y,materialIndex:0};Sn.getNormal(_s,vs,xs,f.normal),u.face=f}return u}class $r 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=[],u=[],f=[];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(u,3)),this.setAttribute("uv",new oi(f,2));function _(g,m,p,y,E,v,M,b,w,D,x){const T=v/w,I=M/D,z=v/2,U=M/2,O=b/2,H=w+1,G=D+1;let k=0,W=0;const ue=new Y;for(let oe=0;oe0?1:-1,u.push(ue.x,ue.y,ue.z),f.push(fe/w),f.push(1-oe/D),k+=1}}for(let oe=0;oe>8&255]+Ct[t>>16&255]+Ct[t>>24&255]+"-"+Ct[e&255]+Ct[e>>8&255]+"-"+Ct[e>>16&15|64]+Ct[e>>24&255]+"-"+Ct[n&63|128]+Ct[n>>8&255]+"-"+Ct[n>>16&255]+Ct[n>>24&255]+Ct[i&255]+Ct[i>>8&255]+Ct[i>>16&255]+Ct[i>>24&255]).toLowerCase()}function kt(t,e,n){return Math.max(e,Math.min(n,t))}function yx(t,e){return(t%e+e)%e}function Xa(t,e,n){return(1-n)*t+n*e}function Mf(t){return(t&t-1)===0&&t!==0}function bx(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Qr(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 Zt(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.")}}class Ge{constructor(e=0,n=0){Ge.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 Ye{constructor(){Ye.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 u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=n,u[4]=r,u[5]=c,u[6]=i,u[7]=o,u[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],u=i[4],f=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+u*y+f*M,r[4]=l*m+u*E+f*b,r[7]=l*p+u*v+f*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],u=e[8];return n*o*u-n*a*l-i*r*u+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],u=e[8],f=u*o-a*l,h=a*c-u*r,d=l*r-o*c,_=n*f+i*h+s*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=f*g,e[1]=(s*l-u*i)*g,e[2]=(a*i-s*o)*g,e[3]=h*g,e[4]=(u*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 Ye;function am(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function jo(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const Ef={};function Ar(t){t in Ef||(Ef[t]=!0,console.warn(t))}function Os(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 Tx=new Ye().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),wx=new Ye().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function Ax(t){return t.convertSRGBToLinear().applyMatrix3(wx)}function Rx(t){return t.applyMatrix3(Tx).convertLinearToSRGB()}const Px={[Bn]:t=>t,[ze]:t=>t.convertSRGBToLinear(),[om]:Ax},Cx={[Bn]:t=>t,[ze]:t=>t.convertLinearToSRGB(),[om]:Rx},_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=Px[e],s=Cx[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 as;class cm{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{as===void 0&&(as=jo("canvas")),as.width=e.width,as.height=e.height;const i=as.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=as}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=jo("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!==nm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case rl:e.x=e.x-Math.floor(e.x);break;case yn:e.x=e.x<0?0:1;break;case ol: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 rl:e.y=e.y-Math.floor(e.y);break;case yn:e.y=e.y<0?0:1;break;case ol: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 Ar("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===ze?Yi:sm}set encoding(e){Ar("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Yi?ze:ji}}ln.DEFAULT_IMAGE=null;ln.DEFAULT_MAPPING=nm;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],u=c[4],f=c[8],h=c[1],d=c[5],_=c[9],g=c[2],m=c[6],p=c[10];if(Math.abs(u-h)<.01&&Math.abs(f-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+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=(u+h)/4,w=(f+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-_)+(f-g)*(f-g)+(h-u)*(h-u));return Math.abs(y)<.001&&(y=1),this.x=(m-_)/y,this.y=(f-g)/y,this.z=(h-u)/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 Zi extends ts{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&&(Ar("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Yi?ze: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 lm(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 um 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 Dx 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 Ji{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],u=i[s+2],f=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]=u,e[n+3]=f;return}if(a===1){e[n+0]=h,e[n+1]=d,e[n+2]=_,e[n+3]=g;return}if(f!==g||c!==h||l!==d||u!==_){let m=1-a;const p=c*h+l*d+u*_+f*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,u=u*m+_*v,f=f*m+g*v,m===1-a){const M=1/Math.sqrt(c*c+l*l+u*u+f*f);c*=M,l*=M,u*=M,f*=M}}e[n]=c,e[n+1]=l,e[n+2]=u,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,s,r,o){const a=i[s],c=i[s+1],l=i[s+2],u=i[s+3],f=r[o],h=r[o+1],d=r[o+2],_=r[o+3];return e[n]=a*_+u*f+c*d-l*h,e[n+1]=c*_+u*h+l*f-a*d,e[n+2]=l*_+u*d+a*h-c*f,e[n+3]=u*_-a*f-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),u=a(s/2),f=a(r/2),h=c(i/2),d=c(s/2),_=c(r/2);switch(o){case"XYZ":this._x=h*u*f+l*d*_,this._y=l*d*f-h*u*_,this._z=l*u*_+h*d*f,this._w=l*u*f-h*d*_;break;case"YXZ":this._x=h*u*f+l*d*_,this._y=l*d*f-h*u*_,this._z=l*u*_-h*d*f,this._w=l*u*f+h*d*_;break;case"ZXY":this._x=h*u*f-l*d*_,this._y=l*d*f+h*u*_,this._z=l*u*_+h*d*f,this._w=l*u*f-h*d*_;break;case"ZYX":this._x=h*u*f-l*d*_,this._y=l*d*f+h*u*_,this._z=l*u*_-h*d*f,this._w=l*u*f+h*d*_;break;case"YZX":this._x=h*u*f+l*d*_,this._y=l*d*f+h*u*_,this._z=l*u*_-h*d*f,this._w=l*u*f-h*d*_;break;case"XZY":this._x=h*u*f-l*d*_,this._y=l*d*f-h*u*_,this._z=l*u*_+h*d*f,this._w=l*u*f+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],u=n[6],f=n[10],h=i+a+f;if(h>0){const d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-c)*d,this._y=(r-l)*d,this._z=(o-s)*d}else if(i>a&&i>f){const d=2*Math.sqrt(1+i-a-f);this._w=(u-c)/d,this._x=.25*d,this._y=(s+o)/d,this._z=(r+l)/d}else if(a>f){const d=2*Math.sqrt(1+a-i-f);this._w=(r-l)/d,this._x=(s+o)/d,this._y=.25*d,this._z=(c+u)/d}else{const d=2*Math.sqrt(1+f-i-a);this._w=(o-s)/d,this._x=(r+l)/d,this._y=(c+u)/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,u=n._w;return this._x=i*u+o*a+s*l-r*c,this._y=s*u+o*c+r*a-i*l,this._z=r*u+o*l+i*c-s*a,this._w=o*u-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),u=Math.atan2(l,a),f=Math.sin((1-n)*u)/l,h=Math.sin(n*u)/l;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=s*f+this._y*h,this._z=r*f+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 Y{constructor(e=0,n=0,i=0){Y.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(Sf.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Sf.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,u=c*i+a*n-r*s,f=c*s+r*i-o*n,h=-r*n-o*i-a*s;return this.x=l*c+h*-r+u*-a-f*-o,this.y=u*c+h*-o+f*-r-l*-a,this.z=f*c+h*-a+l*-o-u*-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 Ka.copy(this).projectOnVector(e),this.sub(Ka)}reflect(e){return this.sub(Ka.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 Ka=new Y,Sf=new Ji;class Vr{constructor(e=new Y(1/0,1/0,1/0),n=new Y(-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,Vn),Vn.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(nr),eo.subVectors(this.max,nr),ls.subVectors(e.a,nr),us.subVectors(e.b,nr),fs.subVectors(e.c,nr),fi.subVectors(us,ls),hi.subVectors(fs,us),Di.subVectors(ls,fs);let n=[0,-fi.z,fi.y,0,-hi.z,hi.y,0,-Di.z,Di.y,fi.z,0,-fi.x,hi.z,0,-hi.x,Di.z,0,-Di.x,-fi.y,fi.x,0,-hi.y,hi.x,0,-Di.y,Di.x,0];return!Za(n,ls,us,fs,eo)||(n=[1,0,0,0,1,0,0,0,1],!Za(n,ls,us,fs,eo))?!1:(to.crossVectors(fi,hi),n=[to.x,to.y,to.z],Za(n,ls,us,fs,eo))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Vn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Vn).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:(Hn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Hn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Hn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Hn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Hn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Hn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Hn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Hn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Hn),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 Hn=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Vn=new Y,cs=new Vr,ls=new Y,us=new Y,fs=new Y,fi=new Y,hi=new Y,Di=new Y,nr=new Y,eo=new Y,to=new Y,Ui=new Y;function Za(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),u=i.dot(Ui);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const Ux=new Vr,ir=new Y,Ja=new Y;class Vl{constructor(e=new Y,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):Ux.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;ir.subVectors(e,this.center);const n=ir.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(ir,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(ir.copy(e.center).add(Ja)),this.expandByPoint(ir.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 Y,Qa=new Y,no=new Y,di=new Y,ec=new Y,io=new Y,tc=new Y;class Ix{constructor(e=new Y,n=new Y(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),no.copy(n).sub(e).normalize(),di.copy(this.origin).sub(Qa);const r=e.distanceTo(n)*.5,o=-this.direction.dot(no),a=di.dot(this.direction),c=-di.dot(no),l=di.lengthSq(),u=Math.abs(1-o*o);let f,h,d,_;if(u>0)if(f=o*c-a,h=o*a-c,_=r*u,f>=0)if(h>=-_)if(h<=_){const g=1/u;f*=g,h*=g,d=f*(f+o*h+2*a)+h*(o*f+h+2*c)+l}else h=r,f=Math.max(0,-(o*h+a)),d=-f*f+h*(h+2*c)+l;else h=-r,f=Math.max(0,-(o*h+a)),d=-f*f+h*(h+2*c)+l;else h<=-_?(f=Math.max(0,-(-o*r+a)),h=f>0?-r:Math.min(Math.max(-r,-c),r),d=-f*f+h*(h+2*c)+l):h<=_?(f=0,h=Math.min(Math.max(-r,-c),r),d=h*(h+2*c)+l):(f=Math.max(0,-(o*r+a)),h=f>0?r:Math.min(Math.max(-r,-c),r),d=-f*f+h*(h+2*c)+l);else h=o>0?-r:r,f=Math.max(0,-(o*h+a)),d=-f*f+h*(h+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,f),s&&s.copy(Qa).addScaledVector(no,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,u=1/this.direction.y,f=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),u>=0?(r=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-h.z)*f,c=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,c=(e.min.z-h.z)*f),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),io.subVectors(i,e),tc.crossVectors(ec,io);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(io.crossVectors(di,io));if(c<0)return null;const l=a*this.direction.dot(ec.cross(di));if(l<0||c+l>o)return null;const u=-a*di.dot(tc);return u<0?null:this.at(u/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,u,f,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]=u,p[10]=f,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/hs.setFromMatrixColumn(e,0).length(),r=1/hs.setFromMatrixColumn(e,1).length(),o=1/hs.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),u=Math.cos(r),f=Math.sin(r);if(e.order==="XYZ"){const h=o*u,d=o*f,_=a*u,g=a*f;n[0]=c*u,n[4]=-c*f,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*u,d=c*f,_=l*u,g=l*f;n[0]=h+g*a,n[4]=_*a-d,n[8]=o*l,n[1]=o*f,n[5]=o*u,n[9]=-a,n[2]=d*a-_,n[6]=g+h*a,n[10]=o*c}else if(e.order==="ZXY"){const h=c*u,d=c*f,_=l*u,g=l*f;n[0]=h-g*a,n[4]=-o*f,n[8]=_+d*a,n[1]=d+_*a,n[5]=o*u,n[9]=g-h*a,n[2]=-o*l,n[6]=a,n[10]=o*c}else if(e.order==="ZYX"){const h=o*u,d=o*f,_=a*u,g=a*f;n[0]=c*u,n[4]=_*l-d,n[8]=h*l+g,n[1]=c*f,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*u,n[4]=g-h*f,n[8]=_*f+d,n[1]=f,n[5]=o*u,n[9]=-a*u,n[2]=-l*u,n[6]=d*f+_,n[10]=h-g*f}else if(e.order==="XZY"){const h=o*c,d=o*l,_=a*c,g=a*l;n[0]=c*u,n[4]=-f,n[8]=l*u,n[1]=h*f+g,n[5]=o*u,n[9]=d*f-_,n[2]=_*f-d,n[6]=a*u,n[10]=g*f+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(Nx,e,Fx)}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(),so.crossVectors(Jt,pi),s[0]=pi.x,s[4]=so.x,s[8]=Jt.x,s[1]=pi.y,s[5]=so.y,s[9]=Jt.y,s[2]=pi.z,s[6]=so.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],u=i[1],f=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],z=s[9],U=s[13],O=s[2],H=s[6],G=s[10],k=s[14],W=s[3],ue=s[7],oe=s[11],Te=s[15];return r[0]=o*b+a*T+c*O+l*W,r[4]=o*w+a*I+c*H+l*ue,r[8]=o*D+a*z+c*G+l*oe,r[12]=o*x+a*U+c*k+l*Te,r[1]=u*b+f*T+h*O+d*W,r[5]=u*w+f*I+h*H+d*ue,r[9]=u*D+f*z+h*G+d*oe,r[13]=u*x+f*U+h*k+d*Te,r[2]=_*b+g*T+m*O+p*W,r[6]=_*w+g*I+m*H+p*ue,r[10]=_*D+g*z+m*G+p*oe,r[14]=_*x+g*U+m*k+p*Te,r[3]=y*b+E*T+v*O+M*W,r[7]=y*w+E*I+v*H+M*ue,r[11]=y*D+E*z+v*G+M*oe,r[15]=y*x+E*U+v*k+M*Te,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],u=e[2],f=e[6],h=e[10],d=e[14],_=e[3],g=e[7],m=e[11],p=e[15];return _*(+r*c*f-s*l*f-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*u-r*c*u)+m*(+n*l*f-n*a*d-r*o*f+i*o*d+r*a*u-i*l*u)+p*(-s*a*u-n*c*f+n*a*h+s*o*f-i*o*h+i*c*u)}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],u=e[8],f=e[9],h=e[10],d=e[11],_=e[12],g=e[13],m=e[14],p=e[15],y=f*m*l-g*h*l+g*c*d-a*m*d-f*c*p+a*h*p,E=_*h*l-u*m*l-_*c*d+o*m*d+u*c*p-o*h*p,v=u*g*l-_*f*l+_*a*d-o*g*d-u*a*p+o*f*p,M=_*f*c-u*g*c-_*a*h+o*g*h+u*a*m-o*f*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-f*m*r-g*s*d+i*m*d+f*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]=(f*c*r-a*h*r-f*s*l+i*h*l+a*s*d-i*c*d)*w,e[4]=E*w,e[5]=(u*m*r-_*h*r+_*s*d-n*m*d-u*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-u*c*r+u*s*l-n*h*l-o*s*d+n*c*d)*w,e[8]=v*w,e[9]=(_*f*r-u*g*r-_*i*d+n*g*d+u*i*p-n*f*p)*w,e[10]=(o*g*r-_*a*r+_*i*l-n*g*l-o*i*p+n*a*p)*w,e[11]=(u*a*r-o*f*r-u*i*l+n*f*l+o*i*d-n*a*d)*w,e[12]=M*w,e[13]=(u*g*s-_*f*s+_*i*h-n*g*h-u*i*m+n*f*m)*w,e[14]=(_*a*s-o*g*s-_*i*c+n*g*c+o*i*m-n*a*m)*w,e[15]=(o*f*s-u*a*s+u*i*c-n*f*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,u=r*a;return this.set(l*o+i,l*a-s*c,l*c+s*a,0,l*a+s*c,u*a+i,u*c-s*o,0,l*c-s*a,u*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,u=o+o,f=a+a,h=r*l,d=r*u,_=r*f,g=o*u,m=o*f,p=a*f,y=c*l,E=c*u,v=c*f,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=hs.set(s[0],s[1],s[2]).length();const o=hs.set(s[4],s[5],s[6]).length(),a=hs.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,u=1/o,f=1/a;return vn.elements[0]*=l,vn.elements[1]*=l,vn.elements[2]*=l,vn.elements[4]*=u,vn.elements[5]*=u,vn.elements[6]*=u,vn.elements[8]*=f,vn.elements[9]*=f,vn.elements[10]*=f,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),u=(n+e)/(n-e),f=(i+s)/(i-s),h=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=c,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=l,a[9]=f,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),u=1/(o-r),f=(n+e)*c,h=(i+s)*l,d=(o+r)*u;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-f,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*u,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 hs=new Y,vn=new _t,Nx=new Y(0,0,0),Fx=new Y(1,1,1),pi=new Y,so=new Y,Jt=new Y,yf=new _t,bf=new Ji;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],u=s[9],f=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(-u,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-kt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,r),this._z=0);break;case"ZXY":this._x=Math.asin(kt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-kt(f,-1,1)),Math.abs(f)<.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(-u,l),this._y=Math.atan2(-f,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(-u,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 yf.makeRotationFromQuaternion(e),this.setFromRotationMatrix(yf,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return bf.setFromEuler(this),this.setFromQuaternion(bf,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 fm{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(sr,e,Bx),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sr,zx,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,u=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),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),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 u=a[l];delete u.metadata,c.push(u)}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),u=kn.dot(nc),f=o*l-a*a;if(f===0)return r.set(-2,-1,-1);const h=1/f,d=(l*c-a*u)*h,_=(o*u-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 oo===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),oo=!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 oo===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),oo=!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;ps.subVectors(s,i),ms.subVectors(r,i),ic.subVectors(e,i);const c=ps.dot(ic),l=ms.dot(ic);if(c<=0&&l<=0)return n.copy(i);sc.subVectors(e,s);const u=ps.dot(sc),f=ms.dot(sc);if(u>=0&&f<=u)return n.copy(s);const h=c*f-u*l;if(h<=0&&c>=0&&u<=0)return o=c/(c-u),n.copy(i).addScaledVector(ps,o);rc.subVectors(e,r);const d=ps.dot(rc),_=ms.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(ms,a);const m=u*_-d*f;if(m<=0&&f-u>=0&&d-_>=0)return Cf.subVectors(r,s),a=(f-u)/(f-u+(d-_)),n.copy(s).addScaledVector(Cf,a);const p=1/(m+g+h);return o=g*p,a=h*p,n.copy(i).addScaledVector(ps,o).addScaledVector(ms,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Vx=0;class Gr extends ts{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Vx++}),this.uuid=Hr(),this.name="",this.type="Material",this.blending=Ns,this.side=bi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Qp,this.blendDst=em,this.blendEquation=Ps,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=nl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Sx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ka,this.stencilZFail=ka,this.stencilZPass=ka,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!==Ns&&(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 hm={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},ao={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=ze){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=yx(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=ze){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=ze){const i=hm[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=Os(e.r),this.g=Os(e.g),this.b=Os(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=ze){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=ze){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 u=(a+o)/2;if(a===o)c=0,l=0;else{const f=o-a;switch(l=u<=.5?f/(o+a):f/(2-o-a),o){case i:c=(s-r)/f+(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],u=[];for(let f=0,h=l.length;f0&&(s[c]=u,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 u=s[l];this.setAttribute(l,u.clone(n))}const r=e.morphAttributes;for(const l in r){const u=[],f=r[l];for(let h=0,d=f.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))&&(Lf.copy(r).invert(),Rn.copy(e.ray).applyMatrix4(Lf),!(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,u=s.attributes.normal,f=s.groups,h=s.drawRange;if(o!==null)if(Array.isArray(r))for(let d=0,_=f.length;d<_;d++){const g=f[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:go.clone(),object:t}}function _o(t,e,n,i,s,r,o,a,c,l){t.getVertexPosition(a,_s),t.getVertexPosition(c,vs),t.getVertexPosition(l,xs);const u=$x(t,e,n,i,_s,vs,xs,mo);if(u){s&&(fo.fromBufferAttribute(s,a),ho.fromBufferAttribute(s,c),po.fromBufferAttribute(s,l),u.uv=Sn.getInterpolation(mo,_s,vs,xs,fo,ho,po,new Ge)),r&&(fo.fromBufferAttribute(r,a),ho.fromBufferAttribute(r,c),po.fromBufferAttribute(r,l),u.uv1=Sn.getInterpolation(mo,_s,vs,xs,fo,ho,po,new Ge),u.uv2=u.uv1),o&&(Uf.fromBufferAttribute(o,a),If.fromBufferAttribute(o,c),Nf.fromBufferAttribute(o,l),u.normal=Sn.getInterpolation(mo,_s,vs,xs,Uf,If,Nf,new Y),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:c,c:l,normal:new Y,materialIndex:0};Sn.getNormal(_s,vs,xs,f.normal),u.face=f}return u}class $r 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=[],u=[],f=[];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(u,3)),this.setAttribute("uv",new oi(f,2));function _(g,m,p,y,E,v,M,b,w,D,x){const T=v/w,I=M/D,z=v/2,U=M/2,O=b/2,H=w+1,G=D+1;let k=0,W=0;const ue=new Y;for(let oe=0;oe0?1:-1,u.push(ue.x,ue.y,ue.z),f.push(fe/w),f.push(1-oe/D),k+=1}}for(let oe=0;oe0&&(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 _m extends It{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new gt,this.projectionMatrix=new gt,this.projectionMatrixInverse=new gt}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 _m{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=ol*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan($a*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ol*2*Math.atan(Math.tan($a*.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($a*.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 Ms=-90,Es=1;class Xx extends It{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i;const s=new pn(Ms,Es,e,n);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(1,0,0),this.add(s);const r=new pn(Ms,Es,e,n);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);const o=new pn(Ms,Es,e,n);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new pn(Ms,Es,e,n);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const c=new pn(Ms,Es,e,n);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,1),this.add(c);const l=new pn(Ms,Es,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,u=e.getRenderTarget(),f=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(u),e.toneMapping=f,e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class vm extends ln{constructor(e,n,i,s,r,o,a,c,l,u){e=e!==void 0?e:[],n=n!==void 0?n:Hs,super(e,n,i,s,r,o,a,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class qx extends Zi{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&&(Ar("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Yi?ze:ji),this.texture=new vm(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 Qi extends Gr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Xx,this.fragmentShader=qx,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=$s(e.uniforms),this.uniformsGroups=kx(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 _m 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 _m{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=cl*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Wa*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return cl*2*Math.atan(Math.tan(Wa*.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(Wa*.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 Ms=-90,Es=1;class Yx extends It{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i;const s=new pn(Ms,Es,e,n);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(1,0,0),this.add(s);const r=new pn(Ms,Es,e,n);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);const o=new pn(Ms,Es,e,n);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new pn(Ms,Es,e,n);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const c=new pn(Ms,Es,e,n);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,1),this.add(c);const l=new pn(Ms,Es,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,u=e.getRenderTarget(),f=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(u),e.toneMapping=f,e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class vm extends ln{constructor(e,n,i,s,r,o,a,c,l,u){e=e!==void 0?e:[],n=n!==void 0?n:Hs,super(e,n,i,s,r,o,a,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class jx extends Zi{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&&(Ar("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Yi?ze:ji),this.texture=new vm(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:` varying vec3 vWorldDirection; @@ -57,28 +57,28 @@ gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},s=new $r(5,5,5),r=new Qi({name:"CubemapFromEquirect",uniforms:$s(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:jt,blending:yi});r.uniforms.tEquirect.value=n;const o=new ii(s,r),a=n.minFilter;return n.minFilter===Ir&&(n.minFilter=dn),new Xx(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 ac=new Y,Yx=new Y,jx=new Ye;class Bi{constructor(e=new Y(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=ac.subVectors(i,n).cross(Yx.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(ac),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||jx.getNormalMatrix(e),s=this.coplanarPoint(ac).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 zl,go=new Y;class Hl{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],u=i[6],f=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,f-c,g-h,E-m).normalize(),n[1].setComponents(a+s,f+c,g+h,E+m).normalize(),n[2].setComponents(a+r,f+l,g+d,E+p).normalize(),n[3].setComponents(a-r,f-l,g-d,E-p).normalize(),n[4].setComponents(a-o,f-u,g-_,E-y).normalize(),n[5].setComponents(a+o,f+u,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,go.y=s.normal.y>0?e.max.y:e.min.y,go.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(go)<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 xm(){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 Kx(t,e){const n=e.isWebGL2,i=new WeakMap;function s(l,u){const f=l.array,h=l.usage,d=t.createBuffer();t.bindBuffer(u,d),t.bufferData(u,f,h),l.onUploadCallback();let _;if(f instanceof Float32Array)_=t.FLOAT;else if(f 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(f instanceof Int16Array)_=t.SHORT;else if(f instanceof Uint32Array)_=t.UNSIGNED_INT;else if(f instanceof Int32Array)_=t.INT;else if(f instanceof Int8Array)_=t.BYTE;else if(f instanceof Uint8Array)_=t.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)_=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:d,type:_,bytesPerElement:f.BYTES_PER_ELEMENT,version:l.version}}function r(l,u,f){const h=u.array,d=u.updateRange;t.bindBuffer(f,l),d.count===-1?t.bufferSubData(f,0,h):(n?t.bufferSubData(f,d.offset*h.BYTES_PER_ELEMENT,h,d.offset,d.count):t.bufferSubData(f,d.offset*h.BYTES_PER_ELEMENT,h.subarray(d.offset,d.offset+d.count)),d.count=-1),u.onUploadCallback()}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=i.get(l);u&&(t.deleteBuffer(u.buffer),i.delete(l))}function c(l,u){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||Zx.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 Vl,vo=new Y;class Gl{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],u=i[6],f=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,f-c,g-h,E-m).normalize(),n[1].setComponents(a+s,f+c,g+h,E+m).normalize(),n[2].setComponents(a+r,f+l,g+d,E+p).normalize(),n[3].setComponents(a-r,f-l,g-d,E-p).normalize(),n[4].setComponents(a-o,f-u,g-_,E-y).normalize(),n[5].setComponents(a+o,f+u,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,vo.y=s.normal.y>0?e.max.y:e.min.y,vo.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(vo)<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 xm(){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 Jx(t,e){const n=e.isWebGL2,i=new WeakMap;function s(l,u){const f=l.array,h=l.usage,d=t.createBuffer();t.bindBuffer(u,d),t.bufferData(u,f,h),l.onUploadCallback();let _;if(f instanceof Float32Array)_=t.FLOAT;else if(f 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(f instanceof Int16Array)_=t.SHORT;else if(f instanceof Uint32Array)_=t.UNSIGNED_INT;else if(f instanceof Int32Array)_=t.INT;else if(f instanceof Int8Array)_=t.BYTE;else if(f instanceof Uint8Array)_=t.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)_=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:d,type:_,bytesPerElement:f.BYTES_PER_ELEMENT,version:l.version}}function r(l,u,f){const h=u.array,d=u.updateRange;t.bindBuffer(f,l),d.count===-1?t.bufferSubData(f,0,h):(n?t.bufferSubData(f,d.offset*h.BYTES_PER_ELEMENT,h,d.offset,d.count):t.bufferSubData(f,d.offset*h.BYTES_PER_ELEMENT,h.subarray(d.offset,d.offset+d.count)),d.count=-1),u.onUploadCallback()}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=i.get(l);u&&(t.deleteBuffer(u.buffer),i.delete(l))}function c(l,u){if(l.isGLBufferAttribute){const h=i.get(l);(!h||h.version 0 +#endif`,u1=`#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`,l1=`#if NUM_CLIPPING_PLANES > 0 +#endif`,f1=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,u1=`#if NUM_CLIPPING_PLANES > 0 +#endif`,h1=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,f1=`#if NUM_CLIPPING_PLANES > 0 +#endif`,d1=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,h1=`#if defined( USE_COLOR_ALPHA ) +#endif`,p1=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,d1=`#if defined( USE_COLOR_ALPHA ) +#endif`,m1=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,p1=`#if defined( USE_COLOR_ALPHA ) +#endif`,g1=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,m1=`#if defined( USE_COLOR_ALPHA ) +#endif`,_1=`#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`,g1=`#define PI 3.141592653589793 +#endif`,v1=`#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`,_1=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,x1=`#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`,v1=`vec3 transformedNormal = objectNormal; +#endif`,M1=`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`,x1=`#ifdef USE_DISPLACEMENTMAP +#endif`,E1=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,M1=`#ifdef USE_DISPLACEMENTMAP +#endif`,S1=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,E1=`#ifdef USE_EMISSIVEMAP +#endif`,y1=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,S1=`#ifdef USE_EMISSIVEMAP +#endif`,b1=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,y1="gl_FragColor = linearToOutputTexel( gl_FragColor );",b1=`vec4 LinearToLinear( in vec4 value ) { +#endif`,T1="gl_FragColor = linearToOutputTexel( gl_FragColor );",w1=`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 ); -}`,T1=`#ifdef USE_ENVMAP +}`,A1=`#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`,w1=`#ifdef USE_ENVMAP +#endif`,R1=`#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`,A1=`#ifdef USE_ENVMAP +#endif`,P1=`#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`,R1=`#ifdef USE_ENVMAP +#endif`,C1=`#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`,P1=`#ifdef USE_ENVMAP +#endif`,L1=`#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`,C1=`#ifdef USE_FOG +#endif`,D1=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,L1=`#ifdef USE_FOG +#endif`,U1=`#ifdef USE_FOG varying float vFogDepth; -#endif`,D1=`#ifdef USE_FOG +#endif`,I1=`#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`,U1=`#ifdef USE_FOG +#endif`,N1=`#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`,I1=`#ifdef USE_GRADIENTMAP +#endif`,F1=`#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 -}`,N1=`#ifdef USE_LIGHTMAP +}`,O1=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,F1=`#ifdef USE_LIGHTMAP +#endif`,B1=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,O1=`LambertMaterial material; +#endif`,z1=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,B1=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,H1=`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`,z1=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,V1=`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`,H1=`#if defined( USE_ENVMAP ) +#endif`,G1=`#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`,V1=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,G1=`varying vec3 vViewPosition; +#endif`,$1=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,k1=`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`,$1=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,W1=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,k1=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,X1=`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`,W1=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,q1=`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`,X1=`struct PhysicalMaterial { +#endif`,Y1=`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 ); -}`,q1=` +}`,j1=` 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`,Y1=`#if defined( RE_IndirectDiffuse ) +#endif`,K1=`#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`,j1=`#if defined( RE_IndirectDiffuse ) +#endif`,Z1=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`,K1=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,J1=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Z1=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,Q1=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,J1=`#ifdef USE_LOGDEPTHBUF +#endif`,eM=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,Q1=`#ifdef USE_LOGDEPTHBUF +#endif`,tM=`#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`,eM=`#ifdef USE_MAP +#endif`,nM=`#ifdef USE_MAP diffuseColor *= texture2D( map, vMapUv ); -#endif`,tM=`#ifdef USE_MAP +#endif`,iM=`#ifdef USE_MAP uniform sampler2D map; -#endif`,nM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,sM=`#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`,iM=`#if defined( USE_POINTS_UV ) +#endif`,rM=`#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`,sM=`float metalnessFactor = metalness; +#endif`,oM=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,rM=`#ifdef USE_METALNESSMAP +#endif`,aM=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,oM=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,cM=`#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`,aM=`#ifdef USE_MORPHNORMALS +#endif`,lM=`#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`,cM=`#ifdef USE_MORPHTARGETS +#endif`,uM=`#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`,lM=`#ifdef USE_MORPHTARGETS +#endif`,fM=`#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`,uM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,hM=`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;`,fM=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 geometryNormal = normal;`,dM=`#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;`,fM=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,hM=`#ifndef FLAT_SHADED +#endif`,pM=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,dM=`#ifndef FLAT_SHADED +#endif`,mM=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,pM=`#ifndef FLAT_SHADED +#endif`,gM=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,mM=`#ifdef USE_NORMALMAP +#endif`,_M=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1411,13 +1411,13 @@ vec3 geometryNormal = normal;`,fM=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,gM=`#ifdef USE_CLEARCOAT +#endif`,vM=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; -#endif`,_M=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,xM=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,vM=`#ifdef USE_CLEARCOATMAP +#endif`,MM=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1426,18 +1426,18 @@ vec3 geometryNormal = normal;`,fM=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,xM=`#ifdef USE_IRIDESCENCEMAP +#endif`,EM=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,MM=`#ifdef OPAQUE +#endif`,SM=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha + 0.1; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,EM=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,yM=`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 ); -}`,SM=`#ifdef PREMULTIPLIED_ALPHA +}`,bM=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,yM=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,TM=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,bM=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,wM=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,TM=`#ifdef DITHERING +#endif`,AM=`#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`,wM=`float roughnessFactor = roughness; +#endif`,RM=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,AM=`#ifdef USE_ROUGHNESSMAP +#endif`,PM=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,RM=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,CM=`#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;`,bM=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,PM=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,LM=`#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;`,bM=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,CM=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,DM=`#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;`,bM=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,LM=`float getShadowMask() { +#endif`,UM=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -1779,12 +1779,12 @@ gl_Position = projectionMatrix * mvPosition;`,bM=`#ifdef DITHERING #endif #endif return shadow; -}`,DM=`#ifdef USE_SKINNING +}`,IM=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,UM=`#ifdef USE_SKINNING +#endif`,NM=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -1803,7 +1803,7 @@ gl_Position = projectionMatrix * mvPosition;`,bM=`#ifdef DITHERING mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } -#endif`,IM=`#ifdef USE_SKINNING +#endif`,FM=`#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;`,bM=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,NM=`#ifdef USE_SKINNING +#endif`,OM=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -1822,17 +1822,17 @@ gl_Position = projectionMatrix * mvPosition;`,bM=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,FM=`float specularStrength; +#endif`,BM=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,OM=`#ifdef USE_SPECULARMAP +#endif`,zM=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,BM=`#if defined( TONE_MAPPING ) +#endif`,HM=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,zM=`#ifndef saturate +#endif`,VM=`#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; }`,HM=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,GM=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -1889,7 +1889,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,HM=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); -#endif`,VM=`#ifdef USE_TRANSMISSION +#endif`,$M=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -1993,7 +1993,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,HM=`#ifdef USE_TRANSMISS vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } -#endif`,GM=`#ifdef USE_UV +#endif`,kM=`#ifdef USE_UV varying vec2 vUv; #endif #ifdef USE_MAP @@ -2060,7 +2060,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,HM=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,$M=`#ifdef USE_UV +#endif`,WM=`#ifdef USE_UV varying vec2 vUv; #endif #ifdef USE_MAP @@ -2150,7 +2150,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,HM=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,kM=`#ifdef USE_UV +#endif`,XM=`#ifdef USE_UV vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2218,18 +2218,18 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,HM=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,WM=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,qM=`#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 XM=`varying vec2 vUv; +#endif`;const YM=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,qM=`uniform sampler2D t2D; +}`,jM=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2238,14 +2238,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,YM=`varying vec3 vWorldDirection; +}`,KM=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,jM=`#ifdef ENVMAP_TYPE_CUBE +}`,ZM=`#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 -}`,KM=`varying vec3 vWorldDirection; +}`,JM=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,ZM=`uniform samplerCube tCube; +}`,QM=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2284,7 +2284,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,JM=`#include +}`,eE=`#include #include #include #include @@ -2308,7 +2308,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,QM=`#if DEPTH_PACKING == 3200 +}`,tE=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2336,7 +2336,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,eE=`#define DISTANCE +}`,nE=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2360,7 +2360,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,tE=`#define DISTANCE +}`,iE=`#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 ); -}`,nE=`varying vec3 vWorldDirection; +}`,sE=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,iE=`uniform sampler2D tEquirect; +}`,rE=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2397,7 +2397,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,sE=`uniform float scale; +}`,oE=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2418,7 +2418,7 @@ void main() { #include #include #include -}`,rE=`uniform vec3 diffuse; +}`,aE=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2446,7 +2446,7 @@ void main() { #include #include #include -}`,oE=`#include +}`,cE=`#include #include #include #include @@ -2475,7 +2475,7 @@ void main() { #include #include #include -}`,aE=`uniform vec3 diffuse; +}`,lE=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2521,7 +2521,7 @@ void main() { #include #include #include -}`,cE=`#define LAMBERT +}`,uE=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2557,7 +2557,7 @@ void main() { #include #include #include -}`,lE=`#define LAMBERT +}`,fE=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -2612,7 +2612,7 @@ void main() { #include #include #include -}`,uE=`#define MATCAP +}`,hE=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -2643,7 +2643,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,fE=`#define MATCAP +}`,dE=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -2687,7 +2687,7 @@ void main() { #include #include #include -}`,hE=`#define NORMAL +}`,pE=`#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 -}`,dE=`#define NORMAL +}`,mE=`#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 +}`,gE=`#define PHONG varying vec3 vViewPosition; #include #include @@ -2774,7 +2774,7 @@ void main() { #include #include #include -}`,mE=`#define PHONG +}`,_E=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -2831,7 +2831,7 @@ void main() { #include #include #include -}`,gE=`#define STANDARD +}`,vE=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -2871,7 +2871,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,_E=`#define STANDARD +}`,xE=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -2985,7 +2985,7 @@ void main() { #include #include #include -}`,vE=`#define TOON +}`,ME=`#define TOON varying vec3 vViewPosition; #include #include @@ -3019,7 +3019,7 @@ void main() { #include #include #include -}`,xE=`#define TOON +}`,EE=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3070,7 +3070,7 @@ void main() { #include #include #include -}`,ME=`uniform float size; +}`,SE=`uniform float size; uniform float scale; #include #include @@ -3100,7 +3100,7 @@ void main() { #include #include #include -}`,EE=`uniform vec3 diffuse; +}`,yE=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3123,7 +3123,7 @@ void main() { #include #include #include -}`,SE=`#include +}`,bE=`#include #include #include #include @@ -3143,7 +3143,7 @@ void main() { #include #include #include -}`,yE=`uniform vec3 color; +}`,TE=`uniform vec3 color; uniform float opacity; #include #include @@ -3159,7 +3159,7 @@ void main() { #include #include #include -}`,bE=`uniform float rotation; +}`,wE=`uniform float rotation; uniform vec2 center; #include #include @@ -3185,7 +3185,7 @@ void main() { #include #include #include -}`,TE=`uniform vec3 diffuse; +}`,AE=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3208,7 +3208,7 @@ void main() { #include #include #include -}`,Ve={alphamap_fragment:Zx,alphamap_pars_fragment:Jx,alphatest_fragment:Qx,alphatest_pars_fragment:e1,aomap_fragment:t1,aomap_pars_fragment:n1,begin_vertex:i1,beginnormal_vertex:s1,bsdfs:r1,iridescence_fragment:o1,bumpmap_pars_fragment:a1,clipping_planes_fragment:c1,clipping_planes_pars_fragment:l1,clipping_planes_pars_vertex:u1,clipping_planes_vertex:f1,color_fragment:h1,color_pars_fragment:d1,color_pars_vertex:p1,color_vertex:m1,common:g1,cube_uv_reflection_fragment:_1,defaultnormal_vertex:v1,displacementmap_pars_vertex:x1,displacementmap_vertex:M1,emissivemap_fragment:E1,emissivemap_pars_fragment:S1,encodings_fragment:y1,encodings_pars_fragment:b1,envmap_fragment:T1,envmap_common_pars_fragment:w1,envmap_pars_fragment:A1,envmap_pars_vertex:R1,envmap_physical_pars_fragment:H1,envmap_vertex:P1,fog_vertex:C1,fog_pars_vertex:L1,fog_fragment:D1,fog_pars_fragment:U1,gradientmap_pars_fragment:I1,lightmap_fragment:N1,lightmap_pars_fragment:F1,lights_lambert_fragment:O1,lights_lambert_pars_fragment:B1,lights_pars_begin:z1,lights_toon_fragment:V1,lights_toon_pars_fragment:G1,lights_phong_fragment:$1,lights_phong_pars_fragment:k1,lights_physical_fragment:W1,lights_physical_pars_fragment:X1,lights_fragment_begin:q1,lights_fragment_maps:Y1,lights_fragment_end:j1,logdepthbuf_fragment:K1,logdepthbuf_pars_fragment:Z1,logdepthbuf_pars_vertex:J1,logdepthbuf_vertex:Q1,map_fragment:eM,map_pars_fragment:tM,map_particle_fragment:nM,map_particle_pars_fragment:iM,metalnessmap_fragment:sM,metalnessmap_pars_fragment:rM,morphcolor_vertex:oM,morphnormal_vertex:aM,morphtarget_pars_vertex:cM,morphtarget_vertex:lM,normal_fragment_begin:uM,normal_fragment_maps:fM,normal_pars_fragment:hM,normal_pars_vertex:dM,normal_vertex:pM,normalmap_pars_fragment:mM,clearcoat_normal_fragment_begin:gM,clearcoat_normal_fragment_maps:_M,clearcoat_pars_fragment:vM,iridescence_pars_fragment:xM,output_fragment:MM,packing:EM,premultiplied_alpha_fragment:SM,project_vertex:yM,dithering_fragment:bM,dithering_pars_fragment:TM,roughnessmap_fragment:wM,roughnessmap_pars_fragment:AM,shadowmap_pars_fragment:RM,shadowmap_pars_vertex:PM,shadowmap_vertex:CM,shadowmask_pars_fragment:LM,skinbase_vertex:DM,skinning_pars_vertex:UM,skinning_vertex:IM,skinnormal_vertex:NM,specularmap_fragment:FM,specularmap_pars_fragment:OM,tonemapping_fragment:BM,tonemapping_pars_fragment:zM,transmission_fragment:HM,transmission_pars_fragment:VM,uv_pars_fragment:GM,uv_pars_vertex:$M,uv_vertex:kM,worldpos_vertex:WM,background_vert:XM,background_frag:qM,backgroundCube_vert:YM,backgroundCube_frag:jM,cube_vert:KM,cube_frag:ZM,depth_vert:JM,depth_frag:QM,distanceRGBA_vert:eE,distanceRGBA_frag:tE,equirect_vert:nE,equirect_frag:iE,linedashed_vert:sE,linedashed_frag:rE,meshbasic_vert:oE,meshbasic_frag:aE,meshlambert_vert:cE,meshlambert_frag:lE,meshmatcap_vert:uE,meshmatcap_frag:fE,meshnormal_vert:hE,meshnormal_frag:dE,meshphong_vert:pE,meshphong_frag:mE,meshphysical_vert:gE,meshphysical_frag:_E,meshtoon_vert:vE,meshtoon_frag:xE,points_vert:ME,points_frag:EE,shadow_vert:SE,shadow_frag:yE,sprite_vert:bE,sprite_frag:TE},Me={common:{diffuse:{value:new it(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ye}},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 Ye}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ye}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ye},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ye},normalScale:{value:new Ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ye},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ye}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ye}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ye}},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 Ye}},sprite:{diffuse:{value:new it(16777215)},opacity:{value:1},center:{value:new Ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaTest:{value:0}}},Un={basic:{uniforms:Ht([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.fog]),vertexShader:Ve.meshbasic_vert,fragmentShader:Ve.meshbasic_frag},lambert:{uniforms:Ht([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,Me.lights,{emissive:{value:new it(0)}}]),vertexShader:Ve.meshlambert_vert,fragmentShader:Ve.meshlambert_frag},phong:{uniforms:Ht([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,Me.lights,{emissive:{value:new it(0)},specular:{value:new it(1118481)},shininess:{value:30}}]),vertexShader:Ve.meshphong_vert,fragmentShader:Ve.meshphong_frag},standard:{uniforms:Ht([Me.common,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.roughnessmap,Me.metalnessmap,Me.fog,Me.lights,{emissive:{value:new it(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag},toon:{uniforms:Ht([Me.common,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.gradientmap,Me.fog,Me.lights,{emissive:{value:new it(0)}}]),vertexShader:Ve.meshtoon_vert,fragmentShader:Ve.meshtoon_frag},matcap:{uniforms:Ht([Me.common,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,{matcap:{value:null}}]),vertexShader:Ve.meshmatcap_vert,fragmentShader:Ve.meshmatcap_frag},points:{uniforms:Ht([Me.points,Me.fog]),vertexShader:Ve.points_vert,fragmentShader:Ve.points_frag},dashed:{uniforms:Ht([Me.common,Me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ve.linedashed_vert,fragmentShader:Ve.linedashed_frag},depth:{uniforms:Ht([Me.common,Me.displacementmap]),vertexShader:Ve.depth_vert,fragmentShader:Ve.depth_frag},normal:{uniforms:Ht([Me.common,Me.bumpmap,Me.normalmap,Me.displacementmap,{opacity:{value:1}}]),vertexShader:Ve.meshnormal_vert,fragmentShader:Ve.meshnormal_frag},sprite:{uniforms:Ht([Me.sprite,Me.fog]),vertexShader:Ve.sprite_vert,fragmentShader:Ve.sprite_frag},background:{uniforms:{uvTransform:{value:new Ye},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:Ht([Me.common,Me.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ve.distanceRGBA_vert,fragmentShader:Ve.distanceRGBA_frag},shadow:{uniforms:Ht([Me.lights,Me.fog,{color:{value:new it(0)},opacity:{value:1}}]),vertexShader:Ve.shadow_vert,fragmentShader:Ve.shadow_frag}};Un.physical={uniforms:Ht([Un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ye},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ye},clearcoatNormalScale:{value:new Ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ye},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ye},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ye},sheen:{value:0},sheenColor:{value:new it(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ye},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ye},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ye},transmissionSamplerSize:{value:new Ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ye},attenuationDistance:{value:0},attenuationColor:{value:new it(0)},specularColor:{value:new it(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ye},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ye}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag};const _o={r:0,b:0,g:0};function wE(t,e,n,i,s,r,o){const a=new it(0);let c=r===!0?0:1,l,u,f=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===aa)?(u===void 0&&(u=new ii(new $r(1,1,1),new Qi({name:"BackgroundCubeMaterial",uniforms:$s(Un.backgroundCube.uniforms),vertexShader:Un.backgroundCube.vertexShader,fragmentShader:Un.backgroundCube.fragmentShader,side:jt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,w,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),u.material.uniforms.envMap.value=E,u.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,u.material.toneMapped=E.colorSpace!==ze,(f!==E||h!==E.version||d!==t.toneMapping)&&(u.material.needsUpdate=!0,f=E,h=E.version,d=t.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):E&&E.isTexture&&(l===void 0&&(l=new ii(new Vl(2,2),new Qi({name:"BackgroundMaterial",uniforms:$s(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!==ze,E.matrixAutoUpdate===!0&&E.updateMatrix(),l.material.uniforms.uvTransform.value.copy(E.matrix),(f!==E||h!==E.version||d!==t.toneMapping)&&(l.material.needsUpdate=!0,f=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(_o,gm(t)),i.buffers.color.setClear(_o.r,_o.g,_o.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 AE(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,u=!1;function f(O,H,G,k,W){let ue=!1;if(o){const oe=g(k,G,H);l!==oe&&(l=oe,d(l.object)),ue=p(O,k,G,W),ue&&y(O,k,G,W)}else{const oe=H.wireframe===!0;(l.geometry!==k.id||l.program!==G.id||l.wireframe!==oe)&&(l.geometry=k.id,l.program=G.id,l.wireframe=oe,ue=!0)}W!==null&&n.update(W,t.ELEMENT_ARRAY_BUFFER),(ue||u)&&(u=!1,D(O,H,G,k),W!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(W).buffer))}function h(){return i.isWebGL2?t.createVertexArray():r.createVertexArrayOES()}function d(O){return i.isWebGL2?t.bindVertexArray(O):r.bindVertexArrayOES(O)}function _(O){return i.isWebGL2?t.deleteVertexArray(O):r.deleteVertexArrayOES(O)}function g(O,H,G){const k=G.wireframe===!0;let W=a[O.id];W===void 0&&(W={},a[O.id]=W);let ue=W[H.id];ue===void 0&&(ue={},W[H.id]=ue);let oe=ue[k];return oe===void 0&&(oe=m(h()),ue[k]=oe),oe}function m(O){const H=[],G=[],k=[];for(let W=0;W=0){const ce=W[fe];let _e=ue[fe];if(_e===void 0&&(fe==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),fe==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),ce===void 0||ce.attribute!==_e||_e&&ce.data!==_e.data)return!0;oe++}return l.attributesNum!==oe||l.index!==k}function y(O,H,G,k){const W={},ue=H.attributes;let oe=0;const Te=G.getAttributes();for(const fe in Te)if(Te[fe].location>=0){let ce=ue[fe];ce===void 0&&(fe==="instanceMatrix"&&O.instanceMatrix&&(ce=O.instanceMatrix),fe==="instanceColor"&&O.instanceColor&&(ce=O.instanceColor));const _e={};_e.attribute=ce,ce&&ce.data&&(_e.data=ce.data),W[fe]=_e,oe++}l.attributes=W,l.attributesNum=oe,l.index=k}function E(){const O=l.newAttributes;for(let H=0,G=O.length;H=0){let K=W[Te];if(K===void 0&&(Te==="instanceMatrix"&&O.instanceMatrix&&(K=O.instanceMatrix),Te==="instanceColor"&&O.instanceColor&&(K=O.instanceColor)),K!==void 0){const ce=K.normalized,_e=K.itemSize,xe=n.get(K);if(xe===void 0)continue;const N=xe.buffer,Ie=xe.type,De=xe.bytesPerElement;if(K.isInterleavedBufferAttribute){const me=K.data,Le=me.stride,P=K.offset;if(me.isInstancedInterleavedBuffer){for(let C=0;C0&&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"),u=n.logarithmicDepthBuffer===!0,f=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:u,maxTextures:f,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:m,maxVaryings:p,maxFragmentUniforms:y,vertexTextures:E,floatFragmentTextures:v,floatVertexTextures:M,maxSamples:b}}function CE(t){const e=this;let n=null,i=0,s=!1,r=!1;const o=new Bi,a=new Ye,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const d=f.length!==0||h||i!==0||s;return s=h,i=f.length,d},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(f,h){n=u(f,h,0)},this.setState=function(f,h,d){const _=f.clippingPlanes,g=f.clipIntersection,m=f.clipShadows,p=t.get(f);if(!s||_===null||_.length===0||r&&!m)r?u(null):l();else{const y=r?0:i,E=y*4;let v=p.clippingState||null;c.value=v,v=u(_,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 u(f,h,d,_){const g=f!==null?f.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 qx(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 Mm extends _m{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,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,o=r+l*this.view.width,a-=u*this.view.offsetY,c=a-u*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 Cs=4,Ff=[.125,.215,.35,.446,.526,.582],Hi=20,cc=new Mm,Of=new it;let lc=null;const zi=(1+Math.sqrt(5))/2,Ss=1/zi,Bf=[new Y(1,1,1),new Y(-1,1,1),new Y(1,1,-1),new Y(-1,1,-1),new Y(0,zi,Ss),new Y(0,zi,-Ss),new Y(Ss,0,zi),new Y(-Ss,0,zi),new Y(zi,Ss,0),new Y(-zi,Ss,0)];class zf{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){lc=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=Gf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Vf(),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),u.setRenderTarget(s),g&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===Hs||e.mapping===Vs;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Gf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Vf());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;vo(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(o,cc)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;for(let s=1;sHi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Hi}`);const p=[];let y=0;for(let w=0;wE-Cs?s-E+Cs:0),b=4*(this._cubeSize-v);vo(n,M,b,3*v,2*v),c.setRenderTarget(n),c.render(f,cc)}}function DE(t){const e=[],n=[],i=[];let s=t;const r=t-Cs+1+Ff.length;for(let o=0;ot-Cs?c=Ff[o-t+Cs-1]:o===0&&(c=0),i.push(c);const l=1/(a-2),u=-l,f=1+l,h=[u,u,f,u,f,f,u,u,f,f,u,f],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 un(y,g)),M.setAttribute("uv",new un(E,m)),M.setAttribute("faceIndex",new un(v,p)),e.push(M),s>Cs&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function Hf(t,e,n){const i=new Zi(t,e,n);return i.texture.mapping=aa,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function vo(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function UE(t,e,n){const i=new Float32Array(Hi),s=new Y(0,1,0);return new Qi({name:"SphericalGaussianBlur",defines:{n:Hi,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:Gl(),fragmentShader:` +}`,Ve={alphamap_fragment:Qx,alphamap_pars_fragment:e1,alphatest_fragment:t1,alphatest_pars_fragment:n1,aomap_fragment:i1,aomap_pars_fragment:s1,begin_vertex:r1,beginnormal_vertex:o1,bsdfs:a1,iridescence_fragment:c1,bumpmap_pars_fragment:l1,clipping_planes_fragment:u1,clipping_planes_pars_fragment:f1,clipping_planes_pars_vertex:h1,clipping_planes_vertex:d1,color_fragment:p1,color_pars_fragment:m1,color_pars_vertex:g1,color_vertex:_1,common:v1,cube_uv_reflection_fragment:x1,defaultnormal_vertex:M1,displacementmap_pars_vertex:E1,displacementmap_vertex:S1,emissivemap_fragment:y1,emissivemap_pars_fragment:b1,encodings_fragment:T1,encodings_pars_fragment:w1,envmap_fragment:A1,envmap_common_pars_fragment:R1,envmap_pars_fragment:P1,envmap_pars_vertex:C1,envmap_physical_pars_fragment:G1,envmap_vertex:L1,fog_vertex:D1,fog_pars_vertex:U1,fog_fragment:I1,fog_pars_fragment:N1,gradientmap_pars_fragment:F1,lightmap_fragment:O1,lightmap_pars_fragment:B1,lights_lambert_fragment:z1,lights_lambert_pars_fragment:H1,lights_pars_begin:V1,lights_toon_fragment:$1,lights_toon_pars_fragment:k1,lights_phong_fragment:W1,lights_phong_pars_fragment:X1,lights_physical_fragment:q1,lights_physical_pars_fragment:Y1,lights_fragment_begin:j1,lights_fragment_maps:K1,lights_fragment_end:Z1,logdepthbuf_fragment:J1,logdepthbuf_pars_fragment:Q1,logdepthbuf_pars_vertex:eM,logdepthbuf_vertex:tM,map_fragment:nM,map_pars_fragment:iM,map_particle_fragment:sM,map_particle_pars_fragment:rM,metalnessmap_fragment:oM,metalnessmap_pars_fragment:aM,morphcolor_vertex:cM,morphnormal_vertex:lM,morphtarget_pars_vertex:uM,morphtarget_vertex:fM,normal_fragment_begin:hM,normal_fragment_maps:dM,normal_pars_fragment:pM,normal_pars_vertex:mM,normal_vertex:gM,normalmap_pars_fragment:_M,clearcoat_normal_fragment_begin:vM,clearcoat_normal_fragment_maps:xM,clearcoat_pars_fragment:MM,iridescence_pars_fragment:EM,output_fragment:SM,packing:yM,premultiplied_alpha_fragment:bM,project_vertex:TM,dithering_fragment:wM,dithering_pars_fragment:AM,roughnessmap_fragment:RM,roughnessmap_pars_fragment:PM,shadowmap_pars_fragment:CM,shadowmap_pars_vertex:LM,shadowmap_vertex:DM,shadowmask_pars_fragment:UM,skinbase_vertex:IM,skinning_pars_vertex:NM,skinning_vertex:FM,skinnormal_vertex:OM,specularmap_fragment:BM,specularmap_pars_fragment:zM,tonemapping_fragment:HM,tonemapping_pars_fragment:VM,transmission_fragment:GM,transmission_pars_fragment:$M,uv_pars_fragment:kM,uv_pars_vertex:WM,uv_vertex:XM,worldpos_vertex:qM,background_vert:YM,background_frag:jM,backgroundCube_vert:KM,backgroundCube_frag:ZM,cube_vert:JM,cube_frag:QM,depth_vert:eE,depth_frag:tE,distanceRGBA_vert:nE,distanceRGBA_frag:iE,equirect_vert:sE,equirect_frag:rE,linedashed_vert:oE,linedashed_frag:aE,meshbasic_vert:cE,meshbasic_frag:lE,meshlambert_vert:uE,meshlambert_frag:fE,meshmatcap_vert:hE,meshmatcap_frag:dE,meshnormal_vert:pE,meshnormal_frag:mE,meshphong_vert:gE,meshphong_frag:_E,meshphysical_vert:vE,meshphysical_frag:xE,meshtoon_vert:ME,meshtoon_frag:EE,points_vert:SE,points_frag:yE,shadow_vert:bE,shadow_frag:TE,sprite_vert:wE,sprite_frag:AE},Me={common:{diffuse:{value:new it(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaMapTransform:{value:new Ye},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ye}},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 Ye}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ye}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ye},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ye},normalScale:{value:new Ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ye},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ye}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ye}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ye}},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 Ye}},sprite:{diffuse:{value:new it(16777215)},opacity:{value:1},center:{value:new Ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ye},alphaMap:{value:null},alphaTest:{value:0}}},Un={basic:{uniforms:Ht([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.fog]),vertexShader:Ve.meshbasic_vert,fragmentShader:Ve.meshbasic_frag},lambert:{uniforms:Ht([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,Me.lights,{emissive:{value:new it(0)}}]),vertexShader:Ve.meshlambert_vert,fragmentShader:Ve.meshlambert_frag},phong:{uniforms:Ht([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,Me.lights,{emissive:{value:new it(0)},specular:{value:new it(1118481)},shininess:{value:30}}]),vertexShader:Ve.meshphong_vert,fragmentShader:Ve.meshphong_frag},standard:{uniforms:Ht([Me.common,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.roughnessmap,Me.metalnessmap,Me.fog,Me.lights,{emissive:{value:new it(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag},toon:{uniforms:Ht([Me.common,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.gradientmap,Me.fog,Me.lights,{emissive:{value:new it(0)}}]),vertexShader:Ve.meshtoon_vert,fragmentShader:Ve.meshtoon_frag},matcap:{uniforms:Ht([Me.common,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,{matcap:{value:null}}]),vertexShader:Ve.meshmatcap_vert,fragmentShader:Ve.meshmatcap_frag},points:{uniforms:Ht([Me.points,Me.fog]),vertexShader:Ve.points_vert,fragmentShader:Ve.points_frag},dashed:{uniforms:Ht([Me.common,Me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ve.linedashed_vert,fragmentShader:Ve.linedashed_frag},depth:{uniforms:Ht([Me.common,Me.displacementmap]),vertexShader:Ve.depth_vert,fragmentShader:Ve.depth_frag},normal:{uniforms:Ht([Me.common,Me.bumpmap,Me.normalmap,Me.displacementmap,{opacity:{value:1}}]),vertexShader:Ve.meshnormal_vert,fragmentShader:Ve.meshnormal_frag},sprite:{uniforms:Ht([Me.sprite,Me.fog]),vertexShader:Ve.sprite_vert,fragmentShader:Ve.sprite_frag},background:{uniforms:{uvTransform:{value:new Ye},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:Ht([Me.common,Me.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ve.distanceRGBA_vert,fragmentShader:Ve.distanceRGBA_frag},shadow:{uniforms:Ht([Me.lights,Me.fog,{color:{value:new it(0)},opacity:{value:1}}]),vertexShader:Ve.shadow_vert,fragmentShader:Ve.shadow_frag}};Un.physical={uniforms:Ht([Un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ye},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ye},clearcoatNormalScale:{value:new Ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ye},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ye},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ye},sheen:{value:0},sheenColor:{value:new it(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ye},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ye},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ye},transmissionSamplerSize:{value:new Ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ye},attenuationDistance:{value:0},attenuationColor:{value:new it(0)},specularColor:{value:new it(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ye},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ye}}]),vertexShader:Ve.meshphysical_vert,fragmentShader:Ve.meshphysical_frag};const xo={r:0,b:0,g:0};function RE(t,e,n,i,s,r,o){const a=new it(0);let c=r===!0?0:1,l,u,f=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===la)?(u===void 0&&(u=new ii(new $r(1,1,1),new Qi({name:"BackgroundCubeMaterial",uniforms:$s(Un.backgroundCube.uniforms),vertexShader:Un.backgroundCube.vertexShader,fragmentShader:Un.backgroundCube.fragmentShader,side:jt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,w,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),u.material.uniforms.envMap.value=E,u.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,u.material.toneMapped=E.colorSpace!==ze,(f!==E||h!==E.version||d!==t.toneMapping)&&(u.material.needsUpdate=!0,f=E,h=E.version,d=t.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):E&&E.isTexture&&(l===void 0&&(l=new ii(new $l(2,2),new Qi({name:"BackgroundMaterial",uniforms:$s(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!==ze,E.matrixAutoUpdate===!0&&E.updateMatrix(),l.material.uniforms.uvTransform.value.copy(E.matrix),(f!==E||h!==E.version||d!==t.toneMapping)&&(l.material.needsUpdate=!0,f=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(xo,gm(t)),i.buffers.color.setClear(xo.r,xo.g,xo.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 PE(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,u=!1;function f(O,H,G,k,W){let ue=!1;if(o){const oe=g(k,G,H);l!==oe&&(l=oe,d(l.object)),ue=p(O,k,G,W),ue&&y(O,k,G,W)}else{const oe=H.wireframe===!0;(l.geometry!==k.id||l.program!==G.id||l.wireframe!==oe)&&(l.geometry=k.id,l.program=G.id,l.wireframe=oe,ue=!0)}W!==null&&n.update(W,t.ELEMENT_ARRAY_BUFFER),(ue||u)&&(u=!1,D(O,H,G,k),W!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(W).buffer))}function h(){return i.isWebGL2?t.createVertexArray():r.createVertexArrayOES()}function d(O){return i.isWebGL2?t.bindVertexArray(O):r.bindVertexArrayOES(O)}function _(O){return i.isWebGL2?t.deleteVertexArray(O):r.deleteVertexArrayOES(O)}function g(O,H,G){const k=G.wireframe===!0;let W=a[O.id];W===void 0&&(W={},a[O.id]=W);let ue=W[H.id];ue===void 0&&(ue={},W[H.id]=ue);let oe=ue[k];return oe===void 0&&(oe=m(h()),ue[k]=oe),oe}function m(O){const H=[],G=[],k=[];for(let W=0;W=0){const ce=W[fe];let _e=ue[fe];if(_e===void 0&&(fe==="instanceMatrix"&&O.instanceMatrix&&(_e=O.instanceMatrix),fe==="instanceColor"&&O.instanceColor&&(_e=O.instanceColor)),ce===void 0||ce.attribute!==_e||_e&&ce.data!==_e.data)return!0;oe++}return l.attributesNum!==oe||l.index!==k}function y(O,H,G,k){const W={},ue=H.attributes;let oe=0;const Te=G.getAttributes();for(const fe in Te)if(Te[fe].location>=0){let ce=ue[fe];ce===void 0&&(fe==="instanceMatrix"&&O.instanceMatrix&&(ce=O.instanceMatrix),fe==="instanceColor"&&O.instanceColor&&(ce=O.instanceColor));const _e={};_e.attribute=ce,ce&&ce.data&&(_e.data=ce.data),W[fe]=_e,oe++}l.attributes=W,l.attributesNum=oe,l.index=k}function E(){const O=l.newAttributes;for(let H=0,G=O.length;H=0){let K=W[Te];if(K===void 0&&(Te==="instanceMatrix"&&O.instanceMatrix&&(K=O.instanceMatrix),Te==="instanceColor"&&O.instanceColor&&(K=O.instanceColor)),K!==void 0){const ce=K.normalized,_e=K.itemSize,xe=n.get(K);if(xe===void 0)continue;const N=xe.buffer,Ie=xe.type,De=xe.bytesPerElement;if(K.isInterleavedBufferAttribute){const me=K.data,Le=me.stride,P=K.offset;if(me.isInstancedInterleavedBuffer){for(let C=0;C0&&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"),u=n.logarithmicDepthBuffer===!0,f=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:u,maxTextures:f,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:m,maxVaryings:p,maxFragmentUniforms:y,vertexTextures:E,floatFragmentTextures:v,floatVertexTextures:M,maxSamples:b}}function DE(t){const e=this;let n=null,i=0,s=!1,r=!1;const o=new Bi,a=new Ye,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const d=f.length!==0||h||i!==0||s;return s=h,i=f.length,d},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(f,h){n=u(f,h,0)},this.setState=function(f,h,d){const _=f.clippingPlanes,g=f.clipIntersection,m=f.clipShadows,p=t.get(f);if(!s||_===null||_.length===0||r&&!m)r?u(null):l();else{const y=r?0:i,E=y*4;let v=p.clippingState||null;c.value=v,v=u(_,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 u(f,h,d,_){const g=f!==null?f.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 jx(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 Mm extends _m{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,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,o=r+l*this.view.width,a-=u*this.view.offsetY,c=a-u*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 Cs=4,Ff=[.125,.215,.35,.446,.526,.582],Hi=20,uc=new Mm,Of=new it;let fc=null;const zi=(1+Math.sqrt(5))/2,Ss=1/zi,Bf=[new Y(1,1,1),new Y(-1,1,1),new Y(1,1,-1),new Y(-1,1,-1),new Y(0,zi,Ss),new Y(0,zi,-Ss),new Y(Ss,0,zi),new Y(-Ss,0,zi),new Y(zi,Ss,0),new Y(-zi,Ss,0)];class zf{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){fc=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=Gf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Vf(),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),u.setRenderTarget(s),g&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===Hs||e.mapping===Vs;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Gf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Vf());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;Mo(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;sHi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Hi}`);const p=[];let y=0;for(let w=0;wE-Cs?s-E+Cs:0),b=4*(this._cubeSize-v);Mo(n,M,b,3*v,2*v),c.setRenderTarget(n),c.render(f,uc)}}function IE(t){const e=[],n=[],i=[];let s=t;const r=t-Cs+1+Ff.length;for(let o=0;ot-Cs?c=Ff[o-t+Cs-1]:o===0&&(c=0),i.push(c);const l=1/(a-2),u=-l,f=1+l,h=[u,u,f,u,f,f,u,u,f,f,u,f],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 un(y,g)),M.setAttribute("uv",new un(E,m)),M.setAttribute("faceIndex",new un(v,p)),e.push(M),s>Cs&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function Hf(t,e,n){const i=new Zi(t,e,n);return i.texture.mapping=la,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Mo(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function NE(t,e,n){const i=new Float32Array(Hi),s=new Y(0,1,0);return new Qi({name:"SphericalGaussianBlur",defines:{n:Hi,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:kl(),fragmentShader:` precision mediump float; precision mediump int; @@ -3268,7 +3268,7 @@ void main() { } } - `,blending:yi,depthTest:!1,depthWrite:!1})}function Vf(){return new Qi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Gl(),fragmentShader:` + `,blending:yi,depthTest:!1,depthWrite:!1})}function Vf(){return new Qi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:kl(),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 Gf(){return new Qi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Gl(),fragmentShader:` + `,blending:yi,depthTest:!1,depthWrite:!1})}function Gf(){return new Qi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:kl(),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 Gl(){return` + `,blending:yi,depthTest:!1,depthWrite:!1})}function kl(){return` precision mediump float; precision mediump int; @@ -3358,28 +3358,28 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function IE(t){let e=new WeakMap,n=null;function i(a){if(a&&a.isTexture){const c=a.mapping,l=c===tl||c===nl,u=c===Hs||c===Vs;if(l||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let f=e.get(a);return n===null&&(n=new zf(t)),f=l?n.fromEquirectangular(a,f):n.fromCubemap(a,f),e.set(a,f),f.texture}else{if(e.has(a))return e.get(a).texture;{const f=a.image;if(l&&f&&f.height>0||u&&f&&s(f)){n===null&&(n=new zf(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 u=0;ue.maxTextureSize&&(I=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const z=new Float32Array(T*I*4*g),U=new um(z,T,I,g);U.type=ki,U.needsUpdate=!0;const O=x*4;for(let G=0;G0)return t;const s=e*n;let r=$f[s];if(r===void 0&&(r=new Float32Array(s),$f[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 _t(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n0||u&&f&&s(f)){n===null&&(n=new zf(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 u=0;ue.maxTextureSize&&(I=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const z=new Float32Array(T*I*4*g),U=new um(z,T,I,g);U.type=ki,U.needsUpdate=!0;const O=x*4;for(let G=0;G0)return t;const s=e*n;let r=$f[s];if(r===void 0&&(r=new Float32Array(s),$f[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;n":" "} ${a}: ${n[o]}`)}return i.join(` -`)}function NS(t){switch(t){case Bn:return["Linear","( value )"];case ze:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),["Linear","( value )"]}}function Kf(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 OS(t){switch(t){case Bn:return["Linear","( value )"];case ze:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),["Linear","( value )"]}}function Kf(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+` -`+IS(t.getShaderSource(e),o)}else return s}function FS(t,e){const n=NS(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function OS(t,e){let n;switch(e){case Kv:n="Linear";break;case Zv:n="Reinhard";break;case Jv:n="OptimizedCineon";break;case Qv:n="ACESFilmic";break;case ex:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function BS(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 zS(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(` -`)}function HS(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function al(t){return t.replace(VS,GS)}function GS(t,e){const n=Ve[e];if(n===void 0)throw new Error("Can not resolve #include <"+e+">");return al(n)}const $S=/#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 Qf(t){return t.replace($S,kS)}function kS(t,e,n,i){let s="";for(let r=parseInt(e);r/gm;function ll(t){return t.replace($S,kS)}function kS(t,e){const n=Ve[e];if(n===void 0)throw new Error("Can not resolve #include <"+e+">");return ll(n)}const WS=/#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 Qf(t){return t.replace(WS,XS)}function XS(t,e,n,i){let s="";for(let r=parseInt(e);r0&&(m+=` `),p=[d,_].filter(mr).join(` `),p.length>0&&(p+=` `)):(m=[eh(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 "+u:"",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,eh(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 "+u:"",n.envMap?"#define "+f:"",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?OS("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ve.encodings_pars_fragment,FS("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` +`),p=[d,eh(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 "+u:"",n.envMap?"#define "+f:"",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?zS("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ve.encodings_pars_fragment,BS("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` `].filter(mr).join(` -`)),o=al(o),o=Zf(o,n),o=Jf(o,n),a=al(a),a=Zf(a,n),a=Jf(a,n),o=Qf(o),a=Qf(a),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(y=`#version 300 es +`)),o=ll(o),o=Zf(o,n),o=Jf(o,n),a=ll(a),a=Zf(a,n),a=Jf(a,n),o=Qf(o),a=Qf(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===xf?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===xf?"":"#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(` @@ -3388,9 +3388,9 @@ precision `+t.precision+" int;";return t.precision==="highp"?e+=` Program Info Log: `+x+` `+O+` -`+H)}else x!==""?console.warn("THREE.WebGLProgram: Program Info Log:",x):(T===""||I==="")&&(U=!1);U&&(this.diagnostics={runnable:z,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 Bo(s,g)),w};let D;return this.getAttributes=function(){return D===void 0&&(D=HS(s,g)),D},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=US++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=M,this.fragmentShader=b,this}let ZS=0;class JS{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 QS(e),n.set(e,i)),i}}class QS{constructor(e){this.id=ZS++,this.code=e,this.usedTimes=0}}function ey(t,e,n,i,s,r,o){const a=new fm,c=new JS,l=[],u=s.isWebGL2,f=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,z,U){const O=z.fog,H=U.geometry,G=x.isMeshStandardMaterial?z.environment:null,k=(x.isMeshStandardMaterial?n:e).get(x.envMap||G),W=k&&k.mapping===aa?k.image.height:null,ue=_[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 oe=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Te=oe!==void 0?oe.length:0;let fe=0;H.morphAttributes.position!==void 0&&(fe=1),H.morphAttributes.normal!==void 0&&(fe=2),H.morphAttributes.color!==void 0&&(fe=3);let K,ce,_e,xe;if(ue){const et=Un[ue];K=et.vertexShader,ce=et.fragmentShader}else K=x.vertexShader,ce=x.fragmentShader,c.update(x),_e=c.getVertexShaderID(x),xe=c.getFragmentShaderID(x);const N=t.getRenderTarget(),Ie=U.isInstancedMesh===!0,De=!!x.map,me=!!x.matcap,Le=!!k,P=!!x.aoMap,C=!!x.lightMap,V=!!x.bumpMap,ie=!!x.normalMap,Q=!!x.displacementMap,se=!!x.emissiveMap,de=!!x.metalnessMap,re=!!x.roughnessMap,le=x.clearcoat>0,ae=x.iridescence>0,A=x.sheen>0,S=x.transmission>0,B=le&&!!x.clearcoatMap,j=le&&!!x.clearcoatNormalMap,Z=le&&!!x.clearcoatRoughnessMap,he=ae&&!!x.iridescenceMap,L=ae&&!!x.iridescenceThicknessMap,J=A&&!!x.sheenColorMap,X=A&&!!x.sheenRoughnessMap,ge=!!x.specularMap,Ee=!!x.specularColorMap,we=!!x.specularIntensityMap,ye=S&&!!x.transmissionMap,Se=S&&!!x.thicknessMap,Pe=!!x.gradientMap,Fe=!!x.alphaMap,at=x.alphaTest>0,F=!!x.extensions,ee=!!H.attributes.uv1,pe=!!H.attributes.uv2,be=!!H.attributes.uv3;return{isWebGL2:u,shaderID:ue,shaderName:x.type,vertexShader:K,fragmentShader:ce,defines:x.defines,customVertexShaderID:_e,customFragmentShaderID:xe,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:d,instancing:Ie,instancingColor:Ie&&U.instanceColor!==null,supportsVertexTextures:h,outputColorSpace:N===null?t.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:Bn,map:De,matcap:me,envMap:Le,envMapMode:Le&&k.mapping,envMapCubeUVHeight:W,aoMap:P,lightMap:C,bumpMap:V,normalMap:ie,displacementMap:h&&Q,emissiveMap:se,normalMapObjectSpace:ie&&x.normalMapType===xx,normalMapTangentSpace:ie&&x.normalMapType===rm,metalnessMap:de,roughnessMap:re,clearcoat:le,clearcoatMap:B,clearcoatNormalMap:j,clearcoatRoughnessMap:Z,iridescence:ae,iridescenceMap:he,iridescenceThicknessMap:L,sheen:A,sheenColorMap:J,sheenRoughnessMap:X,specularMap:ge,specularColorMap:Ee,specularIntensityMap:we,transmission:S,transmissionMap:ye,thicknessMap:Se,gradientMap:Pe,opaque:x.transparent===!1&&x.blending===Ns,alphaMap:Fe,alphaTest:at,combine:x.combine,mapUv:De&&g(x.map.channel),aoMapUv:P&&g(x.aoMap.channel),lightMapUv:C&&g(x.lightMap.channel),bumpMapUv:V&&g(x.bumpMap.channel),normalMapUv:ie&&g(x.normalMap.channel),displacementMapUv:Q&&g(x.displacementMap.channel),emissiveMapUv:se&&g(x.emissiveMap.channel),metalnessMapUv:de&&g(x.metalnessMap.channel),roughnessMapUv:re&&g(x.roughnessMap.channel),clearcoatMapUv:B&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:j&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Z&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:he&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:L&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:J&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:X&&g(x.sheenRoughnessMap.channel),specularMapUv:ge&&g(x.specularMap.channel),specularColorMapUv:Ee&&g(x.specularColorMap.channel),specularIntensityMapUv:we&&g(x.specularIntensityMap.channel),transmissionMapUv:ye&&g(x.transmissionMap.channel),thicknessMapUv:Se&&g(x.thicknessMap.channel),alphaMapUv:Fe&&g(x.alphaMap.channel),vertexTangents:ie&&!!H.attributes.tangent,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,vertexUv1s:ee,vertexUv2s:pe,vertexUv3s:be,pointsUvs:U.isPoints===!0&&!!H.attributes.uv&&(De||Fe),fog:!!O,useFog:x.fog===!0,fogExp2:O&&O.isFogExp2,flatShading:x.flatShading===!0,sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:U.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Te,morphTextureStride:fe,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===jt,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionDerivatives:F&&x.extensions.derivatives===!0,extensionFragDepth:F&&x.extensions.fragDepth===!0,extensionDrawBuffers:F&&x.extensions.drawBuffers===!0,extensionShaderTextureLOD:F&&x.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||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 z=Un[T];I=$x.clone(z.uniforms)}else I=x.uniforms;return I}function M(x,T){let I;for(let z=0,U=l.length;z0?i.push(p):d.transparent===!0?s.push(p):n.push(p)}function c(f,h,d,_,g,m){const p=o(f,h,d,_,g,m);d.transmission>0?i.unshift(p):d.transparent===!0?s.unshift(p):n.unshift(p)}function l(f,h){n.length>1&&n.sort(f||ny),i.length>1&&i.sort(h||th),s.length>1&&s.sort(h||th)}function u(){for(let f=e,h=t.length;f=r.length?(o=new nh,r.push(o)):o=r[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function sy(){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 Y,color:new it};break;case"SpotLight":n={position:new Y,direction:new Y,color:new it,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Y,color:new it,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Y,skyColor:new it,groundColor:new it};break;case"RectAreaLight":n={color:new it,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return t[e.id]=n,n}}}function ry(){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 Ge};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let oy=0;function ay(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function cy(t,e){const n=new sy,i=ry(),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 u=0;u<9;u++)s.probe.push(new Y);const r=new Y,o=new gt,a=new gt;function c(u,f){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;u.sort(ay);const x=f===!0?Math.PI:1;for(let I=0,z=u.length;I0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Me.LTC_FLOAT_1,s.rectAreaLTC2=Me.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Me.LTC_HALF_1,s.rectAreaLTC2=Me.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=oy++)}function l(u,f){let h=0,d=0,_=0,g=0,m=0;const p=f.matrixWorldInverse;for(let y=0,E=u.length;y=a.length?(c=new ih(t,e),a.push(c)):c=a[o],c}function s(){n=new WeakMap}return{get:i,dispose:s}}class uy extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=_x,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 fy extends Gr{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 hy=`void main() { +`+H)}else x!==""?console.warn("THREE.WebGLProgram: Program Info Log:",x):(T===""||I==="")&&(U=!1);U&&(this.diagnostics={runnable:z,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=GS(s,g)),D},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=NS++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=M,this.fragmentShader=b,this}let QS=0;class ey{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 ty(e),n.set(e,i)),i}}class ty{constructor(e){this.id=QS++,this.code=e,this.usedTimes=0}}function ny(t,e,n,i,s,r,o){const a=new fm,c=new ey,l=[],u=s.isWebGL2,f=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,z,U){const O=z.fog,H=U.geometry,G=x.isMeshStandardMaterial?z.environment:null,k=(x.isMeshStandardMaterial?n:e).get(x.envMap||G),W=k&&k.mapping===la?k.image.height:null,ue=_[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 oe=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Te=oe!==void 0?oe.length:0;let fe=0;H.morphAttributes.position!==void 0&&(fe=1),H.morphAttributes.normal!==void 0&&(fe=2),H.morphAttributes.color!==void 0&&(fe=3);let K,ce,_e,xe;if(ue){const et=Un[ue];K=et.vertexShader,ce=et.fragmentShader}else K=x.vertexShader,ce=x.fragmentShader,c.update(x),_e=c.getVertexShaderID(x),xe=c.getFragmentShaderID(x);const N=t.getRenderTarget(),Ie=U.isInstancedMesh===!0,De=!!x.map,me=!!x.matcap,Le=!!k,P=!!x.aoMap,C=!!x.lightMap,V=!!x.bumpMap,ie=!!x.normalMap,Q=!!x.displacementMap,se=!!x.emissiveMap,de=!!x.metalnessMap,re=!!x.roughnessMap,le=x.clearcoat>0,ae=x.iridescence>0,A=x.sheen>0,S=x.transmission>0,B=le&&!!x.clearcoatMap,j=le&&!!x.clearcoatNormalMap,Z=le&&!!x.clearcoatRoughnessMap,he=ae&&!!x.iridescenceMap,L=ae&&!!x.iridescenceThicknessMap,J=A&&!!x.sheenColorMap,X=A&&!!x.sheenRoughnessMap,ge=!!x.specularMap,Ee=!!x.specularColorMap,we=!!x.specularIntensityMap,ye=S&&!!x.transmissionMap,Se=S&&!!x.thicknessMap,Pe=!!x.gradientMap,Fe=!!x.alphaMap,at=x.alphaTest>0,F=!!x.extensions,ee=!!H.attributes.uv1,pe=!!H.attributes.uv2,be=!!H.attributes.uv3;return{isWebGL2:u,shaderID:ue,shaderName:x.type,vertexShader:K,fragmentShader:ce,defines:x.defines,customVertexShaderID:_e,customFragmentShaderID:xe,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:d,instancing:Ie,instancingColor:Ie&&U.instanceColor!==null,supportsVertexTextures:h,outputColorSpace:N===null?t.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:Bn,map:De,matcap:me,envMap:Le,envMapMode:Le&&k.mapping,envMapCubeUVHeight:W,aoMap:P,lightMap:C,bumpMap:V,normalMap:ie,displacementMap:h&&Q,emissiveMap:se,normalMapObjectSpace:ie&&x.normalMapType===Ex,normalMapTangentSpace:ie&&x.normalMapType===rm,metalnessMap:de,roughnessMap:re,clearcoat:le,clearcoatMap:B,clearcoatNormalMap:j,clearcoatRoughnessMap:Z,iridescence:ae,iridescenceMap:he,iridescenceThicknessMap:L,sheen:A,sheenColorMap:J,sheenRoughnessMap:X,specularMap:ge,specularColorMap:Ee,specularIntensityMap:we,transmission:S,transmissionMap:ye,thicknessMap:Se,gradientMap:Pe,opaque:x.transparent===!1&&x.blending===Ns,alphaMap:Fe,alphaTest:at,combine:x.combine,mapUv:De&&g(x.map.channel),aoMapUv:P&&g(x.aoMap.channel),lightMapUv:C&&g(x.lightMap.channel),bumpMapUv:V&&g(x.bumpMap.channel),normalMapUv:ie&&g(x.normalMap.channel),displacementMapUv:Q&&g(x.displacementMap.channel),emissiveMapUv:se&&g(x.emissiveMap.channel),metalnessMapUv:de&&g(x.metalnessMap.channel),roughnessMapUv:re&&g(x.roughnessMap.channel),clearcoatMapUv:B&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:j&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Z&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:he&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:L&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:J&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:X&&g(x.sheenRoughnessMap.channel),specularMapUv:ge&&g(x.specularMap.channel),specularColorMapUv:Ee&&g(x.specularColorMap.channel),specularIntensityMapUv:we&&g(x.specularIntensityMap.channel),transmissionMapUv:ye&&g(x.transmissionMap.channel),thicknessMapUv:Se&&g(x.thicknessMap.channel),alphaMapUv:Fe&&g(x.alphaMap.channel),vertexTangents:ie&&!!H.attributes.tangent,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,vertexUv1s:ee,vertexUv2s:pe,vertexUv3s:be,pointsUvs:U.isPoints===!0&&!!H.attributes.uv&&(De||Fe),fog:!!O,useFog:x.fog===!0,fogExp2:O&&O.isFogExp2,flatShading:x.flatShading===!0,sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:U.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Te,morphTextureStride:fe,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===jt,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionDerivatives:F&&x.extensions.derivatives===!0,extensionFragDepth:F&&x.extensions.fragDepth===!0,extensionDrawBuffers:F&&x.extensions.drawBuffers===!0,extensionShaderTextureLOD:F&&x.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||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 z=Un[T];I=Wx.clone(z.uniforms)}else I=x.uniforms;return I}function M(x,T){let I;for(let z=0,U=l.length;z0?i.push(p):d.transparent===!0?s.push(p):n.push(p)}function c(f,h,d,_,g,m){const p=o(f,h,d,_,g,m);d.transmission>0?i.unshift(p):d.transparent===!0?s.unshift(p):n.unshift(p)}function l(f,h){n.length>1&&n.sort(f||sy),i.length>1&&i.sort(h||th),s.length>1&&s.sort(h||th)}function u(){for(let f=e,h=t.length;f=r.length?(o=new nh,r.push(o)):o=r[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function oy(){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 Y,color:new it};break;case"SpotLight":n={position:new Y,direction:new Y,color:new it,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Y,color:new it,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Y,skyColor:new it,groundColor:new it};break;case"RectAreaLight":n={color:new it,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return t[e.id]=n,n}}}function ay(){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 Ge};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let cy=0;function ly(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function uy(t,e){const n=new oy,i=ay(),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 u=0;u<9;u++)s.probe.push(new Y);const r=new Y,o=new _t,a=new _t;function c(u,f){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;u.sort(ly);const x=f===!0?Math.PI:1;for(let I=0,z=u.length;I0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Me.LTC_FLOAT_1,s.rectAreaLTC2=Me.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Me.LTC_HALF_1,s.rectAreaLTC2=Me.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=cy++)}function l(u,f){let h=0,d=0,_=0,g=0,m=0;const p=f.matrixWorldInverse;for(let y=0,E=u.length;y=a.length?(c=new ih(t,e),a.push(c)):c=a[o],c}function s(){n=new WeakMap}return{get:i,dispose:s}}class hy extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xx,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 dy extends Gr{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 py=`void main() { gl_Position = vec4( position, 1.0 ); -}`,dy=`uniform sampler2D shadow_pass; +}`,my=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3416,29 +3416,29 @@ 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 Hl;const s=new Ge,r=new Ge,o=new yt,a=new uy({depthPacking:vx}),c=new fy,l={},u=n.maxTextureSize,f={[bi]:jt,[jt]:bi,[ni]:ni},h=new Qi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ge},radius:{value:4}},vertexShader:hy,fragmentShader:dy}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const _=new ai;_.setAttribute("position",new un(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=Jp;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 z=p!==Zn&&this.type===Zn,U=p===Zn&&this.type!==Zn;for(let O=0,H=M.length;Ou||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/W.x),s.x=r.x*W.x,k.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/W.y),s.y=r.y*W.y,k.mapSize.y=r.y)),k.map===null||z===!0||U===!0){const oe=this.type!==Zn?{minFilter:Gt,magFilter:Gt}:{};k.map!==null&&k.map.dispose(),k.map=new Zi(s.x,s.y,oe),k.map.texture.name=G.name+".shadowMap",k.camera.updateProjectionMatrix()}t.setRenderTarget(k.map),t.clear();const ue=k.getViewportCount();for(let oe=0;oe0||b.map&&b.alphaTest>0){const I=x.uuid,z=b.uuid;let U=l[I];U===void 0&&(U={},l[I]=U);let O=U[z];O===void 0&&(O=x.clone(),U[z]=O),x=O}if(x.visible=b.visible,x.wireframe=b.wireframe,D===Zn?x.side=b.shadowSide!==null?b.shadowSide:b.side:x.side=b.shadowSide!==null?b.shadowSide:f[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===Zn)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,M.matrixWorld);const z=e.update(M),U=M.material;if(Array.isArray(U)){const O=z.groups;for(let H=0,G=O.length;H=1):W.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(W)[1]),G=k>=2);let ue=null,oe={};const Te=t.getParameter(t.SCISSOR_BOX),fe=t.getParameter(t.VIEWPORT),K=new yt().fromArray(Te),ce=new yt().fromArray(fe);function _e(F,ee,pe,be){const Re=new Uint8Array(4),et=t.createTexture();t.bindTexture(F,et),t.texParameteri(F,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(F,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):qo("canvas")}function E(A,S,B,j){let Z=1;if((A.width>j||A.height>j)&&(Z=j/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 he=S?Sx:Math.floor,L=he(Z*A.width),J=he(Z*A.height);g===void 0&&(g=y(L,J));const X=B?y(L,J):g;return X.width=L,X.height=J,X.getContext("2d").drawImage(A,0,0,L,J),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+L+"x"+J+")."),X}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 Mf(A.width)&&Mf(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,B,j,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 he=S;return S===t.RED&&(B===t.FLOAT&&(he=t.R32F),B===t.HALF_FLOAT&&(he=t.R16F),B===t.UNSIGNED_BYTE&&(he=t.R8)),S===t.RG&&(B===t.FLOAT&&(he=t.RG32F),B===t.HALF_FLOAT&&(he=t.RG16F),B===t.UNSIGNED_BYTE&&(he=t.RG8)),S===t.RGBA&&(B===t.FLOAT&&(he=t.RGBA32F),B===t.HALF_FLOAT&&(he=t.RGBA16F),B===t.UNSIGNED_BYTE&&(he=j===ze&&Z===!1?t.SRGB8_ALPHA8:t.RGBA8),B===t.UNSIGNED_SHORT_4_4_4_4&&(he=t.RGBA4),B===t.UNSIGNED_SHORT_5_5_5_1&&(he=t.RGB5_A1)),(he===t.R16F||he===t.R32F||he===t.RG16F||he===t.RG32F||he===t.RGBA16F||he===t.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function x(A,S,B){return b(A,B)===!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===qu||A===Fa?t.NEAREST:t.LINEAR}function I(A){const S=A.target;S.removeEventListener("dispose",I),U(S),S.isVideoTexture&&_.delete(S)}function z(A){const S=A.target;S.removeEventListener("dispose",z),H(S)}function U(A){const S=i.get(A);if(S.__webglInit===void 0)return;const B=A.source,j=m.get(B);if(j){const Z=j[S.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&O(A),Object.keys(j).length===0&&m.delete(B)}i.remove(A)}function O(A){const S=i.get(A);t.deleteTexture(S.__webglTexture);const B=A.source,j=m.get(B);delete j[S.__cacheKey],o.memory.textures--}function H(A){const S=A.texture,B=i.get(A),j=i.get(S);if(j.__webglTexture!==void 0&&(t.deleteTexture(j.__webglTexture),o.memory.textures--),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++)t.deleteFramebuffer(B.__webglFramebuffer[Z]),B.__webglDepthbuffer&&t.deleteRenderbuffer(B.__webglDepthbuffer[Z]);else{if(t.deleteFramebuffer(B.__webglFramebuffer),B.__webglDepthbuffer&&t.deleteRenderbuffer(B.__webglDepthbuffer),B.__webglMultisampledFramebuffer&&t.deleteFramebuffer(B.__webglMultisampledFramebuffer),B.__webglColorRenderbuffer)for(let Z=0;Z=c&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+c),G+=1,A}function ue(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 oe(A,S){const B=i.get(A);if(A.isVideoTexture&&le(A),A.isRenderTargetTexture===!1&&A.version>0&&B.__version!==A.version){const j=A.image;if(j===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(j.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ie(B,A,S);return}}n.bindTexture(t.TEXTURE_2D,B.__webglTexture,t.TEXTURE0+S)}function Te(A,S){const B=i.get(A);if(A.version>0&&B.__version!==A.version){Ie(B,A,S);return}n.bindTexture(t.TEXTURE_2D_ARRAY,B.__webglTexture,t.TEXTURE0+S)}function fe(A,S){const B=i.get(A);if(A.version>0&&B.__version!==A.version){Ie(B,A,S);return}n.bindTexture(t.TEXTURE_3D,B.__webglTexture,t.TEXTURE0+S)}function K(A,S){const B=i.get(A);if(A.version>0&&B.__version!==A.version){De(B,A,S);return}n.bindTexture(t.TEXTURE_CUBE_MAP,B.__webglTexture,t.TEXTURE0+S)}const ce={[il]:t.REPEAT,[yn]:t.CLAMP_TO_EDGE,[sl]:t.MIRRORED_REPEAT},_e={[Gt]:t.NEAREST,[qu]:t.NEAREST_MIPMAP_NEAREST,[Fa]:t.NEAREST_MIPMAP_LINEAR,[dn]:t.LINEAR,[tx]:t.LINEAR_MIPMAP_NEAREST,[Ir]:t.LINEAR_MIPMAP_LINEAR};function xe(A,S,B){if(B?(t.texParameteri(A,t.TEXTURE_WRAP_S,ce[S.wrapS]),t.texParameteri(A,t.TEXTURE_WRAP_T,ce[S.wrapT]),(A===t.TEXTURE_3D||A===t.TEXTURE_2D_ARRAY)&&t.texParameteri(A,t.TEXTURE_WRAP_R,ce[S.wrapR]),t.texParameteri(A,t.TEXTURE_MAG_FILTER,_e[S.magFilter]),t.texParameteri(A,t.TEXTURE_MIN_FILTER,_e[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 j=e.get("EXT_texture_filter_anisotropic");if(S.magFilter===Gt||S.minFilter!==Fa&&S.minFilter!==Ir||S.type===ki&&e.has("OES_texture_float_linear")===!1||a===!1&&S.type===Nr&&e.has("OES_texture_half_float_linear")===!1)return;(S.anisotropy>1||i.get(S).__currentAnisotropy)&&(t.texParameterf(A,j.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,s.getMaxAnisotropy())),i.get(S).__currentAnisotropy=S.anisotropy)}}function N(A,S){let B=!1;A.__webglInit===void 0&&(A.__webglInit=!0,S.addEventListener("dispose",I));const j=S.source;let Z=m.get(j);Z===void 0&&(Z={},m.set(j,Z));const he=ue(S);if(he!==A.__cacheKey){Z[he]===void 0&&(Z[he]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,B=!0),Z[he].usedTimes++;const L=Z[A.__cacheKey];L!==void 0&&(Z[A.__cacheKey].usedTimes--,L.usedTimes===0&&O(S)),A.__cacheKey=he,A.__webglTexture=Z[he].texture}return B}function Ie(A,S,B){let j=t.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(j=t.TEXTURE_2D_ARRAY),S.isData3DTexture&&(j=t.TEXTURE_3D);const Z=N(A,S),he=S.source;n.bindTexture(j,A.__webglTexture,t.TEXTURE0+B);const L=i.get(he);if(he.version!==L.__version||Z===!0){n.activeTexture(t.TEXTURE0+B),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 J=M(S)&&v(S.image)===!1;let X=E(S.image,J,!1,u);X=ae(S,X);const ge=v(X)||a,Ee=r.convert(S.format,S.colorSpace);let we=r.convert(S.type),ye=D(S.internalFormat,Ee,we,S.colorSpace);xe(j,S,ge);let Se;const Pe=S.mipmaps,Fe=a&&S.isVideoTexture!==!0,at=L.__version===void 0||Z===!0,F=x(S,X,ge);if(S.isDepthTexture)ye=t.DEPTH_COMPONENT,a?S.type===ki?ye=t.DEPTH_COMPONENT32F:S.type===$i?ye=t.DEPTH_COMPONENT24:S.type===Fs?ye=t.DEPTH24_STENCIL8:ye=t.DEPTH_COMPONENT16:S.type===ki&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),S.format===qi&&ye===t.DEPTH_COMPONENT&&S.type!==im&&S.type!==$i&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),S.type=$i,we=r.convert(S.type)),S.format===Gs&&ye===t.DEPTH_COMPONENT&&(ye=t.DEPTH_STENCIL,S.type!==Fs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),S.type=Fs,we=r.convert(S.type))),at&&(Fe?n.texStorage2D(t.TEXTURE_2D,1,ye,X.width,X.height):n.texImage2D(t.TEXTURE_2D,0,ye,X.width,X.height,0,Ee,we,null));else if(S.isDataTexture)if(Pe.length>0&&ge){Fe&&at&&n.texStorage2D(t.TEXTURE_2D,F,ye,Pe[0].width,Pe[0].height);for(let ee=0,pe=Pe.length;ee>=1,pe>>=1}}else if(Pe.length>0&&ge){Fe&&at&&n.texStorage2D(t.TEXTURE_2D,F,ye,Pe[0].width,Pe[0].height);for(let ee=0,pe=Pe.length;ee0&&at++,n.texStorage2D(t.TEXTURE_CUBE_MAP,at,Se,X[0].width,X[0].height));for(let ee=0;ee<6;ee++)if(J){Pe?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,X[ee].width,X[ee].height,we,ye,X[ee].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Se,X[ee].width,X[ee].height,0,we,ye,X[ee].data);for(let pe=0;pe=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,j,Z,i.get(B).__webglTexture,0),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Le(A,S,B){if(t.bindRenderbuffer(t.RENDERBUFFER,A),S.depthBuffer&&!S.stencilBuffer){let j=t.DEPTH_COMPONENT16;if(B||re(S)){const Z=S.depthTexture;Z&&Z.isDepthTexture&&(Z.type===ki?j=t.DEPTH_COMPONENT32F:Z.type===$i&&(j=t.DEPTH_COMPONENT24));const he=de(S);re(S)?h.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,he,j,S.width,S.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,he,j,S.width,S.height)}else t.renderbufferStorage(t.RENDERBUFFER,j,S.width,S.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,A)}else if(S.depthBuffer&&S.stencilBuffer){const j=de(S);B&&re(S)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,j,t.DEPTH24_STENCIL8,S.width,S.height):re(S)?h.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,j,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 j=S.isWebGLMultipleRenderTargets===!0?S.texture:[S.texture];for(let Z=0;Z0&&re(A)===!1){const J=he?S:[S];B.__webglMultisampledFramebuffer=t.createFramebuffer(),B.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let X=0;X0&&re(A)===!1){const S=A.isWebGLMultipleRenderTargets?A.texture:[A.texture],B=A.width,j=A.height;let Z=t.COLOR_BUFFER_BIT;const he=[],L=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,J=i.get(A),X=A.isWebGLMultipleRenderTargets===!0;if(X)for(let ge=0;ge0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function le(A){const S=o.render.frame;_.get(A)!==S&&(_.set(A,S),A.update())}function ae(A,S){const B=A.colorSpace,j=A.format,Z=A.type;return A.isCompressedTexture===!0||A.format===rl||B!==Bn&&B!==ji&&(B===ze?a===!1?e.has("EXT_sRGB")===!0&&j===bn?(A.format=rl,A.minFilter=dn,A.generateMipmaps=!1):S=cm.sRGBToLinear(S):(j!==bn||Z!==Ki)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),S}this.allocateTextureUnit=W,this.resetTextureUnits=k,this.setTexture2D=oe,this.setTexture2DArray=Te,this.setTexture3D=fe,this.setTextureCube=K,this.rebindTextures=V,this.setupRenderTarget=ie,this.updateRenderTargetMipmap=Q,this.updateMultisampleRenderTarget=se,this.setupDepthRenderbuffer=C,this.setupFrameBufferTexture=me,this.useMultisampledRTT=re}function _y(t,e,n){const i=n.isWebGL2;function s(r,o=ji){let a;if(r===Ki)return t.UNSIGNED_BYTE;if(r===rx)return t.UNSIGNED_SHORT_4_4_4_4;if(r===ox)return t.UNSIGNED_SHORT_5_5_5_1;if(r===nx)return t.BYTE;if(r===ix)return t.SHORT;if(r===im)return t.UNSIGNED_SHORT;if(r===sx)return t.INT;if(r===$i)return t.UNSIGNED_INT;if(r===ki)return t.FLOAT;if(r===Nr)return i?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===ax)return t.ALPHA;if(r===bn)return t.RGBA;if(r===cx)return t.LUMINANCE;if(r===lx)return t.LUMINANCE_ALPHA;if(r===qi)return t.DEPTH_COMPONENT;if(r===Gs)return t.DEPTH_STENCIL;if(r===rl)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===ux)return t.RED;if(r===fx)return t.RED_INTEGER;if(r===hx)return t.RG;if(r===dx)return t.RG_INTEGER;if(r===px)return t.RGBA_INTEGER;if(r===Oa||r===Ba||r===za||r===Ha)if(o===ze)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===Oa)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Ba)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===za)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Ha)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===Oa)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Ba)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===za)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Ha)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Yu||r===ju||r===Ku||r===Zu)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===Yu)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===ju)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Ku)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Zu)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===mx)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===Ju||r===Qu)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===Ju)return o===ze?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===Qu)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===ef||r===tf||r===nf||r===sf||r===rf||r===of||r===af||r===cf||r===lf||r===uf||r===ff||r===hf||r===df||r===pf)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===ef)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===tf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===nf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===sf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===rf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===of)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===af)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===cf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===lf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===uf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===ff)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===hf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===df)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===pf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Va)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===Va)return o===ze?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===gx||r===mf||r===gf||r===_f)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===Va)return a.COMPRESSED_RED_RGTC1_EXT;if(r===mf)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===gf)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===_f)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Fs?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 vy extends pn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class xo extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const xy={type:"move"};class fc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xo,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 xo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),this._grip}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 u=l.joints["index-finger-tip"],f=l.joints["thumb-tip"],h=u.position.distanceTo(f.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(xy)))}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 xo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class My extends ln{constructor(e,n,i,s,r,o,a,c,l,u){if(u=u!==void 0?u:qi,u!==qi&&u!==Gs)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===qi&&(i=$i),i===void 0&&u===Gs&&(i=Fs),super(null,s,r,o,a,c,u,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 Ey extends ts{constructor(e,n){super();const i=this;let s=null,r=1,o=null,a="local-floor",c=1,l=null,u=null,f=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 yt;const w=new pn;w.layers.enable(2),w.viewport=new yt;const D=[b,w],x=new vy;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(K){let ce=y[K];return ce===void 0&&(ce=new fc,y[K]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(K){let ce=y[K];return ce===void 0&&(ce=new fc,y[K]=ce),ce.getGripSpace()},this.getHand=function(K){let ce=y[K];return ce===void 0&&(ce=new fc,y[K]=ce),ce.getHandSpace()};function z(K){const ce=E.indexOf(K.inputSource);if(ce===-1)return;const _e=y[ce];_e!==void 0&&(_e.update(K.inputSource,K.frame,l||o),_e.dispatchEvent({type:K.type,data:K.inputSource}))}function U(){s.removeEventListener("select",z),s.removeEventListener("selectstart",z),s.removeEventListener("selectend",z),s.removeEventListener("squeeze",z),s.removeEventListener("squeezestart",z),s.removeEventListener("squeezeend",z),s.removeEventListener("end",U),s.removeEventListener("inputsourceschange",O);for(let K=0;K=0&&(E[xe]=null,y[xe].disconnect(_e))}for(let ce=0;ce=E.length){E.push(_e),xe=Ie;break}else if(E[Ie]===null){E[Ie]=_e,xe=Ie;break}if(xe===-1)break}const N=y[xe];N&&N.connect(_e)}}const H=new Y,G=new Y;function k(K,ce,_e){H.setFromMatrixPosition(ce.matrixWorld),G.setFromMatrixPosition(_e.matrixWorld);const xe=H.distanceTo(G),N=ce.projectionMatrix.elements,Ie=_e.projectionMatrix.elements,De=N[14]/(N[10]-1),me=N[14]/(N[10]+1),Le=(N[9]+1)/N[5],P=(N[9]-1)/N[5],C=(N[8]-1)/N[0],V=(Ie[8]+1)/Ie[0],ie=De*C,Q=De*V,se=xe/(-C+V),de=se*-C;ce.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(de),K.translateZ(se),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();const re=De+se,le=me+se,ae=ie-de,A=Q+(xe-de),S=Le*me/le*re,B=P*me/le*re;K.projectionMatrix.makePerspective(ae,A,S,B,re,le),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function W(K,ce){ce===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(ce.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(s===null)return;x.near=w.near=b.near=K.near,x.far=w.far=b.far=K.far,(T!==x.near||I!==x.far)&&(s.updateRenderState({depthNear:x.near,depthFar:x.far}),T=x.near,I=x.far);const ce=K.parent,_e=x.cameras;W(x,ce);for(let xe=0;xe<_e.length;xe++)W(_e[xe],ce);_e.length===2?k(x,b,w):x.projectionMatrix.copy(b.projectionMatrix),ue(K,x,ce)};function ue(K,ce,_e){_e===null?K.matrix.copy(ce.matrixWorld):(K.matrix.copy(_e.matrixWorld),K.matrix.invert(),K.matrix.multiply(ce.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0);const xe=K.children;for(let N=0,Ie=xe.length;NN&&(M.set(xe,xe.lastChangedTime),i.dispatchEvent({type:"planechanged",data:xe}))}}_=null}const fe=new xm;fe.setAnimationLoop(Te),this.setAnimationLoop=function(K){oe=K},this.dispose=function(){}}}function Sy(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,gm(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),f(m,p)):p.isMeshPhongMaterial?(r(m,p),u(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===jt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,n(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===jt&&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 u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function f(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===jt&&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 yy(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=u(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 u(y){const E=f();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 f(){for(let y=0;y0){b=v%M;const z=M-b;b!==0&&z-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 by(){const t=qo("canvas");return t.style.display="block",t}class Tm{constructor(e={}){const{canvas:n=by(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!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=ze,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 yt,x=new yt;let T=null,I=n.width,z=n.height,U=1,O=null,H=null;const G=new yt(0,0,I,z),k=new yt(0,0,I,z);let W=!1;const ue=new Hl;let oe=!1,Te=!1,fe=null;const K=new gt,ce=new Y,_e={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return M===null?U:1}let N=i;function Ie(R,q){for(let te=0;te0?_=m[m.length-1]:_=null,g.pop(),g.length>0?d=g[g.length-1]:d=null};function Rt(R,q,te,$){if(R.visible===!1)return;if(R.layers.test(q.layers)){if(R.isGroup)te=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(q);else if(R.isLight)_.pushLight(R),R.castShadow&&_.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||ue.intersectsSprite(R)){$&&ce.setFromMatrixPosition(R.matrixWorld).applyMatrix4(K);const Ue=re.update(R),Ne=R.material;Ne.visible&&d.push(R,Ue,Ne,te,ce.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||ue.intersectsObject(R))){R.isSkinnedMesh&&R.skeleton.frame!==P.render.frame&&(R.skeleton.update(),R.skeleton.frame=P.render.frame);const Ue=re.update(R),Ne=R.material;if($&&(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),ce.copy(Ue.boundingSphere.center).applyMatrix4(R.matrixWorld).applyMatrix4(K)),Array.isArray(Ne)){const He=Ue.groups;for(let ke=0,We=He.length;ke0&&ct(ne,Ce,q,te),$&&Le.viewport(D.copy($)),ne.length>0&&fn(ne,q,te),Ce.length>0&&fn(Ce,q,te),Ue.length>0&&fn(Ue,q,te),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function ct(R,q,te,$){if(fe===null){const Ne=me.isWebGL2;fe=new Zi(1024,1024,{generateMipmaps:!0,type:De.has("EXT_color_buffer_half_float")?Nr:Ki,minFilter:Ir,samples:Ne&&a===!0?4:0})}const ne=p.getRenderTarget();p.setRenderTarget(fe),p.clear();const Ce=p.toneMapping;p.toneMapping=ri,fn(R,te,$),V.updateMultisampleRenderTarget(fe),V.updateRenderTargetMipmap(fe);let Ue=!1;for(let Ne=0,He=q.length;Ne0&&V.useMultisampledRTT(R)===!1?ne=C.get(R).__webglMultisampledFramebuffer:ne=We,D.copy(R.viewport),x.copy(R.scissor),T=R.scissorTest}else D.copy(G).multiplyScalar(U).floor(),x.copy(k).multiplyScalar(U).floor(),T=W;if(Le.bindFramebuffer(N.FRAMEBUFFER,ne)&&me.drawBuffers&&$&&Le.drawBuffers(R,ne),Le.viewport(D),Le.scissor(x),Le.setScissorTest(T),Ce){const He=C.get(R.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_CUBE_MAP_POSITIVE_X+q,He.__webglTexture,te)}else if(Ue){const He=C.get(R.texture),ke=q||0;N.framebufferTextureLayer(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,He.__webglTexture,te||0,ke)}b=-1},this.readRenderTargetPixels=function(R,q,te,$,ne,Ce,Ue){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ne=C.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&Ue!==void 0&&(Ne=Ne[Ue]),Ne){Le.bindFramebuffer(N.FRAMEBUFFER,Ne);try{const He=R.texture,ke=He.format,We=He.type;if(ke!==bn&&X.convert(ke)!==N.getParameter(N.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const qe=We===Nr&&(De.has("EXT_color_buffer_half_float")||me.isWebGL2&&De.has("EXT_color_buffer_float"));if(We!==Ki&&X.convert(We)!==N.getParameter(N.IMPLEMENTATION_COLOR_READ_TYPE)&&!(We===ki&&(me.isWebGL2||De.has("OES_texture_float")||De.has("WEBGL_color_buffer_float")))&&!qe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q>=0&&q<=R.width-$&&te>=0&&te<=R.height-ne&&N.readPixels(q,te,$,ne,X.convert(ke),X.convert(We),Ce)}finally{const He=M!==null?C.get(M).__webglFramebuffer:null;Le.bindFramebuffer(N.FRAMEBUFFER,He)}}},this.copyFramebufferToTexture=function(R,q,te=0){const $=Math.pow(2,-te),ne=Math.floor(q.image.width*$),Ce=Math.floor(q.image.height*$);V.setTexture2D(q,0),N.copyTexSubImage2D(N.TEXTURE_2D,te,0,0,R.x,R.y,ne,Ce),Le.unbindTexture()},this.copyTextureToTexture=function(R,q,te,$=0){const ne=q.image.width,Ce=q.image.height,Ue=X.convert(te.format),Ne=X.convert(te.type);V.setTexture2D(te,0),N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,te.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,te.unpackAlignment),q.isDataTexture?N.texSubImage2D(N.TEXTURE_2D,$,R.x,R.y,ne,Ce,Ue,Ne,q.image.data):q.isCompressedTexture?N.compressedTexSubImage2D(N.TEXTURE_2D,$,R.x,R.y,q.mipmaps[0].width,q.mipmaps[0].height,Ue,q.mipmaps[0].data):N.texSubImage2D(N.TEXTURE_2D,$,R.x,R.y,Ue,Ne,q.image),$===0&&te.generateMipmaps&&N.generateMipmap(N.TEXTURE_2D),Le.unbindTexture()},this.copyTextureToTexture3D=function(R,q,te,$,ne=0){if(p.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ce=R.max.x-R.min.x+1,Ue=R.max.y-R.min.y+1,Ne=R.max.z-R.min.z+1,He=X.convert($.format),ke=X.convert($.type);let We;if($.isData3DTexture)V.setTexture3D($,0),We=N.TEXTURE_3D;else if($.isDataArrayTexture)V.setTexture2DArray($,0),We=N.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,$.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,$.unpackAlignment);const qe=N.getParameter(N.UNPACK_ROW_LENGTH),Ze=N.getParameter(N.UNPACK_IMAGE_HEIGHT),Nt=N.getParameter(N.UNPACK_SKIP_PIXELS),gn=N.getParameter(N.UNPACK_SKIP_ROWS),Ai=N.getParameter(N.UNPACK_SKIP_IMAGES),ft=te.isCompressedTexture?te.mipmaps[0]:te.image;N.pixelStorei(N.UNPACK_ROW_LENGTH,ft.width),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,ft.height),N.pixelStorei(N.UNPACK_SKIP_PIXELS,R.min.x),N.pixelStorei(N.UNPACK_SKIP_ROWS,R.min.y),N.pixelStorei(N.UNPACK_SKIP_IMAGES,R.min.z),te.isDataTexture||te.isData3DTexture?N.texSubImage3D(We,ne,q.x,q.y,q.z,Ce,Ue,Ne,He,ke,ft.data):te.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),N.compressedTexSubImage3D(We,ne,q.x,q.y,q.z,Ce,Ue,Ne,He,ft.data)):N.texSubImage3D(We,ne,q.x,q.y,q.z,Ce,Ue,Ne,He,ke,ft),N.pixelStorei(N.UNPACK_ROW_LENGTH,qe),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,Ze),N.pixelStorei(N.UNPACK_SKIP_PIXELS,Nt),N.pixelStorei(N.UNPACK_SKIP_ROWS,gn),N.pixelStorei(N.UNPACK_SKIP_IMAGES,Ai),ne===0&&$.generateMipmaps&&N.generateMipmap(We),Le.unbindTexture()},this.initTexture=function(R){R.isCubeTexture?V.setTextureCube(R,0):R.isData3DTexture?V.setTexture3D(R,0):R.isDataArrayTexture||R.isCompressedArrayTexture?V.setTexture2DArray(R,0):V.setTexture2D(R,0),Le.unbindTexture()},this.resetState=function(){E=0,v=0,M=null,Le.reset(),ge.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===ze?Yi:sm}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Yi?ze:Bn}}class Ty extends Tm{}Ty.prototype.isWebGL1Renderer=!0;class wy 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 Ay extends Gr{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=rm,this.normalScale=new Ge(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 sh={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 Ry{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(u){a++,r===!1&&s.onStart!==void 0&&s.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,s.onProgress!==void 0&&s.onProgress(u,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(u){s.onError!==void 0&&s.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,f){return l.push(u,f),this},this.removeHandler=function(u){const f=l.indexOf(u);return f!==-1&&l.splice(f,2),this},this.getHandler=function(u){for(let f=0,h=l.length;f{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 u=Xn[e],f=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(){f.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=u.length;b{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),h=f&&f[1]?f[1].toLowerCase():void 0,d=new TextDecoder(h);return l.arrayBuffer().then(_=>d.decode(_))}}}).then(l=>{sh.add(e,l);const u=Xn[e];delete Xn[e];for(let f=0,h=u.length;f{const u=Xn[e];if(u===void 0)throw this.manager.itemError(e),l;delete Xn[e];for(let f=0,h=u.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Am 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 hc=new gt,rh=new Y,oh=new Y;class Dy{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ge(512,512),this.map=null,this.mapPass=null,this.matrix=new gt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Hl,this._frameExtents=new Ge(1,1),this._viewportCount=1,this._viewports=[new yt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;rh.setFromMatrixPosition(e.matrixWorld),n.position.copy(rh),oh.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(oh),n.updateMatrixWorld(),hc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(hc),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(hc)}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 Uy extends Dy{constructor(){super(new Mm(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Iy extends Am{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 Uy}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Ny extends Am{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class ah{constructor(e=1,n=0,i=0){return this.radius=e,this.phi=n,this.theta=i,this}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(kt(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Bl}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Bl);class ch extends wm{constructor(e){super(e)}load(e,n,i,s){const r=this,o=new Ly(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 u=new DataView(l),f=32/8*3+32/8*3*3+16/8,h=u.getUint32(80,!0);if(80+32/8+h*f===u.byteLength)return!0;const _=[115,111,108,105,100];for(let g=0;g<5;g++)if(i(_,u,g))return!1;return!0}function i(l,u,f){for(let h=0,d=l.length;h>5&31)/31,_=(H>>10&31)/31)}for(let H=1;H<=3;H++){const G=I+H*12,k=T*3*3+(H-1)*3;D[k]=u.getFloat32(G,!0),D[k+1]=u.getFloat32(G+4,!0),D[k+2]=u.getFloat32(G+8,!0),x[k]=z,x[k+1]=U,x[k+2]=O,g&&(m[k]=h,m[k+1]=d,m[k+2]=_)}}return w.setAttribute("position",new un(D,3)),w.setAttribute("normal",new un(x,3)),g&&(w.setAttribute("color",new un(m,3)),w.hasColors=!0,w.alpha=v),w}function r(l){const u=new ai,f=/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 Y;let v,M=0,b=0,w=0;for(;(v=f.exec(l))!==null;){b=w;const D=v[0];for(;(v=h.exec(D))!==null;){let I=0,z=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]),z++;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++;z!==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;u.addGroup(x,T,M),M++}return u.setAttribute("position",new oi(p,3)),u.setAttribute("normal",new oi(y,3)),u}function o(l){return typeof l!="string"?new TextDecoder().decode(l):l}function a(l){if(typeof l=="string"){const u=new Uint8Array(l.length);for(let f=0;fMath.PI&&(Pe-=we),Fe<-Math.PI?Fe+=we:Fe>Math.PI&&(Fe-=we),Pe<=Fe?a.theta=Math.max(Pe,Math.min(Fe,a.theta)):a.theta=a.theta>(Pe+Fe)/2?Math.max(Pe,a.theta):Math.min(Fe,a.theta)),a.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=l,a.radius=Math.max(i.minDistance,Math.min(i.maxDistance,a.radius)),i.enableDamping===!0?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),L.setFromSpherical(a),L.applyQuaternion(X),Se.copy(i.target).add(L),i.object.lookAt(i.target),i.enableDamping===!0?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),u.set(0,0,0)),l=1,f||ge.distanceToSquared(i.object.position)>o||8*(1-Ee.dot(i.object.quaternion))>o?(i.dispatchEvent(lh),ge.copy(i.object.position),Ee.copy(i.object.quaternion),f=!1,!0):!1}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",S),i.domElement.removeEventListener("pointerdown",V),i.domElement.removeEventListener("pointercancel",Q),i.domElement.removeEventListener("wheel",re),i.domElement.removeEventListener("pointermove",ie),i.domElement.removeEventListener("pointerup",Q),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",le),i._domElementKeyEvents=null)};const i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=s.NONE;const o=1e-6,a=new ah,c=new ah;let l=1;const u=new Y;let f=!1;const h=new Ge,d=new Ge,_=new Ge,g=new Ge,m=new Ge,p=new Ge,y=new Ge,E=new Ge,v=new Ge,M=[],b={};function w(){return 2*Math.PI/60/60*i.autoRotateSpeed}function D(){return Math.pow(.95,i.zoomSpeed)}function x(L){c.theta-=L}function T(L){c.phi-=L}const I=function(){const L=new Y;return function(X,ge){L.setFromMatrixColumn(ge,0),L.multiplyScalar(-X),u.add(L)}}(),z=function(){const L=new Y;return function(X,ge){i.screenSpacePanning===!0?L.setFromMatrixColumn(ge,1):(L.setFromMatrixColumn(ge,0),L.crossVectors(i.object.up,L)),L.multiplyScalar(X),u.add(L)}}(),U=function(){const L=new Y;return function(X,ge){const Ee=i.domElement;if(i.object.isPerspectiveCamera){const we=i.object.position;L.copy(we).sub(i.target);let ye=L.length();ye*=Math.tan(i.object.fov/2*Math.PI/180),I(2*X*ye/Ee.clientHeight,i.object.matrix),z(2*ge*ye/Ee.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(X*(i.object.right-i.object.left)/i.object.zoom/Ee.clientWidth,i.object.matrix),z(ge*(i.object.top-i.object.bottom)/i.object.zoom/Ee.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function O(L){i.object.isPerspectiveCamera?l/=L:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*L)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function H(L){i.object.isPerspectiveCamera?l*=L:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/L)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function G(L){h.set(L.clientX,L.clientY)}function k(L){y.set(L.clientX,L.clientY)}function W(L){g.set(L.clientX,L.clientY)}function ue(L){d.set(L.clientX,L.clientY),_.subVectors(d,h).multiplyScalar(i.rotateSpeed);const J=i.domElement;x(2*Math.PI*_.x/J.clientHeight),T(2*Math.PI*_.y/J.clientHeight),h.copy(d),i.update()}function oe(L){E.set(L.clientX,L.clientY),v.subVectors(E,y),v.y>0?O(D()):v.y<0&&H(D()),y.copy(E),i.update()}function Te(L){m.set(L.clientX,L.clientY),p.subVectors(m,g).multiplyScalar(i.panSpeed),U(p.x,p.y),g.copy(m),i.update()}function fe(L){L.deltaY<0?H(D()):L.deltaY>0&&O(D()),i.update()}function K(L){let J=!1;switch(L.code){case i.keys.UP:L.ctrlKey||L.metaKey||L.shiftKey?T(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):U(0,i.keyPanSpeed),J=!0;break;case i.keys.BOTTOM:L.ctrlKey||L.metaKey||L.shiftKey?T(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):U(0,-i.keyPanSpeed),J=!0;break;case i.keys.LEFT:L.ctrlKey||L.metaKey||L.shiftKey?x(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):U(i.keyPanSpeed,0),J=!0;break;case i.keys.RIGHT:L.ctrlKey||L.metaKey||L.shiftKey?x(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):U(-i.keyPanSpeed,0),J=!0;break}J&&(L.preventDefault(),i.update())}function ce(){if(M.length===1)h.set(M[0].pageX,M[0].pageY);else{const L=.5*(M[0].pageX+M[1].pageX),J=.5*(M[0].pageY+M[1].pageY);h.set(L,J)}}function _e(){if(M.length===1)g.set(M[0].pageX,M[0].pageY);else{const L=.5*(M[0].pageX+M[1].pageX),J=.5*(M[0].pageY+M[1].pageY);g.set(L,J)}}function xe(){const L=M[0].pageX-M[1].pageX,J=M[0].pageY-M[1].pageY,X=Math.sqrt(L*L+J*J);y.set(0,X)}function N(){i.enableZoom&&xe(),i.enablePan&&_e()}function Ie(){i.enableZoom&&xe(),i.enableRotate&&ce()}function De(L){if(M.length==1)d.set(L.pageX,L.pageY);else{const X=he(L),ge=.5*(L.pageX+X.x),Ee=.5*(L.pageY+X.y);d.set(ge,Ee)}_.subVectors(d,h).multiplyScalar(i.rotateSpeed);const J=i.domElement;x(2*Math.PI*_.x/J.clientHeight),T(2*Math.PI*_.y/J.clientHeight),h.copy(d)}function me(L){if(M.length===1)m.set(L.pageX,L.pageY);else{const J=he(L),X=.5*(L.pageX+J.x),ge=.5*(L.pageY+J.y);m.set(X,ge)}p.subVectors(m,g).multiplyScalar(i.panSpeed),U(p.x,p.y),g.copy(m)}function Le(L){const J=he(L),X=L.pageX-J.x,ge=L.pageY-J.y,Ee=Math.sqrt(X*X+ge*ge);E.set(0,Ee),v.set(0,Math.pow(E.y/y.y,i.zoomSpeed)),O(v.y),y.copy(E)}function P(L){i.enableZoom&&Le(L),i.enablePan&&me(L)}function C(L){i.enableZoom&&Le(L),i.enableRotate&&De(L)}function V(L){i.enabled!==!1&&(M.length===0&&(i.domElement.setPointerCapture(L.pointerId),i.domElement.addEventListener("pointermove",ie),i.domElement.addEventListener("pointerup",Q)),B(L),L.pointerType==="touch"?ae(L):se(L))}function ie(L){i.enabled!==!1&&(L.pointerType==="touch"?A(L):de(L))}function Q(L){j(L),M.length===0&&(i.domElement.releasePointerCapture(L.pointerId),i.domElement.removeEventListener("pointermove",ie),i.domElement.removeEventListener("pointerup",Q)),i.dispatchEvent(uh),r=s.NONE}function se(L){let J;switch(L.button){case 0:J=i.mouseButtons.LEFT;break;case 1:J=i.mouseButtons.MIDDLE;break;case 2:J=i.mouseButtons.RIGHT;break;default:J=-1}switch(J){case rs.DOLLY:if(i.enableZoom===!1)return;k(L),r=s.DOLLY;break;case rs.ROTATE:if(L.ctrlKey||L.metaKey||L.shiftKey){if(i.enablePan===!1)return;W(L),r=s.PAN}else{if(i.enableRotate===!1)return;G(L),r=s.ROTATE}break;case rs.PAN:if(L.ctrlKey||L.metaKey||L.shiftKey){if(i.enableRotate===!1)return;G(L),r=s.ROTATE}else{if(i.enablePan===!1)return;W(L),r=s.PAN}break;default:r=s.NONE}r!==s.NONE&&i.dispatchEvent(dc)}function de(L){switch(r){case s.ROTATE:if(i.enableRotate===!1)return;ue(L);break;case s.DOLLY:if(i.enableZoom===!1)return;oe(L);break;case s.PAN:if(i.enablePan===!1)return;Te(L);break}}function re(L){i.enabled===!1||i.enableZoom===!1||r!==s.NONE||(L.preventDefault(),i.dispatchEvent(dc),fe(L),i.dispatchEvent(uh))}function le(L){i.enabled===!1||i.enablePan===!1||K(L)}function ae(L){switch(Z(L),M.length){case 1:switch(i.touches.ONE){case os.ROTATE:if(i.enableRotate===!1)return;ce(),r=s.TOUCH_ROTATE;break;case os.PAN:if(i.enablePan===!1)return;_e(),r=s.TOUCH_PAN;break;default:r=s.NONE}break;case 2:switch(i.touches.TWO){case os.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;N(),r=s.TOUCH_DOLLY_PAN;break;case os.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ie(),r=s.TOUCH_DOLLY_ROTATE;break;default:r=s.NONE}break;default:r=s.NONE}r!==s.NONE&&i.dispatchEvent(dc)}function A(L){switch(Z(L),r){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;De(L),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;me(L),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;P(L),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;C(L),i.update();break;default:r=s.NONE}}function S(L){i.enabled!==!1&&L.preventDefault()}function B(L){M.push(L)}function j(L){delete b[L.pointerId];for(let J=0;J(t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t);var Vy=Hy;const Gy=(t,e,n)=>(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t);var $y=Gy;const ky=t=>Math.atan2(t[1],t[0]);var $l=ky,Wy=$l;const Xy=$l,qy=t=>Xy(t)*57.29577951308232;var Yy=qy;const jy=()=>[0,0];var ua=jy;const Ky=ua,Zy=t=>{const e=Ky();return e[0]=t[0],e[1]=t[1],e};var Jy=Zy;const Qy=(t,e)=>(t[0]=e[0],t[1]=e[1],t);var eb=Qy;const tb=(t,e,n)=>(t[0]=0,t[1]=0,t[2]=e[0]*n[1]-e[1]*n[0],t);var nb=tb;const ib=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)};var sb=ib;const rb=(t,e,n)=>(t[0]=e[0]/n[0],t[1]=e[1]/n[1],t);var ob=rb;const ab=(t,e)=>t[0]*e[0]+t[1]*e[1];var cb=ab;const lb=(t,e)=>t[0]===e[0]&&t[1]===e[1];var ub=lb;const{NEPS:fb}=Qe,Rm=t=>Math.abs(t)Rm(Math.sin(t)),db=t=>Rm(Math.cos(t));var qt={sin:hb,cos:db};const{sin:pb,cos:mb}=qt,gb=(t,e)=>(t[0]=mb(e),t[1]=pb(e),t);var Pm=gb;const _b=Pm,vb=(t,e)=>_b(t,e*.017453292519943295);var xb=vb;const Mb=(t,e)=>(t[0]=e,t[1]=e,t);var Eb=Mb;const Sb=ua,yb=(t,e)=>{const n=Sb();return n[0]=t,n[1]=e,n};var bb=yb;const Tb=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]);var wb=Tb;const Ab=(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 Rb=Ab;const Pb=(t,e,n)=>(t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t);var Cb=Pb;const Lb=(t,e,n)=>(t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t);var Db=Lb;const Ub=(t,e,n)=>(t[0]=e[0]*n[0],t[1]=e[1]*n[1],t);var Ib=Ub;const Nb=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t);var Fb=Nb;const Ob=(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 Cm=Ob;const{TAU:Bb}=Qe,zb=ua,Hb=Cm,Vb=(t,e)=>Hb(t,e,zb(),Bb/4);var Gb=Vb;const $b=(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 kb=$b;const Wb=(t,e,n)=>(t[0]=e[0]*n,t[1]=e[1]*n,t);var Xb=Wb;const qb=(t,e,n)=>(t[0]=Math.round(e[0]/n)*n+0,t[1]=Math.round(e[1]/n)*n+0,t);var Yb=qb;const jb=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i};var Kb=jb;const Zb=t=>{const e=t[0],n=t[1];return e*e+n*n};var Jb=Zb;const Qb=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t);var eT=Qb;const tT=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}]`;var nT=tT;const iT=(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 sT=iT,Xe={abs:Vy,add:$y,angle:Wy,angleDegrees:Yy,angleRadians:$l,clone:Jy,copy:eb,create:ua,cross:nb,distance:sb,divide:ob,dot:cb,equals:ub,fromAngleDegrees:xb,fromAngleRadians:Pm,fromScalar:Eb,fromValues:bb,length:wb,lerp:Rb,max:Cb,min:Db,multiply:Ib,negate:Fb,normal:Gb,normalize:kb,rotate:Cm,scale:Xb,snap:Yb,squaredDistance:Kb,squaredLength:Jb,subtract:eT,toString:nT,transform:sT};const rT=t=>Object.assign({},t);var kl=rT;const{EPS:fh}=Qe,oT=Xe,aT=kl,cT=t=>{if(t.isClosed)return t;const e=aT(t);if(e.isClosed=!0,e.points.length>1){const n=e.points,i=n[0];let s=n[n.length-1];for(;oT.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 uT=lT;const fT=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];var Wl=fT;const hT=Wl,dT=t=>{const e=hT();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=dT;const mT=(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 Dm=mT;const gT=(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],u=e[8],f=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=u*g-f*_,x=u*m-h*_,T=u*p-d*_,I=f*m-h*g,z=f*p-d*g,U=h*p-d*m;let O=y*U-E*z+v*I+M*T-b*x+w*D;return O?(O=1/O,t[0]=(a*U-c*z+l*I)*O,t[1]=(s*z-i*U-r*I)*O,t[2]=(g*w-m*b+p*M)*O,t[3]=(h*b-f*w-d*M)*O,t[4]=(c*T-o*U-l*x)*O,t[5]=(n*U-s*T+r*x)*O,t[6]=(m*v-_*w-p*E)*O,t[7]=(u*w-h*v+d*E)*O,t[8]=(o*z-a*T+l*D)*O,t[9]=(i*T-n*z-r*D)*O,t[10]=(_*b-g*v+p*y)*O,t[11]=(f*v-u*b-d*y)*O,t[12]=(a*x-o*I-c*D)*O,t[13]=(n*I-i*x+s*D)*O,t[14]=(g*E-_*M-m*y)*O,t[15]=(u*M-f*E+h*y)*O,t):null};var _T=gT;const vT=(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 xT=vT;const MT=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 Um=MT;const{EPS:ET}=Qe,{sin:ST,cos:yT}=qt,bT=Um,TT=(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 AT=wT;const{sin:pc,cos:mc}=qt,RT=(t,e,n,i)=>{const s=pc(e),r=mc(e),o=pc(n),a=mc(n),c=pc(i),l=mc(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 PT=RT;const CT=(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 LT=CT;const DT=Wl,UT=(t,e,n,i,s,r,o,a,c,l,u,f,h,d,_,g)=>{const m=DT();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]=u,m[11]=f,m[12]=h,m[13]=d,m[14]=_,m[15]=g,m};var IT=UT;const NT=(t,e)=>(t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t);var Nm=NT;const FT=(t,e,n)=>(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t);var Fm=FT;const OT=(t,e)=>t[0]*e[0]+t[1]*e[1]+t[2]*e[2];var fa=OT;const BT=fa,zT=(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),u=c*l,f=u&&BT(t,e)/u;return Math.acos(Math.min(Math.max(f,-1),1))};var HT=zT;const VT=()=>[0,0,0];var ha=VT;const GT=ha,$T=t=>{const e=GT();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e};var kT=$T;const WT=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t);var Om=WT;const XT=(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 kr=XT;const qT=(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 Bm=qT;const YT=(t,e,n)=>(t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t);var jT=YT;const KT=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2];var ZT=KT;const JT=(t,e)=>(t[0]=e,t[1]=e,t[2]=e,t);var QT=JT;const ew=ha,tw=(t,e,n)=>{const i=ew();return i[0]=t,i[1]=e,i[2]=n,i};var nw=tw;const iw=(t,e,n=0)=>(t[0]=e[0],t[1]=e[1],t[2]=n,t);var sw=iw;const rw=t=>{const e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)};var zm=rw;const ow=(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 aw=ow;const cw=(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 lw=cw;const uw=(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 fw=uw;const hw=(t,e,n)=>(t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t);var dw=hw;const pw=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t);var mw=pw;const gw=(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 Xl=gw;const _w=Nm,vw=ha,xw=kr,Mw=(t,e)=>{const n=_w(vw(),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 yw=Sw;const bw=(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 Tw=bw;const ww=(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 Aw=ww;const Rw=(t,e,n)=>(t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t);var Hm=Rw;const Pw=(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 Cw=Pw;const Lw=(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 Vm=Lw;const Dw=t=>{const e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i};var Gm=Dw;const Uw=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t);var da=Uw;const Iw=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)}]`;var Nw=Iw;const Fw=(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 Ow=Fw,$e={abs:Nm,add:Fm,angle:HT,clone:kT,copy:Om,create:ha,cross:kr,distance:Bm,divide:jT,dot:fa,equals:ZT,fromScalar:QT,fromValues:nw,fromVec2:sw,length:zm,lerp:aw,max:lw,min:fw,multiply:dw,negate:mw,normalize:Xl,orthogonal:Ew,rotateX:yw,rotateY:Tw,rotateZ:Aw,scale:Hm,snap:Cw,squaredDistance:Vm,squaredLength:Gm,subtract:da,toString:Nw,transform:Ow};const mi=$e,Bw=Im,zw=(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 Bw(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 Hw=zw;const{sin:Vw,cos:Gw}=qt,$w=(t,e)=>{const n=Vw(e),i=Gw(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 kw=$w;const{sin:Ww,cos:Xw}=qt,qw=(t,e)=>{const n=Ww(e),i=Xw(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 Yw=qw;const{sin:jw,cos:Kw}=qt,Zw=(t,e)=>{const n=jw(e),i=Kw(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 Jw=Zw;const Qw=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 eA=Qw;const tA=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 sA=iA;const rA=(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 oA=rA;const aA=(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],u=e[7],f=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*f+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*u+M*_+b*y,E=n[4],v=n[5],M=n[6],b=n[7],t[4]=E*i+v*a+M*f+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*u+M*_+b*y,E=n[8],v=n[9],M=n[10],b=n[11],t[8]=E*i+v*a+M*f+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*u+M*_+b*y,E=n[12],v=n[13],M=n[14],b=n[15],t[12]=E*i+v*a+M*f+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*u+M*_+b*y,t};var cA=aA;const{EPS:lA}=Qe,{sin:uA,cos:fA}=qt,hA=Dm,dA=(t,e,n,i)=>{let[s,r,o]=i;const a=s*s+r*r+o*o;if(Math.abs(a){const i=mA(n),s=gA(n),r=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],f=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+u*i,t[6]=a*s+f*i,t[7]=c*s+h*i,t[8]=l*s-r*i,t[9]=u*s-o*i,t[10]=f*s-a*i,t[11]=h*s-c*i,t};var vA=_A;const{sin:xA,cos:MA}=qt,EA=(t,e,n)=>{const i=xA(n),s=MA(n),r=e[0],o=e[1],a=e[2],c=e[3],l=e[8],u=e[9],f=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-u*i,t[2]=a*s-f*i,t[3]=c*s-h*i,t[8]=r*i+l*s,t[9]=o*i+u*s,t[10]=a*i+f*s,t[11]=c*i+h*s,t};var SA=EA;const{sin:yA,cos:bA}=qt,TA=(t,e,n)=>{const i=yA(n),s=bA(n),r=e[0],o=e[1],a=e[2],c=e[3],l=e[4],u=e[5],f=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+u*i,t[2]=a*s+f*i,t[3]=c*s+h*i,t[4]=l*s-r*i,t[5]=u*s-o*i,t[6]=f*s-a*i,t[7]=h*s-c*i,t};var wA=TA;const AA=(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 RA=AA;const PA=(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 CA=PA;const LA=t=>t.map(e=>e.toFixed(7)).toString();var DA=LA;const UA=(t,e,n)=>{const i=n[0],s=n[1],r=n[2];let o,a,c,l,u,f,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],u=e[4],f=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]=u,t[5]=f,t[6]=h,t[7]=d,t[8]=_,t[9]=g,t[10]=m,t[11]=p,t[12]=o*i+u*s+_*r+e[12],t[13]=a*i+f*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 IA=UA,ut={add:uT,clone:pT,copy:Dm,create:Wl,invert:_T,equals:xT,fromRotation:Im,fromScaling:AT,fromTaitBryanRotation:PT,fromTranslation:LT,fromValues:IT,fromVectorRotation:Hw,fromXRotation:kw,fromYRotation:Yw,fromZRotation:Jw,identity:Um,isIdentity:eA,isOnlyTransformScale:nA,isMirroring:sA,mirrorByPlane:oA,multiply:cA,rotate:pA,rotateX:vA,rotateY:SA,rotateZ:wA,scale:RA,subtract:CA,toString:DA,translate:IA};const NA=ut,FA=t=>(t===void 0&&(t=[]),{points:t,isClosed:!1,transforms:NA.create()});var pa=FA;const{EPS:hh}=Qe,dh=Xe,OA=Lm,BA=pa,zA=(t,e)=>{const n={closed:!1};let{closed:i}=Object.assign({},n,t),s=BA();if(s.points=e.map(r=>dh.clone(r)),s.points.length>1){const r=s.points[0],o=s.points[s.points.length-1];dh.distance(r,o)(ph.isIdentity(t.transforms)||(t.points=t.points.map(e=>mh.transform(mh.create(),e,t.transforms)),t.transforms=ph.create()),t);var VA=HA;const GA=VA,$A=t=>GA(t).points;var js=$A;const{TAU:Mo}=Qe,dt=Xe,kA=ql,WA=js,XA=(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=dt.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 u=WA(e);if(u.length<1)throw new Error("the given path must contain one or more points (as the starting point for the arc)");let f=s[0],h=s[1];const d=u[u.length-1];f=Math.round(f*l)/l,h=Math.round(h*l)/l,i=dt.fromValues(Math.round(i[0]*l)/l,Math.round(i[1]*l)/l);const _=!o;let g=[];if(f===0||h===0)g.push(i);else{f=Math.abs(f),h=Math.abs(h);const p=r,y=Math.cos(p),E=Math.sin(p),v=dt.subtract(dt.create(),d,i);dt.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=dt.fromValues(M,b),D=w[0]*w[0]/(f*f)+w[1]*w[1]/(h*h);if(D>1){const W=Math.sqrt(D);f*=W,h*=W,f=Math.round(f*l)/l,h=Math.round(h*l)/l}let x=Math.sqrt((f*f*h*h-f*f*w[1]*w[1]-h*h*w[0]*w[0])/(f*f*w[1]*w[1]+h*h*w[0]*w[0]));_===a&&(x=-x);const T=dt.fromValues(f*w[1]/h,-h*w[0]/f);dt.scale(T,T,x);let I=dt.fromValues(y*T[0]-E*T[1],E*T[0]+y*T[1]);I=dt.add(I,I,dt.scale(dt.create(),dt.add(dt.create(),d,i),.5));const z=dt.fromValues((w[0]-T[0])/f,(w[1]-T[1])/h),U=dt.fromValues((-w[0]-T[0])/f,(-w[1]-T[1])/h),O=dt.angleRadians(z);let G=dt.angleRadians(U)-O;G=G%Mo,!_&&G>0?G-=Mo:_&&G<0&&(G+=Mo);let k=Math.ceil(Math.abs(G)/Mo*c)+1;k<1&&(k=1);for(let W=1;W{let e=!1,n=[];return t.forEach((i,s)=>{const r=jA(i).slice();if(n.length>0&&r.length>0&&KA(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)}),YA({closed:e},n)};var $m=ZA;const JA=$m,QA=pa,e2=(t,e)=>JA(e,QA(t));var km=e2;const{TAU:t2}=Qe,en=Xe,n2=Xe,i2=km,s2=js,r2=(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=s2(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 u=[];for(let b=0;b<=a;++b){const w=c[a]/(c[b]*c[a-b]);u.push(w)}const f=en.create(),h=en.create(),d=n2.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 z=u[I]*w*D,U=en.scale(f,i[I],z);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,z=x+(T-x)*2/3,U=_(I),O=_(z);g.splice(y,1,U,O),m.splice(y,1,I,z),y--,y<1&&(y=1)}else++y}g.shift();const M=i2(g,e);return M.lastBezierControlPoint=i[i.length-2],M};var o2=r2;const a2=Xe,gh=js,c2=(t,e)=>{if(t.isClosed!==e.isClosed||t.points.length!==e.points.length)return!1;const n=gh(t),i=gh(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=h2();e.transforms=u2.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=d2;const m2=t=>!!(t&&typeof t=="object"&&"points"in t&&"transforms"in t&&"isClosed"in t&&Array.isArray(t.points)&&"length"in t.transforms);var Wm=m2;const g2=kl,_2=t=>{const e=g2(t);return e.points=t.points.slice().reverse(),e};var v2=_2;const x2=Xe,M2=js,E2=t=>{const e=M2(t);let n="path ("+e.length+" points, "+t.isClosed+`): +}`;function gy(t,e,n){let i=new Gl;const s=new Ge,r=new Ge,o=new bt,a=new hy({depthPacking:Mx}),c=new dy,l={},u=n.maxTextureSize,f={[bi]:jt,[jt]:bi,[ni]:ni},h=new Qi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ge},radius:{value:4}},vertexShader:py,fragmentShader:my}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const _=new ai;_.setAttribute("position",new un(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=Jp;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 z=p!==Zn&&this.type===Zn,U=p===Zn&&this.type!==Zn;for(let O=0,H=M.length;Ou||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/W.x),s.x=r.x*W.x,k.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/W.y),s.y=r.y*W.y,k.mapSize.y=r.y)),k.map===null||z===!0||U===!0){const oe=this.type!==Zn?{minFilter:Gt,magFilter:Gt}:{};k.map!==null&&k.map.dispose(),k.map=new Zi(s.x,s.y,oe),k.map.texture.name=G.name+".shadowMap",k.camera.updateProjectionMatrix()}t.setRenderTarget(k.map),t.clear();const ue=k.getViewportCount();for(let oe=0;oe0||b.map&&b.alphaTest>0){const I=x.uuid,z=b.uuid;let U=l[I];U===void 0&&(U={},l[I]=U);let O=U[z];O===void 0&&(O=x.clone(),U[z]=O),x=O}if(x.visible=b.visible,x.wireframe=b.wireframe,D===Zn?x.side=b.shadowSide!==null?b.shadowSide:b.side:x.side=b.shadowSide!==null?b.shadowSide:f[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===Zn)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,M.matrixWorld);const z=e.update(M),U=M.material;if(Array.isArray(U)){const O=z.groups;for(let H=0,G=O.length;H=1):W.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(W)[1]),G=k>=2);let ue=null,oe={};const Te=t.getParameter(t.SCISSOR_BOX),fe=t.getParameter(t.VIEWPORT),K=new bt().fromArray(Te),ce=new bt().fromArray(fe);function _e(F,ee,pe,be){const Re=new Uint8Array(4),et=t.createTexture();t.bindTexture(F,et),t.texParameteri(F,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(F,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):jo("canvas")}function E(A,S,B,j){let Z=1;if((A.width>j||A.height>j)&&(Z=j/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 he=S?bx:Math.floor,L=he(Z*A.width),J=he(Z*A.height);g===void 0&&(g=y(L,J));const X=B?y(L,J):g;return X.width=L,X.height=J,X.getContext("2d").drawImage(A,0,0,L,J),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+L+"x"+J+")."),X}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 Mf(A.width)&&Mf(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,B,j,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 he=S;return S===t.RED&&(B===t.FLOAT&&(he=t.R32F),B===t.HALF_FLOAT&&(he=t.R16F),B===t.UNSIGNED_BYTE&&(he=t.R8)),S===t.RG&&(B===t.FLOAT&&(he=t.RG32F),B===t.HALF_FLOAT&&(he=t.RG16F),B===t.UNSIGNED_BYTE&&(he=t.RG8)),S===t.RGBA&&(B===t.FLOAT&&(he=t.RGBA32F),B===t.HALF_FLOAT&&(he=t.RGBA16F),B===t.UNSIGNED_BYTE&&(he=j===ze&&Z===!1?t.SRGB8_ALPHA8:t.RGBA8),B===t.UNSIGNED_SHORT_4_4_4_4&&(he=t.RGBA4),B===t.UNSIGNED_SHORT_5_5_5_1&&(he=t.RGB5_A1)),(he===t.R16F||he===t.R32F||he===t.RG16F||he===t.RG32F||he===t.RGBA16F||he===t.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function x(A,S,B){return b(A,B)===!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===qu||A===Ba?t.NEAREST:t.LINEAR}function I(A){const S=A.target;S.removeEventListener("dispose",I),U(S),S.isVideoTexture&&_.delete(S)}function z(A){const S=A.target;S.removeEventListener("dispose",z),H(S)}function U(A){const S=i.get(A);if(S.__webglInit===void 0)return;const B=A.source,j=m.get(B);if(j){const Z=j[S.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&O(A),Object.keys(j).length===0&&m.delete(B)}i.remove(A)}function O(A){const S=i.get(A);t.deleteTexture(S.__webglTexture);const B=A.source,j=m.get(B);delete j[S.__cacheKey],o.memory.textures--}function H(A){const S=A.texture,B=i.get(A),j=i.get(S);if(j.__webglTexture!==void 0&&(t.deleteTexture(j.__webglTexture),o.memory.textures--),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++)t.deleteFramebuffer(B.__webglFramebuffer[Z]),B.__webglDepthbuffer&&t.deleteRenderbuffer(B.__webglDepthbuffer[Z]);else{if(t.deleteFramebuffer(B.__webglFramebuffer),B.__webglDepthbuffer&&t.deleteRenderbuffer(B.__webglDepthbuffer),B.__webglMultisampledFramebuffer&&t.deleteFramebuffer(B.__webglMultisampledFramebuffer),B.__webglColorRenderbuffer)for(let Z=0;Z=c&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+c),G+=1,A}function ue(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 oe(A,S){const B=i.get(A);if(A.isVideoTexture&&le(A),A.isRenderTargetTexture===!1&&A.version>0&&B.__version!==A.version){const j=A.image;if(j===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(j.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ie(B,A,S);return}}n.bindTexture(t.TEXTURE_2D,B.__webglTexture,t.TEXTURE0+S)}function Te(A,S){const B=i.get(A);if(A.version>0&&B.__version!==A.version){Ie(B,A,S);return}n.bindTexture(t.TEXTURE_2D_ARRAY,B.__webglTexture,t.TEXTURE0+S)}function fe(A,S){const B=i.get(A);if(A.version>0&&B.__version!==A.version){Ie(B,A,S);return}n.bindTexture(t.TEXTURE_3D,B.__webglTexture,t.TEXTURE0+S)}function K(A,S){const B=i.get(A);if(A.version>0&&B.__version!==A.version){De(B,A,S);return}n.bindTexture(t.TEXTURE_CUBE_MAP,B.__webglTexture,t.TEXTURE0+S)}const ce={[rl]:t.REPEAT,[yn]:t.CLAMP_TO_EDGE,[ol]:t.MIRRORED_REPEAT},_e={[Gt]:t.NEAREST,[qu]:t.NEAREST_MIPMAP_NEAREST,[Ba]:t.NEAREST_MIPMAP_LINEAR,[dn]:t.LINEAR,[ix]:t.LINEAR_MIPMAP_NEAREST,[Ir]:t.LINEAR_MIPMAP_LINEAR};function xe(A,S,B){if(B?(t.texParameteri(A,t.TEXTURE_WRAP_S,ce[S.wrapS]),t.texParameteri(A,t.TEXTURE_WRAP_T,ce[S.wrapT]),(A===t.TEXTURE_3D||A===t.TEXTURE_2D_ARRAY)&&t.texParameteri(A,t.TEXTURE_WRAP_R,ce[S.wrapR]),t.texParameteri(A,t.TEXTURE_MAG_FILTER,_e[S.magFilter]),t.texParameteri(A,t.TEXTURE_MIN_FILTER,_e[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 j=e.get("EXT_texture_filter_anisotropic");if(S.magFilter===Gt||S.minFilter!==Ba&&S.minFilter!==Ir||S.type===ki&&e.has("OES_texture_float_linear")===!1||a===!1&&S.type===Nr&&e.has("OES_texture_half_float_linear")===!1)return;(S.anisotropy>1||i.get(S).__currentAnisotropy)&&(t.texParameterf(A,j.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,s.getMaxAnisotropy())),i.get(S).__currentAnisotropy=S.anisotropy)}}function N(A,S){let B=!1;A.__webglInit===void 0&&(A.__webglInit=!0,S.addEventListener("dispose",I));const j=S.source;let Z=m.get(j);Z===void 0&&(Z={},m.set(j,Z));const he=ue(S);if(he!==A.__cacheKey){Z[he]===void 0&&(Z[he]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,B=!0),Z[he].usedTimes++;const L=Z[A.__cacheKey];L!==void 0&&(Z[A.__cacheKey].usedTimes--,L.usedTimes===0&&O(S)),A.__cacheKey=he,A.__webglTexture=Z[he].texture}return B}function Ie(A,S,B){let j=t.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(j=t.TEXTURE_2D_ARRAY),S.isData3DTexture&&(j=t.TEXTURE_3D);const Z=N(A,S),he=S.source;n.bindTexture(j,A.__webglTexture,t.TEXTURE0+B);const L=i.get(he);if(he.version!==L.__version||Z===!0){n.activeTexture(t.TEXTURE0+B),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 J=M(S)&&v(S.image)===!1;let X=E(S.image,J,!1,u);X=ae(S,X);const ge=v(X)||a,Ee=r.convert(S.format,S.colorSpace);let we=r.convert(S.type),ye=D(S.internalFormat,Ee,we,S.colorSpace);xe(j,S,ge);let Se;const Pe=S.mipmaps,Fe=a&&S.isVideoTexture!==!0,at=L.__version===void 0||Z===!0,F=x(S,X,ge);if(S.isDepthTexture)ye=t.DEPTH_COMPONENT,a?S.type===ki?ye=t.DEPTH_COMPONENT32F:S.type===$i?ye=t.DEPTH_COMPONENT24:S.type===Fs?ye=t.DEPTH24_STENCIL8:ye=t.DEPTH_COMPONENT16:S.type===ki&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),S.format===qi&&ye===t.DEPTH_COMPONENT&&S.type!==im&&S.type!==$i&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),S.type=$i,we=r.convert(S.type)),S.format===Gs&&ye===t.DEPTH_COMPONENT&&(ye=t.DEPTH_STENCIL,S.type!==Fs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),S.type=Fs,we=r.convert(S.type))),at&&(Fe?n.texStorage2D(t.TEXTURE_2D,1,ye,X.width,X.height):n.texImage2D(t.TEXTURE_2D,0,ye,X.width,X.height,0,Ee,we,null));else if(S.isDataTexture)if(Pe.length>0&&ge){Fe&&at&&n.texStorage2D(t.TEXTURE_2D,F,ye,Pe[0].width,Pe[0].height);for(let ee=0,pe=Pe.length;ee>=1,pe>>=1}}else if(Pe.length>0&&ge){Fe&&at&&n.texStorage2D(t.TEXTURE_2D,F,ye,Pe[0].width,Pe[0].height);for(let ee=0,pe=Pe.length;ee0&&at++,n.texStorage2D(t.TEXTURE_CUBE_MAP,at,Se,X[0].width,X[0].height));for(let ee=0;ee<6;ee++)if(J){Pe?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,X[ee].width,X[ee].height,we,ye,X[ee].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Se,X[ee].width,X[ee].height,0,we,ye,X[ee].data);for(let pe=0;pe=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,j,Z,i.get(B).__webglTexture,0),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Le(A,S,B){if(t.bindRenderbuffer(t.RENDERBUFFER,A),S.depthBuffer&&!S.stencilBuffer){let j=t.DEPTH_COMPONENT16;if(B||re(S)){const Z=S.depthTexture;Z&&Z.isDepthTexture&&(Z.type===ki?j=t.DEPTH_COMPONENT32F:Z.type===$i&&(j=t.DEPTH_COMPONENT24));const he=de(S);re(S)?h.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,he,j,S.width,S.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,he,j,S.width,S.height)}else t.renderbufferStorage(t.RENDERBUFFER,j,S.width,S.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,A)}else if(S.depthBuffer&&S.stencilBuffer){const j=de(S);B&&re(S)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,j,t.DEPTH24_STENCIL8,S.width,S.height):re(S)?h.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,j,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 j=S.isWebGLMultipleRenderTargets===!0?S.texture:[S.texture];for(let Z=0;Z0&&re(A)===!1){const J=he?S:[S];B.__webglMultisampledFramebuffer=t.createFramebuffer(),B.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let X=0;X0&&re(A)===!1){const S=A.isWebGLMultipleRenderTargets?A.texture:[A.texture],B=A.width,j=A.height;let Z=t.COLOR_BUFFER_BIT;const he=[],L=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,J=i.get(A),X=A.isWebGLMultipleRenderTargets===!0;if(X)for(let ge=0;ge0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function le(A){const S=o.render.frame;_.get(A)!==S&&(_.set(A,S),A.update())}function ae(A,S){const B=A.colorSpace,j=A.format,Z=A.type;return A.isCompressedTexture===!0||A.format===al||B!==Bn&&B!==ji&&(B===ze?a===!1?e.has("EXT_sRGB")===!0&&j===bn?(A.format=al,A.minFilter=dn,A.generateMipmaps=!1):S=cm.sRGBToLinear(S):(j!==bn||Z!==Ki)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),S}this.allocateTextureUnit=W,this.resetTextureUnits=k,this.setTexture2D=oe,this.setTexture2DArray=Te,this.setTexture3D=fe,this.setTextureCube=K,this.rebindTextures=V,this.setupRenderTarget=ie,this.updateRenderTargetMipmap=Q,this.updateMultisampleRenderTarget=se,this.setupDepthRenderbuffer=C,this.setupFrameBufferTexture=me,this.useMultisampledRTT=re}function xy(t,e,n){const i=n.isWebGL2;function s(r,o=ji){let a;if(r===Ki)return t.UNSIGNED_BYTE;if(r===ax)return t.UNSIGNED_SHORT_4_4_4_4;if(r===cx)return t.UNSIGNED_SHORT_5_5_5_1;if(r===sx)return t.BYTE;if(r===rx)return t.SHORT;if(r===im)return t.UNSIGNED_SHORT;if(r===ox)return t.INT;if(r===$i)return t.UNSIGNED_INT;if(r===ki)return t.FLOAT;if(r===Nr)return i?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===lx)return t.ALPHA;if(r===bn)return t.RGBA;if(r===ux)return t.LUMINANCE;if(r===fx)return t.LUMINANCE_ALPHA;if(r===qi)return t.DEPTH_COMPONENT;if(r===Gs)return t.DEPTH_STENCIL;if(r===al)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===hx)return t.RED;if(r===dx)return t.RED_INTEGER;if(r===px)return t.RG;if(r===mx)return t.RG_INTEGER;if(r===gx)return t.RGBA_INTEGER;if(r===za||r===Ha||r===Va||r===Ga)if(o===ze)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===za)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Ha)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Va)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Ga)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===za)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Ha)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Va)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Ga)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Yu||r===ju||r===Ku||r===Zu)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===Yu)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===ju)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Ku)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Zu)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===_x)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===Ju||r===Qu)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===Ju)return o===ze?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===Qu)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===ef||r===tf||r===nf||r===sf||r===rf||r===of||r===af||r===cf||r===lf||r===uf||r===ff||r===hf||r===df||r===pf)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===ef)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===tf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===nf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===sf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===rf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===of)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===af)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===cf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===lf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===uf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===ff)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===hf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===df)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===pf)return o===ze?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===$a)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===$a)return o===ze?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===vx||r===mf||r===gf||r===_f)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===$a)return a.COMPRESSED_RED_RGTC1_EXT;if(r===mf)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===gf)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===_f)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Fs?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 My extends pn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Eo extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ey={type:"move"};class dc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Eo,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 Eo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Eo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),this._grip}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 u=l.joints["index-finger-tip"],f=l.joints["thumb-tip"],h=u.position.distanceTo(f.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(Ey)))}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 Eo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class Sy extends ln{constructor(e,n,i,s,r,o,a,c,l,u){if(u=u!==void 0?u:qi,u!==qi&&u!==Gs)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===qi&&(i=$i),i===void 0&&u===Gs&&(i=Fs),super(null,s,r,o,a,c,u,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 yy extends ts{constructor(e,n){super();const i=this;let s=null,r=1,o=null,a="local-floor",c=1,l=null,u=null,f=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 My;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(K){let ce=y[K];return ce===void 0&&(ce=new dc,y[K]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(K){let ce=y[K];return ce===void 0&&(ce=new dc,y[K]=ce),ce.getGripSpace()},this.getHand=function(K){let ce=y[K];return ce===void 0&&(ce=new dc,y[K]=ce),ce.getHandSpace()};function z(K){const ce=E.indexOf(K.inputSource);if(ce===-1)return;const _e=y[ce];_e!==void 0&&(_e.update(K.inputSource,K.frame,l||o),_e.dispatchEvent({type:K.type,data:K.inputSource}))}function U(){s.removeEventListener("select",z),s.removeEventListener("selectstart",z),s.removeEventListener("selectend",z),s.removeEventListener("squeeze",z),s.removeEventListener("squeezestart",z),s.removeEventListener("squeezeend",z),s.removeEventListener("end",U),s.removeEventListener("inputsourceschange",O);for(let K=0;K=0&&(E[xe]=null,y[xe].disconnect(_e))}for(let ce=0;ce=E.length){E.push(_e),xe=Ie;break}else if(E[Ie]===null){E[Ie]=_e,xe=Ie;break}if(xe===-1)break}const N=y[xe];N&&N.connect(_e)}}const H=new Y,G=new Y;function k(K,ce,_e){H.setFromMatrixPosition(ce.matrixWorld),G.setFromMatrixPosition(_e.matrixWorld);const xe=H.distanceTo(G),N=ce.projectionMatrix.elements,Ie=_e.projectionMatrix.elements,De=N[14]/(N[10]-1),me=N[14]/(N[10]+1),Le=(N[9]+1)/N[5],P=(N[9]-1)/N[5],C=(N[8]-1)/N[0],V=(Ie[8]+1)/Ie[0],ie=De*C,Q=De*V,se=xe/(-C+V),de=se*-C;ce.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(de),K.translateZ(se),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();const re=De+se,le=me+se,ae=ie-de,A=Q+(xe-de),S=Le*me/le*re,B=P*me/le*re;K.projectionMatrix.makePerspective(ae,A,S,B,re,le),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function W(K,ce){ce===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(ce.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(s===null)return;x.near=w.near=b.near=K.near,x.far=w.far=b.far=K.far,(T!==x.near||I!==x.far)&&(s.updateRenderState({depthNear:x.near,depthFar:x.far}),T=x.near,I=x.far);const ce=K.parent,_e=x.cameras;W(x,ce);for(let xe=0;xe<_e.length;xe++)W(_e[xe],ce);_e.length===2?k(x,b,w):x.projectionMatrix.copy(b.projectionMatrix),ue(K,x,ce)};function ue(K,ce,_e){_e===null?K.matrix.copy(ce.matrixWorld):(K.matrix.copy(_e.matrixWorld),K.matrix.invert(),K.matrix.multiply(ce.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0);const xe=K.children;for(let N=0,Ie=xe.length;NN&&(M.set(xe,xe.lastChangedTime),i.dispatchEvent({type:"planechanged",data:xe}))}}_=null}const fe=new xm;fe.setAnimationLoop(Te),this.setAnimationLoop=function(K){oe=K},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,gm(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),f(m,p)):p.isMeshPhongMaterial?(r(m,p),u(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===jt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,n(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===jt&&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 u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function f(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===jt&&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 Ty(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=u(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 u(y){const E=f();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 f(){for(let y=0;y0){b=v%M;const z=M-b;b!==0&&z-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 wy(){const t=jo("canvas");return t.style.display="block",t}class Tm{constructor(e={}){const{canvas:n=wy(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!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=ze,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,z=n.height,U=1,O=null,H=null;const G=new bt(0,0,I,z),k=new bt(0,0,I,z);let W=!1;const ue=new Gl;let oe=!1,Te=!1,fe=null;const K=new _t,ce=new Y,_e={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return M===null?U:1}let N=i;function Ie(R,q){for(let te=0;te0?_=m[m.length-1]:_=null,g.pop(),g.length>0?d=g[g.length-1]:d=null};function Pt(R,q,te,$){if(R.visible===!1)return;if(R.layers.test(q.layers)){if(R.isGroup)te=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(q);else if(R.isLight)_.pushLight(R),R.castShadow&&_.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||ue.intersectsSprite(R)){$&&ce.setFromMatrixPosition(R.matrixWorld).applyMatrix4(K);const Ue=re.update(R),Ne=R.material;Ne.visible&&d.push(R,Ue,Ne,te,ce.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||ue.intersectsObject(R))){R.isSkinnedMesh&&R.skeleton.frame!==P.render.frame&&(R.skeleton.update(),R.skeleton.frame=P.render.frame);const Ue=re.update(R),Ne=R.material;if($&&(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),ce.copy(Ue.boundingSphere.center).applyMatrix4(R.matrixWorld).applyMatrix4(K)),Array.isArray(Ne)){const He=Ue.groups;for(let ke=0,We=He.length;ke0&&ct(ne,Ce,q,te),$&&Le.viewport(D.copy($)),ne.length>0&&fn(ne,q,te),Ce.length>0&&fn(Ce,q,te),Ue.length>0&&fn(Ue,q,te),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function ct(R,q,te,$){if(fe===null){const Ne=me.isWebGL2;fe=new Zi(1024,1024,{generateMipmaps:!0,type:De.has("EXT_color_buffer_half_float")?Nr:Ki,minFilter:Ir,samples:Ne&&a===!0?4:0})}const ne=p.getRenderTarget();p.setRenderTarget(fe),p.clear();const Ce=p.toneMapping;p.toneMapping=ri,fn(R,te,$),V.updateMultisampleRenderTarget(fe),V.updateRenderTargetMipmap(fe);let Ue=!1;for(let Ne=0,He=q.length;Ne0&&V.useMultisampledRTT(R)===!1?ne=C.get(R).__webglMultisampledFramebuffer:ne=We,D.copy(R.viewport),x.copy(R.scissor),T=R.scissorTest}else D.copy(G).multiplyScalar(U).floor(),x.copy(k).multiplyScalar(U).floor(),T=W;if(Le.bindFramebuffer(N.FRAMEBUFFER,ne)&&me.drawBuffers&&$&&Le.drawBuffers(R,ne),Le.viewport(D),Le.scissor(x),Le.setScissorTest(T),Ce){const He=C.get(R.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_CUBE_MAP_POSITIVE_X+q,He.__webglTexture,te)}else if(Ue){const He=C.get(R.texture),ke=q||0;N.framebufferTextureLayer(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,He.__webglTexture,te||0,ke)}b=-1},this.readRenderTargetPixels=function(R,q,te,$,ne,Ce,Ue){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ne=C.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&Ue!==void 0&&(Ne=Ne[Ue]),Ne){Le.bindFramebuffer(N.FRAMEBUFFER,Ne);try{const He=R.texture,ke=He.format,We=He.type;if(ke!==bn&&X.convert(ke)!==N.getParameter(N.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const qe=We===Nr&&(De.has("EXT_color_buffer_half_float")||me.isWebGL2&&De.has("EXT_color_buffer_float"));if(We!==Ki&&X.convert(We)!==N.getParameter(N.IMPLEMENTATION_COLOR_READ_TYPE)&&!(We===ki&&(me.isWebGL2||De.has("OES_texture_float")||De.has("WEBGL_color_buffer_float")))&&!qe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q>=0&&q<=R.width-$&&te>=0&&te<=R.height-ne&&N.readPixels(q,te,$,ne,X.convert(ke),X.convert(We),Ce)}finally{const He=M!==null?C.get(M).__webglFramebuffer:null;Le.bindFramebuffer(N.FRAMEBUFFER,He)}}},this.copyFramebufferToTexture=function(R,q,te=0){const $=Math.pow(2,-te),ne=Math.floor(q.image.width*$),Ce=Math.floor(q.image.height*$);V.setTexture2D(q,0),N.copyTexSubImage2D(N.TEXTURE_2D,te,0,0,R.x,R.y,ne,Ce),Le.unbindTexture()},this.copyTextureToTexture=function(R,q,te,$=0){const ne=q.image.width,Ce=q.image.height,Ue=X.convert(te.format),Ne=X.convert(te.type);V.setTexture2D(te,0),N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,te.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,te.unpackAlignment),q.isDataTexture?N.texSubImage2D(N.TEXTURE_2D,$,R.x,R.y,ne,Ce,Ue,Ne,q.image.data):q.isCompressedTexture?N.compressedTexSubImage2D(N.TEXTURE_2D,$,R.x,R.y,q.mipmaps[0].width,q.mipmaps[0].height,Ue,q.mipmaps[0].data):N.texSubImage2D(N.TEXTURE_2D,$,R.x,R.y,Ue,Ne,q.image),$===0&&te.generateMipmaps&&N.generateMipmap(N.TEXTURE_2D),Le.unbindTexture()},this.copyTextureToTexture3D=function(R,q,te,$,ne=0){if(p.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ce=R.max.x-R.min.x+1,Ue=R.max.y-R.min.y+1,Ne=R.max.z-R.min.z+1,He=X.convert($.format),ke=X.convert($.type);let We;if($.isData3DTexture)V.setTexture3D($,0),We=N.TEXTURE_3D;else if($.isDataArrayTexture)V.setTexture2DArray($,0),We=N.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,$.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,$.unpackAlignment);const qe=N.getParameter(N.UNPACK_ROW_LENGTH),Ze=N.getParameter(N.UNPACK_IMAGE_HEIGHT),Nt=N.getParameter(N.UNPACK_SKIP_PIXELS),gn=N.getParameter(N.UNPACK_SKIP_ROWS),Ai=N.getParameter(N.UNPACK_SKIP_IMAGES),ht=te.isCompressedTexture?te.mipmaps[0]:te.image;N.pixelStorei(N.UNPACK_ROW_LENGTH,ht.width),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,ht.height),N.pixelStorei(N.UNPACK_SKIP_PIXELS,R.min.x),N.pixelStorei(N.UNPACK_SKIP_ROWS,R.min.y),N.pixelStorei(N.UNPACK_SKIP_IMAGES,R.min.z),te.isDataTexture||te.isData3DTexture?N.texSubImage3D(We,ne,q.x,q.y,q.z,Ce,Ue,Ne,He,ke,ht.data):te.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),N.compressedTexSubImage3D(We,ne,q.x,q.y,q.z,Ce,Ue,Ne,He,ht.data)):N.texSubImage3D(We,ne,q.x,q.y,q.z,Ce,Ue,Ne,He,ke,ht),N.pixelStorei(N.UNPACK_ROW_LENGTH,qe),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,Ze),N.pixelStorei(N.UNPACK_SKIP_PIXELS,Nt),N.pixelStorei(N.UNPACK_SKIP_ROWS,gn),N.pixelStorei(N.UNPACK_SKIP_IMAGES,Ai),ne===0&&$.generateMipmaps&&N.generateMipmap(We),Le.unbindTexture()},this.initTexture=function(R){R.isCubeTexture?V.setTextureCube(R,0):R.isData3DTexture?V.setTexture3D(R,0):R.isDataArrayTexture||R.isCompressedArrayTexture?V.setTexture2DArray(R,0):V.setTexture2D(R,0),Le.unbindTexture()},this.resetState=function(){E=0,v=0,M=null,Le.reset(),ge.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===ze?Yi:sm}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Yi?ze:Bn}}class Ay extends Tm{}Ay.prototype.isWebGL1Renderer=!0;class Ry 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 Py extends Gr{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=rm,this.normalScale=new Ge(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 sh={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 Cy{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(u){a++,r===!1&&s.onStart!==void 0&&s.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,s.onProgress!==void 0&&s.onProgress(u,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(u){s.onError!==void 0&&s.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,f){return l.push(u,f),this},this.removeHandler=function(u){const f=l.indexOf(u);return f!==-1&&l.splice(f,2),this},this.getHandler=function(u){for(let f=0,h=l.length;f{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 u=Xn[e],f=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(){f.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=u.length;b{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),h=f&&f[1]?f[1].toLowerCase():void 0,d=new TextDecoder(h);return l.arrayBuffer().then(_=>d.decode(_))}}}).then(l=>{sh.add(e,l);const u=Xn[e];delete Xn[e];for(let f=0,h=u.length;f{const u=Xn[e];if(u===void 0)throw this.manager.itemError(e),l;delete Xn[e];for(let f=0,h=u.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Am 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,rh=new Y,oh=new Y;class Iy{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ge(512,512),this.map=null,this.mapPass=null,this.matrix=new _t,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Gl,this._frameExtents=new Ge(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;rh.setFromMatrixPosition(e.matrixWorld),n.position.copy(rh),oh.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(oh),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 Ny extends Iy{constructor(){super(new Mm(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Fy extends Am{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 Ny}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Oy extends Am{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class ah{constructor(e=1,n=0,i=0){return this.radius=e,this.phi=n,this.theta=i,this}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(kt(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Hl}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Hl);class ch extends wm{constructor(e){super(e)}load(e,n,i,s){const r=this,o=new Uy(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 u=new DataView(l),f=32/8*3+32/8*3*3+16/8,h=u.getUint32(80,!0);if(80+32/8+h*f===u.byteLength)return!0;const _=[115,111,108,105,100];for(let g=0;g<5;g++)if(i(_,u,g))return!1;return!0}function i(l,u,f){for(let h=0,d=l.length;h>5&31)/31,_=(H>>10&31)/31)}for(let H=1;H<=3;H++){const G=I+H*12,k=T*3*3+(H-1)*3;D[k]=u.getFloat32(G,!0),D[k+1]=u.getFloat32(G+4,!0),D[k+2]=u.getFloat32(G+8,!0),x[k]=z,x[k+1]=U,x[k+2]=O,g&&(m[k]=h,m[k+1]=d,m[k+2]=_)}}return w.setAttribute("position",new un(D,3)),w.setAttribute("normal",new un(x,3)),g&&(w.setAttribute("color",new un(m,3)),w.hasColors=!0,w.alpha=v),w}function r(l){const u=new ai,f=/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 Y;let v,M=0,b=0,w=0;for(;(v=f.exec(l))!==null;){b=w;const D=v[0];for(;(v=h.exec(D))!==null;){let I=0,z=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]),z++;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++;z!==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;u.addGroup(x,T,M),M++}return u.setAttribute("position",new oi(p,3)),u.setAttribute("normal",new oi(y,3)),u}function o(l){return typeof l!="string"?new TextDecoder().decode(l):l}function a(l){if(typeof l=="string"){const u=new Uint8Array(l.length);for(let f=0;fMath.PI&&(Pe-=we),Fe<-Math.PI?Fe+=we:Fe>Math.PI&&(Fe-=we),Pe<=Fe?a.theta=Math.max(Pe,Math.min(Fe,a.theta)):a.theta=a.theta>(Pe+Fe)/2?Math.max(Pe,a.theta):Math.min(Fe,a.theta)),a.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=l,a.radius=Math.max(i.minDistance,Math.min(i.maxDistance,a.radius)),i.enableDamping===!0?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),L.setFromSpherical(a),L.applyQuaternion(X),Se.copy(i.target).add(L),i.object.lookAt(i.target),i.enableDamping===!0?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),u.set(0,0,0)),l=1,f||ge.distanceToSquared(i.object.position)>o||8*(1-Ee.dot(i.object.quaternion))>o?(i.dispatchEvent(lh),ge.copy(i.object.position),Ee.copy(i.object.quaternion),f=!1,!0):!1}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",S),i.domElement.removeEventListener("pointerdown",V),i.domElement.removeEventListener("pointercancel",Q),i.domElement.removeEventListener("wheel",re),i.domElement.removeEventListener("pointermove",ie),i.domElement.removeEventListener("pointerup",Q),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",le),i._domElementKeyEvents=null)};const i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=s.NONE;const o=1e-6,a=new ah,c=new ah;let l=1;const u=new Y;let f=!1;const h=new Ge,d=new Ge,_=new Ge,g=new Ge,m=new Ge,p=new Ge,y=new Ge,E=new Ge,v=new Ge,M=[],b={};function w(){return 2*Math.PI/60/60*i.autoRotateSpeed}function D(){return Math.pow(.95,i.zoomSpeed)}function x(L){c.theta-=L}function T(L){c.phi-=L}const I=function(){const L=new Y;return function(X,ge){L.setFromMatrixColumn(ge,0),L.multiplyScalar(-X),u.add(L)}}(),z=function(){const L=new Y;return function(X,ge){i.screenSpacePanning===!0?L.setFromMatrixColumn(ge,1):(L.setFromMatrixColumn(ge,0),L.crossVectors(i.object.up,L)),L.multiplyScalar(X),u.add(L)}}(),U=function(){const L=new Y;return function(X,ge){const Ee=i.domElement;if(i.object.isPerspectiveCamera){const we=i.object.position;L.copy(we).sub(i.target);let ye=L.length();ye*=Math.tan(i.object.fov/2*Math.PI/180),I(2*X*ye/Ee.clientHeight,i.object.matrix),z(2*ge*ye/Ee.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(X*(i.object.right-i.object.left)/i.object.zoom/Ee.clientWidth,i.object.matrix),z(ge*(i.object.top-i.object.bottom)/i.object.zoom/Ee.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function O(L){i.object.isPerspectiveCamera?l/=L:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*L)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function H(L){i.object.isPerspectiveCamera?l*=L:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/L)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function G(L){h.set(L.clientX,L.clientY)}function k(L){y.set(L.clientX,L.clientY)}function W(L){g.set(L.clientX,L.clientY)}function ue(L){d.set(L.clientX,L.clientY),_.subVectors(d,h).multiplyScalar(i.rotateSpeed);const J=i.domElement;x(2*Math.PI*_.x/J.clientHeight),T(2*Math.PI*_.y/J.clientHeight),h.copy(d),i.update()}function oe(L){E.set(L.clientX,L.clientY),v.subVectors(E,y),v.y>0?O(D()):v.y<0&&H(D()),y.copy(E),i.update()}function Te(L){m.set(L.clientX,L.clientY),p.subVectors(m,g).multiplyScalar(i.panSpeed),U(p.x,p.y),g.copy(m),i.update()}function fe(L){L.deltaY<0?H(D()):L.deltaY>0&&O(D()),i.update()}function K(L){let J=!1;switch(L.code){case i.keys.UP:L.ctrlKey||L.metaKey||L.shiftKey?T(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):U(0,i.keyPanSpeed),J=!0;break;case i.keys.BOTTOM:L.ctrlKey||L.metaKey||L.shiftKey?T(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):U(0,-i.keyPanSpeed),J=!0;break;case i.keys.LEFT:L.ctrlKey||L.metaKey||L.shiftKey?x(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):U(i.keyPanSpeed,0),J=!0;break;case i.keys.RIGHT:L.ctrlKey||L.metaKey||L.shiftKey?x(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):U(-i.keyPanSpeed,0),J=!0;break}J&&(L.preventDefault(),i.update())}function ce(){if(M.length===1)h.set(M[0].pageX,M[0].pageY);else{const L=.5*(M[0].pageX+M[1].pageX),J=.5*(M[0].pageY+M[1].pageY);h.set(L,J)}}function _e(){if(M.length===1)g.set(M[0].pageX,M[0].pageY);else{const L=.5*(M[0].pageX+M[1].pageX),J=.5*(M[0].pageY+M[1].pageY);g.set(L,J)}}function xe(){const L=M[0].pageX-M[1].pageX,J=M[0].pageY-M[1].pageY,X=Math.sqrt(L*L+J*J);y.set(0,X)}function N(){i.enableZoom&&xe(),i.enablePan&&_e()}function Ie(){i.enableZoom&&xe(),i.enableRotate&&ce()}function De(L){if(M.length==1)d.set(L.pageX,L.pageY);else{const X=he(L),ge=.5*(L.pageX+X.x),Ee=.5*(L.pageY+X.y);d.set(ge,Ee)}_.subVectors(d,h).multiplyScalar(i.rotateSpeed);const J=i.domElement;x(2*Math.PI*_.x/J.clientHeight),T(2*Math.PI*_.y/J.clientHeight),h.copy(d)}function me(L){if(M.length===1)m.set(L.pageX,L.pageY);else{const J=he(L),X=.5*(L.pageX+J.x),ge=.5*(L.pageY+J.y);m.set(X,ge)}p.subVectors(m,g).multiplyScalar(i.panSpeed),U(p.x,p.y),g.copy(m)}function Le(L){const J=he(L),X=L.pageX-J.x,ge=L.pageY-J.y,Ee=Math.sqrt(X*X+ge*ge);E.set(0,Ee),v.set(0,Math.pow(E.y/y.y,i.zoomSpeed)),O(v.y),y.copy(E)}function P(L){i.enableZoom&&Le(L),i.enablePan&&me(L)}function C(L){i.enableZoom&&Le(L),i.enableRotate&&De(L)}function V(L){i.enabled!==!1&&(M.length===0&&(i.domElement.setPointerCapture(L.pointerId),i.domElement.addEventListener("pointermove",ie),i.domElement.addEventListener("pointerup",Q)),B(L),L.pointerType==="touch"?ae(L):se(L))}function ie(L){i.enabled!==!1&&(L.pointerType==="touch"?A(L):de(L))}function Q(L){j(L),M.length===0&&(i.domElement.releasePointerCapture(L.pointerId),i.domElement.removeEventListener("pointermove",ie),i.domElement.removeEventListener("pointerup",Q)),i.dispatchEvent(uh),r=s.NONE}function se(L){let J;switch(L.button){case 0:J=i.mouseButtons.LEFT;break;case 1:J=i.mouseButtons.MIDDLE;break;case 2:J=i.mouseButtons.RIGHT;break;default:J=-1}switch(J){case rs.DOLLY:if(i.enableZoom===!1)return;k(L),r=s.DOLLY;break;case rs.ROTATE:if(L.ctrlKey||L.metaKey||L.shiftKey){if(i.enablePan===!1)return;W(L),r=s.PAN}else{if(i.enableRotate===!1)return;G(L),r=s.ROTATE}break;case rs.PAN:if(L.ctrlKey||L.metaKey||L.shiftKey){if(i.enableRotate===!1)return;G(L),r=s.ROTATE}else{if(i.enablePan===!1)return;W(L),r=s.PAN}break;default:r=s.NONE}r!==s.NONE&&i.dispatchEvent(mc)}function de(L){switch(r){case s.ROTATE:if(i.enableRotate===!1)return;ue(L);break;case s.DOLLY:if(i.enableZoom===!1)return;oe(L);break;case s.PAN:if(i.enablePan===!1)return;Te(L);break}}function re(L){i.enabled===!1||i.enableZoom===!1||r!==s.NONE||(L.preventDefault(),i.dispatchEvent(mc),fe(L),i.dispatchEvent(uh))}function le(L){i.enabled===!1||i.enablePan===!1||K(L)}function ae(L){switch(Z(L),M.length){case 1:switch(i.touches.ONE){case os.ROTATE:if(i.enableRotate===!1)return;ce(),r=s.TOUCH_ROTATE;break;case os.PAN:if(i.enablePan===!1)return;_e(),r=s.TOUCH_PAN;break;default:r=s.NONE}break;case 2:switch(i.touches.TWO){case os.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;N(),r=s.TOUCH_DOLLY_PAN;break;case os.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ie(),r=s.TOUCH_DOLLY_ROTATE;break;default:r=s.NONE}break;default:r=s.NONE}r!==s.NONE&&i.dispatchEvent(mc)}function A(L){switch(Z(L),r){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;De(L),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;me(L),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;P(L),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;C(L),i.update();break;default:r=s.NONE}}function S(L){i.enabled!==!1&&L.preventDefault()}function B(L){M.push(L)}function j(L){delete b[L.pointerId];for(let J=0;J(t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t);var $y=Gy;const ky=(t,e,n)=>(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t);var Wy=ky;const Xy=t=>Math.atan2(t[1],t[0]);var Wl=Xy,qy=Wl;const Yy=Wl,jy=t=>Yy(t)*57.29577951308232;var Ky=jy;const Zy=()=>[0,0];var ha=Zy;const Jy=ha,Qy=t=>{const e=Jy();return e[0]=t[0],e[1]=t[1],e};var eb=Qy;const tb=(t,e)=>(t[0]=e[0],t[1]=e[1],t);var nb=tb;const ib=(t,e,n)=>(t[0]=0,t[1]=0,t[2]=e[0]*n[1]-e[1]*n[0],t);var sb=ib;const rb=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)};var ob=rb;const ab=(t,e,n)=>(t[0]=e[0]/n[0],t[1]=e[1]/n[1],t);var cb=ab;const lb=(t,e)=>t[0]*e[0]+t[1]*e[1];var ub=lb;const fb=(t,e)=>t[0]===e[0]&&t[1]===e[1];var hb=fb;const{NEPS:db}=Qe,Rm=t=>Math.abs(t)Rm(Math.sin(t)),mb=t=>Rm(Math.cos(t));var qt={sin:pb,cos:mb};const{sin:gb,cos:_b}=qt,vb=(t,e)=>(t[0]=_b(e),t[1]=gb(e),t);var Pm=vb;const xb=Pm,Mb=(t,e)=>xb(t,e*.017453292519943295);var Eb=Mb;const Sb=(t,e)=>(t[0]=e,t[1]=e,t);var yb=Sb;const bb=ha,Tb=(t,e)=>{const n=bb();return n[0]=t,n[1]=e,n};var wb=Tb;const Ab=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]);var Rb=Ab;const Pb=(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 Cb=Pb;const Lb=(t,e,n)=>(t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t);var Db=Lb;const Ub=(t,e,n)=>(t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t);var Ib=Ub;const Nb=(t,e,n)=>(t[0]=e[0]*n[0],t[1]=e[1]*n[1],t);var Fb=Nb;const Ob=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t);var Bb=Ob;const zb=(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 Cm=zb;const{TAU:Hb}=Qe,Vb=ha,Gb=Cm,$b=(t,e)=>Gb(t,e,Vb(),Hb/4);var kb=$b;const Wb=(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 Xb=Wb;const qb=(t,e,n)=>(t[0]=e[0]*n,t[1]=e[1]*n,t);var Yb=qb;const jb=(t,e,n)=>(t[0]=Math.round(e[0]/n)*n+0,t[1]=Math.round(e[1]/n)*n+0,t);var Kb=jb;const Zb=(t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i};var Jb=Zb;const Qb=t=>{const e=t[0],n=t[1];return e*e+n*n};var eT=Qb;const tT=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t);var nT=tT;const iT=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}]`;var sT=iT;const rT=(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 oT=rT,Xe={abs:$y,add:Wy,angle:qy,angleDegrees:Ky,angleRadians:Wl,clone:eb,copy:nb,create:ha,cross:sb,distance:ob,divide:cb,dot:ub,equals:hb,fromAngleDegrees:Eb,fromAngleRadians:Pm,fromScalar:yb,fromValues:wb,length:Rb,lerp:Cb,max:Db,min:Ib,multiply:Fb,negate:Bb,normal:kb,normalize:Xb,rotate:Cm,scale:Yb,snap:Kb,squaredDistance:Jb,squaredLength:eT,subtract:nT,toString:sT,transform:oT};const aT=t=>Object.assign({},t);var Xl=aT;const{EPS:fh}=Qe,cT=Xe,lT=Xl,uT=t=>{if(t.isClosed)return t;const e=lT(t);if(e.isClosed=!0,e.points.length>1){const n=e.points,i=n[0];let s=n[n.length-1];for(;cT.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 hT=fT;const dT=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];var ql=dT;const pT=ql,mT=t=>{const e=pT();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 gT=mT;const _T=(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 Dm=_T;const vT=(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],u=e[8],f=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=u*g-f*_,x=u*m-h*_,T=u*p-d*_,I=f*m-h*g,z=f*p-d*g,U=h*p-d*m;let O=y*U-E*z+v*I+M*T-b*x+w*D;return O?(O=1/O,t[0]=(a*U-c*z+l*I)*O,t[1]=(s*z-i*U-r*I)*O,t[2]=(g*w-m*b+p*M)*O,t[3]=(h*b-f*w-d*M)*O,t[4]=(c*T-o*U-l*x)*O,t[5]=(n*U-s*T+r*x)*O,t[6]=(m*v-_*w-p*E)*O,t[7]=(u*w-h*v+d*E)*O,t[8]=(o*z-a*T+l*D)*O,t[9]=(i*T-n*z-r*D)*O,t[10]=(_*b-g*v+p*y)*O,t[11]=(f*v-u*b-d*y)*O,t[12]=(a*x-o*I-c*D)*O,t[13]=(n*I-i*x+s*D)*O,t[14]=(g*E-_*M-m*y)*O,t[15]=(u*M-f*E+h*y)*O,t):null};var xT=vT;const MT=(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 ET=MT;const ST=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 Um=ST;const{EPS:yT}=Qe,{sin:bT,cos:TT}=qt,wT=Um,AT=(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 PT=RT;const{sin:gc,cos:_c}=qt,CT=(t,e,n,i)=>{const s=gc(e),r=_c(e),o=gc(n),a=_c(n),c=gc(i),l=_c(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 LT=CT;const DT=(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 UT=DT;const IT=ql,NT=(t,e,n,i,s,r,o,a,c,l,u,f,h,d,_,g)=>{const m=IT();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]=u,m[11]=f,m[12]=h,m[13]=d,m[14]=_,m[15]=g,m};var FT=NT;const OT=(t,e)=>(t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t);var Nm=OT;const BT=(t,e,n)=>(t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t);var Fm=BT;const zT=(t,e)=>t[0]*e[0]+t[1]*e[1]+t[2]*e[2];var da=zT;const HT=da,VT=(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),u=c*l,f=u&&HT(t,e)/u;return Math.acos(Math.min(Math.max(f,-1),1))};var GT=VT;const $T=()=>[0,0,0];var pa=$T;const kT=pa,WT=t=>{const e=kT();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e};var XT=WT;const qT=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t);var Om=qT;const YT=(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 kr=YT;const jT=(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 Bm=jT;const KT=(t,e,n)=>(t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t);var ZT=KT;const JT=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2];var QT=JT;const ew=(t,e)=>(t[0]=e,t[1]=e,t[2]=e,t);var tw=ew;const nw=pa,iw=(t,e,n)=>{const i=nw();return i[0]=t,i[1]=e,i[2]=n,i};var sw=iw;const rw=(t,e,n=0)=>(t[0]=e[0],t[1]=e[1],t[2]=n,t);var ow=rw;const aw=t=>{const e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)};var zm=aw;const cw=(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 lw=cw;const uw=(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 fw=uw;const hw=(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 dw=hw;const pw=(t,e,n)=>(t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t);var mw=pw;const gw=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t);var _w=gw;const vw=(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 Yl=vw;const xw=Nm,Mw=pa,Ew=kr,Sw=(t,e)=>{const n=xw(Mw(),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 Tw=bw;const ww=(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 Aw=ww;const Rw=(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 Pw=Rw;const Cw=(t,e,n)=>(t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t);var Hm=Cw;const Lw=(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 Dw=Lw;const Uw=(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 Vm=Uw;const Iw=t=>{const e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i};var Gm=Iw;const Nw=(t,e,n)=>(t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t);var ma=Nw;const Fw=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)}]`;var Ow=Fw;const Bw=(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 zw=Bw,$e={abs:Nm,add:Fm,angle:GT,clone:XT,copy:Om,create:pa,cross:kr,distance:Bm,divide:ZT,dot:da,equals:QT,fromScalar:tw,fromValues:sw,fromVec2:ow,length:zm,lerp:lw,max:fw,min:dw,multiply:mw,negate:_w,normalize:Yl,orthogonal:yw,rotateX:Tw,rotateY:Aw,rotateZ:Pw,scale:Hm,snap:Dw,squaredDistance:Vm,squaredLength:Gm,subtract:ma,toString:Ow,transform:zw};const mi=$e,Hw=Im,Vw=(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 Hw(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 Gw=Vw;const{sin:$w,cos:kw}=qt,Ww=(t,e)=>{const n=$w(e),i=kw(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 Xw=Ww;const{sin:qw,cos:Yw}=qt,jw=(t,e)=>{const n=qw(e),i=Yw(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 Kw=jw;const{sin:Zw,cos:Jw}=qt,Qw=(t,e)=>{const n=Zw(e),i=Jw(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 eA=Qw;const tA=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 nA=tA;const iA=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 oA=rA;const aA=(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 cA=aA;const lA=(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],u=e[7],f=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*f+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*u+M*_+b*y,E=n[4],v=n[5],M=n[6],b=n[7],t[4]=E*i+v*a+M*f+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*u+M*_+b*y,E=n[8],v=n[9],M=n[10],b=n[11],t[8]=E*i+v*a+M*f+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*u+M*_+b*y,E=n[12],v=n[13],M=n[14],b=n[15],t[12]=E*i+v*a+M*f+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*u+M*_+b*y,t};var uA=lA;const{EPS:fA}=Qe,{sin:hA,cos:dA}=qt,pA=Dm,mA=(t,e,n,i)=>{let[s,r,o]=i;const a=s*s+r*r+o*o;if(Math.abs(a){const i=_A(n),s=vA(n),r=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],f=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+u*i,t[6]=a*s+f*i,t[7]=c*s+h*i,t[8]=l*s-r*i,t[9]=u*s-o*i,t[10]=f*s-a*i,t[11]=h*s-c*i,t};var MA=xA;const{sin:EA,cos:SA}=qt,yA=(t,e,n)=>{const i=EA(n),s=SA(n),r=e[0],o=e[1],a=e[2],c=e[3],l=e[8],u=e[9],f=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-u*i,t[2]=a*s-f*i,t[3]=c*s-h*i,t[8]=r*i+l*s,t[9]=o*i+u*s,t[10]=a*i+f*s,t[11]=c*i+h*s,t};var bA=yA;const{sin:TA,cos:wA}=qt,AA=(t,e,n)=>{const i=TA(n),s=wA(n),r=e[0],o=e[1],a=e[2],c=e[3],l=e[4],u=e[5],f=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+u*i,t[2]=a*s+f*i,t[3]=c*s+h*i,t[4]=l*s-r*i,t[5]=u*s-o*i,t[6]=f*s-a*i,t[7]=h*s-c*i,t};var RA=AA;const PA=(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 CA=PA;const LA=(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 DA=LA;const UA=t=>t.map(e=>e.toFixed(7)).toString();var IA=UA;const NA=(t,e,n)=>{const i=n[0],s=n[1],r=n[2];let o,a,c,l,u,f,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],u=e[4],f=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]=u,t[5]=f,t[6]=h,t[7]=d,t[8]=_,t[9]=g,t[10]=m,t[11]=p,t[12]=o*i+u*s+_*r+e[12],t[13]=a*i+f*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 FA=NA,ft={add:hT,clone:gT,copy:Dm,create:ql,invert:xT,equals:ET,fromRotation:Im,fromScaling:PT,fromTaitBryanRotation:LT,fromTranslation:UT,fromValues:FT,fromVectorRotation:Gw,fromXRotation:Xw,fromYRotation:Kw,fromZRotation:eA,identity:Um,isIdentity:nA,isOnlyTransformScale:sA,isMirroring:oA,mirrorByPlane:cA,multiply:uA,rotate:gA,rotateX:MA,rotateY:bA,rotateZ:RA,scale:CA,subtract:DA,toString:IA,translate:FA};const OA=ft,BA=t=>(t===void 0&&(t=[]),{points:t,isClosed:!1,transforms:OA.create()});var ga=BA;const{EPS:hh}=Qe,dh=Xe,zA=Lm,HA=ga,VA=(t,e)=>{const n={closed:!1};let{closed:i}=Object.assign({},n,t),s=HA();if(s.points=e.map(r=>dh.clone(r)),s.points.length>1){const r=s.points[0],o=s.points[s.points.length-1];dh.distance(r,o)(ph.isIdentity(t.transforms)||(t.points=t.points.map(e=>mh.transform(mh.create(),e,t.transforms)),t.transforms=ph.create()),t);var $A=GA;const kA=$A,WA=t=>kA(t).points;var js=WA;const{TAU:So}=Qe,pt=Xe,XA=jl,qA=js,YA=(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 u=qA(e);if(u.length<1)throw new Error("the given path must contain one or more points (as the starting point for the arc)");let f=s[0],h=s[1];const d=u[u.length-1];f=Math.round(f*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(f===0||h===0)g.push(i);else{f=Math.abs(f),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]/(f*f)+w[1]*w[1]/(h*h);if(D>1){const W=Math.sqrt(D);f*=W,h*=W,f=Math.round(f*l)/l,h=Math.round(h*l)/l}let x=Math.sqrt((f*f*h*h-f*f*w[1]*w[1]-h*h*w[0]*w[0])/(f*f*w[1]*w[1]+h*h*w[0]*w[0]));_===a&&(x=-x);const T=pt.fromValues(f*w[1]/h,-h*w[0]/f);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 z=pt.fromValues((w[0]-T[0])/f,(w[1]-T[1])/h),U=pt.fromValues((-w[0]-T[0])/f,(-w[1]-T[1])/h),O=pt.angleRadians(z);let G=pt.angleRadians(U)-O;G=G%So,!_&&G>0?G-=So:_&&G<0&&(G+=So);let k=Math.ceil(Math.abs(G)/So*c)+1;k<1&&(k=1);for(let W=1;W{let e=!1,n=[];return t.forEach((i,s)=>{const r=ZA(i).slice();if(n.length>0&&r.length>0&&JA(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)}),KA({closed:e},n)};var $m=QA;const e2=$m,t2=ga,n2=(t,e)=>e2(e,t2(t));var km=n2;const{TAU:i2}=Qe,en=Xe,s2=Xe,r2=km,o2=js,a2=(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=o2(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 u=[];for(let b=0;b<=a;++b){const w=c[a]/(c[b]*c[a-b]);u.push(w)}const f=en.create(),h=en.create(),d=s2.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 z=u[I]*w*D,U=en.scale(f,i[I],z);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,z=x+(T-x)*2/3,U=_(I),O=_(z);g.splice(y,1,U,O),m.splice(y,1,I,z),y--,y<1&&(y=1)}else++y}g.shift();const M=r2(g,e);return M.lastBezierControlPoint=i[i.length-2],M};var c2=a2;const l2=Xe,gh=js,u2=(t,e)=>{if(t.isClosed!==e.isClosed||t.points.length!==e.points.length)return!1;const n=gh(t),i=gh(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=p2();e.transforms=h2.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 g2=m2;const _2=t=>!!(t&&typeof t=="object"&&"points"in t&&"transforms"in t&&"isClosed"in t&&Array.isArray(t.points)&&"length"in t.transforms);var Wm=_2;const v2=Xl,x2=t=>{const e=v2(t);return e.points=t.points.slice().reverse(),e};var M2=x2;const E2=Xe,S2=js,y2=t=>{const e=S2(t);let n="path ("+e.length+" points, "+t.isClosed+`): [ -`;return e.forEach(i=>{n+=" "+x2.toString(i)+`, +`;return e.forEach(i=>{n+=" "+E2.toString(i)+`, `}),n+=`] -`,n};var S2=E2;const y2=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=_h.multiply(_h.create(),t,e.transforms);return Object.assign({},e,{transforms:n})};var w2=T2;const A2=Xe,R2=Wm,P2=t=>{if(!R2(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 C2=P2,li={appendArc:qA,appendBezier:o2,appendPoints:km,clone:kl,close:Lm,concat:$m,create:pa,equals:l2,fromPoints:ql,fromCompactBinary:p2,isA:Wm,reverse:v2,toPoints:js,toString:S2,toCompactBinary:b2,transform:w2,validate:C2};const L2=(t,e)=>Array.isArray(t)&&t.length>=e?t.every(n=>Number.isFinite(n)):!1,D2=(t,e)=>Number.isFinite(t)&&t>e,U2=(t,e)=>Number.isFinite(t)&&t>=e;var xt={isNumberArray:L2,isGT:D2,isGTE:U2};const{EPS:vh,TAU:ys}=Qe,Yn=Xe,I2=li,{isGT:N2,isGTE:gc,isNumberArray:F2}=xt,O2=t=>{const e={center:[0,0],radius:1,startAngle:0,endAngle:ys,makeTangent:!1,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,makeTangent:o,segments:a}=Object.assign({},e,t);if(!F2(n,2))throw new Error("center must be an array of X and Y values");if(!N2(i,0))throw new Error("radius must be greater than zero");if(!gc(s,0))throw new Error("startAngle must be positive");if(!gc(r,0))throw new Error("endAngle must be positive");if(!gc(a,4))throw new Error("segments must be four or more");s=s%ys,r=r%ys;let c=ys;sr&&(c=r+(ys-s));const l=Math.acos((i*i+i*i-vh*vh)/(2*i*i)),u=Yn.clone(n);let f;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);f=Yn.fromAngleRadians(Yn.create(),y),Yn.scale(f,f,i),Yn.add(f,f,u),h.push(f)}}return I2.fromPoints({closed:!1},h)};var B2=O2;const z2=t=>Object.assign({},t);var H2=z2;const V2=ut,G2=t=>(t===void 0&&(t=[]),{sides:t,transforms:V2.create()});var ma=G2;const _c=Xe,$2=ma,k2=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");_c.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=q2();e.transforms=X2.clone(t.slice(1,17));for(let n=21;n=0&&(e.color=[t[17],t[18],t[19],t[20]]),e};var j2=Y2;const K2=t=>!!(t&&typeof t=="object"&&"sides"in t&&"transforms"in t&&Array.isArray(t.sides)&&"length"in t.transforms);var Xm=K2;const Mh=ut,Eo=Xe,Z2=t=>(Mh.isIdentity(t.transforms)||(t.sides=t.sides.map(e=>{const n=Eo.transform(Eo.create(),e[0],t.transforms),i=Eo.transform(Eo.create(),e[1],t.transforms);return[n,i]}),t.transforms=Mh.create()),t);var J2=Z2;const Q2=J2,eR=t=>Q2(t).sides;var Wr=eR;const tR=ma,nR=Wr,iR=t=>{const n=nR(t).map(i=>[i[1],i[0]]);return n.reverse(),tR(n)};var qm=iR;const or=Xe,sR=Wr,rR=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))},oR=t=>{const e=new Map;return rR(t).forEach(i=>{e.has(i[0])?e.get(i[0]).push(i):e.set(i[0],[i])}),e},aR=t=>{const e=oR(sR(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=cR(i,a);a.length===0&&e.delete(o),i=c}s.length>0&&s.push(s.shift()),n.push(s)}return e.clear(),n},cR=(t,e)=>{if(e.length===1)return e.pop();const n=or.create(),i=or.angleDegrees(or.subtract(n,t[1],t[0]));let s,r;e.forEach((a,c)=>{let u=or.angleDegrees(or.subtract(n,a[1],a[0]))-i;u<-180&&(u+=360),u>=180&&(u-=360),(r===void 0||u>s)&&(r=c,s=u)});const o=e[r];return e.splice(r,1),o};var Ym=aR;const lR=Wr,uR=t=>{const n=lR(t).map(i=>i[0]);return n.length>0&&n.push(n.shift()),n};var fR=uR;const Eh=Xe,hR=Wr,dR=t=>{const e=hR(t);let n="geom2 ("+e.length+` sides): +`,n};var b2=y2;const T2=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=_h.multiply(_h.create(),t,e.transforms);return Object.assign({},e,{transforms:n})};var R2=A2;const P2=Xe,C2=Wm,L2=t=>{if(!C2(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 D2=L2,li={appendArc:jA,appendBezier:c2,appendPoints:km,clone:Xl,close:Lm,concat:$m,create:ga,equals:f2,fromPoints:jl,fromCompactBinary:g2,isA:Wm,reverse:M2,toPoints:js,toString:b2,toCompactBinary:w2,transform:R2,validate:D2};const U2=(t,e)=>Array.isArray(t)&&t.length>=e?t.every(n=>Number.isFinite(n)):!1,I2=(t,e)=>Number.isFinite(t)&&t>e,N2=(t,e)=>Number.isFinite(t)&&t>=e;var Mt={isNumberArray:U2,isGT:I2,isGTE:N2};const{EPS:vh,TAU:ys}=Qe,Yn=Xe,F2=li,{isGT:O2,isGTE:vc,isNumberArray:B2}=Mt,z2=t=>{const e={center:[0,0],radius:1,startAngle:0,endAngle:ys,makeTangent:!1,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,makeTangent:o,segments:a}=Object.assign({},e,t);if(!B2(n,2))throw new Error("center must be an array of X and Y values");if(!O2(i,0))throw new Error("radius must be greater than zero");if(!vc(s,0))throw new Error("startAngle must be positive");if(!vc(r,0))throw new Error("endAngle must be positive");if(!vc(a,4))throw new Error("segments must be four or more");s=s%ys,r=r%ys;let c=ys;sr&&(c=r+(ys-s));const l=Math.acos((i*i+i*i-vh*vh)/(2*i*i)),u=Yn.clone(n);let f;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);f=Yn.fromAngleRadians(Yn.create(),y),Yn.scale(f,f,i),Yn.add(f,f,u),h.push(f)}}return F2.fromPoints({closed:!1},h)};var H2=z2;const V2=t=>Object.assign({},t);var G2=V2;const $2=ft,k2=t=>(t===void 0&&(t=[]),{sides:t,transforms:$2.create()});var _a=k2;const xc=Xe,W2=_a,X2=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");xc.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=j2();e.transforms=Y2.clone(t.slice(1,17));for(let n=21;n=0&&(e.color=[t[17],t[18],t[19],t[20]]),e};var Z2=K2;const J2=t=>!!(t&&typeof t=="object"&&"sides"in t&&"transforms"in t&&Array.isArray(t.sides)&&"length"in t.transforms);var Xm=J2;const Mh=ft,yo=Xe,Q2=t=>(Mh.isIdentity(t.transforms)||(t.sides=t.sides.map(e=>{const n=yo.transform(yo.create(),e[0],t.transforms),i=yo.transform(yo.create(),e[1],t.transforms);return[n,i]}),t.transforms=Mh.create()),t);var eR=Q2;const tR=eR,nR=t=>tR(t).sides;var Wr=nR;const iR=_a,sR=Wr,rR=t=>{const n=sR(t).map(i=>[i[1],i[0]]);return n.reverse(),iR(n)};var qm=rR;const or=Xe,oR=Wr,aR=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))},cR=t=>{const e=new Map;return aR(t).forEach(i=>{e.has(i[0])?e.get(i[0]).push(i):e.set(i[0],[i])}),e},lR=t=>{const e=cR(oR(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=uR(i,a);a.length===0&&e.delete(o),i=c}s.length>0&&s.push(s.shift()),n.push(s)}return e.clear(),n},uR=(t,e)=>{if(e.length===1)return e.pop();const n=or.create(),i=or.angleDegrees(or.subtract(n,t[1],t[0]));let s,r;e.forEach((a,c)=>{let u=or.angleDegrees(or.subtract(n,a[1],a[0]))-i;u<-180&&(u+=360),u>=180&&(u-=360),(r===void 0||u>s)&&(r=c,s=u)});const o=e[r];return e.splice(r,1),o};var Ym=lR;const fR=Wr,hR=t=>{const n=fR(t).map(i=>i[0]);return n.length>0&&n.push(n.shift()),n};var dR=hR;const Eh=Xe,pR=Wr,mR=t=>{const e=pR(t);let n="geom2 ("+e.length+` sides): [ `;return e.forEach(i=>{n+=" ["+Eh.toString(i[0])+", "+Eh.toString(i[1])+`] `}),n+=`] -`,n};var pR=dR;const mR=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=Sh.multiply(Sh.create(),t,e.transforms),i=Object.assign({},e,{transforms:n});return t[0]*t[5]-t[4]*t[1]<0?_R(i):i};var xR=vR;const MR=Xe,ER=Xm,SR=Ym,yR=t=>{if(!ER(t))throw new Error("invalid geom2 structure");if(SR(t),t.sides.forEach(e=>{if(MR.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 bR=yR,wt={clone:H2,create:ma,fromPoints:W2,fromCompactBinary:j2,isA:Xm,reverse:qm,toOutlines:Ym,toPoints:fR,toSides:Wr,toString:pR,toCompactBinary:gR,transform:xR,validate:bR};const{EPS:yh,TAU:gi}=Qe,vc=Xe,bh=wt,{sin:TR,cos:wR}=qt,{isGTE:xc,isNumberArray:Th}=xt,AR=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(!Th(n,2))throw new Error("center must be an array of X and Y values");if(!Th(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 bh.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-yh*yh)/(2*c*c));if(a{const e={center:[0,0],radius:1,startAngle:0,endAngle:RR,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,segments:o}=Object.assign({},e,t);if(!CR(i,0))throw new Error("radius must be positive");return i=[i,i],PR({center:n,radius:i,startAngle:s,endAngle:r,segments:o})};var Km=LR;const DR=t=>Object.assign({},t);var UR=DR;const IR=ut,NR=t=>(t===void 0&&(t=[]),{polygons:t,transforms:IR.create()});var Xr=NR;const FR=kr,wh=da,Ah=Gm,OR=(t,e,n)=>{const i=[],s=[],r=[];wh(i,n,e),wh(s,t,e);const o=Ah(FR(r,s,i)),a=Ah(i);if(a===0)throw Error("a and b are the same point");return o/a},BR=(t,e,n)=>Math.sqrt(OR(t,e,n));var zR=BR;const HR=kr,VR=Xl,Rh=da,GR=(t,e,n,i)=>{const s=[0,0,0];return Rh(t,e,n),Rh(s,n,i),HR(t,t,s),VR(t,t)};var $R=GR;let kR=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 WR=kR;let XR=class{constructor(e,n){this.point=e,this.index=n,this.next=null,this.prev=null,this.face=null}};var qR=XR;const YR=Bm,jR=Vm;let KR=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()?YR(this.tail().point,this.head().point):-1}lengthSquared(){return this.tail()?jR(this.tail().point,this.head().point):-1}setOpposite(e){this.opposite=e,e.opposite=this}};var ZR=KR;const Mc=Fm,JR=Om,QR=kr,Ec=fa,eP=zm,tP=Xl,So=Hm,Sc=da,yc=ZR,Zm=0,nP=1,cl=2;let iP=class Jm{constructor(){this.normal=[],this.centroid=[],this.offset=0,this.outside=null,this.mark=Zm,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=Sc([],n.head().point,e.head().point),r=[],o=[];for(this.nVertices=2,this.normal=[0,0,0];i!==e;)JR(o,s),Sc(s,i.head().point,e.head().point),Mc(this.normal,this.normal,QR(r,o,s)),i=i.next,this.nVertices+=1;this.area=eP(this.normal),this.normal=So(this.normal,this.normal,1/this.area)}computeNormalMinArea(e){if(this.computeNormal(),this.areai&&(n=s,i=u),s=s.next}while(s!==this.edge);const r=n.tail().point,o=n.head().point,a=Sc([],o,r),c=Math.sqrt(i);So(a,a,1/c);const l=Ec(this.normal,a);So(a,a,-l),Mc(this.normal,this.normal,a),tP(this.normal,this.normal)}}computeCentroid(){this.centroid=[0,0,0];let e=this.edge;do Mc(this.centroid,this.centroid,e.head().point),e=e.next;while(e!==this.edge);So(this.centroid,this.centroid,1/this.nVertices)}computeNormalAndCentroid(e){typeof e<"u"?this.computeNormalMinArea(e):this.computeNormal(),this.computeCentroid(),this.offset=Ec(this.normal,this.centroid)}distanceToPlane(e){return Ec(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=cl,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=cl;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 u;return u=this.connectHalfEdges(a,o),u&&n.push(u),u=this.connectHalfEdges(r,c),u&&n.push(u),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 Jm,o=new yc(e,r),a=new yc(n,r),c=new yc(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 sP={VISIBLE:Zm,NON_CONVEX:nP,DELETED:cl,Face:iP};const bc=fa,rP=zR,oP=$R,Ph=WR,aP=qR,{Face:jn,VISIBLE:bs,NON_CONVEX:Ch,DELETED:cP}=sP,lP=1,Lh=2;let uP=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 u=n[l],f=i[l];for(c=0,o=0;oc&&(c=m,s=g)}}const h=oP([],u.point,f.point,s.point),d=bc(u.point,h);for(c=-1,o=0;oc&&(c=m,r=g)}}const _=[];if(bc(r.point,h)-d<0)for(_.push(jn.createTriangle(u,f,s),jn.createTriangle(r,f,u),jn.createTriangle(r,s,f),jn.createTriangle(r,u,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(u,s,f),jn.createTriangle(r,u,f),jn.createTriangle(r,f,s),jn.createTriangle(r,s,u)),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=cP;let r;n?r=n.next:r=n=i.getEdge(0);do{const o=r.opposite,a=o.face;a.mark===bs&&(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===Lh?(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 hP(t);return n.build(),n.collectFaces(e.skipTriangulation)};var pP=dP;const mP=t=>((t===void 0||t.length<3)&&(t=[]),{vertices:t});var Ks=mP;const gP=Ks,_P=$e,vP=(...t)=>{let e,n;return t.length===1?(e=gP(),n=t[0]):(e=t[0],n=t[1]),e.vertices=n.vertices.map(i=>_P.clone(i)),e};var xP=vP;const MP=$e,EP=Ks,SP=t=>{const e=t.map(n=>MP.clone(n));return EP(e)};var yP=SP;const bP=Ks,TP=(t,e)=>{const n=bP(t);return n.plane=e,n};var wP=TP;const AP=()=>[0,0,0,0];var ga=AP;const RP=ga,PP=t=>{const e=RP();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e};var Qm=PP;const CP=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t);var eg=CP;const LP=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3];var tg=LP;const DP=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t);var ng=DP;const Tc=$e,UP=(t,e,n)=>{const i=Tc.normalize(Tc.create(),e),s=Tc.dot(n,i);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=s,t};var ig=UP;const IP=ga,NP=(t,e,n,i)=>{const s=IP();return s[0]=t,s[1]=e,s[2]=n,s[3]=i,s};var sg=NP;const tn=$e,FP=ig,OP=(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 u=tn.create();let f=o*c-a*a;u[0]=f,u[1]=r*a-s*c,u[2]=s*a-r*o;let h=f*f;return tn.add(l,l,tn.scale(u,u,h)),f=i*c-r*r,u[0]=r*a-s*c,u[1]=f,u[2]=s*r-a*i,h=f*f,tn.dot(l,u)<0&&(h=-h),tn.add(l,l,tn.scale(u,u,h)),f=i*o-s*s,u[0]=s*a-r*o,u[1]=s*r-a*i,u[2]=f,h=f*f,tn.dot(l,u)<0&&(h=-h),tn.add(l,l,tn.scale(u,u,h)),FP(t,l,t)};var BP=OP;const Pn=$e,zP=(t,...e)=>{const n=e.length,i=Pn.create(),s=Pn.create(),r=o=>{const a=e[o],c=e[(o+1)%n],l=e[(o+2)%n];return Pn.subtract(i,c,a),Pn.subtract(s,l,a),Pn.cross(i,i,s),Pn.normalize(i,i),i};return t[0]=0,t[1]=0,t[2]=0,n===3?Pn.copy(t,r(0)):(e.forEach((o,a)=>{Pn.add(t,t,r(a))}),Pn.normalize(t,t)),t[3]=Pn.dot(t,e[0]),t};var rg=zP;const{EPS:wc}=Qe,Ot=$e,HP=(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 GP.fromValues(i,s,r)};var kP=$P;const WP=$e,XP=(t,e)=>WP.dot(t,e)-t[3];var og=XP;const qP=t=>`(${t[0].toFixed(9)}, ${t[1].toFixed(9)}, ${t[2].toFixed(9)}, ${t[3].toFixed(9)})`;var ag=qP;const YP=ut,Bt=$e,jP=rg,KP=ng,ZP=(t,e,n)=>{const i=YP.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),jP(t,a,c,l),i&&KP(t,t),t};var JP=ZP,Zs={clone:Qm,copy:eg,create:ga,equals:tg,flip:ng,fromNormalAndPoint:ig,fromValues:sg,fromNoisyPoints:BP,fromPoints:rg,fromPointsRandom:VP,projectionOfPoint:kP,signedDistanceToPoint:og,toString:ag,transform:JP};const Dh=Zs,QP=Ks,eC=t=>{const e=t.vertices.slice().reverse(),n=QP(e);return t.plane&&(n.plane=Dh.flip(Dh.create(),t.plane)),n};var tC=eC;const nC=t=>!!(t&&typeof t=="object"&&"vertices"in t&&Array.isArray(t.vertices));var cg=nC;const Uh=Zs,Ni=$e,iC=t=>sC(t.vertices),sC=t=>{const e=t.length;if(e>2){const n=Uh.fromPoints(Uh.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 lg=iC;const Ih=Zs,oC=t=>(t.plane||(t.plane=Ih.fromPoints(Ih.create(),...t.vertices)),t.plane);var Yl=oC;const aC=Yl,cC=t=>{const e=t.vertices.length;if(e<3)return 0;const n=t.vertices,i=aC(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,u=1,f=2;switch(a){case 1:for(u=1;u{const e=t.vertices,n=e.length,i=n===0?ar.create():ar.clone(e[0]),s=ar.clone(i);for(let r=1;rt[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3];var hC=fC;const dC=(t,e)=>(t[0]=e,t[1]=e,t[2]=e,t[3]=e,t);var pC=dC;const mC=(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 gC=mC,_C={clone:Qm,copy:eg,create:ga,dot:hC,equals:tg,fromScalar:pC,fromValues:sg,toString:ag,transform:gC};const vC=_C,Nh=new WeakMap,xC=t=>{const e=Nh.get(t);if(e)return e;const n=t.vertices,i=vC.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=Ac.create();for(let s=0;st.vertices;var bC=yC;const TC=$e,wC=t=>{let e="poly3: vertices: [";return t.vertices.forEach(n=>{e+=`${TC.toString(n)}, `}),e+="]",e};var AC=wC;const RC=ut,Fh=$e,PC=Ks,CC=(t,e)=>{const n=e.vertices.map(i=>Fh.transform(Fh.create(),i,t));return RC.isMirroring(t)&&n.reverse(),PC(n)};var LC=CC;const DC=og,{NEPS:UC}=Qe,IC=$e,NC=cg,FC=lg,OC=ug,BC=Yl,zC=t=>{if(!NC(t))throw new Error("invalid poly3 structure");if(t.vertices.length<3)throw new Error(`poly3 not enough vertices ${t.vertices.length}`);if(OC(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=BC(t);t.vertices.forEach(n=>{const i=Math.abs(DC(e,n));if(i>UC)throw new Error(`poly3 must be coplanar: vertex ${n} distance ${i}`)})}};var HC=zC,rt={clone:xP,create:Ks,fromPoints:yP,fromPointsAndPlane:wP,invert:tC,isA:cg,isConvex:lg,measureArea:ug,measureBoundingBox:uC,measureBoundingSphere:MC,measureSignedVolume:SC,plane:Yl,toPoints:bC,toString:AC,transform:LC,validate:HC};const VC=pP,GC=Xr,$C=rt,kC=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");const n=VC(t,{skipTriangulation:!0}).map(i=>{const s=i.map(r=>t[r]);return $C.create(s)});return GC(n)};var WC=kC;const XC=rt,qC=Xr,YC=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");const e=t.map((i,s)=>XC.create(i));return qC(e)};var jC=YC;const KC=$e,ZC=ut,JC=rt,QC=Xr,eL=t=>{if(t[0]!==1)throw new Error("invalid compact binary data");const e=QC();e.transforms=ZC.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 tL=eL;const Oh=ut,nL=rt,iL=t=>(Oh.isIdentity(t.transforms)||(t.polygons=t.polygons.map(e=>nL.transform(t.transforms,e)),t.transforms=Oh.create()),t);var sL=iL;const rL=sL,oL=t=>rL(t).polygons;var _a=oL;const aL=rt,cL=Xr,lL=_a,uL=t=>{const n=lL(t).map(i=>aL.invert(i));return cL(n)};var fL=uL;const hL=t=>!!(t&&typeof t=="object"&&"polygons"in t&&"transforms"in t&&Array.isArray(t.polygons)&&"length"in t.transforms);var fg=hL;const dL=rt,pL=_a,mL=t=>pL(t).map(i=>dL.toPoints(i));var gL=mL;const _L=rt,vL=_a,xL=t=>{const e=vL(t);let n="geom3 ("+e.length+` polygons): -`;return e.forEach(i=>{n+=" "+_L.toString(i)+` -`}),n};var ML=xL;const EL=rt,SL=t=>{const e=t.polygons,n=t.transforms,i=e.length,s=e.reduce((l,u)=>l+u.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 u=EL.toPoints(l);o[a]=u.length,a++;for(let f=0;f{const n=Bh.multiply(Bh.create(),t,e.transforms);return Object.assign({},e,{transforms:n})};var TL=bL;const wL=rt,AL=fg,RL=t=>{if(!AL(t))throw new Error("invalid geom3 structure");if(t.polygons.forEach(wL.validate),PL(t),!t.transforms.every(Number.isFinite))throw new Error(`geom3 invalid transforms ${t.transforms}`)},PL=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 gR=mR;const _R=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=Sh.multiply(Sh.create(),t,e.transforms),i=Object.assign({},e,{transforms:n});return t[0]*t[5]-t[4]*t[1]<0?xR(i):i};var ER=MR;const SR=Xe,yR=Xm,bR=Ym,TR=t=>{if(!yR(t))throw new Error("invalid geom2 structure");if(bR(t),t.sides.forEach(e=>{if(SR.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 wR=TR,At={clone:G2,create:_a,fromPoints:q2,fromCompactBinary:Z2,isA:Xm,reverse:qm,toOutlines:Ym,toPoints:dR,toSides:Wr,toString:gR,toCompactBinary:vR,transform:ER,validate:wR};const{EPS:yh,TAU:gi}=Qe,Mc=Xe,bh=At,{sin:AR,cos:RR}=qt,{isGTE:Ec,isNumberArray:Th}=Mt,PR=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(!Th(n,2))throw new Error("center must be an array of X and Y values");if(!Th(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(!Ec(s,0))throw new Error("startAngle must be positive");if(!Ec(r,0))throw new Error("endAngle must be positive");if(!Ec(o,3))throw new Error("segments must be three or more");if(i[0]===0||i[1]===0)return bh.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-yh*yh)/(2*c*c));if(a{const e={center:[0,0],radius:1,startAngle:0,endAngle:CR,segments:32};let{center:n,radius:i,startAngle:s,endAngle:r,segments:o}=Object.assign({},e,t);if(!DR(i,0))throw new Error("radius must be positive");return i=[i,i],LR({center:n,radius:i,startAngle:s,endAngle:r,segments:o})};var Km=UR;const IR=t=>Object.assign({},t);var NR=IR;const FR=ft,OR=t=>(t===void 0&&(t=[]),{polygons:t,transforms:FR.create()});var Xr=OR;const BR=kr,wh=ma,Ah=Gm,zR=(t,e,n)=>{const i=[],s=[],r=[];wh(i,n,e),wh(s,t,e);const o=Ah(BR(r,s,i)),a=Ah(i);if(a===0)throw Error("a and b are the same point");return o/a},HR=(t,e,n)=>Math.sqrt(zR(t,e,n));var VR=HR;const GR=kr,$R=Yl,Rh=ma,kR=(t,e,n,i)=>{const s=[0,0,0];return Rh(t,e,n),Rh(s,n,i),GR(t,t,s),$R(t,t)};var WR=kR;let XR=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 qR=XR;let YR=class{constructor(e,n){this.point=e,this.index=n,this.next=null,this.prev=null,this.face=null}};var jR=YR;const KR=Bm,ZR=Vm;let JR=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()?KR(this.tail().point,this.head().point):-1}lengthSquared(){return this.tail()?ZR(this.tail().point,this.head().point):-1}setOpposite(e){this.opposite=e,e.opposite=this}};var QR=JR;const Sc=Fm,eP=Om,tP=kr,yc=da,nP=zm,iP=Yl,bo=Hm,bc=ma,Tc=QR,Zm=0,sP=1,ul=2;let rP=class Jm{constructor(){this.normal=[],this.centroid=[],this.offset=0,this.outside=null,this.mark=Zm,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=bc([],n.head().point,e.head().point),r=[],o=[];for(this.nVertices=2,this.normal=[0,0,0];i!==e;)eP(o,s),bc(s,i.head().point,e.head().point),Sc(this.normal,this.normal,tP(r,o,s)),i=i.next,this.nVertices+=1;this.area=nP(this.normal),this.normal=bo(this.normal,this.normal,1/this.area)}computeNormalMinArea(e){if(this.computeNormal(),this.areai&&(n=s,i=u),s=s.next}while(s!==this.edge);const r=n.tail().point,o=n.head().point,a=bc([],o,r),c=Math.sqrt(i);bo(a,a,1/c);const l=yc(this.normal,a);bo(a,a,-l),Sc(this.normal,this.normal,a),iP(this.normal,this.normal)}}computeCentroid(){this.centroid=[0,0,0];let e=this.edge;do Sc(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=yc(this.normal,this.centroid)}distanceToPlane(e){return yc(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=ul,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=ul;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 u;return u=this.connectHalfEdges(a,o),u&&n.push(u),u=this.connectHalfEdges(r,c),u&&n.push(u),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 Jm,o=new Tc(e,r),a=new Tc(n,r),c=new Tc(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 oP={VISIBLE:Zm,NON_CONVEX:sP,DELETED:ul,Face:rP};const wc=da,aP=VR,cP=WR,Ph=qR,lP=jR,{Face:jn,VISIBLE:bs,NON_CONVEX:Ch,DELETED:uP}=oP,fP=1,Lh=2;let hP=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 u=n[l],f=i[l];for(c=0,o=0;oc&&(c=m,s=g)}}const h=cP([],u.point,f.point,s.point),d=wc(u.point,h);for(c=-1,o=0;oc&&(c=m,r=g)}}const _=[];if(wc(r.point,h)-d<0)for(_.push(jn.createTriangle(u,f,s),jn.createTriangle(r,f,u),jn.createTriangle(r,s,f),jn.createTriangle(r,u,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(u,s,f),jn.createTriangle(r,u,f),jn.createTriangle(r,f,s),jn.createTriangle(r,s,u)),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=uP;let r;n?r=n.next:r=n=i.getEdge(0);do{const o=r.opposite,a=o.face;a.mark===bs&&(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===Lh?(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 pP(t);return n.build(),n.collectFaces(e.skipTriangulation)};var gP=mP;const _P=t=>((t===void 0||t.length<3)&&(t=[]),{vertices:t});var Ks=_P;const vP=Ks,xP=$e,MP=(...t)=>{let e,n;return t.length===1?(e=vP(),n=t[0]):(e=t[0],n=t[1]),e.vertices=n.vertices.map(i=>xP.clone(i)),e};var EP=MP;const SP=$e,yP=Ks,bP=t=>{const e=t.map(n=>SP.clone(n));return yP(e)};var TP=bP;const wP=Ks,AP=(t,e)=>{const n=wP(t);return n.plane=e,n};var RP=AP;const PP=()=>[0,0,0,0];var va=PP;const CP=va,LP=t=>{const e=CP();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e};var Qm=LP;const DP=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t);var eg=DP;const UP=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3];var tg=UP;const IP=(t,e)=>(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t);var ng=IP;const Ac=$e,NP=(t,e,n)=>{const i=Ac.normalize(Ac.create(),e),s=Ac.dot(n,i);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=s,t};var ig=NP;const FP=va,OP=(t,e,n,i)=>{const s=FP();return s[0]=t,s[1]=e,s[2]=n,s[3]=i,s};var sg=OP;const tn=$e,BP=ig,zP=(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 u=tn.create();let f=o*c-a*a;u[0]=f,u[1]=r*a-s*c,u[2]=s*a-r*o;let h=f*f;return tn.add(l,l,tn.scale(u,u,h)),f=i*c-r*r,u[0]=r*a-s*c,u[1]=f,u[2]=s*r-a*i,h=f*f,tn.dot(l,u)<0&&(h=-h),tn.add(l,l,tn.scale(u,u,h)),f=i*o-s*s,u[0]=s*a-r*o,u[1]=s*r-a*i,u[2]=f,h=f*f,tn.dot(l,u)<0&&(h=-h),tn.add(l,l,tn.scale(u,u,h)),BP(t,l,t)};var HP=zP;const Pn=$e,VP=(t,...e)=>{const n=e.length,i=Pn.create(),s=Pn.create(),r=o=>{const a=e[o],c=e[(o+1)%n],l=e[(o+2)%n];return Pn.subtract(i,c,a),Pn.subtract(s,l,a),Pn.cross(i,i,s),Pn.normalize(i,i),i};return t[0]=0,t[1]=0,t[2]=0,n===3?Pn.copy(t,r(0)):(e.forEach((o,a)=>{Pn.add(t,t,r(a))}),Pn.normalize(t,t)),t[3]=Pn.dot(t,e[0]),t};var rg=VP;const{EPS:Rc}=Qe,Ot=$e,GP=(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 kP.fromValues(i,s,r)};var XP=WP;const qP=$e,YP=(t,e)=>qP.dot(t,e)-t[3];var og=YP;const jP=t=>`(${t[0].toFixed(9)}, ${t[1].toFixed(9)}, ${t[2].toFixed(9)}, ${t[3].toFixed(9)})`;var ag=jP;const KP=ft,Bt=$e,ZP=rg,JP=ng,QP=(t,e,n)=>{const i=KP.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),ZP(t,a,c,l),i&&JP(t,t),t};var eC=QP,Zs={clone:Qm,copy:eg,create:va,equals:tg,flip:ng,fromNormalAndPoint:ig,fromValues:sg,fromNoisyPoints:HP,fromPoints:rg,fromPointsRandom:$P,projectionOfPoint:XP,signedDistanceToPoint:og,toString:ag,transform:eC};const Dh=Zs,tC=Ks,nC=t=>{const e=t.vertices.slice().reverse(),n=tC(e);return t.plane&&(n.plane=Dh.flip(Dh.create(),t.plane)),n};var iC=nC;const sC=t=>!!(t&&typeof t=="object"&&"vertices"in t&&Array.isArray(t.vertices));var cg=sC;const Uh=Zs,Ni=$e,rC=t=>oC(t.vertices),oC=t=>{const e=t.length;if(e>2){const n=Uh.fromPoints(Uh.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 lg=rC;const Ih=Zs,cC=t=>(t.plane||(t.plane=Ih.fromPoints(Ih.create(),...t.vertices)),t.plane);var Kl=cC;const lC=Kl,uC=t=>{const e=t.vertices.length;if(e<3)return 0;const n=t.vertices,i=lC(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,u=1,f=2;switch(a){case 1:for(u=1;u{const e=t.vertices,n=e.length,i=n===0?ar.create():ar.clone(e[0]),s=ar.clone(i);for(let r=1;rt[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3];var pC=dC;const mC=(t,e)=>(t[0]=e,t[1]=e,t[2]=e,t[3]=e,t);var gC=mC;const _C=(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 vC=_C,xC={clone:Qm,copy:eg,create:va,dot:pC,equals:tg,fromScalar:gC,fromValues:sg,toString:ag,transform:vC};const MC=xC,Nh=new WeakMap,EC=t=>{const e=Nh.get(t);if(e)return e;const n=t.vertices,i=MC.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=Pc.create();for(let s=0;st.vertices;var wC=TC;const AC=$e,RC=t=>{let e="poly3: vertices: [";return t.vertices.forEach(n=>{e+=`${AC.toString(n)}, `}),e+="]",e};var PC=RC;const CC=ft,Fh=$e,LC=Ks,DC=(t,e)=>{const n=e.vertices.map(i=>Fh.transform(Fh.create(),i,t));return CC.isMirroring(t)&&n.reverse(),LC(n)};var UC=DC;const IC=og,{NEPS:NC}=Qe,FC=$e,OC=cg,BC=lg,zC=ug,HC=Kl,VC=t=>{if(!OC(t))throw new Error("invalid poly3 structure");if(t.vertices.length<3)throw new Error(`poly3 not enough vertices ${t.vertices.length}`);if(zC(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=HC(t);t.vertices.forEach(n=>{const i=Math.abs(IC(e,n));if(i>NC)throw new Error(`poly3 must be coplanar: vertex ${n} distance ${i}`)})}};var GC=VC,rt={clone:EP,create:Ks,fromPoints:TP,fromPointsAndPlane:RP,invert:iC,isA:cg,isConvex:lg,measureArea:ug,measureBoundingBox:hC,measureBoundingSphere:SC,measureSignedVolume:bC,plane:Kl,toPoints:wC,toString:PC,transform:UC,validate:GC};const $C=gP,kC=Xr,WC=rt,XC=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");const n=$C(t,{skipTriangulation:!0}).map(i=>{const s=i.map(r=>t[r]);return WC.create(s)});return kC(n)};var qC=XC;const YC=rt,jC=Xr,KC=t=>{if(!Array.isArray(t))throw new Error("the given points must be an array");const e=t.map((i,s)=>YC.create(i));return jC(e)};var ZC=KC;const JC=$e,QC=ft,eL=rt,tL=Xr,nL=t=>{if(t[0]!==1)throw new Error("invalid compact binary data");const e=tL();e.transforms=QC.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 iL=nL;const Oh=ft,sL=rt,rL=t=>(Oh.isIdentity(t.transforms)||(t.polygons=t.polygons.map(e=>sL.transform(t.transforms,e)),t.transforms=Oh.create()),t);var oL=rL;const aL=oL,cL=t=>aL(t).polygons;var xa=cL;const lL=rt,uL=Xr,fL=xa,hL=t=>{const n=fL(t).map(i=>lL.invert(i));return uL(n)};var dL=hL;const pL=t=>!!(t&&typeof t=="object"&&"polygons"in t&&"transforms"in t&&Array.isArray(t.polygons)&&"length"in t.transforms);var fg=pL;const mL=rt,gL=xa,_L=t=>gL(t).map(i=>mL.toPoints(i));var vL=_L;const xL=rt,ML=xa,EL=t=>{const e=ML(t);let n="geom3 ("+e.length+` polygons): +`;return e.forEach(i=>{n+=" "+xL.toString(i)+` +`}),n};var SL=EL;const yL=rt,bL=t=>{const e=t.polygons,n=t.transforms,i=e.length,s=e.reduce((l,u)=>l+u.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 u=yL.toPoints(l);o[a]=u.length,a++;for(let f=0;f{const n=Bh.multiply(Bh.create(),t,e.transforms);return Object.assign({},e,{transforms:n})};var AL=wL;const RL=rt,PL=fg,CL=t=>{if(!PL(t))throw new Error("invalid geom3 structure");if(t.polygons.forEach(RL.validate),LL(t),!t.transforms.every(Number.isFinite))throw new Error(`geom3 invalid transforms ${t.transforms}`)},LL=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 CL=RL,At={clone:UR,create:Xr,fromPointsConvex:WC,fromPoints:jC,fromCompactBinary:tL,invert:fL,isA:fg,toPoints:gL,toPolygons:_a,toString:ML,toCompactBinary:yL,transform:TL,validate:CL};const zh=At,LL=rt,{isNumberArray:Hh}=xt,DL=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?zh.create():zh.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 LL.create(o)}))};var jl=DL;const UL=jl,{isGTE:IL}=xt,NL=t=>{const e={center:[0,0,0],size:2};let{center:n,size:i}=Object.assign({},e,t);if(!IL(i,0))throw new Error("size must be positive");return i=[i,i,i],UL({center:n,size:i})};var FL=NL;const{EPS:Vh,TAU:_i}=Qe,St=$e,OL=At,BL=rt,{sin:zL,cos:HL}=qt,{isGT:VL,isGTE:Rc,isNumberArray:Pc}=xt,GL=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(!Pc(n,3))throw new Error("center must be an array of X, Y and Z values");if(!VL(i,0))throw new Error("height must be greater then zero");if(!Pc(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(!Pc(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(!Rc(r,0))throw new Error("startAngle must be positive");if(!Rc(a,0))throw new Error("endAngle must be positive");if(!Rc(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 u=Math.min(s[0],s[1],o[0],o[1]),f=Math.acos((u*u+u*u-Vh*Vh)/(2*u*u));if(l{const z=T*l+r;return St.scale(y,m,I[0]*HL(z)),St.scale(E,p,I[1]*zL(z)),St.add(y,y,E),St.scale(v,g,x),St.add(v,v,d),St.add(St.create(),y,v)},b=(...x)=>{const T=x.map(I=>St.add(St.create(),I,n));return BL.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)))),OL.create(w)};var hg=GL;const $L=At,kL=hg,{isGTE:WL}=xt,XL=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(!WL(s,0))throw new Error("radius must be positive");return i===0||s===0?$L.create():kL({center:n,height:i,startRadius:[s,s],endRadius:[s,s],segments:r})};var dg=XL;const{TAU:Gh}=Qe,Ae=$e,$h=At,kh=rt,{sin:Wh,cos:Xh}=qt,{isGTE:qL,isNumberArray:qh}=xt,YL=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(!qh(n,3))throw new Error("center must be an array of X, Y and Z values");if(!qh(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(!qL(s,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0||i[2]===0)return $h.create();const o=Ae.scale(Ae.create(),Ae.normalize(Ae.create(),r[0]),i[0]),a=Ae.scale(Ae.create(),Ae.normalize(Ae.create(),r[1]),i[1]),c=Ae.scale(Ae.create(),Ae.normalize(Ae.create(),r[2]),i[2]),l=Math.round(s/4);let u;const f=[],h=Ae.create(),d=Ae.create();for(let _=0;_<=s;_++){const g=Gh*_/s,m=Ae.add(Ae.create(),Ae.scale(h,o,Xh(g)),Ae.scale(d,a,Wh(g)));if(_>0){let p,y;for(let E=0;E<=l;E++){const v=Gh/4*E/l,M=Xh(v),b=Wh(v);if(E>0){let w=[],D;D=Ae.subtract(Ae.create(),Ae.scale(h,u,p),Ae.scale(d,c,y)),w.push(Ae.add(D,D,n)),D=Ae.subtract(Ae.create(),Ae.scale(h,m,p),Ae.scale(d,c,y)),w.push(Ae.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(!Yh(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(!Yh(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=KL.create(a.map(u=>n[u]));return s&&s[c]&&(l.color=s[c]),l});return jL.create(o)};var mg=ZL;const jh=ut,Kh=$e,Zh=At,JL=mg,{isGTE:Jh}=xt,QL=t=>{const e={radius:1,frequency:6};let{radius:n,frequency:i}=Object.assign({},e,t);if(!Jh(n,0))throw new Error("radius must be positive");if(!Jh(i,6))throw new Error("frequency must be six or more");if(n===0)return Zh.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=[],u=0;for(let h=0;h{if(!Array.isArray(t))throw new Error("points must be an array");return t3.fromPoints({},t)};var i3=n3;const yo=wt,s3=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((u,f)=>{if(!Array.isArray(u))throw new Error("list of points "+f+" must be an array");if(u.length<3)throw new Error("list of points "+f+" must contain three or more points");u.forEach((h,d)=>{if(!Array.isArray(h))throw new Error("list of points "+f+", point "+d+" must be an array");if(h.length<2)throw new Error("list of points "+f+", point "+d+" must contain by X and Y values")})});let o=i;if(i.length===0){let u=0;o=r.map(f=>f.map(h=>u++))}const a=[];r.forEach(u=>u.forEach(f=>a.push(f)));let c=[];o.forEach(u=>{const f=u.map(d=>a[d]),h=yo.fromPoints(f);c=c.concat(yo.toSides(h))});let l=yo.create(c);return s==="clockwise"&&(l=yo.reverse(l)),l};var r3=s3;const vi=Xe,Qh=wt,{isNumberArray:ed}=xt,o3=t=>{const e={center:[0,0],size:[2,2]},{center:n,size:i}=Object.assign({},e,t);if(!ed(n,2))throw new Error("center must be an array of X and Y values");if(!ed(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 Qh.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 Qh.fromPoints(o)};var Kl=o3;const{EPS:zo,TAU:cr}=Qe,Cc=Xe,lt=$e,td=At,ks=rt,{sin:a3,cos:c3}=qt,{isGTE:nd,isNumberArray:id}=xt,l3=jl,sd=(t,e,n,i,s,r)=>{const o=cr/4*s/i,a=c3(o),c=a3(o),l=i-s;let u=n*a,f=e[2]-(n-n*c);r||(f=n-n*c-e[2]),u=u>zo?u:0;const h=lt.add(lt.create(),t,[e[0]-n,e[1]-n,f]),d=lt.add(lt.create(),t,[n-e[0],e[1]-n,f]),_=lt.add(lt.create(),t,[n-e[0],n-e[1],f]),g=lt.add(lt.create(),t,[e[0]-n,n-e[1],f]),m=[],p=[],y=[],E=[];for(let v=0;v<=l;v++){const M=l>0?cr/4*v/l:0,b=Cc.fromAngleRadians(Cc.create(),M);Cc.scale(b,b,u);const w=lt.fromVec2(lt.create(),b);m.push(lt.add(lt.create(),h,w)),lt.rotateZ(w,w,[0,0,0],cr/4),p.push(lt.add(lt.create(),d,w)),lt.rotateZ(w,w,[0,0,0],cr/4),y.push(lt.add(lt.create(),_,w)),lt.rotateZ(w,w,[0,0,0],cr/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])},rd=(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(!id(n,3))throw new Error("center must be an array of X, Y and Z values");if(!id(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(!nd(s,0))throw new Error("roundRadius must be positive");if(!nd(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 l3({center:n,size:i});if(i=i.map(l=>l/2),s>i[0]-zo||s>i[1]-zo||s>i[2]-zo)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 u=sd(n,i,s,r,l,!0),f=sd(n,i,s,r,l,!1);if(l===0&&(c=c.concat(u3(f,u))),o&&(c=c.concat(rd(o,u),od(o,u))),a&&(c=c.concat(rd(a,f),od(a,f))),l===r){let h=u.map(d=>d[0]);c.push(ks.create(h)),h=f.map(d=>d[0]),c.push(ks.create(h))}o=u,a=f}return td.create(c)};var h3=f3;const{EPS:d3,TAU:ad}=Qe,ve=$e,cd=At,p3=rt,{sin:ld,cos:ud}=qt,{isGTE:bo,isNumberArray:m3}=xt,g3=dg,_3=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(!m3(n,3))throw new Error("center must be an array of X, Y and Z values");if(!bo(i,0))throw new Error("height must be positive");if(!bo(s,0))throw new Error("radius must be positive");if(!bo(r,0))throw new Error("roundRadius must be positive");if(r>s)throw new Error("roundRadius must be smaller than the radius");if(!bo(o,4))throw new Error("segments must be four or more");if(i===0||s===0)return cd.create();if(r===0)return g3({center:n,height:i,radius:s});const a=[0,0,-(i/2)],c=[0,0,i/2],l=ve.subtract(ve.create(),c,a),u=ve.length(l);if(2*r>u-d3)throw new Error("height must be larger than twice roundRadius");let f;Math.abs(l[0])>Math.abs(l[1])?f=ve.fromValues(0,1,0):f=ve.fromValues(1,0,0);const h=ve.scale(ve.create(),ve.normalize(ve.create(),l),r),d=ve.scale(ve.create(),ve.normalize(ve.create(),ve.cross(ve.create(),h,f)),s),_=ve.scale(ve.create(),ve.normalize(ve.create(),ve.cross(ve.create(),d,h)),s);ve.add(a,a,h),ve.subtract(c,c,h);const g=Math.floor(.25*o),m=b=>{const w=b.map(D=>ve.add(D,D,n));return p3.create(w)},p=[],y=ve.create(),E=ve.create();let v;for(let b=0;b<=o;b++){const w=ad*b/o,D=ve.add(ve.create(),ve.scale(y,d,ud(w)),ve.scale(E,_,ld(w)));if(b>0){let x=[];x.push(ve.add(ve.create(),a,D)),x.push(ve.add(ve.create(),a,v)),x.push(ve.add(ve.create(),c,v)),x.push(ve.add(ve.create(),c,D)),p.push(m(x));let T,I;for(let z=0;z<=g;z++){const U=ad/4*z/g,O=ud(U),H=ld(U);if(z>0){x=[];let G;G=ve.add(ve.create(),a,ve.subtract(y,ve.scale(y,v,T),ve.scale(E,h,I))),x.push(G),G=ve.add(ve.create(),a,ve.subtract(y,ve.scale(y,D,T),ve.scale(E,h,I))),x.push(G),z{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(!pd(n,2))throw new Error("center must be an array of X and Y values");if(!pd(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(!dd(s,0))throw new Error("roundRadius must be positive");if(!dd(r,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0)return hd.create();if(s===0)return x3({center:n,size:i});if(i=i.map(g=>g/2),s>i[0]-fd||s>i[1]-fd)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]]),u=ot.add(ot.create(),n,[i[0]-s,s-i[1]]),f=[],h=[],d=[],_=[];for(let g=0;g<=o;g++){const m=To/4*g/o,p=ot.fromAngleRadians(ot.create(),m);ot.scale(p,p,s),f.push(ot.add(ot.create(),a,p)),ot.rotate(p,p,ot.create(),To/4),h.push(ot.add(ot.create(),c,p)),ot.rotate(p,p,ot.create(),To/4),d.push(ot.add(ot.create(),l,p)),ot.rotate(p,p,ot.create(),To/4),_.push(ot.add(ot.create(),u,p))}return hd.fromPoints(f.concat(h,d,_))};var E3=M3;const S3=pg,{isGTE:y3}=xt,b3=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(!y3(i,0))throw new Error("radius must be positive");return i=[i,i,i],S3({center:n,radius:i,segments:s,axes:r})};var T3=b3;const w3=Kl,{isGTE:A3}=xt,R3=t=>{const e={center:[0,0],size:2};let{center:n,size:i}=Object.assign({},e,t);if(!A3(i,0))throw new Error("size must be positive");return i=[i,i],w3({center:n,size:i})};var P3=R3;const{TAU:gg}=Qe,gr=Xe,C3=wt,{isGT:L3,isGTE:wo,isNumberArray:D3}=xt,U3=(t,e)=>t>0&&e>1&&e{const s=gg/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(!D3(n,2))throw new Error("center must be an array of X and Y values");if(!wo(i,2))throw new Error("vertices must be two or more");if(!L3(s,0))throw new Error("outerRadius must be greater than zero");if(!wo(r,0))throw new Error("innerRadius must be greater than zero");if(!wo(a,0))throw new Error("startAngle must be greater than zero");if(i=Math.floor(i),o=Math.floor(o),a=a%gg,r===0){if(!wo(o,2))throw new Error("density must be two or more");r=s*U3(i,o)}const c=gr.clone(n),l=md(i,s,a,c),u=md(i,r,a+Math.PI/i,c),f=[];for(let h=0;ht.reduce((e,n)=>Array.isArray(n)?e.concat(_g(n)):e.concat(n),[]);var ns=_g;const F3=ns,gd=ut,_d=Zs,vd=wt,xd=At,Md=li,O3=(t,...e)=>{const n={origin:[0,0,0],normal:[0,0,1]},{origin:i,normal:s}=Object.assign({},n,t);if(e=F3(e),e.length===0)throw new Error("wrong number of arguments");const r=_d.fromNormalAndPoint(_d.create(),s,i);if(Number.isNaN(r[0]))throw new Error("the given origin and normal do not define a proper plane");const o=gd.mirrorByPlane(gd.create(),r),a=e.map(c=>Md.isA(c)?Md.transform(o,c):vd.isA(c)?vd.transform(o,c):xd.isA(c)?xd.transform(o,c):c);return a.length===1?a[0]:a},B3=(...t)=>O3({normal:[1,0,0]},t);var z3={mirrorX:B3};const Ed=Zs,Fi=$e,H3=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 Ed.fromPoints(Ed.create(),r[0],i[0],i[1])};var vg=H3;const V3=t=>(t||(t=[]),{edges:t});var is=V3;const G3=is,Sd=$e,$3=(...t)=>{let e,n;return t.length===1?(e=G3(),n=t[0]):(e=t[0],n=t[1]),e.edges=n.edges.map(i=>[Sd.clone(i[0]),Sd.clone(i[1])]),e};var k3=$3;const W3=$e,X3=(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=W3.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([Ao.fromVec2(Ao.create(),n),Ao.fromVec2(Ao.create(),i)]),i.length===3&&e.push([n,i]),n=i}),Y3(e)};var K3=j3;const Ro=$e,Z3=is,J3=t=>{if(!Array.isArray(t))throw new Error("the given sides must be an array");const e=[];return t.forEach(n=>{e.push([Ro.fromVec2(Ro.create(),n[0]),Ro.fromVec2(Ro.create(),n[1])])}),Z3(e)};var Q3=J3;const eD=t=>!!(t&&typeof t=="object"&&"edges"in t&&Array.isArray(t.edges));var tD=eD;const nD=is,iD=(...t)=>{let e,n;return t.length===1?(e=nD(),n=t[0]):(e=t[0],n=t[1]),e.edges=n.edges.map(i=>[i[1],i[0]]),e};var sD=iD;const rD=t=>t.edges;var oD=rD;const aD=(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||u>0&&s;)l!==0&&(u===0||!s||e(i)<=e(s))?(r=i,i=i.nextZ,l--):(r=s,s=s.nextZ,u--),c?c.nextZ=r:t=r,r.prevZ=c,c=r;i=s}c.nextZ=null,a*=2}while(o>1);return t};var cD=aD;const lD=cD;let xg=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 uD=(t,e,n,i)=>{const s=new xg(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},fD=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 Mg={Node:xg,insertNode:uD,removeNode:fD,sortLinked:lD};const hD=(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,dD=(t,e,n)=>(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);var Zl={area:dD,pointInTriangle:hD};const{Node:yd,insertNode:bd,removeNode:Yo}=Mg,{area:Yt}=Zl,pD=(t,e,n,i,s)=>{let r;if(s===MD(t,e,n,i)>0)for(let o=e;o=e;o-=i)r=bd(o,t[o],t[o+1],r);return r&&va(r,r.next)&&(Yo(r),r=r.next),r},Eg=(t,e)=>{if(!t)return t;e||(e=t);let n=t,i;do if(i=!1,!n.steiner&&(va(n,n.next)||Yt(n.prev,n,n.next)===0)){if(Yo(n),n=e=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==e);return e},mD=(t,e,n)=>{let i=t;do{const s=i.prev,r=i.next.next;!va(s,r)&&Sg(s,i,i.next,r)&&Fr(s,r)&&Fr(r,s)&&(e.push(s.i/n),e.push(i.i/n),e.push(r.i/n),Yo(i),Yo(i.next),i=t=r),i=i.next}while(i!==t);return Eg(i)},gD=(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&&Sg(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1},Fr=(t,e)=>Yt(t.prev,t,t.next)<0?Yt(t,e,t.next)>=0&&Yt(t,t.prev,e)>=0:Yt(t,e,t.prev)<0||Yt(t,t.next,e)<0,_D=(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},vD=(t,e)=>{const n=new yd(t.i,t.x,t.y),i=new yd(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},xD=(t,e)=>t.next.i!==e.i&&t.prev.i!==e.i&&!gD(t,e)&&(Fr(t,e)&&Fr(e,t)&&_D(t,e)&&(Yt(t.prev,t,e.prev)||Yt(t,e.prev,e))||va(t,e)&&Yt(t.prev,t,t.next)>0&&Yt(e.prev,e,e.next)>0),Sg=(t,e,n,i)=>{const s=Math.sign(Yt(t,e,n)),r=Math.sign(Yt(t,e,i)),o=Math.sign(Yt(n,i,t)),a=Math.sign(Yt(n,i,e));return!!(s!==r&&o!==a||s===0&&Po(t,n,e)||r===0&&Po(t,i,e)||o===0&&Po(n,t,i)||a===0&&Po(n,e,i))},Po=(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),MD=(t,e,n,i)=>{let s=0;for(let r=e,o=n-i;rt.x===e.x&&t.y===e.y;var yg={cureLocalIntersections:mD,filterPoints:Eg,isValidDiagonal:xD,linkedPolygon:pD,locallyInside:Fr,splitPolygon:vD};const{filterPoints:ll,linkedPolygon:ED,locallyInside:SD,splitPolygon:yD}=yg,{area:Td,pointInTriangle:bD}=Zl,TD=(t,e,n,i)=>{const s=[];for(let r=0,o=e.length;rr.x-o.x);for(let r=0;r{const n=AD(t,e);if(!n)return e;const i=yD(n,t),s=ll(n,n.next);return ll(i,i.next),e===n?s:e},AD=(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 f=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=i&&f>r){if(r=f,f===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&&bD(so.x||n.x===o.x&&RD(o,n)))&&(o=n,u=f)}n=n.next}while(n!==a);return o},RD=(t,e)=>Td(t.prev,t,e.prev)<0&&Td(e.next,t,t.next)<0,PD=t=>{let e=t,n=t;do(e.x{const i=e&&e.length,s=i?e[0]*n:t.length;let r=FD(t,0,s,n,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,u,f;if(i&&(r=LD(t,e,r,n)),t.length>80*n){a=l=t[0],c=u=t[1];for(let h=n;hl&&(l=d),_>u&&(u=_)}f=Math.max(l-a,u-c),f=f!==0?1/f:0}return Or(r,o,n,a,c,f),o},Or=(t,e,n,i,s,r,o)=>{if(!t)return;!o&&r&&GD(t,i,s,r);let a=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,r?HD(t,i,s,r):zD(t)){e.push(c.i/n),e.push(t.i/n),e.push(l.i/n),DD(t),t=l.next,a=l.next;continue}if(t=l,t===a){o?o===1?(t=ID(jo(t),e,n),Or(t,e,n,i,s,r,2)):o===2&&VD(t,e,n,i,s,r):Or(jo(t),e,n,i,s,r,1);break}}},zD=t=>{const e=t.prev,n=t,i=t.next;if(Vi(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)&&Vi(s.prev,s,s.next)>=0)return!1;s=s.next}return!0},HD=(t,e,n,i)=>{const s=t.prev,r=t,o=t.next;if(Vi(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,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,f=ul(a,c,e,n,i),h=ul(l,u,e,n,i);let d=t.prevZ,_=t.nextZ;for(;d&&d.z>=f&&_&&_.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)&&Vi(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)&&Vi(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;d&&d.z>=f;){if(d!==t.prev&&d!==t.next&&_r(s.x,s.y,r.x,r.y,o.x,o.y,d.x,d.y)&&Vi(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)&&Vi(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0},VD=(t,e,n,i,s,r)=>{let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&ND(o,a)){let c=OD(o,a);o=jo(o,o.next),c=jo(c,c.next),Or(o,e,n,i,s,r),Or(c,e,n,i,s,r);return}a=a.next}o=o.next}while(o!==t)},GD=(t,e,n,i)=>{let s=t;do s.z===null&&(s.z=ul(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,UD(s,r=>r.z)},ul=(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 $D=BD;const{NEPS:Lc}=Qe,kD=(t,e)=>Math.abs(t[0]-e[0])<=Lc&&Math.abs(t[1]-e[1])<=Lc&&Math.abs(t[2]-e[2])<=Lc;var WD=kD;const XD=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 YD=qD;const jD=(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 KD=jD,Tg={area:bg,solve2Linear:KD};const ZD=bg,JD=t=>ZD(t.vertices);var QD=JD;const eU=t=>((t===void 0||t.length<3)&&(t=[]),{vertices:t});var tU=eU;const nU=tU,iU=t=>{const e=t.vertices.slice().reverse();return nU(e)};var sU=iU;const rU=QD,oU=sU,aU=(t,e)=>{if(t.length===0)return 0;const n=e.vertices;return n.length<3?0:(rU(e)<0&&(e=oU(e)),t.reduce((s,r)=>s+cU(r,n),0)===t.length?1:0)},cU=(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 u=n+1;--u;){const f=o[1]>s;if(a!==f){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=f,r=o,o=e[++l]}return c};var lU=aU,uU={arePointsInside:lU};const{area:fU}=Tg,{toOutlines:hU}=wt,{arePointsInside:dU}=uU,pU=t=>{const e=hU(t),n=[],i=[];e.forEach((o,a)=>{const c=fU(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,u)=>{const f=e[l];dU([f[0]],{vertices:c})&&(s[a].push(l),r[u]||(r[u]=[]),r[u].push(a))})}),i.forEach((o,a)=>{if(r[a]&&r[a].length>1){const c=mU(r[a],l=>s[l].length);r[a].forEach((l,u)=>{u!==c&&(s[l]=s[l].filter(f=>f!==o))})}}),s.map((o,a)=>({solid:e[n[a]],holes:o.map(c=>e[c])}))},mU=(t,e)=>{let n,i;return t.forEach((s,r)=>{const o=e(s);(i===void 0||oo.map(a=>this.to2D(a))),r=_U.create(s);this.roots=MU(r)}to2D(e){const n=vU.fromValues(Tt.dot(e,this.u),Tt.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=Tt.scale(Tt.create(),this.u,e[0]),s=Tt.scale(Tt.create(),this.v,e[1]),r=Tt.scale(Tt.create(),wd,wd[3]),o=Tt.add(i,i,r);return Tt.add(s,s,o)}}};var SU=EU;const yU=rt,bU=$D,TU=SU,wU=t=>{const e=new TU(t),n=[];return e.roots.forEach(({solid:i,holes:s})=>{let r=i.length;const o=[];s.forEach((f,h)=>{o.push(r),r+=f.length});const a=[i,...s].flat(),c=a.flat(),l=f=>e.to3D(a[f]),u=bU(c,o);for(let f=0;ft.reduce((e,n)=>e+=`[${Ad.toString(n[0])}, ${Ad.toString(n[1])}], `,""),PU=t=>`[${RU(t.edges)}]`;var CU=PU;const Co=$e,LU=is,DU=(t,e)=>{const n=e.edges.map(i=>[Co.transform(Co.create(),i[0],t),Co.transform(Co.create(),i[1],t)]);return LU(n)};var UU=DU,Jl={calculatePlane:vg,clone:k3,create:is,equals:q3,fromPoints:K3,fromSides:Q3,isA:tD,reverse:sD,toEdges:oD,toPolygons:AU,toString:CU,transform:UU};const Rd=$e,IU=is,NU=t=>{if(!t.edges)return t;let e=t.edges;const n=new Map,i=new Map;e=e.filter(o=>!Rd.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(u=>{const f=n.get(u),h=Rd.distance(a,f);hu[0].toString()===o?[l,u[1]]:u[1].toString()===o?[u[0],l]:u)}),IU(e)};var FU=NU;const{EPS:Pd}=Qe,Ts=$e,Lo=rt,Cd=Jl,fl=(t,e)=>t===e?t:tt*e/fl(t,e),Ld=(t,e)=>{const n=t/e.length;if(n===1)return e;const i=Ts.fromValues(n,n,n),s=[];return e.forEach(r=>{const o=Ts.subtract(Ts.create(),r[1],r[0]);Ts.divide(o,o,i);let a=r[0];for(let c=1;c<=n;++c){const l=Ts.add(Ts.create(),a,o);s.push([a,l]),a=l}}),s},Dd=Pd*Pd/2*Math.sin(Math.PI/3),BU=(t,e)=>{let n=Cd.toEdges(t),i=Cd.toEdges(e);if(n.length!==i.length){const r=OU(n.length,i.length);r!==n.length&&(n=Ld(r,n)),r!==i.length&&(i=Ld(r,i))}const s=[];return n.forEach((r,o)=>{const a=i[o],c=Lo.create([r[0],r[1],a[1]]),l=Lo.measureArea(c);Number.isFinite(l)&&l>Dd&&s.push(c);const u=Lo.create([r[0],a[1],a[0]]),f=Lo.measureArea(u);Number.isFinite(f)&&f>Dd&&s.push(u)}),s};var zU=BU;const Ud=ut,Id=wt,HU=At,hl=rt,Si=Jl,VU=FU,Nd=zU,GU=(t,e,n)=>{let i=null;return Id.isA(n)&&(i=Si.fromSides(Id.toSides(n))),hl.isA(n)&&(i=Si.fromPoints(hl.toPoints(n))),t===0||t===1?Si.transform(Ud.fromTranslation(Ud.create(),[0,0,t]),i):null},$U=(t,e)=>{const n={numberOfSlices:2,capStart:!0,capEnd:!0,close:!1,repair:!0,callback:GU},{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=VU(e));const l=i-1;let u=null,f=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=Do.toSides(e);if(l.length===0)throw new Error("the given geometry cannot be empty");const u=l.filter(y=>y[0][0]<0),f=l.filter(y=>y[0][0]>=0);u.length>0&&f.length>0&&o==="cap"&&(u.length>f.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=Do.create(l),e=WU(e)):f.length>=u.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=Do.create(l)));const d=c/i,_=Math.abs(c){let M=d*E+s;return c===nn&&E===i&&(M=s),lr.multiply(m,lr.fromZRotation(m,M),lr.fromXRotation(lr.create(),nn/4)),Dc.transform(m,v)};return t={numberOfSlices:i+1,capStart:_,capEnd:_,close:!_,callback:p},XU(t,g)};var YU=qU;const jU=ns,Fd=ut,Od=wt,Bd=At,zd=li,KU=(t,...e)=>{if(!Array.isArray(t))throw new Error("angles must be an array");if(e=jU(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=Fd.fromTaitBryanRotation(Fd.create(),n,i,s),o=e.map(a=>zd.isA(a)?zd.transform(r,a):Od.isA(a)?Od.transform(r,a):Bd.isA(a)?Bd.transform(r,a):a);return o.length===1?o[0]:o};var ZU={rotate:KU};const JU=ns,Hd=ut,Vd=wt,Gd=At,$d=li,xa=(t,...e)=>{if(!Array.isArray(t))throw new Error("offset must be an array");if(e=JU(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=>$d.isA(s)?$d.transform(n,s):Vd.isA(s)?Vd.transform(n,s):Gd.isA(s)?Gd.transform(n,s):s);return i.length===1?i[0]:i},QU=(t,...e)=>xa([t,0,0],e),eI=(t,...e)=>xa([0,t,0],e),tI=(t,...e)=>xa([0,0,t],e);var vr={translate:xa,translateX:QU,translateY:eI,translateZ:tI};const{TAU:nI}=Qe,iI=YU,{rotate:sI}=ZU,{translate:rI}=vr,oI=Km,{isGT:Uc,isGTE:Ic}=xt,aI=t=>{const e={innerRadius:1,innerSegments:32,outerRadius:4,outerSegments:32,innerRotation:0,startAngle:0,outerRotation:nI},{innerRadius:n,innerSegments:i,outerRadius:s,outerSegments:r,innerRotation:o,startAngle:a,outerRotation:c}=Object.assign({},e,t);if(!Uc(n,0))throw new Error("innerRadius must be greater than zero");if(!Ic(i,3))throw new Error("innerSegments must be three or more");if(!Uc(s,0))throw new Error("outerRadius must be greater than zero");if(!Ic(r,3))throw new Error("outerSegments must be three or more");if(!Ic(a,0))throw new Error("startAngle must be positive");if(!Uc(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=oI({radius:n,segments:i});return o!==0&&(l=sI([0,0,o],l)),l=rI([s,0],l),iI({startAngle:a,angle:c,segments:r},l)};var cI=aI;const{NEPS:Ws}=Qe,ur=Xe,lI=wt,{isNumberArray:uI}=xt,dl=(t,e,n)=>Math.acos((t*t+e*e-n*n)/(2*t*e)),fI=(t,e,n)=>e>Ws?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)),hI=t=>{if(Math.abs(t[0]+t[1]+t[2]-Math.PI)>Ws)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 Js(n,i,s,o,a,r)},dI=t=>{const e=t[0],n=t[1],i=Math.PI+Ws-e-n;if(i{const e=t[0],n=t[2],i=Math.PI+Ws-e-n;if(i{const e=t[0],n=t[1],i=t[2],s=fI(e,n,i),r=dl(s,e,i),o=Math.PI-r-n;return Js(r,n,o,i,s,e)},gI=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 Js(s,r,i,n,o,e)},_I=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=dl(n,i,e),r=dl(i,e,n),o=Math.PI-s-r;return Js(s,r,o,e,n,i)},Js=(t,e,n,i,s,r)=>{const o=ur.fromValues(0,0),a=ur.fromValues(r,0),c=ur.fromValues(i,0);return ur.add(c,ur.rotate(c,c,[0,0],Math.PI-e),a),lI.fromPoints([o,a,c])},vI=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(!uI(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 hI(i);case"AAS":return dI(i);case"ASA":return pI(i);case"SAS":return mI(i);case"SSA":return gI(i);case"SSS":return _I(i);default:throw new Error("invalid triangle type, try again")}};var xI=vI,Uo={arc:B2,circle:Km,cube:FL,cuboid:jl,cylinder:dg,cylinderElliptic:hg,ellipse:jm,ellipsoid:pg,geodesicSphere:e3,line:i3,polygon:r3,polyhedron:mg,rectangle:Kl,roundedCuboid:h3,roundedCylinder:v3,roundedRectangle:E3,sphere:T3,square:P3,star:N3,torus:cI,triangle:xI};function MI({width:t,length:e}){const o=t+.5,a=e+.5,c=vr.translate([0,a/2+2.5/2,0],Uo.cuboid({size:[o+5,2.5,10]})),l=vr.translate([0,-a/2-2.5/2,0],Uo.cuboid({size:[o+5,2.5,10]})),u=vr.translate([o/2+2.5/2,0,0],Uo.cuboid({size:[2.5,a+5,10]})),f=vr.translate([-o/2-2.5/2,0,0],Uo.cuboid({size:[2.5,a+5,10]}));return[c,l,u,f]}var wg={geom2:wt,geom3:At,path2:li,poly3:rt};const EI=()=>[0,1,0];var Ql=EI;const SI=Ql,yI=t=>{const e=SI();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e};var bI=yI;const Nc=Xe,TI=t=>{const e=Nc.normal(Nc.create(),t);return Nc.negate(e,e),e};var eu=TI;const kd=Xe,wI=t=>kd.scale(kd.create(),t,t[2]);var Ma=wI;const fr=Xe,AI=eu,RI=Ma,PI=(t,e)=>{const n=RI(t),i=AI(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 CI=PI;const LI=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t);var Ag=LI;const DI=Xe,UI=(t,e)=>{let n=DI.dot(e,t);return n=Math.abs(n-t[2]),n};var II=UI;const NI=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2];var FI=NI;const hr=Xe,OI=(t,e,n)=>{const i=hr.subtract(hr.create(),n,e);hr.normal(i,i),hr.normalize(i,i);const s=hr.dot(e,i);return t[0]=i[0],t[1]=i[1],t[2]=s,t};var Rg=OI;const BI=Ql,zI=(t,e,n)=>{const i=BI();return i[0]=t,i[1]=e,i[2]=n,i};var Pg=zI;const HI=Xe,{solve2Linear:VI}=Tg,GI=(t,e)=>{const n=VI(t[0],t[1],e[0],e[1],t[2],e[2]);return HI.clone(n)};var $I=GI;const Wd=Xe,kI=Ag,WI=Pg,XI=(t,e)=>{const n=Wd.negate(Wd.create(),e),i=-e[2];return kI(t,WI(n[0],n[1],i))};var qI=XI;const YI=t=>`line2: (${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)})`;var jI=YI;const Xd=Xe,KI=Rg,ZI=Ma,JI=eu,QI=(t,e,n)=>{const i=ZI(e),s=JI(e);return Xd.transform(i,i,n),Xd.transform(s,s,n),KI(t,i,s)};var eN=QI;const tN=Ma,nN=(t,e)=>{let n=(t[2]-t[1]*e)/t[0];return Number.isNaN(n)&&(n=tN(t)[0]),n};var iN=nN,sN={clone:bI,closestPoint:CI,copy:Ag,create:Ql,direction:eu,distanceToPoint:II,equals:FI,fromPoints:Rg,fromValues:Pg,intersectPointOfLines:$I,origin:Ma,reverse:qI,toString:jI,transform:eN,xAtY:iN};const rN=ns,In=Xe,dr=$e,Cg=wt,Lg=At,Dg=li,qd=rt,Xs=new WeakMap,oN=t=>{let e=Xs.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],Xs.set(t,e),e},aN=t=>{let e=Xs.get(t);if(e)return e;const n=Cg.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],Xs.set(t,e),e},cN=t=>{let e=Xs.get(t);if(e)return e;const n=Lg.toPolygons(t);let i=dr.create();if(n.length>0){const r=qd.toPoints(n[0]);dr.copy(i,r[0])}let s=dr.clone(i);return n.forEach(r=>{qd.toPoints(r).forEach(o=>{dr.min(i,i,o),dr.max(s,s,o)})}),i=[i[0],i[1],i[2]],s=[s[0],s[1],s[2]],e=[i,s],Xs.set(t,e),e},lN=(...t)=>{if(t=rN(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>Dg.isA(n)?oN(n):Cg.isA(n)?aN(n):Lg.isA(n)?cN(n):[[0,0,0],[0,0,0]]);return e.length===1?e[0]:e};var uN=lN;const{EPS:fN}=Qe,hN=(t,e)=>{let n=0;for(let i=0;itu(nu(t),2),xN=t=>tu(nu(t),2),MN=t=>tu(nu(t),3),EN=(...t)=>{if(t=pN(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>_N.isA(n)?vN(n):mN.isA(n)?xN(n):gN.isA(n)?MN(n):0);return e.length===1?e[0]:e};var Ug=EN;const SN=(t,e)=>t-e;var yN=SN;const bN=(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 TN=bN,wN={fnNumberSort:yN,insertSorted:TN};const Yd=ut,AN=Xe,pt=$e,Ig=function(t,e){arguments.length<2&&(e=pt.orthogonal(pt.create(),t)),this.v=pt.normalize(pt.create(),pt.cross(pt.create(),t,e)),this.u=pt.cross(pt.create(),this.v,t),this.plane=t,this.planeorigin=pt.scale(pt.create(),t,t[3])};Ig.prototype={getProjectionMatrix:function(){return Yd.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=pt.scale(pt.create(),this.plane,this.plane[3]);return Yd.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 AN.fromValues(pt.dot(t,this.u),pt.dot(t,this.v))},to3D:function(t){const e=pt.scale(pt.create(),this.u,t[0]),n=pt.scale(pt.create(),this.v,t[1]),i=pt.add(e,e,this.planeorigin);return pt.add(n,n,i)}};var RN=Ig;const{EPS:Kn}=Qe,xi=sN,En=Xe,PN=RN,ws=YD,{insertSorted:CN,fnNumberSort:LN}=wN,jd=rt,DN=t=>{if(t.length<2)return t;const e=[],n=t.length,i=jd.plane(t[0]),s=new PN(i),r=[],o=[],a=new Map,c=new Map,l=new Map,u=10/Kn;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 f=[];c.forEach((_,g)=>f.push(g)),f.sort(LN);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 z=x-1;z<0&&(z=w-1),v.bottomright=b[z]}}}let y;if(_>=f.length-1)h=[],y=null;else{y=Number(f[_+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 H=T+1;if(H>=D&&(H=0),w[H][1]!==m||H===x)break;T=H}let I=x;for(;;){let H=I-1;if(H<0&&(H=D-1),w[H][1]!==m||H===T)break;I=H}let z=T+1;z>=D&&(z=0);let U=I-1;U<0&&(U=D-1);const O={polygonindex:b,leftvertexindex:T,rightvertexindex:I,topleft:w[T],topright:w[I],bottomleft:w[z],bottomright:w[U]};CN(h,O,(H,G)=>{const k=ws(H.topleft,H.bottomleft,E),W=ws(G.topleft,G.bottomleft,E);return k>W?1:k0){const I=g[g.length-1],z=En.distance(T.topleft,I.topright),U=En.distance(T.bottomleft,I.bottomright);z0){const E=new Set,v=new Set;for(let M=0;M=0,W=G||O>=0;k&&W&&(b.outpolygon=D.outpolygon,b.leftlinecontinues=H,b.rightlinecontinues=G,E.add(w));break}}}for(let M=0;MKn&&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=jd.fromPointsAndPlane(D,i);x.vertices.length&&e.push(x)}}for(let E=0;EKn&&v.outpolygon.rightpoints.push(v.topright))}d=g}return e};var UN=DN;const Kd=At,IN=rt,{NEPS:NN}=Qe,FN=UN,ON=t=>{if(t.isRetesselated)return t;const e=Kd.toPolygons(t).map((r,o)=>({vertices:r.vertices,plane:IN.plane(r),index:o})),n=BN(e),i=[];n.forEach(r=>{if(Array.isArray(r)){const o=FN(r);i.push(...o)}else i.push(r)});const s=Kd.create(i);return s.isRetesselated=!0,s},BN=t=>{let e=[t];const n=[];for(let s=3;s>=0;s--){const r=[],o=s===3?15e-9:NN;e.forEach(a=>{a.sort(zN(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},zN=(t,e)=>(n,i)=>n.plane[t]-i.plane[t]>e?1:i.plane[t]-n.plane[t]>e?-1:0;var HN=ON;const Fc=$e,Ng=rt,VN=(t,e)=>{const n=Math.abs(Ng.measureArea(e));return Number.isFinite(n)&&n>t},GN=(t,e)=>{let n=e.map(s=>{const r=s.vertices.map(c=>Fc.snap(Fc.create(),c,t)),o=[];for(let c=0;cVN(i,s)),n};var Fg=GN;const $N=WD,Ls=$e,Ko=rt,kN=t=>{const e=Ko.toPoints(t),n=[];for(let i=0;i{const n=`${e.v1}:${e.v2}`;t.set(n,e)},Oc=(t,e)=>{const n=`${e.v1}:${e.v2}`;t.delete(n)},XN=(t,e)=>{const n=`${e.v2}:${e.v1}`;return t.get(n)},qN=(t,e,n)=>{let i=t.prev.v1,s=t.prev.v2,r=e.next.v2;const o=Zd(i,s,r,n);i=e.prev.v1,s=e.prev.v2,r=t.next.v2;const a=Zd(i,s,r,n);return[o,a]},YN=Ls.create(),jN=Ls.create(),Zd=(t,e,n,i)=>{const s=Ls.subtract(YN,e,t),r=Ls.subtract(jN,n,e);return Ls.cross(s,s,r),Ls.dot(s,i)},KN=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=Ko.create(n)),e},ZN=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=kN(r);for(let a=0;a=0&&u[1]>=0){const f=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,Oc(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,Oc(_,g),g.v1=null,g.v2=null,g.next=null,g.prev=null,Oc(_,m),m.v1=null,m.v2=null,m.next=null,m.prev=null};u[0]===0&&d(i,f,f.prev),u[1]===0&&d(i,h,h.prev)}}else c.next&&WN(i,c)}}const s=[];return i.forEach(r=>{const o=KN(r);o&&s.push(o)}),i.clear(),s},JN=(t,e)=>Math.abs(t[3]-e[3])<15e-8?$N(t,e):!1,QN=(t,e)=>{const n=[];e.forEach(s=>{const r=n.find(o=>JN(o[0],Ko.plane(s)));r?r[1].push(s):n.push([Ko.plane(s),[s]])});let i=[];return n.forEach(s=>{const r=s[1],o=ZN(r);i=i.concat(o)}),i};var eF=QN;const Jd=Qe,Cn=$e,tF=rt,Vt=t=>`${t}`,Qd=(t,e,n,i,s,r)=>{const o=Vt(i),a=Vt(s),c=`${o}/${a}`,l=`${a}/${o}`;if(t.has(l))return Ho(t,e,n,s,i,null),null;const u={vertex0:i,vertex1:s,polygonindex:r};return t.has(c)?t.get(c).push(u):t.set(c,[u]),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},Ho=(t,e,n,i,s,r)=>{const o=Vt(i),a=Vt(s),c=`${o}/${a}`;let l=-1;const u=t.get(c);for(let f=0;f{const e=new Map;for(let n=0;n=3){let r=i.vertices[0],o=Vt(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=Vt(c.vertex0),u=Vt(c.vertex1);n.has(l)?n.get(l).push(o):n.set(l,[o]),i.has(u)?i.get(u).push(o):i.set(u,[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 f=e.get(c)[0];for(let h=0;h<2;h++){const d=h===0?f.vertex0:f.vertex1,_=h===0?f.vertex1:f.vertex0,g=Vt(d),m=Vt(_);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 z=Cn.scale(Cn.create(),T,I);if(Cn.add(z,z,w),Cn.squaredDistance(z,D){const i=e.vertices.length;if(i>3){if(i>4){const o=[0,0,0];e.vertices.forEach(a=>Bc.add(o,o,a)),Bc.snap(o,Bc.divide(o,o,[i,i,i]),t);for(let a=0;a{const n=[];return e.forEach(i=>{sF(t,i,n)}),n};var oF=rF;const aF=ns,cF=Ug,lF=wt,Og=At,uF=li,fF=Fg,hF=eF,dF=iF,pF=oF,mF=(t,e)=>e,gF=(t,e)=>e,_F=(t,e)=>{const n={snap:!1,simplify:!1,triangulate:!1},{snap:i,simplify:s,triangulate:r}=Object.assign({},n,t),o=cF(e);let a=Og.toPolygons(e);i&&(a=fF(o,a)),s&&(a=hF(o,a)),r&&(a=dF(a),a=pF(o,a));const c=Object.assign({},e);return c.polygons=a,c},vF=(t,...e)=>{if(e=aF(e),e.length===0)throw new Error("wrong number of arguments");const n=e.map(i=>{if(uF.isA(i))return mF(t,i);if(lF.isA(i))return gF(t,i);if(Og.isA(i))return _F(t,i);throw new Error("invalid geometry")});return n.length===1?n[0]:n};var xF=vF;const MF=ns,Gi=Xe,pl=wt,ml=At,gl=li,iu=Ug,EF=Fg,SF=t=>{const e=iu(t),i=gl.toPoints(t).map(s=>Gi.snap(Gi.create(),s,e));return gl.create(i)},yF=t=>{const e=iu(t);let i=pl.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])),pl.create(i)},bF=t=>{const e=iu(t),n=ml.toPolygons(t),i=EF(e,n);return ml.create(i)},TF=(...t)=>{if(t=MF(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>gl.isA(n)?SF(n):pl.isA(n)?yF(n):ml.isA(n)?bF(n):n);return e.length===1?e[0]:e};var wF=TF,AF={generalize:xF,snap:wF,retessellate:HN},su={geometries:wg,modifiers:AF};const Bg=t=>t.reduce((e,n)=>Array.isArray(n)?e.concat(Bg(n)):e.concat(n),[]);var RF=Bg;const PF=t=>Array.isArray(t)?t:t==null?[]:[t];var CF=PF,LF={flatten:RF,toArray:CF};const{geometries:Hc}=su,DF=(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)=>{Hc.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),u=new Int8Array(l),f=new ArrayBuffer(50),h=new Int8Array(f),d=new Float32Array(f,0,12),_=new Uint16Array(f,48,1);let g=0;return t.forEach(m=>{Hc.geom3.toPolygons(m).forEach((y,E)=>{const v=y.vertices,M=v.length,b=Hc.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,u.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 UF={serializeBinary:DF};const{geometries:zg}=su,IF=(t,e)=>{e.statusCallback&&e.statusCallback({progress:0});const n=`solid JSCAD -${NF(t,e)} +`)}`)};var DL=CL,Rt={clone:NR,create:Xr,fromPointsConvex:qC,fromPoints:ZC,fromCompactBinary:iL,invert:dL,isA:fg,toPoints:vL,toPolygons:xa,toString:SL,toCompactBinary:TL,transform:AL,validate:DL};const zh=Rt,UL=rt,{isNumberArray:Hh}=Mt,IL=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?zh.create():zh.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 UL.create(o)}))};var Zl=IL;const NL=Zl,{isGTE:FL}=Mt,OL=t=>{const e={center:[0,0,0],size:2};let{center:n,size:i}=Object.assign({},e,t);if(!FL(i,0))throw new Error("size must be positive");return i=[i,i,i],NL({center:n,size:i})};var BL=OL;const{EPS:Vh,TAU:_i}=Qe,yt=$e,zL=Rt,HL=rt,{sin:VL,cos:GL}=qt,{isGT:$L,isGTE:Cc,isNumberArray:Lc}=Mt,kL=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(!Lc(n,3))throw new Error("center must be an array of X, Y and Z values");if(!$L(i,0))throw new Error("height must be greater then zero");if(!Lc(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(!Lc(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(!Cc(r,0))throw new Error("startAngle must be positive");if(!Cc(a,0))throw new Error("endAngle must be positive");if(!Cc(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 u=Math.min(s[0],s[1],o[0],o[1]),f=Math.acos((u*u+u*u-Vh*Vh)/(2*u*u));if(l{const z=T*l+r;return yt.scale(y,m,I[0]*GL(z)),yt.scale(E,p,I[1]*VL(z)),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 HL.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)))),zL.create(w)};var hg=kL;const WL=Rt,XL=hg,{isGTE:qL}=Mt,YL=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(!qL(s,0))throw new Error("radius must be positive");return i===0||s===0?WL.create():XL({center:n,height:i,startRadius:[s,s],endRadius:[s,s],segments:r})};var dg=YL;const{TAU:Gh}=Qe,Ae=$e,$h=Rt,kh=rt,{sin:Wh,cos:Xh}=qt,{isGTE:jL,isNumberArray:qh}=Mt,KL=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(!qh(n,3))throw new Error("center must be an array of X, Y and Z values");if(!qh(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(!jL(s,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0||i[2]===0)return $h.create();const o=Ae.scale(Ae.create(),Ae.normalize(Ae.create(),r[0]),i[0]),a=Ae.scale(Ae.create(),Ae.normalize(Ae.create(),r[1]),i[1]),c=Ae.scale(Ae.create(),Ae.normalize(Ae.create(),r[2]),i[2]),l=Math.round(s/4);let u;const f=[],h=Ae.create(),d=Ae.create();for(let _=0;_<=s;_++){const g=Gh*_/s,m=Ae.add(Ae.create(),Ae.scale(h,o,Xh(g)),Ae.scale(d,a,Wh(g)));if(_>0){let p,y;for(let E=0;E<=l;E++){const v=Gh/4*E/l,M=Xh(v),b=Wh(v);if(E>0){let w=[],D;D=Ae.subtract(Ae.create(),Ae.scale(h,u,p),Ae.scale(d,c,y)),w.push(Ae.add(D,D,n)),D=Ae.subtract(Ae.create(),Ae.scale(h,m,p),Ae.scale(d,c,y)),w.push(Ae.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(!Yh(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(!Yh(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=JL.create(a.map(u=>n[u]));return s&&s[c]&&(l.color=s[c]),l});return ZL.create(o)};var mg=QL;const jh=ft,Kh=$e,Zh=Rt,e3=mg,{isGTE:Jh}=Mt,t3=t=>{const e={radius:1,frequency:6};let{radius:n,frequency:i}=Object.assign({},e,t);if(!Jh(n,0))throw new Error("radius must be positive");if(!Jh(i,6))throw new Error("frequency must be six or more");if(n===0)return Zh.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=[],u=0;for(let h=0;h{if(!Array.isArray(t))throw new Error("points must be an array");return i3.fromPoints({},t)};var r3=s3;const To=At,o3=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((u,f)=>{if(!Array.isArray(u))throw new Error("list of points "+f+" must be an array");if(u.length<3)throw new Error("list of points "+f+" must contain three or more points");u.forEach((h,d)=>{if(!Array.isArray(h))throw new Error("list of points "+f+", point "+d+" must be an array");if(h.length<2)throw new Error("list of points "+f+", point "+d+" must contain by X and Y values")})});let o=i;if(i.length===0){let u=0;o=r.map(f=>f.map(h=>u++))}const a=[];r.forEach(u=>u.forEach(f=>a.push(f)));let c=[];o.forEach(u=>{const f=u.map(d=>a[d]),h=To.fromPoints(f);c=c.concat(To.toSides(h))});let l=To.create(c);return s==="clockwise"&&(l=To.reverse(l)),l};var a3=o3;const vi=Xe,Qh=At,{isNumberArray:ed}=Mt,c3=t=>{const e={center:[0,0],size:[2,2]},{center:n,size:i}=Object.assign({},e,t);if(!ed(n,2))throw new Error("center must be an array of X and Y values");if(!ed(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 Qh.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 Qh.fromPoints(o)};var Jl=c3;const{EPS:Vo,TAU:cr}=Qe,Dc=Xe,lt=$e,td=Rt,ks=rt,{sin:l3,cos:u3}=qt,{isGTE:nd,isNumberArray:id}=Mt,f3=Zl,sd=(t,e,n,i,s,r)=>{const o=cr/4*s/i,a=u3(o),c=l3(o),l=i-s;let u=n*a,f=e[2]-(n-n*c);r||(f=n-n*c-e[2]),u=u>Vo?u:0;const h=lt.add(lt.create(),t,[e[0]-n,e[1]-n,f]),d=lt.add(lt.create(),t,[n-e[0],e[1]-n,f]),_=lt.add(lt.create(),t,[n-e[0],n-e[1],f]),g=lt.add(lt.create(),t,[e[0]-n,n-e[1],f]),m=[],p=[],y=[],E=[];for(let v=0;v<=l;v++){const M=l>0?cr/4*v/l:0,b=Dc.fromAngleRadians(Dc.create(),M);Dc.scale(b,b,u);const w=lt.fromVec2(lt.create(),b);m.push(lt.add(lt.create(),h,w)),lt.rotateZ(w,w,[0,0,0],cr/4),p.push(lt.add(lt.create(),d,w)),lt.rotateZ(w,w,[0,0,0],cr/4),y.push(lt.add(lt.create(),_,w)),lt.rotateZ(w,w,[0,0,0],cr/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])},rd=(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(!id(n,3))throw new Error("center must be an array of X, Y and Z values");if(!id(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(!nd(s,0))throw new Error("roundRadius must be positive");if(!nd(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 f3({center:n,size:i});if(i=i.map(l=>l/2),s>i[0]-Vo||s>i[1]-Vo||s>i[2]-Vo)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 u=sd(n,i,s,r,l,!0),f=sd(n,i,s,r,l,!1);if(l===0&&(c=c.concat(h3(f,u))),o&&(c=c.concat(rd(o,u),od(o,u))),a&&(c=c.concat(rd(a,f),od(a,f))),l===r){let h=u.map(d=>d[0]);c.push(ks.create(h)),h=f.map(d=>d[0]),c.push(ks.create(h))}o=u,a=f}return td.create(c)};var p3=d3;const{EPS:m3,TAU:ad}=Qe,ve=$e,cd=Rt,g3=rt,{sin:ld,cos:ud}=qt,{isGTE:wo,isNumberArray:_3}=Mt,v3=dg,x3=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(!_3(n,3))throw new Error("center must be an array of X, Y and Z values");if(!wo(i,0))throw new Error("height must be positive");if(!wo(s,0))throw new Error("radius must be positive");if(!wo(r,0))throw new Error("roundRadius must be positive");if(r>s)throw new Error("roundRadius must be smaller than the radius");if(!wo(o,4))throw new Error("segments must be four or more");if(i===0||s===0)return cd.create();if(r===0)return v3({center:n,height:i,radius:s});const a=[0,0,-(i/2)],c=[0,0,i/2],l=ve.subtract(ve.create(),c,a),u=ve.length(l);if(2*r>u-m3)throw new Error("height must be larger than twice roundRadius");let f;Math.abs(l[0])>Math.abs(l[1])?f=ve.fromValues(0,1,0):f=ve.fromValues(1,0,0);const h=ve.scale(ve.create(),ve.normalize(ve.create(),l),r),d=ve.scale(ve.create(),ve.normalize(ve.create(),ve.cross(ve.create(),h,f)),s),_=ve.scale(ve.create(),ve.normalize(ve.create(),ve.cross(ve.create(),d,h)),s);ve.add(a,a,h),ve.subtract(c,c,h);const g=Math.floor(.25*o),m=b=>{const w=b.map(D=>ve.add(D,D,n));return g3.create(w)},p=[],y=ve.create(),E=ve.create();let v;for(let b=0;b<=o;b++){const w=ad*b/o,D=ve.add(ve.create(),ve.scale(y,d,ud(w)),ve.scale(E,_,ld(w)));if(b>0){let x=[];x.push(ve.add(ve.create(),a,D)),x.push(ve.add(ve.create(),a,v)),x.push(ve.add(ve.create(),c,v)),x.push(ve.add(ve.create(),c,D)),p.push(m(x));let T,I;for(let z=0;z<=g;z++){const U=ad/4*z/g,O=ud(U),H=ld(U);if(z>0){x=[];let G;G=ve.add(ve.create(),a,ve.subtract(y,ve.scale(y,v,T),ve.scale(E,h,I))),x.push(G),G=ve.add(ve.create(),a,ve.subtract(y,ve.scale(y,D,T),ve.scale(E,h,I))),x.push(G),z{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(!pd(n,2))throw new Error("center must be an array of X and Y values");if(!pd(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(!dd(s,0))throw new Error("roundRadius must be positive");if(!dd(r,4))throw new Error("segments must be four or more");if(i[0]===0||i[1]===0)return hd.create();if(s===0)return E3({center:n,size:i});if(i=i.map(g=>g/2),s>i[0]-fd||s>i[1]-fd)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]]),u=ot.add(ot.create(),n,[i[0]-s,s-i[1]]),f=[],h=[],d=[],_=[];for(let g=0;g<=o;g++){const m=Ao/4*g/o,p=ot.fromAngleRadians(ot.create(),m);ot.scale(p,p,s),f.push(ot.add(ot.create(),a,p)),ot.rotate(p,p,ot.create(),Ao/4),h.push(ot.add(ot.create(),c,p)),ot.rotate(p,p,ot.create(),Ao/4),d.push(ot.add(ot.create(),l,p)),ot.rotate(p,p,ot.create(),Ao/4),_.push(ot.add(ot.create(),u,p))}return hd.fromPoints(f.concat(h,d,_))};var y3=S3;const b3=pg,{isGTE:T3}=Mt,w3=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(!T3(i,0))throw new Error("radius must be positive");return i=[i,i,i],b3({center:n,radius:i,segments:s,axes:r})};var A3=w3;const R3=Jl,{isGTE:P3}=Mt,C3=t=>{const e={center:[0,0],size:2};let{center:n,size:i}=Object.assign({},e,t);if(!P3(i,0))throw new Error("size must be positive");return i=[i,i],R3({center:n,size:i})};var L3=C3;const{TAU:gg}=Qe,gr=Xe,D3=At,{isGT:U3,isGTE:Ro,isNumberArray:I3}=Mt,N3=(t,e)=>t>0&&e>1&&e{const s=gg/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(!I3(n,2))throw new Error("center must be an array of X and Y values");if(!Ro(i,2))throw new Error("vertices must be two or more");if(!U3(s,0))throw new Error("outerRadius must be greater than zero");if(!Ro(r,0))throw new Error("innerRadius must be greater than zero");if(!Ro(a,0))throw new Error("startAngle must be greater than zero");if(i=Math.floor(i),o=Math.floor(o),a=a%gg,r===0){if(!Ro(o,2))throw new Error("density must be two or more");r=s*N3(i,o)}const c=gr.clone(n),l=md(i,s,a,c),u=md(i,r,a+Math.PI/i,c),f=[];for(let h=0;ht.reduce((e,n)=>Array.isArray(n)?e.concat(_g(n)):e.concat(n),[]);var ns=_g;const B3=ns,gd=ft,_d=Zs,vd=At,xd=Rt,Md=li,z3=(t,...e)=>{const n={origin:[0,0,0],normal:[0,0,1]},{origin:i,normal:s}=Object.assign({},n,t);if(e=B3(e),e.length===0)throw new Error("wrong number of arguments");const r=_d.fromNormalAndPoint(_d.create(),s,i);if(Number.isNaN(r[0]))throw new Error("the given origin and normal do not define a proper plane");const o=gd.mirrorByPlane(gd.create(),r),a=e.map(c=>Md.isA(c)?Md.transform(o,c):vd.isA(c)?vd.transform(o,c):xd.isA(c)?xd.transform(o,c):c);return a.length===1?a[0]:a},H3=(...t)=>z3({normal:[1,0,0]},t);var V3={mirrorX:H3};const Ed=Zs,Fi=$e,G3=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 Ed.fromPoints(Ed.create(),r[0],i[0],i[1])};var vg=G3;const $3=t=>(t||(t=[]),{edges:t});var is=$3;const k3=is,Sd=$e,W3=(...t)=>{let e,n;return t.length===1?(e=k3(),n=t[0]):(e=t[0],n=t[1]),e.edges=n.edges.map(i=>[Sd.clone(i[0]),Sd.clone(i[1])]),e};var X3=W3;const q3=$e,Y3=(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=q3.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}),K3(e)};var J3=Z3;const Co=$e,Q3=is,eD=t=>{if(!Array.isArray(t))throw new Error("the given sides must be an array");const e=[];return t.forEach(n=>{e.push([Co.fromVec2(Co.create(),n[0]),Co.fromVec2(Co.create(),n[1])])}),Q3(e)};var tD=eD;const nD=t=>!!(t&&typeof t=="object"&&"edges"in t&&Array.isArray(t.edges));var iD=nD;const sD=is,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=>[i[1],i[0]]),e};var oD=rD;const aD=t=>t.edges;var cD=aD;const lD=(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||u>0&&s;)l!==0&&(u===0||!s||e(i)<=e(s))?(r=i,i=i.nextZ,l--):(r=s,s=s.nextZ,u--),c?c.nextZ=r:t=r,r.prevZ=c,c=r;i=s}c.nextZ=null,a*=2}while(o>1);return t};var uD=lD;const fD=uD;let xg=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 hD=(t,e,n,i)=>{const s=new xg(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},dD=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 Mg={Node:xg,insertNode:hD,removeNode:dD,sortLinked:fD};const pD=(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,mD=(t,e,n)=>(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);var Ql={area:mD,pointInTriangle:pD};const{Node:yd,insertNode:bd,removeNode:Ko}=Mg,{area:Yt}=Ql,gD=(t,e,n,i,s)=>{let r;if(s===SD(t,e,n,i)>0)for(let o=e;o=e;o-=i)r=bd(o,t[o],t[o+1],r);return r&&Ma(r,r.next)&&(Ko(r),r=r.next),r},Eg=(t,e)=>{if(!t)return t;e||(e=t);let n=t,i;do if(i=!1,!n.steiner&&(Ma(n,n.next)||Yt(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},_D=(t,e,n)=>{let i=t;do{const s=i.prev,r=i.next.next;!Ma(s,r)&&Sg(s,i,i.next,r)&&Fr(s,r)&&Fr(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 Eg(i)},vD=(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&&Sg(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1},Fr=(t,e)=>Yt(t.prev,t,t.next)<0?Yt(t,e,t.next)>=0&&Yt(t,t.prev,e)>=0:Yt(t,e,t.prev)<0||Yt(t,t.next,e)<0,xD=(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},MD=(t,e)=>{const n=new yd(t.i,t.x,t.y),i=new yd(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},ED=(t,e)=>t.next.i!==e.i&&t.prev.i!==e.i&&!vD(t,e)&&(Fr(t,e)&&Fr(e,t)&&xD(t,e)&&(Yt(t.prev,t,e.prev)||Yt(t,e.prev,e))||Ma(t,e)&&Yt(t.prev,t,t.next)>0&&Yt(e.prev,e,e.next)>0),Sg=(t,e,n,i)=>{const s=Math.sign(Yt(t,e,n)),r=Math.sign(Yt(t,e,i)),o=Math.sign(Yt(n,i,t)),a=Math.sign(Yt(n,i,e));return!!(s!==r&&o!==a||s===0&&Lo(t,n,e)||r===0&&Lo(t,i,e)||o===0&&Lo(n,t,i)||a===0&&Lo(n,e,i))},Lo=(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),SD=(t,e,n,i)=>{let s=0;for(let r=e,o=n-i;rt.x===e.x&&t.y===e.y;var yg={cureLocalIntersections:_D,filterPoints:Eg,isValidDiagonal:ED,linkedPolygon:gD,locallyInside:Fr,splitPolygon:MD};const{filterPoints:fl,linkedPolygon:yD,locallyInside:bD,splitPolygon:TD}=yg,{area:Td,pointInTriangle:wD}=Ql,AD=(t,e,n,i)=>{const s=[];for(let r=0,o=e.length;rr.x-o.x);for(let r=0;r{const n=PD(t,e);if(!n)return e;const i=TD(n,t),s=fl(n,n.next);return fl(i,i.next),e===n?s:e},PD=(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 f=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=i&&f>r){if(r=f,f===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&&wD(so.x||n.x===o.x&&CD(o,n)))&&(o=n,u=f)}n=n.next}while(n!==a);return o},CD=(t,e)=>Td(t.prev,t,e.prev)<0&&Td(e.next,t,t.next)<0,LD=t=>{let e=t,n=t;do(e.x{const i=e&&e.length,s=i?e[0]*n:t.length;let r=BD(t,0,s,n,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,u,f;if(i&&(r=UD(t,e,r,n)),t.length>80*n){a=l=t[0],c=u=t[1];for(let h=n;hl&&(l=d),_>u&&(u=_)}f=Math.max(l-a,u-c),f=f!==0?1/f:0}return Or(r,o,n,a,c,f),o},Or=(t,e,n,i,s,r,o)=>{if(!t)return;!o&&r&&kD(t,i,s,r);let a=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,r?GD(t,i,s,r):VD(t)){e.push(c.i/n),e.push(t.i/n),e.push(l.i/n),ID(t),t=l.next,a=l.next;continue}if(t=l,t===a){o?o===1?(t=FD(Zo(t),e,n),Or(t,e,n,i,s,r,2)):o===2&&$D(t,e,n,i,s,r):Or(Zo(t),e,n,i,s,r,1);break}}},VD=t=>{const e=t.prev,n=t,i=t.next;if(Vi(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)&&Vi(s.prev,s,s.next)>=0)return!1;s=s.next}return!0},GD=(t,e,n,i)=>{const s=t.prev,r=t,o=t.next;if(Vi(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,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,f=hl(a,c,e,n,i),h=hl(l,u,e,n,i);let d=t.prevZ,_=t.nextZ;for(;d&&d.z>=f&&_&&_.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)&&Vi(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)&&Vi(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;d&&d.z>=f;){if(d!==t.prev&&d!==t.next&&_r(s.x,s.y,r.x,r.y,o.x,o.y,d.x,d.y)&&Vi(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)&&Vi(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0},$D=(t,e,n,i,s,r)=>{let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&OD(o,a)){let c=zD(o,a);o=Zo(o,o.next),c=Zo(c,c.next),Or(o,e,n,i,s,r),Or(c,e,n,i,s,r);return}a=a.next}o=o.next}while(o!==t)},kD=(t,e,n,i)=>{let s=t;do s.z===null&&(s.z=hl(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,ND(s,r=>r.z)},hl=(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 WD=HD;const{NEPS:Uc}=Qe,XD=(t,e)=>Math.abs(t[0]-e[0])<=Uc&&Math.abs(t[1]-e[1])<=Uc&&Math.abs(t[2]-e[2])<=Uc;var qD=XD;const YD=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 KD=jD;const ZD=(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 JD=ZD,Tg={area:bg,solve2Linear:JD};const QD=bg,eU=t=>QD(t.vertices);var tU=eU;const nU=t=>((t===void 0||t.length<3)&&(t=[]),{vertices:t});var iU=nU;const sU=iU,rU=t=>{const e=t.vertices.slice().reverse();return sU(e)};var oU=rU;const aU=tU,cU=oU,lU=(t,e)=>{if(t.length===0)return 0;const n=e.vertices;return n.length<3?0:(aU(e)<0&&(e=cU(e)),t.reduce((s,r)=>s+uU(r,n),0)===t.length?1:0)},uU=(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 u=n+1;--u;){const f=o[1]>s;if(a!==f){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=f,r=o,o=e[++l]}return c};var fU=lU,hU={arePointsInside:fU};const{area:dU}=Tg,{toOutlines:pU}=At,{arePointsInside:mU}=hU,gU=t=>{const e=pU(t),n=[],i=[];e.forEach((o,a)=>{const c=dU(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,u)=>{const f=e[l];mU([f[0]],{vertices:c})&&(s[a].push(l),r[u]||(r[u]=[]),r[u].push(a))})}),i.forEach((o,a)=>{if(r[a]&&r[a].length>1){const c=_U(r[a],l=>s[l].length);r[a].forEach((l,u)=>{u!==c&&(s[l]=s[l].filter(f=>f!==o))})}}),s.map((o,a)=>({solid:e[n[a]],holes:o.map(c=>e[c])}))},_U=(t,e)=>{let n,i;return t.forEach((s,r)=>{const o=e(s);(i===void 0||oo.map(a=>this.to2D(a))),r=xU.create(s);this.roots=SU(r)}to2D(e){const n=MU.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(),wd,wd[3]),o=wt.add(i,i,r);return wt.add(s,s,o)}}};var bU=yU;const TU=rt,wU=WD,AU=bU,RU=t=>{const e=new AU(t),n=[];return e.roots.forEach(({solid:i,holes:s})=>{let r=i.length;const o=[];s.forEach((f,h)=>{o.push(r),r+=f.length});const a=[i,...s].flat(),c=a.flat(),l=f=>e.to3D(a[f]),u=wU(c,o);for(let f=0;ft.reduce((e,n)=>e+=`[${Ad.toString(n[0])}, ${Ad.toString(n[1])}], `,""),LU=t=>`[${CU(t.edges)}]`;var DU=LU;const Do=$e,UU=is,IU=(t,e)=>{const n=e.edges.map(i=>[Do.transform(Do.create(),i[0],t),Do.transform(Do.create(),i[1],t)]);return UU(n)};var NU=IU,eu={calculatePlane:vg,clone:X3,create:is,equals:j3,fromPoints:J3,fromSides:tD,isA:iD,reverse:oD,toEdges:cD,toPolygons:PU,toString:DU,transform:NU};const Rd=$e,FU=is,OU=t=>{if(!t.edges)return t;let e=t.edges;const n=new Map,i=new Map;e=e.filter(o=>!Rd.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(u=>{const f=n.get(u),h=Rd.distance(a,f);hu[0].toString()===o?[l,u[1]]:u[1].toString()===o?[u[0],l]:u)}),FU(e)};var BU=OU;const{EPS:Pd}=Qe,Ts=$e,Uo=rt,Cd=eu,dl=(t,e)=>t===e?t:tt*e/dl(t,e),Ld=(t,e)=>{const n=t/e.length;if(n===1)return e;const i=Ts.fromValues(n,n,n),s=[];return e.forEach(r=>{const o=Ts.subtract(Ts.create(),r[1],r[0]);Ts.divide(o,o,i);let a=r[0];for(let c=1;c<=n;++c){const l=Ts.add(Ts.create(),a,o);s.push([a,l]),a=l}}),s},Dd=Pd*Pd/2*Math.sin(Math.PI/3),HU=(t,e)=>{let n=Cd.toEdges(t),i=Cd.toEdges(e);if(n.length!==i.length){const r=zU(n.length,i.length);r!==n.length&&(n=Ld(r,n)),r!==i.length&&(i=Ld(r,i))}const s=[];return n.forEach((r,o)=>{const a=i[o],c=Uo.create([r[0],r[1],a[1]]),l=Uo.measureArea(c);Number.isFinite(l)&&l>Dd&&s.push(c);const u=Uo.create([r[0],a[1],a[0]]),f=Uo.measureArea(u);Number.isFinite(f)&&f>Dd&&s.push(u)}),s};var VU=HU;const Ud=ft,Id=At,GU=Rt,pl=rt,Si=eu,$U=BU,Nd=VU,kU=(t,e,n)=>{let i=null;return Id.isA(n)&&(i=Si.fromSides(Id.toSides(n))),pl.isA(n)&&(i=Si.fromPoints(pl.toPoints(n))),t===0||t===1?Si.transform(Ud.fromTranslation(Ud.create(),[0,0,t]),i):null},WU=(t,e)=>{const n={numberOfSlices:2,capStart:!0,capEnd:!0,close:!1,repair:!0,callback:kU},{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=$U(e));const l=i-1;let u=null,f=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=Io.toSides(e);if(l.length===0)throw new Error("the given geometry cannot be empty");const u=l.filter(y=>y[0][0]<0),f=l.filter(y=>y[0][0]>=0);u.length>0&&f.length>0&&o==="cap"&&(u.length>f.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=Io.create(l),e=qU(e)):f.length>=u.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=Io.create(l)));const d=c/i,_=Math.abs(c){let M=d*E+s;return c===nn&&E===i&&(M=s),lr.multiply(m,lr.fromZRotation(m,M),lr.fromXRotation(lr.create(),nn/4)),Ic.transform(m,v)};return t={numberOfSlices:i+1,capStart:_,capEnd:_,close:!_,callback:p},YU(t,g)};var KU=jU;const ZU=ns,Fd=ft,Od=At,Bd=Rt,zd=li,JU=(t,...e)=>{if(!Array.isArray(t))throw new Error("angles must be an array");if(e=ZU(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=Fd.fromTaitBryanRotation(Fd.create(),n,i,s),o=e.map(a=>zd.isA(a)?zd.transform(r,a):Od.isA(a)?Od.transform(r,a):Bd.isA(a)?Bd.transform(r,a):a);return o.length===1?o[0]:o};var QU={rotate:JU};const eI=ns,Hd=ft,Vd=At,Gd=Rt,$d=li,Ea=(t,...e)=>{if(!Array.isArray(t))throw new Error("offset must be an array");if(e=eI(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=>$d.isA(s)?$d.transform(n,s):Vd.isA(s)?Vd.transform(n,s):Gd.isA(s)?Gd.transform(n,s):s);return i.length===1?i[0]:i},tI=(t,...e)=>Ea([t,0,0],e),nI=(t,...e)=>Ea([0,t,0],e),iI=(t,...e)=>Ea([0,0,t],e);var vr={translate:Ea,translateX:tI,translateY:nI,translateZ:iI};const{TAU:sI}=Qe,rI=KU,{rotate:oI}=QU,{translate:aI}=vr,cI=Km,{isGT:Nc,isGTE:Fc}=Mt,lI=t=>{const e={innerRadius:1,innerSegments:32,outerRadius:4,outerSegments:32,innerRotation:0,startAngle:0,outerRotation:sI},{innerRadius:n,innerSegments:i,outerRadius:s,outerSegments:r,innerRotation:o,startAngle:a,outerRotation:c}=Object.assign({},e,t);if(!Nc(n,0))throw new Error("innerRadius must be greater than zero");if(!Fc(i,3))throw new Error("innerSegments must be three or more");if(!Nc(s,0))throw new Error("outerRadius must be greater than zero");if(!Fc(r,3))throw new Error("outerSegments must be three or more");if(!Fc(a,0))throw new Error("startAngle must be positive");if(!Nc(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=cI({radius:n,segments:i});return o!==0&&(l=oI([0,0,o],l)),l=aI([s,0],l),rI({startAngle:a,angle:c,segments:r},l)};var uI=lI;const{NEPS:Ws}=Qe,ur=Xe,fI=At,{isNumberArray:hI}=Mt,ml=(t,e,n)=>Math.acos((t*t+e*e-n*n)/(2*t*e)),dI=(t,e,n)=>e>Ws?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)),pI=t=>{if(Math.abs(t[0]+t[1]+t[2]-Math.PI)>Ws)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 Js(n,i,s,o,a,r)},mI=t=>{const e=t[0],n=t[1],i=Math.PI+Ws-e-n;if(i{const e=t[0],n=t[2],i=Math.PI+Ws-e-n;if(i{const e=t[0],n=t[1],i=t[2],s=dI(e,n,i),r=ml(s,e,i),o=Math.PI-r-n;return Js(r,n,o,i,s,e)},vI=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 Js(s,r,i,n,o,e)},xI=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=ml(n,i,e),r=ml(i,e,n),o=Math.PI-s-r;return Js(s,r,o,e,n,i)},Js=(t,e,n,i,s,r)=>{const o=ur.fromValues(0,0),a=ur.fromValues(r,0),c=ur.fromValues(i,0);return ur.add(c,ur.rotate(c,c,[0,0],Math.PI-e),a),fI.fromPoints([o,a,c])},MI=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(!hI(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 pI(i);case"AAS":return mI(i);case"ASA":return gI(i);case"SAS":return _I(i);case"SSA":return vI(i);case"SSS":return xI(i);default:throw new Error("invalid triangle type, try again")}};var EI=MI,No={arc:H2,circle:Km,cube:BL,cuboid:Zl,cylinder:dg,cylinderElliptic:hg,ellipse:jm,ellipsoid:pg,geodesicSphere:n3,line:r3,polygon:a3,polyhedron:mg,rectangle:Jl,roundedCuboid:p3,roundedCylinder:M3,roundedRectangle:y3,sphere:A3,square:L3,star:O3,torus:uI,triangle:EI};function SI({width:t,length:e,safety:n=0}){const o=t+n,a=e+n,c=vr.translate([0,a/2+2.5/2,0],No.cuboid({size:[o+5,2.5,10]})),l=vr.translate([0,-a/2-2.5/2,0],No.cuboid({size:[o+5,2.5,10]})),u=vr.translate([o/2+2.5/2,0,0],No.cuboid({size:[2.5,a+5,10]})),f=vr.translate([-o/2-2.5/2,0,0],No.cuboid({size:[2.5,a+5,10]}));return[c,l,u,f]}var wg={geom2:At,geom3:Rt,path2:li,poly3:rt};const yI=()=>[0,1,0];var tu=yI;const bI=tu,TI=t=>{const e=bI();return e[0]=t[0],e[1]=t[1],e[2]=t[2],e};var wI=TI;const Oc=Xe,AI=t=>{const e=Oc.normal(Oc.create(),t);return Oc.negate(e,e),e};var nu=AI;const kd=Xe,RI=t=>kd.scale(kd.create(),t,t[2]);var Sa=RI;const fr=Xe,PI=nu,CI=Sa,LI=(t,e)=>{const n=CI(t),i=PI(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 DI=LI;const UI=(t,e)=>(t[0]=e[0],t[1]=e[1],t[2]=e[2],t);var Ag=UI;const II=Xe,NI=(t,e)=>{let n=II.dot(e,t);return n=Math.abs(n-t[2]),n};var FI=NI;const OI=(t,e)=>t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2];var BI=OI;const hr=Xe,zI=(t,e,n)=>{const i=hr.subtract(hr.create(),n,e);hr.normal(i,i),hr.normalize(i,i);const s=hr.dot(e,i);return t[0]=i[0],t[1]=i[1],t[2]=s,t};var Rg=zI;const HI=tu,VI=(t,e,n)=>{const i=HI();return i[0]=t,i[1]=e,i[2]=n,i};var Pg=VI;const GI=Xe,{solve2Linear:$I}=Tg,kI=(t,e)=>{const n=$I(t[0],t[1],e[0],e[1],t[2],e[2]);return GI.clone(n)};var WI=kI;const Wd=Xe,XI=Ag,qI=Pg,YI=(t,e)=>{const n=Wd.negate(Wd.create(),e),i=-e[2];return XI(t,qI(n[0],n[1],i))};var jI=YI;const KI=t=>`line2: (${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)})`;var ZI=KI;const Xd=Xe,JI=Rg,QI=Sa,eN=nu,tN=(t,e,n)=>{const i=QI(e),s=eN(e);return Xd.transform(i,i,n),Xd.transform(s,s,n),JI(t,i,s)};var nN=tN;const iN=Sa,sN=(t,e)=>{let n=(t[2]-t[1]*e)/t[0];return Number.isNaN(n)&&(n=iN(t)[0]),n};var rN=sN,oN={clone:wI,closestPoint:DI,copy:Ag,create:tu,direction:nu,distanceToPoint:FI,equals:BI,fromPoints:Rg,fromValues:Pg,intersectPointOfLines:WI,origin:Sa,reverse:jI,toString:ZI,transform:nN,xAtY:rN};const aN=ns,In=Xe,dr=$e,Cg=At,Lg=Rt,Dg=li,qd=rt,Xs=new WeakMap,cN=t=>{let e=Xs.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],Xs.set(t,e),e},lN=t=>{let e=Xs.get(t);if(e)return e;const n=Cg.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],Xs.set(t,e),e},uN=t=>{let e=Xs.get(t);if(e)return e;const n=Lg.toPolygons(t);let i=dr.create();if(n.length>0){const r=qd.toPoints(n[0]);dr.copy(i,r[0])}let s=dr.clone(i);return n.forEach(r=>{qd.toPoints(r).forEach(o=>{dr.min(i,i,o),dr.max(s,s,o)})}),i=[i[0],i[1],i[2]],s=[s[0],s[1],s[2]],e=[i,s],Xs.set(t,e),e},fN=(...t)=>{if(t=aN(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>Dg.isA(n)?cN(n):Cg.isA(n)?lN(n):Lg.isA(n)?uN(n):[[0,0,0],[0,0,0]]);return e.length===1?e[0]:e};var hN=fN;const{EPS:dN}=Qe,pN=(t,e)=>{let n=0;for(let i=0;iiu(su(t),2),EN=t=>iu(su(t),2),SN=t=>iu(su(t),3),yN=(...t)=>{if(t=gN(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>xN.isA(n)?MN(n):_N.isA(n)?EN(n):vN.isA(n)?SN(n):0);return e.length===1?e[0]:e};var Ug=yN;const bN=(t,e)=>t-e;var TN=bN;const wN=(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 AN=wN,RN={fnNumberSort:TN,insertSorted:AN};const Yd=ft,PN=Xe,mt=$e,Ig=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])};Ig.prototype={getProjectionMatrix:function(){return Yd.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 Yd.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 PN.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 CN=Ig;const{EPS:Kn}=Qe,xi=oN,En=Xe,LN=CN,ws=KD,{insertSorted:DN,fnNumberSort:UN}=RN,jd=rt,IN=t=>{if(t.length<2)return t;const e=[],n=t.length,i=jd.plane(t[0]),s=new LN(i),r=[],o=[],a=new Map,c=new Map,l=new Map,u=10/Kn;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 f=[];c.forEach((_,g)=>f.push(g)),f.sort(UN);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 z=x-1;z<0&&(z=w-1),v.bottomright=b[z]}}}let y;if(_>=f.length-1)h=[],y=null;else{y=Number(f[_+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 H=T+1;if(H>=D&&(H=0),w[H][1]!==m||H===x)break;T=H}let I=x;for(;;){let H=I-1;if(H<0&&(H=D-1),w[H][1]!==m||H===T)break;I=H}let z=T+1;z>=D&&(z=0);let U=I-1;U<0&&(U=D-1);const O={polygonindex:b,leftvertexindex:T,rightvertexindex:I,topleft:w[T],topright:w[I],bottomleft:w[z],bottomright:w[U]};DN(h,O,(H,G)=>{const k=ws(H.topleft,H.bottomleft,E),W=ws(G.topleft,G.bottomleft,E);return k>W?1:k0){const I=g[g.length-1],z=En.distance(T.topleft,I.topright),U=En.distance(T.bottomleft,I.bottomright);z0){const E=new Set,v=new Set;for(let M=0;M=0,W=G||O>=0;k&&W&&(b.outpolygon=D.outpolygon,b.leftlinecontinues=H,b.rightlinecontinues=G,E.add(w));break}}}for(let M=0;MKn&&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=jd.fromPointsAndPlane(D,i);x.vertices.length&&e.push(x)}}for(let E=0;EKn&&v.outpolygon.rightpoints.push(v.topright))}d=g}return e};var NN=IN;const Kd=Rt,FN=rt,{NEPS:ON}=Qe,BN=NN,zN=t=>{if(t.isRetesselated)return t;const e=Kd.toPolygons(t).map((r,o)=>({vertices:r.vertices,plane:FN.plane(r),index:o})),n=HN(e),i=[];n.forEach(r=>{if(Array.isArray(r)){const o=BN(r);i.push(...o)}else i.push(r)});const s=Kd.create(i);return s.isRetesselated=!0,s},HN=t=>{let e=[t];const n=[];for(let s=3;s>=0;s--){const r=[],o=s===3?15e-9:ON;e.forEach(a=>{a.sort(VN(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},VN=(t,e)=>(n,i)=>n.plane[t]-i.plane[t]>e?1:i.plane[t]-n.plane[t]>e?-1:0;var GN=zN;const Bc=$e,Ng=rt,$N=(t,e)=>{const n=Math.abs(Ng.measureArea(e));return Number.isFinite(n)&&n>t},kN=(t,e)=>{let n=e.map(s=>{const r=s.vertices.map(c=>Bc.snap(Bc.create(),c,t)),o=[];for(let c=0;c$N(i,s)),n};var Fg=kN;const WN=qD,Ls=$e,Jo=rt,XN=t=>{const e=Jo.toPoints(t),n=[];for(let i=0;i{const n=`${e.v1}:${e.v2}`;t.set(n,e)},zc=(t,e)=>{const n=`${e.v1}:${e.v2}`;t.delete(n)},YN=(t,e)=>{const n=`${e.v2}:${e.v1}`;return t.get(n)},jN=(t,e,n)=>{let i=t.prev.v1,s=t.prev.v2,r=e.next.v2;const o=Zd(i,s,r,n);i=e.prev.v1,s=e.prev.v2,r=t.next.v2;const a=Zd(i,s,r,n);return[o,a]},KN=Ls.create(),ZN=Ls.create(),Zd=(t,e,n,i)=>{const s=Ls.subtract(KN,e,t),r=Ls.subtract(ZN,n,e);return Ls.cross(s,s,r),Ls.dot(s,i)},JN=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=Jo.create(n)),e},QN=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=XN(r);for(let a=0;a=0&&u[1]>=0){const f=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,zc(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,zc(_,g),g.v1=null,g.v2=null,g.next=null,g.prev=null,zc(_,m),m.v1=null,m.v2=null,m.next=null,m.prev=null};u[0]===0&&d(i,f,f.prev),u[1]===0&&d(i,h,h.prev)}}else c.next&&qN(i,c)}}const s=[];return i.forEach(r=>{const o=JN(r);o&&s.push(o)}),i.clear(),s},eF=(t,e)=>Math.abs(t[3]-e[3])<15e-8?WN(t,e):!1,tF=(t,e)=>{const n=[];e.forEach(s=>{const r=n.find(o=>eF(o[0],Jo.plane(s)));r?r[1].push(s):n.push([Jo.plane(s),[s]])});let i=[];return n.forEach(s=>{const r=s[1],o=QN(r);i=i.concat(o)}),i};var nF=tF;const Jd=Qe,Cn=$e,iF=rt,Vt=t=>`${t}`,Qd=(t,e,n,i,s,r)=>{const o=Vt(i),a=Vt(s),c=`${o}/${a}`,l=`${a}/${o}`;if(t.has(l))return Go(t,e,n,s,i,null),null;const u={vertex0:i,vertex1:s,polygonindex:r};return t.has(c)?t.get(c).push(u):t.set(c,[u]),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},Go=(t,e,n,i,s,r)=>{const o=Vt(i),a=Vt(s),c=`${o}/${a}`;let l=-1;const u=t.get(c);for(let f=0;f{const e=new Map;for(let n=0;n=3){let r=i.vertices[0],o=Vt(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=Vt(c.vertex0),u=Vt(c.vertex1);n.has(l)?n.get(l).push(o):n.set(l,[o]),i.has(u)?i.get(u).push(o):i.set(u,[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 f=e.get(c)[0];for(let h=0;h<2;h++){const d=h===0?f.vertex0:f.vertex1,_=h===0?f.vertex1:f.vertex0,g=Vt(d),m=Vt(_);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 z=Cn.scale(Cn.create(),T,I);if(Cn.add(z,z,w),Cn.squaredDistance(z,D){const i=e.vertices.length;if(i>3){if(i>4){const o=[0,0,0];e.vertices.forEach(a=>Hc.add(o,o,a)),Hc.snap(o,Hc.divide(o,o,[i,i,i]),t);for(let a=0;a{const n=[];return e.forEach(i=>{oF(t,i,n)}),n};var cF=aF;const lF=ns,uF=Ug,fF=At,Og=Rt,hF=li,dF=Fg,pF=nF,mF=rF,gF=cF,_F=(t,e)=>e,vF=(t,e)=>e,xF=(t,e)=>{const n={snap:!1,simplify:!1,triangulate:!1},{snap:i,simplify:s,triangulate:r}=Object.assign({},n,t),o=uF(e);let a=Og.toPolygons(e);i&&(a=dF(o,a)),s&&(a=pF(o,a)),r&&(a=mF(a),a=gF(o,a));const c=Object.assign({},e);return c.polygons=a,c},MF=(t,...e)=>{if(e=lF(e),e.length===0)throw new Error("wrong number of arguments");const n=e.map(i=>{if(hF.isA(i))return _F(t,i);if(fF.isA(i))return vF(t,i);if(Og.isA(i))return xF(t,i);throw new Error("invalid geometry")});return n.length===1?n[0]:n};var EF=MF;const SF=ns,Gi=Xe,gl=At,_l=Rt,vl=li,ru=Ug,yF=Fg,bF=t=>{const e=ru(t),i=vl.toPoints(t).map(s=>Gi.snap(Gi.create(),s,e));return vl.create(i)},TF=t=>{const e=ru(t);let i=gl.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])),gl.create(i)},wF=t=>{const e=ru(t),n=_l.toPolygons(t),i=yF(e,n);return _l.create(i)},AF=(...t)=>{if(t=SF(t),t.length===0)throw new Error("wrong number of arguments");const e=t.map(n=>vl.isA(n)?bF(n):gl.isA(n)?TF(n):_l.isA(n)?wF(n):n);return e.length===1?e[0]:e};var RF=AF,PF={generalize:EF,snap:RF,retessellate:GN},ou={geometries:wg,modifiers:PF};const Bg=t=>t.reduce((e,n)=>Array.isArray(n)?e.concat(Bg(n)):e.concat(n),[]);var CF=Bg;const LF=t=>Array.isArray(t)?t:t==null?[]:[t];var DF=LF,UF={flatten:CF,toArray:DF};const{geometries:Gc}=ou,IF=(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)=>{Gc.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),u=new Int8Array(l),f=new ArrayBuffer(50),h=new Int8Array(f),d=new Float32Array(f,0,12),_=new Uint16Array(f,48,1);let g=0;return t.forEach(m=>{Gc.geom3.toPolygons(m).forEach((y,E)=>{const v=y.vertices,M=v.length,b=Gc.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,u.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 NF={serializeBinary:IF};const{geometries:zg}=ou,FF=(t,e)=>{e.statusCallback&&e.statusCallback({progress:0});const n=`solid JSCAD +${OF(t,e)} endsolid JSCAD -`;return e.statusCallback&&e.statusCallback({progress:100}),[n]},NF=(t,e)=>{const n=[];return t.forEach((i,s)=>{n.push(FF(i)),e.statusCallback&&e.statusCallback({progress:100*s/t.length})}),n.join(` -`)},FF=(t,e)=>{const n=[];return zg.geom3.toPolygons(t).forEach((s,r)=>{n.push(OF(s))}),n.join(` -`)},Hg=t=>`${t[0]} ${t[1]} ${t[2]}`,Vc=t=>`vertex ${Hg(t)}`,OF=t=>{const e=[];if(t.vertices.length>=3){const n=Vc(t.vertices[0]);for(let i=0;i{const n=[];return t.forEach((i,s)=>{n.push(BF(i)),e.statusCallback&&e.statusCallback({progress:100*s/t.length})}),n.join(` +`)},BF=(t,e)=>{const n=[];return zg.geom3.toPolygons(t).forEach((s,r)=>{n.push(zF(s))}),n.join(` +`)},Hg=t=>`${t[0]} ${t[1]} ${t[2]}`,$c=t=>`vertex ${Hg(t)}`,zF=t=>{const e=[];if(t.vertices.length>=3){const n=$c(t.vertices[0]);for(let i=0;i{t=Object.assign({},{binary:!0,statusCallback:null},t),e=VF(e);let i=e.filter(s=>zF.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=GF(HF.generalize({snap:!0,triangulate:!0},i)),t.binary?$F(i,t):kF(i,t)};var qF={mimeType:WF,serialize:XF};const YF={props:["width","length"],data(){return{stlData:null,currentWidth:0,currentLength:0,tweenDuration:1e3}},computed:{targetDimensions(){return{width:this.width,length:this.length}}},watch:{targetDimensions:{handler(t,e){!e||e.width===t.width&&e.length===t.length||this.animateDimensionsTransition({width:this.currentWidth,length:this.currentLength},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.initScene(),this.createInitialMesh()},methods:{generateSTL(t,e){try{const n=MI({width:t,length:e});return qF.serialize({binary:!1},n).join(` -`)}catch(n){return console.error("Error generating geometry or STL:",n),null}},createInitialMesh(){const t=this.generateSTL(this.width,this.length);if(!t)return;this.stlData=t;const n=new ch().parse(t),i=new Ay({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 ch,r=o=>{const a=o-n,c=Math.min(a/i,1),l=t.width+(e.width-t.width)*c,u=t.length+(e.length-t.length)*c,f=this.generateSTL(l,u);if(f){const h=s.parse(f);this.mesh&&(this.mesh.geometry.dispose(),this.mesh.geometry=h),this.stlData=f}c<1?requestAnimationFrame(r):(this.currentWidth=e.width,this.currentLength=e.length)};requestAnimationFrame(r)},initScene(){this.scene=new wy,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 Tm({canvas:this.$refs.canvas,antialias:!0}),this.renderer.setSize(600,500),this.renderer.setClearColor(15790320);const n=new Ny(4210752);this.scene.add(n);const i=new Iy(16777215,1);i.position.set(1,1,1).normalize(),this.scene.add(i),this.controls=new Fy(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.05,this.controls.screenSpacePanning=!0,this.controls.minDistance=50,this.controls.maxDistance=1e3,this.animate()},animate(){requestAnimationFrame(this.animate),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}.stl`,e.click()}}},jF={class:"mt-6 flex flex-col items-center"},KF={ref:"canvas",class:"border border-gray-300 rounded-md w-full max-w-[600px]"};function ZF(t,e,n,i,s,r){return Il(),Nl("div",jF,[Lt("canvas",KF,null,512),Lt("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 JF=Ol(YF,[["render",ZF]]),QF={name:"App",components:{InputForm:Tv,ModelViewer:JF},data(){return{width:155,length:105}},methods:{updateDimensions(t){this.width=t.width,this.length=t.length}}},eO={class:"max-w-3xl mx-auto min-h-screen flex flex-col justify-center items-center p-6"},tO={class:"w-full max-w-[600px] bg-white rounded shadow p-6"};function nO(t,e,n,i,s,r){const o=du("InputForm"),a=du("ModelViewer");return Il(),Nl("div",eO,[e[0]||(e[0]=Lt("div",{class:"mb-8 text-center"},[Lt("h1",{class:"text-4xl font-bold mb-2"},"SynthArmor"),Lt("p",{class:"text-gray-600"}," Modify the dimensions of a 3D model and download your custom design instantly. ")],-1)),Lt("div",tO,[si(o,{onUpdateDimensions:r.updateDimensions},null,8,["onUpdateDimensions"]),si(a,{width:s.width,length:s.length},null,8,["width","length"])])])}const iO=Ol(QF,[["render",nO],["__scopeId","data-v-fa9ff4e8"]]);vv(iO).mount("#app"); +`)};var HF={serializeText:FF};const{geometries:VF,modifiers:GF}=ou,{flatten:$F,toArray:kF}=UF,{serializeBinary:WF}=NF,{serializeText:XF}=HF,qF="application/sla",YF=(t,...e)=>{t=Object.assign({},{binary:!0,statusCallback:null},t),e=$F(e);let i=e.filter(s=>VF.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=kF(GF.generalize({snap:!0,triangulate:!0},i)),t.binary?WF(i,t):XF(i,t)};var jF={mimeType:qF,serialize:YF};const KF={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=SI({width:t,length:e,safety:n});return jF.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 ch().parse(t),i=new Py({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 ch,r=o=>{const a=o-n,c=Math.min(a/i,1),l=t.width+(e.width-t.width)*c,u=t.length+(e.length-t.length)*c,f=t.safety+(e.safety-t.safety)*c,h=this.generateSTL(l,u,f);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 Ry,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 Tm({canvas:this.$refs.canvas,antialias:!0}),this.renderer.setSize(600,500),this.renderer.setClearColor(15790320);const n=new Oy(4210752);this.scene.add(n);const i=new Fy(16777215,1);i.position.set(1,1,1).normalize(),this.scene.add(i),this.controls=new By(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.05,this.controls.screenSpacePanning=!0,this.controls.minDistance=50,this.controls.maxDistance=1e3,this.animate()},animate(){requestAnimationFrame(this.animate),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()}}},ZF={class:"mt-6 flex flex-col items-center"},JF={ref:"canvas",class:"border border-gray-300 rounded-md w-full max-w-[600px]"};function QF(t,e,n,i,s,r){return Fl(),Ol("div",ZF,[ut("canvas",JF,null,512),ut("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 eO=zl(KF,[["render",QF]]),tO={name:"App",components:{InputForm:Av,ModelViewer:eO},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}}},nO={class:"max-w-3xl mx-auto min-h-screen flex flex-col justify-center items-center p-6"},iO={class:"w-full max-w-[600px] bg-white rounded shadow p-6"};function sO(t,e,n,i,s,r){const o=pu("InputForm"),a=pu("ModelViewer");return Fl(),Ol("div",nO,[e[0]||(e[0]=ut("div",{class:"mb-8 text-center"},[ut("h1",{class:"text-4xl font-bold mb-2"},"SynthArmor"),ut("p",{class:"text-gray-600"}," Modify the dimensions of a 3D model and download your custom design instantly. ")],-1)),ut("div",iO,[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 rO=zl(tO,[["render",sO]]);vv(rO).mount("#app"); diff --git a/index.html b/index.html index 3d4070f..4cff50e 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet" /> - +