const Jp=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerpolicy&&(o.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?o.credentials="include":s.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}};Jp();function kc(t,e){const n=Object.create(null),i=t.split(",");for(let s=0;s!!n[s.toLowerCase()]:s=>!!n[s]}const Qp="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",em=kc(Qp);function Xh(t){return!!t||t===""}function fo(t){if($e(t)){const e={};for(let n=0;n{if(n){const i=n.split(nm);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function je(t){let e="";if(zt(t))e=t;else if($e(t))for(let n=0;ndr(n,e))}const ze=t=>zt(t)?t:t==null?"":$e(t)||Ft(t)&&(t.toString===qh||!nt(t.toString))?JSON.stringify(t,jh,2):String(t),jh=(t,e)=>e&&e.__v_isRef?jh(t,e.value):Zs(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[i,s])=>(n[`${i} =>`]=s,n),{})}:po(e)?{[`Set(${e.size})`]:[...e.values()]}:Ft(e)&&!$e(e)&&!Zh(e)?String(e):e,Mt={},qs=[],Bn=()=>{},rm=()=>!1,am=/^on[^a-z]/,ya=t=>am.test(t),Vc=t=>t.startsWith("onUpdate:"),jt=Object.assign,$c=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},lm=Object.prototype.hasOwnProperty,dt=(t,e)=>lm.call(t,e),$e=Array.isArray,Zs=t=>ur(t)==="[object Map]",po=t=>ur(t)==="[object Set]",Fd=t=>ur(t)==="[object Date]",nt=t=>typeof t=="function",zt=t=>typeof t=="string",Zo=t=>typeof t=="symbol",Ft=t=>t!==null&&typeof t=="object",Yh=t=>Ft(t)&&nt(t.then)&&nt(t.catch),qh=Object.prototype.toString,ur=t=>qh.call(t),cm=t=>ur(t).slice(8,-1),Zh=t=>ur(t)==="[object Object]",Hc=t=>zt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Zr=kc(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),xa=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},dm=/-(\w)/g,ei=xa(t=>t.replace(dm,(e,n)=>n?n.toUpperCase():"")),um=/\B([A-Z])/g,xs=xa(t=>t.replace(um,"-$1").toLowerCase()),Sa=xa(t=>t.charAt(0).toUpperCase()+t.slice(1)),Wa=xa(t=>t?`on${Sa(t)}`:""),Ko=(t,e)=>!Object.is(t,e),Kr=(t,e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},Jo=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Ld;const hm=()=>Ld||(Ld=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});let Xn;class fm{constructor(e=!1){this.active=!0,this.effects=[],this.cleanups=[],!e&&Xn&&(this.parent=Xn,this.index=(Xn.scopes||(Xn.scopes=[])).push(this)-1)}run(e){if(this.active){const n=Xn;try{return Xn=this,e()}finally{Xn=n}}}on(){Xn=this}off(){Xn=this.parent}stop(e){if(this.active){let n,i;for(n=0,i=this.effects.length;n{const e=new Set(t);return e.w=0,e.n=0,e},Kh=t=>(t.w&Bi)>0,Jh=t=>(t.n&Bi)>0,mm=({deps:t})=>{if(t.length)for(let e=0;e{const{deps:e}=t;if(e.length){let n=0;for(let i=0;i{(d==="length"||d>=i)&&a.push(l)});else switch(n!==void 0&&a.push(r.get(n)),e){case"add":$e(t)?Hc(n)&&a.push(r.get("length")):(a.push(r.get(_s)),Zs(t)&&a.push(r.get(Ul)));break;case"delete":$e(t)||(a.push(r.get(_s)),Zs(t)&&a.push(r.get(Ul)));break;case"set":Zs(t)&&a.push(r.get(_s));break}if(a.length===1)a[0]&&Ol(a[0]);else{const l=[];for(const d of a)d&&l.push(...d);Ol(Gc(l))}}function Ol(t,e){const n=$e(t)?t:[...t];for(const i of n)i.computed&&Od(i);for(const i of n)i.computed||Od(i)}function Od(t,e){(t!==Ln||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const gm=kc("__proto__,__v_isRef,__isVue"),tf=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Zo)),vm=Xc(),bm=Xc(!1,!0),ym=Xc(!0),Nd=xm();function xm(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...n){const i=pt(this);for(let o=0,r=this.length;o{t[e]=function(...n){mo();const i=pt(this)[e].apply(this,n);return _o(),i}}),t}function Xc(t=!1,e=!1){return function(i,s,o){if(s==="__v_isReactive")return!t;if(s==="__v_isReadonly")return t;if(s==="__v_isShallow")return e;if(s==="__v_raw"&&o===(t?e?Nm:af:e?rf:of).get(i))return i;const r=$e(i);if(!t&&r&&dt(Nd,s))return Reflect.get(Nd,s,o);const a=Reflect.get(i,s,o);return(Zo(s)?tf.has(s):gm(s))||(t||bn(i,"get",s),e)?a:Qt(a)?r&&Hc(s)?a:a.value:Ft(a)?t?lf(a):hr(a):a}}const Sm=nf(),Mm=nf(!0);function nf(t=!1){return function(n,i,s,o){let r=n[i];if(Qo(r)&&Qt(r)&&!Qt(s))return!1;if(!t&&!Qo(s)&&(Nl(s)||(s=pt(s),r=pt(r)),!$e(n)&&Qt(r)&&!Qt(s)))return r.value=s,!0;const a=$e(n)&&Hc(i)?Number(i)t,Ma=t=>Reflect.getPrototypeOf(t);function vr(t,e,n=!1,i=!1){t=t.__v_raw;const s=pt(t),o=pt(e);n||(e!==o&&bn(s,"get",e),bn(s,"get",o));const{has:r}=Ma(s),a=i?jc:n?Zc:er;if(r.call(s,e))return a(t.get(e));if(r.call(s,o))return a(t.get(o));t!==s&&t.get(e)}function br(t,e=!1){const n=this.__v_raw,i=pt(n),s=pt(t);return e||(t!==s&&bn(i,"has",t),bn(i,"has",s)),t===s?n.has(t):n.has(t)||n.has(s)}function yr(t,e=!1){return t=t.__v_raw,!e&&bn(pt(t),"iterate",_s),Reflect.get(t,"size",t)}function zd(t){t=pt(t);const e=pt(this);return Ma(e).has.call(e,t)||(e.add(t),mi(e,"add",t,t)),this}function kd(t,e){e=pt(e);const n=pt(this),{has:i,get:s}=Ma(n);let o=i.call(n,t);o||(t=pt(t),o=i.call(n,t));const r=s.call(n,t);return n.set(t,e),o?Ko(e,r)&&mi(n,"set",t,e):mi(n,"add",t,e),this}function Bd(t){const e=pt(this),{has:n,get:i}=Ma(e);let s=n.call(e,t);s||(t=pt(t),s=n.call(e,t)),i&&i.call(e,t);const o=e.delete(t);return s&&mi(e,"delete",t,void 0),o}function Vd(){const t=pt(this),e=t.size!==0,n=t.clear();return e&&mi(t,"clear",void 0,void 0),n}function xr(t,e){return function(i,s){const o=this,r=o.__v_raw,a=pt(r),l=e?jc:t?Zc:er;return!t&&bn(a,"iterate",_s),r.forEach((d,u)=>i.call(s,l(d),l(u),o))}}function Sr(t,e,n){return function(...i){const s=this.__v_raw,o=pt(s),r=Zs(o),a=t==="entries"||t===Symbol.iterator&&r,l=t==="keys"&&r,d=s[t](...i),u=n?jc:e?Zc:er;return!e&&bn(o,"iterate",l?Ul:_s),{next(){const{value:f,done:h}=d.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function gi(t){return function(...e){return t==="delete"?!1:this}}function Pm(){const t={get(o){return vr(this,o)},get size(){return yr(this)},has:br,add:zd,set:kd,delete:Bd,clear:Vd,forEach:xr(!1,!1)},e={get(o){return vr(this,o,!1,!0)},get size(){return yr(this)},has:br,add:zd,set:kd,delete:Bd,clear:Vd,forEach:xr(!1,!0)},n={get(o){return vr(this,o,!0)},get size(){return yr(this,!0)},has(o){return br.call(this,o,!0)},add:gi("add"),set:gi("set"),delete:gi("delete"),clear:gi("clear"),forEach:xr(!0,!1)},i={get(o){return vr(this,o,!0,!0)},get size(){return yr(this,!0)},has(o){return br.call(this,o,!0)},add:gi("add"),set:gi("set"),delete:gi("delete"),clear:gi("clear"),forEach:xr(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=Sr(o,!1,!1),n[o]=Sr(o,!0,!1),e[o]=Sr(o,!1,!0),i[o]=Sr(o,!0,!0)}),[t,n,e,i]}const[Rm,Dm,Im,Fm]=Pm();function Yc(t,e){const n=e?t?Fm:Im:t?Dm:Rm;return(i,s,o)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?i:Reflect.get(dt(n,s)&&s in i?n:i,s,o)}const Lm={get:Yc(!1,!1)},Um={get:Yc(!1,!0)},Om={get:Yc(!0,!1)},of=new WeakMap,rf=new WeakMap,af=new WeakMap,Nm=new WeakMap;function zm(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function km(t){return t.__v_skip||!Object.isExtensible(t)?0:zm(cm(t))}function hr(t){return Qo(t)?t:qc(t,!1,sf,Lm,of)}function Bm(t){return qc(t,!1,Am,Um,rf)}function lf(t){return qc(t,!0,Cm,Om,af)}function qc(t,e,n,i,s){if(!Ft(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=s.get(t);if(o)return o;const r=km(t);if(r===0)return t;const a=new Proxy(t,r===2?i:n);return s.set(t,a),a}function Ks(t){return Qo(t)?Ks(t.__v_raw):!!(t&&t.__v_isReactive)}function Qo(t){return!!(t&&t.__v_isReadonly)}function Nl(t){return!!(t&&t.__v_isShallow)}function cf(t){return Ks(t)||Qo(t)}function pt(t){const e=t&&t.__v_raw;return e?pt(e):t}function df(t){return la(t,"__v_skip",!0),t}const er=t=>Ft(t)?hr(t):t,Zc=t=>Ft(t)?lf(t):t;function uf(t){Ui&&Ln&&(t=pt(t),ef(t.dep||(t.dep=Gc())))}function hf(t,e){t=pt(t),t.dep&&Ol(t.dep)}function Qt(t){return!!(t&&t.__v_isRef===!0)}function ff(t){return mf(t,!1)}function pf(t){return mf(t,!0)}function mf(t,e){return Qt(t)?t:new Vm(t,e)}class Vm{constructor(e,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?e:pt(e),this._value=n?e:er(e)}get value(){return uf(this),this._value}set value(e){e=this.__v_isShallow?e:pt(e),Ko(e,this._rawValue)&&(this._rawValue=e,this._value=this.__v_isShallow?e:er(e),hf(this))}}function Bo(t){return Qt(t)?t.value:t}const $m={get:(t,e,n)=>Bo(Reflect.get(t,e,n)),set:(t,e,n,i)=>{const s=t[e];return Qt(s)&&!Qt(n)?(s.value=n,!0):Reflect.set(t,e,n,i)}};function _f(t){return Ks(t)?t:new Proxy(t,$m)}class Hm{constructor(e,n,i,s){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new Wc(e,()=>{this._dirty||(this._dirty=!0,hf(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=i}get value(){const e=pt(this);return uf(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function Gm(t,e,n=!1){let i,s;const o=nt(t);return o?(i=t,s=Bn):(i=t.get,s=t.set),new Hm(i,s,o||!s,n)}function Oi(t,e,n,i){let s;try{s=i?t(...i):t()}catch(o){Ea(o,e,n)}return s}function Tn(t,e,n,i){if(nt(t)){const o=Oi(t,e,n,i);return o&&Yh(o)&&o.catch(r=>{Ea(r,e,n)}),o}const s=[];for(let o=0;o>>1;tr(vn[i])ui&&vn.splice(e,1)}function xf(t,e,n,i){$e(t)?n.push(...t):(!e||!e.includes(t,t.allowRecurse?i+1:i))&&n.push(t),yf()}function Ym(t){xf(t,Uo,Vo,$s)}function qm(t){xf(t,Pi,$o,Hs)}function wa(t,e=null){if(Vo.length){for(kl=e,Uo=[...new Set(Vo)],Vo.length=0,$s=0;$str(n)-tr(i)),Hs=0;Hst.id==null?1/0:t.id;function Mf(t){zl=!1,ca=!0,wa(t),vn.sort((n,i)=>tr(n)-tr(i));const e=Bn;try{for(ui=0;uim.trim())),f&&(s=n.map(Jo))}let a,l=i[a=Wa(e)]||i[a=Wa(ei(e))];!l&&o&&(l=i[a=Wa(xs(e))]),l&&Tn(l,t,6,s);const d=i[a+"Once"];if(d){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,Tn(d,t,6,s)}}function Ef(t,e,n=!1){const i=e.emitsCache,s=i.get(t);if(s!==void 0)return s;const o=t.emits;let r={},a=!1;if(!nt(t)){const l=d=>{const u=Ef(d,e,!0);u&&(a=!0,jt(r,u))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!o&&!a?(i.set(t,null),null):($e(o)?o.forEach(l=>r[l]=null):jt(r,o),i.set(t,r),r)}function Ta(t,e){return!t||!ya(e)?!1:(e=e.slice(2).replace(/Once$/,""),dt(t,e[0].toLowerCase()+e.slice(1))||dt(t,xs(e))||dt(t,e))}let en=null,Ca=null;function da(t){const e=en;return en=t,Ca=t&&t.type.__scopeId||null,e}function Aa(t){Ca=t}function Pa(){Ca=null}function Ct(t,e=en,n){if(!e||t._n)return t;const i=(...s)=>{i._d&&Jd(-1);const o=da(e),r=t(...s);return da(o),i._d&&Jd(1),r};return i._n=!0,i._c=!0,i._d=!0,i}function Xa(t){const{type:e,vnode:n,proxy:i,withProxy:s,props:o,propsOptions:[r],slots:a,attrs:l,emit:d,render:u,renderCache:f,data:h,setupState:m,ctx:b,inheritAttrs:y}=t;let _,p;const T=da(t);try{if(n.shapeFlag&4){const S=s||i;_=jn(u.call(S,S,f,o,m,h,b)),p=l}else{const S=e;_=jn(S.length>1?S(o,{attrs:l,slots:a,emit:d}):S(o,null)),p=e.props?l:Km(l)}}catch(S){Wo.length=0,Ea(S,t,1),_=ke(Cn)}let w=_;if(p&&y!==!1){const S=Object.keys(p),{shapeFlag:I}=w;S.length&&I&7&&(r&&S.some(Vc)&&(p=Jm(p,r)),w=Vi(w,p))}return n.dirs&&(w=Vi(w),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&(w.transition=n.transition),_=w,da(T),_}const Km=t=>{let e;for(const n in t)(n==="class"||n==="style"||ya(n))&&((e||(e={}))[n]=t[n]);return e},Jm=(t,e)=>{const n={};for(const i in t)(!Vc(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function Qm(t,e,n){const{props:i,children:s,component:o}=t,{props:r,children:a,patchFlag:l}=e,d=o.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return i?$d(i,r,d):!!r;if(l&8){const u=e.dynamicProps;for(let f=0;ft.__isSuspense;function n_(t,e){e&&e.pendingBranch?$e(t)?e.effects.push(...t):e.effects.push(t):qm(t)}function Jr(t,e){if(Ht){let n=Ht.provides;const i=Ht.parent&&Ht.parent.provides;i===n&&(n=Ht.provides=Object.create(i)),n[t]=e}}function Ni(t,e,n=!1){const i=Ht||en;if(i){const s=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(s&&t in s)return s[t];if(arguments.length>1)return n&&nt(e)?e.call(i.proxy):e}}const Hd={};function Ho(t,e,n){return wf(t,e,n)}function wf(t,e,{immediate:n,deep:i,flush:s,onTrack:o,onTrigger:r}=Mt){const a=Ht;let l,d=!1,u=!1;if(Qt(t)?(l=()=>t.value,d=Nl(t)):Ks(t)?(l=()=>t,i=!0):$e(t)?(u=!0,d=t.some(p=>Ks(p)||Nl(p)),l=()=>t.map(p=>{if(Qt(p))return p.value;if(Ks(p))return fs(p);if(nt(p))return Oi(p,a,2)})):nt(t)?e?l=()=>Oi(t,a,2):l=()=>{if(!(a&&a.isUnmounted))return f&&f(),Tn(t,a,3,[h])}:l=Bn,e&&i){const p=l;l=()=>fs(p())}let f,h=p=>{f=_.onStop=()=>{Oi(p,a,4)}};if(ir)return h=Bn,e?n&&Tn(e,a,3,[l(),u?[]:void 0,h]):l(),Bn;let m=u?[]:Hd;const b=()=>{if(!!_.active)if(e){const p=_.run();(i||d||(u?p.some((T,w)=>Ko(T,m[w])):Ko(p,m)))&&(f&&f(),Tn(e,a,3,[p,m===Hd?void 0:m,h]),m=p)}else _.run()};b.allowRecurse=!!e;let y;s==="sync"?y=b:s==="post"?y=()=>un(b,a&&a.suspense):y=()=>Ym(b);const _=new Wc(l,y);return e?n?b():m=_.run():s==="post"?un(_.run.bind(_),a&&a.suspense):_.run(),()=>{_.stop(),a&&a.scope&&$c(a.scope.effects,_)}}function i_(t,e,n){const i=this.proxy,s=zt(t)?t.includes(".")?Tf(i,t):()=>i[t]:t.bind(i,i);let o;nt(e)?o=e:(o=e.handler,n=e);const r=Ht;no(this);const a=wf(s,o.bind(i),n);return r?no(r):gs(),a}function Tf(t,e){const n=e.split(".");return()=>{let i=t;for(let s=0;s{fs(n,e)});else if(Zh(t))for(const n in t)fs(t[n],e);return t}function s_(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Df(()=>{t.isMounted=!0}),If(()=>{t.isUnmounting=!0}),t}const Sn=[Function,Array],o_={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Sn,onEnter:Sn,onAfterEnter:Sn,onEnterCancelled:Sn,onBeforeLeave:Sn,onLeave:Sn,onAfterLeave:Sn,onLeaveCancelled:Sn,onBeforeAppear:Sn,onAppear:Sn,onAfterAppear:Sn,onAppearCancelled:Sn},setup(t,{slots:e}){const n=k_(),i=s_();let s;return()=>{const o=e.default&&Pf(e.default(),!0);if(!o||!o.length)return;let r=o[0];if(o.length>1){for(const y of o)if(y.type!==Cn){r=y;break}}const a=pt(t),{mode:l}=a;if(i.isLeaving)return ja(r);const d=Gd(r);if(!d)return ja(r);const u=Bl(d,a,i,n);Vl(d,u);const f=n.subTree,h=f&&Gd(f);let m=!1;const{getTransitionKey:b}=d.type;if(b){const y=b();s===void 0?s=y:y!==s&&(s=y,m=!0)}if(h&&h.type!==Cn&&(!ls(d,h)||m)){const y=Bl(h,a,i,n);if(Vl(h,y),l==="out-in")return i.isLeaving=!0,y.afterLeave=()=>{i.isLeaving=!1,n.update()},ja(r);l==="in-out"&&d.type!==Cn&&(y.delayLeave=(_,p,T)=>{const w=Af(i,h);w[String(h.key)]=h,_._leaveCb=()=>{p(),_._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=T})}return r}}},Cf=o_;function Af(t,e){const{leavingVNodes:n}=t;let i=n.get(e.type);return i||(i=Object.create(null),n.set(e.type,i)),i}function Bl(t,e,n,i){const{appear:s,mode:o,persisted:r=!1,onBeforeEnter:a,onEnter:l,onAfterEnter:d,onEnterCancelled:u,onBeforeLeave:f,onLeave:h,onAfterLeave:m,onLeaveCancelled:b,onBeforeAppear:y,onAppear:_,onAfterAppear:p,onAppearCancelled:T}=e,w=String(t.key),S=Af(n,t),I=(R,E)=>{R&&Tn(R,i,9,E)},P=(R,E)=>{const g=E[1];I(R,E),$e(R)?R.every(F=>F.length<=1)&&g():R.length<=1&&g()},D={mode:o,persisted:r,beforeEnter(R){let E=a;if(!n.isMounted)if(s)E=y||a;else return;R._leaveCb&&R._leaveCb(!0);const g=S[w];g&&ls(t,g)&&g.el._leaveCb&&g.el._leaveCb(),I(E,[R])},enter(R){let E=l,g=d,F=u;if(!n.isMounted)if(s)E=_||l,g=p||d,F=T||u;else return;let O=!1;const $=R._enterCb=j=>{O||(O=!0,j?I(F,[R]):I(g,[R]),D.delayedLeave&&D.delayedLeave(),R._enterCb=void 0)};E?P(E,[R,$]):$()},leave(R,E){const g=String(t.key);if(R._enterCb&&R._enterCb(!0),n.isUnmounting)return E();I(f,[R]);let F=!1;const O=R._leaveCb=$=>{F||(F=!0,E(),$?I(b,[R]):I(m,[R]),R._leaveCb=void 0,S[g]===t&&delete S[g])};S[g]=t,h?P(h,[R,O]):O()},clone(R){return Bl(R,e,n,i)}};return D}function ja(t){if(Ra(t))return t=Vi(t),t.children=null,t}function Gd(t){return Ra(t)?t.children?t.children[0]:void 0:t}function Vl(t,e){t.shapeFlag&6&&t.component?Vl(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 Pf(t,e=!1,n){let i=[],s=0;for(let o=0;o1)for(let o=0;o!!t.type.__asyncLoader,Ra=t=>t.type.__isKeepAlive;function r_(t,e){Rf(t,"a",e)}function a_(t,e){Rf(t,"da",e)}function Rf(t,e,n=Ht){const i=t.__wdc||(t.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Da(e,i,n),n){let s=n.parent;for(;s&&s.parent;)Ra(s.parent.vnode)&&l_(i,e,n,s),s=s.parent}}function l_(t,e,n,i){const s=Da(e,t,i,!0);Ff(()=>{$c(i[e],s)},n)}function Da(t,e,n=Ht,i=!1){if(n){const s=n[t]||(n[t]=[]),o=e.__weh||(e.__weh=(...r)=>{if(n.isUnmounted)return;mo(),no(n);const a=Tn(e,n,t,r);return gs(),_o(),a});return i?s.unshift(o):s.push(o),o}}const _i=t=>(e,n=Ht)=>(!ir||t==="sp")&&Da(t,e,n),c_=_i("bm"),Df=_i("m"),d_=_i("bu"),u_=_i("u"),If=_i("bum"),Ff=_i("um"),h_=_i("sp"),f_=_i("rtg"),p_=_i("rtc");function m_(t,e=Ht){Da("ec",t,e)}function se(t,e){const n=en;if(n===null)return t;const i=Fa(n)||n.proxy,s=t.dirs||(t.dirs=[]);for(let o=0;oe(r,a,void 0,o&&o[a]));else{const r=Object.keys(t);s=new Array(r.length);for(let a=0,l=r.length;afa(e)?!(e.type===Cn||e.type===at&&!Of(e.children)):!0)?t:null}const $l=t=>t?Zf(t)?Fa(t)||t.proxy:$l(t.parent):null,ua=jt(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=>$l(t.parent),$root:t=>$l(t.root),$emit:t=>t.emit,$options:t=>zf(t),$forceUpdate:t=>t.f||(t.f=()=>bf(t.update)),$nextTick:t=>t.n||(t.n=vf.bind(t.proxy)),$watch:t=>i_.bind(t)}),g_={get({_:t},e){const{ctx:n,setupState:i,data:s,props:o,accessCache:r,type:a,appContext:l}=t;let d;if(e[0]!=="$"){const m=r[e];if(m!==void 0)switch(m){case 1:return i[e];case 2:return s[e];case 4:return n[e];case 3:return o[e]}else{if(i!==Mt&&dt(i,e))return r[e]=1,i[e];if(s!==Mt&&dt(s,e))return r[e]=2,s[e];if((d=t.propsOptions[0])&&dt(d,e))return r[e]=3,o[e];if(n!==Mt&&dt(n,e))return r[e]=4,n[e];Hl&&(r[e]=0)}}const u=ua[e];let f,h;if(u)return e==="$attrs"&&bn(t,"get",e),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==Mt&&dt(n,e))return r[e]=4,n[e];if(h=l.config.globalProperties,dt(h,e))return h[e]},set({_:t},e,n){const{data:i,setupState:s,ctx:o}=t;return s!==Mt&&dt(s,e)?(s[e]=n,!0):i!==Mt&&dt(i,e)?(i[e]=n,!0):dt(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(o[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:i,appContext:s,propsOptions:o}},r){let a;return!!n[r]||t!==Mt&&dt(t,r)||e!==Mt&&dt(e,r)||(a=o[0])&&dt(a,r)||dt(i,r)||dt(ua,r)||dt(s.config.globalProperties,r)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:dt(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};let Hl=!0;function v_(t){const e=zf(t),n=t.proxy,i=t.ctx;Hl=!1,e.beforeCreate&&Xd(e.beforeCreate,t,"bc");const{data:s,computed:o,methods:r,watch:a,provide:l,inject:d,created:u,beforeMount:f,mounted:h,beforeUpdate:m,updated:b,activated:y,deactivated:_,beforeDestroy:p,beforeUnmount:T,destroyed:w,unmounted:S,render:I,renderTracked:P,renderTriggered:D,errorCaptured:R,serverPrefetch:E,expose:g,inheritAttrs:F,components:O,directives:$,filters:j}=e;if(d&&b_(d,i,null,t.appContext.config.unwrapInjectedRef),r)for(const ae in r){const G=r[ae];nt(G)&&(i[ae]=G.bind(n))}if(s){const ae=s.call(n,n);Ft(ae)&&(t.data=hr(ae))}if(Hl=!0,o)for(const ae in o){const G=o[ae],fe=nt(G)?G.bind(n,n):nt(G.get)?G.get.bind(n,n):Bn,ye=!nt(G)&&nt(G.set)?G.set.bind(n):Bn,De=qn({get:fe,set:ye});Object.defineProperty(i,ae,{enumerable:!0,configurable:!0,get:()=>De.value,set:Be=>De.value=Be})}if(a)for(const ae in a)Nf(a[ae],i,n,ae);if(l){const ae=nt(l)?l.call(n):l;Reflect.ownKeys(ae).forEach(G=>{Jr(G,ae[G])})}u&&Xd(u,t,"c");function q(ae,G){$e(G)?G.forEach(fe=>ae(fe.bind(n))):G&&ae(G.bind(n))}if(q(c_,f),q(Df,h),q(d_,m),q(u_,b),q(r_,y),q(a_,_),q(m_,R),q(p_,P),q(f_,D),q(If,T),q(Ff,S),q(h_,E),$e(g))if(g.length){const ae=t.exposed||(t.exposed={});g.forEach(G=>{Object.defineProperty(ae,G,{get:()=>n[G],set:fe=>n[G]=fe})})}else t.exposed||(t.exposed={});I&&t.render===Bn&&(t.render=I),F!=null&&(t.inheritAttrs=F),O&&(t.components=O),$&&(t.directives=$)}function b_(t,e,n=Bn,i=!1){$e(t)&&(t=Gl(t));for(const s in t){const o=t[s];let r;Ft(o)?"default"in o?r=Ni(o.from||s,o.default,!0):r=Ni(o.from||s):r=Ni(o),Qt(r)&&i?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:a=>r.value=a}):e[s]=r}}function Xd(t,e,n){Tn($e(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function Nf(t,e,n,i){const s=i.includes(".")?Tf(n,i):()=>n[i];if(zt(t)){const o=e[t];nt(o)&&Ho(s,o)}else if(nt(t))Ho(s,t.bind(n));else if(Ft(t))if($e(t))t.forEach(o=>Nf(o,e,n,i));else{const o=nt(t.handler)?t.handler.bind(n):e[t.handler];nt(o)&&Ho(s,o,t)}}function zf(t){const e=t.type,{mixins:n,extends:i}=e,{mixins:s,optionsCache:o,config:{optionMergeStrategies:r}}=t.appContext,a=o.get(e);let l;return a?l=a:!s.length&&!n&&!i?l=e:(l={},s.length&&s.forEach(d=>ha(l,d,r,!0)),ha(l,e,r)),o.set(e,l),l}function ha(t,e,n,i=!1){const{mixins:s,extends:o}=e;o&&ha(t,o,n,!0),s&&s.forEach(r=>ha(t,r,n,!0));for(const r in e)if(!(i&&r==="expose")){const a=y_[r]||n&&n[r];t[r]=a?a(t[r],e[r]):e[r]}return t}const y_={data:jd,props:os,emits:os,methods:os,computed:os,beforeCreate:on,created:on,beforeMount:on,mounted:on,beforeUpdate:on,updated:on,beforeDestroy:on,beforeUnmount:on,destroyed:on,unmounted:on,activated:on,deactivated:on,errorCaptured:on,serverPrefetch:on,components:os,directives:os,watch:S_,provide:jd,inject:x_};function jd(t,e){return e?t?function(){return jt(nt(t)?t.call(this,this):t,nt(e)?e.call(this,this):e)}:e:t}function x_(t,e){return os(Gl(t),Gl(e))}function Gl(t){if($e(t)){const e={};for(let n=0;n0)&&!(r&16)){if(r&8){const u=t.vnode.dynamicProps;for(let f=0;f{l=!0;const[h,m]=Bf(f,e,!0);jt(r,h),m&&a.push(...m)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!o&&!l)return i.set(t,qs),qs;if($e(o))for(let u=0;u-1,m[1]=y<0||b-1||dt(m,"default"))&&a.push(f)}}}const d=[r,a];return i.set(t,d),d}function Yd(t){return t[0]!=="$"}function qd(t){const e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:t===null?"null":""}function Zd(t,e){return qd(t)===qd(e)}function Kd(t,e){return $e(e)?e.findIndex(n=>Zd(n,t)):nt(e)&&Zd(e,t)?0:-1}const Vf=t=>t[0]==="_"||t==="$stable",Qc=t=>$e(t)?t.map(jn):[jn(t)],w_=(t,e,n)=>{if(e._n)return e;const i=Ct((...s)=>Qc(e(...s)),n);return i._c=!1,i},$f=(t,e,n)=>{const i=t._ctx;for(const s in t){if(Vf(s))continue;const o=t[s];if(nt(o))e[s]=w_(s,o,i);else if(o!=null){const r=Qc(o);e[s]=()=>r}}},Hf=(t,e)=>{const n=Qc(e);t.slots.default=()=>n},T_=(t,e)=>{if(t.vnode.shapeFlag&32){const n=e._;n?(t.slots=pt(e),la(e,"_",n)):$f(e,t.slots={})}else t.slots={},e&&Hf(t,e);la(t.slots,Ia,1)},C_=(t,e,n)=>{const{vnode:i,slots:s}=t;let o=!0,r=Mt;if(i.shapeFlag&32){const a=e._;a?n&&a===1?o=!1:(jt(s,e),!n&&a===1&&delete s._):(o=!e.$stable,$f(e,s)),r=e}else e&&(Hf(t,e),r={default:1});if(o)for(const a in s)!Vf(a)&&!(a in r)&&delete s[a]};function Gf(){return{app:null,config:{isNativeTag:rm,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let A_=0;function P_(t,e){return function(i,s=null){nt(i)||(i=Object.assign({},i)),s!=null&&!Ft(s)&&(s=null);const o=Gf(),r=new Set;let a=!1;const l=o.app={_uid:A_++,_component:i,_props:s,_container:null,_context:o,_instance:null,version:X_,get config(){return o.config},set config(d){},use(d,...u){return r.has(d)||(d&&nt(d.install)?(r.add(d),d.install(l,...u)):nt(d)&&(r.add(d),d(l,...u))),l},mixin(d){return o.mixins.includes(d)||o.mixins.push(d),l},component(d,u){return u?(o.components[d]=u,l):o.components[d]},directive(d,u){return u?(o.directives[d]=u,l):o.directives[d]},mount(d,u,f){if(!a){const h=ke(i,s);return h.appContext=o,u&&e?e(h,d):t(h,d,f),a=!0,l._container=d,d.__vue_app__=l,Fa(h.component)||h.component.proxy}},unmount(){a&&(t(null,l._container),delete l._container.__vue_app__)},provide(d,u){return o.provides[d]=u,l}};return l}}function Xl(t,e,n,i,s=!1){if($e(t)){t.forEach((h,m)=>Xl(h,e&&($e(e)?e[m]:e),n,i,s));return}if(Go(i)&&!s)return;const o=i.shapeFlag&4?Fa(i.component)||i.component.proxy:i.el,r=s?null:o,{i:a,r:l}=t,d=e&&e.r,u=a.refs===Mt?a.refs={}:a.refs,f=a.setupState;if(d!=null&&d!==l&&(zt(d)?(u[d]=null,dt(f,d)&&(f[d]=null)):Qt(d)&&(d.value=null)),nt(l))Oi(l,a,12,[r,u]);else{const h=zt(l),m=Qt(l);if(h||m){const b=()=>{if(t.f){const y=h?u[l]:l.value;s?$e(y)&&$c(y,o):$e(y)?y.includes(o)||y.push(o):h?(u[l]=[o],dt(f,l)&&(f[l]=u[l])):(l.value=[o],t.k&&(u[t.k]=l.value))}else h?(u[l]=r,dt(f,l)&&(f[l]=r)):m&&(l.value=r,t.k&&(u[t.k]=r))};r?(b.id=-1,un(b,n)):b()}}}const un=n_;function R_(t){return D_(t)}function D_(t,e){const n=hm();n.__VUE__=!0;const{insert:i,remove:s,patchProp:o,createElement:r,createText:a,createComment:l,setText:d,setElementText:u,parentNode:f,nextSibling:h,setScopeId:m=Bn,cloneNode:b,insertStaticContent:y}=t,_=(A,x,Z,ie=null,te=null,ne=null,_e=!1,Q=null,M=!!x.dynamicChildren)=>{if(A===x)return;A&&!ls(A,x)&&(ie=ue(A),Je(A,te,ne,!0),A=null),x.patchFlag===-2&&(M=!1,x.dynamicChildren=null);const{type:v,ref:U,shapeFlag:B}=x;switch(v){case ed:p(A,x,Z,ie);break;case Cn:T(A,x,Z,ie);break;case Ya:A==null&&w(x,Z,ie,_e);break;case at:$(A,x,Z,ie,te,ne,_e,Q,M);break;default:B&1?P(A,x,Z,ie,te,ne,_e,Q,M):B&6?j(A,x,Z,ie,te,ne,_e,Q,M):(B&64||B&128)&&v.process(A,x,Z,ie,te,ne,_e,Q,M,Se)}U!=null&&te&&Xl(U,A&&A.ref,ne,x||A,!x)},p=(A,x,Z,ie)=>{if(A==null)i(x.el=a(x.children),Z,ie);else{const te=x.el=A.el;x.children!==A.children&&d(te,x.children)}},T=(A,x,Z,ie)=>{A==null?i(x.el=l(x.children||""),Z,ie):x.el=A.el},w=(A,x,Z,ie)=>{[A.el,A.anchor]=y(A.children,x,Z,ie,A.el,A.anchor)},S=({el:A,anchor:x},Z,ie)=>{let te;for(;A&&A!==x;)te=h(A),i(A,Z,ie),A=te;i(x,Z,ie)},I=({el:A,anchor:x})=>{let Z;for(;A&&A!==x;)Z=h(A),s(A),A=Z;s(x)},P=(A,x,Z,ie,te,ne,_e,Q,M)=>{_e=_e||x.type==="svg",A==null?D(x,Z,ie,te,ne,_e,Q,M):g(A,x,te,ne,_e,Q,M)},D=(A,x,Z,ie,te,ne,_e,Q)=>{let M,v;const{type:U,props:B,shapeFlag:X,transition:H,patchFlag:ge,dirs:pe}=A;if(A.el&&b!==void 0&&ge===-1)M=A.el=b(A.el);else{if(M=A.el=r(A.type,ne,B&&B.is,B),X&8?u(M,A.children):X&16&&E(A.children,M,null,ie,te,ne&&U!=="foreignObject",_e,Q),pe&&ji(A,null,ie,"created"),B){for(const Me in B)Me!=="value"&&!Zr(Me)&&o(M,Me,null,B[Me],ne,A.children,ie,te,Y);"value"in B&&o(M,"value",null,B.value),(v=B.onVnodeBeforeMount)&&Gn(v,ie,A)}R(M,A,A.scopeId,_e,ie)}pe&&ji(A,null,ie,"beforeMount");const be=(!te||te&&!te.pendingBranch)&&H&&!H.persisted;be&&H.beforeEnter(M),i(M,x,Z),((v=B&&B.onVnodeMounted)||be||pe)&&un(()=>{v&&Gn(v,ie,A),be&&H.enter(M),pe&&ji(A,null,ie,"mounted")},te)},R=(A,x,Z,ie,te)=>{if(Z&&m(A,Z),ie)for(let ne=0;ne{for(let v=M;v{const Q=x.el=A.el;let{patchFlag:M,dynamicChildren:v,dirs:U}=x;M|=A.patchFlag&16;const B=A.props||Mt,X=x.props||Mt;let H;Z&&Yi(Z,!1),(H=X.onVnodeBeforeUpdate)&&Gn(H,Z,x,A),U&&ji(x,A,Z,"beforeUpdate"),Z&&Yi(Z,!0);const ge=te&&x.type!=="foreignObject";if(v?F(A.dynamicChildren,v,Q,Z,ie,ge,ne):_e||fe(A,x,Q,null,Z,ie,ge,ne,!1),M>0){if(M&16)O(Q,x,B,X,Z,ie,te);else if(M&2&&B.class!==X.class&&o(Q,"class",null,X.class,te),M&4&&o(Q,"style",B.style,X.style,te),M&8){const pe=x.dynamicProps;for(let be=0;be{H&&Gn(H,Z,x,A),U&&ji(x,A,Z,"updated")},ie)},F=(A,x,Z,ie,te,ne,_e)=>{for(let Q=0;Q{if(Z!==ie){for(const Q in ie){if(Zr(Q))continue;const M=ie[Q],v=Z[Q];M!==v&&Q!=="value"&&o(A,Q,v,M,_e,x.children,te,ne,Y)}if(Z!==Mt)for(const Q in Z)!Zr(Q)&&!(Q in ie)&&o(A,Q,Z[Q],null,_e,x.children,te,ne,Y);"value"in ie&&o(A,"value",Z.value,ie.value)}},$=(A,x,Z,ie,te,ne,_e,Q,M)=>{const v=x.el=A?A.el:a(""),U=x.anchor=A?A.anchor:a("");let{patchFlag:B,dynamicChildren:X,slotScopeIds:H}=x;H&&(Q=Q?Q.concat(H):H),A==null?(i(v,Z,ie),i(U,Z,ie),E(x.children,Z,U,te,ne,_e,Q,M)):B>0&&B&64&&X&&A.dynamicChildren?(F(A.dynamicChildren,X,Z,te,ne,_e,Q),(x.key!=null||te&&x===te.subTree)&&Wf(A,x,!0)):fe(A,x,Z,U,te,ne,_e,Q,M)},j=(A,x,Z,ie,te,ne,_e,Q,M)=>{x.slotScopeIds=Q,A==null?x.shapeFlag&512?te.ctx.activate(x,Z,ie,_e,M):re(x,Z,ie,te,ne,_e,M):q(A,x,M)},re=(A,x,Z,ie,te,ne,_e)=>{const Q=A.component=z_(A,ie,te);if(Ra(A)&&(Q.ctx.renderer=Se),B_(Q),Q.asyncDep){if(te&&te.registerDep(Q,ae),!A.el){const M=Q.subTree=ke(Cn);T(null,M,x,Z)}return}ae(Q,A,x,Z,te,ne,_e)},q=(A,x,Z)=>{const ie=x.component=A.component;if(Qm(A,x,Z))if(ie.asyncDep&&!ie.asyncResolved){G(ie,x,Z);return}else ie.next=x,jm(ie.update),ie.update();else x.el=A.el,ie.vnode=x},ae=(A,x,Z,ie,te,ne,_e)=>{const Q=()=>{if(A.isMounted){let{next:U,bu:B,u:X,parent:H,vnode:ge}=A,pe=U,be;Yi(A,!1),U?(U.el=ge.el,G(A,U,_e)):U=ge,B&&Kr(B),(be=U.props&&U.props.onVnodeBeforeUpdate)&&Gn(be,H,U,ge),Yi(A,!0);const Me=Xa(A),he=A.subTree;A.subTree=Me,_(he,Me,f(he.el),ue(he),A,te,ne),U.el=Me.el,pe===null&&e_(A,Me.el),X&&un(X,te),(be=U.props&&U.props.onVnodeUpdated)&&un(()=>Gn(be,H,U,ge),te)}else{let U;const{el:B,props:X}=x,{bm:H,m:ge,parent:pe}=A,be=Go(x);if(Yi(A,!1),H&&Kr(H),!be&&(U=X&&X.onVnodeBeforeMount)&&Gn(U,pe,x),Yi(A,!0),B&&Le){const Me=()=>{A.subTree=Xa(A),Le(B,A.subTree,A,te,null)};be?x.type.__asyncLoader().then(()=>!A.isUnmounted&&Me()):Me()}else{const Me=A.subTree=Xa(A);_(null,Me,Z,ie,A,te,ne),x.el=Me.el}if(ge&&un(ge,te),!be&&(U=X&&X.onVnodeMounted)){const Me=x;un(()=>Gn(U,pe,Me),te)}(x.shapeFlag&256||pe&&Go(pe.vnode)&&pe.vnode.shapeFlag&256)&&A.a&&un(A.a,te),A.isMounted=!0,x=Z=ie=null}},M=A.effect=new Wc(Q,()=>bf(v),A.scope),v=A.update=()=>M.run();v.id=A.uid,Yi(A,!0),v()},G=(A,x,Z)=>{x.component=A;const ie=A.vnode.props;A.vnode=x,A.next=null,E_(A,x.props,ie,Z),C_(A,x.children,Z),mo(),wa(void 0,A.update),_o()},fe=(A,x,Z,ie,te,ne,_e,Q,M=!1)=>{const v=A&&A.children,U=A?A.shapeFlag:0,B=x.children,{patchFlag:X,shapeFlag:H}=x;if(X>0){if(X&128){De(v,B,Z,ie,te,ne,_e,Q,M);return}else if(X&256){ye(v,B,Z,ie,te,ne,_e,Q,M);return}}H&8?(U&16&&Y(v,te,ne),B!==v&&u(Z,B)):U&16?H&16?De(v,B,Z,ie,te,ne,_e,Q,M):Y(v,te,ne,!0):(U&8&&u(Z,""),H&16&&E(B,Z,ie,te,ne,_e,Q,M))},ye=(A,x,Z,ie,te,ne,_e,Q,M)=>{A=A||qs,x=x||qs;const v=A.length,U=x.length,B=Math.min(v,U);let X;for(X=0;XU?Y(A,te,ne,!0,!1,B):E(x,Z,ie,te,ne,_e,Q,M,B)},De=(A,x,Z,ie,te,ne,_e,Q,M)=>{let v=0;const U=x.length;let B=A.length-1,X=U-1;for(;v<=B&&v<=X;){const H=A[v],ge=x[v]=M?Ri(x[v]):jn(x[v]);if(ls(H,ge))_(H,ge,Z,null,te,ne,_e,Q,M);else break;v++}for(;v<=B&&v<=X;){const H=A[B],ge=x[X]=M?Ri(x[X]):jn(x[X]);if(ls(H,ge))_(H,ge,Z,null,te,ne,_e,Q,M);else break;B--,X--}if(v>B){if(v<=X){const H=X+1,ge=HX)for(;v<=B;)Je(A[v],te,ne,!0),v++;else{const H=v,ge=v,pe=new Map;for(v=ge;v<=X;v++){const Ye=x[v]=M?Ri(x[v]):jn(x[v]);Ye.key!=null&&pe.set(Ye.key,v)}let be,Me=0;const he=X-ge+1;let Ae=!1,Xe=0;const He=new Array(he);for(v=0;v=he){Je(Ye,te,ne,!0);continue}let Ge;if(Ye.key!=null)Ge=pe.get(Ye.key);else for(be=ge;be<=X;be++)if(He[be-ge]===0&&ls(Ye,x[be])){Ge=be;break}Ge===void 0?Je(Ye,te,ne,!0):(He[Ge-ge]=v+1,Ge>=Xe?Xe=Ge:Ae=!0,_(Ye,x[Ge],Z,null,te,ne,_e,Q,M),Me++)}const Ie=Ae?I_(He):qs;for(be=Ie.length-1,v=he-1;v>=0;v--){const Ye=ge+v,Ge=x[Ye],gt=Ye+1{const{el:ne,type:_e,transition:Q,children:M,shapeFlag:v}=A;if(v&6){Be(A.component.subTree,x,Z,ie);return}if(v&128){A.suspense.move(x,Z,ie);return}if(v&64){_e.move(A,x,Z,Se);return}if(_e===at){i(ne,x,Z);for(let B=0;BQ.enter(ne),te);else{const{leave:B,delayLeave:X,afterLeave:H}=Q,ge=()=>i(ne,x,Z),pe=()=>{B(ne,()=>{ge(),H&&H()})};X?X(ne,ge,pe):pe()}else i(ne,x,Z)},Je=(A,x,Z,ie=!1,te=!1)=>{const{type:ne,props:_e,ref:Q,children:M,dynamicChildren:v,shapeFlag:U,patchFlag:B,dirs:X}=A;if(Q!=null&&Xl(Q,null,Z,A,!0),U&256){x.ctx.deactivate(A);return}const H=U&1&&X,ge=!Go(A);let pe;if(ge&&(pe=_e&&_e.onVnodeBeforeUnmount)&&Gn(pe,x,A),U&6)le(A.component,Z,ie);else{if(U&128){A.suspense.unmount(Z,ie);return}H&&ji(A,null,x,"beforeUnmount"),U&64?A.type.remove(A,x,Z,te,Se,ie):v&&(ne!==at||B>0&&B&64)?Y(v,x,Z,!1,!0):(ne===at&&B&384||!te&&U&16)&&Y(M,x,Z),ie&&ce(A)}(ge&&(pe=_e&&_e.onVnodeUnmounted)||H)&&un(()=>{pe&&Gn(pe,x,A),H&&ji(A,null,x,"unmounted")},Z)},ce=A=>{const{type:x,el:Z,anchor:ie,transition:te}=A;if(x===at){N(Z,ie);return}if(x===Ya){I(A);return}const ne=()=>{s(Z),te&&!te.persisted&&te.afterLeave&&te.afterLeave()};if(A.shapeFlag&1&&te&&!te.persisted){const{leave:_e,delayLeave:Q}=te,M=()=>_e(Z,ne);Q?Q(A.el,ne,M):M()}else ne()},N=(A,x)=>{let Z;for(;A!==x;)Z=h(A),s(A),A=Z;s(x)},le=(A,x,Z)=>{const{bum:ie,scope:te,update:ne,subTree:_e,um:Q}=A;ie&&Kr(ie),te.stop(),ne&&(ne.active=!1,Je(_e,A,x,Z)),Q&&un(Q,x),un(()=>{A.isUnmounted=!0},x),x&&x.pendingBranch&&!x.isUnmounted&&A.asyncDep&&!A.asyncResolved&&A.suspenseId===x.pendingId&&(x.deps--,x.deps===0&&x.resolve())},Y=(A,x,Z,ie=!1,te=!1,ne=0)=>{for(let _e=ne;_eA.shapeFlag&6?ue(A.component.subTree):A.shapeFlag&128?A.suspense.next():h(A.anchor||A.el),Oe=(A,x,Z)=>{A==null?x._vnode&&Je(x._vnode,null,null,!0):_(x._vnode||null,A,x,null,null,null,Z),Sf(),x._vnode=A},Se={p:_,um:Je,m:Be,r:ce,mt:re,mc:E,pc:fe,pbc:F,n:ue,o:t};let Ne,Le;return e&&([Ne,Le]=e(Se)),{render:Oe,hydrate:Ne,createApp:P_(Oe,Ne)}}function Yi({effect:t,update:e},n){t.allowRecurse=e.allowRecurse=n}function Wf(t,e,n=!1){const i=t.children,s=e.children;if($e(i)&&$e(s))for(let o=0;o>1,t[n[a]]0&&(e[i]=n[o-1]),n[o]=i)}}for(o=n.length,r=n[o-1];o-- >0;)n[o]=r,r=e[r];return n}const F_=t=>t.__isTeleport,at=Symbol(void 0),ed=Symbol(void 0),Cn=Symbol(void 0),Ya=Symbol(void 0),Wo=[];let zn=null;function W(t=!1){Wo.push(zn=t?null:[])}function L_(){Wo.pop(),zn=Wo[Wo.length-1]||null}let nr=1;function Jd(t){nr+=t}function Xf(t){return t.dynamicChildren=nr>0?zn||qs:null,L_(),nr>0&&zn&&zn.push(t),t}function ee(t,e,n,i,s,o){return Xf(c(t,e,n,i,s,o,!0))}function Jt(t,e,n,i,s){return Xf(ke(t,e,n,i,s,!0))}function fa(t){return t?t.__v_isVNode===!0:!1}function ls(t,e){return t.type===e.type&&t.key===e.key}const Ia="__vInternal",jf=({key:t})=>t!=null?t:null,Qr=({ref:t,ref_key:e,ref_for:n})=>t!=null?zt(t)||Qt(t)||nt(t)?{i:en,r:t,k:e,f:!!n}:t:null;function c(t,e=null,n=null,i=0,s=null,o=t===at?0:1,r=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&jf(e),ref:e&&Qr(e),scopeId:Ca,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null};return a?(td(l,n),o&128&&t.normalize(l)):n&&(l.shapeFlag|=zt(n)?8:16),nr>0&&!r&&zn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&zn.push(l),l}const ke=U_;function U_(t,e=null,n=null,i=0,s=null,o=!1){if((!t||t===Lf)&&(t=Cn),fa(t)){const a=Vi(t,e,!0);return n&&td(a,n),nr>0&&!o&&zn&&(a.shapeFlag&6?zn[zn.indexOf(t)]=a:zn.push(a)),a.patchFlag|=-2,a}if(W_(t)&&(t=t.__vccOpts),e){e=Yf(e);let{class:a,style:l}=e;a&&!zt(a)&&(e.class=je(a)),Ft(l)&&(cf(l)&&!$e(l)&&(l=jt({},l)),e.style=fo(l))}const r=zt(t)?1:t_(t)?128:F_(t)?64:Ft(t)?4:nt(t)?2:0;return c(t,e,n,i,s,r,o,!0)}function Yf(t){return t?cf(t)||Ia in t?jt({},t):t:null}function Vi(t,e,n=!1){const{props:i,ref:s,patchFlag:o,children:r}=t,a=e?qf(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&jf(a),ref:e&&e.ref?n&&s?$e(s)?s.concat(Qr(e)):[s,Qr(e)]:Qr(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:r,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==at?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Vi(t.ssContent),ssFallback:t.ssFallback&&Vi(t.ssFallback),el:t.el,anchor:t.anchor}}function we(t=" ",e=0){return ke(ed,null,t,e)}function ot(t="",e=!1){return e?(W(),Jt(Cn,null,t)):ke(Cn,null,t)}function jn(t){return t==null||typeof t=="boolean"?ke(Cn):$e(t)?ke(at,null,t.slice()):typeof t=="object"?Ri(t):ke(ed,null,String(t))}function Ri(t){return t.el===null||t.memo?t:Vi(t)}function td(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if($e(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),td(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!(Ia in e)?e._ctx=en:s===3&&en&&(en.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else nt(e)?(e={default:e,_ctx:en},n=32):(e=String(e),i&64?(n=16,e=[we(e)]):n=8);t.children=e,t.shapeFlag|=n}function qf(...t){const e={};for(let n=0;nHt||en,no=t=>{Ht=t,t.scope.on()},gs=()=>{Ht&&Ht.scope.off(),Ht=null};function Zf(t){return t.vnode.shapeFlag&4}let ir=!1;function B_(t,e=!1){ir=e;const{props:n,children:i}=t.vnode,s=Zf(t);M_(t,n,s,e),T_(t,i);const o=s?V_(t,e):void 0;return ir=!1,o}function V_(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=df(new Proxy(t.ctx,g_));const{setup:i}=n;if(i){const s=t.setupContext=i.length>1?H_(t):null;no(t),mo();const o=Oi(i,t,0,[t.props,s]);if(_o(),gs(),Yh(o)){if(o.then(gs,gs),e)return o.then(r=>{Qd(t,r,e)}).catch(r=>{Ea(r,t,0)});t.asyncDep=o}else Qd(t,o,e)}else Kf(t,e)}function Qd(t,e,n){nt(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Ft(e)&&(t.setupState=_f(e)),Kf(t,n)}let eu;function Kf(t,e,n){const i=t.type;if(!t.render){if(!e&&eu&&!i.render){const s=i.template;if(s){const{isCustomElement:o,compilerOptions:r}=t.appContext.config,{delimiters:a,compilerOptions:l}=i,d=jt(jt({isCustomElement:o,delimiters:a},r),l);i.render=eu(s,d)}}t.render=i.render||Bn}no(t),mo(),v_(t),_o(),gs()}function $_(t){return new Proxy(t.attrs,{get(e,n){return bn(t,"get","$attrs"),e[n]}})}function H_(t){const e=i=>{t.exposed=i||{}};let n;return{get attrs(){return n||(n=$_(t))},slots:t.slots,emit:t.emit,expose:e}}function Fa(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(_f(df(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in ua)return ua[n](t)}}))}function G_(t,e=!0){return nt(t)?t.displayName||t.name:t.name||e&&t.__name}function W_(t){return nt(t)&&"__vccOpts"in t}const qn=(t,e)=>Gm(t,e,ir);function nd(t,e,n){const i=arguments.length;return i===2?Ft(e)&&!$e(e)?fa(e)?ke(t,null,[e]):ke(t,e):ke(t,null,e):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&fa(n)&&(n=[n]),ke(t,e,n))}const X_="3.2.37",j_="http://www.w3.org/2000/svg",cs=typeof document!="undefined"?document:null,tu=cs&&cs.createElement("template"),Y_={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?cs.createElementNS(j_,t):cs.createElement(t,n?{is:n}:void 0);return t==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:t=>cs.createTextNode(t),createComment:t=>cs.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>cs.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},cloneNode(t){const e=t.cloneNode(!0);return"_value"in t&&(e._value=t._value),e},insertStaticContent(t,e,n,i,s,o){const r=n?n.previousSibling:e.lastChild;if(s&&(s===o||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{tu.innerHTML=i?`${t}`:t;const a=tu.content;if(i){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,n)}return[r?r.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}};function q_(t,e,n){const i=t._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}function Z_(t,e,n){const i=t.style,s=zt(n);if(n&&!s){for(const o in n)jl(i,o,n[o]);if(e&&!zt(e))for(const o in e)n[o]==null&&jl(i,o,"")}else{const o=i.display;s?e!==n&&(i.cssText=n):e&&t.removeAttribute("style"),"_vod"in t&&(i.display=o)}}const nu=/\s*!important$/;function jl(t,e,n){if($e(n))n.forEach(i=>jl(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=K_(t,e);nu.test(n)?t.setProperty(xs(i),n.replace(nu,""),"important"):t[i]=n}}const iu=["Webkit","Moz","ms"],qa={};function K_(t,e){const n=qa[e];if(n)return n;let i=ei(e);if(i!=="filter"&&i in t)return qa[e]=i;i=Sa(i);for(let s=0;s{let t=Date.now,e=!1;if(typeof window!="undefined"){Date.now()>document.createEvent("Event").timeStamp&&(t=performance.now.bind(performance));const n=navigator.userAgent.match(/firefox\/(\d+)/i);e=!!(n&&Number(n[1])<=53)}return[t,e]})();let Yl=0;const tg=Promise.resolve(),ng=()=>{Yl=0},ig=()=>Yl||(tg.then(ng),Yl=Jf());function Fi(t,e,n,i){t.addEventListener(e,n,i)}function sg(t,e,n,i){t.removeEventListener(e,n,i)}function og(t,e,n,i,s=null){const o=t._vei||(t._vei={}),r=o[e];if(i&&r)r.value=i;else{const[a,l]=rg(e);if(i){const d=o[e]=ag(i,s);Fi(t,a,d,l)}else r&&(sg(t,a,r,l),o[e]=void 0)}}const ou=/(?:Once|Passive|Capture)$/;function rg(t){let e;if(ou.test(t)){e={};let n;for(;n=t.match(ou);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[xs(t.slice(2)),e]}function ag(t,e){const n=i=>{const s=i.timeStamp||Jf();(eg||s>=n.attached-1)&&Tn(lg(i,n.value),e,5,[i])};return n.value=t,n.attached=ig(),n}function lg(t,e){if($e(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 ru=/^on[a-z]/,cg=(t,e,n,i,s=!1,o,r,a,l)=>{e==="class"?q_(t,i,s):e==="style"?Z_(t,n,i):ya(e)?Vc(e)||og(t,e,n,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):dg(t,e,i,s))?Q_(t,e,i,o,r,a,l):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),J_(t,e,i,s))};function dg(t,e,n,i){return i?!!(e==="innerHTML"||e==="textContent"||e in t&&ru.test(e)&&nt(n)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA"||ru.test(e)&&zt(n)?!1:e in t}const vi="transition",Eo="animation",id=(t,{slots:e})=>nd(Cf,ug(t),e);id.displayName="Transition";const Qf={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};id.props=jt({},Cf.props,Qf);const qi=(t,e=[])=>{$e(t)?t.forEach(n=>n(...e)):t&&t(...e)},au=t=>t?$e(t)?t.some(e=>e.length>1):t.length>1:!1;function ug(t){const e={};for(const O in t)O in Qf||(e[O]=t[O]);if(t.css===!1)return e;const{name:n="v",type:i,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:r=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:d=r,appearToClass:u=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=t,b=hg(s),y=b&&b[0],_=b&&b[1],{onBeforeEnter:p,onEnter:T,onEnterCancelled:w,onLeave:S,onLeaveCancelled:I,onBeforeAppear:P=p,onAppear:D=T,onAppearCancelled:R=w}=e,E=(O,$,j)=>{Zi(O,$?u:a),Zi(O,$?d:r),j&&j()},g=(O,$)=>{O._isLeaving=!1,Zi(O,f),Zi(O,m),Zi(O,h),$&&$()},F=O=>($,j)=>{const re=O?D:T,q=()=>E($,O,j);qi(re,[$,q]),lu(()=>{Zi($,O?l:o),bi($,O?u:a),au(re)||cu($,i,y,q)})};return jt(e,{onBeforeEnter(O){qi(p,[O]),bi(O,o),bi(O,r)},onBeforeAppear(O){qi(P,[O]),bi(O,l),bi(O,d)},onEnter:F(!1),onAppear:F(!0),onLeave(O,$){O._isLeaving=!0;const j=()=>g(O,$);bi(O,f),mg(),bi(O,h),lu(()=>{!O._isLeaving||(Zi(O,f),bi(O,m),au(S)||cu(O,i,_,j))}),qi(S,[O,j])},onEnterCancelled(O){E(O,!1),qi(w,[O])},onAppearCancelled(O){E(O,!0),qi(R,[O])},onLeaveCancelled(O){g(O),qi(I,[O])}})}function hg(t){if(t==null)return null;if(Ft(t))return[Za(t.enter),Za(t.leave)];{const e=Za(t);return[e,e]}}function Za(t){return Jo(t)}function bi(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.add(n)),(t._vtc||(t._vtc=new Set)).add(e)}function Zi(t,e){e.split(/\s+/).forEach(i=>i&&t.classList.remove(i));const{_vtc:n}=t;n&&(n.delete(e),n.size||(t._vtc=void 0))}function lu(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let fg=0;function cu(t,e,n,i){const s=t._endId=++fg,o=()=>{s===t._endId&&i()};if(n)return setTimeout(o,n);const{type:r,timeout:a,propCount:l}=pg(t,e);if(!r)return i();const d=r+"end";let u=0;const f=()=>{t.removeEventListener(d,h),o()},h=m=>{m.target===t&&++u>=l&&f()};setTimeout(()=>{u(n[b]||"").split(", "),s=i(vi+"Delay"),o=i(vi+"Duration"),r=du(s,o),a=i(Eo+"Delay"),l=i(Eo+"Duration"),d=du(a,l);let u=null,f=0,h=0;e===vi?r>0&&(u=vi,f=r,h=o.length):e===Eo?d>0&&(u=Eo,f=d,h=l.length):(f=Math.max(r,d),u=f>0?r>d?vi:Eo:null,h=u?u===vi?o.length:l.length:0);const m=u===vi&&/\b(transform|all)(,|$)/.test(n[vi+"Property"]);return{type:u,timeout:f,propCount:h,hasTransform:m}}function du(t,e){for(;t.lengthuu(n)+uu(t[i])))}function uu(t){return Number(t.slice(0,-1).replace(",","."))*1e3}function mg(){return document.body.offsetHeight}const io=t=>{const e=t.props["onUpdate:modelValue"]||!1;return $e(e)?n=>Kr(e,n):e};function _g(t){t.target.composing=!0}function hu(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const me={created(t,{modifiers:{lazy:e,trim:n,number:i}},s){t._assign=io(s);const o=i||s.props&&s.props.type==="number";Fi(t,e?"change":"input",r=>{if(r.target.composing)return;let a=t.value;n&&(a=a.trim()),o&&(a=Jo(a)),t._assign(a)}),n&&Fi(t,"change",()=>{t.value=t.value.trim()}),e||(Fi(t,"compositionstart",_g),Fi(t,"compositionend",hu),Fi(t,"change",hu))},mounted(t,{value:e}){t.value=e==null?"":e},beforeUpdate(t,{value:e,modifiers:{lazy:n,trim:i,number:s}},o){if(t._assign=io(o),t.composing||document.activeElement===t&&t.type!=="range"&&(n||i&&t.value.trim()===e||(s||t.type==="number")&&Jo(t.value)===e))return;const r=e==null?"":e;t.value!==r&&(t.value=r)}},Kn={deep:!0,created(t,e,n){t._assign=io(n),Fi(t,"change",()=>{const i=t._modelValue,s=sr(t),o=t.checked,r=t._assign;if($e(i)){const a=Bc(i,s),l=a!==-1;if(o&&!l)r(i.concat(s));else if(!o&&l){const d=[...i];d.splice(a,1),r(d)}}else if(po(i)){const a=new Set(i);o?a.add(s):a.delete(s),r(a)}else r(ep(t,o))})},mounted:fu,beforeUpdate(t,e,n){t._assign=io(n),fu(t,e,n)}};function fu(t,{value:e,oldValue:n},i){t._modelValue=e,$e(e)?t.checked=Bc(e,i.props.value)>-1:po(e)?t.checked=e.has(i.props.value):e!==n&&(t.checked=dr(e,ep(t,!0)))}const Jn={deep:!0,created(t,{value:e,modifiers:{number:n}},i){const s=po(e);Fi(t,"change",()=>{const o=Array.prototype.filter.call(t.options,r=>r.selected).map(r=>n?Jo(sr(r)):sr(r));t._assign(t.multiple?s?new Set(o):o:o[0])}),t._assign=io(i)},mounted(t,{value:e}){pu(t,e)},beforeUpdate(t,e,n){t._assign=io(n)},updated(t,{value:e}){pu(t,e)}};function pu(t,e){const n=t.multiple;if(!(n&&!$e(e)&&!po(e))){for(let i=0,s=t.options.length;i-1:o.selected=e.has(r);else if(dr(sr(o),e)){t.selectedIndex!==i&&(t.selectedIndex=i);return}}!n&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function sr(t){return"_value"in t?t._value:t.value}function ep(t,e){const n=e?"_trueValue":"_falseValue";return n in t?t[n]:e}const gg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},tp=(t,e)=>n=>{if(!("key"in n))return;const i=xs(n.key);if(e.some(s=>s===i||gg[s]===i))return t(n)},ln={beforeMount(t,{value:e},{transition:n}){t._vod=t.style.display==="none"?"":t.style.display,n&&e?n.beforeEnter(t):wo(t,e)},mounted(t,{value:e},{transition:n}){n&&e&&n.enter(t)},updated(t,{value:e,oldValue:n},{transition:i}){!e!=!n&&(i?e?(i.beforeEnter(t),wo(t,!0),i.enter(t)):i.leave(t,()=>{wo(t,!1)}):wo(t,e))},beforeUnmount(t,{value:e}){wo(t,e)}};function wo(t,e){t.style.display=e?t._vod:"none"}const vg=jt({patchProp:cg},Y_);let mu;function bg(){return mu||(mu=R_(vg))}const yg=(...t)=>{const e=bg().createApp(...t),{mount:n}=e;return e.mount=i=>{const s=xg(i);if(!s)return;const o=e._component;!nt(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.innerHTML="";const r=n(s,!1,s instanceof SVGElement);return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),r},e};function xg(t){return zt(t)?document.querySelector(t):t}/*! * vue-router v4.0.16 * (c) 2022 Eduardo San Martin Morote * @license MIT */const np=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",vo=t=>np?Symbol(t):"_vr_"+t,Sg=vo("rvlm"),_u=vo("rvd"),sd=vo("r"),ip=vo("rl"),ql=vo("rvl"),Gs=typeof window!="undefined";function Mg(t){return t.__esModule||np&&t[Symbol.toStringTag]==="Module"}const St=Object.assign;function Ka(t,e){const n={};for(const i in e){const s=e[i];n[i]=Array.isArray(s)?s.map(t):t(s)}return n}const Xo=()=>{},Eg=/\/$/,wg=t=>t.replace(Eg,"");function Ja(t,e,n="/"){let i,s={},o="",r="";const a=e.indexOf("?"),l=e.indexOf("#",a>-1?a:0);return a>-1&&(i=e.slice(0,a),o=e.slice(a+1,l>-1?l:e.length),s=t(o)),l>-1&&(i=i||e.slice(0,l),r=e.slice(l,e.length)),i=Pg(i!=null?i:e,n),{fullPath:i+(o&&"?")+o+r,path:i,query:s,hash:r}}function Tg(t,e){const n=e.query?t(e.query):"";return e.path+(n&&"?")+n+(e.hash||"")}function gu(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Cg(t,e,n){const i=e.matched.length-1,s=n.matched.length-1;return i>-1&&i===s&&so(e.matched[i],n.matched[s])&&sp(e.params,n.params)&&t(e.query)===t(n.query)&&e.hash===n.hash}function so(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function sp(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(!Ag(t[n],e[n]))return!1;return!0}function Ag(t,e){return Array.isArray(t)?vu(t,e):Array.isArray(e)?vu(e,t):t===e}function vu(t,e){return Array.isArray(e)?t.length===e.length&&t.every((n,i)=>n===e[i]):t.length===1&&t[0]===e}function Pg(t,e){if(t.startsWith("/"))return t;if(!t)return e;const n=e.split("/"),i=t.split("/");let s=n.length-1,o,r;for(o=0;o({left:window.pageXOffset,top:window.pageYOffset});function Lg(t){let e;if("el"in t){const n=t.el,i=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?i?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;e=Fg(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function bu(t,e){return(history.state?history.state.position-e:-1)+t}const Zl=new Map;function Ug(t,e){Zl.set(t,e)}function Og(t){const e=Zl.get(t);return Zl.delete(t),e}let Ng=()=>location.protocol+"//"+location.host;function op(t,e){const{pathname:n,search:i,hash:s}=e,o=t.indexOf("#");if(o>-1){let a=s.includes(t.slice(o))?t.slice(o).length:1,l=s.slice(a);return l[0]!=="/"&&(l="/"+l),gu(l,"")}return gu(n,t)+i+s}function zg(t,e,n,i){let s=[],o=[],r=null;const a=({state:h})=>{const m=op(t,location),b=n.value,y=e.value;let _=0;if(h){if(n.value=m,e.value=h,r&&r===b){r=null;return}_=y?h.position-y.position:0}else i(m);s.forEach(p=>{p(n.value,b,{delta:_,type:or.pop,direction:_?_>0?jo.forward:jo.back:jo.unknown})})};function l(){r=n.value}function d(h){s.push(h);const m=()=>{const b=s.indexOf(h);b>-1&&s.splice(b,1)};return o.push(m),m}function u(){const{history:h}=window;!h.state||h.replaceState(St({},h.state,{scroll:La()}),"")}function f(){for(const h of o)h();o=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u),{pauseListeners:l,listen:d,destroy:f}}function yu(t,e,n,i=!1,s=!1){return{back:t,current:e,forward:n,replaced:i,position:window.history.length,scroll:s?La():null}}function kg(t){const{history:e,location:n}=window,i={value:op(t,n)},s={value:e.state};s.value||o(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(l,d,u){const f=t.indexOf("#"),h=f>-1?(n.host&&document.querySelector("base")?t:t.slice(f))+l:Ng()+t+l;try{e[u?"replaceState":"pushState"](d,"",h),s.value=d}catch(m){console.error(m),n[u?"replace":"assign"](h)}}function r(l,d){const u=St({},e.state,yu(s.value.back,l,s.value.forward,!0),d,{position:s.value.position});o(l,u,!0),i.value=l}function a(l,d){const u=St({},s.value,e.state,{forward:l,scroll:La()});o(u.current,u,!0);const f=St({},yu(i.value,l,null),{position:u.position+1},d);o(l,f,!1),i.value=l}return{location:i,state:s,push:a,replace:r}}function Bg(t){t=Rg(t);const e=kg(t),n=zg(t,e.state,e.location,e.replace);function i(o,r=!0){r||n.pauseListeners(),history.go(o)}const s=St({location:"",base:t,go:i,createHref:Ig.bind(null,t)},e,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}function Vg(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),Bg(t)}function $g(t){return typeof t=="string"||t&&typeof t=="object"}function rp(t){return typeof t=="string"||typeof t=="symbol"}const yi={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},ap=vo("nf");var xu;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(xu||(xu={}));function oo(t,e){return St(new Error,{type:t,[ap]:!0},e)}function xi(t,e){return t instanceof Error&&ap in t&&(e==null||!!(t.type&e))}const Su="[^/]+?",Hg={sensitive:!1,strict:!1,start:!0,end:!0},Gg=/[.+*?^${}()[\]/\\]/g;function Wg(t,e){const n=St({},Hg,e),i=[];let s=n.start?"^":"";const o=[];for(const d of t){const u=d.length?[]:[90];n.strict&&!d.length&&(s+="/");for(let f=0;f1&&(u.endsWith("/")?u=u.slice(0,-1):f=!0);else throw new Error(`Missing required param "${b}"`);u+=T}}return u}return{re:r,score:i,keys:o,parse:a,stringify:l}}function Xg(t,e){let n=0;for(;ne.length?e.length===1&&e[0]===40+40?1:-1:0}function jg(t,e){let n=0;const i=t.score,s=e.score;for(;n0&&e[e.length-1]<0}const Yg={type:0,value:""},qg=/[a-zA-Z0-9_]/;function Zg(t){if(!t)return[[]];if(t==="/")return[[Yg]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(m){throw new Error(`ERR (${n})/"${d}": ${m}`)}let n=0,i=n;const s=[];let o;function r(){o&&s.push(o),o=[]}let a=0,l,d="",u="";function f(){!d||(n===0?o.push({type:0,value:d}):n===1||n===2||n===3?(o.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:d,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),d="")}function h(){d+=l}for(;a{r(T)}:Xo}function r(u){if(rp(u)){const f=i.get(u);f&&(i.delete(u),n.splice(n.indexOf(f),1),f.children.forEach(r),f.alias.forEach(r))}else{const f=n.indexOf(u);f>-1&&(n.splice(f,1),u.record.name&&i.delete(u.record.name),u.children.forEach(r),u.alias.forEach(r))}}function a(){return n}function l(u){let f=0;for(;f=0&&(u.record.path!==n[f].record.path||!lp(u,n[f]));)f++;n.splice(f,0,u),u.record.name&&!Eu(u)&&i.set(u.record.name,u)}function d(u,f){let h,m={},b,y;if("name"in u&&u.name){if(h=i.get(u.name),!h)throw oo(1,{location:u});y=h.record.name,m=St(Qg(f.params,h.keys.filter(T=>!T.optional).map(T=>T.name)),u.params),b=h.stringify(m)}else if("path"in u)b=u.path,h=n.find(T=>T.re.test(b)),h&&(m=h.parse(b),y=h.record.name);else{if(h=f.name?i.get(f.name):n.find(T=>T.re.test(f.path)),!h)throw oo(1,{location:u,currentLocation:f});y=h.record.name,m=St({},f.params,u.params),b=h.stringify(m)}const _=[];let p=h;for(;p;)_.unshift(p.record),p=p.parent;return{name:y,path:b,params:m,matched:_,meta:n0(_)}}return t.forEach(u=>o(u)),{addRoute:o,resolve:d,removeRoute:r,getRoutes:a,getRecordMatcher:s}}function Qg(t,e){const n={};for(const i of e)i in t&&(n[i]=t[i]);return n}function e0(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:t0(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||{}:{default:t.component}}}function t0(t){const e={},n=t.props||!1;if("component"in t)e.default=n;else for(const i in t.components)e[i]=typeof n=="boolean"?n:n[i];return e}function Eu(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function n0(t){return t.reduce((e,n)=>St(e,n.meta),{})}function wu(t,e){const n={};for(const i in t)n[i]=i in e?e[i]:t[i];return n}function lp(t,e){return e.children.some(n=>n===t||lp(t,n))}const cp=/#/g,i0=/&/g,s0=/\//g,o0=/=/g,r0=/\?/g,dp=/\+/g,a0=/%5B/g,l0=/%5D/g,up=/%5E/g,c0=/%60/g,hp=/%7B/g,d0=/%7C/g,fp=/%7D/g,u0=/%20/g;function od(t){return encodeURI(""+t).replace(d0,"|").replace(a0,"[").replace(l0,"]")}function h0(t){return od(t).replace(hp,"{").replace(fp,"}").replace(up,"^")}function Kl(t){return od(t).replace(dp,"%2B").replace(u0,"+").replace(cp,"%23").replace(i0,"%26").replace(c0,"`").replace(hp,"{").replace(fp,"}").replace(up,"^")}function f0(t){return Kl(t).replace(o0,"%3D")}function p0(t){return od(t).replace(cp,"%23").replace(r0,"%3F")}function m0(t){return t==null?"":p0(t).replace(s0,"%2F")}function pa(t){try{return decodeURIComponent(""+t)}catch{}return""+t}function _0(t){const e={};if(t===""||t==="?")return e;const i=(t[0]==="?"?t.slice(1):t).split("&");for(let s=0;so&&Kl(o)):[i&&Kl(i)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+n,o!=null&&(e+="="+o))})}return e}function g0(t){const e={};for(const n in t){const i=t[n];i!==void 0&&(e[n]=Array.isArray(i)?i.map(s=>s==null?null:""+s):i==null?i:""+i)}return e}function To(){let t=[];function e(i){return t.push(i),()=>{const s=t.indexOf(i);s>-1&&t.splice(s,1)}}function n(){t=[]}return{add:e,list:()=>t,reset:n}}function Di(t,e,n,i,s){const o=i&&(i.enterCallbacks[s]=i.enterCallbacks[s]||[]);return()=>new Promise((r,a)=>{const l=f=>{f===!1?a(oo(4,{from:n,to:e})):f instanceof Error?a(f):$g(f)?a(oo(2,{from:e,to:f})):(o&&i.enterCallbacks[s]===o&&typeof f=="function"&&o.push(f),r())},d=t.call(i&&i.instances[s],e,n,l);let u=Promise.resolve(d);t.length<3&&(u=u.then(l)),u.catch(f=>a(f))})}function Qa(t,e,n,i){const s=[];for(const o of t)for(const r in o.components){let a=o.components[r];if(!(e!=="beforeRouteEnter"&&!o.instances[r]))if(v0(a)){const d=(a.__vccOpts||a)[e];d&&s.push(Di(d,n,i,o,r))}else{let l=a();s.push(()=>l.then(d=>{if(!d)return Promise.reject(new Error(`Couldn't resolve component "${r}" at "${o.path}"`));const u=Mg(d)?d.default:d;o.components[r]=u;const h=(u.__vccOpts||u)[e];return h&&Di(h,n,i,o,r)()}))}}return s}function v0(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Cu(t){const e=Ni(sd),n=Ni(ip),i=qn(()=>e.resolve(Bo(t.to))),s=qn(()=>{const{matched:l}=i.value,{length:d}=l,u=l[d-1],f=n.matched;if(!u||!f.length)return-1;const h=f.findIndex(so.bind(null,u));if(h>-1)return h;const m=Au(l[d-2]);return d>1&&Au(u)===m&&f[f.length-1].path!==m?f.findIndex(so.bind(null,l[d-2])):h}),o=qn(()=>s.value>-1&&S0(n.params,i.value.params)),r=qn(()=>s.value>-1&&s.value===n.matched.length-1&&sp(n.params,i.value.params));function a(l={}){return x0(l)?e[Bo(t.replace)?"replace":"push"](Bo(t.to)).catch(Xo):Promise.resolve()}return{route:i,href:qn(()=>i.value.href),isActive:o,isExactActive:r,navigate:a}}const b0=go({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Cu,setup(t,{slots:e}){const n=hr(Cu(t)),{options:i}=Ni(sd),s=qn(()=>({[Pu(t.activeClass,i.linkActiveClass,"router-link-active")]:n.isActive,[Pu(t.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=e.default&&e.default(n);return t.custom?o:nd("a",{"aria-current":n.isExactActive?t.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),y0=b0;function x0(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function S0(t,e){for(const n in e){const i=e[n],s=t[n];if(typeof i=="string"){if(i!==s)return!1}else if(!Array.isArray(s)||s.length!==i.length||i.some((o,r)=>o!==s[r]))return!1}return!0}function Au(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Pu=(t,e,n)=>t!=null?t:e!=null?e:n,M0=go({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:n}){const i=Ni(ql),s=qn(()=>t.route||i.value),o=Ni(_u,0),r=qn(()=>s.value.matched[o]);Jr(_u,o+1),Jr(Sg,r),Jr(ql,s);const a=ff();return Ho(()=>[a.value,r.value,t.name],([l,d,u],[f,h,m])=>{d&&(d.instances[u]=l,h&&h!==d&&l&&l===f&&(d.leaveGuards.size||(d.leaveGuards=h.leaveGuards),d.updateGuards.size||(d.updateGuards=h.updateGuards))),l&&d&&(!h||!so(d,h)||!f)&&(d.enterCallbacks[u]||[]).forEach(b=>b(l))},{flush:"post"}),()=>{const l=s.value,d=r.value,u=d&&d.components[t.name],f=t.name;if(!u)return Ru(n.default,{Component:u,route:l});const h=d.props[t.name],m=h?h===!0?l.params:typeof h=="function"?h(l):h:null,y=nd(u,St({},m,e,{onVnodeUnmounted:_=>{_.component.isUnmounted&&(d.instances[f]=null)},ref:a}));return Ru(n.default,{Component:y,route:l})||y}}});function Ru(t,e){if(!t)return null;const n=t(e);return n.length===1?n[0]:n}const E0=M0;function w0(t){const e=Jg(t.routes,t),n=t.parseQuery||_0,i=t.stringifyQuery||Tu,s=t.history,o=To(),r=To(),a=To(),l=pf(yi);let d=yi;Gs&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ka.bind(null,N=>""+N),f=Ka.bind(null,m0),h=Ka.bind(null,pa);function m(N,le){let Y,ue;return rp(N)?(Y=e.getRecordMatcher(N),ue=le):ue=N,e.addRoute(ue,Y)}function b(N){const le=e.getRecordMatcher(N);le&&e.removeRoute(le)}function y(){return e.getRoutes().map(N=>N.record)}function _(N){return!!e.getRecordMatcher(N)}function p(N,le){if(le=St({},le||l.value),typeof N=="string"){const Le=Ja(n,N,le.path),A=e.resolve({path:Le.path},le),x=s.createHref(Le.fullPath);return St(Le,A,{params:h(A.params),hash:pa(Le.hash),redirectedFrom:void 0,href:x})}let Y;if("path"in N)Y=St({},N,{path:Ja(n,N.path,le.path).path});else{const Le=St({},N.params);for(const A in Le)Le[A]==null&&delete Le[A];Y=St({},N,{params:f(N.params)}),le.params=f(le.params)}const ue=e.resolve(Y,le),Oe=N.hash||"";ue.params=u(h(ue.params));const Se=Tg(i,St({},N,{hash:h0(Oe),path:ue.path})),Ne=s.createHref(Se);return St({fullPath:Se,hash:Oe,query:i===Tu?g0(N.query):N.query||{}},ue,{redirectedFrom:void 0,href:Ne})}function T(N){return typeof N=="string"?Ja(n,N,l.value.path):St({},N)}function w(N,le){if(d!==N)return oo(8,{from:le,to:N})}function S(N){return D(N)}function I(N){return S(St(T(N),{replace:!0}))}function P(N){const le=N.matched[N.matched.length-1];if(le&&le.redirect){const{redirect:Y}=le;let ue=typeof Y=="function"?Y(N):Y;return typeof ue=="string"&&(ue=ue.includes("?")||ue.includes("#")?ue=T(ue):{path:ue},ue.params={}),St({query:N.query,hash:N.hash,params:N.params},ue)}}function D(N,le){const Y=d=p(N),ue=l.value,Oe=N.state,Se=N.force,Ne=N.replace===!0,Le=P(Y);if(Le)return D(St(T(Le),{state:Oe,force:Se,replace:Ne}),le||Y);const A=Y;A.redirectedFrom=le;let x;return!Se&&Cg(i,ue,Y)&&(x=oo(16,{to:A,from:ue}),ye(ue,ue,!0,!1)),(x?Promise.resolve(x):E(A,ue)).catch(Z=>xi(Z)?xi(Z,2)?Z:fe(Z):ae(Z,A,ue)).then(Z=>{if(Z){if(xi(Z,2))return D(St(T(Z.to),{state:Oe,force:Se,replace:Ne}),le||A)}else Z=F(A,ue,!0,Ne,Oe);return g(A,ue,Z),Z})}function R(N,le){const Y=w(N,le);return Y?Promise.reject(Y):Promise.resolve()}function E(N,le){let Y;const[ue,Oe,Se]=T0(N,le);Y=Qa(ue.reverse(),"beforeRouteLeave",N,le);for(const Le of ue)Le.leaveGuards.forEach(A=>{Y.push(Di(A,N,le))});const Ne=R.bind(null,N,le);return Y.push(Ne),Cs(Y).then(()=>{Y=[];for(const Le of o.list())Y.push(Di(Le,N,le));return Y.push(Ne),Cs(Y)}).then(()=>{Y=Qa(Oe,"beforeRouteUpdate",N,le);for(const Le of Oe)Le.updateGuards.forEach(A=>{Y.push(Di(A,N,le))});return Y.push(Ne),Cs(Y)}).then(()=>{Y=[];for(const Le of N.matched)if(Le.beforeEnter&&!le.matched.includes(Le))if(Array.isArray(Le.beforeEnter))for(const A of Le.beforeEnter)Y.push(Di(A,N,le));else Y.push(Di(Le.beforeEnter,N,le));return Y.push(Ne),Cs(Y)}).then(()=>(N.matched.forEach(Le=>Le.enterCallbacks={}),Y=Qa(Se,"beforeRouteEnter",N,le),Y.push(Ne),Cs(Y))).then(()=>{Y=[];for(const Le of r.list())Y.push(Di(Le,N,le));return Y.push(Ne),Cs(Y)}).catch(Le=>xi(Le,8)?Le:Promise.reject(Le))}function g(N,le,Y){for(const ue of a.list())ue(N,le,Y)}function F(N,le,Y,ue,Oe){const Se=w(N,le);if(Se)return Se;const Ne=le===yi,Le=Gs?history.state:{};Y&&(ue||Ne?s.replace(N.fullPath,St({scroll:Ne&&Le&&Le.scroll},Oe)):s.push(N.fullPath,Oe)),l.value=N,ye(N,le,Y,Ne),fe()}let O;function $(){O||(O=s.listen((N,le,Y)=>{const ue=p(N),Oe=P(ue);if(Oe){D(St(Oe,{replace:!0}),ue).catch(Xo);return}d=ue;const Se=l.value;Gs&&Ug(bu(Se.fullPath,Y.delta),La()),E(ue,Se).catch(Ne=>xi(Ne,12)?Ne:xi(Ne,2)?(D(Ne.to,ue).then(Le=>{xi(Le,20)&&!Y.delta&&Y.type===or.pop&&s.go(-1,!1)}).catch(Xo),Promise.reject()):(Y.delta&&s.go(-Y.delta,!1),ae(Ne,ue,Se))).then(Ne=>{Ne=Ne||F(ue,Se,!1),Ne&&(Y.delta?s.go(-Y.delta,!1):Y.type===or.pop&&xi(Ne,20)&&s.go(-1,!1)),g(ue,Se,Ne)}).catch(Xo)}))}let j=To(),re=To(),q;function ae(N,le,Y){fe(N);const ue=re.list();return ue.length?ue.forEach(Oe=>Oe(N,le,Y)):console.error(N),Promise.reject(N)}function G(){return q&&l.value!==yi?Promise.resolve():new Promise((N,le)=>{j.add([N,le])})}function fe(N){return q||(q=!N,$(),j.list().forEach(([le,Y])=>N?Y(N):le()),j.reset()),N}function ye(N,le,Y,ue){const{scrollBehavior:Oe}=t;if(!Gs||!Oe)return Promise.resolve();const Se=!Y&&Og(bu(N.fullPath,0))||(ue||!Y)&&history.state&&history.state.scroll||null;return vf().then(()=>Oe(N,le,Se)).then(Ne=>Ne&&Lg(Ne)).catch(Ne=>ae(Ne,N,le))}const De=N=>s.go(N);let Be;const Je=new Set;return{currentRoute:l,addRoute:m,removeRoute:b,hasRoute:_,getRoutes:y,resolve:p,options:t,push:S,replace:I,go:De,back:()=>De(-1),forward:()=>De(1),beforeEach:o.add,beforeResolve:r.add,afterEach:a.add,onError:re.add,isReady:G,install(N){const le=this;N.component("RouterLink",y0),N.component("RouterView",E0),N.config.globalProperties.$router=le,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>Bo(l)}),Gs&&!Be&&l.value===yi&&(Be=!0,S(s.location).catch(Oe=>{}));const Y={};for(const Oe in yi)Y[Oe]=qn(()=>l.value[Oe]);N.provide(sd,le),N.provide(ip,hr(Y)),N.provide(ql,l);const ue=N.unmount;Je.add(N),N.unmount=function(){Je.delete(N),Je.size<1&&(d=yi,O&&O(),O=null,l.value=yi,Be=!1,q=!1),ue()}}}}function Cs(t){return t.reduce((e,n)=>e.then(()=>n()),Promise.resolve())}function T0(t,e){const n=[],i=[],s=[],o=Math.max(e.matched.length,t.matched.length);for(let r=0;rso(d,a))?i.push(a):n.push(a));const l=t.matched[r];l&&(e.matched.find(d=>so(d,l))||s.push(l))}return[n,i,s]}class C0{constructor(e,n,i){this.onConnect=n,this.onDisconnect=i,this.options=e,this.port=null,this.isOpened=!1,this.setupListeners()}async open(){try{const e=await navigator.serial.requestPort();return await e.open(this.options),this.port=e,this.isOpened=!0,this.port.getInfo()}catch(e){throw console.error(e),e}}async close(){await this.port.close(),this.isOpened=!1}async write(e){if(this.port.writable){let n=this.port.writable.getWriter();await n.write(e),n.releaseLock()}}async read(){let e=new TextDecoder;for(;this.port.readable;){if(this.port.readable.locked==!0)return new Uint8Array(0);let n=this.port.readable.getReader(),i,s=0;try{for(;;){let{value:o,done:r}=await n.read();s=s+o.length,typeof i=="undefined"?i=o:i=new Uint8Array([...i,...o]);let a=e.decode(i);if(a.includes("ok")||a.includes("error")||a.includes("ALARM")||r){n.releaseLock();break}}return i.length>2048?i.slice(i.length-2048):i}catch(o){throw console.error(o),o}finally{n.releaseLock()}}}setupListeners(){navigator.serial.addEventListener("connect",this.onConnect),navigator.serial.addEventListener("disconnect",this.onDisconnect)}}var ct=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n};const A0={data(){return{serialPortHandler:this.serialPortHandler,lastMessage:""}},computed:{isOpened(){return this.serialPortHandler?this.serialPortHandler.isOpened==!0:!1}},methods:{async connect(){try{if(this.serialPortHandler.isOpened)return;const t=await this.serialPortHandler.open();this.lastMessage=""}catch(t){console.log(t),this.lastMessage="Failed to open serial port"}},disconnect(){if(this.serialPortHandler.isOpened){let t=0;for(;(this.serialPortHandler.port.readable.locked||this.serialPortHandler.port.writable.locked)&&(console.log("waiting..."),setTimeout(10),t++,!(t>10)););this.serialPortHandler.close()}}},mounted(){if(!("serial"in navigator)){this.lastMessage="Web Serial API is not supported in your browser",console.error(this.lastMessage);return}this.serialPortHandler=new C0({baudRate:115200},()=>{console.log("Device connected")},()=>{this.serialPortHandler.isOpened=!1,console.log("Device disconnected")})}},P0={class:"container"},R0={class:"navbar navbar-expand-lg navbar-light bg-light"},D0={class:"container-fluid"},I0=c("div",null,null,-1),F0={class:"text-danger p-1 m-0",role:"alert"},L0={key:0},U0={class:"row"},O0=c("div",{class:"col"},null,-1),N0={class:"col-auto text-center"},z0=["title"],k0={class:"col-auto"};function B0(t,e,n,i,s,o){const r=et("RouterView");return W(),ee("div",P0,[c("header",null,[c("nav",R0,[c("div",D0,[I0,c("div",F0,[s.lastMessage!=""?(W(),ee("span",L0,"\u26A0 "+ze(s.lastMessage),1)):ot("",!0)]),c("div",null,[c("form",null,[c("div",U0,[O0,c("div",N0,[c("span",{class:je(o.isOpened==!0?"fs-4 text-success":"fs-4 text-secondary"),title:o.isOpened==!0?"Connected":"Disconnected"},"\u25CF \u2699",10,z0)]),c("div",k0,[o.isOpened==!1?(W(),ee("button",{key:0,type:"button",onClick:e[0]||(e[0]=a=>o.connect()),class:"btn btn-dark btn-sm"},"Connect")):ot("",!0),o.isOpened==!0?(W(),ee("button",{key:1,type:"button",onClick:e[1]||(e[1]=a=>o.disconnect()),class:"btn btn-dark btn-sm"},"Disconnect")):ot("",!0)])])])])])])]),ke(r)])}var V0=ct(A0,[["render",B0]]);const $0="modulepreload",Du={},H0="/",G0=function(e,n){return!n||n.length===0?e():Promise.all(n.map(i=>{if(i=`${H0}${i}`,i in Du)return;Du[i]=!0;const s=i.endsWith(".css"),o=s?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${o}`))return;const r=document.createElement("link");if(r.rel=s?"stylesheet":$0,s||(r.as="script",r.crossOrigin=""),r.href=i,document.head.appendChild(r),s)return new Promise((a,l)=>{r.addEventListener("load",a),r.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>e())},W0={props:{state:Boolean}},X0={key:0,class:"badge bg-success"},j0={key:1,class:"badge bg-danger"};function Y0(t,e,n,i,s,o){return W(),ee("span",null,[n.state==!0?(W(),ee("span",X0," On ")):(W(),ee("span",j0," Off "))])}var q0=ct(W0,[["render",Y0]]);const Z0={components:{OnOff:q0},props:{state:Object,pnpProcessing:Object,valvesState:Object,pumpState:Boolean},computed:{statusString(){return this.pnpProcessing.runFlag==!0?this.pnpProcessing.pauseFlag==!0?"Paused":"Job":this.state.status}}},K0={class:"card"},J0=c("div",{class:"card-header"},"Controller state",-1),Q0={class:"card-body"},ev={class:"row"},tv={class:"col text-center"},nv={class:"row"},iv=c("div",{class:"col-auto"},"X",-1),sv={class:"col text-end"},ov={class:"row"},rv=c("div",{class:"col-auto"},"Y",-1),av={class:"col text-end"},lv={class:"row"},cv=c("div",{class:"col-auto"},"Z",-1),dv={class:"col text-end"},uv={class:"row"},hv=c("div",{class:"col-auto"},"A",-1),fv={class:"col text-end"},pv={class:"row"},mv=c("div",{class:"col-auto"},"Pump",-1),_v={class:"col text-end"},gv={class:"row"},vv={class:"col-auto"},bv={class:"col text-end"};function yv(t,e,n,i,s,o){const r=et("OnOff");return W(),ee("div",K0,[J0,c("div",Q0,[c("div",ev,[c("div",tv,[c("h3",{class:je("Status "+o.statusString)},ze(o.statusString),3)])]),c("div",nv,[iv,c("div",sv,ze(n.state.pos.x),1)]),c("div",ov,[rv,c("div",av,ze(n.state.pos.y),1)]),c("div",lv,[cv,c("div",dv,ze(n.state.pos.z),1)]),c("div",uv,[hv,c("div",fv,ze(n.state.pos.a),1)]),c("div",pv,[mv,c("div",_v,[ke(r,{state:n.pumpState},null,8,["state"])])]),(W(!0),ee(at,null,wt(n.valvesState,(a,l)=>(W(),ee("div",gv,[c("div",vv,"Valve "+ze(l+1),1),c("div",bv,[ke(r,{state:a},null,8,["state"])])]))),256))])])}var xv=ct(Z0,[["render",yv]]);const Sv={props:{disabled:Boolean,enabledUnderAlaram:Boolean,settings:Object,valvesState:Object,pumpState:Boolean,movingOptions:Object},data:function(){return{tab:0,valves:[!1,!1],pump:!1}},methods:{command(t){this.$emit("command",t)},togglePump(){this.$emit("togglePump")},toggleValve(t){this.$emit("toggleValve",t)},togglePosition(){this.$emit("toggleCamNozzlePosition")}},watch:{valvesState:{handler(t,e){this.valves=this.valvesState},deep:!0},pumpState:{handler(t,e){this.pump=this.pumpState},deep:!0}}},Mv={class:"border p-3 mt-1"},Ev={class:"nav nav-tabs"},wv={class:"nav-item"},Tv={class:"nav-item"},Cv={key:0,class:"p-2"},Av={class:"row"},Pv={class:"col p-1"},Rv=["disabled"],Dv={class:"col p-1"},Iv=["disabled"],Fv={class:"col p-1"},Lv=["disabled"],Uv={class:"col p-1"},Ov=["disabled"],Nv={class:"row"},zv={class:"col p-1"},kv=["disabled"],Bv={class:"col p-1 text-nowrap"},Vv={class:"row p-0 m-0"},$v={class:"col p-0 m-0"},Hv=["disabled"],Gv=c("div",{class:"col-auto p-1 m-0"},null,-1),Wv={class:"col p-0 m-0"},Xv=["disabled"],jv={class:"col p-1"},Yv=["disabled"],qv={class:"col p-1"},Zv=["disabled"],Kv={class:"row"},Jv={class:"col p-1"},Qv=["disabled"],eb={class:"col p-1"},tb=["disabled"],nb={class:"col p-1"},ib=["disabled"],sb={class:"col p-1"},ob=["disabled"],rb={class:"row"},ab={class:"col p-1"},lb=we(" Step size XYZ (mm): "),cb={class:"row"},db={class:"col p-1"},ub=we(" Feed rate XYZ: "),hb=c("hr",null,null,-1),fb={class:"row"},pb={class:"col p-1"},mb=we(" Steps A (1.0 setep = 1 turn): "),_b={class:"row"},gb={class:"col p-1"},vb=we(" Feed rate A: "),bb={key:0,class:"row mt-4"},yb={class:"col p-1"},xb={class:"form-check form-switch"},Sb=["disabled"],Mb=c("label",{class:"form-check-label",for:"pump"},"Pump",-1),Eb={key:1,class:"row mt-4"},wb={class:"col p-1"},Tb={class:"form-check form-switch"},Cb=["onUpdate:modelValue","onClick","disabled","id"],Ab=["for"],Pb={key:1},Rb={class:"row"},Db={class:"col p-1"},Ib=["disabled"],Fb={class:"col p-1"},Lb=["disabled"],Ub={class:"col p-1"},Ob=["disabled"],Nb={class:"row"},zb={class:"col p-1"},kb=["disabled"],Bb={class:"col p-1"},Vb=["disabled"],$b={class:"row"},Hb={class:"col p-1"},Gb=["disabled"],Wb={class:"row"},Xb={class:"col p-1"},jb=["disabled"],Yb={class:"col p-1"},qb=["disabled"],Zb={class:"row"},Kb={class:"col p-1"},Jb=["disabled"],Qb={key:0},ey=we(" Camera \u21D2 Nozzle"),ty=c("br",null,null,-1),ny=we("Toggle Position "),iy=[ey,ty,ny],sy={key:1},oy=we(" Nozzle \u21D2 Camera"),ry=c("br",null,null,-1),ay=we("Toggle Position "),ly=[oy,ry,ay];function cy(t,e,n,i,s,o){return W(),ee("div",Mv,[c("ul",Ev,[c("li",wv,[c("a",{class:je("nav-link"+(t.tab==0?" active":"")),onClick:e[0]||(e[0]=r=>t.tab=0)},"Jog Controller",2)]),c("li",Tv,[c("a",{class:je("nav-link"+(t.tab==1?" active":"")),onClick:e[1]||(e[1]=r=>t.tab=1)},"Toolbox",2)])]),t.tab==0?(W(),ee("div",Cv,[c("div",Av,[c("div",Pv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[2]||(e[2]=r=>o.command("X-Y+"))},"\u{1F884}",8,Rv)]),c("div",Dv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[3]||(e[3]=r=>o.command("Y+"))},"\u{1F881}Y+",8,Iv)]),c("div",Fv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[4]||(e[4]=r=>o.command("X+Y+"))},"\u{1F885}",8,Lv)]),c("div",Uv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[5]||(e[5]=r=>o.command("Z+"))},"Z+",8,Ov)])]),c("div",Nv,[c("div",zv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[6]||(e[6]=r=>o.command("X-"))},"\u{1F878}X-",8,kv)]),c("div",Bv,[c("div",Vv,[c("div",$v,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[7]||(e[7]=r=>o.command("RR"))},"\u2B6E",8,Hv)]),Gv,c("div",Wv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[8]||(e[8]=r=>o.command("RL"))},"\u2B6F",8,Xv)])])]),c("div",jv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[9]||(e[9]=r=>o.command("X+"))},"X+\u{1F87A}",8,Yv)]),c("div",qv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[10]||(e[10]=r=>o.command("Parking")),title:"Parking"},"P",8,Zv)])]),c("div",Kv,[c("div",Jv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[11]||(e[11]=r=>o.command("X-Y-"))},"\u{1F887}",8,Qv)]),c("div",eb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[12]||(e[12]=r=>o.command("Y-"))},"\u{1F883}Y-",8,tb)]),c("div",nb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[13]||(e[13]=r=>o.command("X+Y-"))},"\u{1F886}",8,ib)]),c("div",sb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[14]||(e[14]=r=>o.command("Z-"))},"Z-",8,ob)])]),c("div",rb,[c("div",ab,[lb,se(c("input",{"onUpdate:modelValue":e[15]||(e[15]=r=>n.movingOptions.stepSize=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[me,n.movingOptions.stepSize]])])]),c("div",cb,[c("div",db,[ub,se(c("input",{"onUpdate:modelValue":e[16]||(e[16]=r=>n.movingOptions.feedRateXYZ=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[me,n.movingOptions.feedRateXYZ]])])]),hb,c("div",fb,[c("div",pb,[mb,se(c("input",{"onUpdate:modelValue":e[17]||(e[17]=r=>n.movingOptions.rotateStep=r),type:"number",step:"0.1",class:"form-control form-control-sm"},null,512),[[me,n.movingOptions.rotateStep]])])]),c("div",_b,[c("div",gb,[vb,se(c("input",{"onUpdate:modelValue":e[18]||(e[18]=r=>n.movingOptions.feedRateA=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[me,n.movingOptions.feedRateA]])])]),n.settings.pump?(W(),ee("div",bb,[c("div",yb,[c("div",xb,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=r=>t.pump=r),onClick:e[20]||(e[20]=r=>o.togglePump()),disabled:n.disabled,class:"form-check-input",type:"checkbox",role:"switch",id:"pump"},null,8,Sb),[[Kn,t.pump]]),Mb])])])):ot("",!0),n.settings.heads?(W(),ee("div",Eb,[(W(!0),ee(at,null,wt(n.settings.heads,(r,a)=>(W(),ee("div",wb,[c("div",Tb,[se(c("input",{"onUpdate:modelValue":l=>t.valves[a]=l,onClick:l=>o.toggleValve(a),disabled:n.disabled,class:"form-check-input",type:"checkbox",role:"switch",id:"valve"+a},null,8,Cb),[[Kn,t.valves[a]]]),c("label",{class:"form-check-label",for:"valve"+a},"Valve "+ze(a+1),9,Ab)])]))),256))])):ot("",!0)])):ot("",!0),t.tab==1?(W(),ee("div",Pb,[c("div",Rb,[c("div",Db,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[21]||(e[21]=r=>o.command("HomeResetZero"))},"Home Machine & Reset Zero",8,Ib)]),c("div",Fb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[22]||(e[22]=r=>o.command("Home"))},"Home Machine",8,Lb)]),c("div",Ub,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[23]||(e[23]=r=>o.command("ResetZero"))},"Reset Zero",8,Ob)])]),c("div",Nb,[c("div",zb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[24]||(e[24]=r=>o.command("Return"))},"Return to Zero XY",8,kb)]),c("div",Bb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[25]||(e[25]=r=>o.command("ReturnZ"))},"Return to Zero Z",8,Vb)])]),c("div",$b,[c("div",Hb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[26]||(e[26]=r=>o.command("Unlock"))},"Unlock",8,Gb)])]),c("div",Wb,[c("div",Xb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[27]||(e[27]=r=>o.command("State"))},"Get State",8,jb)]),c("div",Yb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[28]||(e[28]=r=>o.command("Pos"))},"Get Position",8,qb)])]),c("div",Zb,[c("div",Kb,[c("button",{disabled:n.disabled,class:je("btn btn-sm btn-outline-secondary jog-100"+(n.movingOptions.topCamNozzlePos==0?"":" active")),onClick:e[29]||(e[29]=r=>o.togglePosition())},[n.movingOptions.topCamNozzlePos==0?(W(),ee("span",Qb,iy)):(W(),ee("span",sy,ly))],10,Jb)])])])):ot("",!0)])}var dy=ct(Sv,[["render",cy]]);const uy={props:{consoleLog:"",disabled:Boolean},data:function(){return{command:this.command,history:[],historyIndex:0}},methods:{sendCommand(){this.$emit("sendCommand",this.command),this.history.push(this.command),this.historyIndex=this.history.length,this.command=""},keyUp(t){t.key=="ArrowUp"&&this.historyIndex>0&&(this.historyIndex--,this.command=this.history[this.historyIndex]),t.key=="ArrowDown"&&this.historyIndex{let t=this.$refs.console;t.scrollTop=t.scrollHeight},100)}}},hy={class:"card mt-1"},fy=c("div",{class:"card-header"},"Console",-1),py={class:"card-body"},my={class:"row"},_y={class:"col"},gy={class:"row"},vy={class:"col mt-1"},by=["disabled"];function yy(t,e,n,i,s,o){return W(),ee("div",hy,[fy,c("div",py,[c("div",my,[c("div",_y,[c("textarea",{readonly:"",rows:"10",ref:"console",class:"form-control form-control-sm"},ze(n.consoleLog),513)])]),c("div",gy,[c("div",vy,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>t.command=r),disabled:n.disabled,onKeyup:[e[1]||(e[1]=tp(r=>o.sendCommand(this.command),["enter"])),e[2]||(e[2]=(...r)=>o.keyUp&&o.keyUp(...r))],type:"text",class:"form-control form-control-sm"},null,40,by),[[me,t.command]])])])])])}var xy=ct(uy,[["render",yy]]);const vs=pf();function Ua(t){t===void 0&&(t=vs.value.comp.returnValue()),vs.value.resolve(t),vs.value=null}function rd(t,e,n="default"){return new Promise(i=>{vs.value={dialog:t,props:e,wrapper:n,resolve:i}})}const Sy={install:(t,e)=>{t.config.globalProperties.$close=(n,i)=>{Ua(i)}}};var My=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n};const Ey=go({name:"DialogWrapper",components:{},props:{name:{type:String,default:"default"},transitionAttrs:Object},setup(){const t=ff();return Ho(t,()=>{vs.value&&(vs.value.comp=t.value)}),{dialogRef:vs,dialogInstance:t}}});function wy(t,e,n,i,s,o){return W(),Jt(id,sm(Yf(t.transitionAttrs)),{default:Ct(()=>[t.dialogRef&&t.dialogRef.wrapper===t.name?(W(),Jt(__(t.dialogRef.dialog),qf({key:0},t.dialogRef.props,{ref:"dialogInstance"}),null,16)):ot("",!0)]),_:1},16)}var Ty=My(Ey,[["render",wy]]);const Cy=go({props:{text:String,title:String},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus()},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){if(t.keyCode==37){let e=this.$refs.btn_yes;e&&e.focus()}if(t.keyCode==39){let e=this.$refs.btn_no;e&&e.focus()}t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return!0}return{returnValue:t,closeDialog:Ua}}}),Ay={class:"dialog"},Py={class:"center"},Ry={class:"title"},Dy={class:"text"},Iy={class:"p-3 text-center"};function Fy(t,e,n,i,s,o){return W(),ee("div",Ay,[c("div",Py,[c("div",Ry,ze(t.title),1),c("div",Dy,ze(t.text),1),c("div",Iy,[c("button",{onClick:e[0]||(e[0]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"YES",512),c("button",{onClick:e[1]||(e[1]=r=>t.closeDialog(!1)),ref:"btn_no",class:"btn bt-sm btn-dark mb-1"},"NO",512)])])])}var Ly=ct(Cy,[["render",Fy],["__scopeId","data-v-cd0635e6"]]);const Uy=go({props:{text:String,title:String,type:String},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus()},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return!0}return{returnValue:t,closeDialog:Ua}}}),Oy={class:"dialog"},Ny={class:"center"},zy={class:"text"},ky={class:"p-3 text-center"};function By(t,e,n,i,s,o){return W(),ee("div",Oy,[c("div",Ny,[c("div",{class:je("title "+t.type)},ze(t.title),3),c("div",zy,ze(t.text),1),c("div",ky,[c("button",{onClick:e[0]||(e[0]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"OK",512)])])])}var Vy=ct(Uy,[["render",By],["__scopeId","data-v-7fc707e0"]]);const $y=go({props:{text:String,title:String,value:String},data(){return{inputValue:this.inputValue}},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus(),this.inputValue=this.value},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){t.keyCode==13&&this.closeDialog(),t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return this.inputValue}return{returnValue:t,closeDialog:Ua}}}),Hy={class:"dialog"},Gy={class:"center"},Wy={class:"title"},Xy={class:"text"},jy={class:"p-3 text-center"};function Yy(t,e,n,i,s,o){return W(),ee("div",Hy,[c("div",Gy,[c("div",Wy,ze(t.title),1),c("div",Xy,[we(ze(t.text)+" ",1),se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>t.inputValue=r),class:"form-control"},null,512),[[me,t.inputValue]])]),c("div",jy,[c("button",{onClick:e[1]||(e[1]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"YES",512),c("button",{onClick:e[2]||(e[2]=r=>t.closeDialog(!1)),ref:"btn_no",class:"btn bt-sm btn-dark mb-1"},"NO",512)])])])}var qy=ct($y,[["render",Yy],["__scopeId","data-v-8751a8c8"]]);async function Un(t,e=""){return await rd(Ly,{text:t,title:e})}async function st(t,e="",n=""){return await rd(Vy,{text:t,title:e,type:n})}async function Zy(t,e="",n=""){return await rd(qy,{text:t,title:e,value:n})}const Ky={props:{machineState:Object,gCodeProcess:Object,disabled:Boolean},data:function(){return{gCode:""}},computed:{enabledControls(){let t={openFile:!0,run:!1,stop:!1,pause:!1,gCode:!this.disabled};return t.run=this.machineState.status=="Idle"&&this.gCodeProcess.stopFlag==!1&&this.gCodeProcess.pauseFlag==!1&&this.gCode.length>0,t.stop=this.machineState.status=="Jog"||this.gCodeProcess.pauseFlag==!0,t.pause=this.machineState.status=="Jog"||this.gCodeProcess.pauseFlag==!0,t}},methods:{openFile(){let t=this.$refs.openFile.files[0];if(t){let e=new FileReader;e.readAsText(t,"UTF-8"),e.onload=n=>{this.gCode=n.target.result},e.onerror=n=>{console.log(n),st("Can't read file '"+t.name+"'","Error","error")}}},run(){let t=this.gCode.split(` `);this.$emit("run",t)},stop(){this.$emit("stop")},pause(){this.$emit("pause")}}},Jy={class:"card"},Qy=c("div",{class:"card-header"},"G Code",-1),ex={class:"card-body"},tx={class:"row"},nx={class:"col"},ix=["disabled"],sx=we(" | "),ox=["disabled"],rx=["disabled"],ax=["disabled"],lx={class:"row"},cx={class:"col"};function dx(t,e,n,i,s,o){return W(),ee("div",Jy,[Qy,c("div",ex,[c("div",tx,[c("div",nx,[c("input",{type:"file",ref:"openFile",accept:".txt, .gcode",style:{display:"none"},onChange:e[0]||(e[0]=r=>o.openFile())},null,544),c("button",{disabled:!o.enabledControls.openFile,class:"btn btn-sm btn-outline-secondary",onClick:e[1]||(e[1]=r=>t.$refs.openFile.click())},"Open\u2026",8,ix),sx,c("button",{disabled:!o.enabledControls.run,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[2]||(e[2]=r=>o.run())},"Run",8,ox),c("button",{disabled:!o.enabledControls.stop,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[3]||(e[3]=r=>o.stop())},"Stop",8,rx),c("button",{disabled:!o.enabledControls.pause,class:je("btn btn-sm btn-outline-secondary m-1"+(this.gCodeProcess.pauseFlag==!0?" active":"")),onClick:e[4]||(e[4]=r=>o.pause())},"Pause",10,ax)])]),c("div",lx,[c("div",cx,[se(c("textarea",{"onUpdate:modelValue":e[5]||(e[5]=r=>t.gCode=r),rows:"15",class:"form-control form-control-sm"},null,512),[[me,t.gCode]])])])])])}var ux=ct(Ky,[["render",dx]]);const hx={props:{settings:Object,disabled:!1},data:function(){return{values:{},description:{0:"Step pulse time, microseconds",1:"Step idle delay, milliseconds",2:"Step pulse invert, mask",3:"Step direction invert, mask",4:"Invert step enable pin, boolean",5:"Invert limit pins, boolean/mask",6:"Invert probe pin, boolean",7:"Disable spindle with 0 speed, boolean",8:"Ganged axes direction invert as bitfield",10:"Status report options, mask",11:"Junction deviation, millimeters",12:"Arc tolerance, millimeters",13:"Report in inches, boolean",14:"Limit pins invert, mask",15:"Coolant pins invert, mask",16:"Spindle pins invert, mask",17:"Control pins pullup disable, mask",18:"Limit pins pullup disable, mask",19:"Probe pin pullup disable, boolean",20:"Soft limits enable, boolean",21:"Hard limits enable, boolean",22:"Homing cycle enable, boolean (Grbl) / mask (GrblHAL)",23:"Homing direction invert, mask",24:"Homing locate feed rate, mm/min",25:"Homing search seek rate, mm/min",26:"Homing switch debounce delay, milliseconds",27:"Homing switch pull-off distance, millimeters",28:"G73 retract distance, in mm",29:"Step pulse delay (ms)",30:"Maximum spindle speed, RPM",31:"Minimum spindle speed, RPM",32:"Laser-mode enable, boolean",33:"Spindle PWM frequency",34:"Spindle off Value",35:"Spindle min value",36:"Spindle max value",37:"Stepper deenergize mask",39:"Enable printable realtime command characters, boolean",40:"Apply soft limits for jog commands, boolean",43:"Homing passes",44:"Homing cycle 1",45:"Homing cycle 2",46:"Homing cycle 3",47:"Homing cycle 4",62:"Sleep Enable",63:"Feed Hold Actions",64:"Force Init Alarm",65:"Require homing sequence to be executed at startup",70:"Network Services",73:"Wifi Mode",74:"",75:"",100:"X-axis steps per millimeter",101:"Y-axis steps per millimeter",102:"Z-axis steps per millimeter",103:"A-axis steps per millimeter",110:"X-axis maximum rate, mm/min",111:"Y-axis maximum rate, mm/min",112:"Z-axis maximum rate, mm/min",113:"A-axis maximum rate, mm/min",120:"X-axis acceleration, mm/sec^2",121:"Y-axis acceleration, mm/sec^2",122:"Z-axis acceleration, mm/sec^2",123:"A-axis acceleration, mm/sec^2",130:"X-axis maximum travel, millimeters",131:"Y-axis maximum travel, millimeters",132:"Z-axis maximum travel, millimeters",133:"A-axis maximum travel, millimeters",300:"Hostname",302:"IP Address",303:"Gateway",304:"Netmask",305:"Telnet Port",306:"HTTP Port",307:"Websocket Port",341:"Tool Change Mode",342:"Tool Change probing distance",343:"Tool Change Locate Feed rate",344:"Tool Change Search Seek rate",345:"Tool Change Probe Pull Off rate",370:"Invert I/O Port Inputs (mask)",384:"Disable G92 Persistence",346:"ToolChangeOptions",372:"Io Port Invert Out",376:"Rotary Axes",394:"Spindle On Delay",398:"Planner Blocks",481:"Auto Report Interval",484:"Unlock After EStop",486:"Offset Lock",538:"Rotary Wrap",539:"Spindle Off Delay",673:"Coolant On Delay",676:"Reset Actions",680:"Stepper Enable Delay"}}},computed:{settingsList(){for(let t in this.settings)typeof this.values[t]=="undefined"&&(this.values[t]=this.settings[t]);return this.values}},methods:{saveSetting(t){let e=["$"+t+"="+this.values[t],"$"+t];this.$emit("sendCommand",e)}}},fx={class:"card"},px=c("div",{class:"card-header"},"Controller Settings",-1),mx={class:"card-body"},_x={class:"row mb-1"},gx={class:"col-1"},vx={class:"col-auto"},bx=["onUpdate:modelValue"],yx={class:"col-auto"},xx={key:0},Sx=["disabled","onClick"],Mx={class:"col"};function Ex(t,e,n,i,s,o){return W(),ee("div",fx,[px,c("div",mx,[(W(!0),ee(at,null,wt(o.settingsList,(r,a)=>(W(),ee("div",_x,[c("div",gx,ze(a),1),c("div",vx,[se(c("input",{"onUpdate:modelValue":l=>t.values[a]=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,bx),[[me,t.values[a]]])]),c("div",yx,[t.values[a]!==n.settings[a]?(W(),ee("span",xx,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary",onClick:l=>o.saveSetting(a)},"Save",8,Sx)])):ot("",!0)]),c("div",Mx,ze(t.description[a]),1)]))),256))])])}var wx=ct(hx,[["render",Ex]]),Hn={methods:{machineStateIsOK(){if(this.machineState){if(this.machineState.status=="Idle")return!0;st("Controller status is wrong","Error","error")}else st("Controller state is wrong","Error","error");return!1}}};const Tx={mixins:[Hn],props:{cams:Object,machineState:Object,machinePos:Object,settings:Object,showWindow:Object,disabled:Boolean,loading:Boolean},data:function(){return{tab:0,calibrationShow:[!1,!1],currentPos:{x:0,y:0}}},methods:{calibrate(t){this.$emit("calibrate",t)},rememberPos(){this.machineStateIsOK()==!0&&(this.currentPos.x=this.machinePos.x,this.currentPos.y=this.machinePos.y)},calculateOffset(t){if(this.machineStateIsOK()==!0){let e=Math.round((this.currentPos.x-this.machinePos.x)*1e3)/1e3,n=Math.round((this.currentPos.y-this.machinePos.y)*1e3)/1e3;this.cams[t].offset.x=e,this.cams[t].offset.y=n}},setPosition(t){this.machineStateIsOK()==!0&&(this.cams[t].pos.x=this.machinePos.x,this.cams[t].pos.y=this.machinePos.y,this.cams[t].pos.z=this.machinePos.z)},jogBottomCamPos(){let t=[],e=parseFloat(this.cams[1].pos.x),n=parseFloat(this.cams[1].pos.y),i=parseFloat(this.cams[1].pos.z),s=this.settings.heads[0].safePosZ;t.push(`$J=G21G90Z${s}F2000`),t.push(`$J=G21G90X${e}Y${n}F2000`),t.push(`$J=G21G90Z${i}F2000`),this.$emit("sendCommands",t)},toggleCamParamRaw(t){this.$emit("toggleCam",{number:t,raw:1,cv:0,ppmm:this.cams[t].ppmm,grid:0,marker:0})},toggleCamParam(t){this.$emit("toggleCam",{number:t,raw:0,cv:0,ppmm:this.cams[t].ppmm,grid:1,marker:1})},changeCamParam(t){this.$emit("changeCamParam",{number:t,raw:0,cv:0,ppmm:this.cams[t].ppmm,grid:1,marker:1})},applaySettings(){this.$emit("applaySettings")}}},Cx={class:"card"},Ax=c("div",{class:"card-header"},"Cameras Settings",-1),Px={class:"card-body"},Rx={class:"row"},Dx={class:"card"},Ix={class:"card-header"},Fx={class:"card-body"},Lx={class:"row"},Ux={class:"col"},Ox={class:"mb-3"},Nx=c("label",{class:"form-label"},"ID",-1),zx=["onClick"],kx=["onUpdate:modelValue"],Bx=c("div",{class:"form-text"},`ID of camera. Use command 'ls /dev/v4l/by-id/' to view USB cameras list. After changing pleas press "Applay settings"`,-1),Vx=c("div",{class:"form-text"},[we("Use command '"),c("b",null,"ls /dev/v4l/by-id/"),we("' to view USB cameras list")],-1),$x={class:"mb-3"},Hx=c("label",{class:"form-label"},"Capture frame size",-1),Gx={class:"row mb-2"},Wx={class:"col"},Xx={class:"row"},jx=c("div",{class:"col-auto pt-1"},"Width:",-1),Yx={class:"col"},qx=["onUpdate:modelValue"],Zx={class:"col"},Kx={class:"row"},Jx=c("div",{class:"col-auto pt-1"},"Height:",-1),Qx={class:"col"},eS=["onUpdate:modelValue"],tS={class:"mb-3"},nS=c("label",{class:"form-label"},"Undistorting method",-1),iS={class:"row mb-2"},sS={class:"col"},oS=["onUpdate:modelValue"],rS=c("option",{value:0},"Distortion factor",-1),aS=c("option",{value:1},"Calibration data",-1),lS=[rS,aS],cS={key:0,class:"mb-3"},dS=c("label",{class:"form-label"},"Distortion factor",-1),uS={class:"row mb-2"},hS={class:"col"},fS=["onUpdate:modelValue"],pS=c("div",{class:"form-text"},'Positive and negative value available. After changing pleas press "Applay settings"',-1),mS={key:1,class:"mb-3"},_S=c("label",{class:"form-label"},"Calibration data",-1),gS={key:0,class:"row"},vS=c("div",{class:"col-auto"},"matrix:",-1),bS={class:"col-auto"},yS=c("div",{class:"col-auto"},"distortion:",-1),xS={class:"col-auto"},SS={class:"col text-end"},MS=["onClick"],ES={key:1,class:"row"},wS={class:"col"},TS=we("[Hiden] "),CS=["onClick"],AS=c("div",{class:"form-text"},[we("Please print "),c("a",{href:"images/calibration.svg",target:"_blank"},"this"),we(" picture, put it under cams focus then press button 'Calibration'")],-1),PS=["onClick"],RS={key:2,class:"mb-3"},DS=c("label",{class:"form-label"},"Offset from nozzle of head #1",-1),IS={class:"pb-2"},FS=["disabled"],LS=we(" Then move camera to Nozzle position and press "),US=["disabled","onClick"],OS={class:"row mb-2"},NS={class:"col"},zS={class:"row"},kS=c("div",{class:"col-auto pt-1"},"X:",-1),BS={class:"col"},VS=["onUpdate:modelValue"],$S={class:"col"},HS={class:"row"},GS=c("div",{class:"col-auto pt-1"},"Y:",-1),WS={class:"col"},XS=["onUpdate:modelValue"],jS=c("div",{class:"col-auto"},null,-1),YS=c("div",{class:"form-text"},"Top camera offset from nozzle of first head",-1),qS={key:3,class:"mb-3"},ZS=c("label",{class:"form-label"},"Position",-1),KS={class:"row mb-2"},JS={class:"col"},QS={class:"row"},e1=c("div",{class:"col-auto pt-1"},"X:",-1),t1={class:"col"},n1=["onUpdate:modelValue"],i1={class:"col"},s1={class:"row"},o1=c("div",{class:"col-auto pt-1"},"Y:",-1),r1={class:"col"},a1=["onUpdate:modelValue"],l1={class:"col"},c1={class:"row"},d1=c("div",{class:"col-auto pt-1"},"Z:",-1),u1={class:"col"},h1=["onUpdate:modelValue"],f1={class:"col-auto"},p1=["disabled","onClick"],m1=c("div",{class:"form-text"},"Nozzle position over Bottom camera",-1),_1=["disabled"],g1={class:"card mt-1"},v1=c("div",{class:"card-header"},"Image Transform",-1),b1={class:"card-body"},y1={class:"mb-3"},x1=c("label",{class:"form-label"},"Rotation",-1),S1={class:"row mb-2"},M1={class:"col"},E1=["onUpdate:modelValue"],w1=c("option",{value:0},"No",-1),T1=c("option",{value:90},"90",-1),C1=c("option",{value:180},"180",-1),A1=c("option",{value:-90},"-90",-1),P1=[w1,T1,C1,A1],R1={class:"mb-3"},D1=c("label",{class:"form-label"},"Scale",-1),I1={class:"row mb-2"},F1={class:"col"},L1={class:"row"},U1=c("div",{class:"col-auto pt-1"},"Width:",-1),O1={class:"col"},N1=["onUpdate:modelValue"],z1={class:"col"},k1={class:"row"},B1=c("div",{class:"col-auto pt-1"},"Height:",-1),V1={class:"col"},$1=["onUpdate:modelValue"],H1={class:"card mt-1"},G1=c("div",{class:"card-header"},"Resolution",-1),W1={class:"card-body"},X1={class:"mb-3"},j1=c("label",{class:"form-label"},"Resolution (pixels per millimeter)",-1),Y1=["onClick"],q1=["onUpdate:modelValue","onChange"],Z1=c("div",{class:"form-text"},[we("Please print "),c("a",{href:"images/calibration.svg",target:"_blank"},"this"),we(" picture, put it under center of cams focus then change the resolution until the marker matches the image of square.")],-1),K1={class:"card mt-1"},J1=c("div",{class:"card-header"},"Light",-1),Q1={class:"card-body"},eM={class:"mb-3"},tM=c("label",{class:"form-label"},"Light on command",-1),nM=["onUpdate:modelValue"],iM={class:"mb-3"},sM=c("label",{class:"form-label"},"Light off command",-1),oM=["onUpdate:modelValue"],rM={class:"row mt-2"},aM={class:"col"},lM=["disabled"];function cM(t,e,n,i,s,o){return W(),ee("div",Cx,[Ax,c("div",Px,[c("div",Rx,[(W(!0),ee(at,null,wt(n.cams,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",Dx,[c("div",Ix,"Camera "+ze(r.name),1),c("div",Fx,[c("div",Lx,[c("div",Ux,[c("div",Ox,[Nx,c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-1"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCamParamRaw(a)},"Raw view",10,zx),se(c("input",{"onUpdate:modelValue":l=>r.id=l,type:"text",class:"form-control form-control-sm"},null,8,kx),[[me,r.id]]),Bx,Vx]),c("div",$x,[Hx,c("div",Gx,[c("div",Wx,[c("div",Xx,[jx,c("div",Yx,[se(c("input",{"onUpdate:modelValue":l=>r.size.width=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,qx),[[me,r.size.width]])])])]),c("div",Zx,[c("div",Kx,[Jx,c("div",Qx,[se(c("input",{"onUpdate:modelValue":l=>r.size.height=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,eS),[[me,r.size.height]])])])])])]),c("div",tS,[nS,c("div",iS,[c("div",sS,[se(c("select",{"onUpdate:modelValue":l=>r.undistort.type=l,class:"form-control form-control-sm"},lS,8,oS),[[Jn,r.undistort.type]])])])]),r.undistort.type==0?(W(),ee("div",cS,[dS,c("div",uS,[c("div",hS,[se(c("input",{"onUpdate:modelValue":l=>r.undistort.distortion_f=l,type:"number",step:"0.001",class:"form-control form-control-sm"},null,8,fS),[[me,r.undistort.distortion_f]])])]),pS])):ot("",!0),r.undistort.type==1?(W(),ee("div",mS,[_S,t.calibrationShow[a]==!0?(W(),ee("div",gS,[vS,c("div",bS,ze(r.calibration.matrix),1),yS,c("div",xS,ze(r.calibration.distortion),1),c("div",SS,[c("button",{class:"btn btn-sm btn-link p-0 ps-1 pe-1",onClick:l=>t.calibrationShow[a]=!1},"Hide",8,MS)])])):(W(),ee("div",ES,[c("div",wS,[TS,c("button",{class:"btn btn-sm btn-link p-0 ps-1 pe-1",onClick:l=>t.calibrationShow[a]=!0},"Show",8,CS)])])),AS,c("button",{class:"btn btn-sm btn-outline-secondary",onClick:l=>o.calibrate(a)},"Calibrate",8,PS)])):ot("",!0),a==0?(W(),ee("div",RS,[DS,c("div",IS,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:e[0]||(e[0]=l=>o.rememberPos())},"Remember Current Position ("+ze(t.currentPos)+")",9,FS),LS,c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:l=>o.calculateOffset(a)},"Calculate Offset",8,US)]),c("div",OS,[c("div",NS,[c("div",zS,[kS,c("div",BS,[se(c("input",{"onUpdate:modelValue":l=>r.offset.x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,VS),[[me,r.offset.x]])])])]),c("div",$S,[c("div",HS,[GS,c("div",WS,[se(c("input",{"onUpdate:modelValue":l=>r.offset.y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,XS),[[me,r.offset.y]])])])]),jS]),YS])):ot("",!0),a==1?(W(),ee("div",qS,[ZS,c("div",KS,[c("div",JS,[c("div",QS,[e1,c("div",t1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,n1),[[me,r.pos.x]])])])]),c("div",i1,[c("div",s1,[o1,c("div",r1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,a1),[[me,r.pos.y]])])])]),c("div",l1,[c("div",c1,[d1,c("div",u1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.z=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,h1),[[me,r.pos.z]])])])]),c("div",f1,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary",onClick:l=>o.setPosition(a)},"Set current controller position",8,p1)])]),m1,c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:e[1]||(e[1]=l=>o.jogBottomCamPos())},"Jog to Bottom Camera",8,_1)])):ot("",!0)])])])]),c("div",g1,[v1,c("div",b1,[c("div",y1,[x1,c("div",S1,[c("div",M1,[se(c("select",{"onUpdate:modelValue":l=>r.image_transform.rotation=l,class:"form-control form-control-sm"},P1,8,E1),[[Jn,r.image_transform.rotation]])])])]),c("div",R1,[D1,c("div",I1,[c("div",F1,[c("div",L1,[U1,c("div",O1,[se(c("input",{"onUpdate:modelValue":l=>r.image_transform.scale_x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,N1),[[me,r.image_transform.scale_x]])])])]),c("div",z1,[c("div",k1,[B1,c("div",V1,[se(c("input",{"onUpdate:modelValue":l=>r.image_transform.scale_y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,$1),[[me,r.image_transform.scale_y]])])])])])])])]),c("div",H1,[G1,c("div",W1,[c("div",X1,[j1,c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-0"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCamParam(a)},"View",10,Y1),se(c("input",{"onUpdate:modelValue":l=>r.ppmm=l,onChange:l=>o.changeCamParam(a),type:"number",step:"0.1",class:"form-control form-control-sm"},null,40,q1),[[me,r.ppmm]]),Z1])])]),c("div",K1,[J1,c("div",Q1,[c("div",eM,[tM,se(c("input",{"onUpdate:modelValue":l=>r.lightOn=l,type:"text",class:"form-control form-control-sm"},null,8,nM),[[me,r.lightOn]])]),c("div",iM,[sM,se(c("input",{"onUpdate:modelValue":l=>r.lightOff=l,type:"text",class:"form-control form-control-sm"},null,8,oM),[[me,r.lightOff]])])])])]))),128))]),c("div",rM,[c("div",aM,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[2]||(e[2]=r=>o.applaySettings())},"Applay settings",8,lM)])])])])}var dM=ct(Tx,[["render",cM]]);const uM={props:{cvSettings:Object,showWindow:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},toggleCV(t){this.$emit("toggleCV",t)}}},hM={class:"card"},fM=c("div",{class:"card-header"},"Computer Vision Settings",-1),pM={class:"card-body"},mM={class:"row"},_M={class:"card"},gM={class:"card-header"},vM={class:"card-body"},bM={class:"row"},yM={class:"col"},xM={class:"mb-3"},SM=c("label",{class:"form-label"},"Contrast",-1),MM=["onUpdate:modelValue"],EM=c("div",{class:"form-text"},"The default value is 1, meaning no scaling is applied. This parameter controls the contrast of the image.",-1),wM={class:"mb-3"},TM=c("label",{class:"form-label"},"Brightness",-1),CM=["onUpdate:modelValue"],AM=c("div",{class:"form-text"},"The default value is 0, meaning no shift is applied. This parameter controls the brightness of the image.",-1),PM={class:"mb-3"},RM=c("label",{class:"form-label"},"Blur",-1),DM={class:"row"},IM={class:"col-auto"},FM=["onUpdate:modelValue"],LM=c("div",{class:"col-auto mt-1"},"x",-1),UM={class:"col-auto"},OM=["onUpdate:modelValue"],NM=c("div",{class:"form-text"},"This parameter defines the size of the blurring kernel. It's a tuple representing the width and height of the kernel (e.g., (5, 5) for a 5x5 kernel). The kernel size determines the area over which the blurring is applied.",-1),zM={class:"mb-3"},kM=c("label",{class:"form-label"},"Adaptive Threshold block size",-1),BM=["onUpdate:modelValue"],VM=c("div",{class:"form-text"},"The size of the pixel neighborhood used to calculate the threshold, it must be an odd number.",-1),$M={class:"mb-3"},HM=c("label",{class:"form-label"},"Adaptive Threshold C",-1),GM=["onUpdate:modelValue"],WM=c("div",{class:"form-text"},"A constant value subtracted from the calculated mean or weighted sum to fine-tune the threshold. It can be positive, negative, or zero.",-1),XM=["onClick"],jM={class:"card mt-2"},YM=c("div",{class:"card-header"},"Objects parameters (default)",-1),qM={class:"card-body"},ZM={class:"mb-3"},KM={class:"form-label capitalize"},JM=["onUpdate:modelValue"],QM={class:"card mt-2"},eE=c("div",{class:"card-header"},"Misc Settings",-1),tE={class:"card-body"},nE={class:"mb-3"},iE=c("label",{class:"form-label capitalize"},"Delay before image processing:",-1),sE=["onUpdate:modelValue"],oE={class:"row mt-2"},rE={class:"col"},aE=["disabled"];function lE(t,e,n,i,s,o){return W(),ee("div",hM,[fM,c("div",pM,[c("div",mM,[(W(!0),ee(at,null,wt(n.cvSettings,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",_M,[c("div",gM,"Camera "+ze(r.name)+" image transform",1),c("div",vM,[c("div",bM,[c("div",yM,[c("div",xM,[SM,se(c("input",{"onUpdate:modelValue":l=>r.contrast=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,MM),[[me,r.contrast]]),EM]),c("div",wM,[TM,se(c("input",{"onUpdate:modelValue":l=>r.brightness=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,CM),[[me,r.brightness]]),AM]),c("div",PM,[RM,c("div",DM,[c("div",IM,[se(c("input",{"onUpdate:modelValue":l=>r.blur[0]=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,FM),[[me,r.blur[0]]])]),LM,c("div",UM,[se(c("input",{"onUpdate:modelValue":l=>r.blur[1]=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,OM),[[me,r.blur[1]]])])]),NM]),c("div",zM,[kM,se(c("input",{"onUpdate:modelValue":l=>r.adaptiveThreshold_blockSize=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,BM),[[me,r.adaptiveThreshold_blockSize]]),VM]),c("div",$M,[HM,se(c("input",{"onUpdate:modelValue":l=>r.adaptiveThreshold_C=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,GM),[[me,r.adaptiveThreshold_C]]),WM]),c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-0"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCV(a)},"CV View",10,XM)])])])]),c("div",jM,[YM,c("div",qM,[(W(!0),ee(at,null,wt(r.objects,(l,d)=>(W(),ee("div",ZM,[c("label",KM,ze(d),1),c("div",null,[(W(!0),ee(at,null,wt(l,(u,f)=>(W(),ee("span",null,[we(ze(f)+": ",1),se(c("input",{"onUpdate:modelValue":h=>r.objects[d][f]=h,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,JM),[[me,r.objects[d][f]]])]))),256))])]))),256))])]),c("div",QM,[eE,c("div",tE,[c("div",nE,[iE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBefore=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,sE),[[me,r.pauseBefore]])])])])]))),128))]),c("div",oE,[c("div",rE,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[0]||(e[0]=r=>o.applaySettings())},"Applay settings",8,aE)])])])])}var cE=ct(uM,[["render",lE]]);const dE={props:{heads:Object,nozzles:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")}}},uE={class:"card"},hE=c("div",{class:"card-header"},"Heads Settings",-1),fE={class:"card-body"},pE={class:"row"},mE={class:"card"},_E={class:"card-header"},gE={class:"card-body"},vE={class:"mb-3"},bE=c("label",{class:"form-label"},"Safety Z position",-1),yE=["onUpdate:modelValue"],xE=c("div",{class:"form-text"},"Position Z to safety moving head over the table",-1),SE={class:"mb-3"},ME=c("label",{class:"form-label"},"Valve On command",-1),EE=["onUpdate:modelValue"],wE={class:"mb-3"},TE={class:"row"},CE={class:"col"},AE=we(" Pause Before On: "),PE=["onUpdate:modelValue"],RE={class:"col"},DE=we(" Pause After On: "),IE=["onUpdate:modelValue"],FE={class:"mb-3"},LE=c("label",{class:"form-label"},"Valve Off command",-1),UE=["onUpdate:modelValue"],OE={class:"mb-3"},NE={class:"row"},zE={class:"col"},kE=we(" Pause Before Off: "),BE=["onUpdate:modelValue"],VE={class:"col"},$E=we(" Pause After Off: "),HE=["onUpdate:modelValue"],GE={class:"mb-3"},WE=c("label",{class:"form-label"},"Output name in GC",-1),XE=["onUpdate:modelValue"],jE={class:"mb-3"},YE=c("label",{class:"form-label"},"Nozzle default",-1),qE=["onUpdate:modelValue"],ZE=c("option",{value:-1},"Empty",-1),KE=["value"],JE={class:"row mt-2"},QE={class:"col"},ew=["disabled"];function tw(t,e,n,i,s,o){return W(),ee("div",uE,[hE,c("div",fE,[c("div",pE,[(W(!0),ee(at,null,wt(n.heads,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",mE,[c("div",_E,"Head "+ze(r.name),1),c("div",gE,[c("div",vE,[bE,se(c("input",{"onUpdate:modelValue":l=>r.safePosZ=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,yE),[[me,r.safePosZ]]),xE]),c("div",SE,[ME,se(c("input",{"onUpdate:modelValue":l=>r.valveOn=l,type:"text",class:"form-control form-control-sm"},null,8,EE),[[me,r.valveOn]])]),c("div",wE,[c("div",TE,[c("div",CE,[AE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBeforeOn=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,PE),[[me,r.pauseBeforeOn]])]),c("div",RE,[DE,se(c("input",{"onUpdate:modelValue":l=>r.pauseAfterOn=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,IE),[[me,r.pauseAfterOn]])])])]),c("div",FE,[LE,se(c("input",{"onUpdate:modelValue":l=>r.valveOff=l,type:"text",class:"form-control form-control-sm"},null,8,UE),[[me,r.valveOff]])]),c("div",OE,[c("div",NE,[c("div",zE,[kE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBeforeOff=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,BE),[[me,r.pauseBeforeOff]])]),c("div",VE,[$E,se(c("input",{"onUpdate:modelValue":l=>r.pauseAfterOff=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,HE),[[me,r.pauseAfterOff]])])])]),c("div",GE,[WE,se(c("input",{"onUpdate:modelValue":l=>r.inGC=l,type:"text",class:"form-control form-control-sm"},null,8,XE),[[me,r.inGC]])]),c("div",jE,[YE,se(c("select",{"onUpdate:modelValue":l=>r.nozzle=l,class:"form-control form-control-sm"},[ZE,(W(!0),ee(at,null,wt(n.nozzles,l=>(W(),ee("option",{value:l.id},ze(l.name),9,KE))),256))],8,qE),[[Jn,r.nozzle]])])])])]))),128))]),c("div",JE,[c("div",QE,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[0]||(e[0]=r=>o.applaySettings())},"Applay settings",8,ew)])])])])}var nw=ct(dE,[["render",tw]]);const iw={mixins:[Hn],props:{pump:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")}}},sw={class:"card"},ow=c("div",{class:"card-header"},"Pump Settings",-1),rw={class:"card-body"},aw={class:"mb-3"},lw=c("label",{class:"form-label"},"Pump On command",-1),cw={class:"mb-3"},dw=c("label",{class:"form-label"},"Pump Off command",-1),uw={class:"mb-3"},hw=c("label",{class:"form-label"},"Output name in GC",-1),fw={class:"row mt-2"},pw={class:"col"},mw=["disabled"];function _w(t,e,n,i,s,o){return W(),ee("div",sw,[ow,c("div",rw,[c("div",aw,[lw,se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.pump.On=r),type:"text",class:"form-control form-control-sm"},null,512),[[me,n.pump.On]])]),c("div",cw,[dw,se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.pump.Off=r),type:"text",class:"form-control form-control-sm"},null,512),[[me,n.pump.Off]])]),c("div",uw,[hw,se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.pump.inGC=r),type:"text",class:"form-control form-control-sm"},null,512),[[me,n.pump.inGC]])]),c("div",fw,[c("div",pw,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[3]||(e[3]=r=>o.applaySettings())},"Applay settings",8,mw)])])])])}var gw=ct(iw,[["render",_w]]),Oa={methods:{array_move:function(t,e,n){if(n>=t.length)for(var i=n-t.length+1;i--;)t.push(void 0);t.splice(n,0,t.splice(e,1)[0])},rowUp(t,e){let n=t.indexOf(e);n>0&&this.array_move(t,n,n-1)},rowDown(t,e){let n=t.indexOf(e);n{if(n==!0){let i=t.indexOf(e);t.splice(i,1)}})}}},Ss={props:["rows","currentRow"],mounted:function(){window.addEventListener("keydown",this.onkey)},destroyed:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey:function(t){if(this.$refs.table&&this.$refs.table.contains(document.activeElement)&&(t.keyCode==38||t.keyCode==40)){if(document.activeElement.localName=="select")return;if(this.currentRow){let e=this.rows.indexOf(this.currentRow);t.keyCode==38&&e>0&&(e=e-1),t.keyCode==40&&e-1&&this.$refs[this.currentField]&&typeof this.$refs[this.currentField][t]!="undefined"&&this.$refs[this.currentField][t].focus()}},intValidate:function(t,e){typeof t[e]=="string"&&(t[e]=t[e].replace(/[^0-9\-]/g,""))},floatValidate:function(t,e){typeof t[e]=="string"&&(t[e]=t[e].replace(",","."),t[e]=t[e].replace("..","."),t[e]=t[e].replace(/[^0-9\.\-]/g,""))},array_move:function(t,e,n){if(n>=t.length)for(var i=n-t.length+1;i--;)t.push(void 0);t.splice(n,0,t.splice(e,1)[0])},rowUp(t,e){let n=t.indexOf(e);n>0&&this.array_move(t,n,n-1)},rowDown(t,e){let n=t.indexOf(e);n{if(n==!0){let i=t.indexOf(e);t.splice(i,1)}})}},watch:{currentRow(){this.setFocus()}}};const vw={props:{machinePos:Object},mixins:[Ss],data:function(){return{currentField:"dx"}}},bw={class:"scroll"},yw={class:"table",ref:"table"},xw=c("thead",null,[c("tr",null,[c("th"),c("th",null,"a"),c("th",null,"dx"),c("th",null,"dy")])],-1),Sw=["onMousedown"],Mw={key:0},Ew={key:1},ww=["onUpdate:modelValue"],Tw=["onUpdate:modelValue"],Cw={nowrap:""},Aw=["onClick","hidden"];function Pw(t,e,n,i,s,o){return W(),ee("div",bw,[c("table",yw,[xw,c("tbody",null,[(W(!0),ee(at,null,wt(t.rows,(r,a)=>(W(),ee("tr",{onMousedown:l=>t.setCurrentRow(r),class:je(r==t.currentRow?"active-row":"")},[c("td",null,[r==t.currentRow?(W(),ee("span",Mw,"\u2BC8")):(W(),ee("span",Ew,"\xA0\xA0"))]),c("td",null,[c("span",{class:je(r.a==n.machinePos.a?"text-success fw-bold":"")},ze(r.a),3)]),c("td",null,[se(c("input",{"onUpdate:modelValue":l=>r.dx=l,ref_for:!0,ref:"dx",onFocus:e[0]||(e[0]=l=>t.currentField="dx"),class:"form-control form-control-sm"},null,40,ww),[[me,r.dx]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":l=>r.dy=l,ref_for:!0,ref:"dy",onFocus:e[1]||(e[1]=l=>t.currentField="dy"),class:"form-control form-control-sm"},null,40,Tw),[[me,r.dy]])]),c("th",Cw,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:l=>t.$emit("setPos",r),title:"Set nozzle deviation",hidden:r.a==0},"\u{1F78A}",8,Aw)])],42,Sw))),256))])],512)])}var Rw=ct(vw,[["render",Pw]]);const Dw={data:function(){return{showMenu:this.showMenu}}},Iw={class:"dropdown show"};function Fw(t,e,n,i,s,o){return W(),ee("div",Iw,[c("a",{onClick:e[0]||(e[0]=r=>t.showMenu=!t.showMenu)},[to(t.$slots,"menubutton")]),c("div",{class:je("dropdown-menu"+(t.showMenu==!0?" show":"")),onClick:e[1]||(e[1]=r=>t.showMenu=!1)},[to(t.$slots,"menuitems")],2)])}var pp=ct(Dw,[["render",Fw]]);const Lw={props:{disabled:Boolean}},Uw=["disabled"];function Ow(t,e,n,i,s,o){return W(),ee("button",{class:"dropdown-item",disabled:n.disabled,type:"button"},[to(t.$slots,"default")],8,Uw)}var mp=ct(Lw,[["render",Ow]]);const Nw={components:{PopupMenu:pp,PopupMenuItem:mp},props:{row:Object,clipboard:Object}},zw=we("Copy"),kw=we("Paste");function Bw(t,e,n,i,s,o){const r=et("PopupMenuItem"),a=et("PopupMenu");return W(),Jt(a,null,{menubutton:Ct(()=>[to(t.$slots,"default")]),menuitems:Ct(()=>[ke(r,{onClick:e[0]||(e[0]=l=>t.$emit("copy",n.row))},{default:Ct(()=>[zw]),_:1}),ke(r,{disabled:!n.clipboard,onClick:e[1]||(e[1]=l=>t.$emit("paste",n.row))},{default:Ct(()=>[kw]),_:1},8,["disabled"])]),_:3})}var bo=ct(Nw,[["render",Bw]]),Ms={methods:{deepMerge(t,e){const n=Object.assign(t);for(const i in e)e.hasOwnProperty(i)&&(t[i]&&typeof t[i]=="object"&&typeof e[i]=="object"?n[i]=this.deepMerge(t[i],e[i]):n[i]=e[i]);return n}}};const Vw={mixins:[Ss,Ms],props:{settings:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{NozzlesCalibrateTable:Rw,CopyPasteMenu:bo},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},data:function(){return{currentField:"name",currentCalibrateRow:this.currentCalibrateRow,clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},Na=t=>(Aa("data-v-644ea80b"),t=t(),Pa(),t),$w={class:"row"},Hw={class:"col"},Gw={class:"scroll"},Ww={class:"table mb-5",ref:"table"},Xw=Na(()=>c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Caption"),c("th")])],-1)),jw=["onMousedown"],Yw={key:0},qw=we("\u2BC8"),Zw={key:1},Kw=["onUpdate:modelValue"],Jw=["onUpdate:modelValue"],Qw={nowrap:""},eT=["onClick"],tT=["onClick"],nT=["onClick"],iT={class:"text-end"},sT={key:0,class:"col"},oT={class:"card"},rT={class:"card-header"},aT={class:"card-body"},lT={class:"mb-3"},cT=Na(()=>c("label",{class:"form-label"},"Name",-1)),dT={class:"row mb-2"},uT={class:"col"},hT={class:"mb-3"},fT=Na(()=>c("label",{class:"form-label"},"Caption",-1)),pT={class:"row mb-2"},mT={class:"col"},_T={class:"card mt-1"},gT=Na(()=>c("div",{class:"card-header"},"Nozzle calibration table",-1)),vT={class:"card-body"},bT=["disabled"];function yT(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("NozzlesCalibrateTable");return W(),ee("div",$w,[c("div",Hw,[c("div",Gw,[c("table",Ww,[Xw,c("tbody",null,[(W(!0),ee(at,null,wt(t.rows,(l,d)=>(W(),ee("tr",{onMousedown:u=>t.setCurrentRow(l),class:je(l==t.currentRow?"active-row":"")},[c("td",null,[l==t.currentRow?(W(),ee("span",Yw,[ke(r,{row:l,clipboard:t.clipboard,onCopy:e[0]||(e[0]=u=>o.doAction("copy",u)),onPaste:e[1]||(e[1]=u=>o.doAction("paste",u))},{default:Ct(()=>[qw]),_:2},1032,["row","clipboard"])])):(W(),ee("span",Zw,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":u=>l.name=u,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=u=>t.currentField="name"),class:"form-control form-control-sm"},null,40,Kw),[[me,l.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":u=>l.caption=u,ref_for:!0,ref:"caption",onFocus:e[3]||(e[3]=u=>t.currentField="caption"),class:"form-control form-control-sm"},null,40,Jw),[[me,l.caption]])]),c("th",Qw,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>t.$emit("up",l)},"\u2BC5",8,eT),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>t.$emit("down",l)},"\u2BC6",8,tT),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:u=>t.$emit("delete",l)},"\u2BBF",8,nT)])],42,jw))),256))])],512),c("div",iT,[c("button",{onClick:e[4]||(e[4]=l=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add nozzle")])])]),o.isCurrent?(W(),ee("div",sT,[c("div",oT,[c("div",rT,"Nozzle "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",aT,[c("div",lT,[cT,c("div",dT,[c("div",uT,[se(c("input",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.currentRow.name=l),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.name]])])])]),c("div",hT,[fT,c("div",pT,[c("div",mT,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>t.currentRow.caption=l),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.caption]])])])])])]),c("div",_T,[gT,c("div",vT,[ke(a,{rows:t.currentRow.calibrationData,currentRow:t.currentCalibrateRow,machinePos:n.machinePos,onSet:e[7]||(e[7]=l=>t.currentCalibrateRow=l),onSetPos:e[8]||(e[8]=l=>t.$emit("setPos",l))},null,8,["rows","currentRow","machinePos"]),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[9]||(e[9]=l=>t.$emit("autocalibrate",t.currentRow))},"Autocalibrate",8,bT)])])])):ot("",!0)])}var xT=ct(Vw,[["render",yT],["__scopeId","data-v-644ea80b"]]);const ST={mixins:[Oa,Hn],props:{nozzles:Object,machineState:Object,machinePos:Object,settings:Object,disabled:Boolean,loading:Boolean},components:{NozzlesTable:xT},data:function(){return{currentNozzle:this.currentNozzle}},mounted(){this.nozzles.length>0&&(this.currentNozzle=this.nozzles[0])},methods:{applaySettings(){this.$emit("applaySettings")},addNozzle(){let t=1;for(let e of this.nozzles)e.id>=t&&(t=e.id+1);this.nozzles.push({id:t,name:"Nozzle "+t.toString(),caption:"",calibrationData:[{a:0,dx:0,dy:0},{a:.125,dx:0,dy:0},{a:.25,dx:0,dy:0},{a:.375,dx:0,dy:0},{a:.5,dx:0,dy:0},{a:.625,dx:0,dy:0},{a:.75,dx:0,dy:0},{a:.875,dx:0,dy:0}]}),this.currentNozzle=this.nozzles[this.nozzles.length-1]},setXYOffset(t){if(this.machineStateIsOK()==!0){let e=this.settings.cams[1].pos.x,n=this.settings.cams[1].pos.y;t.dx=Math.round((this.machinePos.x-e)*1e3)/1e3,t.dy=Math.round((this.machinePos.y-n)*1e3)/1e3}},autocalibrate(t){Un("Do You want to start Autocalibration of Nozzle?","Confirm").then(e=>{e==!0&&this.$emit("autocalibrate",t)})}}},MT={class:"card"},ET=c("div",{class:"card-header"},"Nozzles Settings",-1),wT={class:"card-body"},TT={class:"row mt-2"},CT={class:"col"},AT=["disabled"];function PT(t,e,n,i,s,o){const r=et("NozzlesTable");return W(),ee("div",MT,[ET,c("div",wT,[ke(r,{rows:n.nozzles,currentRow:t.currentNozzle,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onAdd:e[0]||(e[0]=a=>o.addNozzle()),onSet:e[1]||(e[1]=a=>t.currentNozzle=a),onUp:e[2]||(e[2]=a=>t.rowUp(n.nozzles,a)),onDown:e[3]||(e[3]=a=>t.rowDown(n.nozzles,a)),onDelete:e[4]||(e[4]=a=>t.rowDelete(n.nozzles,a)),onSetPos:e[5]||(e[5]=a=>o.setXYOffset(a)),onAutocalibrate:e[6]||(e[6]=a=>o.autocalibrate(a))},null,8,["rows","currentRow","machineState","machinePos","disabled"]),c("div",TT,[c("div",CT,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[7]||(e[7]=a=>o.applaySettings())},"Applay settings",8,AT)])])])])}var RT=ct(ST,[["render",PT]]);const DT={mixins:[Ss,Ms],components:{CopyPasteMenu:bo},data:function(){return{currentField:"x",clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(e=this.deepMerge(e,this.clipboard))}}},IT={class:"scroll"},FT={class:"table mb-5",ref:"table"},LT=c("thead",null,[c("tr",null,[c("th"),c("th",null,"x"),c("th",null,"y"),c("th",null,"z")])],-1),UT=["onMousedown"],OT={key:0},NT=we("\u2BC8"),zT={key:1},kT=["onUpdate:modelValue"],BT=["onUpdate:modelValue"],VT=["onUpdate:modelValue"],$T={nowrap:""},HT=["onClick"],GT=["onClick"],WT={class:"text-end"};function XT(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",IT,[c("table",FT,[LT,c("tbody",null,[(W(!0),ee(at,null,wt(t.rows,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",OT,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[NT]),_:2},1032,["row","clipboard"])])):(W(),ee("span",zT,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.x=d,ref_for:!0,ref:"x",onFocus:e[2]||(e[2]=d=>t.currentField="x"),class:"form-control form-control-sm"},null,40,kT),[[me,a.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.y=d,ref_for:!0,ref:"y",onFocus:e[3]||(e[3]=d=>t.currentField="y"),class:"form-control form-control-sm"},null,40,BT),[[me,a.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.z=d,ref_for:!0,ref:"z",onFocus:e[4]||(e[4]=d=>t.currentField="z"),class:"form-control form-control-sm"},null,40,VT),[[me,a.z]])]),c("th",$T,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:d=>t.$emit("setPos",a),title:"Set current position of nozzle"},"\u{1F78A}",8,HT),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,GT)])],42,UT))),256))])],512),c("div",WT,[c("button",{onClick:e[5]||(e[5]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add point")])])}var jT=ct(DT,[["render",XT]]);const YT={mixins:[Ss,Hn,Ms],props:{settings:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{NozzlesHolderPlacePointsTable:jT,CopyPasteMenu:bo},data:function(){return{currentField:"name",currentPointRow:this.currentPointRow,clipboard:this.clipboard}},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{addPoint(){this.currentRow.points.push({x:0,y:0,z:0}),this.currentPointRow=this.currentRow.points[this.currentRow.points.length-1]},setPointPos(t){this.machineStateIsOK()==!0&&(t.x=parseFloat(this.machinePos.x),t.y=parseFloat(this.machinePos.y),t.z=parseFloat(this.machinePos.z))},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},Gi=t=>(Aa("data-v-104bd4cb"),t=t(),Pa(),t),qT={class:"row"},ZT={class:"col"},KT={class:"scroll"},JT={class:"table mb-5",ref:"table"},QT=Gi(()=>c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Nozzle"),c("th")])],-1)),eC=["onMousedown"],tC={key:0},nC=we("\u2BC8"),iC={key:1},sC=["onUpdate:modelValue"],oC=["onUpdate:modelValue"],rC=Gi(()=>c("option",{value:-1},"Empty",-1)),aC=["value"],lC={nowrap:""},cC=["onClick"],dC=["onClick"],uC=["onClick"],hC={class:"text-end"},fC={key:0,class:"col"},pC={class:"card"},mC={class:"card-header"},_C={class:"card-body"},gC={class:"mb-3"},vC=Gi(()=>c("label",{class:"form-label"},"Name",-1)),bC={class:"row mb-2"},yC={class:"col"},xC={class:"mb-3"},SC=Gi(()=>c("label",{class:"form-label"},"Nozzle",-1)),MC={class:"row mb-2"},EC={class:"col"},wC=Gi(()=>c("option",{value:-1},"Empty",-1)),TC=["value"],CC={class:"mb-3"},AC=Gi(()=>c("label",{class:"form-label"},"Feed",-1)),PC={class:"row mb-2"},RC={class:"col"},DC={class:"card mt-1"},IC=Gi(()=>c("div",{class:"card-header"},"Path to take nozzle",-1)),FC={class:"card-body"},LC={class:"card mt-1"},UC=Gi(()=>c("div",{class:"card-header"},"Actions",-1)),OC={class:"card-body"},NC=["disabled"];function zC(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("NozzlesHolderPlacePointsTable");return W(),ee("div",qT,[c("div",ZT,[c("div",KT,[c("table",JT,[QT,c("tbody",null,[(W(!0),ee(at,null,wt(t.rows,l=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(l),class:je(l==t.currentRow?"active-row":"")},[c("td",null,[l==t.currentRow?(W(),ee("span",tC,[ke(r,{row:l,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[nC]),_:2},1032,["row","clipboard"])])):(W(),ee("span",iC,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>l.name=d,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=d=>t.currentField="name"),class:"form-control form-control-sm"},null,40,sC),[[me,l.name]])]),c("td",null,[se(c("select",{"onUpdate:modelValue":d=>l.nozzleId=d,class:"form-control form-control-sm"},[rC,(W(!0),ee(at,null,wt(n.settings.nozzles,d=>(W(),ee("option",{value:d.id},ze(d.name),9,aC))),256))],8,oC),[[Jn,l.nozzleId]])]),c("th",lC,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("up",l)},"\u2BC5",8,cC),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("down",l)},"\u2BC6",8,dC),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",l)},"\u2BBF",8,uC)])],42,eC))),256))])],512),c("div",hC,[c("button",{onClick:e[3]||(e[3]=l=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add place")])])]),o.isCurrent?(W(),ee("div",fC,[c("div",pC,[c("div",mC,"Nozzle "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",_C,[c("div",gC,[vC,c("div",bC,[c("div",yC,[se(c("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>t.currentRow.name=l),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.name]])])])]),c("div",xC,[SC,c("div",MC,[c("div",EC,[se(c("select",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.currentRow.nozzleId=l),class:"form-control form-control-sm"},[wC,(W(!0),ee(at,null,wt(n.settings.nozzles,l=>(W(),ee("option",{value:l.id},ze(l.name),9,TC))),256))],512),[[Jn,t.currentRow.nozzleId]])])])]),c("div",CC,[AC,c("div",PC,[c("div",RC,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>t.currentRow.feed=l),type:"number",step:"1",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.feed]])])])])])]),c("div",DC,[IC,c("div",FC,[ke(a,{rows:t.currentRow.points,currentRow:t.currentPointRow,machinePos:n.machinePos,onSet:e[7]||(e[7]=l=>t.currentPointRow=l),onSetPos:e[8]||(e[8]=l=>o.setPointPos(l)),onAdd:e[9]||(e[9]=l=>o.addPoint()),onDelete:e[10]||(e[10]=l=>t.rowDelete(t.currentRow.points,l))},null,8,["rows","currentRow","machinePos"])])]),c("div",LC,[UC,c("div",OC,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[11]||(e[11]=l=>t.$emit("putOnNozzle",t.currentRow))},"Put on Nozzle",8,NC)])])])):ot("",!0)])}var kC=ct(YT,[["render",zC],["__scopeId","data-v-104bd4cb"]]);const BC={mixins:[Oa,Hn],props:{nozzlesHolder:Object,machineState:Object,machinePos:Object,settings:Object,disabled:Boolean,loading:Boolean},components:{NozzlesHolderPlaceTable:kC},data:function(){return{currentPlace:this.currentPlace}},mounted(){this.nozzlesHolder.places.length>0&&(this.currentPlace=this.nozzlesHolder.places[0])},methods:{applaySettings(){let t=!1;for(let e of this.nozzlesHolder.places)if(e.nozzleId==-1){t=!0;break}t?this.$emit("applaySettings"):st("There is no anyone empty place. There need one empty space.","Warning","warning")},addPlace(){let t=1;for(let e of this.nozzlesHolder.places)e.id>=t&&(t=e.id+1);this.nozzlesHolder.places.push({id:t,name:"Place "+t,nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100}),this.currentPlace=this.nozzlesHolder.places[this.nozzlesHolder.places.length-1]}}},VC={class:"card"},$C=c("div",{class:"card-header"},"Nozzles Holder Settings",-1),HC={class:"card-body"},GC={class:"row mt-2"},WC={class:"col"},XC=["disabled"];function jC(t,e,n,i,s,o){const r=et("NozzlesHolderPlaceTable");return W(),ee("div",VC,[$C,c("div",HC,[ke(r,{rows:n.nozzlesHolder.places,currentRow:t.currentPlace,machineState:n.machineState,machinePos:n.machinePos,settings:n.settings,disabled:n.disabled,onPutOnNozzle:e[0]||(e[0]=a=>t.$emit("putOnNozzle",a)),onAdd:e[1]||(e[1]=a=>o.addPlace()),onSet:e[2]||(e[2]=a=>t.currentPlace=a),onUp:e[3]||(e[3]=a=>t.rowUp(n.nozzlesHolder.places,a)),onDown:e[4]||(e[4]=a=>t.rowDown(n.nozzlesHolder.places,a)),onDelete:e[5]||(e[5]=a=>t.rowDelete(n.nozzlesHolder.places,a))},null,8,["rows","currentRow","machineState","machinePos","settings","disabled"]),c("div",GC,[c("div",WC,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[6]||(e[6]=a=>o.applaySettings())},"Applay settings",8,XC)])])])])}var YC=ct(BC,[["render",jC]]);const qC={mixins:[Hn],props:{basket:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.basket.pos.x=parseFloat(this.machinePos.x),this.basket.pos.y=parseFloat(this.machinePos.y),this.basket.pos.z=parseFloat(this.machinePos.z))}}},ZC={class:"card"},KC=c("div",{class:"card-header"},"Basket Settings",-1),JC={class:"card-body"},QC={class:"mb-3"},eA=c("label",{class:"form-label"},"Position",-1),tA={class:"row mb-2"},nA={class:"col"},iA={class:"row"},sA=c("div",{class:"col-auto pt-1"},"X:",-1),oA={class:"col"},rA={class:"col"},aA={class:"row"},lA=c("div",{class:"col-auto pt-1"},"Y:",-1),cA={class:"col"},dA={class:"col"},uA={class:"row"},hA=c("div",{class:"col-auto pt-1"},"Z:",-1),fA={class:"col"},pA={class:"col-auto"},mA={class:"row mt-2"},_A={class:"col"},gA=["disabled"];function vA(t,e,n,i,s,o){return W(),ee("div",ZC,[KC,c("div",JC,[c("div",QC,[eA,c("div",tA,[c("div",nA,[c("div",iA,[sA,c("div",oA,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.basket.pos.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.basket.pos.x]])])])]),c("div",rA,[c("div",aA,[lA,c("div",cA,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.basket.pos.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.basket.pos.y]])])])]),c("div",dA,[c("div",uA,[hA,c("div",fA,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.basket.pos.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.basket.pos.z]])])])]),c("div",pA,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",mA,[c("div",_A,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,gA)])])])])}var bA=ct(qC,[["render",vA]]);const yA={mixins:[Hn],props:{parking:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.parking.pos.x=parseFloat(this.machinePos.x),this.parking.pos.y=parseFloat(this.machinePos.y),this.parking.pos.z=parseFloat(this.machinePos.z))}}},xA={class:"card"},SA=c("div",{class:"card-header"},"Parking Settings",-1),MA={class:"card-body"},EA={class:"mb-3"},wA=c("label",{class:"form-label"},"Position",-1),TA={class:"row mb-2"},CA={class:"col"},AA={class:"row"},PA=c("div",{class:"col-auto pt-1"},"X:",-1),RA={class:"col"},DA={class:"col"},IA={class:"row"},FA=c("div",{class:"col-auto pt-1"},"Y:",-1),LA={class:"col"},UA={class:"col"},OA={class:"row"},NA=c("div",{class:"col-auto pt-1"},"Z:",-1),zA={class:"col"},kA={class:"col-auto"},BA={class:"row mt-2"},VA={class:"col"},$A=["disabled"];function HA(t,e,n,i,s,o){return W(),ee("div",xA,[SA,c("div",MA,[c("div",EA,[wA,c("div",TA,[c("div",CA,[c("div",AA,[PA,c("div",RA,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.parking.pos.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.parking.pos.x]])])])]),c("div",DA,[c("div",IA,[FA,c("div",LA,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.parking.pos.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.parking.pos.y]])])])]),c("div",UA,[c("div",OA,[NA,c("div",zA,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.parking.pos.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.parking.pos.z]])])])]),c("div",kA,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",BA,[c("div",VA,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,$A)])])])])}var GA=ct(yA,[["render",HA]]);const WA={mixins:[Ss,Ms],components:{CopyPasteMenu:bo},data:function(){return{currentField:"x",clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(e=this.deepMerge(e,this.clipboard))}}},XA={class:"scroll"},jA={class:"table mb-5",ref:"table"},YA=c("thead",null,[c("tr",null,[c("th"),c("th",null,"x"),c("th",null,"y"),c("th",null,"z"),c("th",null,"pick")])],-1),qA=["onMousedown"],ZA={key:0},KA=we("\u2BC8"),JA={key:1},QA=["onUpdate:modelValue"],eP=["onUpdate:modelValue"],tP=["onUpdate:modelValue"],nP=["onUpdate:modelValue"],iP={nowrap:""},sP=["onClick"],oP=["onClick"],rP={class:"text-end"};function aP(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",XA,[c("table",jA,[YA,c("tbody",null,[(W(!0),ee(at,null,wt(t.rows,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",ZA,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[KA]),_:2},1032,["row","clipboard"])])):(W(),ee("span",JA,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.x=d,ref_for:!0,ref:"x",onFocus:e[2]||(e[2]=d=>t.currentField="x"),class:"form-control form-control-sm"},null,40,QA),[[me,a.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.y=d,ref_for:!0,ref:"y",onFocus:e[3]||(e[3]=d=>t.currentField="y"),class:"form-control form-control-sm"},null,40,eP),[[me,a.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.z=d,ref_for:!0,ref:"z",onFocus:e[4]||(e[4]=d=>t.currentField="z"),class:"form-control form-control-sm"},null,40,tP),[[me,a.z]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pick=d,type:"checkbox",class:"form-check-input"},null,8,nP),[[Kn,a.pick]])]),c("th",iP,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:d=>t.$emit("setPos",a),title:"Set current position of nozzle"},"\u{1F78A}",8,sP),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,oP)])],42,qA))),256))])],512),c("div",rP,[c("button",{onClick:e[5]||(e[5]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add point")])])}var lP=ct(WA,[["render",aP]]);const cP={mixins:[Ss,Hn,Ms],props:{settings:Object,cases:Object,feederTypes:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{FeedersPathPointsTable:lP,CopyPasteMenu:bo,PopupMenu:pp,PopupMenuItem:mp},data:function(){return{currentField:"name",currentPoint:this.currentPoint,clipboard:this.clipboard}},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{addPathPoint(t){this.currentRow.pathPoints.push({x:0,y:0,z:0,pick:!1})},setFeederPos(t){this.machineStateIsOK()==!0&&(t.pos.x=this.machinePos.x,t.pos.y=this.machinePos.y,t.pos.z=this.machinePos.z)},setFeederPosCAM(t){this.machineStateIsOK()==!0&&(t.pos.x=(parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x)).toFixed(3),t.pos.y=(parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y)).toFixed(3))},setPointPos(t){this.machineStateIsOK()==!0&&(t.x=this.machinePos.x,t.y=this.machinePos.y,t.z=this.machinePos.z)},adjFiderPosByCamPos(t,e){if(this.machineStateIsOK()==!0&&(t.type==0&&((e=="x"||e=="xy")&&(t.pos.x=parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x)),(e=="y"||e=="xy")&&(t.pos.y=parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y))),t.type==1)){let n;for(let i of t.pathPoints)i.pick==!0&&(n=i);if(n){let i=parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x),s=parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y),o=i-n.x,r=s-n.y;for(let a of t.pathPoints)(e=="x"||e=="xy")&&(a.x=(parseFloat(a.x)+parseFloat(o)).toFixed(3)),(e=="y"||e=="xy")&&(a.y=(parseFloat(a.y)+parseFloat(r)).toFixed(3))}}},drawSMDCase(){let t=this.$refs.smdCase,e=t.getContext("2d"),n=t.width,i=t.height;if(e.clearRect(0,0,n,i),this.$refs.smdCase){let s=this.currentRow.case;for(let o of this.cases)if(o.name==s){const r=new Image;r.src=o.src,r.onload=()=>{let a=n/2,l=i/2,d=n*.7,u=r.height*(d/r.width),f=a-d/2,h=l-u/2,m=2*Math.PI*this.currentRow.caseRotate;e.translate(a,l),e.rotate(-m),e.translate(-a,-l),e.drawImage(r,f,h,d,u),e.translate(a,l),e.rotate(m),e.translate(-a,-l),e.stroke()}}}},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}},watch:{currentRow(){clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.drawSMDCase()},200)}}},dP={class:"row"},uP={class:"col"},hP={class:"scroll"},fP={class:"table mb-5",ref:"table"},pP=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Caption"),c("th",null,"Type"),c("th")])],-1),mP=["onMousedown"],_P={key:0},gP=we("\u2BC8"),vP={key:1},bP=["onUpdate:modelValue"],yP=["onUpdate:modelValue"],xP=["onUpdate:modelValue"],SP={nowrap:""},MP=["onClick"],EP=["onClick"],wP=["onClick"],TP={class:"text-end"},CP={class:"col"},AP={class:"scroll"},PP={key:0,class:"card"},RP={class:"card-header"},DP={class:"card-body"},IP={class:"mb-3"},FP=c("label",{class:"form-label"},"Name",-1),LP={class:"row mb-2"},UP={class:"col"},OP={class:"mb-3"},NP=c("label",{class:"form-label"},"Caption",-1),zP={class:"row mb-2"},kP={class:"col"},BP={class:"mb-3"},VP=c("label",{class:"form-label"},"Type",-1),$P={class:"row mb-2"},HP={class:"col"},GP=["value"],WP={key:0},XP={class:"mb-3"},jP=c("label",{class:"form-label"},"Position",-1),YP={class:"row mb-2"},qP={class:"col"},ZP=we(" X: "),KP={class:"col"},JP=we(" Y: "),QP={class:"col"},eR=we(" Z: "),tR={class:"col-auto"},nR={class:"mb-3"},iR=c("label",{class:"form-label"},"Step",-1),sR={class:"row mb-2"},oR={class:"col"},rR=we(" X: "),aR={class:"col"},lR=we(" Y: "),cR={class:"col"},dR=we(" Z: "),uR={class:"mb-3"},hR={class:"row mb-2"},fR={class:"col"},pR=we(" Capacity "),mR={class:"col"},_R=we(" Current "),gR={class:"col"},vR={key:1},bR={class:"mb-3"},yR=c("label",{class:"form-label"},"Path points",-1),xR={class:"row mb-2"},SR={class:"col"},MR={key:2},ER={class:"mb-3"},wR=c("label",{class:"form-label"},"Position (center)",-1),TR={class:"row mb-2"},CR={class:"col"},AR=we(" X: "),PR={class:"col"},RR=we(" Y: "),DR={class:"col"},IR=we(" Z: "),FR={class:"col-auto"},LR={class:"mb-3"},UR=c("label",{class:"form-label"},"Size",-1),OR={class:"row mb-2"},NR={class:"col"},zR=we(" Width X: "),kR={class:"col"},BR=we(" Width Y: "),VR={class:"mb-3"},$R=c("label",{class:"form-label"},"Elements height",-1),HR={class:"row mb-2"},GR={class:"col"},WR={class:"mb-3"},XR=c("label",{class:"form-label"},"Nozzle",-1),jR={class:"row mb-2"},YR={class:"col"},qR=["value"],ZR=c("div",{class:"form-text"},"Specify Nozzle to pick up element",-1),KR={class:"mb-3"},JR=c("label",{class:"form-label"},"Case",-1),QR={class:"row mb-2"},e2={class:"col"},t2=["value"],n2={ref:"smdCase",width:"64",height:"64",style:{border:"silver solid 1px"}},i2={class:"mb-3"},s2=c("label",{class:"form-label"},"Orientation in the feeder",-1),o2={class:"row mb-2"},r2={class:"col"},a2=c("div",{class:"form-text"},"Sets elements orientation in the feeder",-1),l2={class:"mb-3"},c2=c("label",{class:"form-label",for:"posCorrection"},"Correct the element's position after pick",-1),d2={class:"row mb-2"},u2={class:"col"},h2={class:"form-check form-switch"},f2=c("div",{class:"form-text"},"Uses bottom camera to correct position of element after pick",-1),p2={class:"mb-3"},m2=c("label",{class:"form-label"},"Active",-1),_2={class:"row mb-2"},g2={class:"col"},v2={class:"form-check form-switch"},b2={key:1,class:"card mt-1"},y2=c("div",{class:"card-header"},"Actions",-1),x2={class:"card-body"},S2=["disabled"],M2=["disabled"],E2=["disabled"],w2=["disabled"],T2=["disabled"],C2=["disabled"],A2=we("X"),P2=we("Y"),R2=we("Both"),D2=["disabled"];function I2(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("FeedersPathPointsTable"),l=et("PopupMenuItem"),d=et("PopupMenu");return W(),ee("div",dP,[c("div",uP,[c("div",hP,[c("table",fP,[pP,c("tbody",null,[(W(!0),ee(at,null,wt(t.rows,(u,f)=>(W(),ee("tr",{onMousedown:h=>t.setCurrentRow(u),class:je(u==t.currentRow?"active-row":"")},[c("td",null,[u==t.currentRow?(W(),ee("span",_P,[ke(r,{row:u,clipboard:t.clipboard,onCopy:e[0]||(e[0]=h=>o.doAction("copy",h)),onPaste:e[1]||(e[1]=h=>o.doAction("paste",h))},{default:Ct(()=>[gP]),_:2},1032,["row","clipboard"])])):(W(),ee("span",vP,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.name=h,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=h=>t.currentField="name"),class:"form-control form-control-sm"},null,40,bP),[[me,u.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.caption=h,ref_for:!0,ref:"caption",onFocus:e[3]||(e[3]=h=>t.currentField="caption"),class:"form-control form-control-sm"},null,40,yP),[[me,u.caption]])]),c("td",null,ze(n.feederTypes[u.type].name),1),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.active=h,ref_for:!0,ref:"active",onFocus:e[4]||(e[4]=h=>t.currentField="active"),type:"checkbox",class:"form-control form-control-sm",title:"Active"},null,40,xP),[[Kn,u.active]])]),c("th",SP,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:h=>t.$emit("up",u)},"\u2BC5",8,MP),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:h=>t.$emit("down",u)},"\u2BC6",8,EP),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:h=>t.$emit("delete",u)},"\u2BBF",8,wP)])],42,mP))),256))])],512),c("div",TP,[c("button",{onClick:e[5]||(e[5]=u=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add feeder")])])]),c("div",CP,[c("div",AP,[o.isCurrent?(W(),ee("div",PP,[c("div",RP,"Feeder "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",DP,[c("div",IP,[FP,c("div",LP,[c("div",UP,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=u=>t.currentRow.name=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.name]])])])]),c("div",OP,[NP,c("div",zP,[c("div",kP,[se(c("input",{"onUpdate:modelValue":e[7]||(e[7]=u=>t.currentRow.caption=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.caption]])])])]),c("div",BP,[VP,c("div",$P,[c("div",HP,[se(c("select",{"onUpdate:modelValue":e[8]||(e[8]=u=>t.currentRow.type=u),class:"form-control form-control-sm"},[(W(!0),ee(at,null,wt(n.feederTypes,u=>(W(),ee("option",{value:u.id},ze(u.name),9,GP))),256))],512),[[Jn,t.currentRow.type]])])])]),t.currentRow.type==0?(W(),ee("span",WP,[c("div",XP,[jP,c("div",YP,[c("div",qP,[ZP,se(c("input",{"onUpdate:modelValue":e[9]||(e[9]=u=>t.currentRow.pos.x=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.x]])]),c("div",KP,[JP,se(c("input",{"onUpdate:modelValue":e[10]||(e[10]=u=>t.currentRow.pos.y=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.y]])]),c("div",QP,[eR,se(c("input",{"onUpdate:modelValue":e[11]||(e[11]=u=>t.currentRow.pos.z=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.z]])]),c("div",tR,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[12]||(e[12]=u=>o.setFeederPosCAM(t.currentRow)),title:"Set current position of camera (x, y)"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[13]||(e[13]=u=>o.setFeederPos(t.currentRow)),title:"Set current position of nozzle (x, y, z)"},"\u{1F78A}")])])]),c("div",nR,[iR,c("div",sR,[c("div",oR,[rR,se(c("input",{"onUpdate:modelValue":e[14]||(e[14]=u=>t.currentRow.step.x=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.step.x]])]),c("div",aR,[lR,se(c("input",{"onUpdate:modelValue":e[15]||(e[15]=u=>t.currentRow.step.y=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.step.y]])]),c("div",cR,[dR,se(c("input",{"onUpdate:modelValue":e[16]||(e[16]=u=>t.currentRow.step.z=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.step.z]])])])]),c("div",uR,[c("div",hR,[c("div",fR,[pR,se(c("input",{"onUpdate:modelValue":e[17]||(e[17]=u=>t.currentRow.capacity=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.capacity]])]),c("div",mR,[_R,se(c("input",{"onUpdate:modelValue":e[18]||(e[18]=u=>t.currentRow.current=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.current]])]),c("div",gR,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[19]||(e[19]=u=>t.currentRow.current=0)},"Reset")])])])])):ot("",!0),t.currentRow.type==1?(W(),ee("span",vR,[c("div",bR,[yR,c("div",xR,[c("div",SR,[ke(a,{rows:t.currentRow.pathPoints,currentRow:t.currentPoint,onAdd:e[20]||(e[20]=u=>o.addPathPoint(u)),onSet:e[21]||(e[21]=u=>t.currentPoint=u),onSetPos:e[22]||(e[22]=u=>o.setPointPos(u)),onDelete:e[23]||(e[23]=u=>t.rowDelete(t.currentRow.pathPoints,u))},null,8,["rows","currentRow"])])])])])):ot("",!0),t.currentRow.type==2?(W(),ee("span",MR,[c("div",ER,[wR,c("div",TR,[c("div",CR,[AR,se(c("input",{"onUpdate:modelValue":e[24]||(e[24]=u=>t.currentRow.pos.x=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.x]])]),c("div",PR,[RR,se(c("input",{"onUpdate:modelValue":e[25]||(e[25]=u=>t.currentRow.pos.y=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.y]])]),c("div",DR,[IR,se(c("input",{"onUpdate:modelValue":e[26]||(e[26]=u=>t.currentRow.pos.z=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.z]])]),c("div",FR,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[27]||(e[27]=u=>o.setFeederPosCAM(t.currentRow)),title:"Set current position of camera (x, y)"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[28]||(e[28]=u=>o.setFeederPos(t.currentRow)),title:"Set current position of nozzle (x, y, z)"},"\u{1F78A}")])])]),c("div",LR,[UR,c("div",OR,[c("div",NR,[zR,se(c("input",{"onUpdate:modelValue":e[29]||(e[29]=u=>t.currentRow.pos.wx=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.wx]])]),c("div",kR,[BR,se(c("input",{"onUpdate:modelValue":e[30]||(e[30]=u=>t.currentRow.pos.wy=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.wy]])])])])])):ot("",!0),c("div",VR,[$R,c("div",HR,[c("div",GR,[se(c("input",{"onUpdate:modelValue":e[31]||(e[31]=u=>t.currentRow.elementHeight=u),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.elementHeight]])])])]),c("div",WR,[XR,c("div",jR,[c("div",YR,[se(c("select",{"onUpdate:modelValue":e[32]||(e[32]=u=>t.currentRow.nozzle=u),class:"form-control form-control-sm"},[(W(!0),ee(at,null,wt(n.settings.nozzles,u=>(W(),ee("option",{value:u.id},ze(u.name),9,qR))),256))],512),[[Jn,t.currentRow.nozzle]]),ZR])])]),c("div",KR,[JR,c("div",QR,[c("div",e2,[se(c("select",{"onUpdate:modelValue":e[33]||(e[33]=u=>t.currentRow.case=u),class:"form-control form-control-sm",onChange:e[34]||(e[34]=u=>o.drawSMDCase())},[(W(!0),ee(at,null,wt(n.cases,u=>(W(),ee("option",{value:u.name},ze(u.name),9,t2))),256))],544),[[Jn,t.currentRow.case]]),c("canvas",n2,null,512)])])]),c("div",i2,[s2,c("div",o2,[c("div",r2,[se(c("input",{"onUpdate:modelValue":e[35]||(e[35]=u=>t.currentRow.caseRotate=u),type:"number",step:"0.125",class:"form-control form-control-sm",onChange:e[36]||(e[36]=u=>o.drawSMDCase())},null,544),[[me,t.currentRow.caseRotate]])]),a2])]),c("div",l2,[c2,c("div",d2,[c("div",u2,[c("div",h2,[se(c("input",{"onUpdate:modelValue":e[37]||(e[37]=u=>t.currentRow.posCorrection=u),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Kn,t.currentRow.posCorrection]])])]),f2])]),c("div",p2,[m2,c("div",_2,[c("div",g2,[c("div",v2,[se(c("input",{"onUpdate:modelValue":e[38]||(e[38]=u=>t.currentRow.active=u),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Kn,t.currentRow.active]])])])])])])])):ot("",!0),o.isCurrent?(W(),ee("div",b2,[y2,c("div",x2,[c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[39]||(e[39]=u=>t.$emit("pickFromFeeder",t.currentRow))},"Pick element from Feeder",8,S2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[40]||(e[40]=u=>t.$emit("adjPosition"))},"Adjust position of Picked element",8,M2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[41]||(e[41]=u=>t.$emit("dropIntoBasket"))},"Drop Picked element into Basket",8,E2)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[42]||(e[42]=u=>t.$emit("goToFeeder",t.currentRow))},"Jog Nozzle to to Feeder position",8,w2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[43]||(e[43]=u=>t.$emit("goToFeederCam",t.currentRow))},"Jog Camera to to Feeder position",8,T2)]),c("div",null,[ke(d,null,{menubutton:Ct(()=>[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1 dropdown-toggle"},"Manual Adjust feeder's position by top Camera",8,C2)]),menuitems:Ct(()=>[ke(l,{disabled:n.disabled,onClick:e[44]||(e[44]=u=>o.adjFiderPosByCamPos(t.currentRow,"x"))},{default:Ct(()=>[A2]),_:1},8,["disabled"]),ke(l,{disabled:n.disabled,onClick:e[45]||(e[45]=u=>o.adjFiderPosByCamPos(t.currentRow,"y"))},{default:Ct(()=>[P2]),_:1},8,["disabled"]),ke(l,{disabled:n.disabled,onClick:e[46]||(e[46]=u=>o.adjFiderPosByCamPos(t.currentRow,"xy"))},{default:Ct(()=>[R2]),_:1},8,["disabled"])]),_:1}),c("button",{disabled:n.disabled||t.currentRow.type==2,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[47]||(e[47]=u=>t.$emit("adjFeederPositionCV",t.currentRow))},"Adjust Feeder's position by CV",8,D2)])])])):ot("",!0)])])])}var F2=ct(cP,[["render",I2]]);const L2={mixins:[Oa],props:{feeders:Object,settings:Object,cases:Object,machineState:Object,machinePos:Object,disabled:Boolean,loading:Boolean},components:{FeedersTable:F2},data:function(){return{feederTypes:[{id:0,name:"Liner"},{id:1,name:"Push-pull"},{id:2,name:"Heap"}],currentFeeder:this.currentFeeder}},mounted(){this.setCurrentFirst()},methods:{setCurrentFirst(){this.feeders.length>0&&(this.currentFeeder=this.feeders[0])},addFeeder(){let t=1;for(let e of this.feeders)e.id>=t&&(t=e.id+1);this.feeders.push({id:t,name:"Feeder "+t.toString(),caption:"",type:0,pos:{x:0,y:0,z:0},step:{x:0,y:0,z:0},pathPoints:[],capacity:0,current:0,elementHeight:.4,nozzle:0,case:"",caseRotate:0,posCorrection:!0,active:!0}),this.currentFeeder=this.feeders[this.feeders.length-1]},saveFeeders(){this.$emit("saveFeeders")}},watch:{feeders(){this.setCurrentFirst()}}},U2={class:"card"},O2=c("div",{class:"card-header"},"Feeders Settings",-1),N2={class:"card-body"},z2={class:"mt-1"},k2=["disabled"];function B2(t,e,n,i,s,o){const r=et("FeedersTable");return W(),ee("div",U2,[O2,c("div",N2,[ke(r,{rows:n.feeders,currentRow:t.currentFeeder,settings:n.settings,cases:n.cases,feederTypes:t.feederTypes,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onGoToFeeder:e[0]||(e[0]=a=>t.$emit("goToFeeder",a)),onGoToFeederCam:e[1]||(e[1]=a=>t.$emit("goToFeederCam",a)),onPickFromFeeder:e[2]||(e[2]=a=>t.$emit("pickFromFeeder",a)),onAdjPosition:e[3]||(e[3]=a=>t.$emit("adjPosition",a)),onAdjFeederPositionCV:e[4]||(e[4]=a=>t.$emit("adjFeederPositionCV",a)),onDropIntoBasket:e[5]||(e[5]=a=>t.$emit("dropIntoBasket",a)),onAdd:e[6]||(e[6]=a=>o.addFeeder()),onSet:e[7]||(e[7]=a=>t.currentFeeder=a),onUp:e[8]||(e[8]=a=>t.rowUp(n.feeders,a)),onDown:e[9]||(e[9]=a=>t.rowDown(n.feeders,a)),onDelete:e[10]||(e[10]=a=>t.rowDelete(n.feeders,a))},null,8,["rows","currentRow","settings","cases","feederTypes","machineState","machinePos","disabled"]),c("div",z2,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary me-1",onClick:e[11]||(e[11]=a=>o.saveFeeders())},"Save feeders",8,k2)])])])}var _p=ct(L2,[["render",B2]]);const V2={mixins:[Hn],props:{pcbtable:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.pcbtable.z=parseFloat(this.machinePos.z))}}},$2={class:"card"},H2=c("div",{class:"card-header"},"PCB Table Settings",-1),G2={class:"card-body"},W2={class:"mb-3"},X2=c("label",{class:"form-label"},"PCB Table position",-1),j2={class:"row mb-2"},Y2={class:"col"},q2={class:"row"},Z2=c("div",{class:"col-auto pt-1"},"X:",-1),K2={class:"col"},J2={class:"col"},Q2={class:"row"},e3=c("div",{class:"col-auto pt-1"},"Y:",-1),t3={class:"col"},n3={class:"col"},i3={class:"row"},s3=c("div",{class:"col-auto pt-1"},"Z:",-1),o3={class:"col"},r3={class:"col-auto"},a3=c("div",{class:"form-text"},"Left bottom PCB table position",-1),l3={class:"row mt-2"},c3={class:"col"},d3=["disabled"];function u3(t,e,n,i,s,o){return W(),ee("div",$2,[H2,c("div",G2,[c("div",W2,[X2,c("div",j2,[c("div",Y2,[c("div",q2,[Z2,c("div",K2,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.pcbtable.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.pcbtable.x]])])])]),c("div",J2,[c("div",Q2,[e3,c("div",t3,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.pcbtable.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.pcbtable.y]])])])]),c("div",n3,[c("div",i3,[s3,c("div",o3,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.pcbtable.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,n.pcbtable.z]])])])]),c("div",r3,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])]),a3]),c("div",l3,[c("div",c3,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,d3)])])])])}var h3=ct(V2,[["render",u3]]);const f3={mixins:[Ss,Hn,Ms],props:{settings:Object,machineState:Object,machinePos:Object,feeders:Object,disabled:Boolean},components:{CopyPasteMenu:bo},data:function(){return{currentField:"name",clipboard:this.clipboard}},computed:{elements(){if(this.rows){let t=this.rows;for(let e of t){let n=this.getFeederById(e.feeder);if(n!==null){let i=this.getNozzleById(n.nozzle);e.nozzleId=n.nozzle,e.nozzleName=i.name}}return t}},isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{setElementPos(t){this.machineStateIsOK()==!0&&(t.pos.x=this.machinePos.x,t.pos.y=this.machinePos.y)},setElementPosCam(t){if(this.machineStateIsOK()==!0){let e=this.settings.cams[0].offset;t.pos.x=(parseFloat(this.machinePos.x)+parseFloat(e.x)).toFixed(3),t.pos.y=(parseFloat(this.machinePos.y)+parseFloat(e.y)).toFixed(3)}},refreshCurrentElement(t){this.$emit("set",t)},goToElement(t){this.$emit("goToElement",t)},goToElementCam(t){this.$emit("goToElementCam",t)},placeElement(t){this.$emit("placeElement",t)},getFeederById(t){for(let e of this.feeders)if(e.id==t)return e;return null},getNozzleById(t){for(let e of this.settings.nozzles)if(e.id==t)return e;return null},goToFeeder(t){this.$emit("goToFeeder",this.getFeederById(t))},goToFeederCam(t){this.$emit("goToFeederCam",this.getFeederById(t))},runFrom(t){this.$emit("runFrom",t)},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},nn=t=>(Aa("data-v-64bc414d"),t=t(),Pa(),t),p3={class:"row"},m3={class:"col mh-100"},_3={class:"scroll"},g3={class:"table mb-5",ref:"table"},v3=nn(()=>c("th",null,null,-1)),b3=nn(()=>c("th",null,"Name",-1)),y3=nn(()=>c("th",null,"Caption",-1)),x3={nowrap:""},S3=we("Feeder "),M3=we(),E3={nowrap:""},w3=we("Nozzle "),T3=we(),C3={nowrap:""},A3=we("X "),P3=we(),R3={nowrap:""},D3=we("Y "),I3=we(),F3=nn(()=>c("th",null,"A",-1)),L3=nn(()=>c("th",null,null,-1)),U3=nn(()=>c("th",null,null,-1)),O3=["onMousedown"],N3={key:0},z3=we("\u2BC8"),k3={key:1},B3=["onUpdate:modelValue"],V3=["onUpdate:modelValue"],$3=["onUpdate:modelValue"],H3=["value"],G3={nowrap:""},W3=["onUpdate:modelValue"],X3=["onUpdate:modelValue"],j3=["onUpdate:modelValue"],Y3=["onUpdate:modelValue"],q3={nowrap:""},Z3=["onClick"],K3=["onClick"],J3=["onClick"],Q3={class:"text-end"},eD={class:"col"},tD={class:"scroll"},nD={key:0,class:"card"},iD={class:"card-header"},sD={class:"card-body"},oD={class:"mb-3"},rD=nn(()=>c("label",{class:"form-label"},"Name",-1)),aD={class:"row mb-2"},lD={class:"col"},cD={class:"mb-3"},dD=nn(()=>c("label",{class:"form-label"},"Caption",-1)),uD={class:"row mb-2"},hD={class:"col"},fD={class:"mb-3"},pD=nn(()=>c("label",{class:"form-label"},"Feeder",-1)),mD={class:"row mb-2"},_D={class:"col"},gD=["value"],vD={class:"mb-3"},bD=nn(()=>c("label",{class:"form-label"},"Position",-1)),yD={class:"row mb-2"},xD={class:"col"},SD=we(" X: "),MD={class:"col"},ED=we(" Y: "),wD={class:"col"},TD=we(" A: "),CD={class:"col-auto"},AD={class:"mb-3"},PD=nn(()=>c("label",{class:"form-label"},"Active",-1)),RD={class:"row mb-2"},DD={class:"col"},ID={class:"form-check form-switch"},FD={key:1,class:"card mt-1"},LD=nn(()=>c("div",{class:"card-header"},"Actions",-1)),UD={class:"card-body"},OD=["disabled"],ND=["disabled"],zD=["disabled"],kD=we("Jog Nozzle to "),BD=nn(()=>c("b",null,"Element",-1)),VD=we(" position"),$D=[kD,BD,VD],HD=["disabled"],GD=we("Jog Nozzle to to "),WD=nn(()=>c("b",null,"Feeder",-1)),XD=we(" position"),jD=[GD,WD,XD],YD=["disabled"],qD=we("Jog Camera to "),ZD=nn(()=>c("b",null,"Element",-1)),KD=we(" position"),JD=[qD,ZD,KD],QD=["disabled"],eI=we("Jog Camera to to "),tI=nn(()=>c("b",null,"Feeder",-1)),nI=we(" position"),iI=[eI,tI,nI];function sI(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",p3,[c("div",m3,[c("div",_3,[c("table",g3,[c("thead",null,[c("tr",null,[v3,b3,y3,c("th",x3,[S3,c("a",{onClick:e[0]||(e[0]=a=>t.$emit("sortElements",{field:"feeder",order:"up"})),title:"Sort by Feeder"},"\u2BC5"),M3,c("a",{onClick:e[1]||(e[1]=a=>t.$emit("sortElements",{field:"feeder",order:"down"})),title:"Sort by Feeder"},"\u2BC6")]),c("th",E3,[w3,c("a",{onClick:e[2]||(e[2]=a=>t.$emit("sortElements",{field:"nozzle",order:"up"})),title:"Sort by Nozzle"},"\u2BC5"),T3,c("a",{onClick:e[3]||(e[3]=a=>t.$emit("sortElements",{field:"nozzle",order:"down"})),title:"Sort by Nozzle"},"\u2BC6")]),c("th",C3,[A3,c("a",{onClick:e[4]||(e[4]=a=>t.$emit("sortElements",{field:"x",order:"up"})),title:"Sort by X"},"\u2BC5"),P3,c("a",{onClick:e[5]||(e[5]=a=>t.$emit("sortElements",{field:"x",order:"down"})),title:"Sort by X"},"\u2BC6")]),c("th",R3,[D3,c("a",{onClick:e[6]||(e[6]=a=>t.$emit("sortElements",{field:"y",order:"up"})),title:"Sort by Y"},"\u2BC5"),I3,c("a",{onClick:e[7]||(e[7]=a=>t.$emit("sortElements",{field:"y",order:"down"})),title:"Sort by Y"},"\u2BC6")]),F3,L3,U3])]),c("tbody",null,[(W(!0),ee(at,null,wt(o.elements,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",N3,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[8]||(e[8]=d=>o.doAction("copy",d)),onPaste:e[9]||(e[9]=d=>o.doAction("paste",d))},{default:Ct(()=>[z3]),_:2},1032,["row","clipboard"])])):(W(),ee("span",k3,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.name=d,ref_for:!0,ref:"name",onFocus:e[10]||(e[10]=d=>t.currentField="name"),class:"form-control form-control-sm",size:"10"},null,40,B3),[[me,a.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.caption=d,ref_for:!0,ref:"caption",onFocus:e[11]||(e[11]=d=>t.currentField="caption"),class:"form-control form-control-sm",size:"10"},null,40,V3),[[me,a.caption]])]),c("td",null,[se(c("select",{"onUpdate:modelValue":d=>a.feeder=d,class:"form-control form-control-sm"},[(W(!0),ee(at,null,wt(n.feeders,d=>(W(),ee("option",{value:d.id},ze(d.name)+" ( "+ze(d.caption)+" )",9,H3))),256))],8,$3),[[Jn,a.feeder]])]),c("td",G3,ze(a.nozzleName),1),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.x=d,ref_for:!0,ref:"X",onFocus:e[12]||(e[12]=d=>t.currentField="X"),class:"form-control form-control-sm",size:"3"},null,40,W3),[[me,a.pos.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.y=d,ref_for:!0,ref:"Y",onFocus:e[13]||(e[13]=d=>t.currentField="Y"),class:"form-control form-control-sm",size:"3"},null,40,X3),[[me,a.pos.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.a=d,ref_for:!0,ref:"A",onFocus:e[14]||(e[14]=d=>t.currentField="A"),onChange:e[15]||(e[15]=d=>o.refreshCurrentElement(t.currentRow)),class:"form-control form-control-sm",size:"3"},null,40,j3),[[me,a.pos.a]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.active=d,ref_for:!0,ref:"active",onFocus:e[16]||(e[16]=d=>t.currentField="active"),type:"checkbox",class:"form-control form-control-sm",title:"Active"},null,40,Y3),[[Kn,a.active]])]),c("th",q3,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("up",a)},"\u2BC5",8,Z3),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("down",a)},"\u2BC6",8,K3),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,J3)])],42,O3))),256))])],512),c("div",Q3,[c("button",{onClick:e[17]||(e[17]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary me-1"},"Add element"),c("button",{onClick:e[18]||(e[18]=a=>t.$emit("import")),class:"btn btn-sm btn-outline-secondary"},"Import elements...")])])]),c("div",eD,[c("div",tD,[o.isCurrent?(W(),ee("div",nD,[c("div",iD,"Element "+ze(t.currentRow.name)+" (# "+ze(t.currentRow.id)+")",1),c("div",sD,[c("div",oD,[rD,c("div",aD,[c("div",lD,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=a=>t.currentRow.name=a),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.name]])])])]),c("div",cD,[dD,c("div",uD,[c("div",hD,[se(c("input",{"onUpdate:modelValue":e[20]||(e[20]=a=>t.currentRow.caption=a),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.caption]])])])]),c("div",fD,[pD,c("div",mD,[c("div",_D,[se(c("select",{"onUpdate:modelValue":e[21]||(e[21]=a=>t.currentRow.feeder=a),class:"form-control form-control-sm"},[(W(!0),ee(at,null,wt(n.feeders,a=>(W(),ee("option",{value:a.id},ze(a.name)+" ( "+ze(a.caption)+" )",9,gD))),256))],512),[[Jn,t.currentRow.feeder]])])])]),c("div",vD,[bD,c("div",yD,[c("div",xD,[SD,se(c("input",{"onUpdate:modelValue":e[22]||(e[22]=a=>t.currentRow.pos.x=a),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[me,t.currentRow.pos.x]])]),c("div",MD,[ED,se(c("input",{"onUpdate:modelValue":e[23]||(e[23]=a=>t.currentRow.pos.y=a),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[me,t.currentRow.pos.y]])]),c("div",wD,[TD,se(c("input",{"onUpdate:modelValue":e[24]||(e[24]=a=>t.currentRow.pos.a=a),onChange:e[25]||(e[25]=a=>o.refreshCurrentElement(t.currentRow)),type:"number",class:"form-control form-control-sm",step:"0.01"},null,544),[[me,t.currentRow.pos.a]])]),c("div",CD,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[26]||(e[26]=a=>o.setElementPosCam(t.currentRow)),title:"Set current position of camera (x, y, a)"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[27]||(e[27]=a=>o.setElementPos(t.currentRow)),title:"Set current position of nozzle (x, y, a)"},"\u{1F78A}")])])]),c("div",AD,[PD,c("div",RD,[c("div",DD,[c("div",ID,[se(c("input",{"onUpdate:modelValue":e[28]||(e[28]=a=>t.currentRow.active=a),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Kn,t.currentRow.active]])])])])])])])):ot("",!0),o.isCurrent?(W(),ee("div",FD,[LD,c("div",UD,[c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[29]||(e[29]=a=>o.placeElement(t.currentRow))},"Place element",8,OD),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[30]||(e[30]=a=>o.runFrom(t.currentRow))},"Start Job from this element",8,ND)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[31]||(e[31]=a=>o.goToElement(t.currentRow))},$D,8,zD),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[32]||(e[32]=a=>o.goToFeeder(t.currentRow.feeder))},jD,8,HD)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[33]||(e[33]=a=>o.goToElementCam(t.currentRow))},JD,8,YD),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[34]||(e[34]=a=>o.goToFeederCam(t.currentRow.feeder))},iI,8,QD)])])])):ot("",!0)])])])}var oI=ct(f3,[["render",sI],["__scopeId","data-v-64bc414d"]]);const rI={props:["title","number","width","height"],data:function(){return{drag:!1,dragObject:this.dragObject,shiftX:this.shiftX,shiftY:this.shiftY,downX:this.downX,downY:this.downY}},methods:{close(){this.$emit("close")},setSize:function(){typeof this.width!="undefined"&&(this.dragObject.style.width=this.width+"px"),typeof this.height!="undefined"&&(this.dragObject.style.height=this.height+"px")},onkey(t){t.keyCode==27&&this.close()}},mounted:function(){this.dragObject=this.$refs["win"+this.number],this.setSize(),window.addEventListener("keydown",this.onkey)},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},watch:{width(){this.setSize()},height(){this.setSize()}}},aI=t=>(Aa("data-v-c19ddb68"),t=t(),Pa(),t),lI=aI(()=>c("div",{class:"dialog-overlay"},null,-1)),cI={class:"dialogtitle"},dI={class:"title"},uI={class:"content"};function hI(t,e,n,i,s,o){return W(),ee("div",null,[lI,c("div",{class:"dialog",ref:"win"+n.number},[c("div",cI,[c("div",dI,ze(n.title),1),c("div",{class:"btn imgClose",onClick:e[0]||(e[0]=r=>o.close()),title:"Close"})]),c("div",uI,[to(t.$slots,"default",{},void 0,!0)])],512)])}var fI=ct(rI,[["render",hI],["__scopeId","data-v-c19ddb68"]]);const pI={mixins:[Oa,Hn],components:{FeedersSettings:_p,ElementsTable:oI,DialogWindow:fI},data(){return{tab:0,currentElement:this.currentElement,showWindow:[!1,!1],inpuValue:""}},props:{project:Object,projects_list:Object,settings:Object,cases:Object,machineState:Object,machinePos:Object,pnpProcessing:Object,default_feeders:Object,disabled:Boolean,loading:Boolean},computed:{projectsList(){if(this.projects_list){let t=[];for(let e of this.projects_list)t.push(e.split(".").slice(0,-1).join("."));return t}},dialogIsOpened(){return this.showWindow.indexOf(!0)>-1}},methods:{importFeeder(){Un("The Feeders of this project will be replaced by Default Feeders settings. Do you want import default Feeders?","Confirm").then(t=>{t==!0&&(this.project.feeders=JSON.parse(JSON.stringify(this.default_feeders)))})},pnpAdjFeederPositionCV(t){this.$emit("adjFeederPositionCV",t)},pnpAdjFeedersPositionCV(){this.$emit("adjFeedersPositionCV",this.project.feeders)},setCurrentElement(t){this.currentElement=t;for(let e of this.project.feeders)if(e.id==t.feeder){let n=parseFloat(e.caseRotate)+parseFloat(t.pos.a);this.$emit("setSMDCase",{case:e.case,rotate:n})}},pnpGoToFeeder(t){this.$emit("goToFeeder",t)},pnpGoToFeederCam(t){this.$emit("goToFeederCam",t)},pnpPickFromFeeder(t){this.$emit("pickFromFeeder",t)},pnpAdjPosition(t){this.$emit("adjPosition",t)},pnpDropIntoBasket(t){this.$emit("dropIntoBasket",t)},runFrom(t){this.$emit("runFrom",t),this.tab=3},saveFeeders(){Un("Attention! This feeders set will saved when You Save Project! You can set this feeders set as default. Do You want to set this Feeders set as default?","Warning").then(t=>{t==!0&&Un("Do You want to set this Feeders set as default? Are You sure?","Confirm").then(e=>{e==!0&&this.$emit("setFeeders")})})},openDialogOpenProject(){this.showWindow[0]=!0},closeDialogOpenProject(){this.showWindow[0]=!1},openDialogSaveAs(){this.inpuValue=this.project.name,this.showWindow[1]=!0},closeDialogSaveAs(){this.showWindow[1]=!1},openDialogProjectsManager(){this.showWindow[2]=!0},closeDialogProjectsManager(){this.showWindow[2]=!1},newProject(){Un("Attention! All changes of current project will lost. Do You want to create new Project?","Confirm").then(t=>{t==!0&&this.$emit("newProject")})},loadProject(){this.projectsList.indexOf(this.project.name)!=-1?this.$emit("loadProject"):st(`Can't load project "`+this.project.name+'". The project is missing.',"Warning","warning")},saveProject(){this.project.name!="New Project"?this.$emit("saveProject"):this.openDialogSaveAs()},async renameProject(t){let e=await Zy("Please enter new project name:","Rename",t);e!==null&&e!=!1&&(this.projectsList.indexOf(e)==-1?this.$emit("renameProject",{name:t,newName:e}):st("Can't rename the Project. A project with the specified name already exists!","Warning","warning"))},deleteProject(t){Un('Do You want to delete project "'+t+'"?',"Confirm").then(e=>{e==!0&&this.$emit("deleteProject",t)})},goToElement(t){this.$emit("goToElement",t)},goToElementCam(t){this.$emit("goToElementCam",t)},placeElement(t){this.$emit("placeElement",t)},getNextElementId(){let t=1;for(let e of this.project.elements)e.id>=t&&(t=e.id+1);return t},addElement(){let t=this.getNextElementId();this.project.elements.push({id:t,name:"SMD "+t.toString(),caption:"",feeder:0,pos:{x:0,y:0,a:0},active:!0}),this.currentElement=this.project.elements[this.project.elements.length-1]},getFeederById(t){for(let e of this.project.feeders)if(e.id==t)return e;return null},sortElements(t){let e=this.project.elements.slice();e=e.sort((n,i)=>{let s,o;if(t.field=="feeder"&&(s=parseFloat(n.feeder),o=parseFloat(i.feeder)),t.field=="nozzle"){let r=this.getFeederById(n.feeder),a=this.getFeederById(i.feeder);r!=null&&(s=parseFloat(r.nozzle)),a!=null&&(o=parseFloat(a.nozzle))}return t.field=="x"&&(s=parseFloat(n.pos.x),o=parseFloat(i.pos.x)),t.field=="y"&&(s=parseFloat(n.pos.y),o=parseFloat(i.pos.y)),t.order=="up"?so?1:0:os?1:0}),this.project.elements=e},importElements(){this.$refs.openFile.click()},importFile(){function t(i){return i=i.replace(/[\"]/g,""),i}function e(i){return i=parseFloat(i.replace(/[^0-9,\.]/g,"")),i}let n=this.$refs.openFile.files[0];if(n){let i=new FileReader;i.readAsText(n,"UTF-8"),i.onload=s=>{let o=s.target.result.split(` `);if(o.length>0){let r=o[0].split(" "),a={},l=0;for(let f of r)a[f]=l,l++;let d=parseFloat(this.settings.table.pos.x),u=parseFloat(this.settings.table.pos.y);l=0;for(let f of o)if(l>0){let h=f.split(" ");if(h.length>1){let m=t(h[a.Comment]),b=0;for(let y of this.project.feeders)y.caption.toUpperCase()==m.toUpperCase()&&(b=y.id);this.project.elements.push({id:this.getNextElementId(),name:t(h[a.Designator])+" ("+h[a.Layer]+")",caption:m,feeder:b,pos:{x:d+e(h[a["Mid X"]]),y:u+e(h[a["Mid Y"]]),a:e(h[a.Rotation])/360},active:!0})}}else l++}},i.onerror=s=>{console.log(s),st("Can't read file '"+n.name+"'","Error","error")},this.$refs.openFile.value=""}},jogFirstElement(){this.project.elements.length>0?this.$emit("goToElementCam",this.project.elements[0]):st("There is not a elements in the project","Warning","warning")},setPCBPosCam(){this.machineStateIsOK()==!0&&(this.project.pcb.pos.x=(parseFloat(this.machinePos.x)-parseFloat(this.project.elements[0].pos.x)+parseFloat(this.settings.cams[0].offset.x)).toFixed(3),this.project.pcb.pos.y=(parseFloat(this.machinePos.y)-parseFloat(this.project.elements[0].pos.y)+parseFloat(this.settings.cams[0].offset.y)).toFixed(3))},setPCBPos(){this.machineStateIsOK()==!0&&(this.project.pcb.pos.x=(parseFloat(this.machinePos.x)-parseFloat(this.project.elements[0].pos.x)).toFixed(3),this.project.pcb.pos.y=(parseFloat(this.machinePos.y)-parseFloat(this.project.elements[0].pos.y)).toFixed(3))},adjPCBPositionCV(){this.$emit("adjPCBPositionCV",this.project)},findElement(){this.setCurrentElement(this.pnpProcessing.element),this.tab=1},run(){this.$emit("run")},pause(){this.$emit("pause")},stop(){this.$emit("stop")}}},mI={style:{"max-height":"400px","overflow-y":"auto"}},_I={class:"table",ref:"table"},gI=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Projects")])],-1),vI=["onClick","onDblclick"],bI={width:"2"},yI={key:0},xI={key:1},SI={class:"float-end",style:{position:"absolute",bottom:"0px"}},MI=["disabled"],EI=["disabled"],wI={size:"20",disabled:"",class:"form-control"},TI={class:"float-end",style:{position:"absolute",bottom:"0px"}},CI=["disabled"],AI=["disabled"],PI={style:{"max-height":"400px","overflow-y":"auto"}},RI={class:"table",ref:"table"},DI=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Project"),c("th")])],-1),II=["onClick"],FI={width:"2"},LI={key:0},UI={key:1},OI={width:"220"},NI=["disabled","onClick"],zI=["disabled","onClick"],kI=["disabled","onClick"],BI={class:"float-end",style:{position:"absolute",bottom:"0px"}},VI=["disabled"],$I={class:"project-name"},HI={class:"row"},GI={class:"col"},WI=we(" Project: "),XI={class:"col-auto"},jI=["disabled"],YI=["disabled"],qI=["disabled"],ZI=["disabled"],KI=["disabled"],JI={class:"nav nav-tabs"},QI={class:"nav-item"},eF={class:"nav-item"},tF={class:"nav-item"},nF={class:"nav-item"},iF={class:"row mt-2"},sF={class:"col project"},oF=["disabled"],rF={class:"row mt-2"},aF={class:"col"},lF={class:"row mt-2"},cF={class:"col"},dF={class:"card mb-4"},uF=c("div",{class:"card-header"},"Manual position Adjustment",-1),hF={class:"card-body"},fF=["disabled"],pF={class:"mb-3"},mF=c("label",{class:"form-label"},"Offset of first element (manual correction)",-1),_F={class:"row mb-2"},gF={class:"col"},vF=we(" X: "),bF={class:"col"},yF=we(" Y: "),xF={class:"col-auto"},SF={class:"mb-3"},MF=c("label",{class:"form-label"},"PCB thickness",-1),EF={class:"card"},wF=c("div",{class:"card-header"},"Automatically position Adjustment",-1),TF={class:"card-body"},CF={class:"mb-3"},AF=["disabled"],PF=c("div",null,"(fiducials are need)",-1),RF={class:"row mt-2"},DF={class:"col"},IF={class:"card mb-4"},FF=c("div",{class:"card-header"},"Before Run Adjustment",-1),LF={class:"card-body"},UF=["disabled"],OF=["disabled"],NF=we(" (fiducials are need) "),zF={class:"card"},kF=c("div",{class:"card-header"},"Run",-1),BF={class:"card-body"},VF=["disabled"],$F=["disabled"],HF={key:0},GF={key:1},WF=["disabled"],XF={key:0,class:"alert alert-success",role:"alert"},jF={key:0};function YF(t,e,n,i,s,o){const r=et("DialogWindow"),a=et("FeedersSettings"),l=et("ElementsTable");return W(),ee("div",null,[c("input",{type:"file",ref:"openFile",accept:".csv",style:{display:"none"},onChange:e[0]||(e[0]=d=>o.importFile())},null,544),se(ke(r,{title:"Open",width:"800",height:"520",number:0,onClose:e[3]||(e[3]=d=>o.closeDialogOpenProject())},{default:Ct(()=>[c("div",mI,[c("table",_I,[gI,c("tbody",null,[(W(!0),ee(at,null,wt(o.projectsList,d=>(W(),ee("tr",{onClick:u=>s.inpuValue=d,onDblclick:u=>{n.project.name=d,o.closeDialogOpenProject(),o.loadProject()},class:je(s.inpuValue==d?"active-row":"")},[c("td",bI,[s.inpuValue==d?(W(),ee("span",yI,"\u2BC8")):(W(),ee("span",xI,"\xA0\xA0"))]),c("td",null,ze(d),1)],42,vI))),256))])],512)]),c("div",SI,[c("button",{disabled:n.loading||o.projectsList.indexOf(s.inpuValue)==-1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[1]||(e[1]=d=>{n.project.name=s.inpuValue,o.closeDialogOpenProject(),o.loadProject()})},"Open",8,MI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[2]||(e[2]=d=>o.closeDialogOpenProject())},"Cancel",8,EI)])]),_:1},512),[[ln,s.showWindow[0]]]),se(ke(r,{title:"Save as...",width:"800",height:"520",number:1,onClose:e[8]||(e[8]=d=>o.closeDialogSaveAs())},{default:Ct(()=>[se(c("input",{"onUpdate:modelValue":e[4]||(e[4]=d=>s.inpuValue=d),class:"form-control form-control-sm",type:"text",onKeyup:e[5]||(e[5]=tp(d=>{n.project.name=s.inpuValue,o.closeDialogSaveAs(),o.saveProject()},["enter"]))},null,544),[[me,s.inpuValue]]),c("div",null,[c("select",wI,[(W(!0),ee(at,null,wt(o.projectsList,d=>(W(),ee("option",null,ze(d),1))),256))])]),c("div",TI,[c("button",{disabled:n.loading||o.projectsList.indexOf(s.inpuValue)>-1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[6]||(e[6]=d=>{n.project.name=s.inpuValue,o.closeDialogSaveAs(),o.saveProject()})},"Save",8,CI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[7]||(e[7]=d=>o.closeDialogSaveAs())},"Cancel",8,AI)])]),_:1},512),[[ln,s.showWindow[1]]]),se(ke(r,{title:"Projects manager",width:"800",height:"520",number:2,onClose:e[10]||(e[10]=d=>o.closeDialogProjectsManager())},{default:Ct(()=>[c("div",PI,[c("table",RI,[DI,c("tbody",null,[(W(!0),ee(at,null,wt(o.projectsList,d=>(W(),ee("tr",{onClick:u=>s.inpuValue=d,class:je(s.inpuValue==d?"active-row":"")},[c("td",FI,[s.inpuValue==d?(W(),ee("span",LI,"\u2BC8")):(W(),ee("span",UI,"\xA0\xA0"))]),c("td",null,ze(d),1),c("td",OI,[c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>{n.project.name=d,o.closeDialogProjectsManager(),o.loadProject()}},"Open",8,NI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>o.renameProject(d)},"Rename",8,zI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>o.deleteProject(d)},"Delete",8,kI)])],10,II))),256))])],512)]),c("div",BI,[c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[9]||(e[9]=d=>o.closeDialogProjectsManager())},"Cancel",8,VI)])]),_:1},512),[[ln,s.showWindow[2]]]),c("div",$I,[c("div",HI,[c("div",GI,[WI,c("b",null,ze(n.project.name),1)]),c("div",XI,[c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[11]||(e[11]=d=>o.newProject())},"New...",8,jI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[12]||(e[12]=d=>o.openDialogOpenProject())},"Open...",8,YI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[13]||(e[13]=d=>o.saveProject())},"Save Project",8,qI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[14]||(e[14]=d=>o.openDialogSaveAs())},"Save as...",8,ZI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[15]||(e[15]=d=>o.openDialogProjectsManager())},"Projects manager...",8,KI)])])]),c("ul",JI,[c("li",QI,[c("a",{class:je("nav-link"+(s.tab==0?" active":"")),onClick:e[16]||(e[16]=d=>s.tab=0)},"Feeders",2)]),c("li",eF,[c("a",{class:je("nav-link"+(s.tab==1?" active":"")),onClick:e[17]||(e[17]=d=>s.tab=1)},"Elements",2)]),c("li",tF,[c("a",{class:je("nav-link"+(s.tab==2?" active":"")),onClick:e[18]||(e[18]=d=>s.tab=2)},"PCB",2)]),c("li",nF,[c("a",{class:je("nav-link"+(s.tab==3?" active":"")),onClick:e[19]||(e[19]=d=>s.tab=3)},"Job",2)])]),se(c("div",iF,[c("div",sF,[ke(a,{settings:n.settings,cases:n.cases,machineState:n.machineState,machinePos:n.machinePos,feeders:n.project.feeders,disabled:n.disabled,loading:n.loading,onAdjFeederPositionCV:e[20]||(e[20]=d=>o.pnpAdjFeederPositionCV(d)),onGoToFeeder:e[21]||(e[21]=d=>o.pnpGoToFeeder(d)),onGoToFeederCam:e[22]||(e[22]=d=>o.pnpGoToFeederCam(d)),onPickFromFeeder:e[23]||(e[23]=d=>o.pnpPickFromFeeder(d)),onAdjPosition:e[24]||(e[24]=d=>o.pnpAdjPosition(d)),onDropIntoBasket:e[25]||(e[25]=d=>o.pnpDropIntoBasket(d)),onSaveFeeders:e[26]||(e[26]=d=>o.saveFeeders())},null,8,["settings","cases","machineState","machinePos","feeders","disabled","loading"]),c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[27]||(e[27]=d=>o.importFeeder())},"Import from settings"),c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[28]||(e[28]=d=>o.pnpAdjFeedersPositionCV())},"Adjust position of all active feeders using CV",8,oF)])],512),[[ln,s.tab==0]]),se(c("div",rF,[c("div",aF,[ke(l,{rows:n.project.elements,currentRow:s.currentElement,feeders:n.project.feeders,settings:n.settings,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onGoToFeeder:e[29]||(e[29]=d=>o.pnpGoToFeeder(d)),onGoToFeederCam:e[30]||(e[30]=d=>o.pnpGoToFeederCam(d)),onGoToElement:e[31]||(e[31]=d=>o.goToElement(d)),onGoToElementCam:e[32]||(e[32]=d=>o.goToElementCam(d)),onPlaceElement:e[33]||(e[33]=d=>o.placeElement(d)),onSortElements:e[34]||(e[34]=d=>o.sortElements(d)),onRunFrom:e[35]||(e[35]=d=>o.runFrom(d)),onAdd:e[36]||(e[36]=d=>o.addElement()),onImport:e[37]||(e[37]=d=>o.importElements()),onSet:e[38]||(e[38]=d=>o.setCurrentElement(d)),onUp:e[39]||(e[39]=d=>t.rowUp(n.project.elements,d)),onDown:e[40]||(e[40]=d=>t.rowDown(n.project.elements,d)),onDelete:e[41]||(e[41]=d=>t.rowDelete(n.project.elements,d))},null,8,["rows","currentRow","feeders","settings","machineState","machinePos","disabled"])])],512),[[ln,s.tab==1]]),se(c("div",lF,[c("div",cF,[c("div",dF,[uF,c("div",hF,[c("div",null,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[42]||(e[42]=d=>o.jogFirstElement())},"Jog Camera to first elment",8,fF)]),c("div",pF,[mF,c("div",_F,[c("div",gF,[vF,se(c("input",{"onUpdate:modelValue":e[43]||(e[43]=d=>n.project.pcb.pos.x=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[me,n.project.pcb.pos.x]])]),c("div",bF,[yF,se(c("input",{"onUpdate:modelValue":e[44]||(e[44]=d=>n.project.pcb.pos.y=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[me,n.project.pcb.pos.y]])]),c("div",xF,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[45]||(e[45]=d=>o.setPCBPosCam()),title:"Set current position of camera"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[46]||(e[46]=d=>o.setPCBPos()),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",SF,[MF,se(c("input",{"onUpdate:modelValue":e[47]||(e[47]=d=>n.project.pcb.pos.z=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[me,n.project.pcb.pos.z]])])])]),c("div",EF,[wF,c("div",TF,[c("div",CF,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[48]||(e[48]=d=>o.adjPCBPositionCV())},"Adjust PCB Offsets by CV",8,AF),PF])])])])],512),[[ln,s.tab==2]]),se(c("div",RF,[c("div",DF,[c("div",IF,[FF,c("div",LF,[c("div",null,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[49]||(e[49]=d=>o.pnpAdjFeedersPositionCV())},"Adjust position of all active feeders using CV",8,UF)]),c("div",null,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[50]||(e[50]=d=>o.adjPCBPositionCV())},"Adjust PCB Offsets by CV",8,OF),NF])])]),c("div",zF,[kF,c("div",BF,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[51]||(e[51]=d=>o.run())},"Start",8,VF),c("button",{disabled:n.pnpProcessing.runFlag==!1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[52]||(e[52]=d=>o.pause())},[n.pnpProcessing.pauseFlag==!1?(W(),ee("span",HF,"Pause")):(W(),ee("span",GF,"Resume"))],8,$F),c("button",{disabled:n.pnpProcessing.runFlag==!1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[53]||(e[53]=d=>o.stop())},"Stop",8,WF),n.pnpProcessing.message!=""?(W(),ee("div",XF,[we(ze(n.pnpProcessing.message)+" ",1),this.pnpProcessing.runFlag==!1?(W(),ee("span",jF,[c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[54]||(e[54]=d=>o.findElement())},"Find Element in elements list"),c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[55]||(e[55]=d=>o.runFrom(this.pnpProcessing.element))},"Resume Job from this element")])):ot("",!0)])):ot("",!0)])])])],512),[[ln,s.tab==3]])])}var qF=ct(pI,[["render",YF]]);const ZF={props:{loading:Boolean}},KF={key:0,class:"loader-bg"},JF=c("div",{class:"loader-track"},[c("div",{class:"loader-fill"},"\xA0")],-1),QF=[JF];function eL(t,e,n,i,s,o){return n.loading?(W(),ee("div",KF,QF)):ot("",!0)}var tL=ct(ZF,[["render",eL]]);/** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT */const ad="176",Js={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Xs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},nL=0,Iu=1,iL=2,gp=1,sL=2,ci=3,$i=0,hn=1,On=2,zi=0,Qs=1,Fu=2,Lu=3,Uu=4,oL=5,ds=100,rL=101,aL=102,lL=103,cL=104,dL=200,uL=201,hL=202,fL=203,Jl=204,Ql=205,pL=206,mL=207,_L=208,gL=209,vL=210,bL=211,yL=212,xL=213,SL=214,ec=0,tc=1,nc=2,ro=3,ic=4,sc=5,oc=6,rc=7,ld=0,ML=1,EL=2,ki=0,wL=1,TL=2,CL=3,AL=4,PL=5,RL=6,DL=7,vp=300,ao=301,lo=302,ac=303,lc=304,za=306,cc=1e3,ps=1001,dc=1002,Vn=1003,IL=1004,Mr=1005,Zn=1006,el=1007,ms=1008,ti=1009,bp=1010,yp=1011,rr=1012,cd=1013,bs=1014,hi=1015,fr=1016,dd=1017,ud=1018,ar=1020,xp=35902,Sp=1021,Mp=1022,kn=1023,lr=1026,cr=1027,Ep=1028,hd=1029,wp=1030,fd=1031,pd=1033,ea=33776,ta=33777,na=33778,ia=33779,uc=35840,hc=35841,fc=35842,pc=35843,mc=36196,_c=37492,gc=37496,vc=37808,bc=37809,yc=37810,xc=37811,Sc=37812,Mc=37813,Ec=37814,wc=37815,Tc=37816,Cc=37817,Ac=37818,Pc=37819,Rc=37820,Dc=37821,sa=36492,Ic=36494,Fc=36495,Tp=36283,Lc=36284,Uc=36285,Oc=36286,FL=3200,LL=3201,Cp=0,UL=1,Li="",wn="srgb",co="srgb-linear",ma="linear",bt="srgb",As=7680,Ou=519,OL=512,NL=513,zL=514,Ap=515,kL=516,BL=517,VL=518,$L=519,Nu=35044,zu="300 es",fi=2e3,_a=2001;class Es{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners;if(i===void 0)return;const s=i[e];if(s!==void 0){const o=s.indexOf(n);o!==-1&&s.splice(o,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const i=n[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let o=0,r=s.length;o>8&255]+qt[t>>16&255]+qt[t>>24&255]+"-"+qt[e&255]+qt[e>>8&255]+"-"+qt[e>>16&15|64]+qt[e>>24&255]+"-"+qt[n&63|128]+qt[n>>8&255]+"-"+qt[n>>16&255]+qt[n>>24&255]+qt[i&255]+qt[i>>8&255]+qt[i>>16&255]+qt[i>>24&255]).toLowerCase()}function rt(t,e,n){return Math.max(e,Math.min(n,t))}function md(t,e){return(t%e+e)%e}function HL(t,e,n,i,s){return i+(t-e)*(s-i)/(n-e)}function GL(t,e,n){return t!==e?(n-t)/(e-t):0}function qo(t,e,n){return(1-n)*t+n*e}function WL(t,e,n,i){return qo(t,e,1-Math.exp(-n*i))}function XL(t,e=1){return e-Math.abs(md(t,e*2)-e)}function jL(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function YL(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function qL(t,e){return t+Math.floor(Math.random()*(e-t+1))}function ZL(t,e){return t+Math.random()*(e-t)}function KL(t){return t*(.5-Math.random())}function JL(t){t!==void 0&&(ku=t);let e=ku+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function QL(t){return t*Yo}function eU(t){return t*uo}function tU(t){return(t&t-1)===0&&t!==0}function nU(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function iU(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function sU(t,e,n,i,s){const o=Math.cos,r=Math.sin,a=o(n/2),l=r(n/2),d=o((e+i)/2),u=r((e+i)/2),f=o((e-i)/2),h=r((e-i)/2),m=o((i-e)/2),b=r((i-e)/2);switch(s){case"XYX":t.set(a*u,l*f,l*h,a*d);break;case"YZY":t.set(l*h,a*u,l*f,a*d);break;case"ZXZ":t.set(l*f,l*h,a*u,a*d);break;case"XZX":t.set(a*u,l*b,l*m,a*d);break;case"YXY":t.set(l*m,a*u,l*b,a*d);break;case"ZYZ":t.set(l*b,l*m,a*u,a*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function Ws(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function rn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const oU={DEG2RAD:Yo,RAD2DEG:uo,generateUUID:yo,clamp:rt,euclideanModulo:md,mapLinear:HL,inverseLerp:GL,lerp:qo,damp:WL,pingpong:XL,smoothstep:jL,smootherstep:YL,randInt:qL,randFloat:ZL,randFloatSpread:KL,seededRandom:JL,degToRad:QL,radToDeg:eU,isPowerOfTwo:tU,ceilPowerOfTwo:nU,floorPowerOfTwo:iU,setQuaternionFromProperEuler:sU,normalize:rn,denormalize:Ws};class Ke{constructor(e=0,n=0){Ke.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=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(rt(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),o=this.x-e.x,r=this.y-e.y;return this.x=o*i-r*s+e.x,this.y=o*s+r*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class tt{constructor(e,n,i,s,o,r,a,l,d){tt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,s,o,r,a,l,d)}set(e,n,i,s,o,r,a,l,d){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=n,u[4]=o,u[5]=l,u[6]=i,u[7]=r,u[8]=d,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,o=this.elements,r=i[0],a=i[3],l=i[6],d=i[1],u=i[4],f=i[7],h=i[2],m=i[5],b=i[8],y=s[0],_=s[3],p=s[6],T=s[1],w=s[4],S=s[7],I=s[2],P=s[5],D=s[8];return o[0]=r*y+a*T+l*I,o[3]=r*_+a*w+l*P,o[6]=r*p+a*S+l*D,o[1]=d*y+u*T+f*I,o[4]=d*_+u*w+f*P,o[7]=d*p+u*S+f*D,o[2]=h*y+m*T+b*I,o[5]=h*_+m*w+b*P,o[8]=h*p+m*S+b*D,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],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8];return n*r*u-n*a*d-i*o*u+i*a*l+s*o*d-s*r*l}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8],f=u*r-a*d,h=a*l-u*o,m=d*o-r*l,b=n*f+i*h+s*m;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/b;return e[0]=f*y,e[1]=(s*d-u*i)*y,e[2]=(a*i-s*r)*y,e[3]=h*y,e[4]=(u*n-s*l)*y,e[5]=(s*o-a*n)*y,e[6]=m*y,e[7]=(i*l-d*n)*y,e[8]=(r*n-i*o)*y,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,o,r,a){const l=Math.cos(o),d=Math.sin(o);return this.set(i*l,i*d,-i*(l*r+d*a)+r+e,-s*d,s*l,-s*(-d*r+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(tl.makeScale(e,n)),this}rotate(e){return this.premultiply(tl.makeRotation(-e)),this}translate(e,n){return this.premultiply(tl.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):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 tl=new tt;function Pp(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ga(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function rU(){const t=ga("canvas");return t.style.display="block",t}const Bu={};function oa(t){t in Bu||(Bu[t]=!0,console.warn(t))}function aU(t,e,n){return new Promise(function(i,s){function o(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:s();break;case t.TIMEOUT_EXPIRED:setTimeout(o,n);break;default:i()}}setTimeout(o,n)})}function lU(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function cU(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Vu=new tt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),$u=new tt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function dU(){const t={enabled:!0,workingColorSpace:co,spaces:{},convert:function(s,o,r){return this.enabled===!1||o===r||!o||!r||(this.spaces[o].transfer===bt&&(s.r=pi(s.r),s.g=pi(s.g),s.b=pi(s.b)),this.spaces[o].primaries!==this.spaces[r].primaries&&(s.applyMatrix3(this.spaces[o].toXYZ),s.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===bt&&(s.r=eo(s.r),s.g=eo(s.g),s.b=eo(s.b))),s},fromWorkingColorSpace:function(s,o){return this.convert(s,this.workingColorSpace,o)},toWorkingColorSpace:function(s,o){return this.convert(s,o,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Li?ma:this.spaces[s].transfer},getLuminanceCoefficients:function(s,o=this.workingColorSpace){return s.fromArray(this.spaces[o].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,o,r){return s.copy(this.spaces[o].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[co]:{primaries:e,whitePoint:i,transfer:ma,toXYZ:Vu,fromXYZ:$u,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:wn},outputColorSpaceConfig:{drawingBufferColorSpace:wn}},[wn]:{primaries:e,whitePoint:i,transfer:bt,toXYZ:Vu,fromXYZ:$u,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:wn}}}),t}const ft=dU();function pi(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function eo(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Ps;class uU{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Ps===void 0&&(Ps=ga("canvas")),Ps.width=e.width,Ps.height=e.height;const s=Ps.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=Ps}return i.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const n=ga("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),o=s.data;for(let r=0;r0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==vp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case cc:e.x=e.x-Math.floor(e.x);break;case ps:e.x=e.x<0?0:1;break;case dc: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 cc:e.y=e.y-Math.floor(e.y);break;case ps:e.y=e.y<0?0:1;break;case dc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}fn.DEFAULT_IMAGE=null;fn.DEFAULT_MAPPING=vp;fn.DEFAULT_ANISOTROPY=1;class It{constructor(e=0,n=0,i=0,s=1){It.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,o=this.w,r=e.elements;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.w=r[3]*n+r[7]*i+r[11]*s+r[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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,o;const l=e.elements,d=l[0],u=l[4],f=l[8],h=l[1],m=l[5],b=l[9],y=l[2],_=l[6],p=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-y)<.01&&Math.abs(b-_)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+y)<.1&&Math.abs(b+_)<.1&&Math.abs(d+m+p-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const w=(d+1)/2,S=(m+1)/2,I=(p+1)/2,P=(u+h)/4,D=(f+y)/4,R=(b+_)/4;return w>S&&w>I?w<.01?(i=0,s=.707106781,o=.707106781):(i=Math.sqrt(w),s=P/i,o=D/i):S>I?S<.01?(i=.707106781,s=0,o=.707106781):(s=Math.sqrt(S),i=P/s,o=R/s):I<.01?(i=.707106781,s=.707106781,o=0):(o=Math.sqrt(I),i=D/o,s=R/o),this.set(i,s,o,n),this}let T=Math.sqrt((_-b)*(_-b)+(f-y)*(f-y)+(h-u)*(h-u));return Math.abs(T)<.001&&(T=1),this.x=(_-b)/T,this.y=(f-y)/T,this.z=(h-u)/T,this.w=Math.acos((d+m+p-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this.z=rt(this.z,e.z,n.z),this.w=rt(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this.z=rt(this.z,e,n),this.w=rt(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,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 pU extends Es{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=i.depth?i.depth:1,this.scissor=new It(0,0,e,n),this.scissorTest=!1,this.viewport=new It(0,0,e,n);const s={width:e,height:n,depth:this.depth};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Zn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},i);const o=new fn(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);o.flipY=!1,o.generateMipmaps=i.generateMipmaps,o.internalFormat=i.internalFormat,this.textures=[];const r=i.count;for(let a=0;a=0?1:-1,w=1-p*p;if(w>Number.EPSILON){const I=Math.sqrt(w),P=Math.atan2(I,p*T);_=Math.sin(_*P)/I,a=Math.sin(a*P)/I}const S=a*T;if(l=l*_+h*S,d=d*_+m*S,u=u*_+b*S,f=f*_+y*S,_===1-a){const I=1/Math.sqrt(l*l+d*d+u*u+f*f);l*=I,d*=I,u*=I,f*=I}}e[n]=l,e[n+1]=d,e[n+2]=u,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,s,o,r){const a=i[s],l=i[s+1],d=i[s+2],u=i[s+3],f=o[r],h=o[r+1],m=o[r+2],b=o[r+3];return e[n]=a*b+u*f+l*m-d*h,e[n+1]=l*b+u*h+d*f-a*m,e[n+2]=d*b+u*m+a*h-l*f,e[n+3]=u*b-a*f-l*h-d*m,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=!0){const i=e._x,s=e._y,o=e._z,r=e._order,a=Math.cos,l=Math.sin,d=a(i/2),u=a(s/2),f=a(o/2),h=l(i/2),m=l(s/2),b=l(o/2);switch(r){case"XYZ":this._x=h*u*f+d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f-h*m*b;break;case"YXZ":this._x=h*u*f+d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f+h*m*b;break;case"ZXY":this._x=h*u*f-d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f-h*m*b;break;case"ZYX":this._x=h*u*f-d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f+h*m*b;break;case"YZX":this._x=h*u*f+d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f-h*m*b;break;case"XZY":this._x=h*u*f-d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f+h*m*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return n===!0&&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],o=n[8],r=n[1],a=n[5],l=n[9],d=n[2],u=n[6],f=n[10],h=i+a+f;if(h>0){const m=.5/Math.sqrt(h+1);this._w=.25/m,this._x=(u-l)*m,this._y=(o-d)*m,this._z=(r-s)*m}else if(i>a&&i>f){const m=2*Math.sqrt(1+i-a-f);this._w=(u-l)/m,this._x=.25*m,this._y=(s+r)/m,this._z=(o+d)/m}else if(a>f){const m=2*Math.sqrt(1+a-i-f);this._w=(o-d)/m,this._x=(s+r)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+f-i-a);this._w=(r-s)/m,this._x=(o+d)/m,this._y=(l+u)/m,this._z=.25*m}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(rt(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,o=e._z,r=e._w,a=n._x,l=n._y,d=n._z,u=n._w;return this._x=i*u+r*a+s*d-o*l,this._y=s*u+r*l+o*a-i*d,this._z=o*u+r*d+i*l-s*a,this._w=r*u-i*a-s*l-o*d,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,o=this._z,r=this._w;let a=r*e._w+i*e._x+s*e._y+o*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=r,this._x=i,this._y=s,this._z=o,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-n;return this._w=m*r+n*this._w,this._x=m*i+n*this._x,this._y=m*s+n*this._y,this._z=m*o+n*this._z,this.normalize(),this}const d=Math.sqrt(l),u=Math.atan2(d,a),f=Math.sin((1-n)*u)/d,h=Math.sin(n*u)/d;return this._w=r*f+this._w*h,this._x=i*f+this._x*h,this._y=s*f+this._y*h,this._z=o*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),o=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),o*Math.sin(n),o*Math.cos(n))}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._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class L{constructor(e=0,n=0,i=0){L.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(Hu.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Hu.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,s=this.z,o=e.elements;return this.x=o[0]*n+o[3]*i+o[6]*s,this.y=o[1]*n+o[4]*i+o[7]*s,this.z=o[2]*n+o[5]*i+o[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,o=e.elements,r=1/(o[3]*n+o[7]*i+o[11]*s+o[15]);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}applyQuaternion(e){const n=this.x,i=this.y,s=this.z,o=e.x,r=e.y,a=e.z,l=e.w,d=2*(r*s-a*i),u=2*(a*n-o*s),f=2*(o*i-r*n);return this.x=n+l*d+r*f-a*u,this.y=i+l*u+a*d-o*f,this.z=s+l*f+o*u-r*d,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,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*s,this.y=o[1]*n+o[5]*i+o[9]*s,this.z=o[2]*n+o[6]*i+o[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=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this.z=rt(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this.z=rt(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,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,o=e.z,r=n.x,a=n.y,l=n.z;return this.x=s*l-o*a,this.y=o*r-i*l,this.z=i*a-s*r,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 il.copy(this).projectOnVector(e),this.sub(il)}reflect(e){return this.sub(il.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(rt(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()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const il=new L,Hu=new Xt;class pr{constructor(e=new L(1/0,1/0,1/0),n=new L(-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;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Rn),Rn.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(Co),wr.subVectors(this.max,Co),Rs.subVectors(e.a,Co),Ds.subVectors(e.b,Co),Is.subVectors(e.c,Co),Si.subVectors(Ds,Rs),Mi.subVectors(Is,Ds),Ki.subVectors(Rs,Is);let n=[0,-Si.z,Si.y,0,-Mi.z,Mi.y,0,-Ki.z,Ki.y,Si.z,0,-Si.x,Mi.z,0,-Mi.x,Ki.z,0,-Ki.x,-Si.y,Si.x,0,-Mi.y,Mi.x,0,-Ki.y,Ki.x,0];return!sl(n,Rs,Ds,Is,wr)||(n=[1,0,0,0,1,0,0,0,1],!sl(n,Rs,Ds,Is,wr))?!1:(Tr.crossVectors(Si,Mi),n=[Tr.x,Tr.y,Tr.z],sl(n,Rs,Ds,Is,wr))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Rn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Rn).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:(ii[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ii[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ii[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ii[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ii[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ii[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ii[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ii[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ii),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 ii=[new L,new L,new L,new L,new L,new L,new L,new L],Rn=new L,Er=new pr,Rs=new L,Ds=new L,Is=new L,Si=new L,Mi=new L,Ki=new L,Co=new L,wr=new L,Tr=new L,Ji=new L;function sl(t,e,n,i,s){for(let o=0,r=t.length-3;o<=r;o+=3){Ji.fromArray(t,o);const a=s.x*Math.abs(Ji.x)+s.y*Math.abs(Ji.y)+s.z*Math.abs(Ji.z),l=e.dot(Ji),d=n.dot(Ji),u=i.dot(Ji);if(Math.max(-Math.max(l,d,u),Math.min(l,d,u))>a)return!1}return!0}const _U=new pr,Ao=new L,ol=new L;class ka{constructor(e=new L,n=-1){this.isSphere=!0,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):_U.setFromPoints(e).getCenter(i);let s=0;for(let o=0,r=e.length;othis.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;Ao.subVectors(e,this.center);const n=Ao.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(Ao,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):(ol.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ao.copy(e.center).add(ol)),this.expandByPoint(Ao.copy(e.center).sub(ol))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const si=new L,rl=new L,Cr=new L,Ei=new L,al=new L,Ar=new L,ll=new L;class Ba{constructor(e=new L,n=new L(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,si)),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=si.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(si.copy(this.origin).addScaledVector(this.direction,n),si.distanceToSquared(e))}distanceSqToSegment(e,n,i,s){rl.copy(e).add(n).multiplyScalar(.5),Cr.copy(n).sub(e).normalize(),Ei.copy(this.origin).sub(rl);const o=e.distanceTo(n)*.5,r=-this.direction.dot(Cr),a=Ei.dot(this.direction),l=-Ei.dot(Cr),d=Ei.lengthSq(),u=Math.abs(1-r*r);let f,h,m,b;if(u>0)if(f=r*l-a,h=r*a-l,b=o*u,f>=0)if(h>=-b)if(h<=b){const y=1/u;f*=y,h*=y,m=f*(f+r*h+2*a)+h*(r*f+h+2*l)+d}else h=o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;else h=-o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;else h<=-b?(f=Math.max(0,-(-r*o+a)),h=f>0?-o:Math.min(Math.max(-o,-l),o),m=-f*f+h*(h+2*l)+d):h<=b?(f=0,h=Math.min(Math.max(-o,-l),o),m=h*(h+2*l)+d):(f=Math.max(0,-(r*o+a)),h=f>0?o:Math.min(Math.max(-o,-l),o),m=-f*f+h*(h+2*l)+d);else h=r>0?-o:o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,f),s&&s.copy(rl).addScaledVector(Cr,h),m}intersectSphere(e,n){si.subVectors(e.center,this.origin);const i=si.dot(this.direction),s=si.dot(si)-i*i,o=e.radius*e.radius;if(s>o)return null;const r=Math.sqrt(o-s),a=i-r,l=i+r;return l<0?null:a<0?this.at(l,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,o,r,a,l;const d=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,h=this.origin;return d>=0?(i=(e.min.x-h.x)*d,s=(e.max.x-h.x)*d):(i=(e.max.x-h.x)*d,s=(e.min.x-h.x)*d),u>=0?(o=(e.min.y-h.y)*u,r=(e.max.y-h.y)*u):(o=(e.max.y-h.y)*u,r=(e.min.y-h.y)*u),i>r||o>s||((o>i||isNaN(i))&&(i=o),(r=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,n)}intersectsBox(e){return this.intersectBox(e,si)!==null}intersectTriangle(e,n,i,s,o){al.subVectors(n,e),Ar.subVectors(i,e),ll.crossVectors(al,Ar);let r=this.direction.dot(ll),a;if(r>0){if(s)return null;a=1}else if(r<0)a=-1,r=-r;else return null;Ei.subVectors(this.origin,e);const l=a*this.direction.dot(Ar.crossVectors(Ei,Ar));if(l<0)return null;const d=a*this.direction.dot(al.cross(Ei));if(d<0||l+d>r)return null;const u=-a*Ei.dot(ll);return u<0?null:this.at(u/r,o)}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 Tt{constructor(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_){Tt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_)}set(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_){const p=this.elements;return p[0]=e,p[4]=n,p[8]=i,p[12]=s,p[1]=o,p[5]=r,p[9]=a,p[13]=l,p[2]=d,p[6]=u,p[10]=f,p[14]=h,p[3]=m,p[7]=b,p[11]=y,p[15]=_,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 Tt().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/Fs.setFromMatrixColumn(e,0).length(),o=1/Fs.setFromMatrixColumn(e,1).length(),r=1/Fs.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]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[7]=0,n[8]=i[8]*r,n[9]=i[9]*r,n[10]=i[10]*r,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,o=e.z,r=Math.cos(i),a=Math.sin(i),l=Math.cos(s),d=Math.sin(s),u=Math.cos(o),f=Math.sin(o);if(e.order==="XYZ"){const h=r*u,m=r*f,b=a*u,y=a*f;n[0]=l*u,n[4]=-l*f,n[8]=d,n[1]=m+b*d,n[5]=h-y*d,n[9]=-a*l,n[2]=y-h*d,n[6]=b+m*d,n[10]=r*l}else if(e.order==="YXZ"){const h=l*u,m=l*f,b=d*u,y=d*f;n[0]=h+y*a,n[4]=b*a-m,n[8]=r*d,n[1]=r*f,n[5]=r*u,n[9]=-a,n[2]=m*a-b,n[6]=y+h*a,n[10]=r*l}else if(e.order==="ZXY"){const h=l*u,m=l*f,b=d*u,y=d*f;n[0]=h-y*a,n[4]=-r*f,n[8]=b+m*a,n[1]=m+b*a,n[5]=r*u,n[9]=y-h*a,n[2]=-r*d,n[6]=a,n[10]=r*l}else if(e.order==="ZYX"){const h=r*u,m=r*f,b=a*u,y=a*f;n[0]=l*u,n[4]=b*d-m,n[8]=h*d+y,n[1]=l*f,n[5]=y*d+h,n[9]=m*d-b,n[2]=-d,n[6]=a*l,n[10]=r*l}else if(e.order==="YZX"){const h=r*l,m=r*d,b=a*l,y=a*d;n[0]=l*u,n[4]=y-h*f,n[8]=b*f+m,n[1]=f,n[5]=r*u,n[9]=-a*u,n[2]=-d*u,n[6]=m*f+b,n[10]=h-y*f}else if(e.order==="XZY"){const h=r*l,m=r*d,b=a*l,y=a*d;n[0]=l*u,n[4]=-f,n[8]=d*u,n[1]=h*f+y,n[5]=r*u,n[9]=m*f-b,n[2]=b*f-m,n[6]=a*u,n[10]=y*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(gU,e,vU)}lookAt(e,n,i){const s=this.elements;return mn.subVectors(e,n),mn.lengthSq()===0&&(mn.z=1),mn.normalize(),wi.crossVectors(i,mn),wi.lengthSq()===0&&(Math.abs(i.z)===1?mn.x+=1e-4:mn.z+=1e-4,mn.normalize(),wi.crossVectors(i,mn)),wi.normalize(),Pr.crossVectors(mn,wi),s[0]=wi.x,s[4]=Pr.x,s[8]=mn.x,s[1]=wi.y,s[5]=Pr.y,s[9]=mn.y,s[2]=wi.z,s[6]=Pr.z,s[10]=mn.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,o=this.elements,r=i[0],a=i[4],l=i[8],d=i[12],u=i[1],f=i[5],h=i[9],m=i[13],b=i[2],y=i[6],_=i[10],p=i[14],T=i[3],w=i[7],S=i[11],I=i[15],P=s[0],D=s[4],R=s[8],E=s[12],g=s[1],F=s[5],O=s[9],$=s[13],j=s[2],re=s[6],q=s[10],ae=s[14],G=s[3],fe=s[7],ye=s[11],De=s[15];return o[0]=r*P+a*g+l*j+d*G,o[4]=r*D+a*F+l*re+d*fe,o[8]=r*R+a*O+l*q+d*ye,o[12]=r*E+a*$+l*ae+d*De,o[1]=u*P+f*g+h*j+m*G,o[5]=u*D+f*F+h*re+m*fe,o[9]=u*R+f*O+h*q+m*ye,o[13]=u*E+f*$+h*ae+m*De,o[2]=b*P+y*g+_*j+p*G,o[6]=b*D+y*F+_*re+p*fe,o[10]=b*R+y*O+_*q+p*ye,o[14]=b*E+y*$+_*ae+p*De,o[3]=T*P+w*g+S*j+I*G,o[7]=T*D+w*F+S*re+I*fe,o[11]=T*R+w*O+S*q+I*ye,o[15]=T*E+w*$+S*ae+I*De,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],o=e[12],r=e[1],a=e[5],l=e[9],d=e[13],u=e[2],f=e[6],h=e[10],m=e[14],b=e[3],y=e[7],_=e[11],p=e[15];return b*(+o*l*f-s*d*f-o*a*h+i*d*h+s*a*m-i*l*m)+y*(+n*l*m-n*d*h+o*r*h-s*r*m+s*d*u-o*l*u)+_*(+n*d*f-n*a*m-o*r*f+i*r*m+o*a*u-i*d*u)+p*(-s*a*u-n*l*f+n*a*h+s*r*f-i*r*h+i*l*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],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8],f=e[9],h=e[10],m=e[11],b=e[12],y=e[13],_=e[14],p=e[15],T=f*_*d-y*h*d+y*l*m-a*_*m-f*l*p+a*h*p,w=b*h*d-u*_*d-b*l*m+r*_*m+u*l*p-r*h*p,S=u*y*d-b*f*d+b*a*m-r*y*m-u*a*p+r*f*p,I=b*f*l-u*y*l-b*a*h+r*y*h+u*a*_-r*f*_,P=n*T+i*w+s*S+o*I;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/P;return e[0]=T*D,e[1]=(y*h*o-f*_*o-y*s*m+i*_*m+f*s*p-i*h*p)*D,e[2]=(a*_*o-y*l*o+y*s*d-i*_*d-a*s*p+i*l*p)*D,e[3]=(f*l*o-a*h*o-f*s*d+i*h*d+a*s*m-i*l*m)*D,e[4]=w*D,e[5]=(u*_*o-b*h*o+b*s*m-n*_*m-u*s*p+n*h*p)*D,e[6]=(b*l*o-r*_*o-b*s*d+n*_*d+r*s*p-n*l*p)*D,e[7]=(r*h*o-u*l*o+u*s*d-n*h*d-r*s*m+n*l*m)*D,e[8]=S*D,e[9]=(b*f*o-u*y*o-b*i*m+n*y*m+u*i*p-n*f*p)*D,e[10]=(r*y*o-b*a*o+b*i*d-n*y*d-r*i*p+n*a*p)*D,e[11]=(u*a*o-r*f*o-u*i*d+n*f*d+r*i*m-n*a*m)*D,e[12]=I*D,e[13]=(u*y*s-b*f*s+b*i*h-n*y*h-u*i*_+n*f*_)*D,e[14]=(b*a*s-r*y*s-b*i*l+n*y*l+r*i*_-n*a*_)*D,e[15]=(r*f*s-u*a*s+u*i*l-n*f*l-r*i*h+n*a*h)*D,this}scale(e){const n=this.elements,i=e.x,s=e.y,o=e.z;return n[0]*=i,n[4]*=s,n[8]*=o,n[1]*=i,n[5]*=s,n[9]*=o,n[2]*=i,n[6]*=s,n[10]*=o,n[3]*=i,n[7]*=s,n[11]*=o,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 e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,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),o=1-i,r=e.x,a=e.y,l=e.z,d=o*r,u=o*a;return this.set(d*r+i,d*a-s*l,d*l+s*a,0,d*a+s*l,u*a+i,u*l-s*r,0,d*l-s*a,u*l+s*r,o*l*l+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,o,r){return this.set(1,i,o,0,e,1,r,0,n,s,1,0,0,0,0,1),this}compose(e,n,i){const s=this.elements,o=n._x,r=n._y,a=n._z,l=n._w,d=o+o,u=r+r,f=a+a,h=o*d,m=o*u,b=o*f,y=r*u,_=r*f,p=a*f,T=l*d,w=l*u,S=l*f,I=i.x,P=i.y,D=i.z;return s[0]=(1-(y+p))*I,s[1]=(m+S)*I,s[2]=(b-w)*I,s[3]=0,s[4]=(m-S)*P,s[5]=(1-(h+p))*P,s[6]=(_+T)*P,s[7]=0,s[8]=(b+w)*D,s[9]=(_-T)*D,s[10]=(1-(h+y))*D,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 o=Fs.set(s[0],s[1],s[2]).length();const r=Fs.set(s[4],s[5],s[6]).length(),a=Fs.set(s[8],s[9],s[10]).length();this.determinant()<0&&(o=-o),e.x=s[12],e.y=s[13],e.z=s[14],Dn.copy(this);const d=1/o,u=1/r,f=1/a;return Dn.elements[0]*=d,Dn.elements[1]*=d,Dn.elements[2]*=d,Dn.elements[4]*=u,Dn.elements[5]*=u,Dn.elements[6]*=u,Dn.elements[8]*=f,Dn.elements[9]*=f,Dn.elements[10]*=f,n.setFromRotationMatrix(Dn),i.x=o,i.y=r,i.z=a,this}makePerspective(e,n,i,s,o,r,a=fi){const l=this.elements,d=2*o/(n-e),u=2*o/(i-s),f=(n+e)/(n-e),h=(i+s)/(i-s);let m,b;if(a===fi)m=-(r+o)/(r-o),b=-2*r*o/(r-o);else if(a===_a)m=-r/(r-o),b=-r*o/(r-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=d,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=b,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,i,s,o,r,a=fi){const l=this.elements,d=1/(n-e),u=1/(i-s),f=1/(r-o),h=(n+e)*d,m=(i+s)*u;let b,y;if(a===fi)b=(r+o)*f,y=-2*f;else if(a===_a)b=o*f,y=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*d,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=y,l[14]=-b,l[3]=0,l[7]=0,l[11]=0,l[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 Fs=new L,Dn=new Tt,gU=new L(0,0,0),vU=new L(1,1,1),wi=new L,Pr=new L,mn=new L,Gu=new Tt,Wu=new Xt;class $n{constructor(e=0,n=0,i=0,s=$n.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,o=s[0],r=s[4],a=s[8],l=s[1],d=s[5],u=s[9],f=s[2],h=s[6],m=s[10];switch(n){case"XYZ":this._y=Math.asin(rt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-r,o)):(this._x=Math.atan2(h,d),this._z=0);break;case"YXZ":this._x=Math.asin(-rt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,d)):(this._y=Math.atan2(-f,o),this._z=0);break;case"ZXY":this._x=Math.asin(rt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-r,d)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-rt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,m),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-r,d));break;case"YZX":this._z=Math.asin(rt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,d),this._y=Math.atan2(-f,o)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-rt(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(h,d),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-u,m),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 Gu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Gu,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Wu.setFromEuler(this),this.setFromQuaternion(Wu,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}}$n.DEFAULT_ORDER="XYZ";class gd{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&&(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())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?{min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}:void 0,boundingSphere:a.boundingSphere?{radius:a.boundingSphere.radius,center:a.boundingSphere.center.toArray()}:void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()}));function o(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.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=o(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let d=0,u=l.length;d0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),d.length>0&&(i.textures=d),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),m.length>0&&(i.animations=m),b.length>0&&(i.nodes=b)}return i.object=s,i;function r(a){const l=[];for(const d in a){const u=a[d];delete u.metadata,l.push(u)}return l}}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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(o)):s.set(0,0,0)}static getBarycoord(e,n,i,s,o){In.subVectors(s,n),ri.subVectors(i,n),dl.subVectors(e,n);const r=In.dot(In),a=In.dot(ri),l=In.dot(dl),d=ri.dot(ri),u=ri.dot(dl),f=r*d-a*a;if(f===0)return o.set(0,0,0),null;const h=1/f,m=(d*l-a*u)*h,b=(r*u-a*l)*h;return o.set(1-m-b,b,m)}static containsPoint(e,n,i,s){return this.getBarycoord(e,n,i,s,ai)===null?!1:ai.x>=0&&ai.y>=0&&ai.x+ai.y<=1}static getInterpolation(e,n,i,s,o,r,a,l){return this.getBarycoord(e,n,i,s,ai)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(o,ai.x),l.addScaledVector(r,ai.y),l.addScaledVector(a,ai.z),l)}static getInterpolatedAttribute(e,n,i,s,o,r){return pl.setScalar(0),ml.setScalar(0),_l.setScalar(0),pl.fromBufferAttribute(e,n),ml.fromBufferAttribute(e,i),_l.fromBufferAttribute(e,s),r.setScalar(0),r.addScaledVector(pl,o.x),r.addScaledVector(ml,o.y),r.addScaledVector(_l,o.z),r}static isFrontFacing(e,n,i,s){return In.subVectors(i,n),ri.subVectors(e,n),In.cross(ri).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 In.subVectors(this.c,this.b),ri.subVectors(this.a,this.b),In.cross(ri).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Nn.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,s,o){return Nn.getInterpolation(e,this.a,this.b,this.c,n,i,s,o)}containsPoint(e){return Nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Nn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,s=this.b,o=this.c;let r,a;Os.subVectors(s,i),Ns.subVectors(o,i),ul.subVectors(e,i);const l=Os.dot(ul),d=Ns.dot(ul);if(l<=0&&d<=0)return n.copy(i);hl.subVectors(e,s);const u=Os.dot(hl),f=Ns.dot(hl);if(u>=0&&f<=u)return n.copy(s);const h=l*f-u*d;if(h<=0&&l>=0&&u<=0)return r=l/(l-u),n.copy(i).addScaledVector(Os,r);fl.subVectors(e,o);const m=Os.dot(fl),b=Ns.dot(fl);if(b>=0&&m<=b)return n.copy(o);const y=m*d-l*b;if(y<=0&&d>=0&&b<=0)return a=d/(d-b),n.copy(i).addScaledVector(Ns,a);const _=u*b-m*f;if(_<=0&&f-u>=0&&m-b>=0)return Ku.subVectors(o,s),a=(f-u)/(f-u+(m-b)),n.copy(s).addScaledVector(Ku,a);const p=1/(_+y+h);return r=y*p,a=h*p,n.copy(i).addScaledVector(Os,r).addScaledVector(Ns,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Dp={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},Ti={h:0,s:0,l:0},Dr={h:0,s:0,l:0};function gl(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 lt{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=wn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ft.toWorkingColorSpace(this,n),this}setRGB(e,n,i,s=ft.workingColorSpace){return this.r=e,this.g=n,this.b=i,ft.toWorkingColorSpace(this,s),this}setHSL(e,n,i,s=ft.workingColorSpace){if(e=md(e,1),n=rt(n,0,1),i=rt(i,0,1),n===0)this.r=this.g=this.b=i;else{const o=i<=.5?i*(1+n):i+n-i*n,r=2*i-o;this.r=gl(r,o,e+1/3),this.g=gl(r,o,e),this.b=gl(r,o,e-1/3)}return ft.toWorkingColorSpace(this,s),this}setStyle(e,n=wn){function i(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const r=s[1],a=s[2];switch(r){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,n);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,n);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=s[1],r=o.length;if(r===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,n);if(r===6)return this.setHex(parseInt(o,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=wn){const i=Dp[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=pi(e.r),this.g=pi(e.g),this.b=pi(e.b),this}copyLinearToSRGB(e){return this.r=eo(e.r),this.g=eo(e.g),this.b=eo(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=wn){return ft.fromWorkingColorSpace(Zt.copy(this),e),Math.round(rt(Zt.r*255,0,255))*65536+Math.round(rt(Zt.g*255,0,255))*256+Math.round(rt(Zt.b*255,0,255))}getHexString(e=wn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=ft.workingColorSpace){ft.fromWorkingColorSpace(Zt.copy(this),n);const i=Zt.r,s=Zt.g,o=Zt.b,r=Math.max(i,s,o),a=Math.min(i,s,o);let l,d;const u=(a+r)/2;if(a===r)l=0,d=0;else{const f=r-a;switch(d=u<=.5?f/(r+a):f/(2-r-a),r){case i:l=(s-o)/f+(s0!=e>0&&this.version++,this._alphaTest=e}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.6,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!==void 0&&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.dispersion!==void 0&&(i.dispersion=this.dispersion),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.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.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.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),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!==Qs&&(i.blending=this.blending),this.side!==$i&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Jl&&(i.blendSrc=this.blendSrc),this.blendDst!==Ql&&(i.blendDst=this.blendDst),this.blendEquation!==ds&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==ro&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Ou&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==As&&(i.stencilFail=this.stencilFail),this.stencilZFail!==As&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==As&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),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.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),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=!0),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(o){const r=[];for(const a in o){const l=o[a];delete l.metadata,r.push(l)}return r}if(n){const o=s(e.textures),r=s(e.images);o.length>0&&(i.textures=o),r.length>0&&(i.images=r)}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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let i=null;if(n!==null){const s=n.length;i=new Array(s);for(let o=0;o!==s;++o)i[o]=n[o].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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Va extends ws{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new lt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new $n,this.combine=ld,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ut=new L,Ir=new Ke;let EU=0;class Qn{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:EU++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=Nu,this.updateRanges=[],this.gpuType=hi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let s=0,o=this.itemSize;sn.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pr);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new L(-1/0,-1/0,-1/0),new L(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,s=n.length;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const d in l)l[d]!==void 0&&(e[d]=l[d]);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 l in i){const d=i[l];e.data.attributes[l]=d.toJSON(e.data)}const s={};let o=!1;for(const l in this.morphAttributes){const d=this.morphAttributes[l],u=[];for(let f=0,h=d.length;f0&&(s[l]=u,o=!0)}o&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));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());const s=e.attributes;for(const d in s){const u=s[d];this.setAttribute(d,u.clone(n))}const o=e.morphAttributes;for(const d in o){const u=[],f=o[d];for(let h=0,m=f.length;h0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,r=s.length;o(e.far-e.near)**2))&&(Ju.copy(o).invert(),Qi.copy(e.ray).applyMatrix4(Ju),!(i.boundingBox!==null&&Qi.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,Qi)))}_computeIntersections(e,n,i){let s;const o=this.geometry,r=this.material,a=o.index,l=o.attributes.position,d=o.attributes.uv,u=o.attributes.uv1,f=o.attributes.normal,h=o.groups,m=o.drawRange;if(a!==null)if(Array.isArray(r))for(let b=0,y=h.length;bn.far?null:{distance:d,point:zr.clone(),object:t}}function kr(t,e,n,i,s,o,r,a,l,d){t.getVertexPosition(a,Lr),t.getVertexPosition(l,Ur),t.getVertexPosition(d,Or);const u=TU(t,e,n,i,Lr,Ur,Or,eh);if(u){const f=new L;Nn.getBarycoord(eh,Lr,Ur,Or,f),s&&(u.uv=Nn.getInterpolatedAttribute(s,a,l,d,f,new Ke)),o&&(u.uv1=Nn.getInterpolatedAttribute(o,a,l,d,f,new Ke)),r&&(u.normal=Nn.getInterpolatedAttribute(r,a,l,d,f,new L),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c:d,normal:new L,materialIndex:0};Nn.getNormal(Lr,Ur,Or,h.normal),u.face=h,u.barycoord=f}return u}class Ot extends tn{constructor(e=1,n=1,i=1,s=1,o=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:s,heightSegments:o,depthSegments:r};const a=this;s=Math.floor(s),o=Math.floor(o),r=Math.floor(r);const l=[],d=[],u=[],f=[];let h=0,m=0;b("z","y","x",-1,-1,i,n,e,r,o,0),b("z","y","x",1,-1,i,n,-e,r,o,1),b("x","z","y",1,1,e,i,n,s,r,2),b("x","z","y",1,-1,e,i,-n,s,r,3),b("x","y","z",1,-1,e,n,i,s,o,4),b("x","y","z",-1,-1,e,n,-i,s,o,5),this.setIndex(l),this.setAttribute("position",new Et(d,3)),this.setAttribute("normal",new Et(u,3)),this.setAttribute("uv",new Et(f,2));function b(y,_,p,T,w,S,I,P,D,R,E){const g=S/D,F=I/R,O=S/2,$=I/2,j=P/2,re=D+1,q=R+1;let ae=0,G=0;const fe=new L;for(let ye=0;ye0?1:-1,u.push(fe.x,fe.y,fe.z),f.push(Be/D),f.push(1-ye/R),ae+=1}}for(let ye=0;ye0&&(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 Up extends Nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt,this.coordinateSystem=fi}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ci=new L,th=new Ke,nh=new Ke;class gn extends Up{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=uo*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Yo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return uo*2*Math.atan(Math.tan(Yo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,i){Ci.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ci.x,Ci.y).multiplyScalar(-e/Ci.z),Ci.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Ci.x,Ci.y).multiplyScalar(-e/Ci.z)}getViewSize(e,n){return this.getViewBounds(e,th,nh),n.subVectors(nh,th)}setViewOffset(e,n,i,s,o,r){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=o,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Yo*.5*this.fov)/this.zoom,i=2*n,s=this.aspect*i,o=-.5*s;const r=this.view;if(this.view!==null&&this.view.enabled){const l=r.fullWidth,d=r.fullHeight;o+=r.offsetX*s/l,n-=r.offsetY*i/d,s*=r.width/l,i*=r.height/d}const a=this.filmOffset;a!==0&&(o+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+s,n,n-i,e,this.far,this.coordinateSystem),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 ks=-90,Bs=1;class DU extends Nt{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new gn(ks,Bs,e,n);s.layers=this.layers,this.add(s);const o=new gn(ks,Bs,e,n);o.layers=this.layers,this.add(o);const r=new gn(ks,Bs,e,n);r.layers=this.layers,this.add(r);const a=new gn(ks,Bs,e,n);a.layers=this.layers,this.add(a);const l=new gn(ks,Bs,e,n);l.layers=this.layers,this.add(l);const d=new gn(ks,Bs,e,n);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,s,o,r,a,l]=n;for(const d of n)this.remove(d);if(e===fi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===_a)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of n)this.add(d),d.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,r,a,l,d,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const y=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(n,o),e.setRenderTarget(i,1,s),e.render(n,r),e.setRenderTarget(i,2,s),e.render(n,a),e.setRenderTarget(i,3,s),e.render(n,l),e.setRenderTarget(i,4,s),e.render(n,d),i.texture.generateMipmaps=y,e.setRenderTarget(i,5,s),e.render(n,u),e.setRenderTarget(f,h,m),e.xr.enabled=b,i.texture.needsPMREMUpdate=!0}}class Op extends fn{constructor(e=[],n=ao,i,s,o,r,a,l,d,u){super(e,n,i,s,o,r,a,l,d,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class IU extends ys{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];this.texture=new Op(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:Zn}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; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},s=new Ot(5,5,5),o=new Hi({name:"CubemapFromEquirect",uniforms:ho(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:hn,blending:zi});o.uniforms.tEquirect.value=n;const r=new Pe(s,o),a=n.minFilter;return n.minFilter===ms&&(n.minFilter=Zn),new DU(1,10,this).update(e,r),n.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,n=!0,i=!0,s=!0){const o=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(n,i,s);e.setRenderTarget(o)}}class Oo extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const FU={type:"move"};class yl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Oo,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 Oo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Oo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),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,o=null,r=null;const a=this._targetRay,l=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){r=!0;for(const y of e.hand.values()){const _=n.getJointPose(y,i),p=this._getHandJoint(d,y);_!==null&&(p.matrix.fromArray(_.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=_.radius),p.visible=_!==null}const u=d.joints["index-finger-tip"],f=d.joints["thumb-tip"],h=u.position.distanceTo(f.position),m=.02,b=.005;d.inputState.pinching&&h>m+b?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&h<=m-b&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(o=n.getPose(e.gripSpace,i),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=n.getPose(e.targetRaySpace,i),s===null&&o!==null&&(s=o),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(FU)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=o!==null),d!==null&&(d.visible=r!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Oo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class LU extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new $n,this.environmentIntensity=1,this.environmentRotation=new $n,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__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,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const 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.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const xl=new L,UU=new L,OU=new tt;class Ii{constructor(e=new L(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=xl.subVectors(i,n).cross(UU.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(xl),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/s;return o<0||o>1?null:n.copy(e.start).addScaledVector(i,o)}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||OU.getNormalMatrix(e),s=this.coplanarPoint(xl).applyMatrix4(e),o=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(o),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 es=new ka,Br=new L;class vd{constructor(e=new Ii,n=new Ii,i=new Ii,s=new Ii,o=new Ii,r=new Ii){this.planes=[e,n,i,s,o,r]}set(e,n,i,s,o,r){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(s),a[4].copy(o),a[5].copy(r),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=fi){const i=this.planes,s=e.elements,o=s[0],r=s[1],a=s[2],l=s[3],d=s[4],u=s[5],f=s[6],h=s[7],m=s[8],b=s[9],y=s[10],_=s[11],p=s[12],T=s[13],w=s[14],S=s[15];if(i[0].setComponents(l-o,h-d,_-m,S-p).normalize(),i[1].setComponents(l+o,h+d,_+m,S+p).normalize(),i[2].setComponents(l+r,h+u,_+b,S+T).normalize(),i[3].setComponents(l-r,h-u,_-b,S-T).normalize(),i[4].setComponents(l-a,h-f,_-y,S-w).normalize(),n===fi)i[5].setComponents(l+a,h+f,_+y,S+w).normalize();else if(n===_a)i[5].setComponents(a,f,y,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),es.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),es.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(es)}intersectsSprite(e){return es.center.set(0,0,0),es.radius=.7071067811865476,es.applyMatrix4(e.matrixWorld),this.intersectsSphere(es)}intersectsSphere(e){const n=this.planes,i=e.center,s=-e.radius;for(let o=0;o<6;o++)if(n[o].distanceToPoint(i)0?e.max.x:e.min.x,Br.y=s.normal.y>0?e.max.y:e.min.y,Br.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(Br)<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)}}class mr extends ws{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new lt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const va=new L,ba=new L,ih=new Tt,Do=new Ba,Vr=new ka,Sl=new L,sh=new L;class di extends Nt{constructor(e=new tn,n=new mr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let s=1,o=n.count;s0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,r=s.length;oi)return;Sl.applyMatrix4(t.matrixWorld);const d=e.ray.origin.distanceTo(Sl);if(!(de.far))return{distance:d,point:sh.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:t}}const oh=new L,rh=new L;class bd extends di{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[];for(let s=0,o=n.count;s0&&w(!0),n>0&&w(!1)),this.setIndex(u),this.setAttribute("position",new Et(f,3)),this.setAttribute("normal",new Et(h,3)),this.setAttribute("uv",new Et(m,2));function T(){const S=new L,I=new L;let P=0;const D=(n-e)/i;for(let R=0;R<=o;R++){const E=[],g=R/o,F=g*(n-e)+e;for(let O=0;O<=s;O++){const $=O/s,j=$*l+a,re=Math.sin(j),q=Math.cos(j);I.x=F*re,I.y=-g*i+_,I.z=F*q,f.push(I.x,I.y,I.z),S.set(re,D,q).normalize(),h.push(S.x,S.y,S.z),m.push($,1-g),E.push(b++)}y.push(E)}for(let R=0;R0||E!==0)&&(u.push(g,F,$),P+=3),(n>0||E!==o-1)&&(u.push(F,O,$),P+=3)}d.addGroup(p,P,0),p+=P}function w(S){const I=b,P=new Ke,D=new L;let R=0;const E=S===!0?e:n,g=S===!0?1:-1;for(let O=1;O<=s;O++)f.push(0,_*g,0),h.push(0,g,0),m.push(.5,.5),b++;const F=b;for(let O=0;O<=s;O++){const j=O/s*l+a,re=Math.cos(j),q=Math.sin(j);D.x=E*q,D.y=_*g,D.z=E*re,f.push(D.x,D.y,D.z),h.push(0,g,0),P.x=re*.5+.5,P.y=q*.5*g+.5,m.push(P.x,P.y),b++}for(let O=0;O.9&&D<.1&&(w<.2&&(r[T+0]+=1),S<.2&&(r[T+2]+=1),I<.2&&(r[T+4]+=1))}}function h(T){o.push(T.x,T.y,T.z)}function m(T,w){const S=T*3;w.x=e[S+0],w.y=e[S+1],w.z=e[S+2]}function b(){const T=new L,w=new L,S=new L,I=new L,P=new Ke,D=new Ke,R=new Ke;for(let E=0,g=0;E0)&&m.push(w,S,P),(p!==i-1||lm.start-b.start);let h=0;for(let m=1;m 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; float clipOpacity = 1.0; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); if ( clipOpacity == 0.0 ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES float unionClipOpacity = 1.0; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); } #pragma unroll_loop_end clipOpacity *= 1.0 - unionClipOpacity; #endif diffuseColor.a *= clipOpacity; if ( diffuseColor.a == 0.0 ) discard; #else #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif #endif`,pO=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,mO=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,_O=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,gO=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,vO=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,bO=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; #endif`,yO=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; #endif`,xO=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 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 ); } 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`,SO=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define cubeUV_r0 1.0 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,MO=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING mat3 bm = mat3( batchingMatrix ); transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); transformedNormal = bm * transformedNormal; #ifdef USE_TANGENT transformedTangent = bm * transformedTangent; #endif #endif #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); transformedNormal = im * transformedNormal; #ifdef USE_TANGENT transformedTangent = im * transformedTangent; #endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,EO=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,wO=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,TO=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE emissiveColor = sRGBTransferEOTF( emissiveColor ); #endif totalEmissiveRadiance *= emissiveColor.rgb; #endif`,CO=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,AO="gl_FragColor = linearToOutputTexel( gl_FragColor );",PO=`vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferEOTF( in vec4 value ) { return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); } vec4 sRGBTransferOETF( 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 ); }`,RO=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,DO=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,IO=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,FO=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,LO=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,UO=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,OO=`#ifdef USE_FOG varying float vFogDepth; #endif`,NO=`#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`,zO=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,kO=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else 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 }`,BO=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,VO=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,$O=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,HO=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,GO=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif`,WO=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,XO=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,jO=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,YO=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,qO=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_DISPERSION material.dispersion = dispersion; #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); if( material.anisotropy == 0.0 ) { anisotropyV = vec2( 1.0, 0.0 ); } else { anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); } material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif`,ZO=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; float dispersion; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return saturate(v); } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColor; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #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 ); }`,KO=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,JO=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,QO=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,eN=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,tN=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,nN=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; #endif`,iN=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #endif`,sN=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; #endif`,oN=`#ifdef USE_MAP uniform sampler2D map; #endif`,rN=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,aN=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,lN=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,cN=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,dN=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } #endif`,uN=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,hN=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #endif`,fN=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; #endif uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #endif`,pN=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #endif`,mN=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,_N=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,gN=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,vN=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,bN=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,yN=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif`,xN=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,SN=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,MN=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif`,EN=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,wN=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,TN=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; const float Inv255 = 1. / 255.; const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); vec4 packDepthToRGBA( const in float v ) { if( v <= 0.0 ) return vec4( 0., 0., 0., 0. ); if( v >= 1.0 ) return vec4( 1., 1., 1., 1. ); float vuf; float af = modf( v * PackFactors.a, vuf ); float bf = modf( vuf * ShiftRight8, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); } vec3 packDepthToRGB( const in float v ) { if( v <= 0.0 ) return vec3( 0., 0., 0. ); if( v >= 1.0 ) return vec3( 1., 1., 1. ); float vuf; float bf = modf( v * PackFactors.b, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec3( vuf * Inv255, gf * PackUpscale, bf ); } vec2 packDepthToRG( const in float v ) { if( v <= 0.0 ) return vec2( 0., 0. ); if( v >= 1.0 ) return vec2( 1., 1. ); float vuf; float gf = modf( v * 256., vuf ); return vec2( vuf * Inv255, gf ); } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors4 ); } float unpackRGBToDepth( const in vec3 v ) { return dot( v, UnpackFactors3 ); } float unpackRGToDepth( const in vec2 v ) { return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; } vec4 pack2HalfToRGBA( const in vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( const in vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { return depth * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); }`,CN=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,AN=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,PN=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,RN=`#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`,DN=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,IN=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,FN=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return mix( 1.0, shadow, shadowIntensity ); } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec3 lightToPosition = shadowCoord.xyz; float lightToPositionLength = length( lightToPosition ); if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; shadow = ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } return mix( 1.0, shadow, shadowIntensity ); } #endif`,LN=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,UN=`#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 #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif`,ON=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,NN=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,zN=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; int j = int( i ) * 4; int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif`,kN=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,BN=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,VN=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,$N=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,HN=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,GN=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 CineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) ); vec3 agxDefaultContrastApprox( vec3 x ) { vec3 x2 = x * x; vec3 x4 = x2 * x2; return + 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232; } vec3 AgXToneMapping( vec3 color ) { const mat3 AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) ); const mat3 AgXOutsetMatrix = mat3( vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) ); const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; color *= toneMappingExposure; color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; color = AgXInsetMatrix * color; color = max( color, 1e-10 ); color = log2( color ); color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); color = clamp( color, 0.0, 1.0 ); color = agxDefaultContrastApprox( color ); color = AgXOutsetMatrix * color; color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); color = LINEAR_REC2020_TO_LINEAR_SRGB * color; color = clamp( color, 0.0, 1.0 ); return color; } vec3 NeutralToneMapping( vec3 color ) { const float StartCompression = 0.8 - 0.04; const float Desaturation = 0.15; color *= toneMappingExposure; float x = min( color.r, min( color.g, color.b ) ); float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; color -= offset; float peak = max( color.r, max( color.g, color.b ) ); if ( peak < StartCompression ) return color; float d = 1. - StartCompression; float newPeak = 1. - d * d / ( peak + d - StartCompression ); color *= newPeak / peak; float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,WN=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,XN=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return vec3( 1.0 ); } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec4 transmittedLight; vec3 transmittance; #ifdef USE_DISPERSION float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); for ( int i = 0; i < 3; i ++ ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); transmittedLight[ i ] = transmissionSample[ i ]; transmittedLight.a += transmissionSample.a; transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; } transmittedLight.a /= 3.0; #else vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); #endif vec3 attenuatedColor = transmittance * transmittedLight.rgb; vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif`,jN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,YN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,qN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,ZN=`#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_BATCHING worldPosition = batchingMatrix * worldPosition; #endif #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`;const KN=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,JN=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,QN=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,ez=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,tz=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,nz=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include }`,iz=`#include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,sz=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { vec4 diffuseColor = vec4( 1.0 ); #include #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #elif DEPTH_PACKING == 3202 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif }`,oz=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,rz=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include #include void main () { vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,az=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,lz=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,cz=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include #include }`,dz=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,uz=`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,hz=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,fz=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,pz=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,mz=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,_z=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,gz=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif }`,vz=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,bz=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,yz=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,xz=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,Sz=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_DISPERSION uniform float dispersion; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,Mz=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,Ez=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,wz=`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,Tz=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,Cz=`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,Az=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,Pz=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix[ 3 ]; vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,Rz=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,it={alphahash_fragment:JU,alphahash_pars_fragment:QU,alphamap_fragment:eO,alphamap_pars_fragment:tO,alphatest_fragment:nO,alphatest_pars_fragment:iO,aomap_fragment:sO,aomap_pars_fragment:oO,batching_pars_vertex:rO,batching_vertex:aO,begin_vertex:lO,beginnormal_vertex:cO,bsdfs:dO,iridescence_fragment:uO,bumpmap_pars_fragment:hO,clipping_planes_fragment:fO,clipping_planes_pars_fragment:pO,clipping_planes_pars_vertex:mO,clipping_planes_vertex:_O,color_fragment:gO,color_pars_fragment:vO,color_pars_vertex:bO,color_vertex:yO,common:xO,cube_uv_reflection_fragment:SO,defaultnormal_vertex:MO,displacementmap_pars_vertex:EO,displacementmap_vertex:wO,emissivemap_fragment:TO,emissivemap_pars_fragment:CO,colorspace_fragment:AO,colorspace_pars_fragment:PO,envmap_fragment:RO,envmap_common_pars_fragment:DO,envmap_pars_fragment:IO,envmap_pars_vertex:FO,envmap_physical_pars_fragment:GO,envmap_vertex:LO,fog_vertex:UO,fog_pars_vertex:OO,fog_fragment:NO,fog_pars_fragment:zO,gradientmap_pars_fragment:kO,lightmap_pars_fragment:BO,lights_lambert_fragment:VO,lights_lambert_pars_fragment:$O,lights_pars_begin:HO,lights_toon_fragment:WO,lights_toon_pars_fragment:XO,lights_phong_fragment:jO,lights_phong_pars_fragment:YO,lights_physical_fragment:qO,lights_physical_pars_fragment:ZO,lights_fragment_begin:KO,lights_fragment_maps:JO,lights_fragment_end:QO,logdepthbuf_fragment:eN,logdepthbuf_pars_fragment:tN,logdepthbuf_pars_vertex:nN,logdepthbuf_vertex:iN,map_fragment:sN,map_pars_fragment:oN,map_particle_fragment:rN,map_particle_pars_fragment:aN,metalnessmap_fragment:lN,metalnessmap_pars_fragment:cN,morphinstance_vertex:dN,morphcolor_vertex:uN,morphnormal_vertex:hN,morphtarget_pars_vertex:fN,morphtarget_vertex:pN,normal_fragment_begin:mN,normal_fragment_maps:_N,normal_pars_fragment:gN,normal_pars_vertex:vN,normal_vertex:bN,normalmap_pars_fragment:yN,clearcoat_normal_fragment_begin:xN,clearcoat_normal_fragment_maps:SN,clearcoat_pars_fragment:MN,iridescence_pars_fragment:EN,opaque_fragment:wN,packing:TN,premultiplied_alpha_fragment:CN,project_vertex:AN,dithering_fragment:PN,dithering_pars_fragment:RN,roughnessmap_fragment:DN,roughnessmap_pars_fragment:IN,shadowmap_pars_fragment:FN,shadowmap_pars_vertex:LN,shadowmap_vertex:UN,shadowmask_pars_fragment:ON,skinbase_vertex:NN,skinning_pars_vertex:zN,skinning_vertex:kN,skinnormal_vertex:BN,specularmap_fragment:VN,specularmap_pars_fragment:$N,tonemapping_fragment:HN,tonemapping_pars_fragment:GN,transmission_fragment:WN,transmission_pars_fragment:XN,uv_pars_fragment:jN,uv_pars_vertex:YN,uv_vertex:qN,worldpos_vertex:ZN,background_vert:KN,background_frag:JN,backgroundCube_vert:QN,backgroundCube_frag:ez,cube_vert:tz,cube_frag:nz,depth_vert:iz,depth_frag:sz,distanceRGBA_vert:oz,distanceRGBA_frag:rz,equirect_vert:az,equirect_frag:lz,linedashed_vert:cz,linedashed_frag:dz,meshbasic_vert:uz,meshbasic_frag:hz,meshlambert_vert:fz,meshlambert_frag:pz,meshmatcap_vert:mz,meshmatcap_frag:_z,meshnormal_vert:gz,meshnormal_frag:vz,meshphong_vert:bz,meshphong_frag:yz,meshphysical_vert:xz,meshphysical_frag:Sz,meshtoon_vert:Mz,meshtoon_frag:Ez,points_vert:wz,points_frag:Tz,shadow_vert:Cz,shadow_frag:Az,sprite_vert:Pz,sprite_frag:Rz},xe={common:{diffuse:{value:new lt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new tt}},envmap:{envMap:{value:null},envMapRotation:{value:new tt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new tt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new tt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new tt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new tt},normalScale:{value:new Ke(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new tt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new tt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new tt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new tt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new lt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new lt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0},uvTransform:{value:new tt}},sprite:{diffuse:{value:new lt(16777215)},opacity:{value:1},center:{value:new Ke(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}}},Yn={basic:{uniforms:an([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.fog]),vertexShader:it.meshbasic_vert,fragmentShader:it.meshbasic_frag},lambert:{uniforms:an([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new lt(0)}}]),vertexShader:it.meshlambert_vert,fragmentShader:it.meshlambert_frag},phong:{uniforms:an([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new lt(0)},specular:{value:new lt(1118481)},shininess:{value:30}}]),vertexShader:it.meshphong_vert,fragmentShader:it.meshphong_frag},standard:{uniforms:an([xe.common,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.roughnessmap,xe.metalnessmap,xe.fog,xe.lights,{emissive:{value:new lt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag},toon:{uniforms:an([xe.common,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.gradientmap,xe.fog,xe.lights,{emissive:{value:new lt(0)}}]),vertexShader:it.meshtoon_vert,fragmentShader:it.meshtoon_frag},matcap:{uniforms:an([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,{matcap:{value:null}}]),vertexShader:it.meshmatcap_vert,fragmentShader:it.meshmatcap_frag},points:{uniforms:an([xe.points,xe.fog]),vertexShader:it.points_vert,fragmentShader:it.points_frag},dashed:{uniforms:an([xe.common,xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:it.linedashed_vert,fragmentShader:it.linedashed_frag},depth:{uniforms:an([xe.common,xe.displacementmap]),vertexShader:it.depth_vert,fragmentShader:it.depth_frag},normal:{uniforms:an([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,{opacity:{value:1}}]),vertexShader:it.meshnormal_vert,fragmentShader:it.meshnormal_frag},sprite:{uniforms:an([xe.sprite,xe.fog]),vertexShader:it.sprite_vert,fragmentShader:it.sprite_frag},background:{uniforms:{uvTransform:{value:new tt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:it.background_vert,fragmentShader:it.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new tt}},vertexShader:it.backgroundCube_vert,fragmentShader:it.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:it.cube_vert,fragmentShader:it.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:it.equirect_vert,fragmentShader:it.equirect_frag},distanceRGBA:{uniforms:an([xe.common,xe.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:it.distanceRGBA_vert,fragmentShader:it.distanceRGBA_frag},shadow:{uniforms:an([xe.lights,xe.fog,{color:{value:new lt(0)},opacity:{value:1}}]),vertexShader:it.shadow_vert,fragmentShader:it.shadow_frag}};Yn.physical={uniforms:an([Yn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new tt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new tt},clearcoatNormalScale:{value:new Ke(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new tt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new tt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new tt},sheen:{value:0},sheenColor:{value:new lt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new tt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new tt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new tt},transmissionSamplerSize:{value:new Ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new tt},attenuationDistance:{value:0},attenuationColor:{value:new lt(0)},specularColor:{value:new lt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new tt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new tt},anisotropyVector:{value:new Ke},anisotropyMap:{value:null},anisotropyMapTransform:{value:new tt}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag};const Hr={r:0,b:0,g:0},ts=new $n,Dz=new Tt;function Iz(t,e,n,i,s,o,r){const a=new lt(0);let l=o===!0?0:1,d,u,f=null,h=0,m=null;function b(w){let S=w.isScene===!0?w.background:null;return S&&S.isTexture&&(S=(w.backgroundBlurriness>0?n:e).get(S)),S}function y(w){let S=!1;const I=b(w);I===null?p(a,l):I&&I.isColor&&(p(I,1),S=!0);const P=t.xr.getEnvironmentBlendMode();P==="additive"?i.buffers.color.setClear(0,0,0,1,r):P==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,r),(t.autoClear||S)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function _(w,S){const I=b(S);I&&(I.isCubeTexture||I.mapping===za)?(u===void 0&&(u=new Pe(new Ot(1,1,1),new Hi({name:"BackgroundCubeMaterial",uniforms:ho(Yn.backgroundCube.uniforms),vertexShader:Yn.backgroundCube.vertexShader,fragmentShader:Yn.backgroundCube.fragmentShader,side:hn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(P,D,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),ts.copy(S.backgroundRotation),ts.x*=-1,ts.y*=-1,ts.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(ts.y*=-1,ts.z*=-1),u.material.uniforms.envMap.value=I,u.material.uniforms.flipEnvMap.value=I.isCubeTexture&&I.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Dz.makeRotationFromEuler(ts)),u.material.toneMapped=ft.getTransfer(I.colorSpace)!==bt,(f!==I||h!==I.version||m!==t.toneMapping)&&(u.material.needsUpdate=!0,f=I,h=I.version,m=t.toneMapping),u.layers.enableAll(),w.unshift(u,u.geometry,u.material,0,0,null)):I&&I.isTexture&&(d===void 0&&(d=new Pe(new xo(2,2),new Hi({name:"BackgroundMaterial",uniforms:ho(Yn.background.uniforms),vertexShader:Yn.background.vertexShader,fragmentShader:Yn.background.fragmentShader,side:$i,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(d)),d.material.uniforms.t2D.value=I,d.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,d.material.toneMapped=ft.getTransfer(I.colorSpace)!==bt,I.matrixAutoUpdate===!0&&I.updateMatrix(),d.material.uniforms.uvTransform.value.copy(I.matrix),(f!==I||h!==I.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,f=I,h=I.version,m=t.toneMapping),d.layers.enableAll(),w.unshift(d,d.geometry,d.material,0,0,null))}function p(w,S){w.getRGB(Hr,Lp(t)),i.buffers.color.setClear(Hr.r,Hr.g,Hr.b,S,r)}function T(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0)}return{getClearColor:function(){return a},setClearColor:function(w,S=1){a.set(w),l=S,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(w){l=w,p(a,l)},render:y,addToRenderList:_,dispose:T}}function Fz(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},s=h(null);let o=s,r=!1;function a(g,F,O,$,j){let re=!1;const q=f($,O,F);o!==q&&(o=q,d(o.object)),re=m(g,$,O,j),re&&b(g,$,O,j),j!==null&&e.update(j,t.ELEMENT_ARRAY_BUFFER),(re||r)&&(r=!1,S(g,F,O,$),j!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return t.createVertexArray()}function d(g){return t.bindVertexArray(g)}function u(g){return t.deleteVertexArray(g)}function f(g,F,O){const $=O.wireframe===!0;let j=i[g.id];j===void 0&&(j={},i[g.id]=j);let re=j[F.id];re===void 0&&(re={},j[F.id]=re);let q=re[$];return q===void 0&&(q=h(l()),re[$]=q),q}function h(g){const F=[],O=[],$=[];for(let j=0;j=0){const ye=j[G];let De=re[G];if(De===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(De=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(De=g.instanceColor)),ye===void 0||ye.attribute!==De||De&&ye.data!==De.data)return!0;q++}return o.attributesNum!==q||o.index!==$}function b(g,F,O,$){const j={},re=F.attributes;let q=0;const ae=O.getAttributes();for(const G in ae)if(ae[G].location>=0){let ye=re[G];ye===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(ye=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(ye=g.instanceColor));const De={};De.attribute=ye,ye&&ye.data&&(De.data=ye.data),j[G]=De,q++}o.attributes=j,o.attributesNum=q,o.index=$}function y(){const g=o.newAttributes;for(let F=0,O=g.length;F=0){let fe=j[ae];if(fe===void 0&&(ae==="instanceMatrix"&&g.instanceMatrix&&(fe=g.instanceMatrix),ae==="instanceColor"&&g.instanceColor&&(fe=g.instanceColor)),fe!==void 0){const ye=fe.normalized,De=fe.itemSize,Be=e.get(fe);if(Be===void 0)continue;const Je=Be.buffer,ce=Be.type,N=Be.bytesPerElement,le=ce===t.INT||ce===t.UNSIGNED_INT||fe.gpuType===cd;if(fe.isInterleavedBufferAttribute){const Y=fe.data,ue=Y.stride,Oe=fe.offset;if(Y.isInstancedInterleavedBuffer){for(let Se=0;Se0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=n.precision!==void 0?n.precision:"highp";const u=l(d);u!==d&&(console.warn("THREE.WebGLRenderer:",d,"not supported, using",u,"instead."),d=u);const f=n.logarithmicDepthBuffer===!0,h=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),m=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=t.getParameter(t.MAX_TEXTURE_SIZE),_=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),T=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),w=t.getParameter(t.MAX_VARYING_VECTORS),S=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),I=b>0,P=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:l,textureFormatReadable:r,textureTypeReadable:a,precision:d,logarithmicDepthBuffer:f,reverseDepthBuffer:h,maxTextures:m,maxVertexTextures:b,maxTextureSize:y,maxCubemapSize:_,maxAttributes:p,maxVertexUniforms:T,maxVaryings:w,maxFragmentUniforms:S,vertexTextures:I,maxSamples:P}}function Oz(t){const e=this;let n=null,i=0,s=!1,o=!1;const r=new Ii,a=new tt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const m=f.length!==0||h||i!==0||s;return s=h,i=f.length,m},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(f,h){n=u(f,h,0)},this.setState=function(f,h,m){const b=f.clippingPlanes,y=f.clipIntersection,_=f.clipShadows,p=t.get(f);if(!s||b===null||b.length===0||o&&!_)o?u(null):d();else{const T=o?0:i,w=T*4;let S=p.clippingState||null;l.value=S,S=u(b,h,w,m);for(let I=0;I!==w;++I)S[I]=n[I];p.clippingState=S,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=T}};function d(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,h,m,b){const y=f!==null?f.length:0;let _=null;if(y!==0){if(_=l.value,b!==!0||_===null){const p=m+y*4,T=h.matrixWorldInverse;a.getNormalMatrix(T),(_===null||_.length0){const d=new IU(l.height);return d.fromEquirectangularTexture(t,r),e.set(r,d),r.addEventListener("dispose",s),n(d.texture,r.mapping)}else return null}}return r}function s(r){const a=r.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function o(){e=new WeakMap}return{get:i,dispose:o}}const Ys=4,fh=[.125,.215,.35,.446,.526,.582],hs=20,El=new GU,ph=new lt;let wl=null,Tl=0,Cl=0,Al=!1;const rs=(1+Math.sqrt(5))/2,Vs=1/rs,mh=[new L(-rs,Vs,0),new L(rs,Vs,0),new L(-Vs,0,rs),new L(Vs,0,rs),new L(0,rs,-Vs),new L(0,rs,Vs),new L(-1,1,-1),new L(1,1,-1),new L(-1,1,1),new L(1,1,1)],zz=new L;class _h{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,o={}){const{size:r=256,position:a=zz}=o;wl=this._renderer.getRenderTarget(),Tl=this._renderer.getActiveCubeFace(),Cl=this._renderer.getActiveMipmapLevel(),Al=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(r);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,s,l,a),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=bh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=vh(),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?S:0,S,S),f.setRenderTarget(s),_&&f.render(y,l),f.render(e,l)}y.geometry.dispose(),y.material.dispose(),f.toneMapping=m,f.autoClear=h,e.background=p}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===ao||e.mapping===lo;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=bh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=vh());const o=s?this._cubemapMaterial:this._equirectMaterial,r=new Pe(this._lodPlanes[0],o),a=o.uniforms;a.envMap.value=e;const l=this._cubeSize;Gr(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(r,El)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const s=this._lodPlanes.length;for(let o=1;ohs&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${hs}`);const p=[];let T=0;for(let D=0;Dw-Ys?s-w+Ys:0),P=4*(this._cubeSize-S);Gr(n,I,P,3*S,2*S),l.setRenderTarget(n),l.render(f,El)}}function kz(t){const e=[],n=[],i=[];let s=t;const o=t-Ys+1+fh.length;for(let r=0;rt-Ys?l=fh[r-t+Ys-1]:r===0&&(l=0),i.push(l);const d=1/(a-2),u=-d,f=1+d,h=[u,u,f,u,f,f,u,u,f,f,u,f],m=6,b=6,y=3,_=2,p=1,T=new Float32Array(y*b*m),w=new Float32Array(_*b*m),S=new Float32Array(p*b*m);for(let P=0;P2?0:-1,E=[D,R,0,D+2/3,R,0,D+2/3,R+1,0,D,R,0,D+2/3,R+1,0,D,R+1,0];T.set(E,y*b*P),w.set(h,_*b*P);const g=[P,P,P,P,P,P];S.set(g,p*b*P)}const I=new tn;I.setAttribute("position",new Qn(T,y)),I.setAttribute("uv",new Qn(w,_)),I.setAttribute("faceIndex",new Qn(S,p)),e.push(I),s>Ys&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function gh(t,e,n){const i=new ys(t,e,n);return i.texture.mapping=za,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Gr(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function Bz(t,e,n){const i=new Float32Array(hs),s=new L(0,1,0);return new Hi({name:"SphericalGaussianBlur",defines:{n:hs,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:Md(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:zi,depthTest:!1,depthWrite:!1})}function vh(){return new Hi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Md(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:zi,depthTest:!1,depthWrite:!1})}function bh(){return new Hi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Md(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:zi,depthTest:!1,depthWrite:!1})}function Md(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function Vz(t){let e=new WeakMap,n=null;function i(a){if(a&&a.isTexture){const l=a.mapping,d=l===ac||l===lc,u=l===ao||l===lo;if(d||u){let f=e.get(a);const h=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return n===null&&(n=new _h(t)),f=d?n.fromEquirectangular(a,f):n.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const m=a.image;return d&&m&&m.height>0||u&&m&&s(m)?(n===null&&(n=new _h(t)),f=d?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",o),f.texture):null}}}return a}function s(a){let l=0;const d=6;for(let u=0;ue.maxTextureSize&&(I=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const P=new Float32Array(S*I*4*f),D=new Rp(P,S,I,f);D.type=hi,D.needsUpdate=!0;const R=w*4;for(let g=0;g0)return t;const s=e*n;let o=xh[s];if(o===void 0&&(o=new Float32Array(s),xh[s]=o),e!==0){i.toArray(o,0);for(let r=1,a=0;r!==e;++r)a+=n,t[r].toArray(o,a)}return o}function Bt(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${a}: ${n[r]}`)}return i.join(` `)}const Ah=new tt;function Vk(t){ft._getMatrix(Ah,ft.workingColorSpace,t);const e=`mat3( ${Ah.elements.map(n=>n.toFixed(4))} )`;switch(ft.getTransfer(t)){case ma:return[e,"LinearTransferOETF"];case bt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Ph(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(i&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const r=parseInt(o[1]);return n.toUpperCase()+` `+s+` `+Bk(t.getShaderSource(e),r)}else return s}function $k(t,e){const n=Vk(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(` `)}function Hk(t,e){let n;switch(e){case wL:n="Linear";break;case TL:n="Reinhard";break;case CL:n="Cineon";break;case AL:n="ACESFilmic";break;case RL:n="AgX";break;case DL:n="Neutral";break;case PL:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Wr=new L;function Gk(){ft.getLuminanceCoefficients(Wr);const t=Wr.x.toFixed(4),e=Wr.y.toFixed(4),n=Wr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(` `)}function Wk(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(No).join(` `)}function Xk(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(` `)}function jk(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function zc(t){return t.replace(Yk,Zk)}const qk=new Map;function Zk(t,e){let n=it[e];if(n===void 0){const i=qk.get(e);if(i!==void 0)n=it[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return zc(n)}const Kk=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ih(t){return t.replace(Kk,Jk)}function Jk(t,e,n,i){let s="";for(let o=parseInt(e);o0&&(_+=` `),p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(No).join(` `),p.length>0&&(p+=` `)):(_=[Fh(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",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.alphaHash?"#define USE_ALPHAHASH":"",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.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",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&&n.flatShading===!1?"#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?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(No).join(` `),p=[Fh(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",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.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",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.alphaHash?"#define USE_ALPHAHASH":"",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&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#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 "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ki?"#define TONE_MAPPING":"",n.toneMapping!==ki?it.tonemapping_pars_fragment:"",n.toneMapping!==ki?Hk("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",it.colorspace_pars_fragment,$k("linearToOutputTexel",n.outputColorSpace),Gk(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` `].filter(No).join(` `)),r=zc(r),r=Rh(r,n),r=Dh(r,n),a=zc(a),a=Rh(a,n),a=Dh(a,n),r=Ih(r),a=Ih(a),n.isRawShaderMaterial!==!0&&(T=`#version 300 es `,_=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+_,p=["#define varying in",n.glslVersion===zu?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===zu?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` `+p);const w=T+_+r,S=T+p+a,I=Ch(s,s.VERTEX_SHADER,w),P=Ch(s,s.FRAGMENT_SHADER,S);s.attachShader(y,I),s.attachShader(y,P),n.index0AttributeName!==void 0?s.bindAttribLocation(y,0,n.index0AttributeName):n.morphTargets===!0&&s.bindAttribLocation(y,0,"position"),s.linkProgram(y);function D(F){if(t.debug.checkShaderErrors){const O=s.getProgramInfoLog(y).trim(),$=s.getShaderInfoLog(I).trim(),j=s.getShaderInfoLog(P).trim();let re=!0,q=!0;if(s.getProgramParameter(y,s.LINK_STATUS)===!1)if(re=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(s,y,I,P);else{const ae=Ph(s,I,"vertex"),G=Ph(s,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(y,s.VALIDATE_STATUS)+` Material Name: `+F.name+` Material Type: `+F.type+` Program Info Log: `+O+` `+ae+` `+G)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):($===""||j==="")&&(q=!1);q&&(F.diagnostics={runnable:re,programLog:O,vertexShader:{log:$,prefix:_},fragmentShader:{log:j,prefix:p}})}s.deleteShader(I),s.deleteShader(P),R=new ra(s,y),E=jk(s,y)}let R;this.getUniforms=function(){return R===void 0&&D(this),R};let E;this.getAttributes=function(){return E===void 0&&D(this),E};let g=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=s.getProgramParameter(y,zk)),g},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=kk++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=I,this.fragmentShader=P,this}let o4=0;class r4{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(n),o=this._getShaderStage(i),r=this._getShaderCacheForMaterial(e);return r.has(s)===!1&&(r.add(s),s.usedTimes++),r.has(o)===!1&&(r.add(o),o.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 a4(e),n.set(e,i)),i}}class a4{constructor(e){this.id=o4++,this.code=e,this.usedTimes=0}}function l4(t,e,n,i,s,o,r){const a=new gd,l=new r4,d=new Set,u=[],f=s.logarithmicDepthBuffer,h=s.vertexTextures;let m=s.precision;const b={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 y(E){return d.add(E),E===0?"uv":`uv${E}`}function _(E,g,F,O,$){const j=O.fog,re=$.geometry,q=E.isMeshStandardMaterial?O.environment:null,ae=(E.isMeshStandardMaterial?n:e).get(E.envMap||q),G=!!ae&&ae.mapping===za?ae.image.height:null,fe=b[E.type];E.precision!==null&&(m=s.getMaxPrecision(E.precision),m!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",m,"instead."));const ye=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,De=ye!==void 0?ye.length:0;let Be=0;re.morphAttributes.position!==void 0&&(Be=1),re.morphAttributes.normal!==void 0&&(Be=2),re.morphAttributes.color!==void 0&&(Be=3);let Je,ce,N,le;if(fe){const vt=Yn[fe];Je=vt.vertexShader,ce=vt.fragmentShader}else Je=E.vertexShader,ce=E.fragmentShader,l.update(E),N=l.getVertexShaderID(E),le=l.getFragmentShaderID(E);const Y=t.getRenderTarget(),ue=t.state.buffers.depth.getReversed(),Oe=$.isInstancedMesh===!0,Se=$.isBatchedMesh===!0,Ne=!!E.map,Le=!!E.matcap,A=!!ae,x=!!E.aoMap,Z=!!E.lightMap,ie=!!E.bumpMap,te=!!E.normalMap,ne=!!E.displacementMap,_e=!!E.emissiveMap,Q=!!E.metalnessMap,M=!!E.roughnessMap,v=E.anisotropy>0,U=E.clearcoat>0,B=E.dispersion>0,X=E.iridescence>0,H=E.sheen>0,ge=E.transmission>0,pe=v&&!!E.anisotropyMap,be=U&&!!E.clearcoatMap,Me=U&&!!E.clearcoatNormalMap,he=U&&!!E.clearcoatRoughnessMap,Ae=X&&!!E.iridescenceMap,Xe=X&&!!E.iridescenceThicknessMap,He=H&&!!E.sheenColorMap,Ie=H&&!!E.sheenRoughnessMap,Ye=!!E.specularMap,Ge=!!E.specularColorMap,gt=!!E.specularIntensityMap,z=ge&&!!E.transmissionMap,Te=ge&&!!E.thicknessMap,oe=!!E.gradientMap,de=!!E.alphaMap,Re=E.alphaTest>0,Ce=!!E.alphaHash,Qe=!!E.extensions;let Rt=ki;E.toneMapped&&(Y===null||Y.isXRRenderTarget===!0)&&(Rt=t.toneMapping);const Yt={shaderID:fe,shaderType:E.type,shaderName:E.name,vertexShader:Je,fragmentShader:ce,defines:E.defines,customVertexShaderID:N,customFragmentShaderID:le,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:m,batching:Se,batchingColor:Se&&$._colorsTexture!==null,instancing:Oe,instancingColor:Oe&&$.instanceColor!==null,instancingMorph:Oe&&$.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:Y===null?t.outputColorSpace:Y.isXRRenderTarget===!0?Y.texture.colorSpace:co,alphaToCoverage:!!E.alphaToCoverage,map:Ne,matcap:Le,envMap:A,envMapMode:A&&ae.mapping,envMapCubeUVHeight:G,aoMap:x,lightMap:Z,bumpMap:ie,normalMap:te,displacementMap:h&&ne,emissiveMap:_e,normalMapObjectSpace:te&&E.normalMapType===UL,normalMapTangentSpace:te&&E.normalMapType===Cp,metalnessMap:Q,roughnessMap:M,anisotropy:v,anisotropyMap:pe,clearcoat:U,clearcoatMap:be,clearcoatNormalMap:Me,clearcoatRoughnessMap:he,dispersion:B,iridescence:X,iridescenceMap:Ae,iridescenceThicknessMap:Xe,sheen:H,sheenColorMap:He,sheenRoughnessMap:Ie,specularMap:Ye,specularColorMap:Ge,specularIntensityMap:gt,transmission:ge,transmissionMap:z,thicknessMap:Te,gradientMap:oe,opaque:E.transparent===!1&&E.blending===Qs&&E.alphaToCoverage===!1,alphaMap:de,alphaTest:Re,alphaHash:Ce,combine:E.combine,mapUv:Ne&&y(E.map.channel),aoMapUv:x&&y(E.aoMap.channel),lightMapUv:Z&&y(E.lightMap.channel),bumpMapUv:ie&&y(E.bumpMap.channel),normalMapUv:te&&y(E.normalMap.channel),displacementMapUv:ne&&y(E.displacementMap.channel),emissiveMapUv:_e&&y(E.emissiveMap.channel),metalnessMapUv:Q&&y(E.metalnessMap.channel),roughnessMapUv:M&&y(E.roughnessMap.channel),anisotropyMapUv:pe&&y(E.anisotropyMap.channel),clearcoatMapUv:be&&y(E.clearcoatMap.channel),clearcoatNormalMapUv:Me&&y(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:he&&y(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Ae&&y(E.iridescenceMap.channel),iridescenceThicknessMapUv:Xe&&y(E.iridescenceThicknessMap.channel),sheenColorMapUv:He&&y(E.sheenColorMap.channel),sheenRoughnessMapUv:Ie&&y(E.sheenRoughnessMap.channel),specularMapUv:Ye&&y(E.specularMap.channel),specularColorMapUv:Ge&&y(E.specularColorMap.channel),specularIntensityMapUv:gt&&y(E.specularIntensityMap.channel),transmissionMapUv:z&&y(E.transmissionMap.channel),thicknessMapUv:Te&&y(E.thicknessMap.channel),alphaMapUv:de&&y(E.alphaMap.channel),vertexTangents:!!re.attributes.tangent&&(te||v),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,pointsUvs:$.isPoints===!0&&!!re.attributes.uv&&(Ne||de),fog:!!j,useFog:E.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:ue,skinning:$.isSkinnedMesh===!0,morphTargets:re.morphAttributes.position!==void 0,morphNormals:re.morphAttributes.normal!==void 0,morphColors:re.morphAttributes.color!==void 0,morphTargetsCount:De,morphTextureStride:Be,numDirLights:g.directional.length,numPointLights:g.point.length,numSpotLights:g.spot.length,numSpotLightMaps:g.spotLightMap.length,numRectAreaLights:g.rectArea.length,numHemiLights:g.hemi.length,numDirLightShadows:g.directionalShadowMap.length,numPointLightShadows:g.pointShadowMap.length,numSpotLightShadows:g.spotShadowMap.length,numSpotLightShadowsWithMaps:g.numSpotLightShadowsWithMaps,numLightProbes:g.numLightProbes,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:E.dithering,shadowMapEnabled:t.shadowMap.enabled&&F.length>0,shadowMapType:t.shadowMap.type,toneMapping:Rt,decodeVideoTexture:Ne&&E.map.isVideoTexture===!0&&ft.getTransfer(E.map.colorSpace)===bt,decodeVideoTextureEmissive:_e&&E.emissiveMap.isVideoTexture===!0&&ft.getTransfer(E.emissiveMap.colorSpace)===bt,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===On,flipSided:E.side===hn,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Qe&&E.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&E.extensions.multiDraw===!0||Se)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return Yt.vertexUv1s=d.has(1),Yt.vertexUv2s=d.has(2),Yt.vertexUv3s=d.has(3),d.clear(),Yt}function p(E){const g=[];if(E.shaderID?g.push(E.shaderID):(g.push(E.customVertexShaderID),g.push(E.customFragmentShaderID)),E.defines!==void 0)for(const F in E.defines)g.push(F),g.push(E.defines[F]);return E.isRawShaderMaterial===!1&&(T(g,E),w(g,E),g.push(t.outputColorSpace)),g.push(E.customProgramCacheKey),g.join()}function T(E,g){E.push(g.precision),E.push(g.outputColorSpace),E.push(g.envMapMode),E.push(g.envMapCubeUVHeight),E.push(g.mapUv),E.push(g.alphaMapUv),E.push(g.lightMapUv),E.push(g.aoMapUv),E.push(g.bumpMapUv),E.push(g.normalMapUv),E.push(g.displacementMapUv),E.push(g.emissiveMapUv),E.push(g.metalnessMapUv),E.push(g.roughnessMapUv),E.push(g.anisotropyMapUv),E.push(g.clearcoatMapUv),E.push(g.clearcoatNormalMapUv),E.push(g.clearcoatRoughnessMapUv),E.push(g.iridescenceMapUv),E.push(g.iridescenceThicknessMapUv),E.push(g.sheenColorMapUv),E.push(g.sheenRoughnessMapUv),E.push(g.specularMapUv),E.push(g.specularColorMapUv),E.push(g.specularIntensityMapUv),E.push(g.transmissionMapUv),E.push(g.thicknessMapUv),E.push(g.combine),E.push(g.fogExp2),E.push(g.sizeAttenuation),E.push(g.morphTargetsCount),E.push(g.morphAttributeCount),E.push(g.numDirLights),E.push(g.numPointLights),E.push(g.numSpotLights),E.push(g.numSpotLightMaps),E.push(g.numHemiLights),E.push(g.numRectAreaLights),E.push(g.numDirLightShadows),E.push(g.numPointLightShadows),E.push(g.numSpotLightShadows),E.push(g.numSpotLightShadowsWithMaps),E.push(g.numLightProbes),E.push(g.shadowMapType),E.push(g.toneMapping),E.push(g.numClippingPlanes),E.push(g.numClipIntersection),E.push(g.depthPacking)}function w(E,g){a.disableAll(),g.supportsVertexTextures&&a.enable(0),g.instancing&&a.enable(1),g.instancingColor&&a.enable(2),g.instancingMorph&&a.enable(3),g.matcap&&a.enable(4),g.envMap&&a.enable(5),g.normalMapObjectSpace&&a.enable(6),g.normalMapTangentSpace&&a.enable(7),g.clearcoat&&a.enable(8),g.iridescence&&a.enable(9),g.alphaTest&&a.enable(10),g.vertexColors&&a.enable(11),g.vertexAlphas&&a.enable(12),g.vertexUv1s&&a.enable(13),g.vertexUv2s&&a.enable(14),g.vertexUv3s&&a.enable(15),g.vertexTangents&&a.enable(16),g.anisotropy&&a.enable(17),g.alphaHash&&a.enable(18),g.batching&&a.enable(19),g.dispersion&&a.enable(20),g.batchingColor&&a.enable(21),E.push(a.mask),a.disableAll(),g.fog&&a.enable(0),g.useFog&&a.enable(1),g.flatShading&&a.enable(2),g.logarithmicDepthBuffer&&a.enable(3),g.reverseDepthBuffer&&a.enable(4),g.skinning&&a.enable(5),g.morphTargets&&a.enable(6),g.morphNormals&&a.enable(7),g.morphColors&&a.enable(8),g.premultipliedAlpha&&a.enable(9),g.shadowMapEnabled&&a.enable(10),g.doubleSided&&a.enable(11),g.flipSided&&a.enable(12),g.useDepthPacking&&a.enable(13),g.dithering&&a.enable(14),g.transmission&&a.enable(15),g.sheen&&a.enable(16),g.opaque&&a.enable(17),g.pointsUvs&&a.enable(18),g.decodeVideoTexture&&a.enable(19),g.decodeVideoTextureEmissive&&a.enable(20),g.alphaToCoverage&&a.enable(21),E.push(a.mask)}function S(E){const g=b[E.type];let F;if(g){const O=Yn[g];F=AU.clone(O.uniforms)}else F=E.uniforms;return F}function I(E,g){let F;for(let O=0,$=u.length;O<$;O++){const j=u[O];if(j.cacheKey===g){F=j,++F.usedTimes;break}}return F===void 0&&(F=new s4(t,g,E,o),u.push(F)),F}function P(E){if(--E.usedTimes===0){const g=u.indexOf(E);u[g]=u[u.length-1],u.pop(),E.destroy()}}function D(E){l.remove(E)}function R(){l.dispose()}return{getParameters:_,getProgramCacheKey:p,getUniforms:S,acquireProgram:I,releaseProgram:P,releaseShaderCache:D,programs:u,dispose:R}}function c4(){let t=new WeakMap;function e(r){return t.has(r)}function n(r){let a=t.get(r);return a===void 0&&(a={},t.set(r,a)),a}function i(r){t.delete(r)}function s(r,a,l){t.get(r)[a]=l}function o(){t=new WeakMap}return{has:e,get:n,remove:i,update:s,dispose:o}}function d4(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Lh(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Uh(){const t=[];let e=0;const n=[],i=[],s=[];function o(){e=0,n.length=0,i.length=0,s.length=0}function r(f,h,m,b,y,_){let p=t[e];return p===void 0?(p={id:f.id,object:f,geometry:h,material:m,groupOrder:b,renderOrder:f.renderOrder,z:y,group:_},t[e]=p):(p.id=f.id,p.object=f,p.geometry=h,p.material=m,p.groupOrder=b,p.renderOrder=f.renderOrder,p.z=y,p.group=_),e++,p}function a(f,h,m,b,y,_){const p=r(f,h,m,b,y,_);m.transmission>0?i.push(p):m.transparent===!0?s.push(p):n.push(p)}function l(f,h,m,b,y,_){const p=r(f,h,m,b,y,_);m.transmission>0?i.unshift(p):m.transparent===!0?s.unshift(p):n.unshift(p)}function d(f,h){n.length>1&&n.sort(f||d4),i.length>1&&i.sort(h||Lh),s.length>1&&s.sort(h||Lh)}function u(){for(let f=e,h=t.length;f=o.length?(r=new Uh,o.push(r)):r=o[s],r}function n(){t=new WeakMap}return{get:e,dispose:n}}function h4(){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 L,color:new lt};break;case"SpotLight":n={position:new L,direction:new L,color:new lt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new L,color:new lt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new L,skyColor:new lt,groundColor:new lt};break;case"RectAreaLight":n={color:new lt,position:new L,halfWidth:new L,halfHeight:new L};break}return t[e.id]=n,n}}}function f4(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let p4=0;function m4(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function _4(t){const e=new h4,n=f4(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new L);const s=new L,o=new Tt,r=new Tt;function a(d){let u=0,f=0,h=0;for(let E=0;E<9;E++)i.probe[E].set(0,0,0);let m=0,b=0,y=0,_=0,p=0,T=0,w=0,S=0,I=0,P=0,D=0;d.sort(m4);for(let E=0,g=d.length;E0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_FLOAT_1,i.rectAreaLTC2=xe.LTC_FLOAT_2):(i.rectAreaLTC1=xe.LTC_HALF_1,i.rectAreaLTC2=xe.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=h;const R=i.hash;(R.directionalLength!==m||R.pointLength!==b||R.spotLength!==y||R.rectAreaLength!==_||R.hemiLength!==p||R.numDirectionalShadows!==T||R.numPointShadows!==w||R.numSpotShadows!==S||R.numSpotMaps!==I||R.numLightProbes!==D)&&(i.directional.length=m,i.spot.length=y,i.rectArea.length=_,i.point.length=b,i.hemi.length=p,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=S,i.spotShadowMap.length=S,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=S+I-P,i.spotLightMap.length=I,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=D,R.directionalLength=m,R.pointLength=b,R.spotLength=y,R.rectAreaLength=_,R.hemiLength=p,R.numDirectionalShadows=T,R.numPointShadows=w,R.numSpotShadows=S,R.numSpotMaps=I,R.numLightProbes=D,i.version=p4++)}function l(d,u){let f=0,h=0,m=0,b=0,y=0;const _=u.matrixWorldInverse;for(let p=0,T=d.length;p=r.length?(a=new Oh(t),r.push(a)):a=r[o],a}function i(){e=new WeakMap}return{get:n,dispose:i}}const v4=`void main() { gl_Position = vec4( position, 1.0 ); }`,b4=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function y4(t,e,n){let i=new vd;const s=new Ke,o=new Ke,r=new It,a=new kU({depthPacking:LL}),l=new BU,d={},u=n.maxTextureSize,f={[$i]:hn,[hn]:$i,[On]:On},h=new Hi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ke},radius:{value:4}},vertexShader:v4,fragmentShader:b4}),m=h.clone();m.defines.HORIZONTAL_PASS=1;const b=new tn;b.setAttribute("position",new Qn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Pe(b,h),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=gp;let p=this.type;this.render=function(P,D,R){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||P.length===0)return;const E=t.getRenderTarget(),g=t.getActiveCubeFace(),F=t.getActiveMipmapLevel(),O=t.state;O.setBlending(zi),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const $=p!==ci&&this.type===ci,j=p===ci&&this.type!==ci;for(let re=0,q=P.length;reu||s.y>u)&&(s.x>u&&(o.x=Math.floor(u/fe.x),s.x=o.x*fe.x,G.mapSize.x=o.x),s.y>u&&(o.y=Math.floor(u/fe.y),s.y=o.y*fe.y,G.mapSize.y=o.y)),G.map===null||$===!0||j===!0){const De=this.type!==ci?{minFilter:Vn,magFilter:Vn}:{};G.map!==null&&G.map.dispose(),G.map=new ys(s.x,s.y,De),G.map.texture.name=ae.name+".shadowMap",G.camera.updateProjectionMatrix()}t.setRenderTarget(G.map),t.clear();const ye=G.getViewportCount();for(let De=0;De0||D.map&&D.alphaTest>0||D.alphaToCoverage===!0){const O=g.uuid,$=D.uuid;let j=d[O];j===void 0&&(j={},d[O]=j);let re=j[$];re===void 0&&(re=g.clone(),j[$]=re,D.addEventListener("dispose",I)),g=re}if(g.visible=D.visible,g.wireframe=D.wireframe,E===ci?g.side=D.shadowSide!==null?D.shadowSide:D.side:g.side=D.shadowSide!==null?D.shadowSide:f[D.side],g.alphaMap=D.alphaMap,g.alphaTest=D.alphaToCoverage===!0?.5:D.alphaTest,g.map=D.map,g.clipShadows=D.clipShadows,g.clippingPlanes=D.clippingPlanes,g.clipIntersection=D.clipIntersection,g.displacementMap=D.displacementMap,g.displacementScale=D.displacementScale,g.displacementBias=D.displacementBias,g.wireframeLinewidth=D.wireframeLinewidth,g.linewidth=D.linewidth,R.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const O=t.properties.get(g);O.light=R}return g}function S(P,D,R,E,g){if(P.visible===!1)return;if(P.layers.test(D.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&g===ci)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,P.matrixWorld);const $=e.update(P),j=P.material;if(Array.isArray(j)){const re=$.groups;for(let q=0,ae=re.length;q=1):G.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),q=ae>=2);let fe=null,ye={};const De=t.getParameter(t.SCISSOR_BOX),Be=t.getParameter(t.VIEWPORT),Je=new It().fromArray(De),ce=new It().fromArray(Be);function N(z,Te,oe,de){const Re=new Uint8Array(4),Ce=t.createTexture();t.bindTexture(z,Ce),t.texParameteri(z,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(z,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Qe=0;QeU||X.height>U)&&(B=U/Math.max(X.width,X.height)),B<1)if(typeof HTMLImageElement!="undefined"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&M instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&M instanceof ImageBitmap||typeof VideoFrame!="undefined"&&M instanceof VideoFrame){const H=Math.floor(B*X.width),ge=Math.floor(B*X.height);f===void 0&&(f=b(H,ge));const pe=v?b(H,ge):f;return pe.width=H,pe.height=ge,pe.getContext("2d").drawImage(M,0,0,H,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+H+"x"+ge+")."),pe}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),M;return M}function _(M){return M.generateMipmaps}function p(M){t.generateMipmap(M)}function T(M){return M.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:M.isWebGL3DRenderTarget?t.TEXTURE_3D:M.isWebGLArrayRenderTarget||M.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function w(M,v,U,B,X=!1){if(M!==null){if(t[M]!==void 0)return t[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let H=v;if(v===t.RED&&(U===t.FLOAT&&(H=t.R32F),U===t.HALF_FLOAT&&(H=t.R16F),U===t.UNSIGNED_BYTE&&(H=t.R8)),v===t.RED_INTEGER&&(U===t.UNSIGNED_BYTE&&(H=t.R8UI),U===t.UNSIGNED_SHORT&&(H=t.R16UI),U===t.UNSIGNED_INT&&(H=t.R32UI),U===t.BYTE&&(H=t.R8I),U===t.SHORT&&(H=t.R16I),U===t.INT&&(H=t.R32I)),v===t.RG&&(U===t.FLOAT&&(H=t.RG32F),U===t.HALF_FLOAT&&(H=t.RG16F),U===t.UNSIGNED_BYTE&&(H=t.RG8)),v===t.RG_INTEGER&&(U===t.UNSIGNED_BYTE&&(H=t.RG8UI),U===t.UNSIGNED_SHORT&&(H=t.RG16UI),U===t.UNSIGNED_INT&&(H=t.RG32UI),U===t.BYTE&&(H=t.RG8I),U===t.SHORT&&(H=t.RG16I),U===t.INT&&(H=t.RG32I)),v===t.RGB_INTEGER&&(U===t.UNSIGNED_BYTE&&(H=t.RGB8UI),U===t.UNSIGNED_SHORT&&(H=t.RGB16UI),U===t.UNSIGNED_INT&&(H=t.RGB32UI),U===t.BYTE&&(H=t.RGB8I),U===t.SHORT&&(H=t.RGB16I),U===t.INT&&(H=t.RGB32I)),v===t.RGBA_INTEGER&&(U===t.UNSIGNED_BYTE&&(H=t.RGBA8UI),U===t.UNSIGNED_SHORT&&(H=t.RGBA16UI),U===t.UNSIGNED_INT&&(H=t.RGBA32UI),U===t.BYTE&&(H=t.RGBA8I),U===t.SHORT&&(H=t.RGBA16I),U===t.INT&&(H=t.RGBA32I)),v===t.RGB&&U===t.UNSIGNED_INT_5_9_9_9_REV&&(H=t.RGB9_E5),v===t.RGBA){const ge=X?ma:ft.getTransfer(B);U===t.FLOAT&&(H=t.RGBA32F),U===t.HALF_FLOAT&&(H=t.RGBA16F),U===t.UNSIGNED_BYTE&&(H=ge===bt?t.SRGB8_ALPHA8:t.RGBA8),U===t.UNSIGNED_SHORT_4_4_4_4&&(H=t.RGBA4),U===t.UNSIGNED_SHORT_5_5_5_1&&(H=t.RGB5_A1)}return(H===t.R16F||H===t.R32F||H===t.RG16F||H===t.RG32F||H===t.RGBA16F||H===t.RGBA32F)&&e.get("EXT_color_buffer_float"),H}function S(M,v){let U;return M?v===null||v===bs||v===ar?U=t.DEPTH24_STENCIL8:v===hi?U=t.DEPTH32F_STENCIL8:v===rr&&(U=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===bs||v===ar?U=t.DEPTH_COMPONENT24:v===hi?U=t.DEPTH_COMPONENT32F:v===rr&&(U=t.DEPTH_COMPONENT16),U}function I(M,v){return _(M)===!0||M.isFramebufferTexture&&M.minFilter!==Vn&&M.minFilter!==Zn?Math.log2(Math.max(v.width,v.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?v.mipmaps.length:1}function P(M){const v=M.target;v.removeEventListener("dispose",P),R(v),v.isVideoTexture&&u.delete(v)}function D(M){const v=M.target;v.removeEventListener("dispose",D),g(v)}function R(M){const v=i.get(M);if(v.__webglInit===void 0)return;const U=M.source,B=h.get(U);if(B){const X=B[v.__cacheKey];X.usedTimes--,X.usedTimes===0&&E(M),Object.keys(B).length===0&&h.delete(U)}i.remove(M)}function E(M){const v=i.get(M);t.deleteTexture(v.__webglTexture);const U=M.source,B=h.get(U);delete B[v.__cacheKey],r.memory.textures--}function g(M){const v=i.get(M);if(M.depthTexture&&(M.depthTexture.dispose(),i.remove(M.depthTexture)),M.isWebGLCubeRenderTarget)for(let B=0;B<6;B++){if(Array.isArray(v.__webglFramebuffer[B]))for(let X=0;X=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+s.maxTextures),F+=1,M}function j(M){const v=[];return v.push(M.wrapS),v.push(M.wrapT),v.push(M.wrapR||0),v.push(M.magFilter),v.push(M.minFilter),v.push(M.anisotropy),v.push(M.internalFormat),v.push(M.format),v.push(M.type),v.push(M.generateMipmaps),v.push(M.premultiplyAlpha),v.push(M.flipY),v.push(M.unpackAlignment),v.push(M.colorSpace),v.join()}function re(M,v){const U=i.get(M);if(M.isVideoTexture&&ne(M),M.isRenderTargetTexture===!1&&M.version>0&&U.__version!==M.version){const B=M.image;if(B===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(B.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ce(U,M,v);return}}n.bindTexture(t.TEXTURE_2D,U.__webglTexture,t.TEXTURE0+v)}function q(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){ce(U,M,v);return}n.bindTexture(t.TEXTURE_2D_ARRAY,U.__webglTexture,t.TEXTURE0+v)}function ae(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){ce(U,M,v);return}n.bindTexture(t.TEXTURE_3D,U.__webglTexture,t.TEXTURE0+v)}function G(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){N(U,M,v);return}n.bindTexture(t.TEXTURE_CUBE_MAP,U.__webglTexture,t.TEXTURE0+v)}const fe={[cc]:t.REPEAT,[ps]:t.CLAMP_TO_EDGE,[dc]:t.MIRRORED_REPEAT},ye={[Vn]:t.NEAREST,[IL]:t.NEAREST_MIPMAP_NEAREST,[Mr]:t.NEAREST_MIPMAP_LINEAR,[Zn]:t.LINEAR,[el]:t.LINEAR_MIPMAP_NEAREST,[ms]:t.LINEAR_MIPMAP_LINEAR},De={[OL]:t.NEVER,[$L]:t.ALWAYS,[NL]:t.LESS,[Ap]:t.LEQUAL,[zL]:t.EQUAL,[VL]:t.GEQUAL,[kL]:t.GREATER,[BL]:t.NOTEQUAL};function Be(M,v){if(v.type===hi&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===Zn||v.magFilter===el||v.magFilter===Mr||v.magFilter===ms||v.minFilter===Zn||v.minFilter===el||v.minFilter===Mr||v.minFilter===ms)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(M,t.TEXTURE_WRAP_S,fe[v.wrapS]),t.texParameteri(M,t.TEXTURE_WRAP_T,fe[v.wrapT]),(M===t.TEXTURE_3D||M===t.TEXTURE_2D_ARRAY)&&t.texParameteri(M,t.TEXTURE_WRAP_R,fe[v.wrapR]),t.texParameteri(M,t.TEXTURE_MAG_FILTER,ye[v.magFilter]),t.texParameteri(M,t.TEXTURE_MIN_FILTER,ye[v.minFilter]),v.compareFunction&&(t.texParameteri(M,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(M,t.TEXTURE_COMPARE_FUNC,De[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Vn||v.minFilter!==Mr&&v.minFilter!==ms||v.type===hi&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||i.get(v).__currentAnisotropy){const U=e.get("EXT_texture_filter_anisotropic");t.texParameterf(M,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,s.getMaxAnisotropy())),i.get(v).__currentAnisotropy=v.anisotropy}}}function Je(M,v){let U=!1;M.__webglInit===void 0&&(M.__webglInit=!0,v.addEventListener("dispose",P));const B=v.source;let X=h.get(B);X===void 0&&(X={},h.set(B,X));const H=j(v);if(H!==M.__cacheKey){X[H]===void 0&&(X[H]={texture:t.createTexture(),usedTimes:0},r.memory.textures++,U=!0),X[H].usedTimes++;const ge=X[M.__cacheKey];ge!==void 0&&(X[M.__cacheKey].usedTimes--,ge.usedTimes===0&&E(v)),M.__cacheKey=H,M.__webglTexture=X[H].texture}return U}function ce(M,v,U){let B=t.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(B=t.TEXTURE_2D_ARRAY),v.isData3DTexture&&(B=t.TEXTURE_3D);const X=Je(M,v),H=v.source;n.bindTexture(B,M.__webglTexture,t.TEXTURE0+U);const ge=i.get(H);if(H.version!==ge.__version||X===!0){n.activeTexture(t.TEXTURE0+U);const pe=ft.getPrimaries(ft.workingColorSpace),be=v.colorSpace===Li?null:ft.getPrimaries(v.colorSpace),Me=v.colorSpace===Li||pe===be?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,v.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,v.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);let he=y(v.image,!1,s.maxTextureSize);he=_e(v,he);const Ae=o.convert(v.format,v.colorSpace),Xe=o.convert(v.type);let He=w(v.internalFormat,Ae,Xe,v.colorSpace,v.isVideoTexture);Be(B,v);let Ie;const Ye=v.mipmaps,Ge=v.isVideoTexture!==!0,gt=ge.__version===void 0||X===!0,z=H.dataReady,Te=I(v,he);if(v.isDepthTexture)He=S(v.format===cr,v.type),gt&&(Ge?n.texStorage2D(t.TEXTURE_2D,1,He,he.width,he.height):n.texImage2D(t.TEXTURE_2D,0,He,he.width,he.height,0,Ae,Xe,null));else if(v.isDataTexture)if(Ye.length>0){Ge&>&&n.texStorage2D(t.TEXTURE_2D,Te,He,Ye[0].width,Ye[0].height);for(let oe=0,de=Ye.length;oe0){const Re=hh(Ie.width,Ie.height,v.format,v.type);for(const Ce of v.layerUpdates){const Qe=Ie.data.subarray(Ce*Re/Ie.data.BYTES_PER_ELEMENT,(Ce+1)*Re/Ie.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,Ce,Ie.width,Ie.height,1,Ae,Qe)}v.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,0,Ie.width,Ie.height,he.depth,Ae,Ie.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,oe,He,Ie.width,Ie.height,he.depth,0,Ie.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ge?z&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,0,Ie.width,Ie.height,he.depth,Ae,Xe,Ie.data):n.texImage3D(t.TEXTURE_2D_ARRAY,oe,He,Ie.width,Ie.height,he.depth,0,Ae,Xe,Ie.data)}else{Ge&>&&n.texStorage2D(t.TEXTURE_2D,Te,He,Ye[0].width,Ye[0].height);for(let oe=0,de=Ye.length;oe0){const oe=hh(he.width,he.height,v.format,v.type);for(const de of v.layerUpdates){const Re=he.data.subarray(de*oe/he.data.BYTES_PER_ELEMENT,(de+1)*oe/he.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,de,he.width,he.height,1,Ae,Xe,Re)}v.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,he.width,he.height,he.depth,Ae,Xe,he.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,He,he.width,he.height,he.depth,0,Ae,Xe,he.data);else if(v.isData3DTexture)Ge?(gt&&n.texStorage3D(t.TEXTURE_3D,Te,He,he.width,he.height,he.depth),z&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,he.width,he.height,he.depth,Ae,Xe,he.data)):n.texImage3D(t.TEXTURE_3D,0,He,he.width,he.height,he.depth,0,Ae,Xe,he.data);else if(v.isFramebufferTexture){if(gt)if(Ge)n.texStorage2D(t.TEXTURE_2D,Te,He,he.width,he.height);else{let oe=he.width,de=he.height;for(let Re=0;Re>=1,de>>=1}}else if(Ye.length>0){if(Ge&>){const oe=Q(Ye[0]);n.texStorage2D(t.TEXTURE_2D,Te,He,oe.width,oe.height)}for(let oe=0,de=Ye.length;oe0&&Te++;const de=Q(Ae[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Te,Ye,de.width,de.height)}for(let de=0;de<6;de++)if(he){Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Ae[de].width,Ae[de].height,He,Ie,Ae[de].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,Ye,Ae[de].width,Ae[de].height,0,He,Ie,Ae[de].data);for(let Re=0;Re>H),Xe=Math.max(1,v.height>>H);X===t.TEXTURE_3D||X===t.TEXTURE_2D_ARRAY?n.texImage3D(X,H,be,Ae,Xe,v.depth,0,ge,pe,null):n.texImage2D(X,H,be,Ae,Xe,0,ge,pe,null)}n.bindFramebuffer(t.FRAMEBUFFER,M),te(v)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,B,X,he.__webglTexture,0,ie(v)):(X===t.TEXTURE_2D||X>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,B,X,he.__webglTexture,H),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Y(M,v,U){if(t.bindRenderbuffer(t.RENDERBUFFER,M),v.depthBuffer){const B=v.depthTexture,X=B&&B.isDepthTexture?B.type:null,H=S(v.stencilBuffer,X),ge=v.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,pe=ie(v);te(v)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,pe,H,v.width,v.height):U?t.renderbufferStorageMultisample(t.RENDERBUFFER,pe,H,v.width,v.height):t.renderbufferStorage(t.RENDERBUFFER,H,v.width,v.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,ge,t.RENDERBUFFER,M)}else{const B=v.textures;for(let X=0;X{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,B.removeEventListener("dispose",X)};B.addEventListener("dispose",X),v.__depthDisposeCallback=X}v.__boundDepthTexture=B}if(M.depthTexture&&!v.__autoAllocateDepthBuffer){if(U)throw new Error("target.depthTexture not supported in Cube render targets");const B=M.texture.mipmaps;B&&B.length>0?ue(v.__webglFramebuffer[0],M):ue(v.__webglFramebuffer,M)}else if(U){v.__webglDepthbuffer=[];for(let B=0;B<6;B++)if(n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer[B]),v.__webglDepthbuffer[B]===void 0)v.__webglDepthbuffer[B]=t.createRenderbuffer(),Y(v.__webglDepthbuffer[B],M,!1);else{const X=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,H=v.__webglDepthbuffer[B];t.bindRenderbuffer(t.RENDERBUFFER,H),t.framebufferRenderbuffer(t.FRAMEBUFFER,X,t.RENDERBUFFER,H)}}else{const B=M.texture.mipmaps;if(B&&B.length>0?n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=t.createRenderbuffer(),Y(v.__webglDepthbuffer,M,!1);else{const X=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,H=v.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,H),t.framebufferRenderbuffer(t.FRAMEBUFFER,X,t.RENDERBUFFER,H)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(M,v,U){const B=i.get(M);v!==void 0&&le(B.__webglFramebuffer,M,M.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),U!==void 0&&Oe(M)}function Ne(M){const v=M.texture,U=i.get(M),B=i.get(v);M.addEventListener("dispose",D);const X=M.textures,H=M.isWebGLCubeRenderTarget===!0,ge=X.length>1;if(ge||(B.__webglTexture===void 0&&(B.__webglTexture=t.createTexture()),B.__version=v.version,r.memory.textures++),H){U.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(v.mipmaps&&v.mipmaps.length>0){U.__webglFramebuffer[pe]=[];for(let be=0;be0){U.__webglFramebuffer=[];for(let pe=0;pe0&&te(M)===!1){U.__webglMultisampledFramebuffer=t.createFramebuffer(),U.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let pe=0;pe0)for(let be=0;be0)for(let be=0;be0){if(te(M)===!1){const v=M.textures,U=M.width,B=M.height;let X=t.COLOR_BUFFER_BIT;const H=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ge=i.get(M),pe=v.length>1;if(pe)for(let Me=0;Me0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let Me=0;Me0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function ne(M){const v=r.render.frame;u.get(M)!==v&&(u.set(M,v),M.update())}function _e(M,v){const U=M.colorSpace,B=M.format,X=M.type;return M.isCompressedTexture===!0||M.isVideoTexture===!0||U!==co&&U!==Li&&(ft.getTransfer(U)===bt?(B!==kn||X!==ti)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",U)),v}function Q(M){return typeof HTMLImageElement!="undefined"&&M instanceof HTMLImageElement?(d.width=M.naturalWidth||M.width,d.height=M.naturalHeight||M.height):typeof VideoFrame!="undefined"&&M instanceof VideoFrame?(d.width=M.displayWidth,d.height=M.displayHeight):(d.width=M.width,d.height=M.height),d}this.allocateTextureUnit=$,this.resetTextureUnits=O,this.setTexture2D=re,this.setTexture2DArray=q,this.setTexture3D=ae,this.setTextureCube=G,this.rebindTextures=Se,this.setupRenderTarget=Ne,this.updateRenderTargetMipmap=Le,this.updateMultisampleRenderTarget=Z,this.setupDepthRenderbuffer=Oe,this.setupFrameBufferTexture=le,this.useMultisampledRTT=te}function E4(t,e){function n(i,s=Li){let o;const r=ft.getTransfer(s);if(i===ti)return t.UNSIGNED_BYTE;if(i===dd)return t.UNSIGNED_SHORT_4_4_4_4;if(i===ud)return t.UNSIGNED_SHORT_5_5_5_1;if(i===xp)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===bp)return t.BYTE;if(i===yp)return t.SHORT;if(i===rr)return t.UNSIGNED_SHORT;if(i===cd)return t.INT;if(i===bs)return t.UNSIGNED_INT;if(i===hi)return t.FLOAT;if(i===fr)return t.HALF_FLOAT;if(i===Sp)return t.ALPHA;if(i===Mp)return t.RGB;if(i===kn)return t.RGBA;if(i===lr)return t.DEPTH_COMPONENT;if(i===cr)return t.DEPTH_STENCIL;if(i===Ep)return t.RED;if(i===hd)return t.RED_INTEGER;if(i===wp)return t.RG;if(i===fd)return t.RG_INTEGER;if(i===pd)return t.RGBA_INTEGER;if(i===ea||i===ta||i===na||i===ia)if(r===bt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(i===ea)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===ta)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===na)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ia)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(i===ea)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===ta)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===na)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ia)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===uc||i===hc||i===fc||i===pc)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(i===uc)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===hc)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===fc)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===pc)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===mc||i===_c||i===gc)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(i===mc||i===_c)return r===bt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(i===gc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===vc||i===bc||i===yc||i===xc||i===Sc||i===Mc||i===Ec||i===wc||i===Tc||i===Cc||i===Ac||i===Pc||i===Rc||i===Dc)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(i===vc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===bc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===yc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===xc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Sc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Mc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Ec)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===wc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Tc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Cc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Ac)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Pc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Rc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Dc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===sa||i===Ic||i===Fc)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(i===sa)return r===bt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ic)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Fc)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Tp||i===Lc||i===Uc||i===Oc)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(i===sa)return o.COMPRESSED_RED_RGTC1_EXT;if(i===Lc)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Uc)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Oc)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===ar?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const w4=` void main() { gl_Position = vec4( position, 1.0 ); }`,T4=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); if ( coord.x >= 1.0 ) { gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; } else { gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; } }`;class C4{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const s=new fn,o=e.properties.get(s);o.__webglTexture=n.texture,(n.depthNear!==i.depthNear||n.depthFar!==i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new Hi({vertexShader:w4,fragmentShader:T4,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Pe(new xo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class A4 extends Es{constructor(e,n){super();const i=this;let s=null,o=1,r=null,a="local-floor",l=1,d=null,u=null,f=null,h=null,m=null,b=null;const y=new C4,_=n.getContextAttributes();let p=null,T=null;const w=[],S=[],I=new Ke;let P=null;const D=new gn;D.viewport=new It;const R=new gn;R.viewport=new It;const E=[D,R],g=new XU;let F=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ce){let N=w[ce];return N===void 0&&(N=new yl,w[ce]=N),N.getTargetRaySpace()},this.getControllerGrip=function(ce){let N=w[ce];return N===void 0&&(N=new yl,w[ce]=N),N.getGripSpace()},this.getHand=function(ce){let N=w[ce];return N===void 0&&(N=new yl,w[ce]=N),N.getHandSpace()};function $(ce){const N=S.indexOf(ce.inputSource);if(N===-1)return;const le=w[N];le!==void 0&&(le.update(ce.inputSource,ce.frame,d||r),le.dispatchEvent({type:ce.type,data:ce.inputSource}))}function j(){s.removeEventListener("select",$),s.removeEventListener("selectstart",$),s.removeEventListener("selectend",$),s.removeEventListener("squeeze",$),s.removeEventListener("squeezestart",$),s.removeEventListener("squeezeend",$),s.removeEventListener("end",j),s.removeEventListener("inputsourceschange",re);for(let ce=0;ce=0&&(S[Y]=null,w[Y].disconnect(le))}for(let N=0;N=S.length){S.push(le),Y=Oe;break}else if(S[Oe]===null){S[Oe]=le,Y=Oe;break}if(Y===-1)break}const ue=w[Y];ue&&ue.connect(le)}}const q=new L,ae=new L;function G(ce,N,le){q.setFromMatrixPosition(N.matrixWorld),ae.setFromMatrixPosition(le.matrixWorld);const Y=q.distanceTo(ae),ue=N.projectionMatrix.elements,Oe=le.projectionMatrix.elements,Se=ue[14]/(ue[10]-1),Ne=ue[14]/(ue[10]+1),Le=(ue[9]+1)/ue[5],A=(ue[9]-1)/ue[5],x=(ue[8]-1)/ue[0],Z=(Oe[8]+1)/Oe[0],ie=Se*x,te=Se*Z,ne=Y/(-x+Z),_e=ne*-x;if(N.matrixWorld.decompose(ce.position,ce.quaternion,ce.scale),ce.translateX(_e),ce.translateZ(ne),ce.matrixWorld.compose(ce.position,ce.quaternion,ce.scale),ce.matrixWorldInverse.copy(ce.matrixWorld).invert(),ue[10]===-1)ce.projectionMatrix.copy(N.projectionMatrix),ce.projectionMatrixInverse.copy(N.projectionMatrixInverse);else{const Q=Se+ne,M=Ne+ne,v=ie-_e,U=te+(Y-_e),B=Le*Ne/M*Q,X=A*Ne/M*Q;ce.projectionMatrix.makePerspective(v,U,B,X,Q,M),ce.projectionMatrixInverse.copy(ce.projectionMatrix).invert()}}function fe(ce,N){N===null?ce.matrixWorld.copy(ce.matrix):ce.matrixWorld.multiplyMatrices(N.matrixWorld,ce.matrix),ce.matrixWorldInverse.copy(ce.matrixWorld).invert()}this.updateCamera=function(ce){if(s===null)return;let N=ce.near,le=ce.far;y.texture!==null&&(y.depthNear>0&&(N=y.depthNear),y.depthFar>0&&(le=y.depthFar)),g.near=R.near=D.near=N,g.far=R.far=D.far=le,(F!==g.near||O!==g.far)&&(s.updateRenderState({depthNear:g.near,depthFar:g.far}),F=g.near,O=g.far),D.layers.mask=ce.layers.mask|2,R.layers.mask=ce.layers.mask|4,g.layers.mask=D.layers.mask|R.layers.mask;const Y=ce.parent,ue=g.cameras;fe(g,Y);for(let Oe=0;Oe0&&(_.alphaTest.value=p.alphaTest);const T=e.get(p),w=T.envMap,S=T.envMapRotation;w&&(_.envMap.value=w,ns.copy(S),ns.x*=-1,ns.y*=-1,ns.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(ns.y*=-1,ns.z*=-1),_.envMapRotation.value.setFromMatrix4(P4.makeRotationFromEuler(ns)),_.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=p.reflectivity,_.ior.value=p.ior,_.refractionRatio.value=p.refractionRatio),p.lightMap&&(_.lightMap.value=p.lightMap,_.lightMapIntensity.value=p.lightMapIntensity,n(p.lightMap,_.lightMapTransform)),p.aoMap&&(_.aoMap.value=p.aoMap,_.aoMapIntensity.value=p.aoMapIntensity,n(p.aoMap,_.aoMapTransform))}function r(_,p){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,p.map&&(_.map.value=p.map,n(p.map,_.mapTransform))}function a(_,p){_.dashSize.value=p.dashSize,_.totalSize.value=p.dashSize+p.gapSize,_.scale.value=p.scale}function l(_,p,T,w){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,_.size.value=p.size*T,_.scale.value=w*.5,p.map&&(_.map.value=p.map,n(p.map,_.uvTransform)),p.alphaMap&&(_.alphaMap.value=p.alphaMap,n(p.alphaMap,_.alphaMapTransform)),p.alphaTest>0&&(_.alphaTest.value=p.alphaTest)}function d(_,p){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,_.rotation.value=p.rotation,p.map&&(_.map.value=p.map,n(p.map,_.mapTransform)),p.alphaMap&&(_.alphaMap.value=p.alphaMap,n(p.alphaMap,_.alphaMapTransform)),p.alphaTest>0&&(_.alphaTest.value=p.alphaTest)}function u(_,p){_.specular.value.copy(p.specular),_.shininess.value=Math.max(p.shininess,1e-4)}function f(_,p){p.gradientMap&&(_.gradientMap.value=p.gradientMap)}function h(_,p){_.metalness.value=p.metalness,p.metalnessMap&&(_.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,_.metalnessMapTransform)),_.roughness.value=p.roughness,p.roughnessMap&&(_.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,_.roughnessMapTransform)),p.envMap&&(_.envMapIntensity.value=p.envMapIntensity)}function m(_,p,T){_.ior.value=p.ior,p.sheen>0&&(_.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),_.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(_.sheenColorMap.value=p.sheenColorMap,n(p.sheenColorMap,_.sheenColorMapTransform)),p.sheenRoughnessMap&&(_.sheenRoughnessMap.value=p.sheenRoughnessMap,n(p.sheenRoughnessMap,_.sheenRoughnessMapTransform))),p.clearcoat>0&&(_.clearcoat.value=p.clearcoat,_.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(_.clearcoatMap.value=p.clearcoatMap,n(p.clearcoatMap,_.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,n(p.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(_.clearcoatNormalMap.value=p.clearcoatNormalMap,n(p.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===hn&&_.clearcoatNormalScale.value.negate())),p.dispersion>0&&(_.dispersion.value=p.dispersion),p.iridescence>0&&(_.iridescence.value=p.iridescence,_.iridescenceIOR.value=p.iridescenceIOR,_.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(_.iridescenceMap.value=p.iridescenceMap,n(p.iridescenceMap,_.iridescenceMapTransform)),p.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=p.iridescenceThicknessMap,n(p.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),p.transmission>0&&(_.transmission.value=p.transmission,_.transmissionSamplerMap.value=T.texture,_.transmissionSamplerSize.value.set(T.width,T.height),p.transmissionMap&&(_.transmissionMap.value=p.transmissionMap,n(p.transmissionMap,_.transmissionMapTransform)),_.thickness.value=p.thickness,p.thicknessMap&&(_.thicknessMap.value=p.thicknessMap,n(p.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=p.attenuationDistance,_.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(_.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(_.anisotropyMap.value=p.anisotropyMap,n(p.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=p.specularIntensity,_.specularColor.value.copy(p.specularColor),p.specularColorMap&&(_.specularColorMap.value=p.specularColorMap,n(p.specularColorMap,_.specularColorMapTransform)),p.specularIntensityMap&&(_.specularIntensityMap.value=p.specularIntensityMap,n(p.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,p){p.matcap&&(_.matcap.value=p.matcap)}function y(_,p){const T=e.get(p).light;_.referencePosition.value.setFromMatrixPosition(T.matrixWorld),_.nearDistance.value=T.shadow.camera.near,_.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function D4(t,e,n,i){let s={},o={},r=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,w){const S=w.program;i.uniformBlockBinding(T,S)}function d(T,w){let S=s[T.id];S===void 0&&(b(T),S=u(T),s[T.id]=S,T.addEventListener("dispose",_));const I=w.program;i.updateUBOMapping(T,I);const P=e.render.frame;o[T.id]!==P&&(h(T),o[T.id]=P)}function u(T){const w=f();T.__bindingPointIndex=w;const S=t.createBuffer(),I=T.__size,P=T.usage;return t.bindBuffer(t.UNIFORM_BUFFER,S),t.bufferData(t.UNIFORM_BUFFER,I,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,S),S}function f(){for(let T=0;T0&&(S+=I-P),T.__size=S,T.__cache={},this}function y(T){const w={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(w.boundary=4,w.storage=4):T.isVector2?(w.boundary=8,w.storage=8):T.isVector3||T.isColor?(w.boundary=16,w.storage=12):T.isVector4?(w.boundary=16,w.storage=16):T.isMatrix3?(w.boundary=48,w.storage=48):T.isMatrix4?(w.boundary=64,w.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),w}function _(T){const w=T.target;w.removeEventListener("dispose",_);const S=r.indexOf(w.__bindingPointIndex);r.splice(S,1),t.deleteBuffer(s[w.id]),delete s[w.id],delete o[w.id]}function p(){for(const T in s)t.deleteBuffer(s[T]);r=[],s={},o={}}return{bind:l,update:d,dispose:p}}class I4{constructor(e={}){const{canvas:n=rU(),context:i=null,depth:s=!0,stencil:o=!1,alpha:r=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:d=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:h=!1}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext!="undefined"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=r;const b=new Uint32Array(4),y=new Int32Array(4);let _=null,p=null;const T=[],w=[];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.toneMapping=ki,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let I=!1;this._outputColorSpace=wn;let P=0,D=0,R=null,E=-1,g=null;const F=new It,O=new It;let $=null;const j=new lt(0);let re=0,q=n.width,ae=n.height,G=1,fe=null,ye=null;const De=new It(0,0,q,ae),Be=new It(0,0,q,ae);let Je=!1;const ce=new vd;let N=!1,le=!1;const Y=new Tt,ue=new Tt,Oe=new L,Se=new It,Ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Le=!1;function A(){return R===null?G:1}let x=i;function Z(C,k){return n.getContext(C,k)}try{const C={alpha:!0,depth:s,stencil:o,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:d,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${ad}`),n.addEventListener("webglcontextlost",de,!1),n.addEventListener("webglcontextrestored",Re,!1),n.addEventListener("webglcontextcreationerror",Ce,!1),x===null){const k="webgl2";if(x=Z(k,C),x===null)throw Z(k)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(C){throw console.error("THREE.WebGLRenderer: "+C.message),C}let ie,te,ne,_e,Q,M,v,U,B,X,H,ge,pe,be,Me,he,Ae,Xe,He,Ie,Ye,Ge,gt,z;function Te(){ie=new $z(x),ie.init(),Ge=new E4(x,ie),te=new Uz(x,ie,e,Ge),ne=new S4(x,ie),te.reverseDepthBuffer&&h&&ne.buffers.depth.setReversed(!0),_e=new Wz(x),Q=new c4,M=new M4(x,ie,ne,Q,te,Ge,_e),v=new Nz(S),U=new Vz(S),B=new KU(x),gt=new Fz(x,B),X=new Hz(x,B,_e,gt),H=new jz(x,X,B,_e),He=new Xz(x,te,M),he=new Oz(Q),ge=new l4(S,v,U,ie,te,gt,he),pe=new R4(S,Q),be=new u4,Me=new g4(ie),Xe=new Iz(S,v,U,ne,H,m,l),Ae=new y4(S,H,te),z=new D4(x,_e,te,ne),Ie=new Lz(x,ie,_e),Ye=new Gz(x,ie,_e),_e.programs=ge.programs,S.capabilities=te,S.extensions=ie,S.properties=Q,S.renderLists=be,S.shadowMap=Ae,S.state=ne,S.info=_e}Te();const oe=new A4(S,x);this.xr=oe,this.getContext=function(){return x},this.getContextAttributes=function(){return x.getContextAttributes()},this.forceContextLoss=function(){const C=ie.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=ie.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(C){C!==void 0&&(G=C,this.setSize(q,ae,!1))},this.getSize=function(C){return C.set(q,ae)},this.setSize=function(C,k,K=!0){if(oe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=C,ae=k,n.width=Math.floor(C*G),n.height=Math.floor(k*G),K===!0&&(n.style.width=C+"px",n.style.height=k+"px"),this.setViewport(0,0,C,k)},this.getDrawingBufferSize=function(C){return C.set(q*G,ae*G).floor()},this.setDrawingBufferSize=function(C,k,K){q=C,ae=k,G=K,n.width=Math.floor(C*K),n.height=Math.floor(k*K),this.setViewport(0,0,C,k)},this.getCurrentViewport=function(C){return C.copy(F)},this.getViewport=function(C){return C.copy(De)},this.setViewport=function(C,k,K,J){C.isVector4?De.set(C.x,C.y,C.z,C.w):De.set(C,k,K,J),ne.viewport(F.copy(De).multiplyScalar(G).round())},this.getScissor=function(C){return C.copy(Be)},this.setScissor=function(C,k,K,J){C.isVector4?Be.set(C.x,C.y,C.z,C.w):Be.set(C,k,K,J),ne.scissor(O.copy(Be).multiplyScalar(G).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(C){ne.setScissorTest(Je=C)},this.setOpaqueSort=function(C){fe=C},this.setTransparentSort=function(C){ye=C},this.getClearColor=function(C){return C.copy(Xe.getClearColor())},this.setClearColor=function(){Xe.setClearColor(...arguments)},this.getClearAlpha=function(){return Xe.getClearAlpha()},this.setClearAlpha=function(){Xe.setClearAlpha(...arguments)},this.clear=function(C=!0,k=!0,K=!0){let J=0;if(C){let V=!1;if(R!==null){const ve=R.texture.format;V=ve===pd||ve===fd||ve===hd}if(V){const ve=R.texture.type,Ee=ve===ti||ve===bs||ve===rr||ve===ar||ve===dd||ve===ud,Fe=Xe.getClearColor(),Ue=Xe.getClearAlpha(),Ze=Fe.r,qe=Fe.g,Ve=Fe.b;Ee?(b[0]=Ze,b[1]=qe,b[2]=Ve,b[3]=Ue,x.clearBufferuiv(x.COLOR,0,b)):(y[0]=Ze,y[1]=qe,y[2]=Ve,y[3]=Ue,x.clearBufferiv(x.COLOR,0,y))}else J|=x.COLOR_BUFFER_BIT}k&&(J|=x.DEPTH_BUFFER_BIT),K&&(J|=x.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),x.clear(J)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",de,!1),n.removeEventListener("webglcontextrestored",Re,!1),n.removeEventListener("webglcontextcreationerror",Ce,!1),Xe.dispose(),be.dispose(),Me.dispose(),Q.dispose(),v.dispose(),U.dispose(),H.dispose(),gt.dispose(),z.dispose(),ge.dispose(),oe.dispose(),oe.removeEventListener("sessionstart",Td),oe.removeEventListener("sessionend",Cd),Wi.stop()};function de(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function Re(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const C=_e.autoReset,k=Ae.enabled,K=Ae.autoUpdate,J=Ae.needsUpdate,V=Ae.type;Te(),_e.autoReset=C,Ae.enabled=k,Ae.autoUpdate=K,Ae.needsUpdate=J,Ae.type=V}function Ce(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function Qe(C){const k=C.target;k.removeEventListener("dispose",Qe),Rt(k)}function Rt(C){Yt(C),Q.remove(C)}function Yt(C){const k=Q.get(C).programs;k!==void 0&&(k.forEach(function(K){ge.releaseProgram(K)}),C.isShaderMaterial&&ge.releaseShaderCache(C))}this.renderBufferDirect=function(C,k,K,J,V,ve){k===null&&(k=Ne);const Ee=V.isMesh&&V.matrixWorld.determinant()<0,Fe=Xp(C,k,K,J,V);ne.setMaterial(J,Ee);let Ue=K.index,Ze=1;if(J.wireframe===!0){if(Ue=X.getWireframeAttribute(K),Ue===void 0)return;Ze=2}const qe=K.drawRange,Ve=K.attributes.position;let ut=qe.start*Ze,mt=(qe.start+qe.count)*Ze;ve!==null&&(ut=Math.max(ut,ve.start*Ze),mt=Math.min(mt,(ve.start+ve.count)*Ze)),Ue!==null?(ut=Math.max(ut,0),mt=Math.min(mt,Ue.count)):Ve!=null&&(ut=Math.max(ut,0),mt=Math.min(mt,Ve.count));const Lt=mt-ut;if(Lt<0||Lt===1/0)return;gt.setup(V,J,Fe,K,Ue);let Dt,ht=Ie;if(Ue!==null&&(Dt=B.get(Ue),ht=Ye,ht.setIndex(Dt)),V.isMesh)J.wireframe===!0?(ne.setLineWidth(J.wireframeLinewidth*A()),ht.setMode(x.LINES)):ht.setMode(x.TRIANGLES);else if(V.isLine){let We=J.linewidth;We===void 0&&(We=1),ne.setLineWidth(We*A()),V.isLineSegments?ht.setMode(x.LINES):V.isLineLoop?ht.setMode(x.LINE_LOOP):ht.setMode(x.LINE_STRIP)}else V.isPoints?ht.setMode(x.POINTS):V.isSprite&&ht.setMode(x.TRIANGLES);if(V.isBatchedMesh)if(V._multiDrawInstances!==null)oa("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ht.renderMultiDrawInstances(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount,V._multiDrawInstances);else if(ie.get("WEBGL_multi_draw"))ht.renderMultiDraw(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount);else{const We=V._multiDrawStarts,Gt=V._multiDrawCounts,_t=V._multiDrawCount,Pn=Ue?B.get(Ue).bytesPerElement:1,Ts=Q.get(J).currentProgram.getUniforms();for(let pn=0;pn<_t;pn++)Ts.setValue(x,"_gl_DrawID",pn),ht.render(We[pn]/Pn,Gt[pn])}else if(V.isInstancedMesh)ht.renderInstances(ut,Lt,V.count);else if(K.isInstancedBufferGeometry){const We=K._maxInstanceCount!==void 0?K._maxInstanceCount:1/0,Gt=Math.min(K.instanceCount,We);ht.renderInstances(ut,Lt,Gt)}else ht.render(ut,Lt)};function vt(C,k,K){C.transparent===!0&&C.side===On&&C.forceSinglePass===!1?(C.side=hn,C.needsUpdate=!0,gr(C,k,K),C.side=$i,C.needsUpdate=!0,gr(C,k,K),C.side=On):gr(C,k,K)}this.compile=function(C,k,K=null){K===null&&(K=C),p=Me.get(K),p.init(k),w.push(p),K.traverseVisible(function(V){V.isLight&&V.layers.test(k.layers)&&(p.pushLight(V),V.castShadow&&p.pushShadow(V))}),C!==K&&C.traverseVisible(function(V){V.isLight&&V.layers.test(k.layers)&&(p.pushLight(V),V.castShadow&&p.pushShadow(V))}),p.setupLights();const J=new Set;return C.traverse(function(V){if(!(V.isMesh||V.isPoints||V.isLine||V.isSprite))return;const ve=V.material;if(ve)if(Array.isArray(ve))for(let Ee=0;Ee{function ve(){if(J.forEach(function(Ee){Q.get(Ee).currentProgram.isReady()&&J.delete(Ee)}),J.size===0){V(C);return}setTimeout(ve,10)}ie.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let An=null;function ni(C){An&&An(C)}function Td(){Wi.stop()}function Cd(){Wi.start()}const Wi=new Bp;Wi.setAnimationLoop(ni),typeof self!="undefined"&&Wi.setContext(self),this.setAnimationLoop=function(C){An=C,oe.setAnimationLoop(C),C===null?Wi.stop():Wi.start()},oe.addEventListener("sessionstart",Td),oe.addEventListener("sessionend",Cd),this.render=function(C,k){if(k!==void 0&&k.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;if(C.matrixWorldAutoUpdate===!0&&C.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(k),k=oe.getCamera()),C.isScene===!0&&C.onBeforeRender(S,C,k,R),p=Me.get(C,w.length),p.init(k),w.push(p),ue.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),ce.setFromProjectionMatrix(ue),le=this.localClippingEnabled,N=he.init(this.clippingPlanes,le),_=be.get(C,T.length),_.init(),T.push(_),oe.enabled===!0&&oe.isPresenting===!0){const ve=S.xr.getDepthSensingMesh();ve!==null&&Ha(ve,k,-1/0,S.sortObjects)}Ha(C,k,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(fe,ye),Le=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,Le&&Xe.addToRenderList(_,C),this.info.render.frame++,N===!0&&he.beginShadows();const K=p.state.shadowsArray;Ae.render(K,C,k),N===!0&&he.endShadows(),this.info.autoReset===!0&&this.info.reset();const J=_.opaque,V=_.transmissive;if(p.setupLights(),k.isArrayCamera){const ve=k.cameras;if(V.length>0)for(let Ee=0,Fe=ve.length;Ee0&&Pd(J,V,C,k),Le&&Xe.render(C),Ad(_,C,k);R!==null&&D===0&&(M.updateMultisampleRenderTarget(R),M.updateRenderTargetMipmap(R)),C.isScene===!0&&C.onAfterRender(S,C,k),gt.resetDefaultState(),E=-1,g=null,w.pop(),w.length>0?(p=w[w.length-1],N===!0&&he.setGlobalState(S.clippingPlanes,p.state.camera)):p=null,T.pop(),T.length>0?_=T[T.length-1]:_=null};function Ha(C,k,K,J){if(C.visible===!1)return;if(C.layers.test(k.layers)){if(C.isGroup)K=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(k);else if(C.isLight)p.pushLight(C),C.castShadow&&p.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||ce.intersectsSprite(C)){J&&Se.setFromMatrixPosition(C.matrixWorld).applyMatrix4(ue);const Ee=H.update(C),Fe=C.material;Fe.visible&&_.push(C,Ee,Fe,K,Se.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||ce.intersectsObject(C))){const Ee=H.update(C),Fe=C.material;if(J&&(C.boundingSphere!==void 0?(C.boundingSphere===null&&C.computeBoundingSphere(),Se.copy(C.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),Se.copy(Ee.boundingSphere.center)),Se.applyMatrix4(C.matrixWorld).applyMatrix4(ue)),Array.isArray(Fe)){const Ue=Ee.groups;for(let Ze=0,qe=Ue.length;Ze0&&_r(V,k,K),ve.length>0&&_r(ve,k,K),Ee.length>0&&_r(Ee,k,K),ne.buffers.depth.setTest(!0),ne.buffers.depth.setMask(!0),ne.buffers.color.setMask(!0),ne.setPolygonOffset(!1)}function Pd(C,k,K,J){if((K.isScene===!0?K.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[J.id]===void 0&&(p.state.transmissionRenderTarget[J.id]=new ys(1,1,{generateMipmaps:!0,type:ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float")?fr:ti,minFilter:ms,samples:4,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ft.workingColorSpace}));const ve=p.state.transmissionRenderTarget[J.id],Ee=J.viewport||F;ve.setSize(Ee.z*S.transmissionResolutionScale,Ee.w*S.transmissionResolutionScale);const Fe=S.getRenderTarget();S.setRenderTarget(ve),S.getClearColor(j),re=S.getClearAlpha(),re<1&&S.setClearColor(16777215,.5),S.clear(),Le&&Xe.render(K);const Ue=S.toneMapping;S.toneMapping=ki;const Ze=J.viewport;if(J.viewport!==void 0&&(J.viewport=void 0),p.setupLightsView(J),N===!0&&he.setGlobalState(S.clippingPlanes,J),_r(C,K,J),M.updateMultisampleRenderTarget(ve),M.updateRenderTargetMipmap(ve),ie.has("WEBGL_multisampled_render_to_texture")===!1){let qe=!1;for(let Ve=0,ut=k.length;Ve0),Ve=!!K.morphAttributes.position,ut=!!K.morphAttributes.normal,mt=!!K.morphAttributes.color;let Lt=ki;J.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(Lt=S.toneMapping);const Dt=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,ht=Dt!==void 0?Dt.length:0,We=Q.get(J),Gt=p.state.lights;if(N===!0&&(le===!0||C!==g)){const sn=C===g&&J.id===E;he.setState(J,C,sn)}let _t=!1;J.version===We.__version?(We.needsLights&&We.lightsStateVersion!==Gt.state.version||We.outputColorSpace!==Fe||V.isBatchedMesh&&We.batching===!1||!V.isBatchedMesh&&We.batching===!0||V.isBatchedMesh&&We.batchingColor===!0&&V.colorTexture===null||V.isBatchedMesh&&We.batchingColor===!1&&V.colorTexture!==null||V.isInstancedMesh&&We.instancing===!1||!V.isInstancedMesh&&We.instancing===!0||V.isSkinnedMesh&&We.skinning===!1||!V.isSkinnedMesh&&We.skinning===!0||V.isInstancedMesh&&We.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&We.instancingColor===!1&&V.instanceColor!==null||V.isInstancedMesh&&We.instancingMorph===!0&&V.morphTexture===null||V.isInstancedMesh&&We.instancingMorph===!1&&V.morphTexture!==null||We.envMap!==Ue||J.fog===!0&&We.fog!==ve||We.numClippingPlanes!==void 0&&(We.numClippingPlanes!==he.numPlanes||We.numIntersection!==he.numIntersection)||We.vertexAlphas!==Ze||We.vertexTangents!==qe||We.morphTargets!==Ve||We.morphNormals!==ut||We.morphColors!==mt||We.toneMapping!==Lt||We.morphTargetsCount!==ht)&&(_t=!0):(_t=!0,We.__version=J.version);let Pn=We.currentProgram;_t===!0&&(Pn=gr(J,k,V));let Ts=!1,pn=!1,Mo=!1;const At=Pn.getUniforms(),yn=We.uniforms;if(ne.useProgram(Pn.program)&&(Ts=!0,pn=!0,Mo=!0),J.id!==E&&(E=J.id,pn=!0),Ts||g!==C){ne.buffers.depth.getReversed()?(Y.copy(C.projectionMatrix),lU(Y),cU(Y),At.setValue(x,"projectionMatrix",Y)):At.setValue(x,"projectionMatrix",C.projectionMatrix),At.setValue(x,"viewMatrix",C.matrixWorldInverse);const cn=At.map.cameraPosition;cn!==void 0&&cn.setValue(x,Oe.setFromMatrixPosition(C.matrixWorld)),te.logarithmicDepthBuffer&&At.setValue(x,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshLambertMaterial||J.isMeshBasicMaterial||J.isMeshStandardMaterial||J.isShaderMaterial)&&At.setValue(x,"isOrthographic",C.isOrthographicCamera===!0),g!==C&&(g=C,pn=!0,Mo=!0)}if(V.isSkinnedMesh){At.setOptional(x,V,"bindMatrix"),At.setOptional(x,V,"bindMatrixInverse");const sn=V.skeleton;sn&&(sn.boneTexture===null&&sn.computeBoneTexture(),At.setValue(x,"boneTexture",sn.boneTexture,M))}V.isBatchedMesh&&(At.setOptional(x,V,"batchingTexture"),At.setValue(x,"batchingTexture",V._matricesTexture,M),At.setOptional(x,V,"batchingIdTexture"),At.setValue(x,"batchingIdTexture",V._indirectTexture,M),At.setOptional(x,V,"batchingColorTexture"),V._colorsTexture!==null&&At.setValue(x,"batchingColorTexture",V._colorsTexture,M));const xn=K.morphAttributes;if((xn.position!==void 0||xn.normal!==void 0||xn.color!==void 0)&&He.update(V,K,Pn),(pn||We.receiveShadow!==V.receiveShadow)&&(We.receiveShadow=V.receiveShadow,At.setValue(x,"receiveShadow",V.receiveShadow)),J.isMeshGouraudMaterial&&J.envMap!==null&&(yn.envMap.value=Ue,yn.flipEnvMap.value=Ue.isCubeTexture&&Ue.isRenderTargetTexture===!1?-1:1),J.isMeshStandardMaterial&&J.envMap===null&&k.environment!==null&&(yn.envMapIntensity.value=k.environmentIntensity),pn&&(At.setValue(x,"toneMappingExposure",S.toneMappingExposure),We.needsLights&&jp(yn,Mo),ve&&J.fog===!0&&pe.refreshFogUniforms(yn,ve),pe.refreshMaterialUniforms(yn,J,G,ae,p.state.transmissionRenderTarget[C.id]),ra.upload(x,Dd(We),yn,M)),J.isShaderMaterial&&J.uniformsNeedUpdate===!0&&(ra.upload(x,Dd(We),yn,M),J.uniformsNeedUpdate=!1),J.isSpriteMaterial&&At.setValue(x,"center",V.center),At.setValue(x,"modelViewMatrix",V.modelViewMatrix),At.setValue(x,"normalMatrix",V.normalMatrix),At.setValue(x,"modelMatrix",V.matrixWorld),J.isShaderMaterial||J.isRawShaderMaterial){const sn=J.uniformsGroups;for(let cn=0,Ga=sn.length;cn0&&M.useMultisampledRTT(C)===!1?V=Q.get(C).__webglMultisampledFramebuffer:Array.isArray(qe)?V=qe[K]:V=qe,F.copy(C.viewport),O.copy(C.scissor),$=C.scissorTest}else F.copy(De).multiplyScalar(G).floor(),O.copy(Be).multiplyScalar(G).floor(),$=Je;if(K!==0&&(V=qp),ne.bindFramebuffer(x.FRAMEBUFFER,V)&&J&&ne.drawBuffers(C,V),ne.viewport(F),ne.scissor(O),ne.setScissorTest($),ve){const Ue=Q.get(C.texture);x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_CUBE_MAP_POSITIVE_X+k,Ue.__webglTexture,K)}else if(Ee){const Ue=Q.get(C.texture),Ze=k;x.framebufferTextureLayer(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,Ue.__webglTexture,K,Ze)}else if(C!==null&&K!==0){const Ue=Q.get(C.texture);x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,Ue.__webglTexture,K)}E=-1},this.readRenderTargetPixels=function(C,k,K,J,V,ve,Ee){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=Q.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ee!==void 0&&(Fe=Fe[Ee]),Fe){ne.bindFramebuffer(x.FRAMEBUFFER,Fe);try{const Ue=C.texture,Ze=Ue.format,qe=Ue.type;if(!te.textureFormatReadable(Ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!te.textureTypeReadable(qe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=C.width-J&&K>=0&&K<=C.height-V&&x.readPixels(k,K,J,V,Ge.convert(Ze),Ge.convert(qe),ve)}finally{const Ue=R!==null?Q.get(R).__webglFramebuffer:null;ne.bindFramebuffer(x.FRAMEBUFFER,Ue)}}},this.readRenderTargetPixelsAsync=async function(C,k,K,J,V,ve,Ee){if(!(C&&C.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Fe=Q.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ee!==void 0&&(Fe=Fe[Ee]),Fe)if(k>=0&&k<=C.width-J&&K>=0&&K<=C.height-V){ne.bindFramebuffer(x.FRAMEBUFFER,Fe);const Ue=C.texture,Ze=Ue.format,qe=Ue.type;if(!te.textureFormatReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(qe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ve=x.createBuffer();x.bindBuffer(x.PIXEL_PACK_BUFFER,Ve),x.bufferData(x.PIXEL_PACK_BUFFER,ve.byteLength,x.STREAM_READ),x.readPixels(k,K,J,V,Ge.convert(Ze),Ge.convert(qe),0);const ut=R!==null?Q.get(R).__webglFramebuffer:null;ne.bindFramebuffer(x.FRAMEBUFFER,ut);const mt=x.fenceSync(x.SYNC_GPU_COMMANDS_COMPLETE,0);return x.flush(),await aU(x,mt,4),x.bindBuffer(x.PIXEL_PACK_BUFFER,Ve),x.getBufferSubData(x.PIXEL_PACK_BUFFER,0,ve),x.deleteBuffer(Ve),x.deleteSync(mt),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(C,k=null,K=0){const J=Math.pow(2,-K),V=Math.floor(C.image.width*J),ve=Math.floor(C.image.height*J),Ee=k!==null?k.x:0,Fe=k!==null?k.y:0;M.setTexture2D(C,0),x.copyTexSubImage2D(x.TEXTURE_2D,K,0,0,Ee,Fe,V,ve),ne.unbindTexture()};const Zp=x.createFramebuffer(),Kp=x.createFramebuffer();this.copyTextureToTexture=function(C,k,K=null,J=null,V=0,ve=null){ve===null&&(V!==0?(oa("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ve=V,V=0):ve=0);let Ee,Fe,Ue,Ze,qe,Ve,ut,mt,Lt;const Dt=C.isCompressedTexture?C.mipmaps[ve]:C.image;if(K!==null)Ee=K.max.x-K.min.x,Fe=K.max.y-K.min.y,Ue=K.isBox3?K.max.z-K.min.z:1,Ze=K.min.x,qe=K.min.y,Ve=K.isBox3?K.min.z:0;else{const xn=Math.pow(2,-V);Ee=Math.floor(Dt.width*xn),Fe=Math.floor(Dt.height*xn),C.isDataArrayTexture?Ue=Dt.depth:C.isData3DTexture?Ue=Math.floor(Dt.depth*xn):Ue=1,Ze=0,qe=0,Ve=0}J!==null?(ut=J.x,mt=J.y,Lt=J.z):(ut=0,mt=0,Lt=0);const ht=Ge.convert(k.format),We=Ge.convert(k.type);let Gt;k.isData3DTexture?(M.setTexture3D(k,0),Gt=x.TEXTURE_3D):k.isDataArrayTexture||k.isCompressedArrayTexture?(M.setTexture2DArray(k,0),Gt=x.TEXTURE_2D_ARRAY):(M.setTexture2D(k,0),Gt=x.TEXTURE_2D),x.pixelStorei(x.UNPACK_FLIP_Y_WEBGL,k.flipY),x.pixelStorei(x.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),x.pixelStorei(x.UNPACK_ALIGNMENT,k.unpackAlignment);const _t=x.getParameter(x.UNPACK_ROW_LENGTH),Pn=x.getParameter(x.UNPACK_IMAGE_HEIGHT),Ts=x.getParameter(x.UNPACK_SKIP_PIXELS),pn=x.getParameter(x.UNPACK_SKIP_ROWS),Mo=x.getParameter(x.UNPACK_SKIP_IMAGES);x.pixelStorei(x.UNPACK_ROW_LENGTH,Dt.width),x.pixelStorei(x.UNPACK_IMAGE_HEIGHT,Dt.height),x.pixelStorei(x.UNPACK_SKIP_PIXELS,Ze),x.pixelStorei(x.UNPACK_SKIP_ROWS,qe),x.pixelStorei(x.UNPACK_SKIP_IMAGES,Ve);const At=C.isDataArrayTexture||C.isData3DTexture,yn=k.isDataArrayTexture||k.isData3DTexture;if(C.isDepthTexture){const xn=Q.get(C),sn=Q.get(k),cn=Q.get(xn.__renderTarget),Ga=Q.get(sn.__renderTarget);ne.bindFramebuffer(x.READ_FRAMEBUFFER,cn.__webglFramebuffer),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,Ga.__webglFramebuffer);for(let Xi=0;XiMath.PI&&(i-=dn),s<-Math.PI?s+=dn:s>Math.PI&&(s-=dn),i<=s?this._spherical.theta=Math.max(i,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+s)/2?Math.max(i,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let o=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const r=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),o=r!=this._spherical.radius}if(kt.setFromSpherical(this._spherical),kt.applyQuaternion(this._quatInverse),n.copy(this.target).add(kt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let r=null;if(this.object.isPerspectiveCamera){const a=kt.length();r=this._clampDistance(a*this._scale);const l=a-r;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),o=!!l}else if(this.object.isOrthographicCamera){const a=new L(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),o=l!==this.object.zoom;const d=new L(this._mouse.x,this._mouse.y,0);d.unproject(this.object),this.object.position.sub(d).add(a),this.object.updateMatrixWorld(),r=kt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;r!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(r).add(this.object.position):(Xr.origin.copy(this.object.position),Xr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Xr.direction))Rl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Rl||this._lastTargetPosition.distanceToSquared(this.target)>Rl?(this.dispatchEvent(Nh),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?dn/60*this.autoRotateSpeed*e:dn/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){kt.setFromMatrixColumn(n,0),kt.multiplyScalar(-e),this._panOffset.add(kt)}_panUp(e,n){this.screenSpacePanning===!0?kt.setFromMatrixColumn(n,1):(kt.setFromMatrixColumn(n,0),kt.crossVectors(this.object.up,kt)),kt.multiplyScalar(e),this._panOffset.add(kt)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;kt.copy(s).sub(this.target);let o=kt.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*o/i.clientHeight,this.object.matrix),this._panUp(2*n*o/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),s=e-i.left,o=n-i.top,r=i.width,a=i.height;this._mouse.x=s/r*2-1,this._mouse.y=-(o/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(dn*this._rotateDelta.x/n.clientHeight),this._rotateUp(dn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(dn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-dn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(dn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-dn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateStart.set(i,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panStart.set(i,s)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,o=Math.sqrt(i*i+s*s);this._dollyStart.set(0,o)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),s=.5*(e.pageX+i.x),o=.5*(e.pageY+i.y);this._rotateEnd.set(s,o)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(dn*this._rotateDelta.x/n.clientHeight),this._rotateUp(dn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panEnd.set(i,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,o=Math.sqrt(i*i+s*s);this._dollyEnd.set(0,o),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const r=(e.pageX+n.x)*.5,a=(e.pageY+n.y)*.5;this._updateZoomParameters(r,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n.9&&(r.visible=!1)),this.axis==="Y"&&(Pt.setFromEuler(jr.set(0,0,Math.PI/2)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(as).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(Pt.setFromEuler(jr.set(0,Math.PI/2,0)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(ko).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(Pt.setFromEuler(jr.set(0,Math.PI/2,0)),xt.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(Gh.lookAt(Hh,xt,as)),r.quaternion.multiply(Pt),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),Kt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Kt.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(Kt),r.visible=this.dragging):(r.quaternion.copy(i),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(xt.copy(zo).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(xt.copy(as).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(xt.copy(ko).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(xt.copy(ko).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(xt.copy(zo).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(xt.copy(as).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Yr.copy(i),xt.copy(this.eye).applyQuaternion(Pt.copy(i).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(Gh.lookAt(this.eye,Hh,as)),r.name==="X"&&(Pt.setFromAxisAngle(zo,Math.atan2(-xt.y,xt.z)),Pt.multiplyQuaternions(Yr,Pt),r.quaternion.copy(Pt)),r.name==="Y"&&(Pt.setFromAxisAngle(as,Math.atan2(xt.x,xt.z)),Pt.multiplyQuaternions(Yr,Pt),r.quaternion.copy(Pt)),r.name==="Z"&&(Pt.setFromAxisAngle(ko,Math.atan2(xt.y,xt.x)),Pt.multiplyQuaternions(Yr,Pt),r.quaternion.copy(Pt))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(l){return r.name===l}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(e)}}class tB extends Pe{constructor(){super(new xo(1e5,1e5,2,2),new Va({visible:!1,wireframe:!0,side:On,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let n=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(n="local"),qr.copy(zo).applyQuaternion(n==="local"?this.worldQuaternion:aa),Io.copy(as).applyQuaternion(n==="local"?this.worldQuaternion:aa),Fo.copy(ko).applyQuaternion(n==="local"?this.worldQuaternion:aa),xt.copy(Io),this.mode){case"translate":case"scale":switch(this.axis){case"X":xt.copy(this.eye).cross(qr),Wn.copy(qr).cross(xt);break;case"Y":xt.copy(this.eye).cross(Io),Wn.copy(Io).cross(xt);break;case"Z":xt.copy(this.eye).cross(Fo),Wn.copy(Fo).cross(xt);break;case"XY":Wn.copy(Fo);break;case"YZ":Wn.copy(qr);break;case"XZ":xt.copy(Fo),Wn.copy(Io);break;case"XYZ":case"E":Wn.set(0,0,0);break}break;case"rotate":default:Wn.set(0,0,0)}Wn.length()===0?this.quaternion.copy(this.cameraQuaternion):(Wh.lookAt(Kt.set(0,0,0),Wn,xt),this.quaternion.setFromRotationMatrix(Wh)),super.updateMatrixWorld(e)}}let ss,Fn,li,En;const nB={props:{width:Number,height:Number,x:Number,y:Number,z:Number,a:Number,x_max:Number,x_min:Number,y_max:Number,y_min:Number,z_max:Number,z_min:Number},methods:{render(){li.render(Fn,ss)},setSize(){li.setSize(this.width,this.height),this.render()},setPos(){let t={x:this.x,y:this.y,z:this.z,a:this.a};t.x=t.x>this.x_max?this.x_max:t.x,t.x=t.xthis.y_max?this.y_max:t.y,t.y=t.ythis.z_max?this.z_max:t.z,t.z=t.zo.moveOnTop())},[c("div",{class:"wintitle",onDblclick:e[2]||(e[2]=r=>o.dblclickTitle()),onMousedown:e[3]||(e[3]=(...r)=>o.mousedownTitle&&o.mousedownTitle(...r)),onMouseup:e[4]||(e[4]=r=>o.mouseupTitle())},[dB,c("div",uB,ze(n.title),1),c("div",{class:"btn imgClose",onClick:e[0]||(e[0]=r=>o.close()),title:"Close"}),c("div",{class:"btn imgMin",onClick:e[1]||(e[1]=r=>o.toggleMinimize()),title:"Minimize / Restore"})],32),c("div",hB,[to(t.$slots,"default")])],6)}var pB=ct(cB,[["render",fB]]),mB={methods:{async controllerMove(t){let e=[];switch(t){case"X-Y+":e=[`$J=G21G91X-${this.movingOptions.stepSize}Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Y+":e=[`$J=G21G91Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+Y+":e=[`$J=G21G91X${this.movingOptions.stepSize}Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X-":e=[`$J=G21G91X-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+":e=[`$J=G21G91X${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X-Y-":e=[`$J=G21G91X-${this.movingOptions.stepSize}Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Y-":e=[`$J=G21G91Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+Y-":e=[`$J=G21G91X${this.movingOptions.stepSize}Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Z+":e=[`$J=G21G91Z${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Z-":e=[`$J=G21G91Z-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"RL":e=[`$J=G21G91A${this.movingOptions.rotateStep}F${this.movingOptions.feedRateA}`];break;case"RR":e=[`$J=G21G91A-${this.movingOptions.rotateStep}F${this.movingOptions.feedRateA}`];break;case"Return":e=["G90 G0 X0 Y0"];break;case"ReturnZ":e=["G90 G0 Z0"];break;case"Reset":cmd=String.fromCharCode(24);break;case"State":e=["$G"];break;case"Pos":e=["?"];break;case"Home":e=["$H"];break;case"Unlock":e=["$X"];break;case"ResetZero":e=["G10 P0 L20 X0 Y0 Z0"];break;case"HomeResetZero":e.push("$H"),e.push("G10 P0 L20 X0 Y0 Z0");break;case"Parking":e.push(`G0 Z${this.settings.parking.pos.z}`),e.push(`G0 X${this.settings.parking.pos.x} Y${this.settings.parking.pos.y} A0`);break}for(let n of e)await this.sendCommandUI(n)},controllerTogglePump(){let t=this.pumpState?this.settings.pump.Off:this.settings.pump.On;this.sendCommandUI(t)},controllerToggleValve(t){let e=this.valvesState[t]?this.settings.heads[t].valveOff:this.settings.heads[t].valveOn;this.sendCommandUI(e)},controllerToggleCamNozzlePosition(){let t,e=this.settings.cams[0].offset;this.movingOptions.topCamNozzlePos==0?(this.movingOptions.topCamNozzlePos=1,t=`$J=G21G91X${-e.x}Y${-e.y}F${this.movingOptions.feedRateXYZ}`):(this.movingOptions.topCamNozzlePos=0,t=`$J=G21G91X${e.x}Y${e.y}F${this.movingOptions.feedRateXYZ}`),this.sendCommandUI(t)}}},_B={methods:{async sendCommandUI(t){if(this.consoleLogAppend(">>> "+t),this.portIsOpened)for(await this.sendCommand(t),this.consoleLogAppend(this.request),t[0]=="M"&&await this.sendCommand("$G"),t!=="?"&&await this.sendCommand("?");this.machineState.status!=="Idle"&&this.machineState.status!=="Alarm";)await new Promise(e=>setTimeout(e,100)),await this.sendCommand("?")},async sendCommands(t,e=!1){if(this.pnpProcessing.stopFlag!=!0){this.gCodeProcess.stopFlag=!1,this.gCodeProcess.pauseFlag=!1;for(let n of t){if(console.log(n),await this.sendCommand(n),n!=="?"&&await this.sendCommand("?"),e)for(;this.machineState.status!=="Idle";)await new Promise(i=>setTimeout(i,100)),await this.sendCommand("?");for(;this.gCodeProcess.pauseFlag==!0||this.pnpProcessing.pauseFlag==!0;)await new Promise(i=>setTimeout(i,200));if(this.gCodeProcess.stopFlag==!0||this.pnpProcessing.stopFlag==!0)break}this.gCodeProcess.stopFlag=!1,this.gCodeProcess.pauseFlag=!1}},async sendCommandsPool(t){console.log("sendCommandsPool Start");for(let e of t)await this.sendCommand(e);await this.sendCommands(["?"],!0),console.log("sendCommandsPool Stop")},async sendCommand(t){if(this.portIsOpened){t=="$H"&&(this.machineState.status="Homing");let e=Uint8Array.from(Array.from(t+` `).map(n=>n.charCodeAt(0)));await this.portConnection.write(e),await this.readRequest()}},async readRequest(){let t=await this.portConnection.read();this.parseRequest(t)},parseRequest(t){let n=new TextDecoder().decode(t);this.request=n;let i=/<([a-z,A-Z]*)\|MPos:(.*)>/g,s=n.matchAll(i);if(s=Array.from(s),s.length==1){if(s[0].length==3){this.machineState.status=s[0][1];let o=s[0][2].split(",");this.machineState.pos.x=parseFloat(o[0]),this.machineState.pos.y=parseFloat(o[1]),this.machineState.pos.z=parseFloat(o[2]),this.machineState.pos.a=parseFloat(o[3])}}else{let o=/\[([a-z,A-Z, ]*):(.*)]/g,r=n.matchAll(o);if(r=Array.from(r),r.length>0)for(let a of r)a.length==3&&(this.machineState.info[a[1]]=a[2]);else{let a=/\$([0-9]*)=(.*)/g,l=n.matchAll(a);if(l=Array.from(l),l.length>0)for(let d of l)d.length==3&&(this.machineState.settings[d[1]]=parseFloat(d[2]))}}},fetch_execute_async:async function(t,e){this.loading=!0;try{return await(await fetch(t,e)).json()}catch(n){console.log(n)}finally{this.loading=!1}},async getCVData(t){let e="http://localhost:5000/cv/"+t+"?"+Date.now(),n=this.cvParams[t];return await this.fetch_execute_async(e,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)})},pnpGoToZero_GCODE(){let t=[],e=parseFloat(this.settings.heads[0].safePosZ);return t.push(`G0 Z${e}`),t.push("G0 X0 Y0"),t.push("G0 Z0"),t},async pnpGoToZero(){let t=this.pnpGoToZero_GCODE();await this.sendCommands(t,!0)},pnpGoToParking_GCODE(){let t=[];return t.push(`G0 Z${this.settings.parking.pos.z}`),t.push(`G0 X${this.settings.parking.pos.x} Y${this.settings.parking.pos.y} A0`),t},async pnpGoToParking(){let t=this.pnpGoToParking_GCODE();await this.sendCommands(t,!0)},pnpPumpOn_GCODE(){let t=[];return t.push(this.settings.pump.On),t.push("$G"),t},async pnpPumpOn(){let t=this.pnpPumpOn_GCODE();await this.sendCommands(t,!0)},pnpPumpOff_GCODE(){let t=[];return t.push(this.settings.pump.Off),t.push("$G"),t},async pnpPumpOff(){let t=this.pnpPumpOff_GCODE();await this.sendCommands(t,!0)},pnpValveOn_GCODE(t){let e=[];return e.push(`G04 P${t.pauseBeforeOn}`),e.push(t.valveOn),e.push(`G04 P${t.pauseAfterOn}`),e.push("$G"),e},async pnpValveOn(t){let e=this.pnpValveOn_GCODE(t);await this.sendCommands(e,!0)},pnpValveOff_GCODE(t){let e=[];return e.push(`G04 P${t.pauseBeforeOff}`),e.push(t.valveOff),e.push(`G04 P${t.pauseAfterOff}`),e.push("$G"),e},async pnpValveOff(t){let e=this.pnpValveOff_GCODE(t);await this.sendCommands(e,!0)},pnpLightOn_GCODE(t){let e=[];return e.push(this.settings.cams[t].lightOn),e.push("$G"),e},async pnpLightOn(t){let e=this.pnpLightOn_GCODE(t);await this.sendCommands(e,!0)},pnpLightOff_GCODE(t){let e=[];return e.push(this.settings.cams[t].lightOff),e.push("$G"),e},async pnpLightOff(t){let e=this.pnpLightOff_GCODE(t);await this.sendCommands(e,!0)},pnpSafetyUp_GCODE(t){let n=`G0 Z${parseFloat(this.settings.heads[0].safePosZ)}`;return isNaN(t)||(n=n+` A${t}`),[n]},async pnpSafetyUp(t){let e=this.pnpSafetyUp_GCODE(t);await this.sendCommands(e,!0)},pnpSafetyGoToXYZ_GCODE(t,e,n){let i=[];return i.push(...this.pnpSafetyUp_GCODE()),i.push(...this.pnpGoToXYZAF_GCODE(t,e,NaN,NaN,5500)),isNaN(n)||i.push(...this.pnpGoToXYZAF_GCODE(NaN,NaN,n,NaN,5500)),i},async pnpSafetyGoToXYZ(t,e,n){let i=this.pnpSafetyGoToXYZ_GCODE(t,e,n);await this.sendCommands(i,!0)},pnpGoToXYZA_GCODE(t,e,n,i){let s="G0";return isNaN(t)||(s=s+` X${t}`),isNaN(e)||(s=s+` Y${e}`),isNaN(n)||(s=s+` Z${n}`),isNaN(i)||(s=s+` A${i}`),[s]},async pnpGoToXYZA(t,e,n,i){let s=this.pnpGoToXYZA_GCODE(t,e,n,i);await this.sendCommands(s,!0)},pnpGoToXYZAF_GCODE(t,e,n,i,s=500){let o="G1";return isNaN(t)||(o=o+` X${t}`),isNaN(e)||(o=o+` Y${e}`),isNaN(n)||(o=o+` Z${n}`),isNaN(i)||(o=o+` A${i}`),isNaN(s)||(o=o+` F${s}`),[o]},async pnpGoToBottomCam(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=1,n,i,s;n=parseFloat(this.settings.cams[e].pos.x),i=parseFloat(this.settings.cams[e].pos.y),s=parseFloat(this.settings.cams[e].pos.z),await this.pnpSafetyGoToXYZ(n,i,NaN,NaN),await this.pnpLightOn(e),await this.pnpGoToXYZA(NaN,NaN,s,NaN)}finally{this.pnpProcessing.runFlag=t}},getFeederPos(t){let e=0,n=0;if(t.type==0&&(e=t.pos.x,n=t.pos.y),t.type==1)for(let i of t.pathPoints)i.pick==!0&&(e=i.x,n=i.y);return t.type==2&&(e=t.pos.x,n=t.pos.y),{x:e,y:n}},async pnpGoToFeeder(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.getFeederPos(t);await this.pnpSafetyGoToXYZ(n.x,n.y,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpGoToFeederCam(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.getFeederPos(t);n.x=parseFloat(n.x)-parseFloat(this.settings.cams[0].offset.x),n.y=parseFloat(n.y)-parseFloat(this.settings.cams[0].offset.y),await this.pnpSafetyGoToXYZ(n.x,n.y,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpPickFromFeeder(t,e=0){let n=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let i,s,o,r=this.settings.heads[e];if(t.type==0)if(parseInt(t.current)+1setTimeout(f,this.settings.cv[a].pauseBefore*1e3));let l=await this.getCVData(a),d,u=1e4;if(typeof l.objects!="undefined"&&typeof l.objects.rect!="undefined"){let f=parseFloat(t.pos.wx),h=parseFloat(t.pos.wy);for(let m of l.objects.rect){let b=Math.round(m.dx*1e3/this.settings.cams[a].ppmm)/1e3,y=Math.round(m.dy*1e3/this.settings.cams[a].ppmm)/1e3,_=Math.sqrt(b*b+y*y);Math.abs(b)setTimeout(o,this.settings.cv[e].pauseBefore*1e3));let n=await this.getCVData(e),i,s=1e4;if(typeof n.objects!="undefined"&&typeof n.objects.rect!="undefined")for(let o of n.objects.rect){let r=Math.round(o.dx*1e3/this.settings.cams[e].ppmm)/1e3,a=Math.round(o.dy*1e3/this.settings.cams[e].ppmm)/1e3,l=Math.sqrt(r*r+a*a);l<2&&l0){let i=0,s=0,o=0;for(let r of n){await this.pnpLightOn(e),await this.pnpGoToElementCam(r),await new Promise(u=>setTimeout(u,2*this.settings.cv[e].pauseBefore*1e3));let a=await this.getCVData(e);await this.pnpLightOff(e);let l,d=1e4;if(typeof a.objects!="undefined"&&typeof a.objects.circle!="undefined")for(let u of a.objects.circle){let f=Math.round(u.dx*1e3/this.settings.cams[e].ppmm)/1e3,h=Math.round(u.dy*1e3/this.settings.cams[e].ppmm)/1e3,m=Math.sqrt(f*f+h*h);m<2&&m0&&(t.pcb.pos.x=(i/o).toFixed(3),t.pcb.pos.y=(s/o).toFixed(3))}else await st("Fiducials is not found! One or more elements must contain 'FIDUCIAL' in field 'Caption'!","Warning","warning")},async pnpAdjPosition(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=1,n,i,s,o,r;n=parseFloat(this.settings.cams[e].pos.x),i=parseFloat(this.settings.cams[e].pos.y),s=parseFloat(this.settings.cams[e].pos.z),o=this.machinePos.a,await this.pnpGoToBottomCam();for(let u=0;u<3;u++)if(await new Promise(f=>setTimeout(f,this.settings.cv[e].pauseBefore*1e3)),r=await this.getCVData(e),typeof r.objects.object!="undefined"){let f=Math.round(r.objects.object.dx*1e3/this.settings.cams[e].ppmm)/1e3,h=Math.round(r.objects.object.dy*1e3/this.settings.cams[e].ppmm)/1e3;n=n-f,i=i-h;let m=r.objects.object.angle_degrees;m<-45&&(m=90+m),m>45&&(m=-90+m),m=m/360,o=o-m,Math.abs(f)<5&&Math.abs(h)<5&&Math.abs(m)<.25&&await this.pnpGoToXYZA(n,i,NaN,o)}await this.pnpLightOff(e);let a=parseFloat(this.machinePos.x)-parseFloat(this.settings.cams[e].pos.x),l=parseFloat(this.machinePos.y)-parseFloat(this.settings.cams[e].pos.y);return{x:a,y:l}}finally{this.pnpProcessing.runFlag=t}},async pnpDropIntoBasket(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=this.settings.basket.pos.x,n=this.settings.basket.pos.y,i=this.settings.basket.pos.z;await this.pnpSafetyGoToXYZ(e,n,i);for(let s of this.settings.heads)await this.pnpValveOff(s);await this.pnpSafetyUp(0)}finally{this.pnpProcessing.runFlag=t}},async pnpGoToElement(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.project.pcb.pos,i=parseFloat(t.pos.x)+parseFloat(n.x),s=parseFloat(t.pos.y)+parseFloat(n.y);await this.pnpSafetyGoToXYZ(i,s,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpGoToElementCam(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.project.pcb.pos,i=parseFloat(t.pos.x)+parseFloat(n.x)-parseFloat(this.settings.cams[0].offset.x),s=parseFloat(t.pos.y)+parseFloat(n.y)-parseFloat(this.settings.cams[0].offset.y);await this.pnpSafetyGoToXYZ(i,s,NaN)}finally{this.pnpProcessing.runFlag=e}},getNozzle(t){for(let e of this.settings.nozzles)if(e.id==t)return e},getNozzleOffset(t,e){e<0&&(e=1+e);for(let n of t.calibrationData)if(n.a>=e)return n},async pnpPlaceElement(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.settings.heads[0],i=parseFloat(this.settings.table.pos.z),s=t.feeder,o={x:0,y:0},r=parseFloat(t.pos.a);for(let a of this.project.feeders)if(a.id==s){if(await this.pnpPickFromFeeder(a)==!1)return!1;if(r!==0&&await this.pnpGoToXYZA(NaN,NaN,NaN,r),a.posCorrection==!0)o=await this.pnpAdjPosition();else{let h=this.getNozzle(a.nozzle),m=this.getNozzleOffset(h,r);o.x=m.dx,o.y=m.dy}let l=this.project.pcb.pos,d=parseFloat(t.pos.x)+parseFloat(o.x)+parseFloat(l.x),u=parseFloat(t.pos.y)+parseFloat(o.y)+parseFloat(l.y),f=i+parseFloat(l.z)+parseFloat(a.elementHeight);await this.pnpSafetyGoToXYZ(d,u,f),await this.pnpValveOff(n),await this.pnpSafetyUp(),await this.pnpGoToXYZA(NaN,NaN,NaN,0)}return!0}finally{this.pnpProcessing.runFlag=e}},async pnpAutocalibrateNozzle(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=1,i=this.settings.cams[n].ppmm;await this.pnpSafetyUp(0),await this.pnpGoToBottomCam();for(let s of t.calibrationData){await this.pnpGoToXYZA(NaN,NaN,NaN,s.a),await new Promise(r=>setTimeout(r,this.settings.cv[n].pauseBefore*1e3));let o=await this.getCVData(n);if(typeof o.objects.nozzle!="undefined")s.dx=-(o.objects.nozzle.dx/i).toFixed(3),s.dy=-(o.objects.nozzle.dy/i).toFixed(3);else{await st("Autocalibration is failed! Nozzle not found!","Error","error");return}}await this.pnpLightOff(n),await this.pnpSafetyUp(0),await st("Calibration has been completed","Completed","success")}finally{this.pnpProcessing.runFlag=e}},getNozzlePlace(t){for(let e of this.settings.nozzlesHolder.places)if(e.nozzleId==t)return e;return null},pnpGetEmptyNozzlePlace(){let t=null;if(this.settings.heads[0].nozzle==-1)return!0;for(let e of this.settings.nozzlesHolder.places)if(e.nozzleId==-1){t=e;break}return t==null?(st("Not found the empty place!","Error","error"),null):t},async pnpPullOffNozzle(t){let e=this.pnpGetEmptyNozzlePlace();if(e===!0)return!0;if(e==null)return!1;let n=[];for(let s=e.points.length-1;s>=0;s--){let o=e.points[s];s==e.points.length-1?n.push(...this.pnpSafetyGoToXYZ_GCODE(o.x,o.y,o.z)):n.push(...this.pnpGoToXYZAF_GCODE(o.x,o.y,o.z,NaN,t.feed))}let i=parseFloat(this.settings.heads[0].safePosZ);return n.push(...this.pnpGoToXYZAF_GCODE(NaN,NaN,i,NaN,5500)),await this.sendCommandsPool(n),e.nozzleId=this.settings.heads[0].nozzle,this.settings.heads[0].nozzle=-1,!0},async pnpPutOnNozzle(t){if(t.nozzleId==-1){st("Specified Nozzle place is empty!","Error","error");return}if(t.points.length==0){st("Not specified the path to take!","Error","error");return}if(await this.pnpPullOffNozzle(t)==!1)return;console.log(t);let e=[];for(let n=0;n{s==!0&&this.pnpJobProcessing(e)})},async pnpJobProcessing(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0,this.pnpProcessingRun(),await this.pnpPumpOn();let n=this.settings.heads[0].nozzle;for(let i of t)if(this.pnpProcessing.stopFlag==!1&&i.active==!0){if(this.pnpProcessing.element=i,this.pnpProcessing.message=`Element is being placed: ${i.name}`,i.nozzleId!=this.settings.heads[0].nozzle){let s=this.getNozzlePlace(i.nozzleId);console.log("Change Nozzle"),console.log(s),await this.pnpPutOnNozzle(s)}if(await this.pnpPlaceElement(i)==!1)return await st("Job is braked!","Warning","warning"),!1}if(this.settings.heads[0].nozzle!=n){let i=this.getNozzlePlace(n);await this.pnpPutOnNozzle(i)}await this.pnpPumpOff(),await this.pnpGoToParking(),this.pnpProcessing.stopFlag==!0?(this.pnpProcessing.message=`The Job has been canceled on Element: ${this.pnpProcessing.element.name}`,await st("The Job has been canceled!","Canceled","warning"),this.pnpProcessingReset()):(this.pnpProcessing.message="Completed",this.pnpProcessing.element=null,await st('The project "'+this.project.name+'" has been completed',"Completed","success"),this.pnpProcessing.message="")}finally{this.pnpProcessing.runFlag=e}}}};const gB={mixins:[mB,_B,Ms],components:{Loading:tL,DialogWrapper:Ty,Window:pB,Vializer3D:lB,ControllerState:xv,ControllerMovingNew:dy,ControllerConsole:xy,ControllerGCode:ux,ControllerSettings:wx,CamerasSettings:dM,CVSettings:cE,HeadsSettings:nw,PumpSettings:gw,NozzlesSettings:RT,NozzlesHolderSettings:YC,BasketSettings:bA,ParkingSettings:GA,FeedersSettings:_p,PCBTableSettings:h3,Projects:qF},data(){return{tab:0,tabSettings:0,showWindow:[!1,!1,!1,!1],timerId:this.timerId,consoleLog:"",command:this.command,request:this.request,gCodeProcess:{stopFlag:!1,pauseFlag:!1},pnpProcessing:{runFlag:!1,stopFlag:!1,pauseFlag:!1,element:null,message:""},camsViewSMDCase:{case:"",rotate:0},camsViewParams:[{raw:1,cv:0,ppmm:10,grid:1,marker:0},{raw:1,cv:0,ppmm:10,grid:1,marker:0}],CVLikeMachineView:!1,CVResult:[{},{}],machineState:{status:"Not connected",pos:{x:0,y:0,z:0,a:0},settings:{},info:{},gc:[]},loading:!1,movingOptions:{topCamNozzlePos:0,stepSize:10,feedRateXYZ:2e3,rotateStep:.125,feedRateA:500},settings:{machineOffsets:{x:1,y:1,z:1,a:0},cams:[{id:"0",name:"Top",size:{width:800,height:600},undistort:{type:0,distortion_f:0,calibration:{matrix:[[543196.224,0,2499.72745],[0,524402.144,1899.1843],[0,0,1]],distortion:[[-11.527107,.00137230942,-.00112470987,-.0196992455,266238632e-16]]}},image_transform:{rotation:0,scale_x:1,scale_y:1},ppmm:10,pos:{x:0,y:0,z:0},offset:{x:0,y:0},lightOn:"M72",lightOff:"M71"},{id:"1",name:"Bottom",size:{width:800,height:600},undistort:{type:0,distortion_f:0,calibration:{matrix:[[543196.224,0,2499.72745],[0,524402.144,1899.1843],[0,0,1]],distortion:[[-11.527107,.00137230942,-.00112470987,-.0196992455,266238632e-16]]}},image_transform:{rotation:0,scale_x:1,scale_y:1},ppmm:10,pos:{x:0,y:0,z:0},offset:{x:0,y:0},lightOn:"M82",lightOff:"M81"}],cv:[{name:"Top",contrast:1,brightness:0,blur:[1,1],adaptiveThreshold_blockSize:11,adaptiveThreshold_C:2,objects:{circle:{"r-min":1.5,"r-max":2,"dist-min":7},rectangle:{"w-min":2,"w-max":8,"h-min":2,"h-max":8}},pauseBefore:0},{name:"Bottom",contrast:1,brightness:0,blur:[1,1],adaptiveThreshold_blockSize:799,adaptiveThreshold_C:27,objects:{contour:{"w-min":.2,"w-max":20,"h-min":.2,"h-max":20},circle:{"r-min":1.5,"r-max":4,"dist-min":10}},pauseBefore:0}],basket:{pos:{x:0,y:0,z:0}},parking:{pos:{x:0,y:0,z:0}},table:{pos:{x:0,y:0,z:0}},heads:[{id:0,name:"Head 1",safePosZ:20,valveOn:"M32",valveOff:"M31",inGC:"V1",pauseBeforeOn:0,pauseAfterOn:0,pauseBeforeOff:0,pauseAfterOff:0,nozzle:0}],pump:{On:"M42",Off:"M41",inGC:"V2"},nozzles:[{id:0,name:"Nozzle 1",caption:"",calibrationData:[{a:0,dx:0,dy:0},{a:.125,dx:0,dy:0},{a:.25,dx:0,dy:0},{a:.375,dx:0,dy:0},{a:.5,dx:0,dy:0},{a:.625,dx:0,dy:0},{a:.75,dx:0,dy:0},{a:.875,dx:0,dy:0}]}],nozzlesHolder:{places:[{id:1,name:"Place 1",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:2,name:"Place 2",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:3,name:"Place 3",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:4,name:"Place 4",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:5,name:"Place 5",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100}]}},cases:[{name:"",src:""},{name:"R0402",src:"cases/R0402.svg"},{name:"R0603",src:"cases/R0603.svg"},{name:"R0805",src:"cases/R0805.svg"},{name:"R1206",src:"cases/R1206.svg"},{name:"R1210",src:"cases/R1210.svg"},{name:"R1812",src:"cases/1812.svg"},{name:"R2010",src:"cases/2010.svg"},{name:"R2220",src:"cases/2220.svg"},{name:"R2512",src:"cases/2512.svg"},{name:"C0402",src:"cases/C0402.svg"},{name:"C0603",src:"cases/C0603.svg"},{name:"C0805",src:"cases/C0805.svg"},{name:"C1206",src:"cases/C1206.svg"},{name:"SOD-923",src:"cases/sod923.svg"},{name:"SOD-723",src:"cases/sod723.svg"},{name:"SOD-523",src:"cases/sod523.svg"},{name:"SOD-323",src:"cases/SOD-323.svg"},{name:"SOD-123",src:"cases/sod123.svg"},{name:"SOD-123F",src:"cases/sod123f.svg"},{name:"SOD-123FL",src:"cases/SOD-123FL.svg"},{name:"SOD-123W",src:"cases/sod123w.svg"},{name:"SMA",src:"cases/SMA.svg"},{name:"SMB",src:"cases/SMB.svg"},{name:"SMC",src:"cases/smc.svg"},{name:"LED-0603",src:"cases/LED0603.svg"},{name:"LED-0805",src:"cases/LED0805.svg"},{name:"SOT-23",src:"cases/SOT-23.svg"},{name:"SOT-23-5",src:"cases/SOT-23-5.svg"},{name:"SOT-23-6",src:"cases/SOT-23-6.svg"},{name:"SOT-AMS-1117-2.5",src:"cases/SOT-AMS-1117-2.5.svg"},{name:"TO-263-2",src:"cases/TO-263-2.svg"},{name:"PDFN-8-L5.2W5.9",src:"cases/PDFN-8-L5.2W5.9.svg"},{name:"PDFN-8-L5.5W5.2",src:"cases/PDFN-8-L5.5W5.2.svg"},{name:"SOP-8",src:"cases/SOP-8.svg"},{name:"SOIC-8",src:"cases/SOIC-8.svg"},{name:"SOP-16",src:"cases/SOP-16.svg"},{name:"TSSOP-8",src:"cases/TSSOP-8.svg"},{name:"TSSOP-16",src:"cases/TSSOP-16.svg"},{name:"TSSOP-20",src:"cases/TSSOP-20.svg"},{name:"LQFP-48",src:"cases/LQFP-48.svg"},{name:"LQFP-64",src:"cases/LQFP-64.svg"},{name:"BTS7960B",src:"cases/BTS7960B.svg"},{name:"OSC-SMD-4P3225",src:"cases/OSC-SMD-4P3225.svg"}],feeders:[],project:{name:"New Project",feeders:[],elements:[],pcb:{pos:{x:0,y:0,z:1.6}}},projects_list:[]}},computed:{portConnection(){return this.$root.serialPortHandler},portIsOpened(){if(this.portConnection&&this.portConnection.isOpened==!0)return!0},videoSrc(){let t=[],e=0;for(let n of this.camsViewParams){let i=`http://localhost:5000/video_feed/${e}/${n.raw}/${n.cv}/${n.ppmm}/${n.grid}/${n.marker}?${Date.now()}`;e+=1,t.push(i)}return t},controlsEnabled(){return this.machineState.status=="Idle"&&this.pnpProcessing.runFlag==!1},controlsEnabledUnderAlarm(){return(this.machineState.status=="Idle"||this.machineState.status=="Alarm"||this.machineState.status=="Home")&&this.pnpProcessing.runFlag==!1},pumpState(){let t=!1;return typeof this.machineState.info.GC!="undefined"&&(t=this.machineState.info.GC.indexOf(this.settings.pump.inGC)>-1),t},valvesState(){let t=[!1];if(typeof this.machineState.info.GC!="undefined")for(let e in this.settings.heads)t[e]=this.machineState.info.GC.indexOf(this.settings.heads[e].inGC)>-1;return t},lightsState(){let t=[!1,!1];if(typeof this.machineState.info.GC!="undefined")for(let e=0;e<2;e++)t[e]=this.machineState.info.GC.indexOf("L"+(e+1))>-1;return t},machinePos(){let t=parseFloat(this.machineState.pos.x)+this.settings.machineOffsets.x,e=parseFloat(this.machineState.pos.y)+this.settings.machineOffsets.y,n=parseFloat(this.machineState.pos.z)+this.settings.machineOffsets.z,i=parseFloat(this.machineState.pos.a)+this.settings.machineOffsets.a;return{x:t.toFixed(3),y:e.toFixed(3),z:n.toFixed(3),a:i.toFixed(3)}},cvParams(){let t=[];for(let e in this.settings.cv){let n=structuredClone(pt(this.settings.cv[e].objects));for(let i in n)for(let s in n[i])n[i][s]=Math.round(n[i][s]*this.settings.cams[e].ppmm);n=Object.assign(n,{text:!1,img_type:this.CVLikeMachineView?1:0}),t.push(n)}return t}},methods:{fetch_execute:async function(t,e,n,i){this.loading=!0;try{let o=await(await fetch(t,e)).json();n&&n(o)}catch(s){i&&i(s)}finally{this.loading=!1}},loadMachineState(){this.sendCommands(["$I","$$","$G","?"])},consoleLogAppend(t){this.consoleLog=this.consoleLog+t+` `},changeCamParam(t){this.camsViewParams[t.number]={raw:t.raw,cv:t.cv,ppmm:t.ppmm,grid:t.grid,marker:t.marker}},toggleCamParam(t){this.showWindow[t.number]==!0?this.closeCam(t.number):(this.changeCamParam(t),this.openCam(t.number))},toggleCam(t){this.toggleCamParam({number:t,raw:0,cv:0,ppmm:10,grid:1,marker:0})},openCam(t){this.showWindow[t]=!0},closeCam(t){let e=this.$refs["cam_feed"+t];e.src="",this.showWindow[t]=!1,t==0&&(this.camsViewSMDCase={case:"",rotate:0})},toggleCV(t){this.showWindow[t+2]==!0?this.closeCV(t):this.openCV(t)},lightOn(t){let e=this.settings.cams[t].lightOn;this.sendCommandUI(e)},lightOff(t){let e=this.settings.cams[t].lightOff;this.sendCommandUI(e)},toggleLight(t){this.lightsState[t]==!1?this.lightOn(t):this.lightOff(t)},getCV(t){let e="http://localhost:5000/cv/"+t,n=this.cvParams[t];this.fetch_execute(e,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)},i=>{this.CVResult[t]=i,console.log(i.objects)},i=>{console.log(i),st(i,"Error","error")})},openCV(t){this.showWindow[t+2]=!0,this.getCV(t)},closeCV(t){this.showWindow[t+2]=!1},toggleMoviePanel(){this.showWindow[4]==!0?this.closeMoviePanel():this.openMoviePanel()},openMoviePanel(){this.showWindow[4]=!0},closeMoviePanel(){this.showWindow[4]=!1},gCodeRun(t){this.sendCommands(t,!0)},gCodeStop(){this.gCodeProcess.pauseFlag=!1,this.gCodeProcess.stopFlag=!0},gCodePause(){this.gCodeProcess.pauseFlag=!this.gCodeProcess.pauseFlag},pnpProcessingRun(){this.pnpProcessing.pauseFlag=!1,this.pnpProcessing.stopFlag=!1,this.pnpProcessing.runFlag=!0},pnpProcessingPause(){this.pnpProcessing.pauseFlag=!this.pnpProcessing.pauseFlag},pnpProcessingResume(){this.pnpProcessing.pauseFlag=!1},pnpProcessingStop(){this.pnpProcessing.stopFlag=!0},pnpProcessingReset(){this.pnpProcessing.pauseFlag=!1,this.pnpProcessing.stopFlag=!1,this.pnpProcessing.runFlag=!1},moveOnClick(t){if(this.controlsEnabled==!0){let e=t.srcElement.width/2,n=t.srcElement.height/2,i=t.srcElement.id,s,o;i==0?(s=t.offsetX-e,o=n-t.offsetY):(s=t.offsetX-e,o=t.offsetY-n);let r=this.settings.cams[i].ppmm,a=Math.round(s/r*1e3)/1e3,l=Math.round(o/r*1e3)/1e3,d=`$J=G21G91X${a}Y${l}F500`;this.sendCommandUI(d)}},calibrate(t){let e="http://localhost:5000/calibration/"+t+"?"+Date.now();this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{n.result=="OK"?(this.settings.cams[t].calibration=n,st("Calibration complete successfully. Don't forget to apply settings.","Calibration","success")):st(n.msg,"Error","error")},n=>{console.log(n),st(n,"Error","error")})},loadSettings(){let t="http://localhost:5000/settings?"+Date.now();this.fetch_execute(t,{method:"GET",credentials:"same-origin",cache:"no-cache"},e=>{this.settings=this.deepMerge(this.settings,e)},e=>{console.log(e),st(e,"Error","error")})},applaySettings(){let t="http://localhost:5000/settings",e=this.settings;this.fetch_execute(t,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(e)},n=>{n.result=="OK"?st("Settings applied successfully","Settings","success"):n.error?st(n.error,"Error","error"):st("Unexpected Error!","Error","error")},n=>{console.log(n),st(n,"Error","error")})},setFeedersFromProject(){this.feeders=this.project.feeders,Un("Feeders set from current project applied as default feeder set, but settings is not saved yet. Do You want to save and apply settings?","Confirm").then(t=>{t==!0&&this.applaySettings()})},newProject(){this.project={name:"New Project",feeders:[],elements:[],pcb:{pos:{x:0,y:0,z:0}}}},loadProject(){this.loadJSON("projects",this.project.name,"project")},saveProject(){this.saveJSON("projects",this.project.name,this.project),setTimeout(()=>{this.loadProjectsList()},1e3)},renameProject(t){let e=`http://localhost:5000/json/rename/projects/${t.name}/${t.newName}`;this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{this.loadProjectsList()},n=>{console.log(n),st(n,"Error","error")})},deleteProject(t){let e=`http://localhost:5000/json/delete/projects/${t}`;this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{this.loadProjectsList()},n=>{console.log(n),st(n,"Error","error")})},loadProjectsList(){let t="http://localhost:5000/json-list/projects?"+Date.now();this.fetch_execute(t,{method:"GET",credentials:"same-origin",cache:"no-cache"},e=>{this.projects_list=e.result},e=>{console.log(e),st(e,"Error","error")})},loadJSON(t,e,n){let i="http://localhost:5000/json";t!==""&&(i=i+"/"+t),i=i+"/"+e,this.fetch_execute(i,{method:"GET",credentials:"same-origin",cache:"no-cache"},s=>{this[n]=s.result},s=>{console.log(s),st(s,"Error","error")})},saveJSON(t,e,n){let i="http://localhost:5000/json";t!==""&&(i=i+"/"+t),i=i+"/"+e,this.fetch_execute(i,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)},s=>{s.result=="OK"?st('File "'+e+'" saved successfully',"Settings","success"):s.error?st(s.error,"Error","error"):st("Unexpected Error!","Error","error")},s=>{console.log(s),st(s,"Error","error")})},setSMDCase(t){this.camsViewSMDCase=t,this.drawTopCamCanvas()},drawTopCamCanvas(){if(this.$refs.camCanvas0){let t=this.$refs.camCanvas0,e=t.getContext("2d");if(e){e.globalAlpha=.7;let n=t.width,i=t.height,s=t.width/2,o="#239b56",r=1,a=n/2,l=i/2,d=2*Math.PI*parseFloat(this.camsViewSMDCase.rotate),u=parseFloat(this.settings.cams[0].ppmm),f=this.camsViewSMDCase.case;e.clearRect(0,0,n,i),e.translate(a,l),e.rotate(-d),e.translate(-a,-l),e.beginPath(),e.moveTo(a-s/2,l),e.lineTo(a+s/2,l),e.strokeStyle=o,e.lineWidth=r,e.arc(a,l,.6*u,0,2*Math.PI),e.stroke(),e.translate(a,l),e.rotate(d),e.translate(-a,-l);for(let h of this.cases)if(h.name==f){const m=new Image;m.src=h.src,m.onload=()=>{let b=n/2,y=i/2,p=96/25.4,T=m.width*(u/p),w=m.height*(u/p),S=b-T/2,I=y-w/2;e.translate(b,y),e.rotate(-d),e.translate(-b,-y),e.drawImage(m,S,I,T,w),e.translate(b,y),e.rotate(d),e.translate(-b,-y),e.stroke()}}}}}},mounted(){this.loadSettings(),this.loadJSON("","feeders","feeders"),this.loadProjectsList()},unmounted(){},watch:{async portIsOpened(t){t?(this.loadMachineState(),setTimeout(()=>{parseFloat(this.machineState.pos.x)+parseFloat(this.machineState.pos.y)+parseFloat(this.machineState.pos.z)==0&&Un("Are You wish to dispatch Machine to Home & Reset Zero?","Confirm").then(n=>{n==!0&&this.controllerMove("HomeResetZero")})},300)):this.machineState.status="Not connected"},showWindow:{handler(t,e){this.showWindow[0]==1&&setTimeout(()=>{this.drawTopCamCanvas()},200)},deep:!0},machineState:{handler(t,e){clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.drawTopCamCanvas()},200)},deep:!0}}},vB={class:"float-end tool-buttons"},bB={class:"row border bg-light machine-pos"},yB={class:"col-3 p-1"},xB={class:"col-3 p-1"},SB={class:"col-3 p-1"},MB={class:"col-3 p-1"},EB=["src"],wB=["width","height"],TB={class:"form-check form-switch"},CB=["checked"],AB=c("label",{class:"form-check-label",for:"topLight"},"Light",-1),PB=["src"],RB={class:"form-check form-switch"},DB=["checked"],IB=c("label",{class:"form-check-label",for:"bottomLight"},"Light",-1),FB=["src"],LB={class:"row m-0"},UB={class:"col form-check form-switch"},OB=["checked"],NB=c("label",{class:"form-check-label",for:"topLight"},"Light",-1),zB={class:"col form-check form-switch"},kB=c("label",{class:"form-check-label",for:"machineView"},"Machine vision",-1),BB=["src"],VB={class:"row m-0"},$B={class:"col form-check form-switch"},HB=["checked"],GB=c("label",{class:"form-check-label",for:"bottomLight"},"Light",-1),WB={class:"col form-check form-switch"},XB=c("label",{class:"form-check-label",for:"machineView"},"Machine vision",-1),jB={class:"nav nav-tabs"},YB={class:"nav-item"},qB={class:"nav-item"},ZB={class:"nav-item"},KB={class:"row mt-2"},JB={class:"col-md-auto left-column"},QB={class:"col-md central-column"},e5={class:"row"},t5={class:"col"},n5={class:"row"},i5={class:"col"},s5={class:"col-auto"},o5={class:"row mt-2"},r5={class:"col"},a5={class:"row flex-nowrap"},l5={class:"col-auto"},c5={class:"d-flex flex-column"},d5={class:"nav nav-pills flex-column"},u5={class:"nav-item"},h5={class:"nav-item"},f5={class:"nav-item"},p5={class:"nav-item"},m5={class:"nav-item"},_5={class:"nav-item"},g5={class:"nav-item"},v5={class:"nav-item"},b5={class:"nav-item"},y5={class:"nav-item"},x5={class:"nav-item"},S5={class:"col settings"},M5={class:"row mt-2"},E5={class:"col"},w5=c("hr",null,null,-1);function T5(t,e,n,i,s,o){const r=et("Loading"),a=et("DialogWrapper"),l=et("window"),d=et("ControllerMovingNew"),u=et("ControllerState"),f=et("ControllerGCode"),h=et("ControllerConsole"),m=et("Vializer3D"),b=et("ControllerSettings"),y=et("CamerasSettings"),_=et("CVSettings"),p=et("NozzlesSettings"),T=et("NozzlesHolderSettings"),w=et("HeadsSettings"),S=et("PumpSettings"),I=et("ParkingSettings"),P=et("BasketSettings"),D=et("FeedersSettings"),R=et("PCBTableSettings"),E=et("Projects");return W(),ee("div",null,[c("div",vB,[c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[2]==!0?" active":"")),onClick:e[0]||(e[0]=g=>o.toggleCV(0))},"\u{1F441}\u{1F81F}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[3]==!0?" active":"")),onClick:e[1]||(e[1]=g=>o.toggleCV(1))},"\u{1F441}\u{1F81D}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[0]==!0?" active":"")),onClick:e[2]||(e[2]=g=>o.toggleCam(0))},"\u{1F4F7}\u{1F81F}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[1]==!0?" active":"")),onClick:e[3]||(e[3]=g=>o.toggleCam(1))},"\u{1F4F7}\u{1F81D}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[4]==!0?" active":"")),onClick:e[4]||(e[4]=g=>o.toggleMoviePanel())},"\xA0\u2725\xA0",2)]),c("div",bB,[c("div",yB," X: "+ze(o.machinePos.x),1),c("div",xB," Y: "+ze(o.machinePos.y),1),c("div",SB," Z: "+ze(o.machinePos.z),1),c("div",MB," A: "+ze(o.machinePos.a),1)]),ke(r,{loading:s.loading},null,8,["loading"]),ke(a),se(ke(l,{title:"Cam "+s.settings.cams[0].name,width:s.settings.cams[0].size.width+28,height:s.settings.cams[0].size.height+100,number:1,onClose:e[8]||(e[8]=g=>o.closeCam(0))},{default:Ct(()=>[s.showWindow[0]?(W(),ee("img",{key:0,ref:"cam_feed0",id:0,src:o.videoSrc[0],onClick:e[5]||(e[5]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,8,EB)):ot("",!0),s.showWindow[0]?(W(),ee("canvas",{key:1,ref:"camCanvas0",id:0,width:s.settings.cams[0].size.width,height:s.settings.cams[0].size.height,style:fo("position: relative; top: -"+s.settings.cams[0].size.height+"px; margin-bottom: -"+(s.settings.cams[0].size.height-12)+"px;"),onClick:e[6]||(e[6]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,12,wB)):ot("",!0),c("div",TB,[c("input",{onChange:e[7]||(e[7]=g=>o.toggleLight(0)),checked:o.lightsState[0],class:"form-check-input",type:"checkbox",role:"switch",id:"topLight"},null,40,CB),AB])]),_:1},8,["title","width","height"]),[[ln,s.showWindow[0]]]),se(ke(l,{title:"Cam "+s.settings.cams[1].name,width:s.settings.cams[1].size.width+20,height:s.settings.cams[1].size.height+82,number:2,onClose:e[11]||(e[11]=g=>o.closeCam(1))},{default:Ct(()=>[s.showWindow[1]?(W(),ee("img",{key:0,ref:"cam_feed1",id:1,src:o.videoSrc[1],onClick:e[9]||(e[9]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,8,PB)):ot("",!0),c("div",RB,[c("input",{onChange:e[10]||(e[10]=g=>o.toggleLight(1)),checked:o.lightsState[1],class:"form-check-input",type:"checkbox",role:"switch",id:"bottomLight"},null,40,DB),IB])]),_:1},8,["title","width","height"]),[[ln,s.showWindow[1]]]),se(ke(l,{title:"CV Top",width:s.settings.cams[0].size.width+20,height:s.settings.cams[0].size.height+82,number:3,onClose:e[16]||(e[16]=g=>o.closeCV(0))},{default:Ct(()=>[c("img",{ref:"cv0",src:s.CVResult[0].img,onClick:e[12]||(e[12]=g=>o.getCV(0)),title:"Click to Refresh"},null,8,FB),c("div",LB,[c("div",UB,[c("input",{onChange:e[13]||(e[13]=g=>o.toggleLight(0)),checked:o.lightsState[0],class:"form-check-input",type:"checkbox",role:"switch",id:"topLight"},null,40,OB),NB]),c("div",zB,[se(c("input",{"onUpdate:modelValue":e[14]||(e[14]=g=>s.CVLikeMachineView=g),onChange:e[15]||(e[15]=g=>o.getCV(0)),class:"form-check-input",type:"checkbox",role:"switch",id:"machineView"},null,544),[[Kn,s.CVLikeMachineView]]),kB])])]),_:1},8,["width","height"]),[[ln,s.showWindow[2]]]),se(ke(l,{title:"CV Bottom",width:s.settings.cams[0].size.width+20,height:s.settings.cams[0].size.height+82,number:4,onClose:e[21]||(e[21]=g=>o.closeCV(1))},{default:Ct(()=>[c("img",{ref:"cv1",src:s.CVResult[1].img,onClick:e[17]||(e[17]=g=>o.getCV(1)),title:"Click to Refresh"},null,8,BB),c("div",VB,[c("div",$B,[c("input",{onChange:e[18]||(e[18]=g=>o.toggleLight(1)),checked:o.lightsState[1],class:"form-check-input",type:"checkbox",role:"switch",id:"bottomLight"},null,40,HB),GB]),c("div",WB,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=g=>s.CVLikeMachineView=g),onChange:e[20]||(e[20]=g=>o.getCV(1)),class:"form-check-input",type:"checkbox",role:"switch",id:"machineView"},null,544),[[Kn,s.CVLikeMachineView]]),XB])])]),_:1},8,["width","height"]),[[ln,s.showWindow[3]]]),se(ke(l,{title:"Move panel",width:350,height:680,number:5,onClose:e[26]||(e[26]=g=>o.closeMoviePanel())},{default:Ct(()=>[ke(d,{onCommand:e[22]||(e[22]=g=>t.controllerMove(g)),onToggleValve:e[23]||(e[23]=g=>t.controllerToggleValve(g)),onTogglePump:e[24]||(e[24]=g=>t.controllerTogglePump()),onToggleCamNozzlePosition:e[25]||(e[25]=g=>t.controllerToggleCamNozzlePosition()),settings:s.settings,movingOptions:s.movingOptions,valvesState:o.valvesState,pumpState:o.pumpState,disabled:!o.controlsEnabled,enabledUnderAlaram:o.controlsEnabledUnderAlarm},null,8,["settings","movingOptions","valvesState","pumpState","disabled","enabledUnderAlaram"])]),_:1},512),[[ln,s.showWindow[4]]]),c("ul",jB,[c("li",YB,[c("a",{class:je("nav-link"+(s.tab==0?" active":"")),onClick:e[27]||(e[27]=g=>s.tab=0)},"Manual control",2)]),c("li",qB,[c("a",{class:je("nav-link"+(s.tab==1?" active":"")),onClick:e[28]||(e[28]=g=>s.tab=1)},"Settings",2)]),c("li",ZB,[c("a",{class:je("nav-link"+(s.tab==2?" active":"")),onClick:e[29]||(e[29]=g=>s.tab=2)},"Projects",2)])]),se(c("div",KB,[c("div",JB,[ke(u,{state:s.machineState,pnpProcessing:s.pnpProcessing,valvesState:o.valvesState,pumpState:o.pumpState},null,8,["state","pnpProcessing","valvesState","pumpState"]),ke(d,{onCommand:e[30]||(e[30]=g=>t.controllerMove(g)),onToggleValve:e[31]||(e[31]=g=>t.controllerToggleValve(g)),onTogglePump:e[32]||(e[32]=g=>t.controllerTogglePump()),onToggleCamNozzlePosition:e[33]||(e[33]=g=>t.controllerToggleCamNozzlePosition()),settings:s.settings,movingOptions:s.movingOptions,valvesState:o.valvesState,pumpState:o.pumpState,disabled:!o.controlsEnabled,enabledUnderAlaram:o.controlsEnabledUnderAlarm},null,8,["settings","movingOptions","valvesState","pumpState","disabled","enabledUnderAlaram"])]),c("div",QB,[c("div",e5,[c("div",t5,[ke(f,{disabled:!o.controlsEnabled,machineState:s.machineState,gCodeProcess:s.gCodeProcess,onRun:e[34]||(e[34]=g=>o.gCodeRun(g)),onStop:e[35]||(e[35]=g=>o.gCodeStop()),onPause:e[36]||(e[36]=g=>o.gCodePause())},null,8,["disabled","machineState","gCodeProcess"])])]),c("div",n5,[c("div",i5,[ke(h,{consoleLog:s.consoleLog,disabled:!o.controlsEnabledUnderAlarm,onSendCommand:e[37]||(e[37]=g=>t.sendCommandUI([g]))},null,8,["consoleLog","disabled"])])])]),c("div",s5,[ke(m,{width:600,height:300,x:s.machineState.pos.x,y:s.machineState.pos.y,z:s.machineState.pos.z,a:s.machineState.pos.a,x_max:0,x_min:-200,y_max:0,y_min:-200,z_max:55,z_min:-55},null,8,["x","y","z","a"])])],512),[[ln,s.tab==0]]),se(c("div",o5,[c("div",r5,[c("div",a5,[c("div",l5,[c("div",c5,[c("ul",d5,[c("li",u5,[c("a",{class:je("nav-link"+(s.tabSettings==0?" active":"")),onClick:e[38]||(e[38]=g=>s.tabSettings=0)},"Controller",2)]),c("li",h5,[c("a",{class:je("nav-link"+(s.tabSettings==1?" active":"")),onClick:e[39]||(e[39]=g=>s.tabSettings=1)},"Cameras",2)]),c("li",f5,[c("a",{class:je("nav-link"+(s.tabSettings==2?" active":"")),onClick:e[40]||(e[40]=g=>s.tabSettings=2)},"Computer Vision",2)]),c("li",p5,[c("a",{class:je("nav-link"+(s.tabSettings==3?" active":"")),onClick:e[41]||(e[41]=g=>s.tabSettings=3)},"Nozzles",2)]),c("li",m5,[c("a",{class:je("nav-link"+(s.tabSettings==4?" active":"")),onClick:e[42]||(e[42]=g=>s.tabSettings=4)},"Nozzles Holder",2)]),c("li",_5,[c("a",{class:je("nav-link"+(s.tabSettings==5?" active":"")),onClick:e[43]||(e[43]=g=>s.tabSettings=5)},"Heads",2)]),c("li",g5,[c("a",{class:je("nav-link"+(s.tabSettings==6?" active":"")),onClick:e[44]||(e[44]=g=>s.tabSettings=6)},"Pump",2)]),c("li",v5,[c("a",{class:je("nav-link"+(s.tabSettings==7?" active":"")),onClick:e[45]||(e[45]=g=>s.tabSettings=7)},"Parking",2)]),c("li",b5,[c("a",{class:je("nav-link"+(s.tabSettings==8?" active":"")),onClick:e[46]||(e[46]=g=>s.tabSettings=8)},"Basket",2)]),c("li",y5,[c("a",{class:je("nav-link"+(s.tabSettings==9?" active":"")),onClick:e[47]||(e[47]=g=>s.tabSettings=9)},"Feeders",2)]),c("li",x5,[c("a",{class:je("nav-link"+(s.tabSettings==10?" active":"")),onClick:e[48]||(e[48]=g=>s.tabSettings=10)},"PCB Table",2)])])])]),c("div",S5,[s.tabSettings==0?(W(),Jt(b,{key:0,settings:s.machineState.settings,disabled:!o.controlsEnabled,onSendCommand:e[49]||(e[49]=g=>t.sendCommands(g))},null,8,["settings","disabled"])):ot("",!0),s.tabSettings==1?(W(),Jt(y,{key:1,cams:s.settings.cams,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,showWindow:s.showWindow,disabled:!o.controlsEnabled,loading:s.loading,onCalibrate:e[50]||(e[50]=g=>o.calibrate(g)),onSendCommands:e[51]||(e[51]=g=>t.sendCommands(g,!0)),onApplaySettings:e[52]||(e[52]=g=>o.applaySettings()),onToggleCam:e[53]||(e[53]=g=>o.toggleCamParam(g)),onChangeCamParam:e[54]||(e[54]=g=>o.changeCamParam(g)),onToggleMoviePanel:e[55]||(e[55]=g=>o.toggleMoviePanel())},null,8,["cams","machineState","machinePos","settings","showWindow","disabled","loading"])):ot("",!0),s.tabSettings==2?(W(),Jt(_,{key:2,cvSettings:s.settings.cv,showWindow:s.showWindow,loading:s.loading,onToggleCV:e[56]||(e[56]=g=>o.toggleCV(g)),onApplaySettings:e[57]||(e[57]=g=>o.applaySettings())},null,8,["cvSettings","showWindow","loading"])):ot("",!0),s.tabSettings==3?(W(),Jt(p,{key:3,nozzles:s.settings.nozzles,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,disabled:!o.controlsEnabled,loading:s.loading,onAutocalibrate:e[58]||(e[58]=g=>t.pnpAutocalibrateNozzle(g)),onApplaySettings:e[59]||(e[59]=g=>o.applaySettings())},null,8,["nozzles","machineState","machinePos","settings","disabled","loading"])):ot("",!0),s.tabSettings==4?(W(),Jt(T,{key:4,nozzlesHolder:s.settings.nozzlesHolder,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,disabled:!o.controlsEnabled,loading:s.loading,onPutOnNozzle:e[60]||(e[60]=g=>t.pnpPutOnNozzle(g)),onApplaySettings:e[61]||(e[61]=g=>o.applaySettings())},null,8,["nozzlesHolder","machineState","machinePos","settings","disabled","loading"])):ot("",!0),s.tabSettings==5?(W(),Jt(w,{key:5,heads:s.settings.heads,nozzles:s.settings.nozzles,loading:s.loading,onApplaySettings:e[62]||(e[62]=g=>o.applaySettings())},null,8,["heads","nozzles","loading"])):ot("",!0),s.tabSettings==6?(W(),Jt(S,{key:6,pump:s.settings.pump,loading:s.loading,onApplaySettings:e[63]||(e[63]=g=>o.applaySettings())},null,8,["pump","loading"])):ot("",!0),s.tabSettings==7?(W(),Jt(I,{key:7,parking:s.settings.parking,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[64]||(e[64]=g=>o.applaySettings())},null,8,["parking","machineState","machinePos","loading"])):ot("",!0),s.tabSettings==8?(W(),Jt(P,{key:8,basket:s.settings.basket,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[65]||(e[65]=g=>o.applaySettings())},null,8,["basket","machineState","machinePos","loading"])):ot("",!0),s.tabSettings==9?(W(),Jt(D,{key:9,settings:s.settings,cases:s.cases,machineState:s.machineState,machinePos:o.machinePos,feeders:s.feeders,disabled:!o.controlsEnabled,loading:s.loading,onAdjFeederPositionCV:e[66]||(e[66]=g=>t.pnpAdjFeederPositionCV(g)),onGoToFeeder:e[67]||(e[67]=g=>t.pnpGoToFeeder(g)),onGoToFeederCam:e[68]||(e[68]=g=>t.pnpGoToFeederCam(g)),onPickFromFeeder:e[69]||(e[69]=g=>t.pnpPickFromFeeder(g)),onAdjPosition:e[70]||(e[70]=g=>t.pnpAdjPosition(g)),onDropIntoBasket:e[71]||(e[71]=g=>t.pnpDropIntoBasket(g)),onSaveFeeders:e[72]||(e[72]=g=>o.saveJSON("","feeders",this.feeders))},null,8,["settings","cases","machineState","machinePos","feeders","disabled","loading"])):ot("",!0),s.tabSettings==10?(W(),Jt(R,{key:10,pcbtable:s.settings.table.pos,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[73]||(e[73]=g=>o.applaySettings())},null,8,["pcbtable","machineState","machinePos","loading"])):ot("",!0)])])])],512),[[ln,s.tab==1]]),se(c("div",M5,[c("div",E5,[ke(E,{project:s.project,projects_list:s.projects_list,disabled:!o.controlsEnabled,loading:s.loading,settings:s.settings,cases:s.cases,default_feeders:s.feeders,machineState:s.machineState,machinePos:o.machinePos,pnpProcessing:s.pnpProcessing,onSetSMDCase:e[74]||(e[74]=g=>o.setSMDCase(g)),onAdjFeederPositionCV:e[75]||(e[75]=g=>t.pnpAdjFeederPositionCV(g)),onAdjFeedersPositionCV:e[76]||(e[76]=g=>t.pnpAdjFeedersPositionCV(g)),onAdjPCBPositionCV:e[77]||(e[77]=g=>t.pnpAdjPCBPositionCV(g)),onGoToFeeder:e[78]||(e[78]=g=>t.pnpGoToFeeder(g)),onGoToFeederCam:e[79]||(e[79]=g=>t.pnpGoToFeederCam(g)),onPickFromFeeder:e[80]||(e[80]=g=>t.pnpPickFromFeeder(g)),onAdjPosition:e[81]||(e[81]=g=>t.pnpAdjPosition(g)),onDropIntoBasket:e[82]||(e[82]=g=>t.pnpDropIntoBasket(g)),onGoToElement:e[83]||(e[83]=g=>t.pnpGoToElement(g)),onGoToElementCam:e[84]||(e[84]=g=>t.pnpGoToElementCam(g)),onPlaceElement:e[85]||(e[85]=g=>t.pnpPlaceElement(g)),onSetFeeders:e[86]||(e[86]=g=>o.setFeedersFromProject()),onNewProject:e[87]||(e[87]=g=>o.newProject()),onLoadProject:e[88]||(e[88]=g=>o.loadProject()),onSaveProject:e[89]||(e[89]=g=>o.saveProject()),onRenameProject:e[90]||(e[90]=g=>o.renameProject(g)),onDeleteProject:e[91]||(e[91]=g=>o.deleteProject(g)),onRun:e[92]||(e[92]=g=>t.pnpJobStart()),onRunFrom:e[93]||(e[93]=g=>t.pnpJobStart(g)),onPause:e[94]||(e[94]=g=>o.pnpProcessingPause()),onStop:e[95]||(e[95]=g=>o.pnpProcessingStop())},null,8,["project","projects_list","disabled","loading","settings","cases","default_feeders","machineState","machinePos","pnpProcessing"])])],512),[[ln,s.tab==2]]),w5])}var C5=ct(gB,[["render",T5]]);const A5=w0({history:Vg(),routes:[{path:"/",name:"home",component:C5},{path:"/about",name:"about",component:()=>G0(()=>import("./AboutView.95c4c286.js"),[])}]}),wd=yg(V0);wd.use(A5);wd.use(Sy);wd.mount("#app");export{ct as _,c as a,ee as c,W as o};