3859 lines
625 KiB
JavaScript
3859 lines
625 KiB
JavaScript
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=e(s);fetch(s.href,r)}})();/**
|
||
* @vue/shared v3.5.25
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function jl(n){const t=Object.create(null);for(const e of n.split(","))t[e]=1;return e=>e in t}const he={},_s=[],Rn=()=>{},Bh=()=>!1,Do=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),Zl=n=>n.startsWith("onUpdate:"),Fe=Object.assign,Kl=(n,t)=>{const e=n.indexOf(t);e>-1&&n.splice(e,1)},Od=Object.prototype.hasOwnProperty,te=(n,t)=>Od.call(n,t),qt=Array.isArray,gs=n=>Io(n)==="[object Map]",zh=n=>Io(n)==="[object Set]",Yt=n=>typeof n=="function",be=n=>typeof n=="string",Ei=n=>typeof n=="symbol",ge=n=>n!==null&&typeof n=="object",Hh=n=>(ge(n)||Yt(n))&&Yt(n.then)&&Yt(n.catch),kh=Object.prototype.toString,Io=n=>kh.call(n),Fd=n=>Io(n).slice(8,-1),Vh=n=>Io(n)==="[object Object]",$l=n=>be(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,tr=jl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Uo=n=>{const t=Object.create(null);return(e=>t[e]||(t[e]=n(e)))},Bd=/-\w/g,vi=Uo(n=>n.replace(Bd,t=>t.slice(1).toUpperCase())),zd=/\B([A-Z])/g,qi=Uo(n=>n.replace(zd,"-$1").toLowerCase()),Gh=Uo(n=>n.charAt(0).toUpperCase()+n.slice(1)),Ko=Uo(n=>n?`on${Gh(n)}`:""),mi=(n,t)=>!Object.is(n,t),$o=(n,...t)=>{for(let e=0;e<n.length;e++)n[e](...t)},Wh=(n,t,e,i=!1)=>{Object.defineProperty(n,t,{configurable:!0,enumerable:!1,writable:i,value:e})},Hd=n=>{const t=parseFloat(n);return isNaN(t)?n:t};let Gc;const No=()=>Gc||(Gc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Oo(n){if(qt(n)){const t={};for(let e=0;e<n.length;e++){const i=n[e],s=be(i)?Wd(i):Oo(i);if(s)for(const r in s)t[r]=s[r]}return t}else if(be(n)||ge(n))return n}const kd=/;(?![^(]*\))/g,Vd=/:([^]+)/,Gd=/\/\*[^]*?\*\//g;function Wd(n){const t={};return n.replace(Gd,"").split(kd).forEach(e=>{if(e){const i=e.split(Vd);i.length>1&&(t[i[0].trim()]=i[1].trim())}}),t}function Hi(n){let t="";if(be(n))t=n;else if(qt(n))for(let e=0;e<n.length;e++){const i=Hi(n[e]);i&&(t+=i+" ")}else if(ge(n))for(const e in n)n[e]&&(t+=e+" ");return t.trim()}const Xd="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Yd=jl(Xd);function Xh(n){return!!n||n===""}const Yh=n=>!!(n&&n.__v_isRef===!0),Vn=n=>be(n)?n:n==null?"":qt(n)||ge(n)&&(n.toString===kh||!Yt(n.toString))?Yh(n)?Vn(n.value):JSON.stringify(n,qh,2):String(n),qh=(n,t)=>Yh(t)?qh(n,t.value):gs(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[i,s],r)=>(e[Jo(i,r)+" =>"]=s,e),{})}:zh(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Jo(e))}:Ei(t)?Jo(t):ge(t)&&!qt(t)&&!Vh(t)?String(t):t,Jo=(n,t="")=>{var e;return Ei(n)?`Symbol(${(e=n.description)!=null?e:t})`:n};/**
|
||
* @vue/reactivity v3.5.25
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let Ye;class qd{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ye,!t&&Ye&&(this.index=(Ye.scopes||(Ye.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,e;if(this.scopes)for(t=0,e=this.scopes.length;t<e;t++)this.scopes[t].pause();for(t=0,e=this.effects.length;t<e;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,e;if(this.scopes)for(t=0,e=this.scopes.length;t<e;t++)this.scopes[t].resume();for(t=0,e=this.effects.length;t<e;t++)this.effects[t].resume()}}run(t){if(this._active){const e=Ye;try{return Ye=this,t()}finally{Ye=e}}}on(){++this._on===1&&(this.prevScope=Ye,Ye=this)}off(){this._on>0&&--this._on===0&&(Ye=this.prevScope,this.prevScope=void 0)}stop(t){if(this._active){this._active=!1;let e,i;for(e=0,i=this.effects.length;e<i;e++)this.effects[e].stop();for(this.effects.length=0,e=0,i=this.cleanups.length;e<i;e++)this.cleanups[e]();if(this.cleanups.length=0,this.scopes){for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function jd(){return Ye}let ue;const Qo=new WeakSet;class jh{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Ye&&Ye.active&&Ye.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Qo.has(this)&&(Qo.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Kh(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Wc(this),$h(this);const t=ue,e=pn;ue=this,pn=!0;try{return this.fn()}finally{Jh(this),ue=t,pn=e,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)tc(t);this.deps=this.depsTail=void 0,Wc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Qo.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ya(this)&&this.run()}get dirty(){return Ya(this)}}let Zh=0,er,nr;function Kh(n,t=!1){if(n.flags|=8,t){n.next=nr,nr=n;return}n.next=er,er=n}function Jl(){Zh++}function Ql(){if(--Zh>0)return;if(nr){let t=nr;for(nr=void 0;t;){const e=t.next;t.next=void 0,t.flags&=-9,t=e}}let n;for(;er;){let t=er;for(er=void 0;t;){const e=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(i){n||(n=i)}t=e}}if(n)throw n}function $h(n){for(let t=n.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Jh(n){let t,e=n.depsTail,i=e;for(;i;){const s=i.prevDep;i.version===-1?(i===e&&(e=s),tc(i),Zd(i)):t=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}n.deps=t,n.depsTail=e}function Ya(n){for(let t=n.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Qh(t.dep.computed)||t.dep.version!==t.version))return!0;return!!n._dirty}function Qh(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===ur)||(n.globalVersion=ur,!n.isSSR&&n.flags&128&&(!n.deps&&!n._dirty||!Ya(n))))return;n.flags|=2;const t=n.dep,e=ue,i=pn;ue=n,pn=!0;try{$h(n);const s=n.fn(n._value);(t.version===0||mi(s,n._value))&&(n.flags|=128,n._value=s,t.version++)}catch(s){throw t.version++,s}finally{ue=e,pn=i,Jh(n),n.flags&=-3}}function tc(n,t=!1){const{dep:e,prevSub:i,nextSub:s}=n;if(i&&(i.nextSub=s,n.prevSub=void 0),s&&(s.prevSub=i,n.nextSub=void 0),e.subs===n&&(e.subs=i,!i&&e.computed)){e.computed.flags&=-5;for(let r=e.computed.deps;r;r=r.nextDep)tc(r,!0)}!t&&!--e.sc&&e.map&&e.map.delete(e.key)}function Zd(n){const{prevDep:t,nextDep:e}=n;t&&(t.nextDep=e,n.prevDep=void 0),e&&(e.prevDep=t,n.nextDep=void 0)}let pn=!0;const tf=[];function jn(){tf.push(pn),pn=!1}function Zn(){const n=tf.pop();pn=n===void 0?!0:n}function Wc(n){const{cleanup:t}=n;if(n.cleanup=void 0,t){const e=ue;ue=void 0;try{t()}finally{ue=e}}}let ur=0;class Kd{constructor(t,e){this.sub=t,this.dep=e,this.version=e.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ec{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!ue||!pn||ue===this.computed)return;let e=this.activeLink;if(e===void 0||e.sub!==ue)e=this.activeLink=new Kd(ue,this),ue.deps?(e.prevDep=ue.depsTail,ue.depsTail.nextDep=e,ue.depsTail=e):ue.deps=ue.depsTail=e,ef(e);else if(e.version===-1&&(e.version=this.version,e.nextDep)){const i=e.nextDep;i.prevDep=e.prevDep,e.prevDep&&(e.prevDep.nextDep=i),e.prevDep=ue.depsTail,e.nextDep=void 0,ue.depsTail.nextDep=e,ue.depsTail=e,ue.deps===e&&(ue.deps=i)}return e}trigger(t){this.version++,ur++,this.notify(t)}notify(t){Jl();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ql()}}}function ef(n){if(n.dep.sc++,n.sub.flags&4){const t=n.dep.computed;if(t&&!n.dep.subs){t.flags|=20;for(let i=t.deps;i;i=i.nextDep)ef(i)}const e=n.dep.subs;e!==n&&(n.prevSub=e,e&&(e.nextSub=n)),n.dep.subs=n}}const qa=new WeakMap,Gi=Symbol(""),ja=Symbol(""),hr=Symbol("");function Ne(n,t,e){if(pn&&ue){let i=qa.get(n);i||qa.set(n,i=new Map);let s=i.get(e);s||(i.set(e,s=new ec),s.map=i,s.key=e),s.track()}}function Gn(n,t,e,i,s,r){const o=qa.get(n);if(!o){ur++;return}const a=l=>{l&&l.trigger()};if(Jl(),t==="clear")o.forEach(a);else{const l=qt(n),c=l&&$l(e);if(l&&e==="length"){const u=Number(i);o.forEach((h,d)=>{(d==="length"||d===hr||!Ei(d)&&d>=u)&&a(h)})}else switch((e!==void 0||o.has(void 0))&&a(o.get(e)),c&&a(o.get(hr)),t){case"add":l?c&&a(o.get("length")):(a(o.get(Gi)),gs(n)&&a(o.get(ja)));break;case"delete":l||(a(o.get(Gi)),gs(n)&&a(o.get(ja)));break;case"set":gs(n)&&a(o.get(Gi));break}}Ql()}function Ki(n){const t=Qt(n);return t===n?t:(Ne(t,"iterate",hr),mn(n)?t:t.map(Kn))}function nc(n){return Ne(n=Qt(n),"iterate",hr),n}function ci(n,t){return xi(n)?vs(n)?fr(Kn(t)):fr(t):Kn(t)}const $d={__proto__:null,[Symbol.iterator](){return ta(this,Symbol.iterator,n=>ci(this,n))},concat(...n){return Ki(this).concat(...n.map(t=>qt(t)?Ki(t):t))},entries(){return ta(this,"entries",n=>(n[1]=ci(this,n[1]),n))},every(n,t){return Un(this,"every",n,t,void 0,arguments)},filter(n,t){return Un(this,"filter",n,t,e=>e.map(i=>ci(this,i)),arguments)},find(n,t){return Un(this,"find",n,t,e=>ci(this,e),arguments)},findIndex(n,t){return Un(this,"findIndex",n,t,void 0,arguments)},findLast(n,t){return Un(this,"findLast",n,t,e=>ci(this,e),arguments)},findLastIndex(n,t){return Un(this,"findLastIndex",n,t,void 0,arguments)},forEach(n,t){return Un(this,"forEach",n,t,void 0,arguments)},includes(...n){return ea(this,"includes",n)},indexOf(...n){return ea(this,"indexOf",n)},join(n){return Ki(this).join(n)},lastIndexOf(...n){return ea(this,"lastIndexOf",n)},map(n,t){return Un(this,"map",n,t,void 0,arguments)},pop(){return Bs(this,"pop")},push(...n){return Bs(this,"push",n)},reduce(n,...t){return Xc(this,"reduce",n,t)},reduceRight(n,...t){return Xc(this,"reduceRight",n,t)},shift(){return Bs(this,"shift")},some(n,t){return Un(this,"some",n,t,void 0,arguments)},splice(...n){return Bs(this,"splice",n)},toReversed(){return Ki(this).toReversed()},toSorted(n){return Ki(this).toSorted(n)},toSpliced(...n){return Ki(this).toSpliced(...n)},unshift(...n){return Bs(this,"unshift",n)},values(){return ta(this,"values",n=>ci(this,n))}};function ta(n,t,e){const i=nc(n),s=i[t]();return i!==n&&!mn(n)&&(s._next=s.next,s.next=()=>{const r=s._next();return r.done||(r.value=e(r.value)),r}),s}const Jd=Array.prototype;function Un(n,t,e,i,s,r){const o=nc(n),a=o!==n&&!mn(n),l=o[t];if(l!==Jd[t]){const h=l.apply(n,r);return a?Kn(h):h}let c=e;o!==n&&(a?c=function(h,d){return e.call(this,ci(n,h),d,n)}:e.length>2&&(c=function(h,d){return e.call(this,h,d,n)}));const u=l.call(o,c,i);return a&&s?s(u):u}function Xc(n,t,e,i){const s=nc(n);let r=e;return s!==n&&(mn(n)?e.length>3&&(r=function(o,a,l){return e.call(this,o,a,l,n)}):r=function(o,a,l){return e.call(this,o,ci(n,a),l,n)}),s[t](r,...i)}function ea(n,t,e){const i=Qt(n);Ne(i,"iterate",hr);const s=i[t](...e);return(s===-1||s===!1)&&oc(e[0])?(e[0]=Qt(e[0]),i[t](...e)):s}function Bs(n,t,e=[]){jn(),Jl();const i=Qt(n)[t].apply(n,e);return Ql(),Zn(),i}const Qd=jl("__proto__,__v_isRef,__isVue"),nf=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(Ei));function tp(n){Ei(n)||(n=String(n));const t=Qt(this);return Ne(t,"has",n),t.hasOwnProperty(n)}class sf{constructor(t=!1,e=!1){this._isReadonly=t,this._isShallow=e}get(t,e,i){if(e==="__v_skip")return t.__v_skip;const s=this._isReadonly,r=this._isShallow;if(e==="__v_isReactive")return!s;if(e==="__v_isReadonly")return s;if(e==="__v_isShallow")return r;if(e==="__v_raw")return i===(s?r?up:lf:r?af:of).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(i)?t:void 0;const o=qt(t);if(!s){let l;if(o&&(l=$d[e]))return l;if(e==="hasOwnProperty")return tp}const a=Reflect.get(t,e,Oe(t)?t:i);if((Ei(e)?nf.has(e):Qd(e))||(s||Ne(t,"get",e),r))return a;if(Oe(a)){const l=o&&$l(e)?a:a.value;return s&&ge(l)?Ka(l):l}return ge(a)?s?Ka(a):sc(a):a}}class rf extends sf{constructor(t=!1){super(!1,t)}set(t,e,i,s){let r=t[e];const o=qt(t)&&$l(e);if(!this._isShallow){const c=xi(r);if(!mn(i)&&!xi(i)&&(r=Qt(r),i=Qt(i)),!o&&Oe(r)&&!Oe(i))return c||(r.value=i),!0}const a=o?Number(e)<t.length:te(t,e),l=Reflect.set(t,e,i,Oe(t)?t:s);return t===Qt(s)&&(a?mi(i,r)&&Gn(t,"set",e,i):Gn(t,"add",e,i)),l}deleteProperty(t,e){const i=te(t,e);t[e];const s=Reflect.deleteProperty(t,e);return s&&i&&Gn(t,"delete",e,void 0),s}has(t,e){const i=Reflect.has(t,e);return(!Ei(e)||!nf.has(e))&&Ne(t,"has",e),i}ownKeys(t){return Ne(t,"iterate",qt(t)?"length":Gi),Reflect.ownKeys(t)}}class ep extends sf{constructor(t=!1){super(!0,t)}set(t,e){return!0}deleteProperty(t,e){return!0}}const np=new rf,ip=new ep,sp=new rf(!0);const Za=n=>n,Rr=n=>Reflect.getPrototypeOf(n);function rp(n,t,e){return function(...i){const s=this.__v_raw,r=Qt(s),o=gs(r),a=n==="entries"||n===Symbol.iterator&&o,l=n==="keys"&&o,c=s[n](...i),u=e?Za:t?fr:Kn;return!t&&Ne(r,"iterate",l?ja:Gi),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}},[Symbol.iterator](){return this}}}}function Cr(n){return function(...t){return n==="delete"?!1:n==="clear"?void 0:this}}function op(n,t){const e={get(s){const r=this.__v_raw,o=Qt(r),a=Qt(s);n||(mi(s,a)&&Ne(o,"get",s),Ne(o,"get",a));const{has:l}=Rr(o),c=t?Za:n?fr:Kn;if(l.call(o,s))return c(r.get(s));if(l.call(o,a))return c(r.get(a));r!==o&&r.get(s)},get size(){const s=this.__v_raw;return!n&&Ne(Qt(s),"iterate",Gi),s.size},has(s){const r=this.__v_raw,o=Qt(r),a=Qt(s);return n||(mi(s,a)&&Ne(o,"has",s),Ne(o,"has",a)),s===a?r.has(s):r.has(s)||r.has(a)},forEach(s,r){const o=this,a=o.__v_raw,l=Qt(a),c=t?Za:n?fr:Kn;return!n&&Ne(l,"iterate",Gi),a.forEach((u,h)=>s.call(r,c(u),c(h),o))}};return Fe(e,n?{add:Cr("add"),set:Cr("set"),delete:Cr("delete"),clear:Cr("clear")}:{add(s){!t&&!mn(s)&&!xi(s)&&(s=Qt(s));const r=Qt(this);return Rr(r).has.call(r,s)||(r.add(s),Gn(r,"add",s,s)),this},set(s,r){!t&&!mn(r)&&!xi(r)&&(r=Qt(r));const o=Qt(this),{has:a,get:l}=Rr(o);let c=a.call(o,s);c||(s=Qt(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,r),c?mi(r,u)&&Gn(o,"set",s,r):Gn(o,"add",s,r),this},delete(s){const r=Qt(this),{has:o,get:a}=Rr(r);let l=o.call(r,s);l||(s=Qt(s),l=o.call(r,s)),a&&a.call(r,s);const c=r.delete(s);return l&&Gn(r,"delete",s,void 0),c},clear(){const s=Qt(this),r=s.size!==0,o=s.clear();return r&&Gn(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{e[s]=rp(s,n,t)}),e}function ic(n,t){const e=op(n,t);return(i,s,r)=>s==="__v_isReactive"?!n:s==="__v_isReadonly"?n:s==="__v_raw"?i:Reflect.get(te(e,s)&&s in i?e:i,s,r)}const ap={get:ic(!1,!1)},lp={get:ic(!1,!0)},cp={get:ic(!0,!1)};const of=new WeakMap,af=new WeakMap,lf=new WeakMap,up=new WeakMap;function hp(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function fp(n){return n.__v_skip||!Object.isExtensible(n)?0:hp(Fd(n))}function sc(n){return xi(n)?n:rc(n,!1,np,ap,of)}function dp(n){return rc(n,!1,sp,lp,af)}function Ka(n){return rc(n,!0,ip,cp,lf)}function rc(n,t,e,i,s){if(!ge(n)||n.__v_raw&&!(t&&n.__v_isReactive))return n;const r=fp(n);if(r===0)return n;const o=s.get(n);if(o)return o;const a=new Proxy(n,r===2?i:e);return s.set(n,a),a}function vs(n){return xi(n)?vs(n.__v_raw):!!(n&&n.__v_isReactive)}function xi(n){return!!(n&&n.__v_isReadonly)}function mn(n){return!!(n&&n.__v_isShallow)}function oc(n){return n?!!n.__v_raw:!1}function Qt(n){const t=n&&n.__v_raw;return t?Qt(t):n}function pp(n){return!te(n,"__v_skip")&&Object.isExtensible(n)&&Wh(n,"__v_skip",!0),n}const Kn=n=>ge(n)?sc(n):n,fr=n=>ge(n)?Ka(n):n;function Oe(n){return n?n.__v_isRef===!0:!1}function ac(n){return mp(n,!1)}function mp(n,t){return Oe(n)?n:new _p(n,t)}class _p{constructor(t,e){this.dep=new ec,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=e?t:Qt(t),this._value=e?t:Kn(t),this.__v_isShallow=e}get value(){return this.dep.track(),this._value}set value(t){const e=this._rawValue,i=this.__v_isShallow||mn(t)||xi(t);t=i?t:Qt(t),mi(t,e)&&(this._rawValue=t,this._value=i?t:Kn(t),this.dep.trigger())}}function Me(n){return Oe(n)?n.value:n}const gp={get:(n,t,e)=>t==="__v_raw"?n:Me(Reflect.get(n,t,e)),set:(n,t,e,i)=>{const s=n[t];return Oe(s)&&!Oe(e)?(s.value=e,!0):Reflect.set(n,t,e,i)}};function cf(n){return vs(n)?n:new Proxy(n,gp)}class vp{constructor(t,e,i){this.fn=t,this.setter=e,this._value=void 0,this.dep=new ec(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ur-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!e,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&ue!==this)return Kh(this,!0),!0}get value(){const t=this.dep.track();return Qh(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function xp(n,t,e=!1){let i,s;return Yt(n)?i=n:(i=n.get,s=n.set),new vp(i,s,e)}const Pr={},Mo=new WeakMap;let Ui;function yp(n,t=!1,e=Ui){if(e){let i=Mo.get(e);i||Mo.set(e,i=[]),i.push(n)}}function Mp(n,t,e=he){const{immediate:i,deep:s,once:r,scheduler:o,augmentJob:a,call:l}=e,c=M=>s?M:mn(M)||s===!1||s===0?di(M,1):di(M);let u,h,d,p,v=!1,x=!1;if(Oe(n)?(h=()=>n.value,v=mn(n)):vs(n)?(h=()=>c(n),v=!0):qt(n)?(x=!0,v=n.some(M=>vs(M)||mn(M)),h=()=>n.map(M=>{if(Oe(M))return M.value;if(vs(M))return c(M);if(Yt(M))return l?l(M,2):M()})):Yt(n)?t?h=l?()=>l(n,2):n:h=()=>{if(d){jn();try{d()}finally{Zn()}}const M=Ui;Ui=u;try{return l?l(n,3,[p]):n(p)}finally{Ui=M}}:h=Rn,t&&s){const M=h,F=s===!0?1/0:s;h=()=>di(M(),F)}const m=jd(),f=()=>{u.stop(),m&&m.active&&Kl(m.effects,u)};if(r&&t){const M=t;t=(...F)=>{M(...F),f()}}let R=x?new Array(n.length).fill(Pr):Pr;const w=M=>{if(!(!(u.flags&1)||!u.dirty&&!M))if(t){const F=u.run();if(s||v||(x?F.some((D,L)=>mi(D,R[L])):mi(F,R))){d&&d();const D=Ui;Ui=u;try{const L=[F,R===Pr?void 0:x&&R[0]===Pr?[]:R,p];R=F,l?l(t,3,L):t(...L)}finally{Ui=D}}}else u.run()};return a&&a(w),u=new jh(h),u.scheduler=o?()=>o(w,!1):w,p=M=>yp(M,!1,u),d=u.onStop=()=>{const M=Mo.get(u);if(M){if(l)l(M,4);else for(const F of M)F();Mo.delete(u)}},t?i?w(!0):R=u.run():o?o(w.bind(null,!0),!0):u.run(),f.pause=u.pause.bind(u),f.resume=u.resume.bind(u),f.stop=f,f}function di(n,t=1/0,e){if(t<=0||!ge(n)||n.__v_skip||(e=e||new Map,(e.get(n)||0)>=t))return n;if(e.set(n,t),t--,Oe(n))di(n.value,t,e);else if(qt(n))for(let i=0;i<n.length;i++)di(n[i],t,e);else if(zh(n)||gs(n))n.forEach(i=>{di(i,t,e)});else if(Vh(n)){for(const i in n)di(n[i],t,e);for(const i of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,i)&&di(n[i],t,e)}return n}/**
|
||
* @vue/runtime-core v3.5.25
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function yr(n,t,e,i){try{return i?n(...i):n()}catch(s){Fo(s,t,e)}}function Pn(n,t,e,i){if(Yt(n)){const s=yr(n,t,e,i);return s&&Hh(s)&&s.catch(r=>{Fo(r,t,e)}),s}if(qt(n)){const s=[];for(let r=0;r<n.length;r++)s.push(Pn(n[r],t,e,i));return s}}function Fo(n,t,e,i=!0){const s=t?t.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||he;if(t){let a=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${e}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](n,l,c)===!1)return}a=a.parent}if(r){jn(),yr(r,null,10,[n,l,c]),Zn();return}}Sp(n,e,s,i,o)}function Sp(n,t,e,i=!0,s=!1){if(s)throw n;console.error(n)}const ke=[];let Sn=-1;const xs=[];let ui=null,hs=0;const uf=Promise.resolve();let So=null;function Ep(n){const t=So||uf;return n?t.then(this?n.bind(this):n):t}function bp(n){let t=Sn+1,e=ke.length;for(;t<e;){const i=t+e>>>1,s=ke[i],r=dr(s);r<n||r===n&&s.flags&2?t=i+1:e=i}return t}function lc(n){if(!(n.flags&1)){const t=dr(n),e=ke[ke.length-1];!e||!(n.flags&2)&&t>=dr(e)?ke.push(n):ke.splice(bp(t),0,n),n.flags|=1,hf()}}function hf(){So||(So=uf.then(df))}function Tp(n){qt(n)?xs.push(...n):ui&&n.id===-1?ui.splice(hs+1,0,n):n.flags&1||(xs.push(n),n.flags|=1),hf()}function Yc(n,t,e=Sn+1){for(;e<ke.length;e++){const i=ke[e];if(i&&i.flags&2){if(n&&i.id!==n.uid)continue;ke.splice(e,1),e--,i.flags&4&&(i.flags&=-2),i(),i.flags&4||(i.flags&=-2)}}}function ff(n){if(xs.length){const t=[...new Set(xs)].sort((e,i)=>dr(e)-dr(i));if(xs.length=0,ui){ui.push(...t);return}for(ui=t,hs=0;hs<ui.length;hs++){const e=ui[hs];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}ui=null,hs=0}}const dr=n=>n.id==null?n.flags&2?-1:1/0:n.id;function df(n){try{for(Sn=0;Sn<ke.length;Sn++){const t=ke[Sn];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),yr(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Sn<ke.length;Sn++){const t=ke[Sn];t&&(t.flags&=-2)}Sn=-1,ke.length=0,ff(),So=null,(ke.length||xs.length)&&df()}}let wn=null,pf=null;function Eo(n){const t=wn;return wn=n,pf=n&&n.type.__scopeId||null,t}function wp(n,t=wn,e){if(!t||n._n)return n;const i=(...s)=>{i._d&&nu(-1);const r=Eo(t);let o;try{o=n(...s)}finally{Eo(r),i._d&&nu(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function Ti(n,t,e,i){const s=n.dirs,r=t&&t.dirs;for(let o=0;o<s.length;o++){const a=s[o];r&&(a.oldValue=r[o].value);let l=a.dir[i];l&&(jn(),Pn(l,e,8,[n.el,a,n,t]),Zn())}}const Ap=Symbol("_vte"),Rp=n=>n.__isTeleport,Cp=Symbol("_leaveCb");function cc(n,t){n.shapeFlag&6&&n.component?(n.transition=t,cc(n.component.subTree,t)):n.shapeFlag&128?(n.ssContent.transition=t.clone(n.ssContent),n.ssFallback.transition=t.clone(n.ssFallback)):n.transition=t}function Bo(n,t){return Yt(n)?Fe({name:n.name},t,{setup:n}):n}function mf(n){n.ids=[n.ids[0]+n.ids[2]+++"-",0,0]}const bo=new WeakMap;function ir(n,t,e,i,s=!1){if(qt(n)){n.forEach((v,x)=>ir(v,t&&(qt(t)?t[x]:t),e,i,s));return}if(sr(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&ir(n,t,e,i.component.subTree);return}const r=i.shapeFlag&4?pc(i.component):i.el,o=s?null:r,{i:a,r:l}=n,c=t&&t.r,u=a.refs===he?a.refs={}:a.refs,h=a.setupState,d=Qt(h),p=h===he?Bh:v=>te(d,v);if(c!=null&&c!==l){if(qc(t),be(c))u[c]=null,p(c)&&(h[c]=null);else if(Oe(c)){c.value=null;const v=t;v.k&&(u[v.k]=null)}}if(Yt(l))yr(l,a,12,[o,u]);else{const v=be(l),x=Oe(l);if(v||x){const m=()=>{if(n.f){const f=v?p(l)?h[l]:u[l]:l.value;if(s)qt(f)&&Kl(f,r);else if(qt(f))f.includes(r)||f.push(r);else if(v)u[l]=[r],p(l)&&(h[l]=u[l]);else{const R=[r];l.value=R,n.k&&(u[n.k]=R)}}else v?(u[l]=o,p(l)&&(h[l]=o)):x&&(l.value=o,n.k&&(u[n.k]=o))};if(o){const f=()=>{m(),bo.delete(n)};f.id=-1,bo.set(n,f),Je(f,e)}else qc(n),m()}}}function qc(n){const t=bo.get(n);t&&(t.flags|=8,bo.delete(n))}No().requestIdleCallback;No().cancelIdleCallback;const sr=n=>!!n.type.__asyncLoader,_f=n=>n.type.__isKeepAlive;function Pp(n,t){gf(n,"a",t)}function Lp(n,t){gf(n,"da",t)}function gf(n,t,e=Ve){const i=n.__wdc||(n.__wdc=()=>{let s=e;for(;s;){if(s.isDeactivated)return;s=s.parent}return n()});if(zo(t,i,e),e){let s=e.parent;for(;s&&s.parent;)_f(s.parent.vnode)&&Dp(i,t,e,s),s=s.parent}}function Dp(n,t,e,i){const s=zo(t,n,i,!0);uc(()=>{Kl(i[t],s)},e)}function zo(n,t,e=Ve,i=!1){if(e){const s=e[n]||(e[n]=[]),r=t.__weh||(t.__weh=(...o)=>{jn();const a=Sr(e),l=Pn(t,e,n,o);return a(),Zn(),l});return i?s.unshift(r):s.push(r),r}}const Jn=n=>(t,e=Ve)=>{(!mr||n==="sp")&&zo(n,(...i)=>t(...i),e)},Ip=Jn("bm"),vf=Jn("m"),Up=Jn("bu"),Np=Jn("u"),Op=Jn("bum"),uc=Jn("um"),Fp=Jn("sp"),Bp=Jn("rtg"),zp=Jn("rtc");function Hp(n,t=Ve){zo("ec",n,t)}const kp=Symbol.for("v-ndc"),$a=n=>n?zf(n)?pc(n):$a(n.parent):null,rr=Fe(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>$a(n.parent),$root:n=>$a(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>yf(n),$forceUpdate:n=>n.f||(n.f=()=>{lc(n.update)}),$nextTick:n=>n.n||(n.n=Ep.bind(n.proxy)),$watch:n=>Qp.bind(n)}),na=(n,t)=>n!==he&&!n.__isScriptSetup&&te(n,t),Vp={get({_:n},t){if(t==="__v_skip")return!0;const{ctx:e,setupState:i,data:s,props:r,accessCache:o,type:a,appContext:l}=n;if(t[0]!=="$"){const d=o[t];if(d!==void 0)switch(d){case 1:return i[t];case 2:return s[t];case 4:return e[t];case 3:return r[t]}else{if(na(i,t))return o[t]=1,i[t];if(s!==he&&te(s,t))return o[t]=2,s[t];if(te(r,t))return o[t]=3,r[t];if(e!==he&&te(e,t))return o[t]=4,e[t];Ja&&(o[t]=0)}}const c=rr[t];let u,h;if(c)return t==="$attrs"&&Ne(n.attrs,"get",""),c(n);if((u=a.__cssModules)&&(u=u[t]))return u;if(e!==he&&te(e,t))return o[t]=4,e[t];if(h=l.config.globalProperties,te(h,t))return h[t]},set({_:n},t,e){const{data:i,setupState:s,ctx:r}=n;return na(s,t)?(s[t]=e,!0):i!==he&&te(i,t)?(i[t]=e,!0):te(n.props,t)||t[0]==="$"&&t.slice(1)in n?!1:(r[t]=e,!0)},has({_:{data:n,setupState:t,accessCache:e,ctx:i,appContext:s,props:r,type:o}},a){let l;return!!(e[a]||n!==he&&a[0]!=="$"&&te(n,a)||na(t,a)||te(r,a)||te(i,a)||te(rr,a)||te(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(n,t,e){return e.get!=null?n._.accessCache[t]=0:te(e,"value")&&this.set(n,t,e.value,null),Reflect.defineProperty(n,t,e)}};function jc(n){return qt(n)?n.reduce((t,e)=>(t[e]=null,t),{}):n}let Ja=!0;function Gp(n){const t=yf(n),e=n.proxy,i=n.ctx;Ja=!1,t.beforeCreate&&Zc(t.beforeCreate,n,"bc");const{data:s,computed:r,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:p,updated:v,activated:x,deactivated:m,beforeDestroy:f,beforeUnmount:R,destroyed:w,unmounted:M,render:F,renderTracked:D,renderTriggered:L,errorCaptured:b,serverPrefetch:_,expose:g,inheritAttrs:A,components:O,directives:k,filters:J}=t;if(c&&Wp(c,i,null),o)for(const V in o){const G=o[V];Yt(G)&&(i[V]=G.bind(e))}if(s){const V=s.call(e,e);ge(V)&&(n.data=sc(V))}if(Ja=!0,r)for(const V in r){const G=r[V],it=Yt(G)?G.bind(e,e):Yt(G.get)?G.get.bind(e,e):Rn,vt=!Yt(G)&&Yt(G.set)?G.set.bind(e):Rn,W=kf({get:it,set:vt});Object.defineProperty(i,V,{enumerable:!0,configurable:!0,get:()=>W.value,set:rt=>W.value=rt})}if(a)for(const V in a)xf(a[V],i,e,V);if(l){const V=Yt(l)?l.call(e):l;Reflect.ownKeys(V).forEach(G=>{Kp(G,V[G])})}u&&Zc(u,n,"c");function Q(V,G){qt(G)?G.forEach(it=>V(it.bind(e))):G&&V(G.bind(e))}if(Q(Ip,h),Q(vf,d),Q(Up,p),Q(Np,v),Q(Pp,x),Q(Lp,m),Q(Hp,b),Q(zp,D),Q(Bp,L),Q(Op,R),Q(uc,M),Q(Fp,_),qt(g))if(g.length){const V=n.exposed||(n.exposed={});g.forEach(G=>{Object.defineProperty(V,G,{get:()=>e[G],set:it=>e[G]=it,enumerable:!0})})}else n.exposed||(n.exposed={});F&&n.render===Rn&&(n.render=F),A!=null&&(n.inheritAttrs=A),O&&(n.components=O),k&&(n.directives=k),_&&mf(n)}function Wp(n,t,e=Rn){qt(n)&&(n=Qa(n));for(const i in n){const s=n[i];let r;ge(s)?"default"in s?r=lo(s.from||i,s.default,!0):r=lo(s.from||i):r=lo(s),Oe(r)?Object.defineProperty(t,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):t[i]=r}}function Zc(n,t,e){Pn(qt(n)?n.map(i=>i.bind(t.proxy)):n.bind(t.proxy),t,e)}function xf(n,t,e,i){let s=i.includes(".")?Ef(e,i):()=>e[i];if(be(n)){const r=t[n];Yt(r)&&ia(s,r)}else if(Yt(n))ia(s,n.bind(e));else if(ge(n))if(qt(n))n.forEach(r=>xf(r,t,e,i));else{const r=Yt(n.handler)?n.handler.bind(e):t[n.handler];Yt(r)&&ia(s,r,n)}}function yf(n){const t=n.type,{mixins:e,extends:i}=t,{mixins:s,optionsCache:r,config:{optionMergeStrategies:o}}=n.appContext,a=r.get(t);let l;return a?l=a:!s.length&&!e&&!i?l=t:(l={},s.length&&s.forEach(c=>To(l,c,o,!0)),To(l,t,o)),ge(t)&&r.set(t,l),l}function To(n,t,e,i=!1){const{mixins:s,extends:r}=t;r&&To(n,r,e,!0),s&&s.forEach(o=>To(n,o,e,!0));for(const o in t)if(!(i&&o==="expose")){const a=Xp[o]||e&&e[o];n[o]=a?a(n[o],t[o]):t[o]}return n}const Xp={data:Kc,props:$c,emits:$c,methods:Zs,computed:Zs,beforeCreate:ze,created:ze,beforeMount:ze,mounted:ze,beforeUpdate:ze,updated:ze,beforeDestroy:ze,beforeUnmount:ze,destroyed:ze,unmounted:ze,activated:ze,deactivated:ze,errorCaptured:ze,serverPrefetch:ze,components:Zs,directives:Zs,watch:qp,provide:Kc,inject:Yp};function Kc(n,t){return t?n?function(){return Fe(Yt(n)?n.call(this,this):n,Yt(t)?t.call(this,this):t)}:t:n}function Yp(n,t){return Zs(Qa(n),Qa(t))}function Qa(n){if(qt(n)){const t={};for(let e=0;e<n.length;e++)t[n[e]]=n[e];return t}return n}function ze(n,t){return n?[...new Set([].concat(n,t))]:t}function Zs(n,t){return n?Fe(Object.create(null),n,t):t}function $c(n,t){return n?qt(n)&&qt(t)?[...new Set([...n,...t])]:Fe(Object.create(null),jc(n),jc(t??{})):t}function qp(n,t){if(!n)return t;if(!t)return n;const e=Fe(Object.create(null),n);for(const i in t)e[i]=ze(n[i],t[i]);return e}function Mf(){return{app:null,config:{isNativeTag:Bh,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 jp=0;function Zp(n,t){return function(i,s=null){Yt(i)||(i=Fe({},i)),s!=null&&!ge(s)&&(s=null);const r=Mf(),o=new WeakSet,a=[];let l=!1;const c=r.app={_uid:jp++,_component:i,_props:s,_container:null,_context:r,_instance:null,version:Um,get config(){return r.config},set config(u){},use(u,...h){return o.has(u)||(u&&Yt(u.install)?(o.add(u),u.install(c,...h)):Yt(u)&&(o.add(u),u(c,...h))),c},mixin(u){return r.mixins.includes(u)||r.mixins.push(u),c},component(u,h){return h?(r.components[u]=h,c):r.components[u]},directive(u,h){return h?(r.directives[u]=h,c):r.directives[u]},mount(u,h,d){if(!l){const p=c._ceVNode||on(i,s);return p.appContext=r,d===!0?d="svg":d===!1&&(d=void 0),n(p,u,d),l=!0,c._container=u,u.__vue_app__=c,pc(p.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Pn(a,c._instance,16),n(null,c._container),delete c._container.__vue_app__)},provide(u,h){return r.provides[u]=h,c},runWithContext(u){const h=ys;ys=c;try{return u()}finally{ys=h}}};return c}}let ys=null;function Kp(n,t){if(Ve){let e=Ve.provides;const i=Ve.parent&&Ve.parent.provides;i===e&&(e=Ve.provides=Object.create(i)),e[n]=t}}function lo(n,t,e=!1){const i=Rm();if(i||ys){let s=ys?ys._context.provides:i?i.parent==null||i.ce?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(s&&n in s)return s[n];if(arguments.length>1)return e&&Yt(t)?t.call(i&&i.proxy):t}}const $p=Symbol.for("v-scx"),Jp=()=>lo($p);function ia(n,t,e){return Sf(n,t,e)}function Sf(n,t,e=he){const{immediate:i,deep:s,flush:r,once:o}=e,a=Fe({},e),l=t&&i||!t&&r!=="post";let c;if(mr){if(r==="sync"){const p=Jp();c=p.__watcherHandles||(p.__watcherHandles=[])}else if(!l){const p=()=>{};return p.stop=Rn,p.resume=Rn,p.pause=Rn,p}}const u=Ve;a.call=(p,v,x)=>Pn(p,u,v,x);let h=!1;r==="post"?a.scheduler=p=>{Je(p,u&&u.suspense)}:r!=="sync"&&(h=!0,a.scheduler=(p,v)=>{v?p():lc(p)}),a.augmentJob=p=>{t&&(p.flags|=4),h&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const d=Mp(n,t,a);return mr&&(c?c.push(d):l&&d()),d}function Qp(n,t,e){const i=this.proxy,s=be(n)?n.includes(".")?Ef(i,n):()=>i[n]:n.bind(i,i);let r;Yt(t)?r=t:(r=t.handler,e=t);const o=Sr(this),a=Sf(s,r.bind(i),e);return o(),a}function Ef(n,t){const e=t.split(".");return()=>{let i=n;for(let s=0;s<e.length&&i;s++)i=i[e[s]];return i}}const tm=(n,t)=>t==="modelValue"||t==="model-value"?n.modelModifiers:n[`${t}Modifiers`]||n[`${vi(t)}Modifiers`]||n[`${qi(t)}Modifiers`];function em(n,t,...e){if(n.isUnmounted)return;const i=n.vnode.props||he;let s=e;const r=t.startsWith("update:"),o=r&&tm(i,t.slice(7));o&&(o.trim&&(s=e.map(u=>be(u)?u.trim():u)),o.number&&(s=e.map(Hd)));let a,l=i[a=Ko(t)]||i[a=Ko(vi(t))];!l&&r&&(l=i[a=Ko(qi(t))]),l&&Pn(l,n,6,s);const c=i[a+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[a])return;n.emitted[a]=!0,Pn(c,n,6,s)}}const nm=new WeakMap;function bf(n,t,e=!1){const i=e?nm:t.emitsCache,s=i.get(n);if(s!==void 0)return s;const r=n.emits;let o={},a=!1;if(!Yt(n)){const l=c=>{const u=bf(c,t,!0);u&&(a=!0,Fe(o,u))};!e&&t.mixins.length&&t.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!r&&!a?(ge(n)&&i.set(n,null),null):(qt(r)?r.forEach(l=>o[l]=null):Fe(o,r),ge(n)&&i.set(n,o),o)}function Ho(n,t){return!n||!Do(t)?!1:(t=t.slice(2).replace(/Once$/,""),te(n,t[0].toLowerCase()+t.slice(1))||te(n,qi(t))||te(n,t))}function Jc(n){const{type:t,vnode:e,proxy:i,withProxy:s,propsOptions:[r],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:p,ctx:v,inheritAttrs:x}=n,m=Eo(n);let f,R;try{if(e.shapeFlag&4){const M=s||i,F=M;f=bn(c.call(F,M,u,h,p,d,v)),R=a}else{const M=t;f=bn(M.length>1?M(h,{attrs:a,slots:o,emit:l}):M(h,null)),R=t.props?a:im(a)}}catch(M){or.length=0,Fo(M,n,1),f=on(yi)}let w=f;if(R&&x!==!1){const M=Object.keys(R),{shapeFlag:F}=w;M.length&&F&7&&(r&&M.some(Zl)&&(R=sm(R,r)),w=bs(w,R,!1,!0))}return e.dirs&&(w=bs(w,null,!1,!0),w.dirs=w.dirs?w.dirs.concat(e.dirs):e.dirs),e.transition&&cc(w,e.transition),f=w,Eo(m),f}const im=n=>{let t;for(const e in n)(e==="class"||e==="style"||Do(e))&&((t||(t={}))[e]=n[e]);return t},sm=(n,t)=>{const e={};for(const i in n)(!Zl(i)||!(i.slice(9)in t))&&(e[i]=n[i]);return e};function rm(n,t,e){const{props:i,children:s,component:r}=n,{props:o,children:a,patchFlag:l}=t,c=r.emitsOptions;if(t.dirs||t.transition)return!0;if(e&&l>=0){if(l&1024)return!0;if(l&16)return i?Qc(i,o,c):!!o;if(l&8){const u=t.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(o[d]!==i[d]&&!Ho(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:i===o?!1:i?o?Qc(i,o,c):!0:!!o;return!1}function Qc(n,t,e){const i=Object.keys(t);if(i.length!==Object.keys(n).length)return!0;for(let s=0;s<i.length;s++){const r=i[s];if(t[r]!==n[r]&&!Ho(e,r))return!0}return!1}function om({vnode:n,parent:t},e){for(;t;){const i=t.subTree;if(i.suspense&&i.suspense.activeBranch===n&&(i.el=n.el),i===n)(n=t.vnode).el=e,t=t.parent;else break}}const Tf={},wf=()=>Object.create(Tf),Af=n=>Object.getPrototypeOf(n)===Tf;function am(n,t,e,i=!1){const s={},r=wf();n.propsDefaults=Object.create(null),Rf(n,t,s,r);for(const o in n.propsOptions[0])o in s||(s[o]=void 0);e?n.props=i?s:dp(s):n.type.props?n.props=s:n.props=r,n.attrs=r}function lm(n,t,e,i){const{props:s,attrs:r,vnode:{patchFlag:o}}=n,a=Qt(s),[l]=n.propsOptions;let c=!1;if((i||o>0)&&!(o&16)){if(o&8){const u=n.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(Ho(n.emitsOptions,d))continue;const p=t[d];if(l)if(te(r,d))p!==r[d]&&(r[d]=p,c=!0);else{const v=vi(d);s[v]=tl(l,a,v,p,n,!1)}else p!==r[d]&&(r[d]=p,c=!0)}}}else{Rf(n,t,s,r)&&(c=!0);let u;for(const h in a)(!t||!te(t,h)&&((u=qi(h))===h||!te(t,u)))&&(l?e&&(e[h]!==void 0||e[u]!==void 0)&&(s[h]=tl(l,a,h,void 0,n,!0)):delete s[h]);if(r!==a)for(const h in r)(!t||!te(t,h))&&(delete r[h],c=!0)}c&&Gn(n.attrs,"set","")}function Rf(n,t,e,i){const[s,r]=n.propsOptions;let o=!1,a;if(t)for(let l in t){if(tr(l))continue;const c=t[l];let u;s&&te(s,u=vi(l))?!r||!r.includes(u)?e[u]=c:(a||(a={}))[u]=c:Ho(n.emitsOptions,l)||(!(l in i)||c!==i[l])&&(i[l]=c,o=!0)}if(r){const l=Qt(e),c=a||he;for(let u=0;u<r.length;u++){const h=r[u];e[h]=tl(s,l,h,c[h],n,!te(c,h))}}return o}function tl(n,t,e,i,s,r){const o=n[e];if(o!=null){const a=te(o,"default");if(a&&i===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Yt(l)){const{propsDefaults:c}=s;if(e in c)i=c[e];else{const u=Sr(s);i=c[e]=l.call(null,t),u()}}else i=l;s.ce&&s.ce._setProp(e,i)}o[0]&&(r&&!a?i=!1:o[1]&&(i===""||i===qi(e))&&(i=!0))}return i}const cm=new WeakMap;function Cf(n,t,e=!1){const i=e?cm:t.propsCache,s=i.get(n);if(s)return s;const r=n.props,o={},a=[];let l=!1;if(!Yt(n)){const u=h=>{l=!0;const[d,p]=Cf(h,t,!0);Fe(o,d),p&&a.push(...p)};!e&&t.mixins.length&&t.mixins.forEach(u),n.extends&&u(n.extends),n.mixins&&n.mixins.forEach(u)}if(!r&&!l)return ge(n)&&i.set(n,_s),_s;if(qt(r))for(let u=0;u<r.length;u++){const h=vi(r[u]);tu(h)&&(o[h]=he)}else if(r)for(const u in r){const h=vi(u);if(tu(h)){const d=r[u],p=o[h]=qt(d)||Yt(d)?{type:d}:Fe({},d),v=p.type;let x=!1,m=!0;if(qt(v))for(let f=0;f<v.length;++f){const R=v[f],w=Yt(R)&&R.name;if(w==="Boolean"){x=!0;break}else w==="String"&&(m=!1)}else x=Yt(v)&&v.name==="Boolean";p[0]=x,p[1]=m,(x||te(p,"default"))&&a.push(h)}}const c=[o,a];return ge(n)&&i.set(n,c),c}function tu(n){return n[0]!=="$"&&!tr(n)}const hc=n=>n==="_"||n==="_ctx"||n==="$stable",fc=n=>qt(n)?n.map(bn):[bn(n)],um=(n,t,e)=>{if(t._n)return t;const i=wp((...s)=>fc(t(...s)),e);return i._c=!1,i},Pf=(n,t,e)=>{const i=n._ctx;for(const s in n){if(hc(s))continue;const r=n[s];if(Yt(r))t[s]=um(s,r,i);else if(r!=null){const o=fc(r);t[s]=()=>o}}},Lf=(n,t)=>{const e=fc(t);n.slots.default=()=>e},Df=(n,t,e)=>{for(const i in t)(e||!hc(i))&&(n[i]=t[i])},hm=(n,t,e)=>{const i=n.slots=wf();if(n.vnode.shapeFlag&32){const s=t._;s?(Df(i,t,e),e&&Wh(i,"_",s,!0)):Pf(t,i)}else t&&Lf(n,t)},fm=(n,t,e)=>{const{vnode:i,slots:s}=n;let r=!0,o=he;if(i.shapeFlag&32){const a=t._;a?e&&a===1?r=!1:Df(s,t,e):(r=!t.$stable,Pf(t,s)),o=t}else t&&(Lf(n,t),o={default:1});if(r)for(const a in s)!hc(a)&&o[a]==null&&delete s[a]},Je=gm;function dm(n){return pm(n)}function pm(n,t){const e=No();e.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:p=Rn,insertStaticContent:v}=n,x=(T,C,S,H=null,U=null,z=null,B=void 0,tt=null,j=!!C.dynamicChildren)=>{if(T===C)return;T&&!zs(T,C)&&(H=ut(T),rt(T,U,z,!0),T=null),C.patchFlag===-2&&(j=!1,C.dynamicChildren=null);const{type:E,ref:y,shapeFlag:N}=C;switch(E){case ko:m(T,C,S,H);break;case yi:f(T,C,S,H);break;case ra:T==null&&R(C,S,H,B);break;case En:O(T,C,S,H,U,z,B,tt,j);break;default:N&1?F(T,C,S,H,U,z,B,tt,j):N&6?k(T,C,S,H,U,z,B,tt,j):(N&64||N&128)&&E.process(T,C,S,H,U,z,B,tt,j,gt)}y!=null&&U?ir(y,T&&T.ref,z,C||T,!C):y==null&&T&&T.ref!=null&&ir(T.ref,null,z,T,!0)},m=(T,C,S,H)=>{if(T==null)i(C.el=a(C.children),S,H);else{const U=C.el=T.el;C.children!==T.children&&c(U,C.children)}},f=(T,C,S,H)=>{T==null?i(C.el=l(C.children||""),S,H):C.el=T.el},R=(T,C,S,H)=>{[T.el,T.anchor]=v(T.children,C,S,H,T.el,T.anchor)},w=({el:T,anchor:C},S,H)=>{let U;for(;T&&T!==C;)U=d(T),i(T,S,H),T=U;i(C,S,H)},M=({el:T,anchor:C})=>{let S;for(;T&&T!==C;)S=d(T),s(T),T=S;s(C)},F=(T,C,S,H,U,z,B,tt,j)=>{if(C.type==="svg"?B="svg":C.type==="math"&&(B="mathml"),T==null)D(C,S,H,U,z,B,tt,j);else{const E=T.el&&T.el._isVueCE?T.el:null;try{E&&E._beginPatch(),_(T,C,U,z,B,tt,j)}finally{E&&E._endPatch()}}},D=(T,C,S,H,U,z,B,tt)=>{let j,E;const{props:y,shapeFlag:N,transition:X,dirs:nt}=T;if(j=T.el=o(T.type,z,y&&y.is,y),N&8?u(j,T.children):N&16&&b(T.children,j,null,H,U,sa(T,z),B,tt),nt&&Ti(T,null,H,"created"),L(j,T,T.scopeId,B,H),y){for(const xt in y)xt!=="value"&&!tr(xt)&&r(j,xt,null,y[xt],z,H);"value"in y&&r(j,"value",null,y.value,z),(E=y.onVnodeBeforeMount)&&xn(E,H,T)}nt&&Ti(T,null,H,"beforeMount");const K=mm(U,X);K&&X.beforeEnter(j),i(j,C,S),((E=y&&y.onVnodeMounted)||K||nt)&&Je(()=>{E&&xn(E,H,T),K&&X.enter(j),nt&&Ti(T,null,H,"mounted")},U)},L=(T,C,S,H,U)=>{if(S&&p(T,S),H)for(let z=0;z<H.length;z++)p(T,H[z]);if(U){let z=U.subTree;if(C===z||Nf(z.type)&&(z.ssContent===C||z.ssFallback===C)){const B=U.vnode;L(T,B,B.scopeId,B.slotScopeIds,U.parent)}}},b=(T,C,S,H,U,z,B,tt,j=0)=>{for(let E=j;E<T.length;E++){const y=T[E]=tt?hi(T[E]):bn(T[E]);x(null,y,C,S,H,U,z,B,tt)}},_=(T,C,S,H,U,z,B)=>{const tt=C.el=T.el;let{patchFlag:j,dynamicChildren:E,dirs:y}=C;j|=T.patchFlag&16;const N=T.props||he,X=C.props||he;let nt;if(S&&wi(S,!1),(nt=X.onVnodeBeforeUpdate)&&xn(nt,S,C,T),y&&Ti(C,T,S,"beforeUpdate"),S&&wi(S,!0),(N.innerHTML&&X.innerHTML==null||N.textContent&&X.textContent==null)&&u(tt,""),E?g(T.dynamicChildren,E,tt,S,H,sa(C,U),z):B||G(T,C,tt,null,S,H,sa(C,U),z,!1),j>0){if(j&16)A(tt,N,X,S,U);else if(j&2&&N.class!==X.class&&r(tt,"class",null,X.class,U),j&4&&r(tt,"style",N.style,X.style,U),j&8){const K=C.dynamicProps;for(let xt=0;xt<K.length;xt++){const dt=K[xt],St=N[dt],Ft=X[dt];(Ft!==St||dt==="value")&&r(tt,dt,St,Ft,U,S)}}j&1&&T.children!==C.children&&u(tt,C.children)}else!B&&E==null&&A(tt,N,X,S,U);((nt=X.onVnodeUpdated)||y)&&Je(()=>{nt&&xn(nt,S,C,T),y&&Ti(C,T,S,"updated")},H)},g=(T,C,S,H,U,z,B)=>{for(let tt=0;tt<C.length;tt++){const j=T[tt],E=C[tt],y=j.el&&(j.type===En||!zs(j,E)||j.shapeFlag&198)?h(j.el):S;x(j,E,y,null,H,U,z,B,!0)}},A=(T,C,S,H,U)=>{if(C!==S){if(C!==he)for(const z in C)!tr(z)&&!(z in S)&&r(T,z,C[z],null,U,H);for(const z in S){if(tr(z))continue;const B=S[z],tt=C[z];B!==tt&&z!=="value"&&r(T,z,tt,B,U,H)}"value"in S&&r(T,"value",C.value,S.value,U)}},O=(T,C,S,H,U,z,B,tt,j)=>{const E=C.el=T?T.el:a(""),y=C.anchor=T?T.anchor:a("");let{patchFlag:N,dynamicChildren:X,slotScopeIds:nt}=C;nt&&(tt=tt?tt.concat(nt):nt),T==null?(i(E,S,H),i(y,S,H),b(C.children||[],S,y,U,z,B,tt,j)):N>0&&N&64&&X&&T.dynamicChildren?(g(T.dynamicChildren,X,S,U,z,B,tt),(C.key!=null||U&&C===U.subTree)&&If(T,C,!0)):G(T,C,S,y,U,z,B,tt,j)},k=(T,C,S,H,U,z,B,tt,j)=>{C.slotScopeIds=tt,T==null?C.shapeFlag&512?U.ctx.activate(C,S,H,B,j):J(C,S,H,U,z,B,j):st(T,C,j)},J=(T,C,S,H,U,z,B)=>{const tt=T.component=Am(T,H,U);if(_f(T)&&(tt.ctx.renderer=gt),Cm(tt,!1,B),tt.asyncDep){if(U&&U.registerDep(tt,Q,B),!T.el){const j=tt.subTree=on(yi);f(null,j,C,S),T.placeholder=j.el}}else Q(tt,T,C,S,U,z,B)},st=(T,C,S)=>{const H=C.component=T.component;if(rm(T,C,S))if(H.asyncDep&&!H.asyncResolved){V(H,C,S);return}else H.next=C,H.update();else C.el=T.el,H.vnode=C},Q=(T,C,S,H,U,z,B)=>{const tt=()=>{if(T.isMounted){let{next:N,bu:X,u:nt,parent:K,vnode:xt}=T;{const Et=Uf(T);if(Et){N&&(N.el=xt.el,V(T,N,B)),Et.asyncDep.then(()=>{T.isUnmounted||tt()});return}}let dt=N,St;wi(T,!1),N?(N.el=xt.el,V(T,N,B)):N=xt,X&&$o(X),(St=N.props&&N.props.onVnodeBeforeUpdate)&&xn(St,K,N,xt),wi(T,!0);const Ft=Jc(T),mt=T.subTree;T.subTree=Ft,x(mt,Ft,h(mt.el),ut(mt),T,U,z),N.el=Ft.el,dt===null&&om(T,Ft.el),nt&&Je(nt,U),(St=N.props&&N.props.onVnodeUpdated)&&Je(()=>xn(St,K,N,xt),U)}else{let N;const{el:X,props:nt}=C,{bm:K,m:xt,parent:dt,root:St,type:Ft}=T,mt=sr(C);wi(T,!1),K&&$o(K),!mt&&(N=nt&&nt.onVnodeBeforeMount)&&xn(N,dt,C),wi(T,!0);{St.ce&&St.ce._def.shadowRoot!==!1&&St.ce._injectChildStyle(Ft);const Et=T.subTree=Jc(T);x(null,Et,S,H,T,U,z),C.el=Et.el}if(xt&&Je(xt,U),!mt&&(N=nt&&nt.onVnodeMounted)){const Et=C;Je(()=>xn(N,dt,Et),U)}(C.shapeFlag&256||dt&&sr(dt.vnode)&&dt.vnode.shapeFlag&256)&&T.a&&Je(T.a,U),T.isMounted=!0,C=S=H=null}};T.scope.on();const j=T.effect=new jh(tt);T.scope.off();const E=T.update=j.run.bind(j),y=T.job=j.runIfDirty.bind(j);y.i=T,y.id=T.uid,j.scheduler=()=>lc(y),wi(T,!0),E()},V=(T,C,S)=>{C.component=T;const H=T.vnode.props;T.vnode=C,T.next=null,lm(T,C.props,H,S),fm(T,C.children,S),jn(),Yc(T),Zn()},G=(T,C,S,H,U,z,B,tt,j=!1)=>{const E=T&&T.children,y=T?T.shapeFlag:0,N=C.children,{patchFlag:X,shapeFlag:nt}=C;if(X>0){if(X&128){vt(E,N,S,H,U,z,B,tt,j);return}else if(X&256){it(E,N,S,H,U,z,B,tt,j);return}}nt&8?(y&16&&pt(E,U,z),N!==E&&u(S,N)):y&16?nt&16?vt(E,N,S,H,U,z,B,tt,j):pt(E,U,z,!0):(y&8&&u(S,""),nt&16&&b(N,S,H,U,z,B,tt,j))},it=(T,C,S,H,U,z,B,tt,j)=>{T=T||_s,C=C||_s;const E=T.length,y=C.length,N=Math.min(E,y);let X;for(X=0;X<N;X++){const nt=C[X]=j?hi(C[X]):bn(C[X]);x(T[X],nt,S,null,U,z,B,tt,j)}E>y?pt(T,U,z,!0,!1,N):b(C,S,H,U,z,B,tt,j,N)},vt=(T,C,S,H,U,z,B,tt,j)=>{let E=0;const y=C.length;let N=T.length-1,X=y-1;for(;E<=N&&E<=X;){const nt=T[E],K=C[E]=j?hi(C[E]):bn(C[E]);if(zs(nt,K))x(nt,K,S,null,U,z,B,tt,j);else break;E++}for(;E<=N&&E<=X;){const nt=T[N],K=C[X]=j?hi(C[X]):bn(C[X]);if(zs(nt,K))x(nt,K,S,null,U,z,B,tt,j);else break;N--,X--}if(E>N){if(E<=X){const nt=X+1,K=nt<y?C[nt].el:H;for(;E<=X;)x(null,C[E]=j?hi(C[E]):bn(C[E]),S,K,U,z,B,tt,j),E++}}else if(E>X)for(;E<=N;)rt(T[E],U,z,!0),E++;else{const nt=E,K=E,xt=new Map;for(E=K;E<=X;E++){const Tt=C[E]=j?hi(C[E]):bn(C[E]);Tt.key!=null&&xt.set(Tt.key,E)}let dt,St=0;const Ft=X-K+1;let mt=!1,Et=0;const Dt=new Array(Ft);for(E=0;E<Ft;E++)Dt[E]=0;for(E=nt;E<=N;E++){const Tt=T[E];if(St>=Ft){rt(Tt,U,z,!0);continue}let zt;if(Tt.key!=null)zt=xt.get(Tt.key);else for(dt=K;dt<=X;dt++)if(Dt[dt-K]===0&&zs(Tt,C[dt])){zt=dt;break}zt===void 0?rt(Tt,U,z,!0):(Dt[zt-K]=E+1,zt>=Et?Et=zt:mt=!0,x(Tt,C[zt],S,null,U,z,B,tt,j),St++)}const Bt=mt?_m(Dt):_s;for(dt=Bt.length-1,E=Ft-1;E>=0;E--){const Tt=K+E,zt=C[Tt],Vt=C[Tt+1],ee=Tt+1<y?Vt.el||Vt.placeholder:H;Dt[E]===0?x(null,zt,S,ee,U,z,B,tt,j):mt&&(dt<0||E!==Bt[dt]?W(zt,S,ee,2):dt--)}}},W=(T,C,S,H,U=null)=>{const{el:z,type:B,transition:tt,children:j,shapeFlag:E}=T;if(E&6){W(T.component.subTree,C,S,H);return}if(E&128){T.suspense.move(C,S,H);return}if(E&64){B.move(T,C,S,gt);return}if(B===En){i(z,C,S);for(let N=0;N<j.length;N++)W(j[N],C,S,H);i(T.anchor,C,S);return}if(B===ra){w(T,C,S);return}if(H!==2&&E&1&&tt)if(H===0)tt.beforeEnter(z),i(z,C,S),Je(()=>tt.enter(z),U);else{const{leave:N,delayLeave:X,afterLeave:nt}=tt,K=()=>{T.ctx.isUnmounted?s(z):i(z,C,S)},xt=()=>{z._isLeaving&&z[Cp](!0),N(z,()=>{K(),nt&&nt()})};X?X(z,K,xt):xt()}else i(z,C,S)},rt=(T,C,S,H=!1,U=!1)=>{const{type:z,props:B,ref:tt,children:j,dynamicChildren:E,shapeFlag:y,patchFlag:N,dirs:X,cacheIndex:nt}=T;if(N===-2&&(U=!1),tt!=null&&(jn(),ir(tt,null,S,T,!0),Zn()),nt!=null&&(C.renderCache[nt]=void 0),y&256){C.ctx.deactivate(T);return}const K=y&1&&X,xt=!sr(T);let dt;if(xt&&(dt=B&&B.onVnodeBeforeUnmount)&&xn(dt,C,T),y&6)lt(T.component,S,H);else{if(y&128){T.suspense.unmount(S,H);return}K&&Ti(T,null,C,"beforeUnmount"),y&64?T.type.remove(T,C,S,gt,H):E&&!E.hasOnce&&(z!==En||N>0&&N&64)?pt(E,C,S,!1,!0):(z===En&&N&384||!U&&y&16)&&pt(j,C,S),H&&ct(T)}(xt&&(dt=B&&B.onVnodeUnmounted)||K)&&Je(()=>{dt&&xn(dt,C,T),K&&Ti(T,null,C,"unmounted")},S)},ct=T=>{const{type:C,el:S,anchor:H,transition:U}=T;if(C===En){$(S,H);return}if(C===ra){M(T);return}const z=()=>{s(S),U&&!U.persisted&&U.afterLeave&&U.afterLeave()};if(T.shapeFlag&1&&U&&!U.persisted){const{leave:B,delayLeave:tt}=U,j=()=>B(S,z);tt?tt(T.el,z,j):j()}else z()},$=(T,C)=>{let S;for(;T!==C;)S=d(T),s(T),T=S;s(C)},lt=(T,C,S)=>{const{bum:H,scope:U,job:z,subTree:B,um:tt,m:j,a:E}=T;eu(j),eu(E),H&&$o(H),U.stop(),z&&(z.flags|=8,rt(B,T,C,S)),tt&&Je(tt,C),Je(()=>{T.isUnmounted=!0},C)},pt=(T,C,S,H=!1,U=!1,z=0)=>{for(let B=z;B<T.length;B++)rt(T[B],C,S,H,U)},ut=T=>{if(T.shapeFlag&6)return ut(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const C=d(T.anchor||T.el),S=C&&C[Ap];return S?d(S):C};let et=!1;const ft=(T,C,S)=>{T==null?C._vnode&&rt(C._vnode,null,null,!0):x(C._vnode||null,T,C,null,null,null,S),C._vnode=T,et||(et=!0,Yc(),ff(),et=!1)},gt={p:x,um:rt,m:W,r:ct,mt:J,mc:b,pc:G,pbc:g,n:ut,o:n};return{render:ft,hydrate:void 0,createApp:Zp(ft)}}function sa({type:n,props:t},e){return e==="svg"&&n==="foreignObject"||e==="mathml"&&n==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:e}function wi({effect:n,job:t},e){e?(n.flags|=32,t.flags|=4):(n.flags&=-33,t.flags&=-5)}function mm(n,t){return(!n||n&&!n.pendingBranch)&&t&&!t.persisted}function If(n,t,e=!1){const i=n.children,s=t.children;if(qt(i)&&qt(s))for(let r=0;r<i.length;r++){const o=i[r];let a=s[r];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[r]=hi(s[r]),a.el=o.el),!e&&a.patchFlag!==-2&&If(o,a)),a.type===ko&&a.patchFlag!==-1&&(a.el=o.el),a.type===yi&&!a.el&&(a.el=o.el)}}function _m(n){const t=n.slice(),e=[0];let i,s,r,o,a;const l=n.length;for(i=0;i<l;i++){const c=n[i];if(c!==0){if(s=e[e.length-1],n[s]<c){t[i]=s,e.push(i);continue}for(r=0,o=e.length-1;r<o;)a=r+o>>1,n[e[a]]<c?r=a+1:o=a;c<n[e[r]]&&(r>0&&(t[i]=e[r-1]),e[r]=i)}}for(r=e.length,o=e[r-1];r-- >0;)e[r]=o,o=t[o];return e}function Uf(n){const t=n.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Uf(t)}function eu(n){if(n)for(let t=0;t<n.length;t++)n[t].flags|=8}const Nf=n=>n.__isSuspense;function gm(n,t){t&&t.pendingBranch?qt(n)?t.effects.push(...n):t.effects.push(n):Tp(n)}const En=Symbol.for("v-fgt"),ko=Symbol.for("v-txt"),yi=Symbol.for("v-cmt"),ra=Symbol.for("v-stc"),or=[];let tn=null;function Mr(n=!1){or.push(tn=n?null:[])}function vm(){or.pop(),tn=or[or.length-1]||null}let pr=1;function nu(n,t=!1){pr+=n,n<0&&tn&&t&&(tn.hasOnce=!0)}function Of(n){return n.dynamicChildren=pr>0?tn||_s:null,vm(),pr>0&&tn&&tn.push(n),n}function Vo(n,t,e,i,s,r){return Of(ie(n,t,e,i,s,r,!0))}function xm(n,t,e,i,s){return Of(on(n,t,e,i,s,!0))}function Ff(n){return n?n.__v_isVNode===!0:!1}function zs(n,t){return n.type===t.type&&n.key===t.key}const Bf=({key:n})=>n??null,co=({ref:n,ref_key:t,ref_for:e})=>(typeof n=="number"&&(n=""+n),n!=null?be(n)||Oe(n)||Yt(n)?{i:wn,r:n,k:t,f:!!e}:n:null);function ie(n,t=null,e=null,i=0,s=null,r=n===En?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:t,key:t&&Bf(t),ref:t&&co(t),scopeId:pf,slotScopeIds:null,children:e,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:wn};return a?(dc(l,e),r&128&&n.normalize(l)):e&&(l.shapeFlag|=be(e)?8:16),pr>0&&!o&&tn&&(l.patchFlag>0||r&6)&&l.patchFlag!==32&&tn.push(l),l}const on=ym;function ym(n,t=null,e=null,i=0,s=null,r=!1){if((!n||n===kp)&&(n=yi),Ff(n)){const a=bs(n,t,!0);return e&&dc(a,e),pr>0&&!r&&tn&&(a.shapeFlag&6?tn[tn.indexOf(n)]=a:tn.push(a)),a.patchFlag=-2,a}if(Im(n)&&(n=n.__vccOpts),t){t=Mm(t);let{class:a,style:l}=t;a&&!be(a)&&(t.class=Hi(a)),ge(l)&&(oc(l)&&!qt(l)&&(l=Fe({},l)),t.style=Oo(l))}const o=be(n)?1:Nf(n)?128:Rp(n)?64:ge(n)?4:Yt(n)?2:0;return ie(n,t,e,i,s,o,r,!0)}function Mm(n){return n?oc(n)||Af(n)?Fe({},n):n:null}function bs(n,t,e=!1,i=!1){const{props:s,ref:r,patchFlag:o,children:a,transition:l}=n,c=t?bm(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:n.type,props:c,key:c&&Bf(c),ref:t&&t.ref?e&&r?qt(r)?r.concat(co(t)):[r,co(t)]:co(t):r,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:a,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:t&&n.type!==En?o===-1?16:o|16:o,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:l,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&bs(n.ssContent),ssFallback:n.ssFallback&&bs(n.ssFallback),placeholder:n.placeholder,el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return l&&i&&cc(u,l.clone(u)),u}function Sm(n=" ",t=0){return on(ko,null,n,t)}function Em(n="",t=!1){return t?(Mr(),xm(yi,null,n)):on(yi,null,n)}function bn(n){return n==null||typeof n=="boolean"?on(yi):qt(n)?on(En,null,n.slice()):Ff(n)?hi(n):on(ko,null,String(n))}function hi(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:bs(n)}function dc(n,t){let e=0;const{shapeFlag:i}=n;if(t==null)t=null;else if(qt(t))e=16;else if(typeof t=="object")if(i&65){const s=t.default;s&&(s._c&&(s._d=!1),dc(n,s()),s._c&&(s._d=!0));return}else{e=32;const s=t._;!s&&!Af(t)?t._ctx=wn:s===3&&wn&&(wn.slots._===1?t._=1:(t._=2,n.patchFlag|=1024))}else Yt(t)?(t={default:t,_ctx:wn},e=32):(t=String(t),i&64?(e=16,t=[Sm(t)]):e=8);n.children=t,n.shapeFlag|=e}function bm(...n){const t={};for(let e=0;e<n.length;e++){const i=n[e];for(const s in i)if(s==="class")t.class!==i.class&&(t.class=Hi([t.class,i.class]));else if(s==="style")t.style=Oo([t.style,i.style]);else if(Do(s)){const r=t[s],o=i[s];o&&r!==o&&!(qt(r)&&r.includes(o))&&(t[s]=r?[].concat(r,o):o)}else s!==""&&(t[s]=i[s])}return t}function xn(n,t,e,i=null){Pn(n,t,7,[e,i])}const Tm=Mf();let wm=0;function Am(n,t,e){const i=n.type,s=(t?t.appContext:n.appContext)||Tm,r={uid:wm++,vnode:n,type:i,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new qd(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Cf(i,s),emitsOptions:bf(i,s),emit:null,emitted:null,propsDefaults:he,inheritAttrs:i.inheritAttrs,ctx:he,data:he,props:he,attrs:he,slots:he,refs:he,setupState:he,setupContext:null,suspense:e,suspenseId:e?e.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=t?t.root:r,r.emit=em.bind(null,r),n.ce&&n.ce(r),r}let Ve=null;const Rm=()=>Ve||wn;let wo,el;{const n=No(),t=(e,i)=>{let s;return(s=n[e])||(s=n[e]=[]),s.push(i),r=>{s.length>1?s.forEach(o=>o(r)):s[0](r)}};wo=t("__VUE_INSTANCE_SETTERS__",e=>Ve=e),el=t("__VUE_SSR_SETTERS__",e=>mr=e)}const Sr=n=>{const t=Ve;return wo(n),n.scope.on(),()=>{n.scope.off(),wo(t)}},iu=()=>{Ve&&Ve.scope.off(),wo(null)};function zf(n){return n.vnode.shapeFlag&4}let mr=!1;function Cm(n,t=!1,e=!1){t&&el(t);const{props:i,children:s}=n.vnode,r=zf(n);am(n,i,r,t),hm(n,s,e||t);const o=r?Pm(n,t):void 0;return t&&el(!1),o}function Pm(n,t){const e=n.type;n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,Vp);const{setup:i}=e;if(i){jn();const s=n.setupContext=i.length>1?Dm(n):null,r=Sr(n),o=yr(i,n,0,[n.props,s]),a=Hh(o);if(Zn(),r(),(a||n.sp)&&!sr(n)&&mf(n),a){if(o.then(iu,iu),t)return o.then(l=>{su(n,l)}).catch(l=>{Fo(l,n,0)});n.asyncDep=o}else su(n,o)}else Hf(n)}function su(n,t,e){Yt(t)?n.type.__ssrInlineRender?n.ssrRender=t:n.render=t:ge(t)&&(n.setupState=cf(t)),Hf(n)}function Hf(n,t,e){const i=n.type;n.render||(n.render=i.render||Rn);{const s=Sr(n);jn();try{Gp(n)}finally{Zn(),s()}}}const Lm={get(n,t){return Ne(n,"get",""),n[t]}};function Dm(n){const t=e=>{n.exposed=e||{}};return{attrs:new Proxy(n.attrs,Lm),slots:n.slots,emit:n.emit,expose:t}}function pc(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(cf(pp(n.exposed)),{get(t,e){if(e in t)return t[e];if(e in rr)return rr[e](n)},has(t,e){return e in t||e in rr}})):n.proxy}function Im(n){return Yt(n)&&"__vccOpts"in n}const kf=(n,t)=>xp(n,t,mr),Um="3.5.25";/**
|
||
* @vue/runtime-dom v3.5.25
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let nl;const ru=typeof window<"u"&&window.trustedTypes;if(ru)try{nl=ru.createPolicy("vue",{createHTML:n=>n})}catch{}const Vf=nl?n=>nl.createHTML(n):n=>n,Nm="http://www.w3.org/2000/svg",Om="http://www.w3.org/1998/Math/MathML",kn=typeof document<"u"?document:null,ou=kn&&kn.createElement("template"),Fm={insert:(n,t,e)=>{t.insertBefore(n,e||null)},remove:n=>{const t=n.parentNode;t&&t.removeChild(n)},createElement:(n,t,e,i)=>{const s=t==="svg"?kn.createElementNS(Nm,n):t==="mathml"?kn.createElementNS(Om,n):e?kn.createElement(n,{is:e}):kn.createElement(n);return n==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:n=>kn.createTextNode(n),createComment:n=>kn.createComment(n),setText:(n,t)=>{n.nodeValue=t},setElementText:(n,t)=>{n.textContent=t},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>kn.querySelector(n),setScopeId(n,t){n.setAttribute(t,"")},insertStaticContent(n,t,e,i,s,r){const o=e?e.previousSibling:t.lastChild;if(s&&(s===r||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),e),!(s===r||!(s=s.nextSibling)););else{ou.innerHTML=Vf(i==="svg"?`<svg>${n}</svg>`:i==="mathml"?`<math>${n}</math>`:n);const a=ou.content;if(i==="svg"||i==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,e)}return[o?o.nextSibling:t.firstChild,e?e.previousSibling:t.lastChild]}},Bm=Symbol("_vtc");function zm(n,t,e){const i=n[Bm];i&&(t=(t?[t,...i]:[...i]).join(" ")),t==null?n.removeAttribute("class"):e?n.setAttribute("class",t):n.className=t}const au=Symbol("_vod"),Hm=Symbol("_vsh"),km=Symbol(""),Vm=/(?:^|;)\s*display\s*:/;function Gm(n,t,e){const i=n.style,s=be(e);let r=!1;if(e&&!s){if(t)if(be(t))for(const o of t.split(";")){const a=o.slice(0,o.indexOf(":")).trim();e[a]==null&&uo(i,a,"")}else for(const o in t)e[o]==null&&uo(i,o,"");for(const o in e)o==="display"&&(r=!0),uo(i,o,e[o])}else if(s){if(t!==e){const o=i[km];o&&(e+=";"+o),i.cssText=e,r=Vm.test(e)}}else t&&n.removeAttribute("style");au in n&&(n[au]=r?i.display:"",n[Hm]&&(i.display="none"))}const lu=/\s*!important$/;function uo(n,t,e){if(qt(e))e.forEach(i=>uo(n,t,i));else if(e==null&&(e=""),t.startsWith("--"))n.setProperty(t,e);else{const i=Wm(n,t);lu.test(e)?n.setProperty(qi(i),e.replace(lu,""),"important"):n[i]=e}}const cu=["Webkit","Moz","ms"],oa={};function Wm(n,t){const e=oa[t];if(e)return e;let i=vi(t);if(i!=="filter"&&i in n)return oa[t]=i;i=Gh(i);for(let s=0;s<cu.length;s++){const r=cu[s]+i;if(r in n)return oa[t]=r}return t}const uu="http://www.w3.org/1999/xlink";function hu(n,t,e,i,s,r=Yd(t)){i&&t.startsWith("xlink:")?e==null?n.removeAttributeNS(uu,t.slice(6,t.length)):n.setAttributeNS(uu,t,e):e==null||r&&!Xh(e)?n.removeAttribute(t):n.setAttribute(t,r?"":Ei(e)?String(e):e)}function fu(n,t,e,i,s){if(t==="innerHTML"||t==="textContent"){e!=null&&(n[t]=t==="innerHTML"?Vf(e):e);return}const r=n.tagName;if(t==="value"&&r!=="PROGRESS"&&!r.includes("-")){const a=r==="OPTION"?n.getAttribute("value")||"":n.value,l=e==null?n.type==="checkbox"?"on":"":String(e);(a!==l||!("_value"in n))&&(n.value=l),e==null&&n.removeAttribute(t),n._value=e;return}let o=!1;if(e===""||e==null){const a=typeof n[t];a==="boolean"?e=Xh(e):e==null&&a==="string"?(e="",o=!0):a==="number"&&(e=0,o=!0)}try{n[t]=e}catch{}o&&n.removeAttribute(s||t)}function Xm(n,t,e,i){n.addEventListener(t,e,i)}function Ym(n,t,e,i){n.removeEventListener(t,e,i)}const du=Symbol("_vei");function qm(n,t,e,i,s=null){const r=n[du]||(n[du]={}),o=r[t];if(i&&o)o.value=i;else{const[a,l]=jm(t);if(i){const c=r[t]=$m(i,s);Xm(n,a,c,l)}else o&&(Ym(n,a,o,l),r[t]=void 0)}}const pu=/(?:Once|Passive|Capture)$/;function jm(n){let t;if(pu.test(n)){t={};let i;for(;i=n.match(pu);)n=n.slice(0,n.length-i[0].length),t[i[0].toLowerCase()]=!0}return[n[2]===":"?n.slice(3):qi(n.slice(2)),t]}let aa=0;const Zm=Promise.resolve(),Km=()=>aa||(Zm.then(()=>aa=0),aa=Date.now());function $m(n,t){const e=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=e.attached)return;Pn(Jm(i,e.value),t,5,[i])};return e.value=n,e.attached=Km(),e}function Jm(n,t){if(qt(t)){const e=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{e.call(n),n._stopped=!0},t.map(i=>s=>!s._stopped&&i&&i(s))}else return t}const mu=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,Qm=(n,t,e,i,s,r)=>{const o=s==="svg";t==="class"?zm(n,i,o):t==="style"?Gm(n,e,i):Do(t)?Zl(t)||qm(n,t,e,i,r):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):t_(n,t,i,o))?(fu(n,t,i),!n.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&hu(n,t,i,o,r,t!=="value")):n._isVueCE&&(/[A-Z]/.test(t)||!be(i))?fu(n,vi(t),i,r,t):(t==="true-value"?n._trueValue=i:t==="false-value"&&(n._falseValue=i),hu(n,t,i,o))};function t_(n,t,e,i){if(i)return!!(t==="innerHTML"||t==="textContent"||t in n&&mu(t)&&Yt(e));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&n.tagName==="IFRAME"||t==="form"||t==="list"&&n.tagName==="INPUT"||t==="type"&&n.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=n.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return mu(t)&&be(e)?!1:t in n}const e_=Fe({patchProp:Qm},Fm);let _u;function n_(){return _u||(_u=dm(e_))}const i_=((...n)=>{const t=n_().createApp(...n),{mount:e}=t;return t.mount=i=>{const s=r_(i);if(!s)return;const r=t._component;!Yt(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=e(s,!1,s_(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},t});function s_(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function r_(n){return be(n)?document.querySelector(n):n}/**
|
||
* @license
|
||
* Copyright 2010-2024 Three.js Authors
|
||
* SPDX-License-Identifier: MIT
|
||
*/const mc="170",Yn={ROTATE:0,DOLLY:1,PAN:2},fs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o_=0,gu=1,a_=2,Gf=1,l_=2,Hn=3,Mi=0,qe=1,rn=2,_i=0,Ms=1,vu=2,xu=3,yu=4,c_=5,Fi=100,u_=101,h_=102,f_=103,d_=104,p_=200,m_=201,__=202,g_=203,il=204,sl=205,v_=206,x_=207,y_=208,M_=209,S_=210,E_=211,b_=212,T_=213,w_=214,rl=0,ol=1,al=2,Ts=3,ll=4,cl=5,ul=6,hl=7,_c=0,A_=1,R_=2,gi=0,C_=1,P_=2,L_=3,D_=4,I_=5,U_=6,N_=7,Wf=300,ws=301,As=302,fl=303,dl=304,Go=306,pl=1e3,ki=1001,ml=1002,_n=1003,O_=1004,Lr=1005,An=1006,la=1007,Vi=1008,$n=1009,Xf=1010,Yf=1011,_r=1012,gc=1013,Wi=1014,Wn=1015,Er=1016,vc=1017,xc=1018,Rs=1020,qf=35902,jf=1021,Zf=1022,dn=1023,Kf=1024,$f=1025,Ss=1026,Cs=1027,Jf=1028,yc=1029,Qf=1030,Mc=1031,Sc=1033,ho=33776,fo=33777,po=33778,mo=33779,_l=35840,gl=35841,vl=35842,xl=35843,yl=36196,Ml=37492,Sl=37496,El=37808,bl=37809,Tl=37810,wl=37811,Al=37812,Rl=37813,Cl=37814,Pl=37815,Ll=37816,Dl=37817,Il=37818,Ul=37819,Nl=37820,Ol=37821,_o=36492,Fl=36494,Bl=36495,td=36283,zl=36284,Hl=36285,kl=36286,F_=3200,B_=3201,ed=0,z_=1,pi="",Qe="srgb",Ls="srgb-linear",Wo="linear",se="srgb",$i=7680,Mu=519,H_=512,k_=513,V_=514,nd=515,G_=516,W_=517,X_=518,Y_=519,Su=35044,Eu="300 es",Xn=2e3,Ao=2001;class ji{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const s=this._listeners[t];if(s!==void 0){const r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const i=this._listeners[t.type];if(i!==void 0){t.target=this;const s=i.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,t);t.target=null}}}const Le=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],go=Math.PI/180,Vl=180/Math.PI;function Ds(){const n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Le[n&255]+Le[n>>8&255]+Le[n>>16&255]+Le[n>>24&255]+"-"+Le[t&255]+Le[t>>8&255]+"-"+Le[t>>16&15|64]+Le[t>>24&255]+"-"+Le[e&63|128]+Le[e>>8&255]+"-"+Le[e>>16&255]+Le[e>>24&255]+Le[i&255]+Le[i>>8&255]+Le[i>>16&255]+Le[i>>24&255]).toLowerCase()}function Ce(n,t,e){return Math.max(t,Math.min(e,n))}function q_(n,t){return(n%t+t)%t}function ca(n,t,e){return(1-e)*n+e*t}function Hs(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function We(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const j_={DEG2RAD:go};class Mt{constructor(t=0,e=0){Mt.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Ce(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*s+t.x,this.y=r*s+o*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Xt{constructor(t,e,i,s,r,o,a,l,c){Xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,s,r,o,a,l,c)}set(t,e,i,s,r,o,a,l,c){const u=this.elements;return u[0]=t,u[1]=s,u[2]=a,u[3]=e,u[4]=r,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],p=i[5],v=i[8],x=s[0],m=s[3],f=s[6],R=s[1],w=s[4],M=s[7],F=s[2],D=s[5],L=s[8];return r[0]=o*x+a*R+l*F,r[3]=o*m+a*w+l*D,r[6]=o*f+a*M+l*L,r[1]=c*x+u*R+h*F,r[4]=c*m+u*w+h*D,r[7]=c*f+u*M+h*L,r[2]=d*x+p*R+v*F,r[5]=d*m+p*w+v*D,r[8]=d*f+p*M+v*L,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e*o*u-e*a*c-i*r*u+i*a*l+s*r*c-s*o*l}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*o-a*c,d=a*l-u*r,p=c*r-o*l,v=e*h+i*d+s*p;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/v;return t[0]=h*x,t[1]=(s*c-u*i)*x,t[2]=(a*i-s*o)*x,t[3]=d*x,t[4]=(u*e-s*l)*x,t[5]=(s*r-a*e)*x,t[6]=p*x,t[7]=(i*l-c*e)*x,t[8]=(o*e-i*r)*x,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+t,-s*c,s*l,-s*(-c*o+l*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(ua.makeScale(t,e)),this}rotate(t){return this.premultiply(ua.makeRotation(-t)),this}translate(t,e){return this.premultiply(ua.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<9;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const ua=new Xt;function id(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function Ro(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Z_(){const n=Ro("canvas");return n.style.display="block",n}const bu={};function Ks(n){n in bu||(bu[n]=!0,console.warn(n))}function K_(n,t,e){return new Promise(function(i,s){function r(){switch(n.clientWaitSync(t,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:s();break;case n.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:i()}}setTimeout(r,e)})}function $_(n){const t=n.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function J_(n){const t=n.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}const Zt={enabled:!0,workingColorSpace:Ls,spaces:{},convert:function(n,t,e){return this.enabled===!1||t===e||!t||!e||(this.spaces[t].transfer===se&&(n.r=qn(n.r),n.g=qn(n.g),n.b=qn(n.b)),this.spaces[t].primaries!==this.spaces[e].primaries&&(n.applyMatrix3(this.spaces[t].toXYZ),n.applyMatrix3(this.spaces[e].fromXYZ)),this.spaces[e].transfer===se&&(n.r=Es(n.r),n.g=Es(n.g),n.b=Es(n.b))),n},fromWorkingColorSpace:function(n,t){return this.convert(n,this.workingColorSpace,t)},toWorkingColorSpace:function(n,t){return this.convert(n,t,this.workingColorSpace)},getPrimaries:function(n){return this.spaces[n].primaries},getTransfer:function(n){return n===pi?Wo:this.spaces[n].transfer},getLuminanceCoefficients:function(n,t=this.workingColorSpace){return n.fromArray(this.spaces[t].luminanceCoefficients)},define:function(n){Object.assign(this.spaces,n)},_getMatrix:function(n,t,e){return n.copy(this.spaces[t].toXYZ).multiply(this.spaces[e].fromXYZ)},_getDrawingBufferColorSpace:function(n){return this.spaces[n].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(n=this.workingColorSpace){return this.spaces[n].workingColorSpaceConfig.unpackColorSpace}};function qn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Es(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const Tu=[.64,.33,.3,.6,.15,.06],wu=[.2126,.7152,.0722],Au=[.3127,.329],Ru=new Xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Cu=new Xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Zt.define({[Ls]:{primaries:Tu,whitePoint:Au,transfer:Wo,toXYZ:Ru,fromXYZ:Cu,luminanceCoefficients:wu,workingColorSpaceConfig:{unpackColorSpace:Qe},outputColorSpaceConfig:{drawingBufferColorSpace:Qe}},[Qe]:{primaries:Tu,whitePoint:Au,transfer:se,toXYZ:Ru,fromXYZ:Cu,luminanceCoefficients:wu,outputColorSpaceConfig:{drawingBufferColorSpace:Qe}}});let Ji;class Q_{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Ji===void 0&&(Ji=Ro("canvas")),Ji.width=t.width,Ji.height=t.height;const i=Ji.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=Ji}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=Ro("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let o=0;o<r.length;o++)r[o]=qn(r[o]/255)*255;return i.putImageData(s,0,0),e}else if(t.data){const e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(qn(e[i]/255)*255):e[i]=qn(e[i]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let tg=0;class sd{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:tg++}),this.uuid=Ds(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let o=0,a=s.length;o<a;o++)s[o].isDataTexture?r.push(ha(s[o].image)):r.push(ha(s[o]))}else r=ha(s);i.url=r}return e||(t.images[this.uuid]=i),i}}function ha(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Q_.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let eg=0;class je extends ji{constructor(t=je.DEFAULT_IMAGE,e=je.DEFAULT_MAPPING,i=ki,s=ki,r=An,o=Vi,a=dn,l=$n,c=je.DEFAULT_ANISOTROPY,u=pi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eg++}),this.uuid=Ds(),this.name="",this.source=new sd(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Mt(0,0),this.repeat=new Mt(1,1),this.center=new Mt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Wf)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case pl:t.x=t.x-Math.floor(t.x);break;case ki:t.x=t.x<0?0:1;break;case ml:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case pl:t.y=t.y-Math.floor(t.y);break;case ki:t.y=t.y<0?0:1;break;case ml:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}je.DEFAULT_IMAGE=null;je.DEFAULT_MAPPING=Wf;je.DEFAULT_ANISOTROPY=1;class xe{constructor(t=0,e=0,i=0,s=1){xe.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*e+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*e+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*e+o[7]*i+o[11]*s+o[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,r;const l=t.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],v=l[9],x=l[2],m=l[6],f=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-x)<.01&&Math.abs(v-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+x)<.1&&Math.abs(v+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const w=(c+1)/2,M=(p+1)/2,F=(f+1)/2,D=(u+d)/4,L=(h+x)/4,b=(v+m)/4;return w>M&&w>F?w<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(w),s=D/i,r=L/i):M>F?M<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(M),i=D/s,r=b/s):F<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(F),i=L/r,s=b/r),this.set(i,s,r,e),this}let R=Math.sqrt((m-v)*(m-v)+(h-x)*(h-x)+(d-u)*(d-u));return Math.abs(R)<.001&&(R=1),this.x=(m-v)/R,this.y=(h-x)/R,this.z=(d-u)/R,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 ng extends ji{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new xe(0,0,t,e),this.scissorTest=!1,this.viewport=new xe(0,0,t,e);const s={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:An,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const r=new je(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);r.flipY=!1,r.generateMipmaps=i.generateMipmaps,r.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=i;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let i=0,s=t.textures.length;i<s;i++)this.textures[i]=t.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new sd(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Xi extends ng{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class rd extends je{constructor(t=null,e=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=_n,this.minFilter=_n,this.wrapR=ki,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ig extends je{constructor(t=null,e=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=_n,this.minFilter=_n,this.wrapR=ki,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Re{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,o,a){let l=i[s+0],c=i[s+1],u=i[s+2],h=i[s+3];const d=r[o+0],p=r[o+1],v=r[o+2],x=r[o+3];if(a===0){t[e+0]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h;return}if(a===1){t[e+0]=d,t[e+1]=p,t[e+2]=v,t[e+3]=x;return}if(h!==x||l!==d||c!==p||u!==v){let m=1-a;const f=l*d+c*p+u*v+h*x,R=f>=0?1:-1,w=1-f*f;if(w>Number.EPSILON){const F=Math.sqrt(w),D=Math.atan2(F,f*R);m=Math.sin(m*D)/F,a=Math.sin(a*D)/F}const M=a*R;if(l=l*m+d*M,c=c*m+p*M,u=u*m+v*M,h=h*m+x*M,m===1-a){const F=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=F,c*=F,u*=F,h*=F}}t[e]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],u=i[s+3],h=r[o],d=r[o+1],p=r[o+2],v=r[o+3];return t[e]=a*v+u*h+l*p-c*d,t[e+1]=l*v+u*d+c*h-a*p,t[e+2]=c*v+u*p+a*d-l*h,t[e+3]=u*v-a*h-l*d-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,s=t._y,r=t._z,o=t._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(s/2),h=a(r/2),d=l(i/2),p=l(s/2),v=l(r/2);switch(o){case"XYZ":this._x=d*u*h+c*p*v,this._y=c*p*h-d*u*v,this._z=c*u*v+d*p*h,this._w=c*u*h-d*p*v;break;case"YXZ":this._x=d*u*h+c*p*v,this._y=c*p*h-d*u*v,this._z=c*u*v-d*p*h,this._w=c*u*h+d*p*v;break;case"ZXY":this._x=d*u*h-c*p*v,this._y=c*p*h+d*u*v,this._z=c*u*v+d*p*h,this._w=c*u*h-d*p*v;break;case"ZYX":this._x=d*u*h-c*p*v,this._y=c*p*h+d*u*v,this._z=c*u*v-d*p*h,this._w=c*u*h+d*p*v;break;case"YZX":this._x=d*u*h+c*p*v,this._y=c*p*h+d*u*v,this._z=c*u*v-d*p*h,this._w=c*u*h-d*p*v;break;case"XZY":this._x=d*u*h-c*p*v,this._y=c*p*h-d*u*v,this._z=c*u*v+d*p*h,this._w=c*u*h+d*p*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],s=e[4],r=e[8],o=e[1],a=e[5],l=e[9],c=e[2],u=e[6],h=e[10],d=i+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(r-c)*p,this._z=(o-s)*p}else if(i>a&&i>h){const p=2*Math.sqrt(1+i-a-h);this._w=(u-l)/p,this._x=.25*p,this._y=(s+o)/p,this._z=(r+c)/p}else if(a>h){const p=2*Math.sqrt(1+a-i-h);this._w=(r-c)/p,this._x=(s+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-i-a);this._w=(o-s)/p,this._x=(r+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Ce(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(i===0)return this;const s=Math.min(1,e/i);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,s=t._y,r=t._z,o=t._w,a=e._x,l=e._y,c=e._z,u=e._w;return this._x=i*u+o*a+s*c-r*l,this._y=s*u+o*l+r*a-i*c,this._z=r*u+o*c+i*l-s*a,this._w=o*u-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*t._w+i*t._x+s*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-e;return this._w=p*o+e*this._w,this._x=p*i+e*this._x,this._y=p*s+e*this._y,this._z=p*r+e*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=o*h+this._w*d,this._x=i*h+this._x*d,this._y=s*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class I{constructor(t=0,e=0,i=0){I.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Pu.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Pu.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(t){const e=this.x,i=this.y,s=this.z,r=t.x,o=t.y,a=t.z,l=t.w,c=2*(o*s-a*i),u=2*(a*e-r*s),h=2*(r*i-o*e);return this.x=e+l*c+o*h-a*u,this.y=i+l*u+a*c-r*h,this.z=s+l*h+r*u-o*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,s=t.y,r=t.z,o=e.x,a=e.y,l=e.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return fa.copy(this).projectOnVector(t),this.sub(fa)}reflect(t){return this.sub(fa.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Ce(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const fa=new I,Pu=new Re;class br{constructor(t=new I(1/0,1/0,1/0),e=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(cn.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(cn.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=cn.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(i!==void 0){const r=i.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)t.isMesh===!0?t.getVertexPosition(o,cn):cn.fromBufferAttribute(r,o),cn.applyMatrix4(t.matrixWorld),this.expandByPoint(cn);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Dr.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Dr.copy(i.boundingBox)),Dr.applyMatrix4(t.matrixWorld),this.union(Dr)}const s=t.children;for(let r=0,o=s.length;r<o;r++)this.expandByObject(s[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,cn),cn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ks),Ir.subVectors(this.max,ks),Qi.subVectors(t.a,ks),ts.subVectors(t.b,ks),es.subVectors(t.c,ks),ei.subVectors(ts,Qi),ni.subVectors(es,ts),Ai.subVectors(Qi,es);let e=[0,-ei.z,ei.y,0,-ni.z,ni.y,0,-Ai.z,Ai.y,ei.z,0,-ei.x,ni.z,0,-ni.x,Ai.z,0,-Ai.x,-ei.y,ei.x,0,-ni.y,ni.x,0,-Ai.y,Ai.x,0];return!da(e,Qi,ts,es,Ir)||(e=[1,0,0,0,1,0,0,0,1],!da(e,Qi,ts,es,Ir))?!1:(Ur.crossVectors(ei,ni),e=[Ur.x,Ur.y,Ur.z],da(e,Qi,ts,es,Ir))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,cn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(cn).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Nn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Nn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Nn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Nn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Nn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Nn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Nn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Nn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Nn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Nn=[new I,new I,new I,new I,new I,new I,new I,new I],cn=new I,Dr=new br,Qi=new I,ts=new I,es=new I,ei=new I,ni=new I,Ai=new I,ks=new I,Ir=new I,Ur=new I,Ri=new I;function da(n,t,e,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){Ri.fromArray(n,r);const a=s.x*Math.abs(Ri.x)+s.y*Math.abs(Ri.y)+s.z*Math.abs(Ri.z),l=t.dot(Ri),c=e.dot(Ri),u=i.dot(Ri);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const sg=new br,Vs=new I,pa=new I;class Xo{constructor(t=new I,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;e!==void 0?i.copy(e):sg.setFromPoints(t).getCenter(i);let s=0;for(let r=0,o=t.length;r<o;r++)s=Math.max(s,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Vs.subVectors(t,this.center);const e=Vs.lengthSq();if(e>this.radius*this.radius){const i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(Vs,s/i),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(pa.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Vs.copy(t.center).add(pa)),this.expandByPoint(Vs.copy(t.center).sub(pa))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const On=new I,ma=new I,Nr=new I,ii=new I,_a=new I,Or=new I,ga=new I;class Yo{constructor(t=new I,e=new I(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,On)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=On.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(On.copy(this.origin).addScaledVector(this.direction,e),On.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){ma.copy(t).add(e).multiplyScalar(.5),Nr.copy(e).sub(t).normalize(),ii.copy(this.origin).sub(ma);const r=t.distanceTo(e)*.5,o=-this.direction.dot(Nr),a=ii.dot(this.direction),l=-ii.dot(Nr),c=ii.lengthSq(),u=Math.abs(1-o*o);let h,d,p,v;if(u>0)if(h=o*l-a,d=o*a-l,v=r*u,h>=0)if(d>=-v)if(d<=v){const x=1/u;h*=x,d*=x,p=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d=-r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d<=-v?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c):d<=v?(h=0,d=Math.min(Math.max(-r,-l),r),p=d*(d+2*l)+c):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),s&&s.copy(ma).addScaledVector(Nr,d),p}intersectSphere(t,e){On.subVectors(t.center,this.origin);const i=On.dot(this.direction),s=On.dot(On)-i*i,r=t.radius*t.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,s,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(t.min.x-d.x)*c,s=(t.max.x-d.x)*c):(i=(t.max.x-d.x)*c,s=(t.min.x-d.x)*c),u>=0?(r=(t.min.y-d.y)*u,o=(t.max.y-d.y)*u):(r=(t.max.y-d.y)*u,o=(t.min.y-d.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o<s||isNaN(s))&&(s=o),h>=0?(a=(t.min.z-d.z)*h,l=(t.max.z-d.z)*h):(a=(t.max.z-d.z)*h,l=(t.min.z-d.z)*h),i>l||a>s)||((a>i||i!==i)&&(i=a),(l<s||s!==s)&&(s=l),s<0)?null:this.at(i>=0?i:s,e)}intersectsBox(t){return this.intersectBox(t,On)!==null}intersectTriangle(t,e,i,s,r){_a.subVectors(e,t),Or.subVectors(i,t),ga.crossVectors(_a,Or);let o=this.direction.dot(ga),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ii.subVectors(this.origin,t);const l=a*this.direction.dot(Or.crossVectors(ii,Or));if(l<0)return null;const c=a*this.direction.dot(_a.cross(ii));if(c<0||l+c>o)return null;const u=-a*ii.dot(ga);return u<0?null:this.at(u/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ae{constructor(t,e,i,s,r,o,a,l,c,u,h,d,p,v,x,m){ae.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,s,r,o,a,l,c,u,h,d,p,v,x,m)}set(t,e,i,s,r,o,a,l,c,u,h,d,p,v,x,m){const f=this.elements;return f[0]=t,f[4]=e,f[8]=i,f[12]=s,f[1]=r,f[5]=o,f[9]=a,f[13]=l,f[2]=c,f[6]=u,f[10]=h,f[14]=d,f[3]=p,f[7]=v,f[11]=x,f[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ae().fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,s=1/ns.setFromMatrixColumn(t,0).length(),r=1/ns.setFromMatrixColumn(t,1).length(),o=1/ns.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,s=t.y,r=t.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),h=Math.sin(r);if(t.order==="XYZ"){const d=o*u,p=o*h,v=a*u,x=a*h;e[0]=l*u,e[4]=-l*h,e[8]=c,e[1]=p+v*c,e[5]=d-x*c,e[9]=-a*l,e[2]=x-d*c,e[6]=v+p*c,e[10]=o*l}else if(t.order==="YXZ"){const d=l*u,p=l*h,v=c*u,x=c*h;e[0]=d+x*a,e[4]=v*a-p,e[8]=o*c,e[1]=o*h,e[5]=o*u,e[9]=-a,e[2]=p*a-v,e[6]=x+d*a,e[10]=o*l}else if(t.order==="ZXY"){const d=l*u,p=l*h,v=c*u,x=c*h;e[0]=d-x*a,e[4]=-o*h,e[8]=v+p*a,e[1]=p+v*a,e[5]=o*u,e[9]=x-d*a,e[2]=-o*c,e[6]=a,e[10]=o*l}else if(t.order==="ZYX"){const d=o*u,p=o*h,v=a*u,x=a*h;e[0]=l*u,e[4]=v*c-p,e[8]=d*c+x,e[1]=l*h,e[5]=x*c+d,e[9]=p*c-v,e[2]=-c,e[6]=a*l,e[10]=o*l}else if(t.order==="YZX"){const d=o*l,p=o*c,v=a*l,x=a*c;e[0]=l*u,e[4]=x-d*h,e[8]=v*h+p,e[1]=h,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=p*h+v,e[10]=d-x*h}else if(t.order==="XZY"){const d=o*l,p=o*c,v=a*l,x=a*c;e[0]=l*u,e[4]=-h,e[8]=c*u,e[1]=d*h+x,e[5]=o*u,e[9]=p*h-v,e[2]=v*h-p,e[6]=a*u,e[10]=x*h+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(rg,t,og)}lookAt(t,e,i){const s=this.elements;return Ke.subVectors(t,e),Ke.lengthSq()===0&&(Ke.z=1),Ke.normalize(),si.crossVectors(i,Ke),si.lengthSq()===0&&(Math.abs(i.z)===1?Ke.x+=1e-4:Ke.z+=1e-4,Ke.normalize(),si.crossVectors(i,Ke)),si.normalize(),Fr.crossVectors(Ke,si),s[0]=si.x,s[4]=Fr.x,s[8]=Ke.x,s[1]=si.y,s[5]=Fr.y,s[9]=Ke.y,s[2]=si.z,s[6]=Fr.z,s[10]=Ke.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],p=i[13],v=i[2],x=i[6],m=i[10],f=i[14],R=i[3],w=i[7],M=i[11],F=i[15],D=s[0],L=s[4],b=s[8],_=s[12],g=s[1],A=s[5],O=s[9],k=s[13],J=s[2],st=s[6],Q=s[10],V=s[14],G=s[3],it=s[7],vt=s[11],W=s[15];return r[0]=o*D+a*g+l*J+c*G,r[4]=o*L+a*A+l*st+c*it,r[8]=o*b+a*O+l*Q+c*vt,r[12]=o*_+a*k+l*V+c*W,r[1]=u*D+h*g+d*J+p*G,r[5]=u*L+h*A+d*st+p*it,r[9]=u*b+h*O+d*Q+p*vt,r[13]=u*_+h*k+d*V+p*W,r[2]=v*D+x*g+m*J+f*G,r[6]=v*L+x*A+m*st+f*it,r[10]=v*b+x*O+m*Q+f*vt,r[14]=v*_+x*k+m*V+f*W,r[3]=R*D+w*g+M*J+F*G,r[7]=R*L+w*A+M*st+F*it,r[11]=R*b+w*O+M*Q+F*vt,r[15]=R*_+w*k+M*V+F*W,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],o=t[1],a=t[5],l=t[9],c=t[13],u=t[2],h=t[6],d=t[10],p=t[14],v=t[3],x=t[7],m=t[11],f=t[15];return v*(+r*l*h-s*c*h-r*a*d+i*c*d+s*a*p-i*l*p)+x*(+e*l*p-e*c*d+r*o*d-s*o*p+s*c*u-r*l*u)+m*(+e*c*h-e*a*p-r*o*h+i*o*p+r*a*u-i*c*u)+f*(-s*a*u-e*l*h+e*a*d+s*o*h-i*o*d+i*l*u)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],v=t[12],x=t[13],m=t[14],f=t[15],R=h*m*c-x*d*c+x*l*p-a*m*p-h*l*f+a*d*f,w=v*d*c-u*m*c-v*l*p+o*m*p+u*l*f-o*d*f,M=u*x*c-v*h*c+v*a*p-o*x*p-u*a*f+o*h*f,F=v*h*l-u*x*l-v*a*d+o*x*d+u*a*m-o*h*m,D=e*R+i*w+s*M+r*F;if(D===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/D;return t[0]=R*L,t[1]=(x*d*r-h*m*r-x*s*p+i*m*p+h*s*f-i*d*f)*L,t[2]=(a*m*r-x*l*r+x*s*c-i*m*c-a*s*f+i*l*f)*L,t[3]=(h*l*r-a*d*r-h*s*c+i*d*c+a*s*p-i*l*p)*L,t[4]=w*L,t[5]=(u*m*r-v*d*r+v*s*p-e*m*p-u*s*f+e*d*f)*L,t[6]=(v*l*r-o*m*r-v*s*c+e*m*c+o*s*f-e*l*f)*L,t[7]=(o*d*r-u*l*r+u*s*c-e*d*c-o*s*p+e*l*p)*L,t[8]=M*L,t[9]=(v*h*r-u*x*r-v*i*p+e*x*p+u*i*f-e*h*f)*L,t[10]=(o*x*r-v*a*r+v*i*c-e*x*c-o*i*f+e*a*f)*L,t[11]=(u*a*r-o*h*r-u*i*c+e*h*c+o*i*p-e*a*p)*L,t[12]=F*L,t[13]=(u*x*s-v*h*s+v*i*d-e*x*d-u*i*m+e*h*m)*L,t[14]=(v*a*s-o*x*s-v*i*l+e*x*l+o*i*m-e*a*m)*L,t[15]=(o*h*s-u*a*s+u*i*l-e*h*l-o*i*d+e*a*d)*L,this}scale(t){const e=this.elements,i=t.x,s=t.y,r=t.z;return e[0]*=i,e[4]*=s,e[8]*=r,e[1]*=i,e[5]*=s,e[9]*=r,e[2]*=i,e[6]*=s,e[10]*=r,e[3]*=i,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),s=Math.sin(e),r=1-i,o=t.x,a=t.y,l=t.z,c=r*o,u=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,u*a+i,u*l-s*o,0,c*l-s*a,u*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,r,o){return this.set(1,i,r,0,t,1,o,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){const s=this.elements,r=e._x,o=e._y,a=e._z,l=e._w,c=r+r,u=o+o,h=a+a,d=r*c,p=r*u,v=r*h,x=o*u,m=o*h,f=a*h,R=l*c,w=l*u,M=l*h,F=i.x,D=i.y,L=i.z;return s[0]=(1-(x+f))*F,s[1]=(p+M)*F,s[2]=(v-w)*F,s[3]=0,s[4]=(p-M)*D,s[5]=(1-(d+f))*D,s[6]=(m+R)*D,s[7]=0,s[8]=(v+w)*L,s[9]=(m-R)*L,s[10]=(1-(d+x))*L,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){const s=this.elements;let r=ns.set(s[0],s[1],s[2]).length();const o=ns.set(s[4],s[5],s[6]).length(),a=ns.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),t.x=s[12],t.y=s[13],t.z=s[14],un.copy(this);const c=1/r,u=1/o,h=1/a;return un.elements[0]*=c,un.elements[1]*=c,un.elements[2]*=c,un.elements[4]*=u,un.elements[5]*=u,un.elements[6]*=u,un.elements[8]*=h,un.elements[9]*=h,un.elements[10]*=h,e.setFromRotationMatrix(un),i.x=r,i.y=o,i.z=a,this}makePerspective(t,e,i,s,r,o,a=Xn){const l=this.elements,c=2*r/(e-t),u=2*r/(i-s),h=(e+t)/(e-t),d=(i+s)/(i-s);let p,v;if(a===Xn)p=-(o+r)/(o-r),v=-2*o*r/(o-r);else if(a===Ao)p=-o/(o-r),v=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,i,s,r,o,a=Xn){const l=this.elements,c=1/(e-t),u=1/(i-s),h=1/(o-r),d=(e+t)*c,p=(i+s)*u;let v,x;if(a===Xn)v=(o+r)*h,x=-2*h;else if(a===Ao)v=r*h,x=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=x,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const ns=new I,un=new ae,rg=new I(0,0,0),og=new I(1,1,1),si=new I,Fr=new I,Ke=new I,Lu=new ae,Du=new Re;class gn{constructor(t=0,e=0,i=0,s=gn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const s=t.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],u=s[9],h=s[2],d=s[6],p=s[10];switch(e){case"XYZ":this._y=Math.asin(Ce(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ce(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ce(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Ce(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Ce(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Ce(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return Lu.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Lu,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Du.setFromEuler(this),this.setFromQuaternion(Du,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}gn.DEFAULT_ORDER="XYZ";class Ec{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let ag=0;const Iu=new I,is=new Re,Fn=new ae,Br=new I,Gs=new I,lg=new I,cg=new Re,Uu=new I(1,0,0),Nu=new I(0,1,0),Ou=new I(0,0,1),Fu={type:"added"},ug={type:"removed"},ss={type:"childadded",child:null},va={type:"childremoved",child:null};class Se extends ji{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ag++}),this.uuid=Ds(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Se.DEFAULT_UP.clone();const t=new I,e=new gn,i=new Re,s=new I(1,1,1);function r(){i.setFromEuler(e,!1)}function o(){e.setFromQuaternion(i,void 0,!1)}e._onChange(r),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new ae},normalMatrix:{value:new Xt}}),this.matrix=new ae,this.matrixWorld=new ae,this.matrixAutoUpdate=Se.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Se.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ec,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return is.setFromAxisAngle(t,e),this.quaternion.multiply(is),this}rotateOnWorldAxis(t,e){return is.setFromAxisAngle(t,e),this.quaternion.premultiply(is),this}rotateX(t){return this.rotateOnAxis(Uu,t)}rotateY(t){return this.rotateOnAxis(Nu,t)}rotateZ(t){return this.rotateOnAxis(Ou,t)}translateOnAxis(t,e){return Iu.copy(t).applyQuaternion(this.quaternion),this.position.add(Iu.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Uu,t)}translateY(t){return this.translateOnAxis(Nu,t)}translateZ(t){return this.translateOnAxis(Ou,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Fn.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Br.copy(t):Br.set(t,e,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Gs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Fn.lookAt(Gs,Br,this.up):Fn.lookAt(Br,Gs,this.up),this.quaternion.setFromRotationMatrix(Fn),s&&(Fn.extractRotation(s.matrixWorld),is.setFromRotationMatrix(Fn),this.quaternion.premultiply(is.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Fu),ss.child=t,this.dispatchEvent(ss),ss.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(ug),va.child=t,this.dispatchEvent(va),va.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Fn.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Fn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Fn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Fu),ss.child=t,this.dispatchEvent(ss),ss.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,s=this.children.length;i<s;i++){const o=this.children[i].getObjectByProperty(t,e);if(o!==void 0)return o}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gs,t,lg),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gs,cg,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){const i=this.parent;if(t===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].updateWorldMatrix(!1,!0)}}toJSON(t){const e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(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.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];r(t.shapes,h)}else r(t.shapes,l)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(r(t.materials,this.material[l]));s.material=a}else s.material=r(t.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];s.animations.push(r(t.animations,l))}}if(e){const a=o(t.geometries),l=o(t.materials),c=o(t.textures),u=o(t.images),h=o(t.shapes),d=o(t.skeletons),p=o(t.animations),v=o(t.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),v.length>0&&(i.nodes=v)}return i.object=s,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){const s=t.children[i];this.add(s.clone())}return this}}Se.DEFAULT_UP=new I(0,1,0);Se.DEFAULT_MATRIX_AUTO_UPDATE=!0;Se.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const hn=new I,Bn=new I,xa=new I,zn=new I,rs=new I,os=new I,Bu=new I,ya=new I,Ma=new I,Sa=new I,Ea=new xe,ba=new xe,Ta=new xe;class fn{constructor(t=new I,e=new I,i=new I){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),hn.subVectors(t,e),s.cross(hn);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){hn.subVectors(s,e),Bn.subVectors(i,e),xa.subVectors(t,e);const o=hn.dot(hn),a=hn.dot(Bn),l=hn.dot(xa),c=Bn.dot(Bn),u=Bn.dot(xa),h=o*c-a*a;if(h===0)return r.set(0,0,0),null;const d=1/h,p=(c*l-a*u)*d,v=(o*u-a*l)*d;return r.set(1-p-v,v,p)}static containsPoint(t,e,i,s){return this.getBarycoord(t,e,i,s,zn)===null?!1:zn.x>=0&&zn.y>=0&&zn.x+zn.y<=1}static getInterpolation(t,e,i,s,r,o,a,l){return this.getBarycoord(t,e,i,s,zn)===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(r,zn.x),l.addScaledVector(o,zn.y),l.addScaledVector(a,zn.z),l)}static getInterpolatedAttribute(t,e,i,s,r,o){return Ea.setScalar(0),ba.setScalar(0),Ta.setScalar(0),Ea.fromBufferAttribute(t,e),ba.fromBufferAttribute(t,i),Ta.fromBufferAttribute(t,s),o.setScalar(0),o.addScaledVector(Ea,r.x),o.addScaledVector(ba,r.y),o.addScaledVector(Ta,r.z),o}static isFrontFacing(t,e,i,s){return hn.subVectors(i,e),Bn.subVectors(t,e),hn.cross(Bn).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return hn.subVectors(this.c,this.b),Bn.subVectors(this.a,this.b),hn.cross(Bn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return fn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return fn.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return fn.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return fn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return fn.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,s=this.b,r=this.c;let o,a;rs.subVectors(s,i),os.subVectors(r,i),ya.subVectors(t,i);const l=rs.dot(ya),c=os.dot(ya);if(l<=0&&c<=0)return e.copy(i);Ma.subVectors(t,s);const u=rs.dot(Ma),h=os.dot(Ma);if(u>=0&&h<=u)return e.copy(s);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),e.copy(i).addScaledVector(rs,o);Sa.subVectors(t,r);const p=rs.dot(Sa),v=os.dot(Sa);if(v>=0&&p<=v)return e.copy(r);const x=p*c-l*v;if(x<=0&&c>=0&&v<=0)return a=c/(c-v),e.copy(i).addScaledVector(os,a);const m=u*v-p*h;if(m<=0&&h-u>=0&&p-v>=0)return Bu.subVectors(r,s),a=(h-u)/(h-u+(p-v)),e.copy(s).addScaledVector(Bu,a);const f=1/(m+x+d);return o=x*f,a=d*f,e.copy(i).addScaledVector(rs,o).addScaledVector(os,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const od={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},ri={h:0,s:0,l:0},zr={h:0,s:0,l:0};function wa(n,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?n+(t-n)*6*e:e<1/2?t:e<2/3?n+(t-n)*6*(2/3-e):n}class kt{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){const s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Qe){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Zt.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=Zt.workingColorSpace){return this.r=t,this.g=e,this.b=i,Zt.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=Zt.workingColorSpace){if(t=q_(t,1),e=Ce(e,0,1),i=Ce(i,0,1),e===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+e):i+e-i*e,o=2*i-r;this.r=wa(o,r,t+1/3),this.g=wa(o,r,t),this.b=wa(o,r,t-1/3)}return Zt.toWorkingColorSpace(this,s),this}setStyle(t,e=Qe){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(o===6)return this.setHex(parseInt(r,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Qe){const i=od[t.toLowerCase()];return i!==void 0?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=qn(t.r),this.g=qn(t.g),this.b=qn(t.b),this}copyLinearToSRGB(t){return this.r=Es(t.r),this.g=Es(t.g),this.b=Es(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Qe){return Zt.fromWorkingColorSpace(De.copy(this),t),Math.round(Ce(De.r*255,0,255))*65536+Math.round(Ce(De.g*255,0,255))*256+Math.round(Ce(De.b*255,0,255))}getHexString(t=Qe){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Zt.workingColorSpace){Zt.fromWorkingColorSpace(De.copy(this),e);const i=De.r,s=De.g,r=De.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(s-r)/h+(s<r?6:0);break;case s:l=(r-i)/h+2;break;case r:l=(i-s)/h+4;break}l/=6}return t.h=l,t.s=c,t.l=u,t}getRGB(t,e=Zt.workingColorSpace){return Zt.fromWorkingColorSpace(De.copy(this),e),t.r=De.r,t.g=De.g,t.b=De.b,t}getStyle(t=Qe){Zt.fromWorkingColorSpace(De.copy(this),t);const e=De.r,i=De.g,s=De.b;return t!==Qe?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(t,e,i){return this.getHSL(ri),this.setHSL(ri.h+t,ri.s+e,ri.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(ri),t.getHSL(zr);const i=ca(ri.h,zr.h,e),s=ca(ri.s,zr.s,e),r=ca(ri.l,zr.l,e);return this.setHSL(i,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*s,this.g=r[1]*e+r[4]*i+r[7]*s,this.b=r[2]*e+r[5]*i+r[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const De=new kt;kt.NAMES=od;let hg=0;class Is extends ji{static get type(){return"Material"}get type(){return this.constructor.type}set type(t){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:hg++}),this.uuid=Ds(),this.name="",this.blending=Ms,this.side=Mi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=il,this.blendDst=sl,this.blendEquation=Fi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new kt(0,0,0),this.blendAlpha=0,this.depthFunc=Ts,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Mu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$i,this.stencilZFail=$i,this.stencilZPass=$i,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const i=t[e];if(i===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const s=this[e];if(s===void 0){console.warn(`THREE.Material: '${e}' 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[e]=i}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={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(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).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(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).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(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).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(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).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!==Ms&&(i.blending=this.blending),this.side!==Mi&&(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!==il&&(i.blendSrc=this.blendSrc),this.blendDst!==sl&&(i.blendDst=this.blendDst),this.blendEquation!==Fi&&(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!==Ts&&(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!==Mu&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==$i&&(i.stencilFail=this.stencilFail),this.stencilZFail!==$i&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==$i&&(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(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(e){const r=s(t.textures),o=s(t.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(e!==null){const s=e.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Tr extends Is{static get type(){return"MeshBasicMaterial"}constructor(t){super(),this.isMeshBasicMaterial=!0,this.color=new kt(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 gn,this.combine=_c,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const ye=new I,Hr=new Mt;class Cn{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=Su,this.updateRanges=[],this.gpuType=Wn,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)Hr.fromBufferAttribute(this,e),Hr.applyMatrix3(t),this.setXY(e,Hr.x,Hr.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)ye.fromBufferAttribute(this,e),ye.applyMatrix3(t),this.setXYZ(e,ye.x,ye.y,ye.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)ye.fromBufferAttribute(this,e),ye.applyMatrix4(t),this.setXYZ(e,ye.x,ye.y,ye.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)ye.fromBufferAttribute(this,e),ye.applyNormalMatrix(t),this.setXYZ(e,ye.x,ye.y,ye.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)ye.fromBufferAttribute(this,e),ye.transformDirection(t),this.setXYZ(e,ye.x,ye.y,ye.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Hs(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=We(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Hs(e,this.array)),e}setX(t,e){return this.normalized&&(e=We(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Hs(e,this.array)),e}setY(t,e){return this.normalized&&(e=We(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Hs(e,this.array)),e}setZ(t,e){return this.normalized&&(e=We(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Hs(e,this.array)),e}setW(t,e){return this.normalized&&(e=We(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=We(e,this.array),i=We(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=We(e,this.array),i=We(i,this.array),s=We(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,r){return t*=this.itemSize,this.normalized&&(e=We(e,this.array),i=We(i,this.array),s=We(s,this.array),r=We(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==Su&&(t.usage=this.usage),t}}class ad extends Cn{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class ld extends Cn{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class le extends Cn{constructor(t,e,i){super(new Float32Array(t),e,i)}}let fg=0;const nn=new ae,Aa=new Se,as=new I,$e=new br,Ws=new br,Ae=new I;class Be extends ji{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fg++}),this.uuid=Ds(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(id(t)?ld:ad)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const r=new Xt().getNormalMatrix(t);i.applyNormalMatrix(r),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return nn.makeRotationFromQuaternion(t),this.applyMatrix4(nn),this}rotateX(t){return nn.makeRotationX(t),this.applyMatrix4(nn),this}rotateY(t){return nn.makeRotationY(t),this.applyMatrix4(nn),this}rotateZ(t){return nn.makeRotationZ(t),this.applyMatrix4(nn),this}translate(t,e,i){return nn.makeTranslation(t,e,i),this.applyMatrix4(nn),this}scale(t,e,i){return nn.makeScale(t,e,i),this.applyMatrix4(nn),this}lookAt(t){return Aa.lookAt(t),Aa.updateMatrix(),this.applyMatrix4(Aa.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(as).negate(),this.translate(as.x,as.y,as.z),this}setFromPoints(t){const e=this.getAttribute("position");if(e===void 0){const i=[];for(let s=0,r=t.length;s<r;s++){const o=t[s];i.push(o.x,o.y,o.z||0)}this.setAttribute("position",new le(i,3))}else{for(let i=0,s=e.count;i<s;i++){const r=t[i];e.setXYZ(i,r.x,r.y,r.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new br);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,s=e.length;i<s;i++){const r=e[i];$e.setFromBufferAttribute(r),this.morphTargetsRelative?(Ae.addVectors(this.boundingBox.min,$e.min),this.boundingBox.expandByPoint(Ae),Ae.addVectors(this.boundingBox.max,$e.max),this.boundingBox.expandByPoint(Ae)):(this.boundingBox.expandByPoint($e.min),this.boundingBox.expandByPoint($e.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Xo);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(t){const i=this.boundingSphere.center;if($e.setFromBufferAttribute(t),e)for(let r=0,o=e.length;r<o;r++){const a=e[r];Ws.setFromBufferAttribute(a),this.morphTargetsRelative?(Ae.addVectors($e.min,Ws.min),$e.expandByPoint(Ae),Ae.addVectors($e.max,Ws.max),$e.expandByPoint(Ae)):($e.expandByPoint(Ws.min),$e.expandByPoint(Ws.max))}$e.getCenter(i);let s=0;for(let r=0,o=t.count;r<o;r++)Ae.fromBufferAttribute(t,r),s=Math.max(s,i.distanceToSquared(Ae));if(e)for(let r=0,o=e.length;r<o;r++){const a=e[r],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Ae.fromBufferAttribute(a,c),l&&(as.fromBufferAttribute(t,c),Ae.add(as)),s=Math.max(s,i.distanceToSquared(Ae))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.position,s=e.normal,r=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Cn(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let b=0;b<i.count;b++)a[b]=new I,l[b]=new I;const c=new I,u=new I,h=new I,d=new Mt,p=new Mt,v=new Mt,x=new I,m=new I;function f(b,_,g){c.fromBufferAttribute(i,b),u.fromBufferAttribute(i,_),h.fromBufferAttribute(i,g),d.fromBufferAttribute(r,b),p.fromBufferAttribute(r,_),v.fromBufferAttribute(r,g),u.sub(c),h.sub(c),p.sub(d),v.sub(d);const A=1/(p.x*v.y-v.x*p.y);isFinite(A)&&(x.copy(u).multiplyScalar(v.y).addScaledVector(h,-p.y).multiplyScalar(A),m.copy(h).multiplyScalar(p.x).addScaledVector(u,-v.x).multiplyScalar(A),a[b].add(x),a[_].add(x),a[g].add(x),l[b].add(m),l[_].add(m),l[g].add(m))}let R=this.groups;R.length===0&&(R=[{start:0,count:t.count}]);for(let b=0,_=R.length;b<_;++b){const g=R[b],A=g.start,O=g.count;for(let k=A,J=A+O;k<J;k+=3)f(t.getX(k+0),t.getX(k+1),t.getX(k+2))}const w=new I,M=new I,F=new I,D=new I;function L(b){F.fromBufferAttribute(s,b),D.copy(F);const _=a[b];w.copy(_),w.sub(F.multiplyScalar(F.dot(_))).normalize(),M.crossVectors(D,_);const A=M.dot(l[b])<0?-1:1;o.setXYZW(b,w.x,w.y,w.z,A)}for(let b=0,_=R.length;b<_;++b){const g=R[b],A=g.start,O=g.count;for(let k=A,J=A+O;k<J;k+=3)L(t.getX(k+0)),L(t.getX(k+1)),L(t.getX(k+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Cn(new Float32Array(e.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);const s=new I,r=new I,o=new I,a=new I,l=new I,c=new I,u=new I,h=new I;if(t)for(let d=0,p=t.count;d<p;d+=3){const v=t.getX(d+0),x=t.getX(d+1),m=t.getX(d+2);s.fromBufferAttribute(e,v),r.fromBufferAttribute(e,x),o.fromBufferAttribute(e,m),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),a.fromBufferAttribute(i,v),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,m),a.add(u),l.add(u),c.add(u),i.setXYZ(v,a.x,a.y,a.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(m,c.x,c.y,c.z)}else for(let d=0,p=e.count;d<p;d+=3)s.fromBufferAttribute(e,d+0),r.fromBufferAttribute(e,d+1),o.fromBufferAttribute(e,d+2),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Ae.fromBufferAttribute(t,e),Ae.normalize(),t.setXYZ(e,Ae.x,Ae.y,Ae.z)}toNonIndexed(){function t(a,l){const c=a.array,u=a.itemSize,h=a.normalized,d=new c.constructor(l.length*u);let p=0,v=0;for(let x=0,m=l.length;x<m;x++){a.isInterleavedBufferAttribute?p=l[x]*a.data.stride+a.offset:p=l[x]*u;for(let f=0;f<u;f++)d[v++]=c[p++]}return new Cn(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Be,i=this.index.array,s=this.attributes;for(const a in s){const l=s[a],c=t(l,i);e.setAttribute(a,c)}const r=this.morphAttributes;for(const a in r){const l=[],c=r[a];for(let u=0,h=c.length;u<h;u++){const d=c[u],p=t(d,i);l.push(p)}e.morphAttributes[a]=l}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const l in i){const c=i[l];t.data.attributes[l]=c.toJSON(t.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){const p=c[h];u.push(p.toJSON(t.data))}u.length>0&&(s[l]=u,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;i!==null&&this.setIndex(i.clone(e));const s=t.attributes;for(const c in s){const u=s[c];this.setAttribute(c,u.clone(e))}const r=t.morphAttributes;for(const c in r){const u=[],h=r[c];for(let d=0,p=h.length;d<p;d++)u.push(h[d].clone(e));this.morphAttributes[c]=u}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const zu=new ae,Ci=new Yo,kr=new Xo,Hu=new I,Vr=new I,Gr=new I,Wr=new I,Ra=new I,Xr=new I,ku=new I,Yr=new I;class Rt extends Se{constructor(t=new Be,e=new Tr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(t,e){const i=this.geometry,s=i.attributes.position,r=i.morphAttributes.position,o=i.morphTargetsRelative;e.fromBufferAttribute(s,t);const a=this.morphTargetInfluences;if(r&&a){Xr.set(0,0,0);for(let l=0,c=r.length;l<c;l++){const u=a[l],h=r[l];u!==0&&(Ra.fromBufferAttribute(h,t),o?Xr.addScaledVector(Ra,u):Xr.addScaledVector(Ra.sub(e),u))}e.add(Xr)}return e}raycast(t,e){const i=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),kr.copy(i.boundingSphere),kr.applyMatrix4(r),Ci.copy(t.ray).recast(t.near),!(kr.containsPoint(Ci.origin)===!1&&(Ci.intersectSphere(kr,Hu)===null||Ci.origin.distanceToSquared(Hu)>(t.far-t.near)**2))&&(zu.copy(r).invert(),Ci.copy(t.ray).applyMatrix4(zu),!(i.boundingBox!==null&&Ci.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(t,e,Ci)))}_computeIntersections(t,e,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,u=r.attributes.uv1,h=r.attributes.normal,d=r.groups,p=r.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,x=d.length;v<x;v++){const m=d[v],f=o[m.materialIndex],R=Math.max(m.start,p.start),w=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let M=R,F=w;M<F;M+=3){const D=a.getX(M),L=a.getX(M+1),b=a.getX(M+2);s=qr(this,f,t,i,c,u,h,D,L,b),s&&(s.faceIndex=Math.floor(M/3),s.face.materialIndex=m.materialIndex,e.push(s))}}else{const v=Math.max(0,p.start),x=Math.min(a.count,p.start+p.count);for(let m=v,f=x;m<f;m+=3){const R=a.getX(m),w=a.getX(m+1),M=a.getX(m+2);s=qr(this,o,t,i,c,u,h,R,w,M),s&&(s.faceIndex=Math.floor(m/3),e.push(s))}}else if(l!==void 0)if(Array.isArray(o))for(let v=0,x=d.length;v<x;v++){const m=d[v],f=o[m.materialIndex],R=Math.max(m.start,p.start),w=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let M=R,F=w;M<F;M+=3){const D=M,L=M+1,b=M+2;s=qr(this,f,t,i,c,u,h,D,L,b),s&&(s.faceIndex=Math.floor(M/3),s.face.materialIndex=m.materialIndex,e.push(s))}}else{const v=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let m=v,f=x;m<f;m+=3){const R=m,w=m+1,M=m+2;s=qr(this,o,t,i,c,u,h,R,w,M),s&&(s.faceIndex=Math.floor(m/3),e.push(s))}}}}function dg(n,t,e,i,s,r,o,a){let l;if(t.side===qe?l=i.intersectTriangle(o,r,s,!0,a):l=i.intersectTriangle(s,r,o,t.side===Mi,a),l===null)return null;Yr.copy(a),Yr.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Yr);return c<e.near||c>e.far?null:{distance:c,point:Yr.clone(),object:n}}function qr(n,t,e,i,s,r,o,a,l,c){n.getVertexPosition(a,Vr),n.getVertexPosition(l,Gr),n.getVertexPosition(c,Wr);const u=dg(n,t,e,i,Vr,Gr,Wr,ku);if(u){const h=new I;fn.getBarycoord(ku,Vr,Gr,Wr,h),s&&(u.uv=fn.getInterpolatedAttribute(s,a,l,c,h,new Mt)),r&&(u.uv1=fn.getInterpolatedAttribute(r,a,l,c,h,new Mt)),o&&(u.normal=fn.getInterpolatedAttribute(o,a,l,c,h,new I),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:l,c,normal:new I,materialIndex:0};fn.getNormal(Vr,Gr,Wr,d.normal),u.face=d,u.barycoord=h}return u}class me extends Be{constructor(t=1,e=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],u=[],h=[];let d=0,p=0;v("z","y","x",-1,-1,i,e,t,o,r,0),v("z","y","x",1,-1,i,e,-t,o,r,1),v("x","z","y",1,1,t,i,e,s,o,2),v("x","z","y",1,-1,t,i,-e,s,o,3),v("x","y","z",1,-1,t,e,i,s,r,4),v("x","y","z",-1,-1,t,e,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new le(c,3)),this.setAttribute("normal",new le(u,3)),this.setAttribute("uv",new le(h,2));function v(x,m,f,R,w,M,F,D,L,b,_){const g=M/L,A=F/b,O=M/2,k=F/2,J=D/2,st=L+1,Q=b+1;let V=0,G=0;const it=new I;for(let vt=0;vt<Q;vt++){const W=vt*A-k;for(let rt=0;rt<st;rt++){const ct=rt*g-O;it[x]=ct*R,it[m]=W*w,it[f]=J,c.push(it.x,it.y,it.z),it[x]=0,it[m]=0,it[f]=D>0?1:-1,u.push(it.x,it.y,it.z),h.push(rt/L),h.push(1-vt/b),V+=1}}for(let vt=0;vt<b;vt++)for(let W=0;W<L;W++){const rt=d+W+st*vt,ct=d+W+st*(vt+1),$=d+(W+1)+st*(vt+1),lt=d+(W+1)+st*vt;l.push(rt,ct,lt),l.push(ct,$,lt),G+=6}a.addGroup(p,G,_),p+=G,d+=V}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new me(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Ps(n){const t={};for(const e in n){t[e]={};for(const i in n[e]){const s=n[e][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][i]=null):t[e][i]=s.clone():Array.isArray(s)?t[e][i]=s.slice():t[e][i]=s}}return t}function He(n){const t={};for(let e=0;e<n.length;e++){const i=Ps(n[e]);for(const s in i)t[s]=i[s]}return t}function pg(n){const t=[];for(let e=0;e<n.length;e++)t.push(n[e].clone());return t}function cd(n){const t=n.getRenderTarget();return t===null?n.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Zt.workingColorSpace}const mg={clone:Ps,merge:He};var _g=`void main() {
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,gg=`void main() {
|
||
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
||
}`;class Si extends Is{static get type(){return"ShaderMaterial"}constructor(t){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=_g,this.fragmentShader=gg,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ps(t.uniforms),this.uniformsGroups=pg(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?e.uniforms[s]={type:"t",value:o.toJSON(t).uuid}:o&&o.isColor?e.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?e.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?e.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?e.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?e.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?e.uniforms[s]={type:"m4",value:o.toArray()}:e.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class ud extends Se{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ae,this.projectionMatrix=new ae,this.projectionMatrixInverse=new ae,this.coordinateSystem=Xn}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const oi=new I,Vu=new Mt,Gu=new Mt;class sn extends ud{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=Vl*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(go*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return Vl*2*Math.atan(Math.tan(go*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){oi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(oi.x,oi.y).multiplyScalar(-t/oi.z),oi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(oi.x,oi.y).multiplyScalar(-t/oi.z)}getViewSize(t,e){return this.getViewBounds(t,Vu,Gu),e.subVectors(Gu,Vu)}setViewOffset(t,e,i,s,r,o){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(go*.5*this.fov)/this.zoom,i=2*e,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,e-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-i,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const ls=-90,cs=1;class vg extends Se{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new sn(ls,cs,t,e);s.layers=this.layers,this.add(s);const r=new sn(ls,cs,t,e);r.layers=this.layers,this.add(r);const o=new sn(ls,cs,t,e);o.layers=this.layers,this.add(o);const a=new sn(ls,cs,t,e);a.layers=this.layers,this.add(a);const l=new sn(ls,cs,t,e);l.layers=this.layers,this.add(l);const c=new sn(ls,cs,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,s,r,o,a,l]=e;for(const c of e)this.remove(c);if(t===Xn)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===Ao)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,o,a,l,c,u]=this.children,h=t.getRenderTarget(),d=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),v=t.xr.enabled;t.xr.enabled=!1;const x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,r),t.setRenderTarget(i,1,s),t.render(e,o),t.setRenderTarget(i,2,s),t.render(e,a),t.setRenderTarget(i,3,s),t.render(e,l),t.setRenderTarget(i,4,s),t.render(e,c),i.texture.generateMipmaps=x,t.setRenderTarget(i,5,s),t.render(e,u),t.setRenderTarget(h,d,p),t.xr.enabled=v,i.texture.needsPMREMUpdate=!0}}class hd extends je{constructor(t,e,i,s,r,o,a,l,c,u){t=t!==void 0?t:[],e=e!==void 0?e:ws,super(t,e,i,s,r,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class xg extends Xi{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},s=[i,i,i,i,i,i];this.texture=new hd(s,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:An}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.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 <begin_vertex>
|
||
#include <project_vertex>
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tEquirect;
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 direction = normalize( vWorldDirection );
|
||
|
||
vec2 sampleUV = equirectUv( direction );
|
||
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
|
||
}
|
||
`},s=new me(5,5,5),r=new Si({name:"CubemapFromEquirect",uniforms:Ps(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:qe,blending:_i});r.uniforms.tEquirect.value=e;const o=new Rt(s,r),a=e.minFilter;return e.minFilter===Vi&&(e.minFilter=An),new vg(1,10,this).update(t,o),e.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,i,s){const r=t.getRenderTarget();for(let o=0;o<6;o++)t.setRenderTarget(this,o),t.clear(e,i,s);t.setRenderTarget(r)}}const Ca=new I,yg=new I,Mg=new Xt;class fi{constructor(t=new I(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const s=Ca.subVectors(i,e).cross(yg.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const i=t.delta(Ca),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Mg.getNormalMatrix(t),s=this.coplanarPoint(Ca).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Pi=new Xo,jr=new I;class bc{constructor(t=new fi,e=new fi,i=new fi,s=new fi,r=new fi,o=new fi){this.planes=[t,e,i,s,r,o]}set(t,e,i,s,r,o){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=Xn){const i=this.planes,s=t.elements,r=s[0],o=s[1],a=s[2],l=s[3],c=s[4],u=s[5],h=s[6],d=s[7],p=s[8],v=s[9],x=s[10],m=s[11],f=s[12],R=s[13],w=s[14],M=s[15];if(i[0].setComponents(l-r,d-c,m-p,M-f).normalize(),i[1].setComponents(l+r,d+c,m+p,M+f).normalize(),i[2].setComponents(l+o,d+u,m+v,M+R).normalize(),i[3].setComponents(l-o,d-u,m-v,M-R).normalize(),i[4].setComponents(l-a,d-h,m-x,M-w).normalize(),e===Xn)i[5].setComponents(l+a,d+h,m+x,M+w).normalize();else if(e===Ao)i[5].setComponents(a,h,x,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Pi.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Pi.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Pi)}intersectsSprite(t){return Pi.center.set(0,0,0),Pi.radius=.7071067811865476,Pi.applyMatrix4(t.matrixWorld),this.intersectsSphere(Pi)}intersectsSphere(t){const e=this.planes,i=t.center,s=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(i)<s)return!1;return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const s=e[i];if(jr.x=s.normal.x>0?t.max.x:t.min.x,jr.y=s.normal.y>0?t.max.y:t.min.y,jr.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(jr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function fd(){let n=null,t=!1,e=null,i=null;function s(r,o){e(r,o),i=n.requestAnimationFrame(s)}return{start:function(){t!==!0&&e!==null&&(i=n.requestAnimationFrame(s),t=!0)},stop:function(){n.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(r){e=r},setContext:function(r){n=r}}}function Sg(n){const t=new WeakMap;function e(a,l){const c=a.array,u=a.usage,h=c.byteLength,d=n.createBuffer();n.bindBuffer(l,d),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,l,c){const u=l.array,h=l.updateRanges;if(n.bindBuffer(c,a),h.length===0)n.bufferSubData(c,0,u);else{h.sort((p,v)=>p.start-v.start);let d=0;for(let p=1;p<h.length;p++){const v=h[d],x=h[p];x.start<=v.start+v.count+1?v.count=Math.max(v.count,x.start+x.count-v.start):(++d,h[d]=x)}h.length=d+1;for(let p=0,v=h.length;p<v;p++){const x=h[p];n.bufferSubData(c,x.start*u.BYTES_PER_ELEMENT,u,x.start,x.count)}l.clearUpdateRanges()}l.onUploadCallback()}function s(a){return a.isInterleavedBufferAttribute&&(a=a.data),t.get(a)}function r(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=t.get(a);l&&(n.deleteBuffer(l.buffer),t.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=t.get(a);(!u||u.version<a.version)&&t.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=t.get(a);if(c===void 0)t.set(a,e(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,a,l),c.version=a.version}}return{get:s,remove:r,update:o}}class Us extends Be{constructor(t=1,e=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:s};const r=t/2,o=e/2,a=Math.floor(i),l=Math.floor(s),c=a+1,u=l+1,h=t/a,d=e/l,p=[],v=[],x=[],m=[];for(let f=0;f<u;f++){const R=f*d-o;for(let w=0;w<c;w++){const M=w*h-r;v.push(M,-R,0),x.push(0,0,1),m.push(w/a),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let R=0;R<a;R++){const w=R+c*f,M=R+c*(f+1),F=R+1+c*(f+1),D=R+1+c*f;p.push(w,M,D),p.push(M,F,D)}this.setIndex(p),this.setAttribute("position",new le(v,3)),this.setAttribute("normal",new le(x,3)),this.setAttribute("uv",new le(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Us(t.width,t.height,t.widthSegments,t.heightSegments)}}var Eg=`#ifdef USE_ALPHAHASH
|
||
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
||
#endif`,bg=`#ifdef USE_ALPHAHASH
|
||
const float ALPHA_HASH_SCALE = 0.05;
|
||
float hash2D( vec2 value ) {
|
||
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
||
}
|
||
float hash3D( vec3 value ) {
|
||
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
||
}
|
||
float getAlphaHashThreshold( vec3 position ) {
|
||
float maxDeriv = max(
|
||
length( dFdx( position.xyz ) ),
|
||
length( dFdy( position.xyz ) )
|
||
);
|
||
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
||
vec2 pixScales = vec2(
|
||
exp2( floor( log2( pixScale ) ) ),
|
||
exp2( ceil( log2( pixScale ) ) )
|
||
);
|
||
vec2 alpha = vec2(
|
||
hash3D( floor( pixScales.x * position.xyz ) ),
|
||
hash3D( floor( pixScales.y * position.xyz ) )
|
||
);
|
||
float lerpFactor = fract( log2( pixScale ) );
|
||
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
||
float a = min( lerpFactor, 1.0 - lerpFactor );
|
||
vec3 cases = vec3(
|
||
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
||
( x - 0.5 * a ) / ( 1.0 - a ),
|
||
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
||
);
|
||
float threshold = ( x < ( 1.0 - a ) )
|
||
? ( ( x < a ) ? cases.x : cases.y )
|
||
: cases.z;
|
||
return clamp( threshold , 1.0e-6, 1.0 );
|
||
}
|
||
#endif`,Tg=`#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
||
#endif`,wg=`#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,Ag=`#ifdef USE_ALPHATEST
|
||
#ifdef ALPHA_TO_COVERAGE
|
||
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
||
if ( diffuseColor.a == 0.0 ) discard;
|
||
#else
|
||
if ( diffuseColor.a < alphaTest ) discard;
|
||
#endif
|
||
#endif`,Rg=`#ifdef USE_ALPHATEST
|
||
uniform float alphaTest;
|
||
#endif`,Cg=`#ifdef USE_AOMAP
|
||
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
||
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
||
#if defined( USE_CLEARCOAT )
|
||
clearcoatSpecularIndirect *= ambientOcclusion;
|
||
#endif
|
||
#if defined( USE_SHEEN )
|
||
sheenSpecularIndirect *= ambientOcclusion;
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
||
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
||
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
||
#endif
|
||
#endif`,Pg=`#ifdef USE_AOMAP
|
||
uniform sampler2D aoMap;
|
||
uniform float aoMapIntensity;
|
||
#endif`,Lg=`#ifdef USE_BATCHING
|
||
#if ! defined( GL_ANGLE_multi_draw )
|
||
#define gl_DrawID _gl_DrawID
|
||
uniform int _gl_DrawID;
|
||
#endif
|
||
uniform highp sampler2D batchingTexture;
|
||
uniform highp usampler2D batchingIdTexture;
|
||
mat4 getBatchingMatrix( const in float i ) {
|
||
int size = textureSize( batchingTexture, 0 ).x;
|
||
int j = int( i ) * 4;
|
||
int x = j % size;
|
||
int y = j / size;
|
||
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
|
||
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
|
||
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
|
||
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
||
return mat4( v1, v2, v3, v4 );
|
||
}
|
||
float getIndirectIndex( const in int i ) {
|
||
int size = textureSize( batchingIdTexture, 0 ).x;
|
||
int x = i % size;
|
||
int y = i / size;
|
||
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
|
||
}
|
||
#endif
|
||
#ifdef USE_BATCHING_COLOR
|
||
uniform sampler2D batchingColorTexture;
|
||
vec3 getBatchingColor( const in float i ) {
|
||
int size = textureSize( batchingColorTexture, 0 ).x;
|
||
int j = int( i );
|
||
int x = j % size;
|
||
int y = j / size;
|
||
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
|
||
}
|
||
#endif`,Dg=`#ifdef USE_BATCHING
|
||
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
||
#endif`,Ig=`vec3 transformed = vec3( position );
|
||
#ifdef USE_ALPHAHASH
|
||
vPosition = vec3( position );
|
||
#endif`,Ug=`vec3 objectNormal = vec3( normal );
|
||
#ifdef USE_TANGENT
|
||
vec3 objectTangent = vec3( tangent.xyz );
|
||
#endif`,Ng=`float G_BlinnPhong_Implicit( ) {
|
||
return 0.25;
|
||
}
|
||
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
||
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
||
}
|
||
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
||
float G = G_BlinnPhong_Implicit( );
|
||
float D = D_BlinnPhong( shininess, dotNH );
|
||
return F * ( G * D );
|
||
} // validated`,Og=`#ifdef USE_IRIDESCENCE
|
||
const mat3 XYZ_TO_REC709 = mat3(
|
||
3.2404542, -0.9692660, 0.0556434,
|
||
-1.5371385, 1.8760108, -0.2040259,
|
||
-0.4985314, 0.0415560, 1.0572252
|
||
);
|
||
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
||
vec3 sqrtF0 = sqrt( fresnel0 );
|
||
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
||
}
|
||
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
||
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
||
}
|
||
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
||
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
||
}
|
||
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
||
float phase = 2.0 * PI * OPD * 1.0e-9;
|
||
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
||
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
||
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
||
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
||
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
||
xyz /= 1.0685e-7;
|
||
vec3 rgb = XYZ_TO_REC709 * xyz;
|
||
return rgb;
|
||
}
|
||
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
||
vec3 I;
|
||
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
||
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
||
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
||
if ( cosTheta2Sq < 0.0 ) {
|
||
return vec3( 1.0 );
|
||
}
|
||
float cosTheta2 = sqrt( cosTheta2Sq );
|
||
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
||
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
||
float T121 = 1.0 - R12;
|
||
float phi12 = 0.0;
|
||
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
||
float phi21 = PI - phi12;
|
||
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
||
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
||
vec3 phi23 = vec3( 0.0 );
|
||
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
||
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
||
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
||
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
||
vec3 phi = vec3( phi21 ) + phi23;
|
||
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
||
vec3 r123 = sqrt( R123 );
|
||
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
||
vec3 C0 = R12 + Rs;
|
||
I = C0;
|
||
vec3 Cm = Rs - T121;
|
||
for ( int m = 1; m <= 2; ++ m ) {
|
||
Cm *= r123;
|
||
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
||
I += Cm * Sm;
|
||
}
|
||
return max( I, vec3( 0.0 ) );
|
||
}
|
||
#endif`,Fg=`#ifdef USE_BUMPMAP
|
||
uniform sampler2D bumpMap;
|
||
uniform float bumpScale;
|
||
vec2 dHdxy_fwd() {
|
||
vec2 dSTdx = dFdx( vBumpMapUv );
|
||
vec2 dSTdy = dFdy( vBumpMapUv );
|
||
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
||
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
||
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
||
return vec2( dBx, dBy );
|
||
}
|
||
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
||
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
||
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
||
vec3 vN = surf_norm;
|
||
vec3 R1 = cross( vSigmaY, vN );
|
||
vec3 R2 = cross( vN, vSigmaX );
|
||
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
||
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
||
return normalize( abs( fDet ) * surf_norm - vGrad );
|
||
}
|
||
#endif`,Bg=`#if NUM_CLIPPING_PLANES > 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`,zg=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
||
#endif`,Hg=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
#endif`,kg=`#if NUM_CLIPPING_PLANES > 0
|
||
vClipPosition = - mvPosition.xyz;
|
||
#endif`,Vg=`#if defined( USE_COLOR_ALPHA )
|
||
diffuseColor *= vColor;
|
||
#elif defined( USE_COLOR )
|
||
diffuseColor.rgb *= vColor;
|
||
#endif`,Gg=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,Wg=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,Xg=`#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`,Yg=`#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`,qg=`#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`,jg=`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`,Zg=`#ifdef USE_DISPLACEMENTMAP
|
||
uniform sampler2D displacementMap;
|
||
uniform float displacementScale;
|
||
uniform float displacementBias;
|
||
#endif`,Kg=`#ifdef USE_DISPLACEMENTMAP
|
||
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
||
#endif`,$g=`#ifdef USE_EMISSIVEMAP
|
||
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
||
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
||
#endif
|
||
totalEmissiveRadiance *= emissiveColor.rgb;
|
||
#endif`,Jg=`#ifdef USE_EMISSIVEMAP
|
||
uniform sampler2D emissiveMap;
|
||
#endif`,Qg="gl_FragColor = linearToOutputTexel( gl_FragColor );",t0=`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 );
|
||
}`,e0=`#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`,n0=`#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`,i0=`#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`,s0=`#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`,r0=`#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`,o0=`#ifdef USE_FOG
|
||
vFogDepth = - mvPosition.z;
|
||
#endif`,a0=`#ifdef USE_FOG
|
||
varying float vFogDepth;
|
||
#endif`,l0=`#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`,c0=`#ifdef USE_FOG
|
||
uniform vec3 fogColor;
|
||
varying float vFogDepth;
|
||
#ifdef FOG_EXP2
|
||
uniform float fogDensity;
|
||
#else
|
||
uniform float fogNear;
|
||
uniform float fogFar;
|
||
#endif
|
||
#endif`,u0=`#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
|
||
}`,h0=`#ifdef USE_LIGHTMAP
|
||
uniform sampler2D lightMap;
|
||
uniform float lightMapIntensity;
|
||
#endif`,f0=`LambertMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularStrength = specularStrength;`,d0=`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`,p0=`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`,m0=`#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`,_0=`ToonMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;`,g0=`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`,v0=`BlinnPhongMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularColor = specular;
|
||
material.specularShininess = shininess;
|
||
material.specularStrength = specularStrength;`,x0=`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`,y0=`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`,M0=`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 );
|
||
}`,S0=`
|
||
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`,E0=`#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`,b0=`#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`,T0=`#if defined( USE_LOGDEPTHBUF )
|
||
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
||
#endif`,w0=`#if defined( USE_LOGDEPTHBUF )
|
||
uniform float logDepthBufFC;
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,A0=`#ifdef USE_LOGDEPTHBUF
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,R0=`#ifdef USE_LOGDEPTHBUF
|
||
vFragDepth = 1.0 + gl_Position.w;
|
||
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
||
#endif`,C0=`#ifdef USE_MAP
|
||
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
||
#endif
|
||
diffuseColor *= sampledDiffuseColor;
|
||
#endif`,P0=`#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif`,L0=`#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`,D0=`#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`,I0=`float metalnessFactor = metalness;
|
||
#ifdef USE_METALNESSMAP
|
||
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
||
metalnessFactor *= texelMetalness.b;
|
||
#endif`,U0=`#ifdef USE_METALNESSMAP
|
||
uniform sampler2D metalnessMap;
|
||
#endif`,N0=`#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`,O0=`#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`,F0=`#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`,B0=`#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`,z0=`#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`,H0=`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;`,k0=`#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`,V0=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,G0=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,W0=`#ifndef FLAT_SHADED
|
||
vNormal = normalize( transformedNormal );
|
||
#ifdef USE_TANGENT
|
||
vTangent = normalize( transformedTangent );
|
||
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
||
#endif
|
||
#endif`,X0=`#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`,Y0=`#ifdef USE_CLEARCOAT
|
||
vec3 clearcoatNormal = nonPerturbedNormal;
|
||
#endif`,q0=`#ifdef USE_CLEARCOAT_NORMALMAP
|
||
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
||
clearcoatMapN.xy *= clearcoatNormalScale;
|
||
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
||
#endif`,j0=`#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`,Z0=`#ifdef USE_IRIDESCENCEMAP
|
||
uniform sampler2D iridescenceMap;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
uniform sampler2D iridescenceThicknessMap;
|
||
#endif`,K0=`#ifdef OPAQUE
|
||
diffuseColor.a = 1.0;
|
||
#endif
|
||
#ifdef USE_TRANSMISSION
|
||
diffuseColor.a *= material.transmissionAlpha;
|
||
#endif
|
||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,$0=`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 );
|
||
}`,J0=`#ifdef PREMULTIPLIED_ALPHA
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
#endif`,Q0=`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;`,tv=`#ifdef DITHERING
|
||
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
||
#endif`,ev=`#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`,nv=`float roughnessFactor = roughness;
|
||
#ifdef USE_ROUGHNESSMAP
|
||
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
||
roughnessFactor *= texelRoughness.g;
|
||
#endif`,iv=`#ifdef USE_ROUGHNESSMAP
|
||
uniform sampler2D roughnessMap;
|
||
#endif`,sv=`#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`,rv=`#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`,ov=`#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`,av=`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;
|
||
}`,lv=`#ifdef USE_SKINNING
|
||
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
||
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
||
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
||
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
||
#endif`,cv=`#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`,uv=`#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`,hv=`#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`,fv=`float specularStrength;
|
||
#ifdef USE_SPECULARMAP
|
||
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
||
specularStrength = texelSpecular.r;
|
||
#else
|
||
specularStrength = 1.0;
|
||
#endif`,dv=`#ifdef USE_SPECULARMAP
|
||
uniform sampler2D specularMap;
|
||
#endif`,pv=`#if defined( TONE_MAPPING )
|
||
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
||
#endif`,mv=`#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; }`,_v=`#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`,gv=`#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`,vv=`#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`,xv=`#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`,yv=`#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`,Mv=`#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 Sv=`varying vec2 vUv;
|
||
uniform mat3 uvTransform;
|
||
void main() {
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
||
}`,Ev=`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 <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,bv=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,Tv=`#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 <cube_uv_reflection_fragment>
|
||
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 <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,wv=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,Av=`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 <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,Rv=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <morphinstance_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vHighPrecisionZW = gl_Position.zw;
|
||
}`,Cv=`#if DEPTH_PACKING == 3200
|
||
uniform float opacity;
|
||
#endif
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <clipping_planes_fragment>
|
||
#if DEPTH_PACKING == 3200
|
||
diffuseColor.a = opacity;
|
||
#endif
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
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
|
||
}`,Pv=`#define DISTANCE
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <morphinstance_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vWorldPosition = worldPosition.xyz;
|
||
}`,Lv=`#define DISTANCE
|
||
uniform vec3 referencePosition;
|
||
uniform float nearDistance;
|
||
uniform float farDistance;
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main () {
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <clipping_planes_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
float dist = length( vWorldPosition - referencePosition );
|
||
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
||
dist = saturate( dist );
|
||
gl_FragColor = packDepthToRGBA( dist );
|
||
}`,Dv=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
}`,Iv=`uniform sampler2D tEquirect;
|
||
varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vec3 direction = normalize( vWorldDirection );
|
||
vec2 sampleUV = equirectUv( direction );
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,Uv=`uniform float scale;
|
||
attribute float lineDistance;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
vLineDistance = scale * lineDistance;
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,Nv=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform float dashSize;
|
||
uniform float totalSize;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
||
discard;
|
||
}
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,Ov=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Fv=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#endif
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
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 <aomap_fragment>
|
||
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
||
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Bv=`#define LAMBERT
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,zv=`#define LAMBERT
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_lambert_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_lambert_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Hv=`#define MATCAP
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
}`,kv=`#define MATCAP
|
||
uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform sampler2D matcap;
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
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 <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Vv=`#define NORMAL
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
vViewPosition = - mvPosition.xyz;
|
||
#endif
|
||
}`,Gv=`#define NORMAL
|
||
uniform float opacity;
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
|
||
#ifdef OPAQUE
|
||
gl_FragColor.a = 1.0;
|
||
#endif
|
||
}`,Wv=`#define PHONG
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Xv=`#define PHONG
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform vec3 specular;
|
||
uniform float shininess;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_phong_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_phong_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Yv=`#define STANDARD
|
||
varying vec3 vViewPosition;
|
||
#ifdef USE_TRANSMISSION
|
||
varying vec3 vWorldPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
#ifdef USE_TRANSMISSION
|
||
vWorldPosition = worldPosition.xyz;
|
||
#endif
|
||
}`,qv=`#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 <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <iridescence_fragment>
|
||
#include <cube_uv_reflection_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_physical_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_physical_pars_fragment>
|
||
#include <transmission_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <clearcoat_pars_fragment>
|
||
#include <iridescence_pars_fragment>
|
||
#include <roughnessmap_pars_fragment>
|
||
#include <metalnessmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <roughnessmap_fragment>
|
||
#include <metalnessmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <clearcoat_normal_fragment_begin>
|
||
#include <clearcoat_normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_physical_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
||
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
||
#include <transmission_fragment>
|
||
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 <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,jv=`#define TOON
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Zv=`#define TOON
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <gradientmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_toon_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_toon_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Kv=`uniform float size;
|
||
uniform float scale;
|
||
#include <common>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
#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 <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
gl_PointSize = size;
|
||
#ifdef USE_SIZEATTENUATION
|
||
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
||
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
||
#endif
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <fog_vertex>
|
||
}`,$v=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <map_particle_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_particle_fragment>
|
||
#include <color_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,Jv=`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
void main() {
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Qv=`uniform vec3 color;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <shadowmask_pars_fragment>
|
||
void main() {
|
||
#include <logdepthbuf_fragment>
|
||
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
}`,tx=`uniform float rotation;
|
||
uniform vec2 center;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
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 <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,ex=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
}`,jt={alphahash_fragment:Eg,alphahash_pars_fragment:bg,alphamap_fragment:Tg,alphamap_pars_fragment:wg,alphatest_fragment:Ag,alphatest_pars_fragment:Rg,aomap_fragment:Cg,aomap_pars_fragment:Pg,batching_pars_vertex:Lg,batching_vertex:Dg,begin_vertex:Ig,beginnormal_vertex:Ug,bsdfs:Ng,iridescence_fragment:Og,bumpmap_pars_fragment:Fg,clipping_planes_fragment:Bg,clipping_planes_pars_fragment:zg,clipping_planes_pars_vertex:Hg,clipping_planes_vertex:kg,color_fragment:Vg,color_pars_fragment:Gg,color_pars_vertex:Wg,color_vertex:Xg,common:Yg,cube_uv_reflection_fragment:qg,defaultnormal_vertex:jg,displacementmap_pars_vertex:Zg,displacementmap_vertex:Kg,emissivemap_fragment:$g,emissivemap_pars_fragment:Jg,colorspace_fragment:Qg,colorspace_pars_fragment:t0,envmap_fragment:e0,envmap_common_pars_fragment:n0,envmap_pars_fragment:i0,envmap_pars_vertex:s0,envmap_physical_pars_fragment:m0,envmap_vertex:r0,fog_vertex:o0,fog_pars_vertex:a0,fog_fragment:l0,fog_pars_fragment:c0,gradientmap_pars_fragment:u0,lightmap_pars_fragment:h0,lights_lambert_fragment:f0,lights_lambert_pars_fragment:d0,lights_pars_begin:p0,lights_toon_fragment:_0,lights_toon_pars_fragment:g0,lights_phong_fragment:v0,lights_phong_pars_fragment:x0,lights_physical_fragment:y0,lights_physical_pars_fragment:M0,lights_fragment_begin:S0,lights_fragment_maps:E0,lights_fragment_end:b0,logdepthbuf_fragment:T0,logdepthbuf_pars_fragment:w0,logdepthbuf_pars_vertex:A0,logdepthbuf_vertex:R0,map_fragment:C0,map_pars_fragment:P0,map_particle_fragment:L0,map_particle_pars_fragment:D0,metalnessmap_fragment:I0,metalnessmap_pars_fragment:U0,morphinstance_vertex:N0,morphcolor_vertex:O0,morphnormal_vertex:F0,morphtarget_pars_vertex:B0,morphtarget_vertex:z0,normal_fragment_begin:H0,normal_fragment_maps:k0,normal_pars_fragment:V0,normal_pars_vertex:G0,normal_vertex:W0,normalmap_pars_fragment:X0,clearcoat_normal_fragment_begin:Y0,clearcoat_normal_fragment_maps:q0,clearcoat_pars_fragment:j0,iridescence_pars_fragment:Z0,opaque_fragment:K0,packing:$0,premultiplied_alpha_fragment:J0,project_vertex:Q0,dithering_fragment:tv,dithering_pars_fragment:ev,roughnessmap_fragment:nv,roughnessmap_pars_fragment:iv,shadowmap_pars_fragment:sv,shadowmap_pars_vertex:rv,shadowmap_vertex:ov,shadowmask_pars_fragment:av,skinbase_vertex:lv,skinning_pars_vertex:cv,skinning_vertex:uv,skinnormal_vertex:hv,specularmap_fragment:fv,specularmap_pars_fragment:dv,tonemapping_fragment:pv,tonemapping_pars_fragment:mv,transmission_fragment:_v,transmission_pars_fragment:gv,uv_pars_fragment:vv,uv_pars_vertex:xv,uv_vertex:yv,worldpos_vertex:Mv,background_vert:Sv,background_frag:Ev,backgroundCube_vert:bv,backgroundCube_frag:Tv,cube_vert:wv,cube_frag:Av,depth_vert:Rv,depth_frag:Cv,distanceRGBA_vert:Pv,distanceRGBA_frag:Lv,equirect_vert:Dv,equirect_frag:Iv,linedashed_vert:Uv,linedashed_frag:Nv,meshbasic_vert:Ov,meshbasic_frag:Fv,meshlambert_vert:Bv,meshlambert_frag:zv,meshmatcap_vert:Hv,meshmatcap_frag:kv,meshnormal_vert:Vv,meshnormal_frag:Gv,meshphong_vert:Wv,meshphong_frag:Xv,meshphysical_vert:Yv,meshphysical_frag:qv,meshtoon_vert:jv,meshtoon_frag:Zv,points_vert:Kv,points_frag:$v,shadow_vert:Jv,shadow_frag:Qv,sprite_vert:tx,sprite_frag:ex},wt={common:{diffuse:{value:new kt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xt}},envmap:{envMap:{value:null},envMapRotation:{value:new Xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xt},normalScale:{value:new Mt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new kt(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 kt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new kt(16777215)},opacity:{value:1},center:{value:new Mt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}}},Tn={basic:{uniforms:He([wt.common,wt.specularmap,wt.envmap,wt.aomap,wt.lightmap,wt.fog]),vertexShader:jt.meshbasic_vert,fragmentShader:jt.meshbasic_frag},lambert:{uniforms:He([wt.common,wt.specularmap,wt.envmap,wt.aomap,wt.lightmap,wt.emissivemap,wt.bumpmap,wt.normalmap,wt.displacementmap,wt.fog,wt.lights,{emissive:{value:new kt(0)}}]),vertexShader:jt.meshlambert_vert,fragmentShader:jt.meshlambert_frag},phong:{uniforms:He([wt.common,wt.specularmap,wt.envmap,wt.aomap,wt.lightmap,wt.emissivemap,wt.bumpmap,wt.normalmap,wt.displacementmap,wt.fog,wt.lights,{emissive:{value:new kt(0)},specular:{value:new kt(1118481)},shininess:{value:30}}]),vertexShader:jt.meshphong_vert,fragmentShader:jt.meshphong_frag},standard:{uniforms:He([wt.common,wt.envmap,wt.aomap,wt.lightmap,wt.emissivemap,wt.bumpmap,wt.normalmap,wt.displacementmap,wt.roughnessmap,wt.metalnessmap,wt.fog,wt.lights,{emissive:{value:new kt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:jt.meshphysical_vert,fragmentShader:jt.meshphysical_frag},toon:{uniforms:He([wt.common,wt.aomap,wt.lightmap,wt.emissivemap,wt.bumpmap,wt.normalmap,wt.displacementmap,wt.gradientmap,wt.fog,wt.lights,{emissive:{value:new kt(0)}}]),vertexShader:jt.meshtoon_vert,fragmentShader:jt.meshtoon_frag},matcap:{uniforms:He([wt.common,wt.bumpmap,wt.normalmap,wt.displacementmap,wt.fog,{matcap:{value:null}}]),vertexShader:jt.meshmatcap_vert,fragmentShader:jt.meshmatcap_frag},points:{uniforms:He([wt.points,wt.fog]),vertexShader:jt.points_vert,fragmentShader:jt.points_frag},dashed:{uniforms:He([wt.common,wt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:jt.linedashed_vert,fragmentShader:jt.linedashed_frag},depth:{uniforms:He([wt.common,wt.displacementmap]),vertexShader:jt.depth_vert,fragmentShader:jt.depth_frag},normal:{uniforms:He([wt.common,wt.bumpmap,wt.normalmap,wt.displacementmap,{opacity:{value:1}}]),vertexShader:jt.meshnormal_vert,fragmentShader:jt.meshnormal_frag},sprite:{uniforms:He([wt.sprite,wt.fog]),vertexShader:jt.sprite_vert,fragmentShader:jt.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:jt.background_vert,fragmentShader:jt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Xt}},vertexShader:jt.backgroundCube_vert,fragmentShader:jt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:jt.cube_vert,fragmentShader:jt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:jt.equirect_vert,fragmentShader:jt.equirect_frag},distanceRGBA:{uniforms:He([wt.common,wt.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:jt.distanceRGBA_vert,fragmentShader:jt.distanceRGBA_frag},shadow:{uniforms:He([wt.lights,wt.fog,{color:{value:new kt(0)},opacity:{value:1}}]),vertexShader:jt.shadow_vert,fragmentShader:jt.shadow_frag}};Tn.physical={uniforms:He([Tn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Xt},clearcoatNormalScale:{value:new Mt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Xt},sheen:{value:0},sheenColor:{value:new kt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Xt},transmissionSamplerSize:{value:new Mt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Xt},attenuationDistance:{value:0},attenuationColor:{value:new kt(0)},specularColor:{value:new kt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Xt},anisotropyVector:{value:new Mt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Xt}}]),vertexShader:jt.meshphysical_vert,fragmentShader:jt.meshphysical_frag};const Zr={r:0,b:0,g:0},Li=new gn,nx=new ae;function ix(n,t,e,i,s,r,o){const a=new kt(0);let l=r===!0?0:1,c,u,h=null,d=0,p=null;function v(R){let w=R.isScene===!0?R.background:null;return w&&w.isTexture&&(w=(R.backgroundBlurriness>0?e:t).get(w)),w}function x(R){let w=!1;const M=v(R);M===null?f(a,l):M&&M.isColor&&(f(M,1),w=!0);const F=n.xr.getEnvironmentBlendMode();F==="additive"?i.buffers.color.setClear(0,0,0,1,o):F==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||w)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function m(R,w){const M=v(w);M&&(M.isCubeTexture||M.mapping===Go)?(u===void 0&&(u=new Rt(new me(1,1,1),new Si({name:"BackgroundCubeMaterial",uniforms:Ps(Tn.backgroundCube.uniforms),vertexShader:Tn.backgroundCube.vertexShader,fragmentShader:Tn.backgroundCube.fragmentShader,side:qe,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(F,D,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),Li.copy(w.backgroundRotation),Li.x*=-1,Li.y*=-1,Li.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(Li.y*=-1,Li.z*=-1),u.material.uniforms.envMap.value=M,u.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(nx.makeRotationFromEuler(Li)),u.material.toneMapped=Zt.getTransfer(M.colorSpace)!==se,(h!==M||d!==M.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,h=M,d=M.version,p=n.toneMapping),u.layers.enableAll(),R.unshift(u,u.geometry,u.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new Rt(new Us(2,2),new Si({name:"BackgroundMaterial",uniforms:Ps(Tn.background.uniforms),vertexShader:Tn.background.vertexShader,fragmentShader:Tn.background.fragmentShader,side:Mi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=Zt.getTransfer(M.colorSpace)!==se,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||d!==M.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,h=M,d=M.version,p=n.toneMapping),c.layers.enableAll(),R.unshift(c,c.geometry,c.material,0,0,null))}function f(R,w){R.getRGB(Zr,cd(n)),i.buffers.color.setClear(Zr.r,Zr.g,Zr.b,w,o)}return{getClearColor:function(){return a},setClearColor:function(R,w=1){a.set(R),l=w,f(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(R){l=R,f(a,l)},render:x,addToRenderList:m}}function sx(n,t){const e=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},s=d(null);let r=s,o=!1;function a(g,A,O,k,J){let st=!1;const Q=h(k,O,A);r!==Q&&(r=Q,c(r.object)),st=p(g,k,O,J),st&&v(g,k,O,J),J!==null&&t.update(J,n.ELEMENT_ARRAY_BUFFER),(st||o)&&(o=!1,M(g,A,O,k),J!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(J).buffer))}function l(){return n.createVertexArray()}function c(g){return n.bindVertexArray(g)}function u(g){return n.deleteVertexArray(g)}function h(g,A,O){const k=O.wireframe===!0;let J=i[g.id];J===void 0&&(J={},i[g.id]=J);let st=J[A.id];st===void 0&&(st={},J[A.id]=st);let Q=st[k];return Q===void 0&&(Q=d(l()),st[k]=Q),Q}function d(g){const A=[],O=[],k=[];for(let J=0;J<e;J++)A[J]=0,O[J]=0,k[J]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:A,enabledAttributes:O,attributeDivisors:k,object:g,attributes:{},index:null}}function p(g,A,O,k){const J=r.attributes,st=A.attributes;let Q=0;const V=O.getAttributes();for(const G in V)if(V[G].location>=0){const vt=J[G];let W=st[G];if(W===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(W=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(W=g.instanceColor)),vt===void 0||vt.attribute!==W||W&&vt.data!==W.data)return!0;Q++}return r.attributesNum!==Q||r.index!==k}function v(g,A,O,k){const J={},st=A.attributes;let Q=0;const V=O.getAttributes();for(const G in V)if(V[G].location>=0){let vt=st[G];vt===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(vt=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(vt=g.instanceColor));const W={};W.attribute=vt,vt&&vt.data&&(W.data=vt.data),J[G]=W,Q++}r.attributes=J,r.attributesNum=Q,r.index=k}function x(){const g=r.newAttributes;for(let A=0,O=g.length;A<O;A++)g[A]=0}function m(g){f(g,0)}function f(g,A){const O=r.newAttributes,k=r.enabledAttributes,J=r.attributeDivisors;O[g]=1,k[g]===0&&(n.enableVertexAttribArray(g),k[g]=1),J[g]!==A&&(n.vertexAttribDivisor(g,A),J[g]=A)}function R(){const g=r.newAttributes,A=r.enabledAttributes;for(let O=0,k=A.length;O<k;O++)A[O]!==g[O]&&(n.disableVertexAttribArray(O),A[O]=0)}function w(g,A,O,k,J,st,Q){Q===!0?n.vertexAttribIPointer(g,A,O,J,st):n.vertexAttribPointer(g,A,O,k,J,st)}function M(g,A,O,k){x();const J=k.attributes,st=O.getAttributes(),Q=A.defaultAttributeValues;for(const V in st){const G=st[V];if(G.location>=0){let it=J[V];if(it===void 0&&(V==="instanceMatrix"&&g.instanceMatrix&&(it=g.instanceMatrix),V==="instanceColor"&&g.instanceColor&&(it=g.instanceColor)),it!==void 0){const vt=it.normalized,W=it.itemSize,rt=t.get(it);if(rt===void 0)continue;const ct=rt.buffer,$=rt.type,lt=rt.bytesPerElement,pt=$===n.INT||$===n.UNSIGNED_INT||it.gpuType===gc;if(it.isInterleavedBufferAttribute){const ut=it.data,et=ut.stride,ft=it.offset;if(ut.isInstancedInterleavedBuffer){for(let gt=0;gt<G.locationSize;gt++)f(G.location+gt,ut.meshPerAttribute);g.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=ut.meshPerAttribute*ut.count)}else for(let gt=0;gt<G.locationSize;gt++)m(G.location+gt);n.bindBuffer(n.ARRAY_BUFFER,ct);for(let gt=0;gt<G.locationSize;gt++)w(G.location+gt,W/G.locationSize,$,vt,et*lt,(ft+W/G.locationSize*gt)*lt,pt)}else{if(it.isInstancedBufferAttribute){for(let ut=0;ut<G.locationSize;ut++)f(G.location+ut,it.meshPerAttribute);g.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=it.meshPerAttribute*it.count)}else for(let ut=0;ut<G.locationSize;ut++)m(G.location+ut);n.bindBuffer(n.ARRAY_BUFFER,ct);for(let ut=0;ut<G.locationSize;ut++)w(G.location+ut,W/G.locationSize,$,vt,W*lt,W/G.locationSize*ut*lt,pt)}}else if(Q!==void 0){const vt=Q[V];if(vt!==void 0)switch(vt.length){case 2:n.vertexAttrib2fv(G.location,vt);break;case 3:n.vertexAttrib3fv(G.location,vt);break;case 4:n.vertexAttrib4fv(G.location,vt);break;default:n.vertexAttrib1fv(G.location,vt)}}}}R()}function F(){b();for(const g in i){const A=i[g];for(const O in A){const k=A[O];for(const J in k)u(k[J].object),delete k[J];delete A[O]}delete i[g]}}function D(g){if(i[g.id]===void 0)return;const A=i[g.id];for(const O in A){const k=A[O];for(const J in k)u(k[J].object),delete k[J];delete A[O]}delete i[g.id]}function L(g){for(const A in i){const O=i[A];if(O[g.id]===void 0)continue;const k=O[g.id];for(const J in k)u(k[J].object),delete k[J];delete O[g.id]}}function b(){_(),o=!0,r!==s&&(r=s,c(r.object))}function _(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:b,resetDefaultState:_,dispose:F,releaseStatesOfGeometry:D,releaseStatesOfProgram:L,initAttributes:x,enableAttribute:m,disableUnusedAttributes:R}}function rx(n,t,e){let i;function s(c){i=c}function r(c,u){n.drawArrays(i,c,u),e.update(u,i,1)}function o(c,u,h){h!==0&&(n.drawArraysInstanced(i,c,u,h),e.update(u,i,h))}function a(c,u,h){if(h===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,u,0,h);let p=0;for(let v=0;v<h;v++)p+=u[v];e.update(p,i,1)}function l(c,u,h,d){if(h===0)return;const p=t.get("WEBGL_multi_draw");if(p===null)for(let v=0;v<c.length;v++)o(c[v],u[v],d[v]);else{p.multiDrawArraysInstancedWEBGL(i,c,0,u,0,d,0,h);let v=0;for(let x=0;x<h;x++)v+=u[x]*d[x];e.update(v,i,1)}}this.setMode=s,this.render=r,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function ox(n,t,e,i){let s;function r(){if(s!==void 0)return s;if(t.has("EXT_texture_filter_anisotropic")===!0){const L=t.get("EXT_texture_filter_anisotropic");s=n.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function o(L){return!(L!==dn&&i.convert(L)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){const b=L===Er&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(L!==$n&&i.convert(L)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Wn&&!b)}function l(L){if(L==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=e.logarithmicDepthBuffer===!0,d=e.reverseDepthBuffer===!0&&t.has("EXT_clip_control"),p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),f=n.getParameter(n.MAX_VERTEX_ATTRIBS),R=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),M=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),F=v>0,D=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,reverseDepthBuffer:d,maxTextures:p,maxVertexTextures:v,maxTextureSize:x,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:R,maxVaryings:w,maxFragmentUniforms:M,vertexTextures:F,maxSamples:D}}function ax(n){const t=this;let e=null,i=0,s=!1,r=!1;const o=new fi,a=new Xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const p=h.length!==0||d||i!==0||s;return s=d,i=h.length,p},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(h,d){e=u(h,d,0)},this.setState=function(h,d,p){const v=h.clippingPlanes,x=h.clipIntersection,m=h.clipShadows,f=n.get(h);if(!s||v===null||v.length===0||r&&!m)r?u(null):c();else{const R=r?0:i,w=R*4;let M=f.clippingState||null;l.value=M,M=u(v,d,w,p);for(let F=0;F!==w;++F)M[F]=e[F];f.clippingState=M,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=R}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function u(h,d,p,v){const x=h!==null?h.length:0;let m=null;if(x!==0){if(m=l.value,v!==!0||m===null){const f=p+x*4,R=d.matrixWorldInverse;a.getNormalMatrix(R),(m===null||m.length<f)&&(m=new Float32Array(f));for(let w=0,M=p;w!==x;++w,M+=4)o.copy(h[w]).applyMatrix4(R,a),o.normal.toArray(m,M),m[M+3]=o.constant}l.value=m,l.needsUpdate=!0}return t.numPlanes=x,t.numIntersection=0,m}}function lx(n){let t=new WeakMap;function e(o,a){return a===fl?o.mapping=ws:a===dl&&(o.mapping=As),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===fl||a===dl)if(t.has(o)){const l=t.get(o).texture;return e(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new xg(l.height);return c.fromEquirectangularTexture(n,o),t.set(o,c),o.addEventListener("dispose",s),e(c.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=t.get(a);l!==void 0&&(t.delete(a),l.dispose())}function r(){t=new WeakMap}return{get:i,dispose:r}}class dd extends ud{constructor(t=-1,e=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-t,o=i+t,a=s+e,l=s-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}const ds=4,Wu=[.125,.215,.35,.446,.526,.582],Bi=20,Pa=new dd,Xu=new kt;let La=null,Da=0,Ia=0,Ua=!1;const Ni=(1+Math.sqrt(5))/2,us=1/Ni,Yu=[new I(-Ni,us,0),new I(Ni,us,0),new I(-us,0,Ni),new I(us,0,Ni),new I(0,Ni,-us),new I(0,Ni,us),new I(-1,1,-1),new I(1,1,-1),new I(-1,1,1),new I(1,1,1)];class qu{constructor(t){this._renderer=t,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(t,e=0,i=.1,s=100){La=this._renderer.getRenderTarget(),Da=this._renderer.getActiveCubeFace(),Ia=this._renderer.getActiveMipmapLevel(),Ua=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,i,s,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ku(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Zu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(La,Da,Ia),this._renderer.xr.enabled=Ua,t.scissorTest=!1,Kr(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===ws||t.mapping===As?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),La=this._renderer.getRenderTarget(),Da=this._renderer.getActiveCubeFace(),Ia=this._renderer.getActiveMipmapLevel(),Ua=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:An,minFilter:An,generateMipmaps:!1,type:Er,format:dn,colorSpace:Ls,depthBuffer:!1},s=ju(t,e,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ju(t,e,i);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=cx(r)),this._blurMaterial=ux(r,t,e)}return s}_compileMaterial(t){const e=new Rt(this._lodPlanes[0],t);this._renderer.compile(e,Pa)}_sceneToCubeUV(t,e,i,s){const a=new sn(90,1,e,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.toneMapping;u.getClearColor(Xu),u.toneMapping=gi,u.autoClear=!1;const p=new Tr({name:"PMREM.Background",side:qe,depthWrite:!1,depthTest:!1}),v=new Rt(new me,p);let x=!1;const m=t.background;m?m.isColor&&(p.color.copy(m),t.background=null,x=!0):(p.color.copy(Xu),x=!0);for(let f=0;f<6;f++){const R=f%3;R===0?(a.up.set(0,l[f],0),a.lookAt(c[f],0,0)):R===1?(a.up.set(0,0,l[f]),a.lookAt(0,c[f],0)):(a.up.set(0,l[f],0),a.lookAt(0,0,c[f]));const w=this._cubeSize;Kr(s,R*w,f>2?w:0,w,w),u.setRenderTarget(s),x&&u.render(v,a),u.render(t,a)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=d,u.autoClear=h,t.background=m}_textureToCubeUV(t,e){const i=this._renderer,s=t.mapping===ws||t.mapping===As;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ku()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Zu());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new Rt(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=t;const l=this._cubeSize;Kr(e,0,0,3*l,2*l),i.setRenderTarget(e),i.render(o,Pa)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;const s=this._lodPlanes.length;for(let r=1;r<s;r++){const o=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=Yu[(s-r-1)%Yu.length];this._blur(t,r-1,r,o,a)}e.autoClear=i}_blur(t,e,i,s,r){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,i,s,"latitudinal",r),this._halfBlur(o,t,i,i,s,"longitudinal",r)}_halfBlur(t,e,i,s,r,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new Rt(this._lodPlanes[s],c),d=c.uniforms,p=this._sizeLods[i]-1,v=isFinite(r)?Math.PI/(2*p):2*Math.PI/(2*Bi-1),x=r/v,m=isFinite(r)?1+Math.floor(u*x):Bi;m>Bi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Bi}`);const f=[];let R=0;for(let L=0;L<Bi;++L){const b=L/x,_=Math.exp(-b*b/2);f.push(_),L===0?R+=_:L<m&&(R+=2*_)}for(let L=0;L<f.length;L++)f[L]=f[L]/R;d.envMap.value=t.texture,d.samples.value=m,d.weights.value=f,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);const{_lodMax:w}=this;d.dTheta.value=v,d.mipInt.value=w-i;const M=this._sizeLods[s],F=3*M*(s>w-ds?s-w+ds:0),D=4*(this._cubeSize-M);Kr(e,F,D,3*M,2*M),l.setRenderTarget(e),l.render(h,Pa)}}function cx(n){const t=[],e=[],i=[];let s=n;const r=n-ds+1+Wu.length;for(let o=0;o<r;o++){const a=Math.pow(2,s);e.push(a);let l=1/a;o>n-ds?l=Wu[o-n+ds-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,v=6,x=3,m=2,f=1,R=new Float32Array(x*v*p),w=new Float32Array(m*v*p),M=new Float32Array(f*v*p);for(let D=0;D<p;D++){const L=D%3*2/3-1,b=D>2?0:-1,_=[L,b,0,L+2/3,b,0,L+2/3,b+1,0,L,b,0,L+2/3,b+1,0,L,b+1,0];R.set(_,x*v*D),w.set(d,m*v*D);const g=[D,D,D,D,D,D];M.set(g,f*v*D)}const F=new Be;F.setAttribute("position",new Cn(R,x)),F.setAttribute("uv",new Cn(w,m)),F.setAttribute("faceIndex",new Cn(M,f)),t.push(F),s>ds&&s--}return{lodPlanes:t,sizeLods:e,sigmas:i}}function ju(n,t,e){const i=new Xi(n,t,e);return i.texture.mapping=Go,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Kr(n,t,e,i,s){n.viewport.set(t,e,i,s),n.scissor.set(t,e,i,s)}function ux(n,t,e){const i=new Float32Array(Bi),s=new I(0,1,0);return new Si({name:"SphericalGaussianBlur",defines:{n:Bi,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Tc(),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 <cube_uv_reflection_fragment>
|
||
|
||
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:_i,depthTest:!1,depthWrite:!1})}function Zu(){return new Si({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Tc(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 outputDirection = normalize( vOutputDirection );
|
||
vec2 uv = equirectUv( outputDirection );
|
||
|
||
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
||
|
||
}
|
||
`,blending:_i,depthTest:!1,depthWrite:!1})}function Ku(){return new Si({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Tc(),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:_i,depthTest:!1,depthWrite:!1})}function Tc(){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 hx(n){let t=new WeakMap,e=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===fl||l===dl,u=l===ws||l===As;if(c||u){let h=t.get(a);const d=h!==void 0?h.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return e===null&&(e=new qu(n)),h=c?e.fromEquirectangular(a,h):e.fromCubemap(a,h),h.texture.pmremVersion=a.pmremVersion,t.set(a,h),h.texture;if(h!==void 0)return h.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&s(p)?(e===null&&(e=new qu(n)),h=c?e.fromEquirectangular(a):e.fromCubemap(a),h.texture.pmremVersion=a.pmremVersion,t.set(a,h),a.addEventListener("dispose",r),h.texture):null}}}return a}function s(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function r(a){const l=a.target;l.removeEventListener("dispose",r);const c=t.get(l);c!==void 0&&(t.delete(l),c.dispose())}function o(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:i,dispose:o}}function fx(n){const t={};function e(i){if(t[i]!==void 0)return t[i];let s;switch(i){case"WEBGL_depth_texture":s=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=n.getExtension(i)}return t[i]=s,s}return{has:function(i){return e(i)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(i){const s=e(i);return s===null&&Ks("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function dx(n,t,e,i){const s={},r=new WeakMap;function o(h){const d=h.target;d.index!==null&&t.remove(d.index);for(const v in d.attributes)t.remove(d.attributes[v]);for(const v in d.morphAttributes){const x=d.morphAttributes[v];for(let m=0,f=x.length;m<f;m++)t.remove(x[m])}d.removeEventListener("dispose",o),delete s[d.id];const p=r.get(d);p&&(t.remove(p),r.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,e.memory.geometries--}function a(h,d){return s[d.id]===!0||(d.addEventListener("dispose",o),s[d.id]=!0,e.memory.geometries++),d}function l(h){const d=h.attributes;for(const v in d)t.update(d[v],n.ARRAY_BUFFER);const p=h.morphAttributes;for(const v in p){const x=p[v];for(let m=0,f=x.length;m<f;m++)t.update(x[m],n.ARRAY_BUFFER)}}function c(h){const d=[],p=h.index,v=h.attributes.position;let x=0;if(p!==null){const R=p.array;x=p.version;for(let w=0,M=R.length;w<M;w+=3){const F=R[w+0],D=R[w+1],L=R[w+2];d.push(F,D,D,L,L,F)}}else if(v!==void 0){const R=v.array;x=v.version;for(let w=0,M=R.length/3-1;w<M;w+=3){const F=w+0,D=w+1,L=w+2;d.push(F,D,D,L,L,F)}}else return;const m=new(id(d)?ld:ad)(d,1);m.version=x;const f=r.get(h);f&&t.remove(f),r.set(h,m)}function u(h){const d=r.get(h);if(d){const p=h.index;p!==null&&d.version<p.version&&c(h)}else c(h);return r.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function px(n,t,e){let i;function s(d){i=d}let r,o;function a(d){r=d.type,o=d.bytesPerElement}function l(d,p){n.drawElements(i,p,r,d*o),e.update(p,i,1)}function c(d,p,v){v!==0&&(n.drawElementsInstanced(i,p,r,d*o,v),e.update(p,i,v))}function u(d,p,v){if(v===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,r,d,0,v);let m=0;for(let f=0;f<v;f++)m+=p[f];e.update(m,i,1)}function h(d,p,v,x){if(v===0)return;const m=t.get("WEBGL_multi_draw");if(m===null)for(let f=0;f<d.length;f++)c(d[f]/o,p[f],x[f]);else{m.multiDrawElementsInstancedWEBGL(i,p,0,r,d,0,x,0,v);let f=0;for(let R=0;R<v;R++)f+=p[R]*x[R];e.update(f,i,1)}}this.setMode=s,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function mx(n){const t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function i(r,o,a){switch(e.calls++,o){case n.TRIANGLES:e.triangles+=a*(r/3);break;case n.LINES:e.lines+=a*(r/2);break;case n.LINE_STRIP:e.lines+=a*(r-1);break;case n.LINE_LOOP:e.lines+=a*r;break;case n.POINTS:e.points+=a*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function s(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:s,update:i}}function _x(n,t,e){const i=new WeakMap,s=new xe;function r(o,a,l){const c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=u!==void 0?u.length:0;let d=i.get(a);if(d===void 0||d.count!==h){let g=function(){b.dispose(),i.delete(a),a.removeEventListener("dispose",g)};var p=g;d!==void 0&&d.texture.dispose();const v=a.morphAttributes.position!==void 0,x=a.morphAttributes.normal!==void 0,m=a.morphAttributes.color!==void 0,f=a.morphAttributes.position||[],R=a.morphAttributes.normal||[],w=a.morphAttributes.color||[];let M=0;v===!0&&(M=1),x===!0&&(M=2),m===!0&&(M=3);let F=a.attributes.position.count*M,D=1;F>t.maxTextureSize&&(D=Math.ceil(F/t.maxTextureSize),F=t.maxTextureSize);const L=new Float32Array(F*D*4*h),b=new rd(L,F,D,h);b.type=Wn,b.needsUpdate=!0;const _=M*4;for(let A=0;A<h;A++){const O=f[A],k=R[A],J=w[A],st=F*D*4*A;for(let Q=0;Q<O.count;Q++){const V=Q*_;v===!0&&(s.fromBufferAttribute(O,Q),L[st+V+0]=s.x,L[st+V+1]=s.y,L[st+V+2]=s.z,L[st+V+3]=0),x===!0&&(s.fromBufferAttribute(k,Q),L[st+V+4]=s.x,L[st+V+5]=s.y,L[st+V+6]=s.z,L[st+V+7]=0),m===!0&&(s.fromBufferAttribute(J,Q),L[st+V+8]=s.x,L[st+V+9]=s.y,L[st+V+10]=s.z,L[st+V+11]=J.itemSize===4?s.w:1)}}d={count:h,texture:b,size:new Mt(F,D)},i.set(a,d),a.addEventListener("dispose",g)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",o.morphTexture,e);else{let v=0;for(let m=0;m<c.length;m++)v+=c[m];const x=a.morphTargetsRelative?1:1-v;l.getUniforms().setValue(n,"morphTargetBaseInfluence",x),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",d.texture,e),l.getUniforms().setValue(n,"morphTargetsTextureSize",d.size)}return{update:r}}function gx(n,t,e,i){let s=new WeakMap;function r(l){const c=i.render.frame,u=l.geometry,h=t.get(l,u);if(s.get(h)!==c&&(t.update(h),s.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),s.get(l)!==c&&(e.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&e.update(l.instanceColor,n.ARRAY_BUFFER),s.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;s.get(d)!==c&&(d.update(),s.set(d,c))}return h}function o(){s=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),e.remove(c.instanceMatrix),c.instanceColor!==null&&e.remove(c.instanceColor)}return{update:r,dispose:o}}class pd extends je{constructor(t,e,i,s,r,o,a,l,c,u=Ss){if(u!==Ss&&u!==Cs)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===Ss&&(i=Wi),i===void 0&&u===Cs&&(i=Rs),super(null,s,r,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=a!==void 0?a:_n,this.minFilter=l!==void 0?l:_n,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}const md=new je,$u=new pd(1,1),_d=new rd,gd=new ig,vd=new hd,Ju=[],Qu=[],th=new Float32Array(16),eh=new Float32Array(9),nh=new Float32Array(4);function Ns(n,t,e){const i=n[0];if(i<=0||i>0)return n;const s=t*e;let r=Ju[s];if(r===void 0&&(r=new Float32Array(s),Ju[s]=r),t!==0){i.toArray(r,0);for(let o=1,a=0;o!==t;++o)a+=e,n[o].toArray(r,a)}return r}function Te(n,t){if(n.length!==t.length)return!1;for(let e=0,i=n.length;e<i;e++)if(n[e]!==t[e])return!1;return!0}function we(n,t){for(let e=0,i=t.length;e<i;e++)n[e]=t[e]}function qo(n,t){let e=Qu[t];e===void 0&&(e=new Int32Array(t),Qu[t]=e);for(let i=0;i!==t;++i)e[i]=n.allocateTextureUnit();return e}function vx(n,t){const e=this.cache;e[0]!==t&&(n.uniform1f(this.addr,t),e[0]=t)}function xx(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(n.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Te(e,t))return;n.uniform2fv(this.addr,t),we(e,t)}}function yx(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(n.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(n.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(Te(e,t))return;n.uniform3fv(this.addr,t),we(e,t)}}function Mx(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(n.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Te(e,t))return;n.uniform4fv(this.addr,t),we(e,t)}}function Sx(n,t){const e=this.cache,i=t.elements;if(i===void 0){if(Te(e,t))return;n.uniformMatrix2fv(this.addr,!1,t),we(e,t)}else{if(Te(e,i))return;nh.set(i),n.uniformMatrix2fv(this.addr,!1,nh),we(e,i)}}function Ex(n,t){const e=this.cache,i=t.elements;if(i===void 0){if(Te(e,t))return;n.uniformMatrix3fv(this.addr,!1,t),we(e,t)}else{if(Te(e,i))return;eh.set(i),n.uniformMatrix3fv(this.addr,!1,eh),we(e,i)}}function bx(n,t){const e=this.cache,i=t.elements;if(i===void 0){if(Te(e,t))return;n.uniformMatrix4fv(this.addr,!1,t),we(e,t)}else{if(Te(e,i))return;th.set(i),n.uniformMatrix4fv(this.addr,!1,th),we(e,i)}}function Tx(n,t){const e=this.cache;e[0]!==t&&(n.uniform1i(this.addr,t),e[0]=t)}function wx(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(n.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Te(e,t))return;n.uniform2iv(this.addr,t),we(e,t)}}function Ax(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(n.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Te(e,t))return;n.uniform3iv(this.addr,t),we(e,t)}}function Rx(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(n.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Te(e,t))return;n.uniform4iv(this.addr,t),we(e,t)}}function Cx(n,t){const e=this.cache;e[0]!==t&&(n.uniform1ui(this.addr,t),e[0]=t)}function Px(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(n.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Te(e,t))return;n.uniform2uiv(this.addr,t),we(e,t)}}function Lx(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(n.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Te(e,t))return;n.uniform3uiv(this.addr,t),we(e,t)}}function Dx(n,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(n.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Te(e,t))return;n.uniform4uiv(this.addr,t),we(e,t)}}function Ix(n,t,e){const i=this.cache,s=e.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s);let r;this.type===n.SAMPLER_2D_SHADOW?($u.compareFunction=nd,r=$u):r=md,e.setTexture2D(t||r,s)}function Ux(n,t,e){const i=this.cache,s=e.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),e.setTexture3D(t||gd,s)}function Nx(n,t,e){const i=this.cache,s=e.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),e.setTextureCube(t||vd,s)}function Ox(n,t,e){const i=this.cache,s=e.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),e.setTexture2DArray(t||_d,s)}function Fx(n){switch(n){case 5126:return vx;case 35664:return xx;case 35665:return yx;case 35666:return Mx;case 35674:return Sx;case 35675:return Ex;case 35676:return bx;case 5124:case 35670:return Tx;case 35667:case 35671:return wx;case 35668:case 35672:return Ax;case 35669:case 35673:return Rx;case 5125:return Cx;case 36294:return Px;case 36295:return Lx;case 36296:return Dx;case 35678:case 36198:case 36298:case 36306:case 35682:return Ix;case 35679:case 36299:case 36307:return Ux;case 35680:case 36300:case 36308:case 36293:return Nx;case 36289:case 36303:case 36311:case 36292:return Ox}}function Bx(n,t){n.uniform1fv(this.addr,t)}function zx(n,t){const e=Ns(t,this.size,2);n.uniform2fv(this.addr,e)}function Hx(n,t){const e=Ns(t,this.size,3);n.uniform3fv(this.addr,e)}function kx(n,t){const e=Ns(t,this.size,4);n.uniform4fv(this.addr,e)}function Vx(n,t){const e=Ns(t,this.size,4);n.uniformMatrix2fv(this.addr,!1,e)}function Gx(n,t){const e=Ns(t,this.size,9);n.uniformMatrix3fv(this.addr,!1,e)}function Wx(n,t){const e=Ns(t,this.size,16);n.uniformMatrix4fv(this.addr,!1,e)}function Xx(n,t){n.uniform1iv(this.addr,t)}function Yx(n,t){n.uniform2iv(this.addr,t)}function qx(n,t){n.uniform3iv(this.addr,t)}function jx(n,t){n.uniform4iv(this.addr,t)}function Zx(n,t){n.uniform1uiv(this.addr,t)}function Kx(n,t){n.uniform2uiv(this.addr,t)}function $x(n,t){n.uniform3uiv(this.addr,t)}function Jx(n,t){n.uniform4uiv(this.addr,t)}function Qx(n,t,e){const i=this.cache,s=t.length,r=qo(e,s);Te(i,r)||(n.uniform1iv(this.addr,r),we(i,r));for(let o=0;o!==s;++o)e.setTexture2D(t[o]||md,r[o])}function ty(n,t,e){const i=this.cache,s=t.length,r=qo(e,s);Te(i,r)||(n.uniform1iv(this.addr,r),we(i,r));for(let o=0;o!==s;++o)e.setTexture3D(t[o]||gd,r[o])}function ey(n,t,e){const i=this.cache,s=t.length,r=qo(e,s);Te(i,r)||(n.uniform1iv(this.addr,r),we(i,r));for(let o=0;o!==s;++o)e.setTextureCube(t[o]||vd,r[o])}function ny(n,t,e){const i=this.cache,s=t.length,r=qo(e,s);Te(i,r)||(n.uniform1iv(this.addr,r),we(i,r));for(let o=0;o!==s;++o)e.setTexture2DArray(t[o]||_d,r[o])}function iy(n){switch(n){case 5126:return Bx;case 35664:return zx;case 35665:return Hx;case 35666:return kx;case 35674:return Vx;case 35675:return Gx;case 35676:return Wx;case 5124:case 35670:return Xx;case 35667:case 35671:return Yx;case 35668:case 35672:return qx;case 35669:case 35673:return jx;case 5125:return Zx;case 36294:return Kx;case 36295:return $x;case 36296:return Jx;case 35678:case 36198:case 36298:case 36306:case 35682:return Qx;case 35679:case 36299:case 36307:return ty;case 35680:case 36300:case 36308:case 36293:return ey;case 36289:case 36303:case 36311:case 36292:return ny}}class sy{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=Fx(e.type)}}class ry{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=iy(e.type)}}class oy{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){const s=this.seq;for(let r=0,o=s.length;r!==o;++r){const a=s[r];a.setValue(t,e[a.id],i)}}}const Na=/(\w+)(\])?(\[|\.)?/g;function ih(n,t){n.seq.push(t),n.map[t.id]=t}function ay(n,t,e){const i=n.name,s=i.length;for(Na.lastIndex=0;;){const r=Na.exec(i),o=Na.lastIndex;let a=r[1];const l=r[2]==="]",c=r[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===s){ih(e,c===void 0?new sy(a,n,t):new ry(a,n,t));break}else{let h=e.map[a];h===void 0&&(h=new oy(a),ih(e,h)),e=h}}}class vo{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let s=0;s<i;++s){const r=t.getActiveUniform(e,s),o=t.getUniformLocation(e,r.name);ay(r,o,this)}}setValue(t,e,i,s){const r=this.map[e];r!==void 0&&r.setValue(t,i,s)}setOptional(t,e,i){const s=e[i];s!==void 0&&this.setValue(t,i,s)}static upload(t,e,i,s){for(let r=0,o=e.length;r!==o;++r){const a=e[r],l=i[a.id];l.needsUpdate!==!1&&a.setValue(t,l.value,s)}}static seqWithValue(t,e){const i=[];for(let s=0,r=t.length;s!==r;++s){const o=t[s];o.id in e&&i.push(o)}return i}}function sh(n,t,e){const i=n.createShader(t);return n.shaderSource(i,e),n.compileShader(i),i}const ly=37297;let cy=0;function uy(n,t){const e=n.split(`
|
||
`),i=[],s=Math.max(t-6,0),r=Math.min(t+6,e.length);for(let o=s;o<r;o++){const a=o+1;i.push(`${a===t?">":" "} ${a}: ${e[o]}`)}return i.join(`
|
||
`)}const rh=new Xt;function hy(n){Zt._getMatrix(rh,Zt.workingColorSpace,n);const t=`mat3( ${rh.elements.map(e=>e.toFixed(4))} )`;switch(Zt.getTransfer(n)){case Wo:return[t,"LinearTransferOETF"];case se:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[t,"LinearTransferOETF"]}}function oh(n,t,e){const i=n.getShaderParameter(t,n.COMPILE_STATUS),s=n.getShaderInfoLog(t).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return e.toUpperCase()+`
|
||
|
||
`+s+`
|
||
|
||
`+uy(n.getShaderSource(t),o)}else return s}function fy(n,t){const e=hy(t);return[`vec4 ${n}( vec4 value ) {`,` return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(`
|
||
`)}function dy(n,t){let e;switch(t){case C_:e="Linear";break;case P_:e="Reinhard";break;case L_:e="Cineon";break;case D_:e="ACESFilmic";break;case U_:e="AgX";break;case N_:e="Neutral";break;case I_:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+n+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}const $r=new I;function py(){Zt.getLuminanceCoefficients($r);const n=$r.x.toFixed(4),t=$r.y.toFixed(4),e=$r.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(`
|
||
`)}function my(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter($s).join(`
|
||
`)}function _y(n){const t=[];for(const e in n){const i=n[e];i!==!1&&t.push("#define "+e+" "+i)}return t.join(`
|
||
`)}function gy(n,t){const e={},i=n.getProgramParameter(t,n.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const r=n.getActiveAttrib(t,s),o=r.name;let a=1;r.type===n.FLOAT_MAT2&&(a=2),r.type===n.FLOAT_MAT3&&(a=3),r.type===n.FLOAT_MAT4&&(a=4),e[o]={type:r.type,location:n.getAttribLocation(t,o),locationSize:a}}return e}function $s(n){return n!==""}function ah(n,t){const e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function lh(n,t){return n.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const vy=/^[ \t]*#include +<([\w\d./]+)>/gm;function Gl(n){return n.replace(vy,yy)}const xy=new Map;function yy(n,t){let e=jt[t];if(e===void 0){const i=xy.get(t);if(i!==void 0)e=jt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i);else throw new Error("Can not resolve #include <"+t+">")}return Gl(e)}const My=/#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 ch(n){return n.replace(My,Sy)}function Sy(n,t,e,i){let s="";for(let r=parseInt(t);r<parseInt(e);r++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function uh(n){let t=`precision ${n.precision} float;
|
||
precision ${n.precision} int;
|
||
precision ${n.precision} sampler2D;
|
||
precision ${n.precision} samplerCube;
|
||
precision ${n.precision} sampler3D;
|
||
precision ${n.precision} sampler2DArray;
|
||
precision ${n.precision} sampler2DShadow;
|
||
precision ${n.precision} samplerCubeShadow;
|
||
precision ${n.precision} sampler2DArrayShadow;
|
||
precision ${n.precision} isampler2D;
|
||
precision ${n.precision} isampler3D;
|
||
precision ${n.precision} isamplerCube;
|
||
precision ${n.precision} isampler2DArray;
|
||
precision ${n.precision} usampler2D;
|
||
precision ${n.precision} usampler3D;
|
||
precision ${n.precision} usamplerCube;
|
||
precision ${n.precision} usampler2DArray;
|
||
`;return n.precision==="highp"?t+=`
|
||
#define HIGH_PRECISION`:n.precision==="mediump"?t+=`
|
||
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(t+=`
|
||
#define LOW_PRECISION`),t}function Ey(n){let t="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===Gf?t="SHADOWMAP_TYPE_PCF":n.shadowMapType===l_?t="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Hn&&(t="SHADOWMAP_TYPE_VSM"),t}function by(n){let t="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case ws:case As:t="ENVMAP_TYPE_CUBE";break;case Go:t="ENVMAP_TYPE_CUBE_UV";break}return t}function Ty(n){let t="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case As:t="ENVMAP_MODE_REFRACTION";break}return t}function wy(n){let t="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case _c:t="ENVMAP_BLENDING_MULTIPLY";break;case A_:t="ENVMAP_BLENDING_MIX";break;case R_:t="ENVMAP_BLENDING_ADD";break}return t}function Ay(n){const t=n.envMapCubeUVHeight;if(t===null)return null;const e=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:i,maxMip:e}}function Ry(n,t,e,i){const s=n.getContext(),r=e.defines;let o=e.vertexShader,a=e.fragmentShader;const l=Ey(e),c=by(e),u=Ty(e),h=wy(e),d=Ay(e),p=my(e),v=_y(r),x=s.createProgram();let m,f,R=e.glslVersion?"#version "+e.glslVersion+`
|
||
`:"";e.isRawShaderMaterial?(m=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,v].filter($s).join(`
|
||
`),m.length>0&&(m+=`
|
||
`),f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,v].filter($s).join(`
|
||
`),f.length>0&&(f+=`
|
||
`)):(m=[uh(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,v,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+u:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.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($s).join(`
|
||
`),f=[uh(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,v,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+u:"",e.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==gi?"#define TONE_MAPPING":"",e.toneMapping!==gi?jt.tonemapping_pars_fragment:"",e.toneMapping!==gi?dy("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",jt.colorspace_pars_fragment,fy("linearToOutputTexel",e.outputColorSpace),py(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
|
||
`].filter($s).join(`
|
||
`)),o=Gl(o),o=ah(o,e),o=lh(o,e),a=Gl(a),a=ah(a,e),a=lh(a,e),o=ch(o),a=ch(a),e.isRawShaderMaterial!==!0&&(R=`#version 300 es
|
||
`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
||
`)+`
|
||
`+m,f=["#define varying in",e.glslVersion===Eu?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Eu?"":"#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(`
|
||
`)+`
|
||
`+f);const w=R+m+o,M=R+f+a,F=sh(s,s.VERTEX_SHADER,w),D=sh(s,s.FRAGMENT_SHADER,M);s.attachShader(x,F),s.attachShader(x,D),e.index0AttributeName!==void 0?s.bindAttribLocation(x,0,e.index0AttributeName):e.morphTargets===!0&&s.bindAttribLocation(x,0,"position"),s.linkProgram(x);function L(A){if(n.debug.checkShaderErrors){const O=s.getProgramInfoLog(x).trim(),k=s.getShaderInfoLog(F).trim(),J=s.getShaderInfoLog(D).trim();let st=!0,Q=!0;if(s.getProgramParameter(x,s.LINK_STATUS)===!1)if(st=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(s,x,F,D);else{const V=oh(s,F,"vertex"),G=oh(s,D,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(x,s.VALIDATE_STATUS)+`
|
||
|
||
Material Name: `+A.name+`
|
||
Material Type: `+A.type+`
|
||
|
||
Program Info Log: `+O+`
|
||
`+V+`
|
||
`+G)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(k===""||J==="")&&(Q=!1);Q&&(A.diagnostics={runnable:st,programLog:O,vertexShader:{log:k,prefix:m},fragmentShader:{log:J,prefix:f}})}s.deleteShader(F),s.deleteShader(D),b=new vo(s,x),_=gy(s,x)}let b;this.getUniforms=function(){return b===void 0&&L(this),b};let _;this.getAttributes=function(){return _===void 0&&L(this),_};let g=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=s.getProgramParameter(x,ly)),g},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(x),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=cy++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=F,this.fragmentShader=D,this}let Cy=0;class Py{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,s=this._getShaderStage(e),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(t);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const i of e)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return i===void 0&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return i===void 0&&(i=new Ly(t),e.set(t,i)),i}}class Ly{constructor(t){this.id=Cy++,this.code=t,this.usedTimes=0}}function Dy(n,t,e,i,s,r,o){const a=new Ec,l=new Py,c=new Set,u=[],h=s.logarithmicDepthBuffer,d=s.vertexTextures;let p=s.precision;const v={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 x(_){return c.add(_),_===0?"uv":`uv${_}`}function m(_,g,A,O,k){const J=O.fog,st=k.geometry,Q=_.isMeshStandardMaterial?O.environment:null,V=(_.isMeshStandardMaterial?e:t).get(_.envMap||Q),G=V&&V.mapping===Go?V.image.height:null,it=v[_.type];_.precision!==null&&(p=s.getMaxPrecision(_.precision),p!==_.precision&&console.warn("THREE.WebGLProgram.getParameters:",_.precision,"not supported, using",p,"instead."));const vt=st.morphAttributes.position||st.morphAttributes.normal||st.morphAttributes.color,W=vt!==void 0?vt.length:0;let rt=0;st.morphAttributes.position!==void 0&&(rt=1),st.morphAttributes.normal!==void 0&&(rt=2),st.morphAttributes.color!==void 0&&(rt=3);let ct,$,lt,pt;if(it){const ne=Tn[it];ct=ne.vertexShader,$=ne.fragmentShader}else ct=_.vertexShader,$=_.fragmentShader,l.update(_),lt=l.getVertexShaderID(_),pt=l.getFragmentShaderID(_);const ut=n.getRenderTarget(),et=n.state.buffers.depth.getReversed(),ft=k.isInstancedMesh===!0,gt=k.isBatchedMesh===!0,yt=!!_.map,T=!!_.matcap,C=!!V,S=!!_.aoMap,H=!!_.lightMap,U=!!_.bumpMap,z=!!_.normalMap,B=!!_.displacementMap,tt=!!_.emissiveMap,j=!!_.metalnessMap,E=!!_.roughnessMap,y=_.anisotropy>0,N=_.clearcoat>0,X=_.dispersion>0,nt=_.iridescence>0,K=_.sheen>0,xt=_.transmission>0,dt=y&&!!_.anisotropyMap,St=N&&!!_.clearcoatMap,Ft=N&&!!_.clearcoatNormalMap,mt=N&&!!_.clearcoatRoughnessMap,Et=nt&&!!_.iridescenceMap,Dt=nt&&!!_.iridescenceThicknessMap,Bt=K&&!!_.sheenColorMap,Tt=K&&!!_.sheenRoughnessMap,zt=!!_.specularMap,Vt=!!_.specularColorMap,ee=!!_.specularIntensityMap,Y=xt&&!!_.transmissionMap,At=xt&&!!_.thicknessMap,ht=!!_.gradientMap,_t=!!_.alphaMap,Lt=_.alphaTest>0,Ct=!!_.alphaHash,Gt=!!_.extensions;let ve=gi;_.toneMapped&&(ut===null||ut.isXRRenderTarget===!0)&&(ve=n.toneMapping);const Pe={shaderID:it,shaderType:_.type,shaderName:_.name,vertexShader:ct,fragmentShader:$,defines:_.defines,customVertexShaderID:lt,customFragmentShaderID:pt,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:p,batching:gt,batchingColor:gt&&k._colorsTexture!==null,instancing:ft,instancingColor:ft&&k.instanceColor!==null,instancingMorph:ft&&k.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:ut===null?n.outputColorSpace:ut.isXRRenderTarget===!0?ut.texture.colorSpace:Ls,alphaToCoverage:!!_.alphaToCoverage,map:yt,matcap:T,envMap:C,envMapMode:C&&V.mapping,envMapCubeUVHeight:G,aoMap:S,lightMap:H,bumpMap:U,normalMap:z,displacementMap:d&&B,emissiveMap:tt,normalMapObjectSpace:z&&_.normalMapType===z_,normalMapTangentSpace:z&&_.normalMapType===ed,metalnessMap:j,roughnessMap:E,anisotropy:y,anisotropyMap:dt,clearcoat:N,clearcoatMap:St,clearcoatNormalMap:Ft,clearcoatRoughnessMap:mt,dispersion:X,iridescence:nt,iridescenceMap:Et,iridescenceThicknessMap:Dt,sheen:K,sheenColorMap:Bt,sheenRoughnessMap:Tt,specularMap:zt,specularColorMap:Vt,specularIntensityMap:ee,transmission:xt,transmissionMap:Y,thicknessMap:At,gradientMap:ht,opaque:_.transparent===!1&&_.blending===Ms&&_.alphaToCoverage===!1,alphaMap:_t,alphaTest:Lt,alphaHash:Ct,combine:_.combine,mapUv:yt&&x(_.map.channel),aoMapUv:S&&x(_.aoMap.channel),lightMapUv:H&&x(_.lightMap.channel),bumpMapUv:U&&x(_.bumpMap.channel),normalMapUv:z&&x(_.normalMap.channel),displacementMapUv:B&&x(_.displacementMap.channel),emissiveMapUv:tt&&x(_.emissiveMap.channel),metalnessMapUv:j&&x(_.metalnessMap.channel),roughnessMapUv:E&&x(_.roughnessMap.channel),anisotropyMapUv:dt&&x(_.anisotropyMap.channel),clearcoatMapUv:St&&x(_.clearcoatMap.channel),clearcoatNormalMapUv:Ft&&x(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:mt&&x(_.clearcoatRoughnessMap.channel),iridescenceMapUv:Et&&x(_.iridescenceMap.channel),iridescenceThicknessMapUv:Dt&&x(_.iridescenceThicknessMap.channel),sheenColorMapUv:Bt&&x(_.sheenColorMap.channel),sheenRoughnessMapUv:Tt&&x(_.sheenRoughnessMap.channel),specularMapUv:zt&&x(_.specularMap.channel),specularColorMapUv:Vt&&x(_.specularColorMap.channel),specularIntensityMapUv:ee&&x(_.specularIntensityMap.channel),transmissionMapUv:Y&&x(_.transmissionMap.channel),thicknessMapUv:At&&x(_.thicknessMap.channel),alphaMapUv:_t&&x(_.alphaMap.channel),vertexTangents:!!st.attributes.tangent&&(z||y),vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!st.attributes.color&&st.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!st.attributes.uv&&(yt||_t),fog:!!J,useFog:_.fog===!0,fogExp2:!!J&&J.isFogExp2,flatShading:_.flatShading===!0,sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:et,skinning:k.isSkinnedMesh===!0,morphTargets:st.morphAttributes.position!==void 0,morphNormals:st.morphAttributes.normal!==void 0,morphColors:st.morphAttributes.color!==void 0,morphTargetsCount:W,morphTextureStride:rt,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:o.numPlanes,numClipIntersection:o.numIntersection,dithering:_.dithering,shadowMapEnabled:n.shadowMap.enabled&&A.length>0,shadowMapType:n.shadowMap.type,toneMapping:ve,decodeVideoTexture:yt&&_.map.isVideoTexture===!0&&Zt.getTransfer(_.map.colorSpace)===se,decodeVideoTextureEmissive:tt&&_.emissiveMap.isVideoTexture===!0&&Zt.getTransfer(_.emissiveMap.colorSpace)===se,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===rn,flipSided:_.side===qe,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:Gt&&_.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Gt&&_.extensions.multiDraw===!0||gt)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return Pe.vertexUv1s=c.has(1),Pe.vertexUv2s=c.has(2),Pe.vertexUv3s=c.has(3),c.clear(),Pe}function f(_){const g=[];if(_.shaderID?g.push(_.shaderID):(g.push(_.customVertexShaderID),g.push(_.customFragmentShaderID)),_.defines!==void 0)for(const A in _.defines)g.push(A),g.push(_.defines[A]);return _.isRawShaderMaterial===!1&&(R(g,_),w(g,_),g.push(n.outputColorSpace)),g.push(_.customProgramCacheKey),g.join()}function R(_,g){_.push(g.precision),_.push(g.outputColorSpace),_.push(g.envMapMode),_.push(g.envMapCubeUVHeight),_.push(g.mapUv),_.push(g.alphaMapUv),_.push(g.lightMapUv),_.push(g.aoMapUv),_.push(g.bumpMapUv),_.push(g.normalMapUv),_.push(g.displacementMapUv),_.push(g.emissiveMapUv),_.push(g.metalnessMapUv),_.push(g.roughnessMapUv),_.push(g.anisotropyMapUv),_.push(g.clearcoatMapUv),_.push(g.clearcoatNormalMapUv),_.push(g.clearcoatRoughnessMapUv),_.push(g.iridescenceMapUv),_.push(g.iridescenceThicknessMapUv),_.push(g.sheenColorMapUv),_.push(g.sheenRoughnessMapUv),_.push(g.specularMapUv),_.push(g.specularColorMapUv),_.push(g.specularIntensityMapUv),_.push(g.transmissionMapUv),_.push(g.thicknessMapUv),_.push(g.combine),_.push(g.fogExp2),_.push(g.sizeAttenuation),_.push(g.morphTargetsCount),_.push(g.morphAttributeCount),_.push(g.numDirLights),_.push(g.numPointLights),_.push(g.numSpotLights),_.push(g.numSpotLightMaps),_.push(g.numHemiLights),_.push(g.numRectAreaLights),_.push(g.numDirLightShadows),_.push(g.numPointLightShadows),_.push(g.numSpotLightShadows),_.push(g.numSpotLightShadowsWithMaps),_.push(g.numLightProbes),_.push(g.shadowMapType),_.push(g.toneMapping),_.push(g.numClippingPlanes),_.push(g.numClipIntersection),_.push(g.depthPacking)}function w(_,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),_.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),_.push(a.mask)}function M(_){const g=v[_.type];let A;if(g){const O=Tn[g];A=mg.clone(O.uniforms)}else A=_.uniforms;return A}function F(_,g){let A;for(let O=0,k=u.length;O<k;O++){const J=u[O];if(J.cacheKey===g){A=J,++A.usedTimes;break}}return A===void 0&&(A=new Ry(n,g,_,r),u.push(A)),A}function D(_){if(--_.usedTimes===0){const g=u.indexOf(_);u[g]=u[u.length-1],u.pop(),_.destroy()}}function L(_){l.remove(_)}function b(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:M,acquireProgram:F,releaseProgram:D,releaseShaderCache:L,programs:u,dispose:b}}function Iy(){let n=new WeakMap;function t(o){return n.has(o)}function e(o){let a=n.get(o);return a===void 0&&(a={},n.set(o,a)),a}function i(o){n.delete(o)}function s(o,a,l){n.get(o)[a]=l}function r(){n=new WeakMap}return{has:t,get:e,remove:i,update:s,dispose:r}}function Uy(n,t){return n.groupOrder!==t.groupOrder?n.groupOrder-t.groupOrder:n.renderOrder!==t.renderOrder?n.renderOrder-t.renderOrder:n.material.id!==t.material.id?n.material.id-t.material.id:n.z!==t.z?n.z-t.z:n.id-t.id}function hh(n,t){return n.groupOrder!==t.groupOrder?n.groupOrder-t.groupOrder:n.renderOrder!==t.renderOrder?n.renderOrder-t.renderOrder:n.z!==t.z?t.z-n.z:n.id-t.id}function fh(){const n=[];let t=0;const e=[],i=[],s=[];function r(){t=0,e.length=0,i.length=0,s.length=0}function o(h,d,p,v,x,m){let f=n[t];return f===void 0?(f={id:h.id,object:h,geometry:d,material:p,groupOrder:v,renderOrder:h.renderOrder,z:x,group:m},n[t]=f):(f.id=h.id,f.object=h,f.geometry=d,f.material=p,f.groupOrder=v,f.renderOrder=h.renderOrder,f.z=x,f.group=m),t++,f}function a(h,d,p,v,x,m){const f=o(h,d,p,v,x,m);p.transmission>0?i.push(f):p.transparent===!0?s.push(f):e.push(f)}function l(h,d,p,v,x,m){const f=o(h,d,p,v,x,m);p.transmission>0?i.unshift(f):p.transparent===!0?s.unshift(f):e.unshift(f)}function c(h,d){e.length>1&&e.sort(h||Uy),i.length>1&&i.sort(d||hh),s.length>1&&s.sort(d||hh)}function u(){for(let h=t,d=n.length;h<d;h++){const p=n[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:e,transmissive:i,transparent:s,init:r,push:a,unshift:l,finish:u,sort:c}}function Ny(){let n=new WeakMap;function t(i,s){const r=n.get(i);let o;return r===void 0?(o=new fh,n.set(i,[o])):s>=r.length?(o=new fh,r.push(o)):o=r[s],o}function e(){n=new WeakMap}return{get:t,dispose:e}}function Oy(){const n={};return{get:function(t){if(n[t.id]!==void 0)return n[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new I,color:new kt};break;case"SpotLight":e={position:new I,direction:new I,color:new kt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new I,color:new kt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new I,skyColor:new kt,groundColor:new kt};break;case"RectAreaLight":e={color:new kt,position:new I,halfWidth:new I,halfHeight:new I};break}return n[t.id]=e,e}}}function Fy(){const n={};return{get:function(t){if(n[t.id]!==void 0)return n[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Mt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[t.id]=e,e}}}let By=0;function zy(n,t){return(t.castShadow?2:0)-(n.castShadow?2:0)+(t.map?1:0)-(n.map?1:0)}function Hy(n){const t=new Oy,e=Fy(),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 c=0;c<9;c++)i.probe.push(new I);const s=new I,r=new ae,o=new ae;function a(c){let u=0,h=0,d=0;for(let _=0;_<9;_++)i.probe[_].set(0,0,0);let p=0,v=0,x=0,m=0,f=0,R=0,w=0,M=0,F=0,D=0,L=0;c.sort(zy);for(let _=0,g=c.length;_<g;_++){const A=c[_],O=A.color,k=A.intensity,J=A.distance,st=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)u+=O.r*k,h+=O.g*k,d+=O.b*k;else if(A.isLightProbe){for(let Q=0;Q<9;Q++)i.probe[Q].addScaledVector(A.sh.coefficients[Q],k);L++}else if(A.isDirectionalLight){const Q=t.get(A);if(Q.color.copy(A.color).multiplyScalar(A.intensity),A.castShadow){const V=A.shadow,G=e.get(A);G.shadowIntensity=V.intensity,G.shadowBias=V.bias,G.shadowNormalBias=V.normalBias,G.shadowRadius=V.radius,G.shadowMapSize=V.mapSize,i.directionalShadow[p]=G,i.directionalShadowMap[p]=st,i.directionalShadowMatrix[p]=A.shadow.matrix,R++}i.directional[p]=Q,p++}else if(A.isSpotLight){const Q=t.get(A);Q.position.setFromMatrixPosition(A.matrixWorld),Q.color.copy(O).multiplyScalar(k),Q.distance=J,Q.coneCos=Math.cos(A.angle),Q.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),Q.decay=A.decay,i.spot[x]=Q;const V=A.shadow;if(A.map&&(i.spotLightMap[F]=A.map,F++,V.updateMatrices(A),A.castShadow&&D++),i.spotLightMatrix[x]=V.matrix,A.castShadow){const G=e.get(A);G.shadowIntensity=V.intensity,G.shadowBias=V.bias,G.shadowNormalBias=V.normalBias,G.shadowRadius=V.radius,G.shadowMapSize=V.mapSize,i.spotShadow[x]=G,i.spotShadowMap[x]=st,M++}x++}else if(A.isRectAreaLight){const Q=t.get(A);Q.color.copy(O).multiplyScalar(k),Q.halfWidth.set(A.width*.5,0,0),Q.halfHeight.set(0,A.height*.5,0),i.rectArea[m]=Q,m++}else if(A.isPointLight){const Q=t.get(A);if(Q.color.copy(A.color).multiplyScalar(A.intensity),Q.distance=A.distance,Q.decay=A.decay,A.castShadow){const V=A.shadow,G=e.get(A);G.shadowIntensity=V.intensity,G.shadowBias=V.bias,G.shadowNormalBias=V.normalBias,G.shadowRadius=V.radius,G.shadowMapSize=V.mapSize,G.shadowCameraNear=V.camera.near,G.shadowCameraFar=V.camera.far,i.pointShadow[v]=G,i.pointShadowMap[v]=st,i.pointShadowMatrix[v]=A.shadow.matrix,w++}i.point[v]=Q,v++}else if(A.isHemisphereLight){const Q=t.get(A);Q.skyColor.copy(A.color).multiplyScalar(k),Q.groundColor.copy(A.groundColor).multiplyScalar(k),i.hemi[f]=Q,f++}}m>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=wt.LTC_FLOAT_1,i.rectAreaLTC2=wt.LTC_FLOAT_2):(i.rectAreaLTC1=wt.LTC_HALF_1,i.rectAreaLTC2=wt.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=h,i.ambient[2]=d;const b=i.hash;(b.directionalLength!==p||b.pointLength!==v||b.spotLength!==x||b.rectAreaLength!==m||b.hemiLength!==f||b.numDirectionalShadows!==R||b.numPointShadows!==w||b.numSpotShadows!==M||b.numSpotMaps!==F||b.numLightProbes!==L)&&(i.directional.length=p,i.spot.length=x,i.rectArea.length=m,i.point.length=v,i.hemi.length=f,i.directionalShadow.length=R,i.directionalShadowMap.length=R,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=M,i.spotShadowMap.length=M,i.directionalShadowMatrix.length=R,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=M+F-D,i.spotLightMap.length=F,i.numSpotLightShadowsWithMaps=D,i.numLightProbes=L,b.directionalLength=p,b.pointLength=v,b.spotLength=x,b.rectAreaLength=m,b.hemiLength=f,b.numDirectionalShadows=R,b.numPointShadows=w,b.numSpotShadows=M,b.numSpotMaps=F,b.numLightProbes=L,i.version=By++)}function l(c,u){let h=0,d=0,p=0,v=0,x=0;const m=u.matrixWorldInverse;for(let f=0,R=c.length;f<R;f++){const w=c[f];if(w.isDirectionalLight){const M=i.directional[h];M.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(m),h++}else if(w.isSpotLight){const M=i.spot[p];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),M.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(m),p++}else if(w.isRectAreaLight){const M=i.rectArea[v];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),o.identity(),r.copy(w.matrixWorld),r.premultiply(m),o.extractRotation(r),M.halfWidth.set(w.width*.5,0,0),M.halfHeight.set(0,w.height*.5,0),M.halfWidth.applyMatrix4(o),M.halfHeight.applyMatrix4(o),v++}else if(w.isPointLight){const M=i.point[d];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),d++}else if(w.isHemisphereLight){const M=i.hemi[x];M.direction.setFromMatrixPosition(w.matrixWorld),M.direction.transformDirection(m),x++}}}return{setup:a,setupView:l,state:i}}function dh(n){const t=new Hy(n),e=[],i=[];function s(u){c.camera=u,e.length=0,i.length=0}function r(u){e.push(u)}function o(u){i.push(u)}function a(){t.setup(e)}function l(u){t.setupView(e,u)}const c={lightsArray:e,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:s,state:c,setupLights:a,setupLightsView:l,pushLight:r,pushShadow:o}}function ky(n){let t=new WeakMap;function e(s,r=0){const o=t.get(s);let a;return o===void 0?(a=new dh(n),t.set(s,[a])):r>=o.length?(a=new dh(n),o.push(a)):a=o[r],a}function i(){t=new WeakMap}return{get:e,dispose:i}}class Vy extends Is{static get type(){return"MeshDepthMaterial"}constructor(t){super(),this.isMeshDepthMaterial=!0,this.depthPacking=F_,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Gy extends Is{static get type(){return"MeshDistanceMaterial"}constructor(t){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const Wy=`void main() {
|
||
gl_Position = vec4( position, 1.0 );
|
||
}`,Xy=`uniform sampler2D shadow_pass;
|
||
uniform vec2 resolution;
|
||
uniform float radius;
|
||
#include <packing>
|
||
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 Yy(n,t,e){let i=new bc;const s=new Mt,r=new Mt,o=new xe,a=new Vy({depthPacking:B_}),l=new Gy,c={},u=e.maxTextureSize,h={[Mi]:qe,[qe]:Mi,[rn]:rn},d=new Si({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Mt},radius:{value:4}},vertexShader:Wy,fragmentShader:Xy}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const v=new Be;v.setAttribute("position",new Cn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Rt(v,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Gf;let f=this.type;this.render=function(D,L,b){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||D.length===0)return;const _=n.getRenderTarget(),g=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),O=n.state;O.setBlending(_i),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const k=f!==Hn&&this.type===Hn,J=f===Hn&&this.type!==Hn;for(let st=0,Q=D.length;st<Q;st++){const V=D[st],G=V.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",V,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;s.copy(G.mapSize);const it=G.getFrameExtents();if(s.multiply(it),r.copy(G.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/it.x),s.x=r.x*it.x,G.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/it.y),s.y=r.y*it.y,G.mapSize.y=r.y)),G.map===null||k===!0||J===!0){const W=this.type!==Hn?{minFilter:_n,magFilter:_n}:{};G.map!==null&&G.map.dispose(),G.map=new Xi(s.x,s.y,W),G.map.texture.name=V.name+".shadowMap",G.camera.updateProjectionMatrix()}n.setRenderTarget(G.map),n.clear();const vt=G.getViewportCount();for(let W=0;W<vt;W++){const rt=G.getViewport(W);o.set(r.x*rt.x,r.y*rt.y,r.x*rt.z,r.y*rt.w),O.viewport(o),G.updateMatrices(V,W),i=G.getFrustum(),M(L,b,G.camera,V,this.type)}G.isPointLightShadow!==!0&&this.type===Hn&&R(G,b),G.needsUpdate=!1}f=this.type,m.needsUpdate=!1,n.setRenderTarget(_,g,A)};function R(D,L){const b=t.update(x);d.defines.VSM_SAMPLES!==D.blurSamples&&(d.defines.VSM_SAMPLES=D.blurSamples,p.defines.VSM_SAMPLES=D.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new Xi(s.x,s.y)),d.uniforms.shadow_pass.value=D.map.texture,d.uniforms.resolution.value=D.mapSize,d.uniforms.radius.value=D.radius,n.setRenderTarget(D.mapPass),n.clear(),n.renderBufferDirect(L,null,b,d,x,null),p.uniforms.shadow_pass.value=D.mapPass.texture,p.uniforms.resolution.value=D.mapSize,p.uniforms.radius.value=D.radius,n.setRenderTarget(D.map),n.clear(),n.renderBufferDirect(L,null,b,p,x,null)}function w(D,L,b,_){let g=null;const A=b.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(A!==void 0)g=A;else if(g=b.isPointLight===!0?l:a,n.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0){const O=g.uuid,k=L.uuid;let J=c[O];J===void 0&&(J={},c[O]=J);let st=J[k];st===void 0&&(st=g.clone(),J[k]=st,L.addEventListener("dispose",F)),g=st}if(g.visible=L.visible,g.wireframe=L.wireframe,_===Hn?g.side=L.shadowSide!==null?L.shadowSide:L.side:g.side=L.shadowSide!==null?L.shadowSide:h[L.side],g.alphaMap=L.alphaMap,g.alphaTest=L.alphaTest,g.map=L.map,g.clipShadows=L.clipShadows,g.clippingPlanes=L.clippingPlanes,g.clipIntersection=L.clipIntersection,g.displacementMap=L.displacementMap,g.displacementScale=L.displacementScale,g.displacementBias=L.displacementBias,g.wireframeLinewidth=L.wireframeLinewidth,g.linewidth=L.linewidth,b.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const O=n.properties.get(g);O.light=b}return g}function M(D,L,b,_,g){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&g===Hn)&&(!D.frustumCulled||i.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,D.matrixWorld);const k=t.update(D),J=D.material;if(Array.isArray(J)){const st=k.groups;for(let Q=0,V=st.length;Q<V;Q++){const G=st[Q],it=J[G.materialIndex];if(it&&it.visible){const vt=w(D,it,_,g);D.onBeforeShadow(n,D,L,b,k,vt,G),n.renderBufferDirect(b,null,k,vt,D,G),D.onAfterShadow(n,D,L,b,k,vt,G)}}}else if(J.visible){const st=w(D,J,_,g);D.onBeforeShadow(n,D,L,b,k,st,null),n.renderBufferDirect(b,null,k,st,D,null),D.onAfterShadow(n,D,L,b,k,st,null)}}const O=D.children;for(let k=0,J=O.length;k<J;k++)M(O[k],L,b,_,g)}function F(D){D.target.removeEventListener("dispose",F);for(const b in c){const _=c[b],g=D.target.uuid;g in _&&(_[g].dispose(),delete _[g])}}}const qy={[rl]:ol,[al]:ul,[ll]:hl,[Ts]:cl,[ol]:rl,[ul]:al,[hl]:ll,[cl]:Ts};function jy(n,t){function e(){let Y=!1;const At=new xe;let ht=null;const _t=new xe(0,0,0,0);return{setMask:function(Lt){ht!==Lt&&!Y&&(n.colorMask(Lt,Lt,Lt,Lt),ht=Lt)},setLocked:function(Lt){Y=Lt},setClear:function(Lt,Ct,Gt,ve,Pe){Pe===!0&&(Lt*=ve,Ct*=ve,Gt*=ve),At.set(Lt,Ct,Gt,ve),_t.equals(At)===!1&&(n.clearColor(Lt,Ct,Gt,ve),_t.copy(At))},reset:function(){Y=!1,ht=null,_t.set(-1,0,0,0)}}}function i(){let Y=!1,At=!1,ht=null,_t=null,Lt=null;return{setReversed:function(Ct){if(At!==Ct){const Gt=t.get("EXT_clip_control");At?Gt.clipControlEXT(Gt.LOWER_LEFT_EXT,Gt.ZERO_TO_ONE_EXT):Gt.clipControlEXT(Gt.LOWER_LEFT_EXT,Gt.NEGATIVE_ONE_TO_ONE_EXT);const ve=Lt;Lt=null,this.setClear(ve)}At=Ct},getReversed:function(){return At},setTest:function(Ct){Ct?ut(n.DEPTH_TEST):et(n.DEPTH_TEST)},setMask:function(Ct){ht!==Ct&&!Y&&(n.depthMask(Ct),ht=Ct)},setFunc:function(Ct){if(At&&(Ct=qy[Ct]),_t!==Ct){switch(Ct){case rl:n.depthFunc(n.NEVER);break;case ol:n.depthFunc(n.ALWAYS);break;case al:n.depthFunc(n.LESS);break;case Ts:n.depthFunc(n.LEQUAL);break;case ll:n.depthFunc(n.EQUAL);break;case cl:n.depthFunc(n.GEQUAL);break;case ul:n.depthFunc(n.GREATER);break;case hl:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}_t=Ct}},setLocked:function(Ct){Y=Ct},setClear:function(Ct){Lt!==Ct&&(At&&(Ct=1-Ct),n.clearDepth(Ct),Lt=Ct)},reset:function(){Y=!1,ht=null,_t=null,Lt=null,At=!1}}}function s(){let Y=!1,At=null,ht=null,_t=null,Lt=null,Ct=null,Gt=null,ve=null,Pe=null;return{setTest:function(ne){Y||(ne?ut(n.STENCIL_TEST):et(n.STENCIL_TEST))},setMask:function(ne){At!==ne&&!Y&&(n.stencilMask(ne),At=ne)},setFunc:function(ne,an,Dn){(ht!==ne||_t!==an||Lt!==Dn)&&(n.stencilFunc(ne,an,Dn),ht=ne,_t=an,Lt=Dn)},setOp:function(ne,an,Dn){(Ct!==ne||Gt!==an||ve!==Dn)&&(n.stencilOp(ne,an,Dn),Ct=ne,Gt=an,ve=Dn)},setLocked:function(ne){Y=ne},setClear:function(ne){Pe!==ne&&(n.clearStencil(ne),Pe=ne)},reset:function(){Y=!1,At=null,ht=null,_t=null,Lt=null,Ct=null,Gt=null,ve=null,Pe=null}}}const r=new e,o=new i,a=new s,l=new WeakMap,c=new WeakMap;let u={},h={},d=new WeakMap,p=[],v=null,x=!1,m=null,f=null,R=null,w=null,M=null,F=null,D=null,L=new kt(0,0,0),b=0,_=!1,g=null,A=null,O=null,k=null,J=null;const st=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Q=!1,V=0;const G=n.getParameter(n.VERSION);G.indexOf("WebGL")!==-1?(V=parseFloat(/^WebGL (\d)/.exec(G)[1]),Q=V>=1):G.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),Q=V>=2);let it=null,vt={};const W=n.getParameter(n.SCISSOR_BOX),rt=n.getParameter(n.VIEWPORT),ct=new xe().fromArray(W),$=new xe().fromArray(rt);function lt(Y,At,ht,_t){const Lt=new Uint8Array(4),Ct=n.createTexture();n.bindTexture(Y,Ct),n.texParameteri(Y,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(Y,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Gt=0;Gt<ht;Gt++)Y===n.TEXTURE_3D||Y===n.TEXTURE_2D_ARRAY?n.texImage3D(At,0,n.RGBA,1,1,_t,0,n.RGBA,n.UNSIGNED_BYTE,Lt):n.texImage2D(At+Gt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Lt);return Ct}const pt={};pt[n.TEXTURE_2D]=lt(n.TEXTURE_2D,n.TEXTURE_2D,1),pt[n.TEXTURE_CUBE_MAP]=lt(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),pt[n.TEXTURE_2D_ARRAY]=lt(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),pt[n.TEXTURE_3D]=lt(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),ut(n.DEPTH_TEST),o.setFunc(Ts),U(!1),z(gu),ut(n.CULL_FACE),S(_i);function ut(Y){u[Y]!==!0&&(n.enable(Y),u[Y]=!0)}function et(Y){u[Y]!==!1&&(n.disable(Y),u[Y]=!1)}function ft(Y,At){return h[Y]!==At?(n.bindFramebuffer(Y,At),h[Y]=At,Y===n.DRAW_FRAMEBUFFER&&(h[n.FRAMEBUFFER]=At),Y===n.FRAMEBUFFER&&(h[n.DRAW_FRAMEBUFFER]=At),!0):!1}function gt(Y,At){let ht=p,_t=!1;if(Y){ht=d.get(At),ht===void 0&&(ht=[],d.set(At,ht));const Lt=Y.textures;if(ht.length!==Lt.length||ht[0]!==n.COLOR_ATTACHMENT0){for(let Ct=0,Gt=Lt.length;Ct<Gt;Ct++)ht[Ct]=n.COLOR_ATTACHMENT0+Ct;ht.length=Lt.length,_t=!0}}else ht[0]!==n.BACK&&(ht[0]=n.BACK,_t=!0);_t&&n.drawBuffers(ht)}function yt(Y){return v!==Y?(n.useProgram(Y),v=Y,!0):!1}const T={[Fi]:n.FUNC_ADD,[u_]:n.FUNC_SUBTRACT,[h_]:n.FUNC_REVERSE_SUBTRACT};T[f_]=n.MIN,T[d_]=n.MAX;const C={[p_]:n.ZERO,[m_]:n.ONE,[__]:n.SRC_COLOR,[il]:n.SRC_ALPHA,[S_]:n.SRC_ALPHA_SATURATE,[y_]:n.DST_COLOR,[v_]:n.DST_ALPHA,[g_]:n.ONE_MINUS_SRC_COLOR,[sl]:n.ONE_MINUS_SRC_ALPHA,[M_]:n.ONE_MINUS_DST_COLOR,[x_]:n.ONE_MINUS_DST_ALPHA,[E_]:n.CONSTANT_COLOR,[b_]:n.ONE_MINUS_CONSTANT_COLOR,[T_]:n.CONSTANT_ALPHA,[w_]:n.ONE_MINUS_CONSTANT_ALPHA};function S(Y,At,ht,_t,Lt,Ct,Gt,ve,Pe,ne){if(Y===_i){x===!0&&(et(n.BLEND),x=!1);return}if(x===!1&&(ut(n.BLEND),x=!0),Y!==c_){if(Y!==m||ne!==_){if((f!==Fi||M!==Fi)&&(n.blendEquation(n.FUNC_ADD),f=Fi,M=Fi),ne)switch(Y){case Ms:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case vu:n.blendFunc(n.ONE,n.ONE);break;case xu:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case yu:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",Y);break}else switch(Y){case Ms:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case vu:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case xu:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case yu:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",Y);break}R=null,w=null,F=null,D=null,L.set(0,0,0),b=0,m=Y,_=ne}return}Lt=Lt||At,Ct=Ct||ht,Gt=Gt||_t,(At!==f||Lt!==M)&&(n.blendEquationSeparate(T[At],T[Lt]),f=At,M=Lt),(ht!==R||_t!==w||Ct!==F||Gt!==D)&&(n.blendFuncSeparate(C[ht],C[_t],C[Ct],C[Gt]),R=ht,w=_t,F=Ct,D=Gt),(ve.equals(L)===!1||Pe!==b)&&(n.blendColor(ve.r,ve.g,ve.b,Pe),L.copy(ve),b=Pe),m=Y,_=!1}function H(Y,At){Y.side===rn?et(n.CULL_FACE):ut(n.CULL_FACE);let ht=Y.side===qe;At&&(ht=!ht),U(ht),Y.blending===Ms&&Y.transparent===!1?S(_i):S(Y.blending,Y.blendEquation,Y.blendSrc,Y.blendDst,Y.blendEquationAlpha,Y.blendSrcAlpha,Y.blendDstAlpha,Y.blendColor,Y.blendAlpha,Y.premultipliedAlpha),o.setFunc(Y.depthFunc),o.setTest(Y.depthTest),o.setMask(Y.depthWrite),r.setMask(Y.colorWrite);const _t=Y.stencilWrite;a.setTest(_t),_t&&(a.setMask(Y.stencilWriteMask),a.setFunc(Y.stencilFunc,Y.stencilRef,Y.stencilFuncMask),a.setOp(Y.stencilFail,Y.stencilZFail,Y.stencilZPass)),tt(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),Y.alphaToCoverage===!0?ut(n.SAMPLE_ALPHA_TO_COVERAGE):et(n.SAMPLE_ALPHA_TO_COVERAGE)}function U(Y){g!==Y&&(Y?n.frontFace(n.CW):n.frontFace(n.CCW),g=Y)}function z(Y){Y!==o_?(ut(n.CULL_FACE),Y!==A&&(Y===gu?n.cullFace(n.BACK):Y===a_?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):et(n.CULL_FACE),A=Y}function B(Y){Y!==O&&(Q&&n.lineWidth(Y),O=Y)}function tt(Y,At,ht){Y?(ut(n.POLYGON_OFFSET_FILL),(k!==At||J!==ht)&&(n.polygonOffset(At,ht),k=At,J=ht)):et(n.POLYGON_OFFSET_FILL)}function j(Y){Y?ut(n.SCISSOR_TEST):et(n.SCISSOR_TEST)}function E(Y){Y===void 0&&(Y=n.TEXTURE0+st-1),it!==Y&&(n.activeTexture(Y),it=Y)}function y(Y,At,ht){ht===void 0&&(it===null?ht=n.TEXTURE0+st-1:ht=it);let _t=vt[ht];_t===void 0&&(_t={type:void 0,texture:void 0},vt[ht]=_t),(_t.type!==Y||_t.texture!==At)&&(it!==ht&&(n.activeTexture(ht),it=ht),n.bindTexture(Y,At||pt[Y]),_t.type=Y,_t.texture=At)}function N(){const Y=vt[it];Y!==void 0&&Y.type!==void 0&&(n.bindTexture(Y.type,null),Y.type=void 0,Y.texture=void 0)}function X(){try{n.compressedTexImage2D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function nt(){try{n.compressedTexImage3D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function K(){try{n.texSubImage2D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function xt(){try{n.texSubImage3D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function dt(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function St(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Ft(){try{n.texStorage2D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function mt(){try{n.texStorage3D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Et(){try{n.texImage2D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Dt(){try{n.texImage3D.apply(n,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Bt(Y){ct.equals(Y)===!1&&(n.scissor(Y.x,Y.y,Y.z,Y.w),ct.copy(Y))}function Tt(Y){$.equals(Y)===!1&&(n.viewport(Y.x,Y.y,Y.z,Y.w),$.copy(Y))}function zt(Y,At){let ht=c.get(At);ht===void 0&&(ht=new WeakMap,c.set(At,ht));let _t=ht.get(Y);_t===void 0&&(_t=n.getUniformBlockIndex(At,Y.name),ht.set(Y,_t))}function Vt(Y,At){const _t=c.get(At).get(Y);l.get(At)!==_t&&(n.uniformBlockBinding(At,_t,Y.__bindingPointIndex),l.set(At,_t))}function ee(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),o.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),u={},it=null,vt={},h={},d=new WeakMap,p=[],v=null,x=!1,m=null,f=null,R=null,w=null,M=null,F=null,D=null,L=new kt(0,0,0),b=0,_=!1,g=null,A=null,O=null,k=null,J=null,ct.set(0,0,n.canvas.width,n.canvas.height),$.set(0,0,n.canvas.width,n.canvas.height),r.reset(),o.reset(),a.reset()}return{buffers:{color:r,depth:o,stencil:a},enable:ut,disable:et,bindFramebuffer:ft,drawBuffers:gt,useProgram:yt,setBlending:S,setMaterial:H,setFlipSided:U,setCullFace:z,setLineWidth:B,setPolygonOffset:tt,setScissorTest:j,activeTexture:E,bindTexture:y,unbindTexture:N,compressedTexImage2D:X,compressedTexImage3D:nt,texImage2D:Et,texImage3D:Dt,updateUBOMapping:zt,uniformBlockBinding:Vt,texStorage2D:Ft,texStorage3D:mt,texSubImage2D:K,texSubImage3D:xt,compressedTexSubImage2D:dt,compressedTexSubImage3D:St,scissor:Bt,viewport:Tt,reset:ee}}function ph(n,t,e,i){const s=Zy(i);switch(e){case jf:return n*t;case Kf:return n*t;case $f:return n*t*2;case Jf:return n*t/s.components*s.byteLength;case yc:return n*t/s.components*s.byteLength;case Qf:return n*t*2/s.components*s.byteLength;case Mc:return n*t*2/s.components*s.byteLength;case Zf:return n*t*3/s.components*s.byteLength;case dn:return n*t*4/s.components*s.byteLength;case Sc:return n*t*4/s.components*s.byteLength;case ho:case fo:return Math.floor((n+3)/4)*Math.floor((t+3)/4)*8;case po:case mo:return Math.floor((n+3)/4)*Math.floor((t+3)/4)*16;case gl:case xl:return Math.max(n,16)*Math.max(t,8)/4;case _l:case vl:return Math.max(n,8)*Math.max(t,8)/2;case yl:case Ml:return Math.floor((n+3)/4)*Math.floor((t+3)/4)*8;case Sl:return Math.floor((n+3)/4)*Math.floor((t+3)/4)*16;case El:return Math.floor((n+3)/4)*Math.floor((t+3)/4)*16;case bl:return Math.floor((n+4)/5)*Math.floor((t+3)/4)*16;case Tl:return Math.floor((n+4)/5)*Math.floor((t+4)/5)*16;case wl:return Math.floor((n+5)/6)*Math.floor((t+4)/5)*16;case Al:return Math.floor((n+5)/6)*Math.floor((t+5)/6)*16;case Rl:return Math.floor((n+7)/8)*Math.floor((t+4)/5)*16;case Cl:return Math.floor((n+7)/8)*Math.floor((t+5)/6)*16;case Pl:return Math.floor((n+7)/8)*Math.floor((t+7)/8)*16;case Ll:return Math.floor((n+9)/10)*Math.floor((t+4)/5)*16;case Dl:return Math.floor((n+9)/10)*Math.floor((t+5)/6)*16;case Il:return Math.floor((n+9)/10)*Math.floor((t+7)/8)*16;case Ul:return Math.floor((n+9)/10)*Math.floor((t+9)/10)*16;case Nl:return Math.floor((n+11)/12)*Math.floor((t+9)/10)*16;case Ol:return Math.floor((n+11)/12)*Math.floor((t+11)/12)*16;case _o:case Fl:case Bl:return Math.ceil(n/4)*Math.ceil(t/4)*16;case td:case zl:return Math.ceil(n/4)*Math.ceil(t/4)*8;case Hl:case kl:return Math.ceil(n/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function Zy(n){switch(n){case $n:case Xf:return{byteLength:1,components:1};case _r:case Yf:case Er:return{byteLength:2,components:1};case vc:case xc:return{byteLength:2,components:4};case Wi:case gc:case Wn:return{byteLength:4,components:1};case qf:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}function Ky(n,t,e,i,s,r,o){const a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Mt,u=new WeakMap;let h;const d=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(E,y){return p?new OffscreenCanvas(E,y):Ro("canvas")}function x(E,y,N){let X=1;const nt=j(E);if((nt.width>N||nt.height>N)&&(X=N/Math.max(nt.width,nt.height)),X<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){const K=Math.floor(X*nt.width),xt=Math.floor(X*nt.height);h===void 0&&(h=v(K,xt));const dt=y?v(K,xt):h;return dt.width=K,dt.height=xt,dt.getContext("2d").drawImage(E,0,0,K,xt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+nt.width+"x"+nt.height+") to ("+K+"x"+xt+")."),dt}else return"data"in E&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+nt.width+"x"+nt.height+")."),E;return E}function m(E){return E.generateMipmaps}function f(E){n.generateMipmap(E)}function R(E){return E.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:E.isWebGL3DRenderTarget?n.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function w(E,y,N,X,nt=!1){if(E!==null){if(n[E]!==void 0)return n[E];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let K=y;if(y===n.RED&&(N===n.FLOAT&&(K=n.R32F),N===n.HALF_FLOAT&&(K=n.R16F),N===n.UNSIGNED_BYTE&&(K=n.R8)),y===n.RED_INTEGER&&(N===n.UNSIGNED_BYTE&&(K=n.R8UI),N===n.UNSIGNED_SHORT&&(K=n.R16UI),N===n.UNSIGNED_INT&&(K=n.R32UI),N===n.BYTE&&(K=n.R8I),N===n.SHORT&&(K=n.R16I),N===n.INT&&(K=n.R32I)),y===n.RG&&(N===n.FLOAT&&(K=n.RG32F),N===n.HALF_FLOAT&&(K=n.RG16F),N===n.UNSIGNED_BYTE&&(K=n.RG8)),y===n.RG_INTEGER&&(N===n.UNSIGNED_BYTE&&(K=n.RG8UI),N===n.UNSIGNED_SHORT&&(K=n.RG16UI),N===n.UNSIGNED_INT&&(K=n.RG32UI),N===n.BYTE&&(K=n.RG8I),N===n.SHORT&&(K=n.RG16I),N===n.INT&&(K=n.RG32I)),y===n.RGB_INTEGER&&(N===n.UNSIGNED_BYTE&&(K=n.RGB8UI),N===n.UNSIGNED_SHORT&&(K=n.RGB16UI),N===n.UNSIGNED_INT&&(K=n.RGB32UI),N===n.BYTE&&(K=n.RGB8I),N===n.SHORT&&(K=n.RGB16I),N===n.INT&&(K=n.RGB32I)),y===n.RGBA_INTEGER&&(N===n.UNSIGNED_BYTE&&(K=n.RGBA8UI),N===n.UNSIGNED_SHORT&&(K=n.RGBA16UI),N===n.UNSIGNED_INT&&(K=n.RGBA32UI),N===n.BYTE&&(K=n.RGBA8I),N===n.SHORT&&(K=n.RGBA16I),N===n.INT&&(K=n.RGBA32I)),y===n.RGB&&N===n.UNSIGNED_INT_5_9_9_9_REV&&(K=n.RGB9_E5),y===n.RGBA){const xt=nt?Wo:Zt.getTransfer(X);N===n.FLOAT&&(K=n.RGBA32F),N===n.HALF_FLOAT&&(K=n.RGBA16F),N===n.UNSIGNED_BYTE&&(K=xt===se?n.SRGB8_ALPHA8:n.RGBA8),N===n.UNSIGNED_SHORT_4_4_4_4&&(K=n.RGBA4),N===n.UNSIGNED_SHORT_5_5_5_1&&(K=n.RGB5_A1)}return(K===n.R16F||K===n.R32F||K===n.RG16F||K===n.RG32F||K===n.RGBA16F||K===n.RGBA32F)&&t.get("EXT_color_buffer_float"),K}function M(E,y){let N;return E?y===null||y===Wi||y===Rs?N=n.DEPTH24_STENCIL8:y===Wn?N=n.DEPTH32F_STENCIL8:y===_r&&(N=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):y===null||y===Wi||y===Rs?N=n.DEPTH_COMPONENT24:y===Wn?N=n.DEPTH_COMPONENT32F:y===_r&&(N=n.DEPTH_COMPONENT16),N}function F(E,y){return m(E)===!0||E.isFramebufferTexture&&E.minFilter!==_n&&E.minFilter!==An?Math.log2(Math.max(y.width,y.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?y.mipmaps.length:1}function D(E){const y=E.target;y.removeEventListener("dispose",D),b(y),y.isVideoTexture&&u.delete(y)}function L(E){const y=E.target;y.removeEventListener("dispose",L),g(y)}function b(E){const y=i.get(E);if(y.__webglInit===void 0)return;const N=E.source,X=d.get(N);if(X){const nt=X[y.__cacheKey];nt.usedTimes--,nt.usedTimes===0&&_(E),Object.keys(X).length===0&&d.delete(N)}i.remove(E)}function _(E){const y=i.get(E);n.deleteTexture(y.__webglTexture);const N=E.source,X=d.get(N);delete X[y.__cacheKey],o.memory.textures--}function g(E){const y=i.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),i.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(y.__webglFramebuffer[X]))for(let nt=0;nt<y.__webglFramebuffer[X].length;nt++)n.deleteFramebuffer(y.__webglFramebuffer[X][nt]);else n.deleteFramebuffer(y.__webglFramebuffer[X]);y.__webglDepthbuffer&&n.deleteRenderbuffer(y.__webglDepthbuffer[X])}else{if(Array.isArray(y.__webglFramebuffer))for(let X=0;X<y.__webglFramebuffer.length;X++)n.deleteFramebuffer(y.__webglFramebuffer[X]);else n.deleteFramebuffer(y.__webglFramebuffer);if(y.__webglDepthbuffer&&n.deleteRenderbuffer(y.__webglDepthbuffer),y.__webglMultisampledFramebuffer&&n.deleteFramebuffer(y.__webglMultisampledFramebuffer),y.__webglColorRenderbuffer)for(let X=0;X<y.__webglColorRenderbuffer.length;X++)y.__webglColorRenderbuffer[X]&&n.deleteRenderbuffer(y.__webglColorRenderbuffer[X]);y.__webglDepthRenderbuffer&&n.deleteRenderbuffer(y.__webglDepthRenderbuffer)}const N=E.textures;for(let X=0,nt=N.length;X<nt;X++){const K=i.get(N[X]);K.__webglTexture&&(n.deleteTexture(K.__webglTexture),o.memory.textures--),i.remove(N[X])}i.remove(E)}let A=0;function O(){A=0}function k(){const E=A;return E>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+s.maxTextures),A+=1,E}function J(E){const y=[];return y.push(E.wrapS),y.push(E.wrapT),y.push(E.wrapR||0),y.push(E.magFilter),y.push(E.minFilter),y.push(E.anisotropy),y.push(E.internalFormat),y.push(E.format),y.push(E.type),y.push(E.generateMipmaps),y.push(E.premultiplyAlpha),y.push(E.flipY),y.push(E.unpackAlignment),y.push(E.colorSpace),y.join()}function st(E,y){const N=i.get(E);if(E.isVideoTexture&&B(E),E.isRenderTargetTexture===!1&&E.version>0&&N.__version!==E.version){const X=E.image;if(X===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(X.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{$(N,E,y);return}}e.bindTexture(n.TEXTURE_2D,N.__webglTexture,n.TEXTURE0+y)}function Q(E,y){const N=i.get(E);if(E.version>0&&N.__version!==E.version){$(N,E,y);return}e.bindTexture(n.TEXTURE_2D_ARRAY,N.__webglTexture,n.TEXTURE0+y)}function V(E,y){const N=i.get(E);if(E.version>0&&N.__version!==E.version){$(N,E,y);return}e.bindTexture(n.TEXTURE_3D,N.__webglTexture,n.TEXTURE0+y)}function G(E,y){const N=i.get(E);if(E.version>0&&N.__version!==E.version){lt(N,E,y);return}e.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+y)}const it={[pl]:n.REPEAT,[ki]:n.CLAMP_TO_EDGE,[ml]:n.MIRRORED_REPEAT},vt={[_n]:n.NEAREST,[O_]:n.NEAREST_MIPMAP_NEAREST,[Lr]:n.NEAREST_MIPMAP_LINEAR,[An]:n.LINEAR,[la]:n.LINEAR_MIPMAP_NEAREST,[Vi]:n.LINEAR_MIPMAP_LINEAR},W={[H_]:n.NEVER,[Y_]:n.ALWAYS,[k_]:n.LESS,[nd]:n.LEQUAL,[V_]:n.EQUAL,[X_]:n.GEQUAL,[G_]:n.GREATER,[W_]:n.NOTEQUAL};function rt(E,y){if(y.type===Wn&&t.has("OES_texture_float_linear")===!1&&(y.magFilter===An||y.magFilter===la||y.magFilter===Lr||y.magFilter===Vi||y.minFilter===An||y.minFilter===la||y.minFilter===Lr||y.minFilter===Vi)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(E,n.TEXTURE_WRAP_S,it[y.wrapS]),n.texParameteri(E,n.TEXTURE_WRAP_T,it[y.wrapT]),(E===n.TEXTURE_3D||E===n.TEXTURE_2D_ARRAY)&&n.texParameteri(E,n.TEXTURE_WRAP_R,it[y.wrapR]),n.texParameteri(E,n.TEXTURE_MAG_FILTER,vt[y.magFilter]),n.texParameteri(E,n.TEXTURE_MIN_FILTER,vt[y.minFilter]),y.compareFunction&&(n.texParameteri(E,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(E,n.TEXTURE_COMPARE_FUNC,W[y.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===_n||y.minFilter!==Lr&&y.minFilter!==Vi||y.type===Wn&&t.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||i.get(y).__currentAnisotropy){const N=t.get("EXT_texture_filter_anisotropic");n.texParameterf(E,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,s.getMaxAnisotropy())),i.get(y).__currentAnisotropy=y.anisotropy}}}function ct(E,y){let N=!1;E.__webglInit===void 0&&(E.__webglInit=!0,y.addEventListener("dispose",D));const X=y.source;let nt=d.get(X);nt===void 0&&(nt={},d.set(X,nt));const K=J(y);if(K!==E.__cacheKey){nt[K]===void 0&&(nt[K]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,N=!0),nt[K].usedTimes++;const xt=nt[E.__cacheKey];xt!==void 0&&(nt[E.__cacheKey].usedTimes--,xt.usedTimes===0&&_(y)),E.__cacheKey=K,E.__webglTexture=nt[K].texture}return N}function $(E,y,N){let X=n.TEXTURE_2D;(y.isDataArrayTexture||y.isCompressedArrayTexture)&&(X=n.TEXTURE_2D_ARRAY),y.isData3DTexture&&(X=n.TEXTURE_3D);const nt=ct(E,y),K=y.source;e.bindTexture(X,E.__webglTexture,n.TEXTURE0+N);const xt=i.get(K);if(K.version!==xt.__version||nt===!0){e.activeTexture(n.TEXTURE0+N);const dt=Zt.getPrimaries(Zt.workingColorSpace),St=y.colorSpace===pi?null:Zt.getPrimaries(y.colorSpace),Ft=y.colorSpace===pi||dt===St?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,y.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,y.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ft);let mt=x(y.image,!1,s.maxTextureSize);mt=tt(y,mt);const Et=r.convert(y.format,y.colorSpace),Dt=r.convert(y.type);let Bt=w(y.internalFormat,Et,Dt,y.colorSpace,y.isVideoTexture);rt(X,y);let Tt;const zt=y.mipmaps,Vt=y.isVideoTexture!==!0,ee=xt.__version===void 0||nt===!0,Y=K.dataReady,At=F(y,mt);if(y.isDepthTexture)Bt=M(y.format===Cs,y.type),ee&&(Vt?e.texStorage2D(n.TEXTURE_2D,1,Bt,mt.width,mt.height):e.texImage2D(n.TEXTURE_2D,0,Bt,mt.width,mt.height,0,Et,Dt,null));else if(y.isDataTexture)if(zt.length>0){Vt&&ee&&e.texStorage2D(n.TEXTURE_2D,At,Bt,zt[0].width,zt[0].height);for(let ht=0,_t=zt.length;ht<_t;ht++)Tt=zt[ht],Vt?Y&&e.texSubImage2D(n.TEXTURE_2D,ht,0,0,Tt.width,Tt.height,Et,Dt,Tt.data):e.texImage2D(n.TEXTURE_2D,ht,Bt,Tt.width,Tt.height,0,Et,Dt,Tt.data);y.generateMipmaps=!1}else Vt?(ee&&e.texStorage2D(n.TEXTURE_2D,At,Bt,mt.width,mt.height),Y&&e.texSubImage2D(n.TEXTURE_2D,0,0,0,mt.width,mt.height,Et,Dt,mt.data)):e.texImage2D(n.TEXTURE_2D,0,Bt,mt.width,mt.height,0,Et,Dt,mt.data);else if(y.isCompressedTexture)if(y.isCompressedArrayTexture){Vt&&ee&&e.texStorage3D(n.TEXTURE_2D_ARRAY,At,Bt,zt[0].width,zt[0].height,mt.depth);for(let ht=0,_t=zt.length;ht<_t;ht++)if(Tt=zt[ht],y.format!==dn)if(Et!==null)if(Vt){if(Y)if(y.layerUpdates.size>0){const Lt=ph(Tt.width,Tt.height,y.format,y.type);for(const Ct of y.layerUpdates){const Gt=Tt.data.subarray(Ct*Lt/Tt.data.BYTES_PER_ELEMENT,(Ct+1)*Lt/Tt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ht,0,0,Ct,Tt.width,Tt.height,1,Et,Gt)}y.clearLayerUpdates()}else e.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ht,0,0,0,Tt.width,Tt.height,mt.depth,Et,Tt.data)}else e.compressedTexImage3D(n.TEXTURE_2D_ARRAY,ht,Bt,Tt.width,Tt.height,mt.depth,0,Tt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Vt?Y&&e.texSubImage3D(n.TEXTURE_2D_ARRAY,ht,0,0,0,Tt.width,Tt.height,mt.depth,Et,Dt,Tt.data):e.texImage3D(n.TEXTURE_2D_ARRAY,ht,Bt,Tt.width,Tt.height,mt.depth,0,Et,Dt,Tt.data)}else{Vt&&ee&&e.texStorage2D(n.TEXTURE_2D,At,Bt,zt[0].width,zt[0].height);for(let ht=0,_t=zt.length;ht<_t;ht++)Tt=zt[ht],y.format!==dn?Et!==null?Vt?Y&&e.compressedTexSubImage2D(n.TEXTURE_2D,ht,0,0,Tt.width,Tt.height,Et,Tt.data):e.compressedTexImage2D(n.TEXTURE_2D,ht,Bt,Tt.width,Tt.height,0,Tt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Vt?Y&&e.texSubImage2D(n.TEXTURE_2D,ht,0,0,Tt.width,Tt.height,Et,Dt,Tt.data):e.texImage2D(n.TEXTURE_2D,ht,Bt,Tt.width,Tt.height,0,Et,Dt,Tt.data)}else if(y.isDataArrayTexture)if(Vt){if(ee&&e.texStorage3D(n.TEXTURE_2D_ARRAY,At,Bt,mt.width,mt.height,mt.depth),Y)if(y.layerUpdates.size>0){const ht=ph(mt.width,mt.height,y.format,y.type);for(const _t of y.layerUpdates){const Lt=mt.data.subarray(_t*ht/mt.data.BYTES_PER_ELEMENT,(_t+1)*ht/mt.data.BYTES_PER_ELEMENT);e.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,_t,mt.width,mt.height,1,Et,Dt,Lt)}y.clearLayerUpdates()}else e.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,mt.width,mt.height,mt.depth,Et,Dt,mt.data)}else e.texImage3D(n.TEXTURE_2D_ARRAY,0,Bt,mt.width,mt.height,mt.depth,0,Et,Dt,mt.data);else if(y.isData3DTexture)Vt?(ee&&e.texStorage3D(n.TEXTURE_3D,At,Bt,mt.width,mt.height,mt.depth),Y&&e.texSubImage3D(n.TEXTURE_3D,0,0,0,0,mt.width,mt.height,mt.depth,Et,Dt,mt.data)):e.texImage3D(n.TEXTURE_3D,0,Bt,mt.width,mt.height,mt.depth,0,Et,Dt,mt.data);else if(y.isFramebufferTexture){if(ee)if(Vt)e.texStorage2D(n.TEXTURE_2D,At,Bt,mt.width,mt.height);else{let ht=mt.width,_t=mt.height;for(let Lt=0;Lt<At;Lt++)e.texImage2D(n.TEXTURE_2D,Lt,Bt,ht,_t,0,Et,Dt,null),ht>>=1,_t>>=1}}else if(zt.length>0){if(Vt&&ee){const ht=j(zt[0]);e.texStorage2D(n.TEXTURE_2D,At,Bt,ht.width,ht.height)}for(let ht=0,_t=zt.length;ht<_t;ht++)Tt=zt[ht],Vt?Y&&e.texSubImage2D(n.TEXTURE_2D,ht,0,0,Et,Dt,Tt):e.texImage2D(n.TEXTURE_2D,ht,Bt,Et,Dt,Tt);y.generateMipmaps=!1}else if(Vt){if(ee){const ht=j(mt);e.texStorage2D(n.TEXTURE_2D,At,Bt,ht.width,ht.height)}Y&&e.texSubImage2D(n.TEXTURE_2D,0,0,0,Et,Dt,mt)}else e.texImage2D(n.TEXTURE_2D,0,Bt,Et,Dt,mt);m(y)&&f(X),xt.__version=K.version,y.onUpdate&&y.onUpdate(y)}E.__version=y.version}function lt(E,y,N){if(y.image.length!==6)return;const X=ct(E,y),nt=y.source;e.bindTexture(n.TEXTURE_CUBE_MAP,E.__webglTexture,n.TEXTURE0+N);const K=i.get(nt);if(nt.version!==K.__version||X===!0){e.activeTexture(n.TEXTURE0+N);const xt=Zt.getPrimaries(Zt.workingColorSpace),dt=y.colorSpace===pi?null:Zt.getPrimaries(y.colorSpace),St=y.colorSpace===pi||xt===dt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,y.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,y.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,St);const Ft=y.isCompressedTexture||y.image[0].isCompressedTexture,mt=y.image[0]&&y.image[0].isDataTexture,Et=[];for(let _t=0;_t<6;_t++)!Ft&&!mt?Et[_t]=x(y.image[_t],!0,s.maxCubemapSize):Et[_t]=mt?y.image[_t].image:y.image[_t],Et[_t]=tt(y,Et[_t]);const Dt=Et[0],Bt=r.convert(y.format,y.colorSpace),Tt=r.convert(y.type),zt=w(y.internalFormat,Bt,Tt,y.colorSpace),Vt=y.isVideoTexture!==!0,ee=K.__version===void 0||X===!0,Y=nt.dataReady;let At=F(y,Dt);rt(n.TEXTURE_CUBE_MAP,y);let ht;if(Ft){Vt&&ee&&e.texStorage2D(n.TEXTURE_CUBE_MAP,At,zt,Dt.width,Dt.height);for(let _t=0;_t<6;_t++){ht=Et[_t].mipmaps;for(let Lt=0;Lt<ht.length;Lt++){const Ct=ht[Lt];y.format!==dn?Bt!==null?Vt?Y&&e.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Lt,0,0,Ct.width,Ct.height,Bt,Ct.data):e.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Lt,zt,Ct.width,Ct.height,0,Ct.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Vt?Y&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Lt,0,0,Ct.width,Ct.height,Bt,Tt,Ct.data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Lt,zt,Ct.width,Ct.height,0,Bt,Tt,Ct.data)}}}else{if(ht=y.mipmaps,Vt&&ee){ht.length>0&&At++;const _t=j(Et[0]);e.texStorage2D(n.TEXTURE_CUBE_MAP,At,zt,_t.width,_t.height)}for(let _t=0;_t<6;_t++)if(mt){Vt?Y&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0,0,0,Et[_t].width,Et[_t].height,Bt,Tt,Et[_t].data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0,zt,Et[_t].width,Et[_t].height,0,Bt,Tt,Et[_t].data);for(let Lt=0;Lt<ht.length;Lt++){const Gt=ht[Lt].image[_t].image;Vt?Y&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Lt+1,0,0,Gt.width,Gt.height,Bt,Tt,Gt.data):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Lt+1,zt,Gt.width,Gt.height,0,Bt,Tt,Gt.data)}}else{Vt?Y&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0,0,0,Bt,Tt,Et[_t]):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0,zt,Bt,Tt,Et[_t]);for(let Lt=0;Lt<ht.length;Lt++){const Ct=ht[Lt];Vt?Y&&e.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Lt+1,0,0,Bt,Tt,Ct.image[_t]):e.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Lt+1,zt,Bt,Tt,Ct.image[_t])}}}m(y)&&f(n.TEXTURE_CUBE_MAP),K.__version=nt.version,y.onUpdate&&y.onUpdate(y)}E.__version=y.version}function pt(E,y,N,X,nt,K){const xt=r.convert(N.format,N.colorSpace),dt=r.convert(N.type),St=w(N.internalFormat,xt,dt,N.colorSpace),Ft=i.get(y),mt=i.get(N);if(mt.__renderTarget=y,!Ft.__hasExternalTextures){const Et=Math.max(1,y.width>>K),Dt=Math.max(1,y.height>>K);nt===n.TEXTURE_3D||nt===n.TEXTURE_2D_ARRAY?e.texImage3D(nt,K,St,Et,Dt,y.depth,0,xt,dt,null):e.texImage2D(nt,K,St,Et,Dt,0,xt,dt,null)}e.bindFramebuffer(n.FRAMEBUFFER,E),z(y)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,X,nt,mt.__webglTexture,0,U(y)):(nt===n.TEXTURE_2D||nt>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&nt<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,X,nt,mt.__webglTexture,K),e.bindFramebuffer(n.FRAMEBUFFER,null)}function ut(E,y,N){if(n.bindRenderbuffer(n.RENDERBUFFER,E),y.depthBuffer){const X=y.depthTexture,nt=X&&X.isDepthTexture?X.type:null,K=M(y.stencilBuffer,nt),xt=y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,dt=U(y);z(y)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,dt,K,y.width,y.height):N?n.renderbufferStorageMultisample(n.RENDERBUFFER,dt,K,y.width,y.height):n.renderbufferStorage(n.RENDERBUFFER,K,y.width,y.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,xt,n.RENDERBUFFER,E)}else{const X=y.textures;for(let nt=0;nt<X.length;nt++){const K=X[nt],xt=r.convert(K.format,K.colorSpace),dt=r.convert(K.type),St=w(K.internalFormat,xt,dt,K.colorSpace),Ft=U(y);N&&z(y)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ft,St,y.width,y.height):z(y)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ft,St,y.width,y.height):n.renderbufferStorage(n.RENDERBUFFER,St,y.width,y.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function et(E,y){if(y&&y.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(n.FRAMEBUFFER,E),!(y.depthTexture&&y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const X=i.get(y.depthTexture);X.__renderTarget=y,(!X.__webglTexture||y.depthTexture.image.width!==y.width||y.depthTexture.image.height!==y.height)&&(y.depthTexture.image.width=y.width,y.depthTexture.image.height=y.height,y.depthTexture.needsUpdate=!0),st(y.depthTexture,0);const nt=X.__webglTexture,K=U(y);if(y.depthTexture.format===Ss)z(y)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,nt,0,K):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,nt,0);else if(y.depthTexture.format===Cs)z(y)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,nt,0,K):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,nt,0);else throw new Error("Unknown depthTexture format")}function ft(E){const y=i.get(E),N=E.isWebGLCubeRenderTarget===!0;if(y.__boundDepthTexture!==E.depthTexture){const X=E.depthTexture;if(y.__depthDisposeCallback&&y.__depthDisposeCallback(),X){const nt=()=>{delete y.__boundDepthTexture,delete y.__depthDisposeCallback,X.removeEventListener("dispose",nt)};X.addEventListener("dispose",nt),y.__depthDisposeCallback=nt}y.__boundDepthTexture=X}if(E.depthTexture&&!y.__autoAllocateDepthBuffer){if(N)throw new Error("target.depthTexture not supported in Cube render targets");et(y.__webglFramebuffer,E)}else if(N){y.__webglDepthbuffer=[];for(let X=0;X<6;X++)if(e.bindFramebuffer(n.FRAMEBUFFER,y.__webglFramebuffer[X]),y.__webglDepthbuffer[X]===void 0)y.__webglDepthbuffer[X]=n.createRenderbuffer(),ut(y.__webglDepthbuffer[X],E,!1);else{const nt=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,K=y.__webglDepthbuffer[X];n.bindRenderbuffer(n.RENDERBUFFER,K),n.framebufferRenderbuffer(n.FRAMEBUFFER,nt,n.RENDERBUFFER,K)}}else if(e.bindFramebuffer(n.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer===void 0)y.__webglDepthbuffer=n.createRenderbuffer(),ut(y.__webglDepthbuffer,E,!1);else{const X=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,nt=y.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,nt),n.framebufferRenderbuffer(n.FRAMEBUFFER,X,n.RENDERBUFFER,nt)}e.bindFramebuffer(n.FRAMEBUFFER,null)}function gt(E,y,N){const X=i.get(E);y!==void 0&&pt(X.__webglFramebuffer,E,E.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),N!==void 0&&ft(E)}function yt(E){const y=E.texture,N=i.get(E),X=i.get(y);E.addEventListener("dispose",L);const nt=E.textures,K=E.isWebGLCubeRenderTarget===!0,xt=nt.length>1;if(xt||(X.__webglTexture===void 0&&(X.__webglTexture=n.createTexture()),X.__version=y.version,o.memory.textures++),K){N.__webglFramebuffer=[];for(let dt=0;dt<6;dt++)if(y.mipmaps&&y.mipmaps.length>0){N.__webglFramebuffer[dt]=[];for(let St=0;St<y.mipmaps.length;St++)N.__webglFramebuffer[dt][St]=n.createFramebuffer()}else N.__webglFramebuffer[dt]=n.createFramebuffer()}else{if(y.mipmaps&&y.mipmaps.length>0){N.__webglFramebuffer=[];for(let dt=0;dt<y.mipmaps.length;dt++)N.__webglFramebuffer[dt]=n.createFramebuffer()}else N.__webglFramebuffer=n.createFramebuffer();if(xt)for(let dt=0,St=nt.length;dt<St;dt++){const Ft=i.get(nt[dt]);Ft.__webglTexture===void 0&&(Ft.__webglTexture=n.createTexture(),o.memory.textures++)}if(E.samples>0&&z(E)===!1){N.__webglMultisampledFramebuffer=n.createFramebuffer(),N.__webglColorRenderbuffer=[],e.bindFramebuffer(n.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let dt=0;dt<nt.length;dt++){const St=nt[dt];N.__webglColorRenderbuffer[dt]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,N.__webglColorRenderbuffer[dt]);const Ft=r.convert(St.format,St.colorSpace),mt=r.convert(St.type),Et=w(St.internalFormat,Ft,mt,St.colorSpace,E.isXRRenderTarget===!0),Dt=U(E);n.renderbufferStorageMultisample(n.RENDERBUFFER,Dt,Et,E.width,E.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+dt,n.RENDERBUFFER,N.__webglColorRenderbuffer[dt])}n.bindRenderbuffer(n.RENDERBUFFER,null),E.depthBuffer&&(N.__webglDepthRenderbuffer=n.createRenderbuffer(),ut(N.__webglDepthRenderbuffer,E,!0)),e.bindFramebuffer(n.FRAMEBUFFER,null)}}if(K){e.bindTexture(n.TEXTURE_CUBE_MAP,X.__webglTexture),rt(n.TEXTURE_CUBE_MAP,y);for(let dt=0;dt<6;dt++)if(y.mipmaps&&y.mipmaps.length>0)for(let St=0;St<y.mipmaps.length;St++)pt(N.__webglFramebuffer[dt][St],E,y,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+dt,St);else pt(N.__webglFramebuffer[dt],E,y,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+dt,0);m(y)&&f(n.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(xt){for(let dt=0,St=nt.length;dt<St;dt++){const Ft=nt[dt],mt=i.get(Ft);e.bindTexture(n.TEXTURE_2D,mt.__webglTexture),rt(n.TEXTURE_2D,Ft),pt(N.__webglFramebuffer,E,Ft,n.COLOR_ATTACHMENT0+dt,n.TEXTURE_2D,0),m(Ft)&&f(n.TEXTURE_2D)}e.unbindTexture()}else{let dt=n.TEXTURE_2D;if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(dt=E.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),e.bindTexture(dt,X.__webglTexture),rt(dt,y),y.mipmaps&&y.mipmaps.length>0)for(let St=0;St<y.mipmaps.length;St++)pt(N.__webglFramebuffer[St],E,y,n.COLOR_ATTACHMENT0,dt,St);else pt(N.__webglFramebuffer,E,y,n.COLOR_ATTACHMENT0,dt,0);m(y)&&f(dt),e.unbindTexture()}E.depthBuffer&&ft(E)}function T(E){const y=E.textures;for(let N=0,X=y.length;N<X;N++){const nt=y[N];if(m(nt)){const K=R(E),xt=i.get(nt).__webglTexture;e.bindTexture(K,xt),f(K),e.unbindTexture()}}}const C=[],S=[];function H(E){if(E.samples>0){if(z(E)===!1){const y=E.textures,N=E.width,X=E.height;let nt=n.COLOR_BUFFER_BIT;const K=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,xt=i.get(E),dt=y.length>1;if(dt)for(let St=0;St<y.length;St++)e.bindFramebuffer(n.FRAMEBUFFER,xt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+St,n.RENDERBUFFER,null),e.bindFramebuffer(n.FRAMEBUFFER,xt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+St,n.TEXTURE_2D,null,0);e.bindFramebuffer(n.READ_FRAMEBUFFER,xt.__webglMultisampledFramebuffer),e.bindFramebuffer(n.DRAW_FRAMEBUFFER,xt.__webglFramebuffer);for(let St=0;St<y.length;St++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(nt|=n.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(nt|=n.STENCIL_BUFFER_BIT)),dt){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,xt.__webglColorRenderbuffer[St]);const Ft=i.get(y[St]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Ft,0)}n.blitFramebuffer(0,0,N,X,0,0,N,X,nt,n.NEAREST),l===!0&&(C.length=0,S.length=0,C.push(n.COLOR_ATTACHMENT0+St),E.depthBuffer&&E.resolveDepthBuffer===!1&&(C.push(K),S.push(K),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,S)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,C))}if(e.bindFramebuffer(n.READ_FRAMEBUFFER,null),e.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),dt)for(let St=0;St<y.length;St++){e.bindFramebuffer(n.FRAMEBUFFER,xt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+St,n.RENDERBUFFER,xt.__webglColorRenderbuffer[St]);const Ft=i.get(y[St]).__webglTexture;e.bindFramebuffer(n.FRAMEBUFFER,xt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+St,n.TEXTURE_2D,Ft,0)}e.bindFramebuffer(n.DRAW_FRAMEBUFFER,xt.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&l){const y=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[y])}}}function U(E){return Math.min(s.maxSamples,E.samples)}function z(E){const y=i.get(E);return E.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function B(E){const y=o.render.frame;u.get(E)!==y&&(u.set(E,y),E.update())}function tt(E,y){const N=E.colorSpace,X=E.format,nt=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||N!==Ls&&N!==pi&&(Zt.getTransfer(N)===se?(X!==dn||nt!==$n)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",N)),y}function j(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(c.width=E.naturalWidth||E.width,c.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(c.width=E.displayWidth,c.height=E.displayHeight):(c.width=E.width,c.height=E.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=st,this.setTexture2DArray=Q,this.setTexture3D=V,this.setTextureCube=G,this.rebindTextures=gt,this.setupRenderTarget=yt,this.updateRenderTargetMipmap=T,this.updateMultisampleRenderTarget=H,this.setupDepthRenderbuffer=ft,this.setupFrameBufferTexture=pt,this.useMultisampledRTT=z}function $y(n,t){function e(i,s=pi){let r;const o=Zt.getTransfer(s);if(i===$n)return n.UNSIGNED_BYTE;if(i===vc)return n.UNSIGNED_SHORT_4_4_4_4;if(i===xc)return n.UNSIGNED_SHORT_5_5_5_1;if(i===qf)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===Xf)return n.BYTE;if(i===Yf)return n.SHORT;if(i===_r)return n.UNSIGNED_SHORT;if(i===gc)return n.INT;if(i===Wi)return n.UNSIGNED_INT;if(i===Wn)return n.FLOAT;if(i===Er)return n.HALF_FLOAT;if(i===jf)return n.ALPHA;if(i===Zf)return n.RGB;if(i===dn)return n.RGBA;if(i===Kf)return n.LUMINANCE;if(i===$f)return n.LUMINANCE_ALPHA;if(i===Ss)return n.DEPTH_COMPONENT;if(i===Cs)return n.DEPTH_STENCIL;if(i===Jf)return n.RED;if(i===yc)return n.RED_INTEGER;if(i===Qf)return n.RG;if(i===Mc)return n.RG_INTEGER;if(i===Sc)return n.RGBA_INTEGER;if(i===ho||i===fo||i===po||i===mo)if(o===se)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===ho)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===fo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===po)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===mo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===ho)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===fo)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===po)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===mo)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===_l||i===gl||i===vl||i===xl)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===_l)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===gl)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===vl)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===xl)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===yl||i===Ml||i===Sl)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(i===yl||i===Ml)return o===se?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===Sl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===El||i===bl||i===Tl||i===wl||i===Al||i===Rl||i===Cl||i===Pl||i===Ll||i===Dl||i===Il||i===Ul||i===Nl||i===Ol)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(i===El)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===bl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Tl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===wl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Al)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Rl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Cl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Pl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ll)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Dl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Il)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Ul)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Nl)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Ol)return o===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===_o||i===Fl||i===Bl)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(i===_o)return o===se?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Fl)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Bl)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===td||i===zl||i===Hl||i===kl)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(i===_o)return r.COMPRESSED_RED_RGTC1_EXT;if(i===zl)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Hl)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===kl)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Rs?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:e}}class Jy extends sn{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class Jr extends Se{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Qy={type:"move"};class Oa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Jr,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 Jr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Jr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){o=!0;for(const x of t.hand.values()){const m=e.getJointPose(x,i),f=this._getHandJoint(c,x);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,v=.005;c.inputState.pinching&&d>p+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&d<=p-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=e.getPose(t.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Qy)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const i=new Jr;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}const tM=`
|
||
void main() {
|
||
|
||
gl_Position = vec4( position, 1.0 );
|
||
|
||
}`,eM=`
|
||
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 nM{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,i){if(this.texture===null){const s=new je,r=t.properties.get(s);r.__webglTexture=e.texture,(e.depthNear!=i.depthNear||e.depthFar!=i.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,i=new Si({vertexShader:tM,fragmentShader:eM,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Rt(new Us(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class iM extends ji{constructor(t,e){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,d=null,p=null,v=null;const x=new nM,m=e.getContextAttributes();let f=null,R=null;const w=[],M=[],F=new Mt;let D=null;const L=new sn;L.viewport=new xe;const b=new sn;b.viewport=new xe;const _=[L,b],g=new Jy;let A=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function($){let lt=w[$];return lt===void 0&&(lt=new Oa,w[$]=lt),lt.getTargetRaySpace()},this.getControllerGrip=function($){let lt=w[$];return lt===void 0&&(lt=new Oa,w[$]=lt),lt.getGripSpace()},this.getHand=function($){let lt=w[$];return lt===void 0&&(lt=new Oa,w[$]=lt),lt.getHandSpace()};function k($){const lt=M.indexOf($.inputSource);if(lt===-1)return;const pt=w[lt];pt!==void 0&&(pt.update($.inputSource,$.frame,c||o),pt.dispatchEvent({type:$.type,data:$.inputSource}))}function J(){s.removeEventListener("select",k),s.removeEventListener("selectstart",k),s.removeEventListener("selectend",k),s.removeEventListener("squeeze",k),s.removeEventListener("squeezestart",k),s.removeEventListener("squeezeend",k),s.removeEventListener("end",J),s.removeEventListener("inputsourceschange",st);for(let $=0;$<w.length;$++){const lt=M[$];lt!==null&&(M[$]=null,w[$].disconnect(lt))}A=null,O=null,x.reset(),t.setRenderTarget(f),p=null,d=null,h=null,s=null,R=null,ct.stop(),i.isPresenting=!1,t.setPixelRatio(D),t.setSize(F.width,F.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function($){r=$,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function($){a=$,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function($){c=$},this.getBaseLayer=function(){return d!==null?d:p},this.getBinding=function(){return h},this.getFrame=function(){return v},this.getSession=function(){return s},this.setSession=async function($){if(s=$,s!==null){if(f=t.getRenderTarget(),s.addEventListener("select",k),s.addEventListener("selectstart",k),s.addEventListener("selectend",k),s.addEventListener("squeeze",k),s.addEventListener("squeezestart",k),s.addEventListener("squeezeend",k),s.addEventListener("end",J),s.addEventListener("inputsourceschange",st),m.xrCompatible!==!0&&await e.makeXRCompatible(),D=t.getPixelRatio(),t.getSize(F),s.renderState.layers===void 0){const lt={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};p=new XRWebGLLayer(s,e,lt),s.updateRenderState({baseLayer:p}),t.setPixelRatio(1),t.setSize(p.framebufferWidth,p.framebufferHeight,!1),R=new Xi(p.framebufferWidth,p.framebufferHeight,{format:dn,type:$n,colorSpace:t.outputColorSpace,stencilBuffer:m.stencil})}else{let lt=null,pt=null,ut=null;m.depth&&(ut=m.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,lt=m.stencil?Cs:Ss,pt=m.stencil?Rs:Wi);const et={colorFormat:e.RGBA8,depthFormat:ut,scaleFactor:r};h=new XRWebGLBinding(s,e),d=h.createProjectionLayer(et),s.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),R=new Xi(d.textureWidth,d.textureHeight,{format:dn,type:$n,depthTexture:new pd(d.textureWidth,d.textureHeight,pt,void 0,void 0,void 0,void 0,void 0,void 0,lt),stencilBuffer:m.stencil,colorSpace:t.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}R.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await s.requestReferenceSpace(a),ct.setContext(s),ct.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function st($){for(let lt=0;lt<$.removed.length;lt++){const pt=$.removed[lt],ut=M.indexOf(pt);ut>=0&&(M[ut]=null,w[ut].disconnect(pt))}for(let lt=0;lt<$.added.length;lt++){const pt=$.added[lt];let ut=M.indexOf(pt);if(ut===-1){for(let ft=0;ft<w.length;ft++)if(ft>=M.length){M.push(pt),ut=ft;break}else if(M[ft]===null){M[ft]=pt,ut=ft;break}if(ut===-1)break}const et=w[ut];et&&et.connect(pt)}}const Q=new I,V=new I;function G($,lt,pt){Q.setFromMatrixPosition(lt.matrixWorld),V.setFromMatrixPosition(pt.matrixWorld);const ut=Q.distanceTo(V),et=lt.projectionMatrix.elements,ft=pt.projectionMatrix.elements,gt=et[14]/(et[10]-1),yt=et[14]/(et[10]+1),T=(et[9]+1)/et[5],C=(et[9]-1)/et[5],S=(et[8]-1)/et[0],H=(ft[8]+1)/ft[0],U=gt*S,z=gt*H,B=ut/(-S+H),tt=B*-S;if(lt.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(tt),$.translateZ(B),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),et[10]===-1)$.projectionMatrix.copy(lt.projectionMatrix),$.projectionMatrixInverse.copy(lt.projectionMatrixInverse);else{const j=gt+B,E=yt+B,y=U-tt,N=z+(ut-tt),X=T*yt/E*j,nt=C*yt/E*j;$.projectionMatrix.makePerspective(y,N,X,nt,j,E),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function it($,lt){lt===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(lt.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(s===null)return;let lt=$.near,pt=$.far;x.texture!==null&&(x.depthNear>0&&(lt=x.depthNear),x.depthFar>0&&(pt=x.depthFar)),g.near=b.near=L.near=lt,g.far=b.far=L.far=pt,(A!==g.near||O!==g.far)&&(s.updateRenderState({depthNear:g.near,depthFar:g.far}),A=g.near,O=g.far),L.layers.mask=$.layers.mask|2,b.layers.mask=$.layers.mask|4,g.layers.mask=L.layers.mask|b.layers.mask;const ut=$.parent,et=g.cameras;it(g,ut);for(let ft=0;ft<et.length;ft++)it(et[ft],ut);et.length===2?G(g,L,b):g.projectionMatrix.copy(L.projectionMatrix),vt($,g,ut)};function vt($,lt,pt){pt===null?$.matrix.copy(lt.matrixWorld):($.matrix.copy(pt.matrixWorld),$.matrix.invert(),$.matrix.multiply(lt.matrixWorld)),$.matrix.decompose($.position,$.quaternion,$.scale),$.updateMatrixWorld(!0),$.projectionMatrix.copy(lt.projectionMatrix),$.projectionMatrixInverse.copy(lt.projectionMatrixInverse),$.isPerspectiveCamera&&($.fov=Vl*2*Math.atan(1/$.projectionMatrix.elements[5]),$.zoom=1)}this.getCamera=function(){return g},this.getFoveation=function(){if(!(d===null&&p===null))return l},this.setFoveation=function($){l=$,d!==null&&(d.fixedFoveation=$),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=$)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(g)};let W=null;function rt($,lt){if(u=lt.getViewerPose(c||o),v=lt,u!==null){const pt=u.views;p!==null&&(t.setRenderTargetFramebuffer(R,p.framebuffer),t.setRenderTarget(R));let ut=!1;pt.length!==g.cameras.length&&(g.cameras.length=0,ut=!0);for(let ft=0;ft<pt.length;ft++){const gt=pt[ft];let yt=null;if(p!==null)yt=p.getViewport(gt);else{const C=h.getViewSubImage(d,gt);yt=C.viewport,ft===0&&(t.setRenderTargetTextures(R,C.colorTexture,d.ignoreDepthValues?void 0:C.depthStencilTexture),t.setRenderTarget(R))}let T=_[ft];T===void 0&&(T=new sn,T.layers.enable(ft),T.viewport=new xe,_[ft]=T),T.matrix.fromArray(gt.transform.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale),T.projectionMatrix.fromArray(gt.projectionMatrix),T.projectionMatrixInverse.copy(T.projectionMatrix).invert(),T.viewport.set(yt.x,yt.y,yt.width,yt.height),ft===0&&(g.matrix.copy(T.matrix),g.matrix.decompose(g.position,g.quaternion,g.scale)),ut===!0&&g.cameras.push(T)}const et=s.enabledFeatures;if(et&&et.includes("depth-sensing")){const ft=h.getDepthInformation(pt[0]);ft&&ft.isValid&&ft.texture&&x.init(t,ft,s.renderState)}}for(let pt=0;pt<w.length;pt++){const ut=M[pt],et=w[pt];ut!==null&&et!==void 0&&et.update(ut,lt,c||o)}W&&W($,lt),lt.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:lt}),v=null}const ct=new fd;ct.setAnimationLoop(rt),this.setAnimationLoop=function($){W=$},this.dispose=function(){}}}const Di=new gn,sM=new ae;function rM(n,t){function e(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function i(m,f){f.color.getRGB(m.fogColor.value,cd(n)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function s(m,f,R,w,M){f.isMeshBasicMaterial||f.isMeshLambertMaterial?r(m,f):f.isMeshToonMaterial?(r(m,f),h(m,f)):f.isMeshPhongMaterial?(r(m,f),u(m,f)):f.isMeshStandardMaterial?(r(m,f),d(m,f),f.isMeshPhysicalMaterial&&p(m,f,M)):f.isMeshMatcapMaterial?(r(m,f),v(m,f)):f.isMeshDepthMaterial?r(m,f):f.isMeshDistanceMaterial?(r(m,f),x(m,f)):f.isMeshNormalMaterial?r(m,f):f.isLineBasicMaterial?(o(m,f),f.isLineDashedMaterial&&a(m,f)):f.isPointsMaterial?l(m,f,R,w):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function r(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,e(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,e(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===qe&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,e(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===qe&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,e(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,e(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,e(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const R=t.get(f),w=R.envMap,M=R.envMapRotation;w&&(m.envMap.value=w,Di.copy(M),Di.x*=-1,Di.y*=-1,Di.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Di.y*=-1,Di.z*=-1),m.envMapRotation.value.setFromMatrix4(sM.makeRotationFromEuler(Di)),m.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,e(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,e(f.aoMap,m.aoMapTransform))}function o(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform))}function a(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,R,w){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*R,m.scale.value=w*.5,f.map&&(m.map.value=f.map,e(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function u(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function h(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function d(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,e(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,e(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,R){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,e(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,e(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,e(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,e(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,e(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===qe&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,e(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,e(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=R.texture,m.transmissionSamplerSize.value.set(R.width,R.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,e(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,e(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,e(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,e(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,e(f.specularIntensityMap,m.specularIntensityMapTransform))}function v(m,f){f.matcap&&(m.matcap.value=f.matcap)}function x(m,f){const R=t.get(f).light;m.referencePosition.value.setFromMatrixPosition(R.matrixWorld),m.nearDistance.value=R.shadow.camera.near,m.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function oM(n,t,e,i){let s={},r={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(R,w){const M=w.program;i.uniformBlockBinding(R,M)}function c(R,w){let M=s[R.id];M===void 0&&(v(R),M=u(R),s[R.id]=M,R.addEventListener("dispose",m));const F=w.program;i.updateUBOMapping(R,F);const D=t.render.frame;r[R.id]!==D&&(d(R),r[R.id]=D)}function u(R){const w=h();R.__bindingPointIndex=w;const M=n.createBuffer(),F=R.__size,D=R.usage;return n.bindBuffer(n.UNIFORM_BUFFER,M),n.bufferData(n.UNIFORM_BUFFER,F,D),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,M),M}function h(){for(let R=0;R<a;R++)if(o.indexOf(R)===-1)return o.push(R),R;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(R){const w=s[R.id],M=R.uniforms,F=R.__cache;n.bindBuffer(n.UNIFORM_BUFFER,w);for(let D=0,L=M.length;D<L;D++){const b=Array.isArray(M[D])?M[D]:[M[D]];for(let _=0,g=b.length;_<g;_++){const A=b[_];if(p(A,D,_,F)===!0){const O=A.__offset,k=Array.isArray(A.value)?A.value:[A.value];let J=0;for(let st=0;st<k.length;st++){const Q=k[st],V=x(Q);typeof Q=="number"||typeof Q=="boolean"?(A.__data[0]=Q,n.bufferSubData(n.UNIFORM_BUFFER,O+J,A.__data)):Q.isMatrix3?(A.__data[0]=Q.elements[0],A.__data[1]=Q.elements[1],A.__data[2]=Q.elements[2],A.__data[3]=0,A.__data[4]=Q.elements[3],A.__data[5]=Q.elements[4],A.__data[6]=Q.elements[5],A.__data[7]=0,A.__data[8]=Q.elements[6],A.__data[9]=Q.elements[7],A.__data[10]=Q.elements[8],A.__data[11]=0):(Q.toArray(A.__data,J),J+=V.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,O,A.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(R,w,M,F){const D=R.value,L=w+"_"+M;if(F[L]===void 0)return typeof D=="number"||typeof D=="boolean"?F[L]=D:F[L]=D.clone(),!0;{const b=F[L];if(typeof D=="number"||typeof D=="boolean"){if(b!==D)return F[L]=D,!0}else if(b.equals(D)===!1)return b.copy(D),!0}return!1}function v(R){const w=R.uniforms;let M=0;const F=16;for(let L=0,b=w.length;L<b;L++){const _=Array.isArray(w[L])?w[L]:[w[L]];for(let g=0,A=_.length;g<A;g++){const O=_[g],k=Array.isArray(O.value)?O.value:[O.value];for(let J=0,st=k.length;J<st;J++){const Q=k[J],V=x(Q),G=M%F,it=G%V.boundary,vt=G+it;M+=it,vt!==0&&F-vt<V.storage&&(M+=F-vt),O.__data=new Float32Array(V.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=M,M+=V.storage}}}const D=M%F;return D>0&&(M+=F-D),R.__size=M,R.__cache={},this}function x(R){const w={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(w.boundary=4,w.storage=4):R.isVector2?(w.boundary=8,w.storage=8):R.isVector3||R.isColor?(w.boundary=16,w.storage=12):R.isVector4?(w.boundary=16,w.storage=16):R.isMatrix3?(w.boundary=48,w.storage=48):R.isMatrix4?(w.boundary=64,w.storage=64):R.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",R),w}function m(R){const w=R.target;w.removeEventListener("dispose",m);const M=o.indexOf(w.__bindingPointIndex);o.splice(M,1),n.deleteBuffer(s[w.id]),delete s[w.id],delete r[w.id]}function f(){for(const R in s)n.deleteBuffer(s[R]);o=[],s={},r={}}return{bind:l,update:c,dispose:f}}class aM{constructor(t={}){const{canvas:e=Z_(),context:i=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:d=!1}=t;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=o;const v=new Uint32Array(4),x=new Int32Array(4);let m=null,f=null;const R=[],w=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Qe,this.toneMapping=gi,this.toneMappingExposure=1;const M=this;let F=!1,D=0,L=0,b=null,_=-1,g=null;const A=new xe,O=new xe;let k=null;const J=new kt(0);let st=0,Q=e.width,V=e.height,G=1,it=null,vt=null;const W=new xe(0,0,Q,V),rt=new xe(0,0,Q,V);let ct=!1;const $=new bc;let lt=!1,pt=!1;const ut=new ae,et=new ae,ft=new I,gt=new xe,yt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let T=!1;function C(){return b===null?G:1}let S=i;function H(P,q){return e.getContext(P,q)}try{const P={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${mc}`),e.addEventListener("webglcontextlost",_t,!1),e.addEventListener("webglcontextrestored",Lt,!1),e.addEventListener("webglcontextcreationerror",Ct,!1),S===null){const q="webgl2";if(S=H(q,P),S===null)throw H(q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let U,z,B,tt,j,E,y,N,X,nt,K,xt,dt,St,Ft,mt,Et,Dt,Bt,Tt,zt,Vt,ee,Y;function At(){U=new fx(S),U.init(),Vt=new $y(S,U),z=new ox(S,U,t,Vt),B=new jy(S,U),z.reverseDepthBuffer&&d&&B.buffers.depth.setReversed(!0),tt=new mx(S),j=new Iy,E=new Ky(S,U,B,j,z,Vt,tt),y=new lx(M),N=new hx(M),X=new Sg(S),ee=new sx(S,X),nt=new dx(S,X,tt,ee),K=new gx(S,nt,X,tt),Bt=new _x(S,z,E),mt=new ax(j),xt=new Dy(M,y,N,U,z,ee,mt),dt=new rM(M,j),St=new Ny,Ft=new ky(U),Dt=new ix(M,y,N,B,K,p,l),Et=new Yy(M,K,z),Y=new oM(S,tt,z,B),Tt=new rx(S,U,tt),zt=new px(S,U,tt),tt.programs=xt.programs,M.capabilities=z,M.extensions=U,M.properties=j,M.renderLists=St,M.shadowMap=Et,M.state=B,M.info=tt}At();const ht=new iM(M,S);this.xr=ht,this.getContext=function(){return S},this.getContextAttributes=function(){return S.getContextAttributes()},this.forceContextLoss=function(){const P=U.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){const P=U.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(P){P!==void 0&&(G=P,this.setSize(Q,V,!1))},this.getSize=function(P){return P.set(Q,V)},this.setSize=function(P,q,ot=!0){if(ht.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Q=P,V=q,e.width=Math.floor(P*G),e.height=Math.floor(q*G),ot===!0&&(e.style.width=P+"px",e.style.height=q+"px"),this.setViewport(0,0,P,q)},this.getDrawingBufferSize=function(P){return P.set(Q*G,V*G).floor()},this.setDrawingBufferSize=function(P,q,ot){Q=P,V=q,G=ot,e.width=Math.floor(P*ot),e.height=Math.floor(q*ot),this.setViewport(0,0,P,q)},this.getCurrentViewport=function(P){return P.copy(A)},this.getViewport=function(P){return P.copy(W)},this.setViewport=function(P,q,ot,at){P.isVector4?W.set(P.x,P.y,P.z,P.w):W.set(P,q,ot,at),B.viewport(A.copy(W).multiplyScalar(G).round())},this.getScissor=function(P){return P.copy(rt)},this.setScissor=function(P,q,ot,at){P.isVector4?rt.set(P.x,P.y,P.z,P.w):rt.set(P,q,ot,at),B.scissor(O.copy(rt).multiplyScalar(G).round())},this.getScissorTest=function(){return ct},this.setScissorTest=function(P){B.setScissorTest(ct=P)},this.setOpaqueSort=function(P){it=P},this.setTransparentSort=function(P){vt=P},this.getClearColor=function(P){return P.copy(Dt.getClearColor())},this.setClearColor=function(){Dt.setClearColor.apply(Dt,arguments)},this.getClearAlpha=function(){return Dt.getClearAlpha()},this.setClearAlpha=function(){Dt.setClearAlpha.apply(Dt,arguments)},this.clear=function(P=!0,q=!0,ot=!0){let at=0;if(P){let Z=!1;if(b!==null){const bt=b.texture.format;Z=bt===Sc||bt===Mc||bt===yc}if(Z){const bt=b.texture.type,Pt=bt===$n||bt===Wi||bt===_r||bt===Rs||bt===vc||bt===xc,It=Dt.getClearColor(),Ut=Dt.getClearAlpha(),Ht=It.r,Wt=It.g,Nt=It.b;Pt?(v[0]=Ht,v[1]=Wt,v[2]=Nt,v[3]=Ut,S.clearBufferuiv(S.COLOR,0,v)):(x[0]=Ht,x[1]=Wt,x[2]=Nt,x[3]=Ut,S.clearBufferiv(S.COLOR,0,x))}else at|=S.COLOR_BUFFER_BIT}q&&(at|=S.DEPTH_BUFFER_BIT),ot&&(at|=S.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),S.clear(at)},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(){e.removeEventListener("webglcontextlost",_t,!1),e.removeEventListener("webglcontextrestored",Lt,!1),e.removeEventListener("webglcontextcreationerror",Ct,!1),St.dispose(),Ft.dispose(),j.dispose(),y.dispose(),N.dispose(),K.dispose(),ee.dispose(),Y.dispose(),xt.dispose(),ht.dispose(),ht.removeEventListener("sessionstart",Nc),ht.removeEventListener("sessionend",Oc),bi.stop()};function _t(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function Lt(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;const P=tt.autoReset,q=Et.enabled,ot=Et.autoUpdate,at=Et.needsUpdate,Z=Et.type;At(),tt.autoReset=P,Et.enabled=q,Et.autoUpdate=ot,Et.needsUpdate=at,Et.type=Z}function Ct(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function Gt(P){const q=P.target;q.removeEventListener("dispose",Gt),ve(q)}function ve(P){Pe(P),j.remove(P)}function Pe(P){const q=j.get(P).programs;q!==void 0&&(q.forEach(function(ot){xt.releaseProgram(ot)}),P.isShaderMaterial&&xt.releaseShaderCache(P))}this.renderBufferDirect=function(P,q,ot,at,Z,bt){q===null&&(q=yt);const Pt=Z.isMesh&&Z.matrixWorld.determinant()<0,It=Id(P,q,ot,at,Z);B.setMaterial(at,Pt);let Ut=ot.index,Ht=1;if(at.wireframe===!0){if(Ut=nt.getWireframeAttribute(ot),Ut===void 0)return;Ht=2}const Wt=ot.drawRange,Nt=ot.attributes.position;let Kt=Wt.start*Ht,ce=(Wt.start+Wt.count)*Ht;bt!==null&&(Kt=Math.max(Kt,bt.start*Ht),ce=Math.min(ce,(bt.start+bt.count)*Ht)),Ut!==null?(Kt=Math.max(Kt,0),ce=Math.min(ce,Ut.count)):Nt!=null&&(Kt=Math.max(Kt,0),ce=Math.min(ce,Nt.count));const fe=ce-Kt;if(fe<0||fe===1/0)return;ee.setup(Z,at,It,ot,Ut);let Ge,$t=Tt;if(Ut!==null&&(Ge=X.get(Ut),$t=zt,$t.setIndex(Ge)),Z.isMesh)at.wireframe===!0?(B.setLineWidth(at.wireframeLinewidth*C()),$t.setMode(S.LINES)):$t.setMode(S.TRIANGLES);else if(Z.isLine){let Ot=at.linewidth;Ot===void 0&&(Ot=1),B.setLineWidth(Ot*C()),Z.isLineSegments?$t.setMode(S.LINES):Z.isLineLoop?$t.setMode(S.LINE_LOOP):$t.setMode(S.LINE_STRIP)}else Z.isPoints?$t.setMode(S.POINTS):Z.isSprite&&$t.setMode(S.TRIANGLES);if(Z.isBatchedMesh)if(Z._multiDrawInstances!==null)$t.renderMultiDrawInstances(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount,Z._multiDrawInstances);else if(U.get("WEBGL_multi_draw"))$t.renderMultiDraw(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount);else{const Ot=Z._multiDrawStarts,In=Z._multiDrawCounts,Jt=Z._multiDrawCount,ln=Ut?X.get(Ut).bytesPerElement:1,Zi=j.get(at).currentProgram.getUniforms();for(let Ze=0;Ze<Jt;Ze++)Zi.setValue(S,"_gl_DrawID",Ze),$t.render(Ot[Ze]/ln,In[Ze])}else if(Z.isInstancedMesh)$t.renderInstances(Kt,fe,Z.count);else if(ot.isInstancedBufferGeometry){const Ot=ot._maxInstanceCount!==void 0?ot._maxInstanceCount:1/0,In=Math.min(ot.instanceCount,Ot);$t.renderInstances(Kt,fe,In)}else $t.render(Kt,fe)};function ne(P,q,ot){P.transparent===!0&&P.side===rn&&P.forceSinglePass===!1?(P.side=qe,P.needsUpdate=!0,Ar(P,q,ot),P.side=Mi,P.needsUpdate=!0,Ar(P,q,ot),P.side=rn):Ar(P,q,ot)}this.compile=function(P,q,ot=null){ot===null&&(ot=P),f=Ft.get(ot),f.init(q),w.push(f),ot.traverseVisible(function(Z){Z.isLight&&Z.layers.test(q.layers)&&(f.pushLight(Z),Z.castShadow&&f.pushShadow(Z))}),P!==ot&&P.traverseVisible(function(Z){Z.isLight&&Z.layers.test(q.layers)&&(f.pushLight(Z),Z.castShadow&&f.pushShadow(Z))}),f.setupLights();const at=new Set;return P.traverse(function(Z){if(!(Z.isMesh||Z.isPoints||Z.isLine||Z.isSprite))return;const bt=Z.material;if(bt)if(Array.isArray(bt))for(let Pt=0;Pt<bt.length;Pt++){const It=bt[Pt];ne(It,ot,Z),at.add(It)}else ne(bt,ot,Z),at.add(bt)}),w.pop(),f=null,at},this.compileAsync=function(P,q,ot=null){const at=this.compile(P,q,ot);return new Promise(Z=>{function bt(){if(at.forEach(function(Pt){j.get(Pt).currentProgram.isReady()&&at.delete(Pt)}),at.size===0){Z(P);return}setTimeout(bt,10)}U.get("KHR_parallel_shader_compile")!==null?bt():setTimeout(bt,10)})};let an=null;function Dn(P){an&&an(P)}function Nc(){bi.stop()}function Oc(){bi.start()}const bi=new fd;bi.setAnimationLoop(Dn),typeof self<"u"&&bi.setContext(self),this.setAnimationLoop=function(P){an=P,ht.setAnimationLoop(P),P===null?bi.stop():bi.start()},ht.addEventListener("sessionstart",Nc),ht.addEventListener("sessionend",Oc),this.render=function(P,q){if(q!==void 0&&q.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),q.parent===null&&q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),ht.enabled===!0&&ht.isPresenting===!0&&(ht.cameraAutoUpdate===!0&&ht.updateCamera(q),q=ht.getCamera()),P.isScene===!0&&P.onBeforeRender(M,P,q,b),f=Ft.get(P,w.length),f.init(q),w.push(f),et.multiplyMatrices(q.projectionMatrix,q.matrixWorldInverse),$.setFromProjectionMatrix(et),pt=this.localClippingEnabled,lt=mt.init(this.clippingPlanes,pt),m=St.get(P,R.length),m.init(),R.push(m),ht.enabled===!0&&ht.isPresenting===!0){const bt=M.xr.getDepthSensingMesh();bt!==null&&Zo(bt,q,-1/0,M.sortObjects)}Zo(P,q,0,M.sortObjects),m.finish(),M.sortObjects===!0&&m.sort(it,vt),T=ht.enabled===!1||ht.isPresenting===!1||ht.hasDepthSensing()===!1,T&&Dt.addToRenderList(m,P),this.info.render.frame++,lt===!0&&mt.beginShadows();const ot=f.state.shadowsArray;Et.render(ot,P,q),lt===!0&&mt.endShadows(),this.info.autoReset===!0&&this.info.reset();const at=m.opaque,Z=m.transmissive;if(f.setupLights(),q.isArrayCamera){const bt=q.cameras;if(Z.length>0)for(let Pt=0,It=bt.length;Pt<It;Pt++){const Ut=bt[Pt];Bc(at,Z,P,Ut)}T&&Dt.render(P);for(let Pt=0,It=bt.length;Pt<It;Pt++){const Ut=bt[Pt];Fc(m,P,Ut,Ut.viewport)}}else Z.length>0&&Bc(at,Z,P,q),T&&Dt.render(P),Fc(m,P,q);b!==null&&(E.updateMultisampleRenderTarget(b),E.updateRenderTargetMipmap(b)),P.isScene===!0&&P.onAfterRender(M,P,q),ee.resetDefaultState(),_=-1,g=null,w.pop(),w.length>0?(f=w[w.length-1],lt===!0&&mt.setGlobalState(M.clippingPlanes,f.state.camera)):f=null,R.pop(),R.length>0?m=R[R.length-1]:m=null};function Zo(P,q,ot,at){if(P.visible===!1)return;if(P.layers.test(q.layers)){if(P.isGroup)ot=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(q);else if(P.isLight)f.pushLight(P),P.castShadow&&f.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||$.intersectsSprite(P)){at&>.setFromMatrixPosition(P.matrixWorld).applyMatrix4(et);const Pt=K.update(P),It=P.material;It.visible&&m.push(P,Pt,It,ot,gt.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||$.intersectsObject(P))){const Pt=K.update(P),It=P.material;if(at&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),gt.copy(P.boundingSphere.center)):(Pt.boundingSphere===null&&Pt.computeBoundingSphere(),gt.copy(Pt.boundingSphere.center)),gt.applyMatrix4(P.matrixWorld).applyMatrix4(et)),Array.isArray(It)){const Ut=Pt.groups;for(let Ht=0,Wt=Ut.length;Ht<Wt;Ht++){const Nt=Ut[Ht],Kt=It[Nt.materialIndex];Kt&&Kt.visible&&m.push(P,Pt,Kt,ot,gt.z,Nt)}}else It.visible&&m.push(P,Pt,It,ot,gt.z,null)}}const bt=P.children;for(let Pt=0,It=bt.length;Pt<It;Pt++)Zo(bt[Pt],q,ot,at)}function Fc(P,q,ot,at){const Z=P.opaque,bt=P.transmissive,Pt=P.transparent;f.setupLightsView(ot),lt===!0&&mt.setGlobalState(M.clippingPlanes,ot),at&&B.viewport(A.copy(at)),Z.length>0&&wr(Z,q,ot),bt.length>0&&wr(bt,q,ot),Pt.length>0&&wr(Pt,q,ot),B.buffers.depth.setTest(!0),B.buffers.depth.setMask(!0),B.buffers.color.setMask(!0),B.setPolygonOffset(!1)}function Bc(P,q,ot,at){if((ot.isScene===!0?ot.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[at.id]===void 0&&(f.state.transmissionRenderTarget[at.id]=new Xi(1,1,{generateMipmaps:!0,type:U.has("EXT_color_buffer_half_float")||U.has("EXT_color_buffer_float")?Er:$n,minFilter:Vi,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Zt.workingColorSpace}));const bt=f.state.transmissionRenderTarget[at.id],Pt=at.viewport||A;bt.setSize(Pt.z,Pt.w);const It=M.getRenderTarget();M.setRenderTarget(bt),M.getClearColor(J),st=M.getClearAlpha(),st<1&&M.setClearColor(16777215,.5),M.clear(),T&&Dt.render(ot);const Ut=M.toneMapping;M.toneMapping=gi;const Ht=at.viewport;if(at.viewport!==void 0&&(at.viewport=void 0),f.setupLightsView(at),lt===!0&&mt.setGlobalState(M.clippingPlanes,at),wr(P,ot,at),E.updateMultisampleRenderTarget(bt),E.updateRenderTargetMipmap(bt),U.has("WEBGL_multisampled_render_to_texture")===!1){let Wt=!1;for(let Nt=0,Kt=q.length;Nt<Kt;Nt++){const ce=q[Nt],fe=ce.object,Ge=ce.geometry,$t=ce.material,Ot=ce.group;if($t.side===rn&&fe.layers.test(at.layers)){const In=$t.side;$t.side=qe,$t.needsUpdate=!0,zc(fe,ot,at,Ge,$t,Ot),$t.side=In,$t.needsUpdate=!0,Wt=!0}}Wt===!0&&(E.updateMultisampleRenderTarget(bt),E.updateRenderTargetMipmap(bt))}M.setRenderTarget(It),M.setClearColor(J,st),Ht!==void 0&&(at.viewport=Ht),M.toneMapping=Ut}function wr(P,q,ot){const at=q.isScene===!0?q.overrideMaterial:null;for(let Z=0,bt=P.length;Z<bt;Z++){const Pt=P[Z],It=Pt.object,Ut=Pt.geometry,Ht=at===null?Pt.material:at,Wt=Pt.group;It.layers.test(ot.layers)&&zc(It,q,ot,Ut,Ht,Wt)}}function zc(P,q,ot,at,Z,bt){P.onBeforeRender(M,q,ot,at,Z,bt),P.modelViewMatrix.multiplyMatrices(ot.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),Z.onBeforeRender(M,q,ot,at,P,bt),Z.transparent===!0&&Z.side===rn&&Z.forceSinglePass===!1?(Z.side=qe,Z.needsUpdate=!0,M.renderBufferDirect(ot,q,at,Z,P,bt),Z.side=Mi,Z.needsUpdate=!0,M.renderBufferDirect(ot,q,at,Z,P,bt),Z.side=rn):M.renderBufferDirect(ot,q,at,Z,P,bt),P.onAfterRender(M,q,ot,at,Z,bt)}function Ar(P,q,ot){q.isScene!==!0&&(q=yt);const at=j.get(P),Z=f.state.lights,bt=f.state.shadowsArray,Pt=Z.state.version,It=xt.getParameters(P,Z.state,bt,q,ot),Ut=xt.getProgramCacheKey(It);let Ht=at.programs;at.environment=P.isMeshStandardMaterial?q.environment:null,at.fog=q.fog,at.envMap=(P.isMeshStandardMaterial?N:y).get(P.envMap||at.environment),at.envMapRotation=at.environment!==null&&P.envMap===null?q.environmentRotation:P.envMapRotation,Ht===void 0&&(P.addEventListener("dispose",Gt),Ht=new Map,at.programs=Ht);let Wt=Ht.get(Ut);if(Wt!==void 0){if(at.currentProgram===Wt&&at.lightsStateVersion===Pt)return kc(P,It),Wt}else It.uniforms=xt.getUniforms(P),P.onBeforeCompile(It,M),Wt=xt.acquireProgram(It,Ut),Ht.set(Ut,Wt),at.uniforms=It.uniforms;const Nt=at.uniforms;return(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(Nt.clippingPlanes=mt.uniform),kc(P,It),at.needsLights=Nd(P),at.lightsStateVersion=Pt,at.needsLights&&(Nt.ambientLightColor.value=Z.state.ambient,Nt.lightProbe.value=Z.state.probe,Nt.directionalLights.value=Z.state.directional,Nt.directionalLightShadows.value=Z.state.directionalShadow,Nt.spotLights.value=Z.state.spot,Nt.spotLightShadows.value=Z.state.spotShadow,Nt.rectAreaLights.value=Z.state.rectArea,Nt.ltc_1.value=Z.state.rectAreaLTC1,Nt.ltc_2.value=Z.state.rectAreaLTC2,Nt.pointLights.value=Z.state.point,Nt.pointLightShadows.value=Z.state.pointShadow,Nt.hemisphereLights.value=Z.state.hemi,Nt.directionalShadowMap.value=Z.state.directionalShadowMap,Nt.directionalShadowMatrix.value=Z.state.directionalShadowMatrix,Nt.spotShadowMap.value=Z.state.spotShadowMap,Nt.spotLightMatrix.value=Z.state.spotLightMatrix,Nt.spotLightMap.value=Z.state.spotLightMap,Nt.pointShadowMap.value=Z.state.pointShadowMap,Nt.pointShadowMatrix.value=Z.state.pointShadowMatrix),at.currentProgram=Wt,at.uniformsList=null,Wt}function Hc(P){if(P.uniformsList===null){const q=P.currentProgram.getUniforms();P.uniformsList=vo.seqWithValue(q.seq,P.uniforms)}return P.uniformsList}function kc(P,q){const ot=j.get(P);ot.outputColorSpace=q.outputColorSpace,ot.batching=q.batching,ot.batchingColor=q.batchingColor,ot.instancing=q.instancing,ot.instancingColor=q.instancingColor,ot.instancingMorph=q.instancingMorph,ot.skinning=q.skinning,ot.morphTargets=q.morphTargets,ot.morphNormals=q.morphNormals,ot.morphColors=q.morphColors,ot.morphTargetsCount=q.morphTargetsCount,ot.numClippingPlanes=q.numClippingPlanes,ot.numIntersection=q.numClipIntersection,ot.vertexAlphas=q.vertexAlphas,ot.vertexTangents=q.vertexTangents,ot.toneMapping=q.toneMapping}function Id(P,q,ot,at,Z){q.isScene!==!0&&(q=yt),E.resetTextureUnits();const bt=q.fog,Pt=at.isMeshStandardMaterial?q.environment:null,It=b===null?M.outputColorSpace:b.isXRRenderTarget===!0?b.texture.colorSpace:Ls,Ut=(at.isMeshStandardMaterial?N:y).get(at.envMap||Pt),Ht=at.vertexColors===!0&&!!ot.attributes.color&&ot.attributes.color.itemSize===4,Wt=!!ot.attributes.tangent&&(!!at.normalMap||at.anisotropy>0),Nt=!!ot.morphAttributes.position,Kt=!!ot.morphAttributes.normal,ce=!!ot.morphAttributes.color;let fe=gi;at.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(fe=M.toneMapping);const Ge=ot.morphAttributes.position||ot.morphAttributes.normal||ot.morphAttributes.color,$t=Ge!==void 0?Ge.length:0,Ot=j.get(at),In=f.state.lights;if(lt===!0&&(pt===!0||P!==g)){const en=P===g&&at.id===_;mt.setState(at,P,en)}let Jt=!1;at.version===Ot.__version?(Ot.needsLights&&Ot.lightsStateVersion!==In.state.version||Ot.outputColorSpace!==It||Z.isBatchedMesh&&Ot.batching===!1||!Z.isBatchedMesh&&Ot.batching===!0||Z.isBatchedMesh&&Ot.batchingColor===!0&&Z.colorTexture===null||Z.isBatchedMesh&&Ot.batchingColor===!1&&Z.colorTexture!==null||Z.isInstancedMesh&&Ot.instancing===!1||!Z.isInstancedMesh&&Ot.instancing===!0||Z.isSkinnedMesh&&Ot.skinning===!1||!Z.isSkinnedMesh&&Ot.skinning===!0||Z.isInstancedMesh&&Ot.instancingColor===!0&&Z.instanceColor===null||Z.isInstancedMesh&&Ot.instancingColor===!1&&Z.instanceColor!==null||Z.isInstancedMesh&&Ot.instancingMorph===!0&&Z.morphTexture===null||Z.isInstancedMesh&&Ot.instancingMorph===!1&&Z.morphTexture!==null||Ot.envMap!==Ut||at.fog===!0&&Ot.fog!==bt||Ot.numClippingPlanes!==void 0&&(Ot.numClippingPlanes!==mt.numPlanes||Ot.numIntersection!==mt.numIntersection)||Ot.vertexAlphas!==Ht||Ot.vertexTangents!==Wt||Ot.morphTargets!==Nt||Ot.morphNormals!==Kt||Ot.morphColors!==ce||Ot.toneMapping!==fe||Ot.morphTargetsCount!==$t)&&(Jt=!0):(Jt=!0,Ot.__version=at.version);let ln=Ot.currentProgram;Jt===!0&&(ln=Ar(at,q,Z));let Zi=!1,Ze=!1,Os=!1;const de=ln.getUniforms(),vn=Ot.uniforms;if(B.useProgram(ln.program)&&(Zi=!0,Ze=!0,Os=!0),at.id!==_&&(_=at.id,Ze=!0),Zi||g!==P){B.buffers.depth.getReversed()?(ut.copy(P.projectionMatrix),$_(ut),J_(ut),de.setValue(S,"projectionMatrix",ut)):de.setValue(S,"projectionMatrix",P.projectionMatrix),de.setValue(S,"viewMatrix",P.matrixWorldInverse);const Qn=de.map.cameraPosition;Qn!==void 0&&Qn.setValue(S,ft.setFromMatrixPosition(P.matrixWorld)),z.logarithmicDepthBuffer&&de.setValue(S,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(at.isMeshPhongMaterial||at.isMeshToonMaterial||at.isMeshLambertMaterial||at.isMeshBasicMaterial||at.isMeshStandardMaterial||at.isShaderMaterial)&&de.setValue(S,"isOrthographic",P.isOrthographicCamera===!0),g!==P&&(g=P,Ze=!0,Os=!0)}if(Z.isSkinnedMesh){de.setOptional(S,Z,"bindMatrix"),de.setOptional(S,Z,"bindMatrixInverse");const en=Z.skeleton;en&&(en.boneTexture===null&&en.computeBoneTexture(),de.setValue(S,"boneTexture",en.boneTexture,E))}Z.isBatchedMesh&&(de.setOptional(S,Z,"batchingTexture"),de.setValue(S,"batchingTexture",Z._matricesTexture,E),de.setOptional(S,Z,"batchingIdTexture"),de.setValue(S,"batchingIdTexture",Z._indirectTexture,E),de.setOptional(S,Z,"batchingColorTexture"),Z._colorsTexture!==null&&de.setValue(S,"batchingColorTexture",Z._colorsTexture,E));const Fs=ot.morphAttributes;if((Fs.position!==void 0||Fs.normal!==void 0||Fs.color!==void 0)&&Bt.update(Z,ot,ln),(Ze||Ot.receiveShadow!==Z.receiveShadow)&&(Ot.receiveShadow=Z.receiveShadow,de.setValue(S,"receiveShadow",Z.receiveShadow)),at.isMeshGouraudMaterial&&at.envMap!==null&&(vn.envMap.value=Ut,vn.flipEnvMap.value=Ut.isCubeTexture&&Ut.isRenderTargetTexture===!1?-1:1),at.isMeshStandardMaterial&&at.envMap===null&&q.environment!==null&&(vn.envMapIntensity.value=q.environmentIntensity),Ze&&(de.setValue(S,"toneMappingExposure",M.toneMappingExposure),Ot.needsLights&&Ud(vn,Os),bt&&at.fog===!0&&dt.refreshFogUniforms(vn,bt),dt.refreshMaterialUniforms(vn,at,G,V,f.state.transmissionRenderTarget[P.id]),vo.upload(S,Hc(Ot),vn,E)),at.isShaderMaterial&&at.uniformsNeedUpdate===!0&&(vo.upload(S,Hc(Ot),vn,E),at.uniformsNeedUpdate=!1),at.isSpriteMaterial&&de.setValue(S,"center",Z.center),de.setValue(S,"modelViewMatrix",Z.modelViewMatrix),de.setValue(S,"normalMatrix",Z.normalMatrix),de.setValue(S,"modelMatrix",Z.matrixWorld),at.isShaderMaterial||at.isRawShaderMaterial){const en=at.uniformsGroups;for(let Qn=0,ti=en.length;Qn<ti;Qn++){const Vc=en[Qn];Y.update(Vc,ln),Y.bind(Vc,ln)}}return ln}function Ud(P,q){P.ambientLightColor.needsUpdate=q,P.lightProbe.needsUpdate=q,P.directionalLights.needsUpdate=q,P.directionalLightShadows.needsUpdate=q,P.pointLights.needsUpdate=q,P.pointLightShadows.needsUpdate=q,P.spotLights.needsUpdate=q,P.spotLightShadows.needsUpdate=q,P.rectAreaLights.needsUpdate=q,P.hemisphereLights.needsUpdate=q}function Nd(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return D},this.getActiveMipmapLevel=function(){return L},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(P,q,ot){j.get(P.texture).__webglTexture=q,j.get(P.depthTexture).__webglTexture=ot;const at=j.get(P);at.__hasExternalTextures=!0,at.__autoAllocateDepthBuffer=ot===void 0,at.__autoAllocateDepthBuffer||U.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),at.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(P,q){const ot=j.get(P);ot.__webglFramebuffer=q,ot.__useDefaultFramebuffer=q===void 0},this.setRenderTarget=function(P,q=0,ot=0){b=P,D=q,L=ot;let at=!0,Z=null,bt=!1,Pt=!1;if(P){const Ut=j.get(P);if(Ut.__useDefaultFramebuffer!==void 0)B.bindFramebuffer(S.FRAMEBUFFER,null),at=!1;else if(Ut.__webglFramebuffer===void 0)E.setupRenderTarget(P);else if(Ut.__hasExternalTextures)E.rebindTextures(P,j.get(P.texture).__webglTexture,j.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){const Nt=P.depthTexture;if(Ut.__boundDepthTexture!==Nt){if(Nt!==null&&j.has(Nt)&&(P.width!==Nt.image.width||P.height!==Nt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");E.setupDepthRenderbuffer(P)}}const Ht=P.texture;(Ht.isData3DTexture||Ht.isDataArrayTexture||Ht.isCompressedArrayTexture)&&(Pt=!0);const Wt=j.get(P).__webglFramebuffer;P.isWebGLCubeRenderTarget?(Array.isArray(Wt[q])?Z=Wt[q][ot]:Z=Wt[q],bt=!0):P.samples>0&&E.useMultisampledRTT(P)===!1?Z=j.get(P).__webglMultisampledFramebuffer:Array.isArray(Wt)?Z=Wt[ot]:Z=Wt,A.copy(P.viewport),O.copy(P.scissor),k=P.scissorTest}else A.copy(W).multiplyScalar(G).floor(),O.copy(rt).multiplyScalar(G).floor(),k=ct;if(B.bindFramebuffer(S.FRAMEBUFFER,Z)&&at&&B.drawBuffers(P,Z),B.viewport(A),B.scissor(O),B.setScissorTest(k),bt){const Ut=j.get(P.texture);S.framebufferTexture2D(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,S.TEXTURE_CUBE_MAP_POSITIVE_X+q,Ut.__webglTexture,ot)}else if(Pt){const Ut=j.get(P.texture),Ht=q||0;S.framebufferTextureLayer(S.FRAMEBUFFER,S.COLOR_ATTACHMENT0,Ut.__webglTexture,ot||0,Ht)}_=-1},this.readRenderTargetPixels=function(P,q,ot,at,Z,bt,Pt){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let It=j.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Pt!==void 0&&(It=It[Pt]),It){B.bindFramebuffer(S.FRAMEBUFFER,It);try{const Ut=P.texture,Ht=Ut.format,Wt=Ut.type;if(!z.textureFormatReadable(Ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!z.textureTypeReadable(Wt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q>=0&&q<=P.width-at&&ot>=0&&ot<=P.height-Z&&S.readPixels(q,ot,at,Z,Vt.convert(Ht),Vt.convert(Wt),bt)}finally{const Ut=b!==null?j.get(b).__webglFramebuffer:null;B.bindFramebuffer(S.FRAMEBUFFER,Ut)}}},this.readRenderTargetPixelsAsync=async function(P,q,ot,at,Z,bt,Pt){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let It=j.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&Pt!==void 0&&(It=It[Pt]),It){const Ut=P.texture,Ht=Ut.format,Wt=Ut.type;if(!z.textureFormatReadable(Ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!z.textureTypeReadable(Wt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(q>=0&&q<=P.width-at&&ot>=0&&ot<=P.height-Z){B.bindFramebuffer(S.FRAMEBUFFER,It);const Nt=S.createBuffer();S.bindBuffer(S.PIXEL_PACK_BUFFER,Nt),S.bufferData(S.PIXEL_PACK_BUFFER,bt.byteLength,S.STREAM_READ),S.readPixels(q,ot,at,Z,Vt.convert(Ht),Vt.convert(Wt),0);const Kt=b!==null?j.get(b).__webglFramebuffer:null;B.bindFramebuffer(S.FRAMEBUFFER,Kt);const ce=S.fenceSync(S.SYNC_GPU_COMMANDS_COMPLETE,0);return S.flush(),await K_(S,ce,4),S.bindBuffer(S.PIXEL_PACK_BUFFER,Nt),S.getBufferSubData(S.PIXEL_PACK_BUFFER,0,bt),S.deleteBuffer(Nt),S.deleteSync(ce),bt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(P,q=null,ot=0){P.isTexture!==!0&&(Ks("WebGLRenderer: copyFramebufferToTexture function signature has changed."),q=arguments[0]||null,P=arguments[1]);const at=Math.pow(2,-ot),Z=Math.floor(P.image.width*at),bt=Math.floor(P.image.height*at),Pt=q!==null?q.x:0,It=q!==null?q.y:0;E.setTexture2D(P,0),S.copyTexSubImage2D(S.TEXTURE_2D,ot,0,0,Pt,It,Z,bt),B.unbindTexture()},this.copyTextureToTexture=function(P,q,ot=null,at=null,Z=0){P.isTexture!==!0&&(Ks("WebGLRenderer: copyTextureToTexture function signature has changed."),at=arguments[0]||null,P=arguments[1],q=arguments[2],Z=arguments[3]||0,ot=null);let bt,Pt,It,Ut,Ht,Wt,Nt,Kt,ce;const fe=P.isCompressedTexture?P.mipmaps[Z]:P.image;ot!==null?(bt=ot.max.x-ot.min.x,Pt=ot.max.y-ot.min.y,It=ot.isBox3?ot.max.z-ot.min.z:1,Ut=ot.min.x,Ht=ot.min.y,Wt=ot.isBox3?ot.min.z:0):(bt=fe.width,Pt=fe.height,It=fe.depth||1,Ut=0,Ht=0,Wt=0),at!==null?(Nt=at.x,Kt=at.y,ce=at.z):(Nt=0,Kt=0,ce=0);const Ge=Vt.convert(q.format),$t=Vt.convert(q.type);let Ot;q.isData3DTexture?(E.setTexture3D(q,0),Ot=S.TEXTURE_3D):q.isDataArrayTexture||q.isCompressedArrayTexture?(E.setTexture2DArray(q,0),Ot=S.TEXTURE_2D_ARRAY):(E.setTexture2D(q,0),Ot=S.TEXTURE_2D),S.pixelStorei(S.UNPACK_FLIP_Y_WEBGL,q.flipY),S.pixelStorei(S.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),S.pixelStorei(S.UNPACK_ALIGNMENT,q.unpackAlignment);const In=S.getParameter(S.UNPACK_ROW_LENGTH),Jt=S.getParameter(S.UNPACK_IMAGE_HEIGHT),ln=S.getParameter(S.UNPACK_SKIP_PIXELS),Zi=S.getParameter(S.UNPACK_SKIP_ROWS),Ze=S.getParameter(S.UNPACK_SKIP_IMAGES);S.pixelStorei(S.UNPACK_ROW_LENGTH,fe.width),S.pixelStorei(S.UNPACK_IMAGE_HEIGHT,fe.height),S.pixelStorei(S.UNPACK_SKIP_PIXELS,Ut),S.pixelStorei(S.UNPACK_SKIP_ROWS,Ht),S.pixelStorei(S.UNPACK_SKIP_IMAGES,Wt);const Os=P.isDataArrayTexture||P.isData3DTexture,de=q.isDataArrayTexture||q.isData3DTexture;if(P.isRenderTargetTexture||P.isDepthTexture){const vn=j.get(P),Fs=j.get(q),en=j.get(vn.__renderTarget),Qn=j.get(Fs.__renderTarget);B.bindFramebuffer(S.READ_FRAMEBUFFER,en.__webglFramebuffer),B.bindFramebuffer(S.DRAW_FRAMEBUFFER,Qn.__webglFramebuffer);for(let ti=0;ti<It;ti++)Os&&S.framebufferTextureLayer(S.READ_FRAMEBUFFER,S.COLOR_ATTACHMENT0,j.get(P).__webglTexture,Z,Wt+ti),P.isDepthTexture?(de&&S.framebufferTextureLayer(S.DRAW_FRAMEBUFFER,S.COLOR_ATTACHMENT0,j.get(q).__webglTexture,Z,ce+ti),S.blitFramebuffer(Ut,Ht,bt,Pt,Nt,Kt,bt,Pt,S.DEPTH_BUFFER_BIT,S.NEAREST)):de?S.copyTexSubImage3D(Ot,Z,Nt,Kt,ce+ti,Ut,Ht,bt,Pt):S.copyTexSubImage2D(Ot,Z,Nt,Kt,ce+ti,Ut,Ht,bt,Pt);B.bindFramebuffer(S.READ_FRAMEBUFFER,null),B.bindFramebuffer(S.DRAW_FRAMEBUFFER,null)}else de?P.isDataTexture||P.isData3DTexture?S.texSubImage3D(Ot,Z,Nt,Kt,ce,bt,Pt,It,Ge,$t,fe.data):q.isCompressedArrayTexture?S.compressedTexSubImage3D(Ot,Z,Nt,Kt,ce,bt,Pt,It,Ge,fe.data):S.texSubImage3D(Ot,Z,Nt,Kt,ce,bt,Pt,It,Ge,$t,fe):P.isDataTexture?S.texSubImage2D(S.TEXTURE_2D,Z,Nt,Kt,bt,Pt,Ge,$t,fe.data):P.isCompressedTexture?S.compressedTexSubImage2D(S.TEXTURE_2D,Z,Nt,Kt,fe.width,fe.height,Ge,fe.data):S.texSubImage2D(S.TEXTURE_2D,Z,Nt,Kt,bt,Pt,Ge,$t,fe);S.pixelStorei(S.UNPACK_ROW_LENGTH,In),S.pixelStorei(S.UNPACK_IMAGE_HEIGHT,Jt),S.pixelStorei(S.UNPACK_SKIP_PIXELS,ln),S.pixelStorei(S.UNPACK_SKIP_ROWS,Zi),S.pixelStorei(S.UNPACK_SKIP_IMAGES,Ze),Z===0&&q.generateMipmaps&&S.generateMipmap(Ot),B.unbindTexture()},this.copyTextureToTexture3D=function(P,q,ot=null,at=null,Z=0){return P.isTexture!==!0&&(Ks("WebGLRenderer: copyTextureToTexture3D function signature has changed."),ot=arguments[0]||null,at=arguments[1]||null,P=arguments[2],q=arguments[3],Z=arguments[4]||0),Ks('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(P,q,ot,at,Z)},this.initRenderTarget=function(P){j.get(P).__webglFramebuffer===void 0&&E.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?E.setTextureCube(P,0):P.isData3DTexture?E.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?E.setTexture2DArray(P,0):E.setTexture2D(P,0),B.unbindTexture()},this.resetState=function(){D=0,L=0,b=null,B.reset(),ee.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Xn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorspace=Zt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Zt._getUnpackColorSpace()}}class lM extends Se{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 gn,this.environmentIntensity=1,this.environmentRotation=new gn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class xd extends Is{static get type(){return"LineBasicMaterial"}constructor(t){super(),this.isLineBasicMaterial=!0,this.color=new kt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Co=new I,Po=new I,mh=new ae,Xs=new Yo,Qr=new Xo,Fa=new I,_h=new I;class ai extends Se{constructor(t=new Be,e=new xd){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,i=[0];for(let s=1,r=e.count;s<r;s++)Co.fromBufferAttribute(e,s-1),Po.fromBufferAttribute(e,s),i[s]=i[s-1],i[s]+=Co.distanceTo(Po);t.setAttribute("lineDistance",new le(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,s=this.matrixWorld,r=t.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Qr.copy(i.boundingSphere),Qr.applyMatrix4(s),Qr.radius+=r,t.ray.intersectsSphere(Qr)===!1)return;mh.copy(s).invert(),Xs.copy(t.ray).applyMatrix4(mh);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=i.index,d=i.attributes.position;if(u!==null){const p=Math.max(0,o.start),v=Math.min(u.count,o.start+o.count);for(let x=p,m=v-1;x<m;x+=c){const f=u.getX(x),R=u.getX(x+1),w=to(this,t,Xs,l,f,R);w&&e.push(w)}if(this.isLineLoop){const x=u.getX(v-1),m=u.getX(p),f=to(this,t,Xs,l,x,m);f&&e.push(f)}}else{const p=Math.max(0,o.start),v=Math.min(d.count,o.start+o.count);for(let x=p,m=v-1;x<m;x+=c){const f=to(this,t,Xs,l,x,x+1);f&&e.push(f)}if(this.isLineLoop){const x=to(this,t,Xs,l,v-1,p);x&&e.push(x)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}function to(n,t,e,i,s,r){const o=n.geometry.attributes.position;if(Co.fromBufferAttribute(o,s),Po.fromBufferAttribute(o,r),e.distanceSqToSegment(Co,Po,Fa,_h)>i)return;Fa.applyMatrix4(n.matrixWorld);const l=t.ray.origin.distanceTo(Fa);if(!(l<t.near||l>t.far))return{distance:l,point:_h.clone().applyMatrix4(n.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:n}}class Ln{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,s=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)i=this.getPoint(o/t),r+=i.distanceTo(s),e.push(r),s=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let s=0;const r=i.length;let o;e?o=e:o=t*i[r-1];let a=0,l=r-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=i[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,i[s]===o)return s/(r-1);const u=i[s],d=i[s+1]-u,p=(o-u)/d;return(s+p)/(r-1)}getTangent(t,e){let s=t-1e-4,r=t+1e-4;s<0&&(s=0),r>1&&(r=1);const o=this.getPoint(s),a=this.getPoint(r),l=e||(o.isVector2?new Mt:new I);return l.copy(a).sub(o).normalize(),l}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new I,s=[],r=[],o=[],a=new I,l=new ae;for(let p=0;p<=t;p++){const v=p/t;s[p]=this.getTangentAt(v,new I)}r[0]=new I,o[0]=new I;let c=Number.MAX_VALUE;const u=Math.abs(s[0].x),h=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let p=1;p<=t;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(s[p-1],s[p]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(Ce(s[p-1].dot(s[p]),-1,1));r[p].applyMatrix4(l.makeRotationAxis(a,v))}o[p].crossVectors(s[p],r[p])}if(e===!0){let p=Math.acos(Ce(r[0].dot(r[t]),-1,1));p/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(p=-p);for(let v=1;v<=t;v++)r[v].applyMatrix4(l.makeRotationAxis(s[v],p*v)),o[v].crossVectors(s[v],r[v])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class wc extends Ln{constructor(t=0,e=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(t,e=new Mt){const i=e,s=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(o?r=0:r=s),this.aClockwise===!0&&!o&&(r===s?r=-s:r=r-s);const a=this.aStartAngle+t*r;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=l-this.aX,p=c-this.aY;l=d*u-p*h+this.aX,c=d*h+p*u+this.aY}return i.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class cM extends wc{constructor(t,e,i,s,r,o){super(t,e,i,i,s,r,o),this.isArcCurve=!0,this.type="ArcCurve"}}function Ac(){let n=0,t=0,e=0,i=0;function s(r,o,a,l){n=r,t=a,e=-3*r+3*o-2*a-l,i=2*r-2*o+a+l}return{initCatmullRom:function(r,o,a,l,c){s(o,a,c*(a-r),c*(l-o))},initNonuniformCatmullRom:function(r,o,a,l,c,u,h){let d=(o-r)/c-(a-r)/(c+u)+(a-o)/u,p=(a-o)/u-(l-o)/(u+h)+(l-a)/h;d*=u,p*=u,s(o,a,d,p)},calc:function(r){const o=r*r,a=o*r;return n+t*r+e*o+i*a}}}const eo=new I,Ba=new Ac,za=new Ac,Ha=new Ac;class uM extends Ln{constructor(t=[],e=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=s}getPoint(t,e=new I){const i=e,s=this.points,r=s.length,o=(r-(this.closed?0:1))*t;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=s[(a-1)%r]:(eo.subVectors(s[0],s[1]).add(s[0]),c=eo);const h=s[a%r],d=s[(a+1)%r];if(this.closed||a+2<r?u=s[(a+2)%r]:(eo.subVectors(s[r-1],s[r-2]).add(s[r-1]),u=eo),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let v=Math.pow(c.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(d),p),m=Math.pow(d.distanceToSquared(u),p);x<1e-4&&(x=1),v<1e-4&&(v=x),m<1e-4&&(m=x),Ba.initNonuniformCatmullRom(c.x,h.x,d.x,u.x,v,x,m),za.initNonuniformCatmullRom(c.y,h.y,d.y,u.y,v,x,m),Ha.initNonuniformCatmullRom(c.z,h.z,d.z,u.z,v,x,m)}else this.curveType==="catmullrom"&&(Ba.initCatmullRom(c.x,h.x,d.x,u.x,this.tension),za.initCatmullRom(c.y,h.y,d.y,u.y,this.tension),Ha.initCatmullRom(c.z,h.z,d.z,u.z,this.tension));return i.set(Ba.calc(l),za.calc(l),Ha.calc(l)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const s=t.points[e];this.points.push(new I().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function gh(n,t,e,i,s){const r=(i-t)*.5,o=(s-e)*.5,a=n*n,l=n*a;return(2*e-2*i+r+o)*l+(-3*e+3*i-2*r-o)*a+r*n+e}function hM(n,t){const e=1-n;return e*e*t}function fM(n,t){return 2*(1-n)*n*t}function dM(n,t){return n*n*t}function ar(n,t,e,i){return hM(n,t)+fM(n,e)+dM(n,i)}function pM(n,t){const e=1-n;return e*e*e*t}function mM(n,t){const e=1-n;return 3*e*e*n*t}function _M(n,t){return 3*(1-n)*n*n*t}function gM(n,t){return n*n*n*t}function lr(n,t,e,i,s){return pM(n,t)+mM(n,e)+_M(n,i)+gM(n,s)}class yd extends Ln{constructor(t=new Mt,e=new Mt,i=new Mt,s=new Mt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new Mt){const i=e,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(lr(t,s.x,r.x,o.x,a.x),lr(t,s.y,r.y,o.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class vM extends Ln{constructor(t=new I,e=new I,i=new I,s=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new I){const i=e,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(lr(t,s.x,r.x,o.x,a.x),lr(t,s.y,r.y,o.y,a.y),lr(t,s.z,r.z,o.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Md extends Ln{constructor(t=new Mt,e=new Mt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Mt){const i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Mt){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class xM extends Ln{constructor(t=new I,e=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new I){const i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new I){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Sd extends Ln{constructor(t=new Mt,e=new Mt,i=new Mt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Mt){const i=e,s=this.v0,r=this.v1,o=this.v2;return i.set(ar(t,s.x,r.x,o.x),ar(t,s.y,r.y,o.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class yM extends Ln{constructor(t=new I,e=new I,i=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new I){const i=e,s=this.v0,r=this.v1,o=this.v2;return i.set(ar(t,s.x,r.x,o.x),ar(t,s.y,r.y,o.y),ar(t,s.z,r.z,o.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Ed extends Ln{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Mt){const i=e,s=this.points,r=(s.length-1)*t,o=Math.floor(r),a=r-o,l=s[o===0?o:o-1],c=s[o],u=s[o>s.length-2?s.length-1:o+1],h=s[o>s.length-3?s.length-1:o+2];return i.set(gh(a,l.x,c.x,u.x,h.x),gh(a,l.y,c.y,u.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const s=t.points[e];this.points.push(s.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const s=t.points[e];this.points.push(new Mt().fromArray(s))}return this}}var Wl=Object.freeze({__proto__:null,ArcCurve:cM,CatmullRomCurve3:uM,CubicBezierCurve:yd,CubicBezierCurve3:vM,EllipseCurve:wc,LineCurve:Md,LineCurve3:xM,QuadraticBezierCurve:Sd,QuadraticBezierCurve3:yM,SplineCurve:Ed});class MM extends Ln{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Wl[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),s=this.getCurveLengths();let r=0;for(;r<s.length;){if(s[r]>=i){const o=s[r]-i,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,s=this.curves.length;i<s;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let s=0,r=this.curves;s<r.length;s++){const o=r[s],a=o.isEllipseCurve?t*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?t*o.points.length:t,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(e.push(u),i=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const s=t.curves[e];this.curves.push(new Wl[s.type]().fromJSON(s))}return this}}class vh extends MM{constructor(t){super(),this.type="Path",this.currentPoint=new Mt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new Md(this.currentPoint.clone(),new Mt(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,s){const r=new Sd(this.currentPoint.clone(),new Mt(t,e),new Mt(i,s));return this.curves.push(r),this.currentPoint.set(i,s),this}bezierCurveTo(t,e,i,s,r,o){const a=new yd(this.currentPoint.clone(),new Mt(t,e),new Mt(i,s),new Mt(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new Ed(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,s,r,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(t+a,e+l,i,s,r,o),this}absarc(t,e,i,s,r,o){return this.absellipse(t,e,i,i,s,r,o),this}ellipse(t,e,i,s,r,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(t+c,e+u,i,s,r,o,a,l),this}absellipse(t,e,i,s,r,o,a,l){const c=new wc(t,e,i,s,r,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Ie extends Be{constructor(t=1,e=1,i=1,s=32,r=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:s,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:l};const c=this;s=Math.floor(s),r=Math.floor(r);const u=[],h=[],d=[],p=[];let v=0;const x=[],m=i/2;let f=0;R(),o===!1&&(t>0&&w(!0),e>0&&w(!1)),this.setIndex(u),this.setAttribute("position",new le(h,3)),this.setAttribute("normal",new le(d,3)),this.setAttribute("uv",new le(p,2));function R(){const M=new I,F=new I;let D=0;const L=(e-t)/i;for(let b=0;b<=r;b++){const _=[],g=b/r,A=g*(e-t)+t;for(let O=0;O<=s;O++){const k=O/s,J=k*l+a,st=Math.sin(J),Q=Math.cos(J);F.x=A*st,F.y=-g*i+m,F.z=A*Q,h.push(F.x,F.y,F.z),M.set(st,L,Q).normalize(),d.push(M.x,M.y,M.z),p.push(k,1-g),_.push(v++)}x.push(_)}for(let b=0;b<s;b++)for(let _=0;_<r;_++){const g=x[_][b],A=x[_+1][b],O=x[_+1][b+1],k=x[_][b+1];(t>0||_!==0)&&(u.push(g,A,k),D+=3),(e>0||_!==r-1)&&(u.push(A,O,k),D+=3)}c.addGroup(f,D,0),f+=D}function w(M){const F=v,D=new Mt,L=new I;let b=0;const _=M===!0?t:e,g=M===!0?1:-1;for(let O=1;O<=s;O++)h.push(0,m*g,0),d.push(0,g,0),p.push(.5,.5),v++;const A=v;for(let O=0;O<=s;O++){const J=O/s*l+a,st=Math.cos(J),Q=Math.sin(J);L.x=_*Q,L.y=m*g,L.z=_*st,h.push(L.x,L.y,L.z),d.push(0,g,0),D.x=st*.5+.5,D.y=Q*.5*g+.5,p.push(D.x,D.y),v++}for(let O=0;O<s;O++){const k=F+O,J=A+O;M===!0?u.push(J,J+1,k):u.push(J+1,J,k),b+=3}c.addGroup(f,b,M===!0?1:2),f+=b}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ie(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Rc extends Be{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],o=[];a(s),c(i),u(),this.setAttribute("position",new le(r,3)),this.setAttribute("normal",new le(r.slice(),3)),this.setAttribute("uv",new le(o,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function a(R){const w=new I,M=new I,F=new I;for(let D=0;D<e.length;D+=3)p(e[D+0],w),p(e[D+1],M),p(e[D+2],F),l(w,M,F,R)}function l(R,w,M,F){const D=F+1,L=[];for(let b=0;b<=D;b++){L[b]=[];const _=R.clone().lerp(M,b/D),g=w.clone().lerp(M,b/D),A=D-b;for(let O=0;O<=A;O++)O===0&&b===D?L[b][O]=_:L[b][O]=_.clone().lerp(g,O/A)}for(let b=0;b<D;b++)for(let _=0;_<2*(D-b)-1;_++){const g=Math.floor(_/2);_%2===0?(d(L[b][g+1]),d(L[b+1][g]),d(L[b][g])):(d(L[b][g+1]),d(L[b+1][g+1]),d(L[b+1][g]))}}function c(R){const w=new I;for(let M=0;M<r.length;M+=3)w.x=r[M+0],w.y=r[M+1],w.z=r[M+2],w.normalize().multiplyScalar(R),r[M+0]=w.x,r[M+1]=w.y,r[M+2]=w.z}function u(){const R=new I;for(let w=0;w<r.length;w+=3){R.x=r[w+0],R.y=r[w+1],R.z=r[w+2];const M=m(R)/2/Math.PI+.5,F=f(R)/Math.PI+.5;o.push(M,1-F)}v(),h()}function h(){for(let R=0;R<o.length;R+=6){const w=o[R+0],M=o[R+2],F=o[R+4],D=Math.max(w,M,F),L=Math.min(w,M,F);D>.9&&L<.1&&(w<.2&&(o[R+0]+=1),M<.2&&(o[R+2]+=1),F<.2&&(o[R+4]+=1))}}function d(R){r.push(R.x,R.y,R.z)}function p(R,w){const M=R*3;w.x=t[M+0],w.y=t[M+1],w.z=t[M+2]}function v(){const R=new I,w=new I,M=new I,F=new I,D=new Mt,L=new Mt,b=new Mt;for(let _=0,g=0;_<r.length;_+=9,g+=6){R.set(r[_+0],r[_+1],r[_+2]),w.set(r[_+3],r[_+4],r[_+5]),M.set(r[_+6],r[_+7],r[_+8]),D.set(o[g+0],o[g+1]),L.set(o[g+2],o[g+3]),b.set(o[g+4],o[g+5]),F.copy(R).add(w).add(M).divideScalar(3);const A=m(F);x(D,g+0,R,A),x(L,g+2,w,A),x(b,g+4,M,A)}}function x(R,w,M,F){F<0&&R.x===1&&(o[w]=R.x-1),M.x===0&&M.z===0&&(o[w]=F/2/Math.PI+.5)}function m(R){return Math.atan2(R.z,-R.x)}function f(R){return Math.atan2(-R.y,Math.sqrt(R.x*R.x+R.z*R.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Rc(t.vertices,t.indices,t.radius,t.details)}}class bd extends vh{constructor(t){super(t),this.uuid=Ds(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,s=this.holes.length;i<s;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const s=t.holes[e];this.holes.push(new vh().fromJSON(s))}return this}}const SM={triangulate:function(n,t,e=2){const i=t&&t.length,s=i?t[0]*e:n.length;let r=Td(n,0,s,e,!0);const o=[];if(!r||r.next===r.prev)return o;let a,l,c,u,h,d,p;if(i&&(r=AM(n,t,r,e)),n.length>80*e){a=c=n[0],l=u=n[1];for(let v=e;v<s;v+=e)h=n[v],d=n[v+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=Math.max(c-a,u-l),p=p!==0?32767/p:0}return gr(r,o,e,a,l,p,0),o}};function Td(n,t,e,i,s){let r,o;if(s===BM(n,t,e,i)>0)for(r=t;r<e;r+=i)o=xh(r,n[r],n[r+1],o);else for(r=e-i;r>=t;r-=i)o=xh(r,n[r],n[r+1],o);return o&&jo(o,o.next)&&(xr(o),o=o.next),o}function Yi(n,t){if(!n)return n;t||(t=n);let e=n,i;do if(i=!1,!e.steiner&&(jo(e,e.next)||_e(e.prev,e,e.next)===0)){if(xr(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function gr(n,t,e,i,s,r,o){if(!n)return;!o&&r&&DM(n,i,s,r);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,r?bM(n,i,s,r):EM(n)){t.push(l.i/e|0),t.push(n.i/e|0),t.push(c.i/e|0),xr(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=TM(Yi(n),t,e),gr(n,t,e,i,s,r,2)):o===2&&wM(n,t,e,i,s,r):gr(Yi(n),t,e,i,s,r,1);break}}}function EM(n){const t=n.prev,e=n,i=n.next;if(_e(t,e,i)>=0)return!1;const s=t.x,r=e.x,o=i.x,a=t.y,l=e.y,c=i.y,u=s<r?s<o?s:o:r<o?r:o,h=a<l?a<c?a:c:l<c?l:c,d=s>r?s>o?s:o:r>o?r:o,p=a>l?a>c?a:c:l>c?l:c;let v=i.next;for(;v!==t;){if(v.x>=u&&v.x<=d&&v.y>=h&&v.y<=p&&ps(s,a,r,l,o,c,v.x,v.y)&&_e(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function bM(n,t,e,i){const s=n.prev,r=n,o=n.next;if(_e(s,r,o)>=0)return!1;const a=s.x,l=r.x,c=o.x,u=s.y,h=r.y,d=o.y,p=a<l?a<c?a:c:l<c?l:c,v=u<h?u<d?u:d:h<d?h:d,x=a>l?a>c?a:c:l>c?l:c,m=u>h?u>d?u:d:h>d?h:d,f=Xl(p,v,t,e,i),R=Xl(x,m,t,e,i);let w=n.prevZ,M=n.nextZ;for(;w&&w.z>=f&&M&&M.z<=R;){if(w.x>=p&&w.x<=x&&w.y>=v&&w.y<=m&&w!==s&&w!==o&&ps(a,u,l,h,c,d,w.x,w.y)&&_e(w.prev,w,w.next)>=0||(w=w.prevZ,M.x>=p&&M.x<=x&&M.y>=v&&M.y<=m&&M!==s&&M!==o&&ps(a,u,l,h,c,d,M.x,M.y)&&_e(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;w&&w.z>=f;){if(w.x>=p&&w.x<=x&&w.y>=v&&w.y<=m&&w!==s&&w!==o&&ps(a,u,l,h,c,d,w.x,w.y)&&_e(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=R;){if(M.x>=p&&M.x<=x&&M.y>=v&&M.y<=m&&M!==s&&M!==o&&ps(a,u,l,h,c,d,M.x,M.y)&&_e(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function TM(n,t,e){let i=n;do{const s=i.prev,r=i.next.next;!jo(s,r)&&wd(s,i,i.next,r)&&vr(s,r)&&vr(r,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(r.i/e|0),xr(i),xr(i.next),i=n=r),i=i.next}while(i!==n);return Yi(i)}function wM(n,t,e,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&NM(o,a)){let l=Ad(o,a);o=Yi(o,o.next),l=Yi(l,l.next),gr(o,t,e,i,s,r,0),gr(l,t,e,i,s,r,0);return}a=a.next}o=o.next}while(o!==n)}function AM(n,t,e,i){const s=[];let r,o,a,l,c;for(r=0,o=t.length;r<o;r++)a=t[r]*i,l=r<o-1?t[r+1]*i:n.length,c=Td(n,a,l,i,!1),c===c.next&&(c.steiner=!0),s.push(UM(c));for(s.sort(RM),r=0;r<s.length;r++)e=CM(s[r],e);return e}function RM(n,t){return n.x-t.x}function CM(n,t){const e=PM(n,t);if(!e)return t;const i=Ad(e,n);return Yi(i,i.next),Yi(e,e.next)}function PM(n,t){let e=t,i=-1/0,s;const r=n.x,o=n.y;do{if(o<=e.y&&o>=e.next.y&&e.next.y!==e.y){const d=e.x+(o-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=r&&d>i&&(i=d,s=e.x<e.next.x?e:e.next,d===r))return s}e=e.next}while(e!==t);if(!s)return null;const a=s,l=s.x,c=s.y;let u=1/0,h;e=s;do r>=e.x&&e.x>=l&&r!==e.x&&ps(o<c?r:i,o,l,c,o<c?i:r,o,e.x,e.y)&&(h=Math.abs(o-e.y)/(r-e.x),vr(e,n)&&(h<u||h===u&&(e.x>s.x||e.x===s.x&&LM(s,e)))&&(s=e,u=h)),e=e.next;while(e!==a);return s}function LM(n,t){return _e(n.prev,n,t.prev)<0&&_e(t.next,n,n.next)<0}function DM(n,t,e,i){let s=n;do s.z===0&&(s.z=Xl(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,IM(s)}function IM(n){let t,e,i,s,r,o,a,l,c=1;do{for(e=n,n=null,r=null,o=0;e;){for(o++,i=e,a=0,t=0;t<c&&(a++,i=i.nextZ,!!i);t++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;e=i}r.nextZ=null,c*=2}while(o>1);return n}function Xl(n,t,e,i,s){return n=(n-e)*s|0,t=(t-i)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function UM(n){let t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function ps(n,t,e,i,s,r,o,a){return(s-o)*(t-a)>=(n-o)*(r-a)&&(n-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(r-a)>=(s-o)*(i-a)}function NM(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!OM(n,t)&&(vr(n,t)&&vr(t,n)&&FM(n,t)&&(_e(n.prev,n,t.prev)||_e(n,t.prev,t))||jo(n,t)&&_e(n.prev,n,n.next)>0&&_e(t.prev,t,t.next)>0)}function _e(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function jo(n,t){return n.x===t.x&&n.y===t.y}function wd(n,t,e,i){const s=io(_e(n,t,e)),r=io(_e(n,t,i)),o=io(_e(e,i,n)),a=io(_e(e,i,t));return!!(s!==r&&o!==a||s===0&&no(n,e,t)||r===0&&no(n,i,t)||o===0&&no(e,n,i)||a===0&&no(e,t,i))}function no(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function io(n){return n>0?1:n<0?-1:0}function OM(n,t){let e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&wd(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function vr(n,t){return _e(n.prev,n,n.next)<0?_e(n,t,n.next)>=0&&_e(n,n.prev,t)>=0:_e(n,t,n.prev)<0||_e(n,n.next,t)<0}function FM(n,t){let e=n,i=!1;const s=(n.x+t.x)/2,r=(n.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&s<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==n);return i}function Ad(n,t){const e=new Yl(n.i,n.x,n.y),i=new Yl(t.i,t.x,t.y),s=n.next,r=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,i.next=e,e.prev=i,r.next=i,i.prev=r,i}function xh(n,t,e,i){const s=new Yl(n,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function xr(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Yl(n,t,e){this.i=n,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function BM(n,t,e,i){let s=0;for(let r=t,o=e-i;r<e;r+=i)s+=(n[o]-n[r])*(n[r+1]+n[o+1]),o=r;return s}class cr{static area(t){const e=t.length;let i=0;for(let s=e-1,r=0;r<e;s=r++)i+=t[s].x*t[r].y-t[r].x*t[s].y;return i*.5}static isClockWise(t){return cr.area(t)<0}static triangulateShape(t,e){const i=[],s=[],r=[];yh(t),Mh(i,t);let o=t.length;e.forEach(yh);for(let l=0;l<e.length;l++)s.push(o),o+=e[l].length,Mh(i,e[l]);const a=SM.triangulate(i,s);for(let l=0;l<a.length;l+=3)r.push(a.slice(l,l+3));return r}}function yh(n){const t=n.length;t>2&&n[t-1].equals(n[0])&&n.pop()}function Mh(n,t){for(let e=0;e<t.length;e++)n.push(t[e].x),n.push(t[e].y)}class Cc extends Be{constructor(t=new bd([new Mt(.5,.5),new Mt(-.5,.5),new Mt(-.5,-.5),new Mt(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,s=[],r=[];for(let a=0,l=t.length;a<l;a++){const c=t[a];o(c)}this.setAttribute("position",new le(s,3)),this.setAttribute("uv",new le(r,2)),this.computeVertexNormals();function o(a){const l=[],c=e.curveSegments!==void 0?e.curveSegments:12,u=e.steps!==void 0?e.steps:1,h=e.depth!==void 0?e.depth:1;let d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,p=e.bevelThickness!==void 0?e.bevelThickness:.2,v=e.bevelSize!==void 0?e.bevelSize:p-.1,x=e.bevelOffset!==void 0?e.bevelOffset:0,m=e.bevelSegments!==void 0?e.bevelSegments:3;const f=e.extrudePath,R=e.UVGenerator!==void 0?e.UVGenerator:zM;let w,M=!1,F,D,L,b;f&&(w=f.getSpacedPoints(u),M=!0,d=!1,F=f.computeFrenetFrames(u,!1),D=new I,L=new I,b=new I),d||(m=0,p=0,v=0,x=0);const _=a.extractPoints(c);let g=_.shape;const A=_.holes;if(!cr.isClockWise(g)){g=g.reverse();for(let T=0,C=A.length;T<C;T++){const S=A[T];cr.isClockWise(S)&&(A[T]=S.reverse())}}const k=cr.triangulateShape(g,A),J=g;for(let T=0,C=A.length;T<C;T++){const S=A[T];g=g.concat(S)}function st(T,C,S){return C||console.error("THREE.ExtrudeGeometry: vec does not exist"),T.clone().addScaledVector(C,S)}const Q=g.length,V=k.length;function G(T,C,S){let H,U,z;const B=T.x-C.x,tt=T.y-C.y,j=S.x-T.x,E=S.y-T.y,y=B*B+tt*tt,N=B*E-tt*j;if(Math.abs(N)>Number.EPSILON){const X=Math.sqrt(y),nt=Math.sqrt(j*j+E*E),K=C.x-tt/X,xt=C.y+B/X,dt=S.x-E/nt,St=S.y+j/nt,Ft=((dt-K)*E-(St-xt)*j)/(B*E-tt*j);H=K+B*Ft-T.x,U=xt+tt*Ft-T.y;const mt=H*H+U*U;if(mt<=2)return new Mt(H,U);z=Math.sqrt(mt/2)}else{let X=!1;B>Number.EPSILON?j>Number.EPSILON&&(X=!0):B<-Number.EPSILON?j<-Number.EPSILON&&(X=!0):Math.sign(tt)===Math.sign(E)&&(X=!0),X?(H=-tt,U=B,z=Math.sqrt(y)):(H=B,U=tt,z=Math.sqrt(y/2))}return new Mt(H/z,U/z)}const it=[];for(let T=0,C=J.length,S=C-1,H=T+1;T<C;T++,S++,H++)S===C&&(S=0),H===C&&(H=0),it[T]=G(J[T],J[S],J[H]);const vt=[];let W,rt=it.concat();for(let T=0,C=A.length;T<C;T++){const S=A[T];W=[];for(let H=0,U=S.length,z=U-1,B=H+1;H<U;H++,z++,B++)z===U&&(z=0),B===U&&(B=0),W[H]=G(S[H],S[z],S[B]);vt.push(W),rt=rt.concat(W)}for(let T=0;T<m;T++){const C=T/m,S=p*Math.cos(C*Math.PI/2),H=v*Math.sin(C*Math.PI/2)+x;for(let U=0,z=J.length;U<z;U++){const B=st(J[U],it[U],H);ut(B.x,B.y,-S)}for(let U=0,z=A.length;U<z;U++){const B=A[U];W=vt[U];for(let tt=0,j=B.length;tt<j;tt++){const E=st(B[tt],W[tt],H);ut(E.x,E.y,-S)}}}const ct=v+x;for(let T=0;T<Q;T++){const C=d?st(g[T],rt[T],ct):g[T];M?(L.copy(F.normals[0]).multiplyScalar(C.x),D.copy(F.binormals[0]).multiplyScalar(C.y),b.copy(w[0]).add(L).add(D),ut(b.x,b.y,b.z)):ut(C.x,C.y,0)}for(let T=1;T<=u;T++)for(let C=0;C<Q;C++){const S=d?st(g[C],rt[C],ct):g[C];M?(L.copy(F.normals[T]).multiplyScalar(S.x),D.copy(F.binormals[T]).multiplyScalar(S.y),b.copy(w[T]).add(L).add(D),ut(b.x,b.y,b.z)):ut(S.x,S.y,h/u*T)}for(let T=m-1;T>=0;T--){const C=T/m,S=p*Math.cos(C*Math.PI/2),H=v*Math.sin(C*Math.PI/2)+x;for(let U=0,z=J.length;U<z;U++){const B=st(J[U],it[U],H);ut(B.x,B.y,h+S)}for(let U=0,z=A.length;U<z;U++){const B=A[U];W=vt[U];for(let tt=0,j=B.length;tt<j;tt++){const E=st(B[tt],W[tt],H);M?ut(E.x,E.y+w[u-1].y,w[u-1].x+S):ut(E.x,E.y,h+S)}}}$(),lt();function $(){const T=s.length/3;if(d){let C=0,S=Q*C;for(let H=0;H<V;H++){const U=k[H];et(U[2]+S,U[1]+S,U[0]+S)}C=u+m*2,S=Q*C;for(let H=0;H<V;H++){const U=k[H];et(U[0]+S,U[1]+S,U[2]+S)}}else{for(let C=0;C<V;C++){const S=k[C];et(S[2],S[1],S[0])}for(let C=0;C<V;C++){const S=k[C];et(S[0]+Q*u,S[1]+Q*u,S[2]+Q*u)}}i.addGroup(T,s.length/3-T,0)}function lt(){const T=s.length/3;let C=0;pt(J,C),C+=J.length;for(let S=0,H=A.length;S<H;S++){const U=A[S];pt(U,C),C+=U.length}i.addGroup(T,s.length/3-T,1)}function pt(T,C){let S=T.length;for(;--S>=0;){const H=S;let U=S-1;U<0&&(U=T.length-1);for(let z=0,B=u+m*2;z<B;z++){const tt=Q*z,j=Q*(z+1),E=C+H+tt,y=C+U+tt,N=C+U+j,X=C+H+j;ft(E,y,N,X)}}}function ut(T,C,S){l.push(T),l.push(C),l.push(S)}function et(T,C,S){gt(T),gt(C),gt(S);const H=s.length/3,U=R.generateTopUV(i,s,H-3,H-2,H-1);yt(U[0]),yt(U[1]),yt(U[2])}function ft(T,C,S,H){gt(T),gt(C),gt(H),gt(C),gt(S),gt(H);const U=s.length/3,z=R.generateSideWallUV(i,s,U-6,U-3,U-2,U-1);yt(z[0]),yt(z[1]),yt(z[3]),yt(z[1]),yt(z[2]),yt(z[3])}function gt(T){s.push(l[T*3+0]),s.push(l[T*3+1]),s.push(l[T*3+2])}function yt(T){r.push(T.x),r.push(T.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes,i=this.parameters.options;return HM(e,i,t)}static fromJSON(t,e){const i=[];for(let r=0,o=t.shapes.length;r<o;r++){const a=e[t.shapes[r]];i.push(a)}const s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new Wl[s.type]().fromJSON(s)),new Cc(i,t.options)}}const zM={generateTopUV:function(n,t,e,i,s){const r=t[e*3],o=t[e*3+1],a=t[i*3],l=t[i*3+1],c=t[s*3],u=t[s*3+1];return[new Mt(r,o),new Mt(a,l),new Mt(c,u)]},generateSideWallUV:function(n,t,e,i,s,r){const o=t[e*3],a=t[e*3+1],l=t[e*3+2],c=t[i*3],u=t[i*3+1],h=t[i*3+2],d=t[s*3],p=t[s*3+1],v=t[s*3+2],x=t[r*3],m=t[r*3+1],f=t[r*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Mt(o,1-l),new Mt(c,1-h),new Mt(d,1-v),new Mt(x,1-f)]:[new Mt(a,1-l),new Mt(u,1-h),new Mt(p,1-v),new Mt(m,1-f)]}};function HM(n,t,e){if(e.shapes=[],Array.isArray(n))for(let i=0,s=n.length;i<s;i++){const r=n[i];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}class ms extends Rc{constructor(t=1,e=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,s,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new ms(t.radius,t.detail)}}class Pc extends Be{constructor(t=.5,e=1,i=32,s=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:s,thetaStart:r,thetaLength:o},i=Math.max(3,i),s=Math.max(1,s);const a=[],l=[],c=[],u=[];let h=t;const d=(e-t)/s,p=new I,v=new Mt;for(let x=0;x<=s;x++){for(let m=0;m<=i;m++){const f=r+m/i*o;p.x=h*Math.cos(f),p.y=h*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),v.x=(p.x/e+1)/2,v.y=(p.y/e+1)/2,u.push(v.x,v.y)}h+=d}for(let x=0;x<s;x++){const m=x*(i+1);for(let f=0;f<i;f++){const R=f+m,w=R,M=R+i+1,F=R+i+2,D=R+1;a.push(w,M,D),a.push(M,F,D)}}this.setIndex(a),this.setAttribute("position",new le(l,3)),this.setAttribute("normal",new le(c,3)),this.setAttribute("uv",new le(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Pc(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Lc extends Be{constructor(t=1,e=32,i=16,s=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:s,phiLength:r,thetaStart:o,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new I,d=new I,p=[],v=[],x=[],m=[];for(let f=0;f<=i;f++){const R=[],w=f/i;let M=0;f===0&&o===0?M=.5/e:f===i&&l===Math.PI&&(M=-.5/e);for(let F=0;F<=e;F++){const D=F/e;h.x=-t*Math.cos(s+D*r)*Math.sin(o+w*a),h.y=t*Math.cos(o+w*a),h.z=t*Math.sin(s+D*r)*Math.sin(o+w*a),v.push(h.x,h.y,h.z),d.copy(h).normalize(),x.push(d.x,d.y,d.z),m.push(D+M,1-w),R.push(c++)}u.push(R)}for(let f=0;f<i;f++)for(let R=0;R<e;R++){const w=u[f][R+1],M=u[f][R],F=u[f+1][R],D=u[f+1][R+1];(f!==0||o>0)&&p.push(w,M,D),(f!==i-1||l<Math.PI)&&p.push(M,F,D)}this.setIndex(p),this.setAttribute("position",new le(v,3)),this.setAttribute("normal",new le(x,3)),this.setAttribute("uv",new le(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Lc(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class zi extends Be{constructor(t=1,e=.4,i=12,s=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:s,arc:r},i=Math.floor(i),s=Math.floor(s);const o=[],a=[],l=[],c=[],u=new I,h=new I,d=new I;for(let p=0;p<=i;p++)for(let v=0;v<=s;v++){const x=v/s*r,m=p/i*Math.PI*2;h.x=(t+e*Math.cos(m))*Math.cos(x),h.y=(t+e*Math.cos(m))*Math.sin(x),h.z=e*Math.sin(m),a.push(h.x,h.y,h.z),u.x=t*Math.cos(x),u.y=t*Math.sin(x),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(v/s),c.push(p/i)}for(let p=1;p<=i;p++)for(let v=1;v<=s;v++){const x=(s+1)*p+v-1,m=(s+1)*(p-1)+v-1,f=(s+1)*(p-1)+v,R=(s+1)*p+v;o.push(x,m,R),o.push(m,f,R)}this.setIndex(o),this.setAttribute("position",new le(a,3)),this.setAttribute("normal",new le(l,3)),this.setAttribute("uv",new le(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new zi(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Ys extends Is{static get type(){return"MeshLambertMaterial"}constructor(t){super(),this.isMeshLambertMaterial=!0,this.color=new kt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new kt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ed,this.normalScale=new Mt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new gn,this.combine=_c,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Rd extends Se{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new kt(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(e.object.target=this.target.uuid),e}}const ka=new ae,Sh=new I,Eh=new I;class kM{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Mt(512,512),this.map=null,this.mapPass=null,this.matrix=new ae,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new bc,this._frameExtents=new Mt(1,1),this._viewportCount=1,this._viewports=[new xe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;Sh.setFromMatrixPosition(t.matrixWorld),e.position.copy(Sh),Eh.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Eh),e.updateMatrixWorld(),ka.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ka),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ka)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class VM extends kM{constructor(){super(new dd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class GM extends Rd{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Se.DEFAULT_UP),this.updateMatrix(),this.target=new Se,this.shadow=new VM}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class WM extends Rd{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}const bh=new ae;class Cd{constructor(t,e,i=0,s=1/0){this.ray=new Yo(t,e),this.near=i,this.far=s,this.camera=null,this.layers=new Ec,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return bh.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(bh),this}intersectObject(t,e=!0,i=[]){return ql(t,this,i,e),i.sort(Th),i}intersectObjects(t,e=!0,i=[]){for(let s=0,r=t.length;s<r;s++)ql(t[s],this,i,e);return i.sort(Th),i}}function Th(n,t){return n.distance-t.distance}function ql(n,t,e,i){let s=!0;if(n.layers.test(t.layers)&&n.raycast(t,e)===!1&&(s=!1),s===!0&&i===!0){const r=n.children;for(let o=0,a=r.length;o<a;o++)ql(r[o],t,e,!0)}}class wh{constructor(t=1,e=0,i=0){return this.radius=t,this.phi=e,this.theta=i,this}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(Ce(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Pd extends ji{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:mc}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=mc);const Ah={type:"change"},Dc={type:"start"},Ld={type:"end"},so=new Yo,Rh=new fi,XM=Math.cos(70*j_.DEG2RAD),Ee=new I,Xe=2*Math.PI,re={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Va=1e-6;class YM extends Pd{constructor(t,e=null){super(t,e),this.state=re.NONE,this.enabled=!0,this.target=new I,this.cursor=new I,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Yn.ROTATE,MIDDLE:Yn.DOLLY,RIGHT:Yn.PAN},this.touches={ONE:fs.ROTATE,TWO:fs.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new I,this._lastQuaternion=new Re,this._lastTargetPosition=new I,this._quat=new Re().setFromUnitVectors(t.up,new I(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new wh,this._sphericalDelta=new wh,this._scale=1,this._panOffset=new I,this._rotateStart=new Mt,this._rotateEnd=new Mt,this._rotateDelta=new Mt,this._panStart=new Mt,this._panEnd=new Mt,this._panDelta=new Mt,this._dollyStart=new Mt,this._dollyEnd=new Mt,this._dollyDelta=new Mt,this._dollyDirection=new I,this._mouse=new Mt,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=jM.bind(this),this._onPointerDown=qM.bind(this),this._onPointerUp=ZM.bind(this),this._onContextMenu=nS.bind(this),this._onMouseWheel=JM.bind(this),this._onKeyDown=QM.bind(this),this._onTouchStart=tS.bind(this),this._onTouchMove=eS.bind(this),this._onMouseDown=KM.bind(this),this._onMouseMove=$M.bind(this),this._interceptControlDown=iS.bind(this),this._interceptControlUp=sS.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Ah),this.update(),this.state=re.NONE}update(t=null){const e=this.object.position;Ee.copy(e).sub(this.target),Ee.applyQuaternion(this._quat),this._spherical.setFromVector3(Ee),this.autoRotate&&this.state===re.NONE&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(i)&&isFinite(s)&&(i<-Math.PI?i+=Xe:i>Math.PI&&(i-=Xe),s<-Math.PI?s+=Xe:s>Math.PI&&(s-=Xe),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 r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=o!=this._spherical.radius}if(Ee.setFromSpherical(this._spherical),Ee.applyQuaternion(this._quatInverse),e.copy(this.target).add(Ee),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Ee.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),r=!!l}else if(this.object.isOrthographicCamera){const a=new I(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(),r=l!==this.object.zoom;const c=new I(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Ee.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(so.origin.copy(this.object.position),so.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(so.direction))<XM?this.object.lookAt(this.target):(Rh.setFromNormalAndCoplanarPoint(this.object.up,this.target),so.intersectPlane(Rh,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>Va||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Va||this._lastTargetPosition.distanceToSquared(this.target)>Va?(this.dispatchEvent(Ah),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?Xe/60*this.autoRotateSpeed*t:Xe/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){Ee.setFromMatrixColumn(e,0),Ee.multiplyScalar(-t),this._panOffset.add(Ee)}_panUp(t,e){this.screenSpacePanning===!0?Ee.setFromMatrixColumn(e,1):(Ee.setFromMatrixColumn(e,0),Ee.crossVectors(this.object.up,Ee)),Ee.multiplyScalar(t),this._panOffset.add(Ee)}_pan(t,e){const i=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;Ee.copy(s).sub(this.target);let r=Ee.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*r/i.clientHeight,this.object.matrix),this._panUp(2*e*r/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(e*(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(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),s=t-i.left,r=e-i.top,o=i.width,a=i.height;this._mouse.x=s/o*2-1,this._mouse.y=-(r/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Xe*this._rotateDelta.x/e.clientHeight),this._rotateUp(Xe*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.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(t){this._panEnd.set(t.clientX,t.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(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this._rotateUp(Xe*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this._rotateUp(-Xe*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this._rotateLeft(Xe*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this._rotateLeft(-Xe*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),s=.5*(t.pageY+e.y);this._rotateStart.set(i,s)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),s=.5*(t.pageY+e.y);this._panStart.set(i,s)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),i=t.pageX-e.x,s=t.pageY-e.y,r=Math.sqrt(i*i+s*s);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t),s=.5*(t.pageX+i.x),r=.5*(t.pageY+i.y);this._rotateEnd.set(s,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Xe*this._rotateDelta.x/e.clientHeight),this._rotateUp(Xe*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),i=.5*(t.pageX+e.x),s=.5*(t.pageY+e.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(t){const e=this._getSecondPointerPosition(t),i=t.pageX-e.x,s=t.pageY-e.y,r=Math.sqrt(i*i+s*s);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(t.pageX+e.x)*.5,a=(t.pageY+e.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];e===void 0&&(e=new Mt,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,i={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return t.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function qM(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n)))}function jM(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function ZM(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Ld),this.state=re.NONE;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y});break}}function KM(n){let t;switch(n.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Yn.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=re.DOLLY;break;case Yn.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=re.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=re.ROTATE}break;case Yn.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=re.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=re.PAN}break;default:this.state=re.NONE}this.state!==re.NONE&&this.dispatchEvent(Dc)}function $M(n){switch(this.state){case re.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case re.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case re.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function JM(n){this.enabled===!1||this.enableZoom===!1||this.state!==re.NONE||(n.preventDefault(),this.dispatchEvent(Dc),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Ld))}function QM(n){this.enabled===!1||this.enablePan===!1||this._handleKeyDown(n)}function tS(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case fs.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=re.TOUCH_ROTATE;break;case fs.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=re.TOUCH_PAN;break;default:this.state=re.NONE}break;case 2:switch(this.touches.TWO){case fs.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=re.TOUCH_DOLLY_PAN;break;case fs.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=re.TOUCH_DOLLY_ROTATE;break;default:this.state=re.NONE}break;default:this.state=re.NONE}this.state!==re.NONE&&this.dispatchEvent(Dc)}function eS(n){switch(this._trackPointer(n),this.state){case re.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case re.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case re.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case re.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=re.NONE}}function nS(n){this.enabled!==!1&&n.preventDefault()}function iS(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function sS(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const Ii=new Cd,Ue=new I,li=new I,pe=new Re,Ch={X:new I(1,0,0),Y:new I(0,1,0),Z:new I(0,0,1)},Ga={type:"change"},Ph={type:"mouseDown",mode:null},Lh={type:"mouseUp",mode:null},Dh={type:"objectChange"};class rS extends Pd{constructor(t,e=null){super(void 0,e);const i=new hS(this);this._root=i;const s=new fS;this._gizmo=s,i.add(s);const r=new dS;this._plane=r,i.add(r);const o=this;function a(w,M){let F=M;Object.defineProperty(o,w,{get:function(){return F!==void 0?F:M},set:function(D){F!==D&&(F=D,r[w]=D,s[w]=D,o.dispatchEvent({type:w+"-changed",value:D}),o.dispatchEvent(Ga))}}),o[w]=M,r[w]=M,s[w]=M}a("camera",t),a("object",void 0),a("enabled",!0),a("axis",null),a("mode","translate"),a("translationSnap",null),a("rotationSnap",null),a("scaleSnap",null),a("space","world"),a("size",1),a("dragging",!1),a("showX",!0),a("showY",!0),a("showZ",!0),a("minX",-1/0),a("maxX",1/0),a("minY",-1/0),a("maxY",1/0),a("minZ",-1/0),a("maxZ",1/0);const l=new I,c=new I,u=new Re,h=new Re,d=new I,p=new Re,v=new I,x=new I,m=new I,f=0,R=new I;a("worldPosition",l),a("worldPositionStart",c),a("worldQuaternion",u),a("worldQuaternionStart",h),a("cameraPosition",d),a("cameraQuaternion",p),a("pointStart",v),a("pointEnd",x),a("rotationAxis",m),a("rotationAngle",f),a("eye",R),this._offset=new I,this._startNorm=new I,this._endNorm=new I,this._cameraScale=new I,this._parentPosition=new I,this._parentQuaternion=new Re,this._parentQuaternionInv=new Re,this._parentScale=new I,this._worldScaleStart=new I,this._worldQuaternionInv=new Re,this._worldScale=new I,this._positionStart=new I,this._quaternionStart=new Re,this._scaleStart=new I,this._getPointer=oS.bind(this),this._onPointerDown=lS.bind(this),this._onPointerHover=aS.bind(this),this._onPointerMove=cS.bind(this),this._onPointerUp=uS.bind(this),e!==null&&this.connect()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(t){if(this.object===void 0||this.dragging===!0)return;t!==null&&Ii.setFromCamera(t,this.camera);const e=Wa(this._gizmo.picker[this.mode],Ii);e?this.axis=e.object.name:this.axis=null}pointerDown(t){if(!(this.object===void 0||this.dragging===!0||t!=null&&t.button!==0)&&this.axis!==null){t!==null&&Ii.setFromCamera(t,this.camera);const e=Wa(this._plane,Ii,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,Ph.mode=this.mode,this.dispatchEvent(Ph)}}pointerMove(t){const e=this.axis,i=this.mode,s=this.object;let r=this.space;if(i==="scale"?r="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(r="world"),s===void 0||e===null||this.dragging===!1||t!==null&&t.button!==-1)return;t!==null&&Ii.setFromCamera(t,this.camera);const o=Wa(this._plane,Ii,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),r==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),r==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(r==="local"&&(s.position.applyQuaternion(pe.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),r==="world"&&(s.parent&&s.position.add(Ue.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Ue.setFromMatrixPosition(s.parent.matrixWorld)))),s.position.x=Math.max(this.minX,Math.min(this.maxX,s.position.x)),s.position.y=Math.max(this.minY,Math.min(this.maxY,s.position.y)),s.position.z=Math.max(this.minZ,Math.min(this.maxZ,s.position.z));else if(i==="scale"){if(e.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),li.set(a,a,a)}else Ue.copy(this.pointStart),li.copy(this.pointEnd),Ue.applyQuaternion(this._worldQuaternionInv),li.applyQuaternion(this._worldQuaternionInv),li.divide(Ue),e.search("X")===-1&&(li.x=1),e.search("Y")===-1&&(li.y=1),e.search("Z")===-1&&(li.z=1);s.scale.copy(this._scaleStart).multiply(li),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Ue.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Ue.copy(this.rotationAxis).cross(this.eye))*a):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(Ch[e]),Ue.copy(Ch[e]),r==="local"&&Ue.applyQuaternion(this.worldQuaternion),Ue.cross(this.eye),Ue.length()===0?l=!0:this.rotationAngle=this._offset.dot(Ue.normalize())*a),(e==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),r==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(pe.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(pe.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Ga),this.dispatchEvent(Dh)}}pointerUp(t){t!==null&&t.button!==0||(this.dragging&&this.axis!==null&&(Lh.mode=this.mode,this.dispatchEvent(Lh)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(t){return this.object=t,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Ga),this.dispatchEvent(Dh),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Ii}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}}function oS(n){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:n.button};{const t=this.domElement.getBoundingClientRect();return{x:(n.clientX-t.left)/t.width*2-1,y:-(n.clientY-t.top)/t.height*2+1,button:n.button}}}function aS(n){if(this.enabled)switch(n.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(n));break}}function lS(n){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(n)),this.pointerDown(this._getPointer(n)))}function cS(n){this.enabled&&this.pointerMove(this._getPointer(n))}function uS(n){this.enabled&&(this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(n)))}function Wa(n,t,e){const i=t.intersectObject(n,!0);for(let s=0;s<i.length;s++)if(i[s].object.visible||e)return i[s];return!1}const ro=new gn,oe=new I(0,1,0),Ih=new I(0,0,0),Uh=new ae,oo=new Re,xo=new Re,yn=new I,Nh=new ae,Js=new I(1,0,0),Oi=new I(0,1,0),Qs=new I(0,0,1),ao=new I,qs=new I,js=new I;class hS extends Se{constructor(t){super(),this.isTransformControlsRoot=!0,this.controls=t,this.visible=!1}updateMatrixWorld(t){const e=this.controls;e.object!==void 0&&(e.object.updateMatrixWorld(),e.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):e.object.parent.matrixWorld.decompose(e._parentPosition,e._parentQuaternion,e._parentScale),e.object.matrixWorld.decompose(e.worldPosition,e.worldQuaternion,e._worldScale),e._parentQuaternionInv.copy(e._parentQuaternion).invert(),e._worldQuaternionInv.copy(e.worldQuaternion).invert()),e.camera.updateMatrixWorld(),e.camera.matrixWorld.decompose(e.cameraPosition,e.cameraQuaternion,e._cameraScale),e.camera.isOrthographicCamera?e.camera.getWorldDirection(e.eye).negate():e.eye.copy(e.cameraPosition).sub(e.worldPosition).normalize(),super.updateMatrixWorld(t)}dispose(){this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}}class fS extends Se{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const t=new Tr({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new xd({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=t.clone();i.opacity=.15;const s=e.clone();s.opacity=.5;const r=t.clone();r.color.setHex(16711680);const o=t.clone();o.color.setHex(65280);const a=t.clone();a.color.setHex(255);const l=t.clone();l.color.setHex(16711680),l.opacity=.5;const c=t.clone();c.color.setHex(65280),c.opacity=.5;const u=t.clone();u.color.setHex(255),u.opacity=.5;const h=t.clone();h.opacity=.25;const d=t.clone();d.color.setHex(16776960),d.opacity=.25,t.clone().color.setHex(16776960);const v=t.clone();v.color.setHex(7895160);const x=new Ie(0,.04,.1,12);x.translate(0,.05,0);const m=new me(.08,.08,.08);m.translate(0,.04,0);const f=new Be;f.setAttribute("position",new le([0,0,0,1,0,0],3));const R=new Ie(.0075,.0075,.5,3);R.translate(0,.25,0);function w(st,Q){const V=new zi(st,.0075,3,64,Q*Math.PI*2);return V.rotateY(Math.PI/2),V.rotateX(Math.PI/2),V}function M(){const st=new Be;return st.setAttribute("position",new le([0,0,0,1,1,1],3)),st}const F={X:[[new Rt(x,r),[.5,0,0],[0,0,-Math.PI/2]],[new Rt(x,r),[-.5,0,0],[0,0,Math.PI/2]],[new Rt(R,r),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new Rt(x,o),[0,.5,0]],[new Rt(x,o),[0,-.5,0],[Math.PI,0,0]],[new Rt(R,o)]],Z:[[new Rt(x,a),[0,0,.5],[Math.PI/2,0,0]],[new Rt(x,a),[0,0,-.5],[-Math.PI/2,0,0]],[new Rt(R,a),null,[Math.PI/2,0,0]]],XYZ:[[new Rt(new ms(.1,0),h.clone()),[0,0,0]]],XY:[[new Rt(new me(.15,.15,.01),u.clone()),[.15,.15,0]]],YZ:[[new Rt(new me(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Rt(new me(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},D={X:[[new Rt(new Ie(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new Rt(new Ie(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new Rt(new Ie(.2,0,.6,4),i),[0,.3,0]],[new Rt(new Ie(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new Rt(new Ie(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new Rt(new Ie(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new Rt(new ms(.2,0),i)]],XY:[[new Rt(new me(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new Rt(new me(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Rt(new me(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},L={START:[[new Rt(new ms(.01,2),s),null,null,null,"helper"]],END:[[new Rt(new ms(.01,2),s),null,null,null,"helper"]],DELTA:[[new ai(M(),s),null,null,null,"helper"]],X:[[new ai(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ai(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ai(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},b={XYZE:[[new Rt(w(.5,1),v),null,[0,Math.PI/2,0]]],X:[[new Rt(w(.5,.5),r)]],Y:[[new Rt(w(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new Rt(w(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new Rt(w(.75,1),d),null,[0,Math.PI/2,0]]]},_={AXIS:[[new ai(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},g={XYZE:[[new Rt(new Lc(.25,10,8),i)]],X:[[new Rt(new zi(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new Rt(new zi(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new Rt(new zi(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new Rt(new zi(.75,.1,2,24),i)]]},A={X:[[new Rt(m,r),[.5,0,0],[0,0,-Math.PI/2]],[new Rt(R,r),[0,0,0],[0,0,-Math.PI/2]],[new Rt(m,r),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new Rt(m,o),[0,.5,0]],[new Rt(R,o)],[new Rt(m,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new Rt(m,a),[0,0,.5],[Math.PI/2,0,0]],[new Rt(R,a),[0,0,0],[Math.PI/2,0,0]],[new Rt(m,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new Rt(new me(.15,.15,.01),u),[.15,.15,0]]],YZ:[[new Rt(new me(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Rt(new me(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new Rt(new me(.1,.1,.1),h.clone())]]},O={X:[[new Rt(new Ie(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new Rt(new Ie(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new Rt(new Ie(.2,0,.6,4),i),[0,.3,0]],[new Rt(new Ie(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new Rt(new Ie(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new Rt(new Ie(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new Rt(new me(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new Rt(new me(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Rt(new me(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new Rt(new me(.2,.2,.2),i),[0,0,0]]]},k={X:[[new ai(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ai(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ai(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function J(st){const Q=new Se;for(const V in st)for(let G=st[V].length;G--;){const it=st[V][G][0].clone(),vt=st[V][G][1],W=st[V][G][2],rt=st[V][G][3],ct=st[V][G][4];it.name=V,it.tag=ct,vt&&it.position.set(vt[0],vt[1],vt[2]),W&&it.rotation.set(W[0],W[1],W[2]),rt&&it.scale.set(rt[0],rt[1],rt[2]),it.updateMatrix();const $=it.geometry.clone();$.applyMatrix4(it.matrix),it.geometry=$,it.renderOrder=1/0,it.position.set(0,0,0),it.rotation.set(0,0,0),it.scale.set(1,1,1),Q.add(it)}return Q}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=J(F)),this.add(this.gizmo.rotate=J(b)),this.add(this.gizmo.scale=J(A)),this.add(this.picker.translate=J(D)),this.add(this.picker.rotate=J(g)),this.add(this.picker.scale=J(O)),this.add(this.helper.translate=J(L)),this.add(this.helper.rotate=J(_)),this.add(this.helper.scale=J(k)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:xo;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let r=0;r<s.length;r++){const o=s[r];o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(a*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(pe.setFromEuler(ro.set(0,0,0)),o.quaternion.copy(i).multiply(pe),Math.abs(oe.copy(Js).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(pe.setFromEuler(ro.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(pe),Math.abs(oe.copy(Oi).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(pe.setFromEuler(ro.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(pe),Math.abs(oe.copy(Qs).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(pe.setFromEuler(ro.set(0,Math.PI/2,0)),oe.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(Uh.lookAt(Ih,oe,Oi)),o.quaternion.multiply(pe),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Ue.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Ue.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Ue),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(oe.copy(Js).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(oe.copy(Oi).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(oe.copy(Qs).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(oe.copy(Qs).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(oe.copy(Js).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(oe.copy(Oi).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(oo.copy(i),oe.copy(this.eye).applyQuaternion(pe.copy(i).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(Uh.lookAt(this.eye,Ih,Oi)),o.name==="X"&&(pe.setFromAxisAngle(Js,Math.atan2(-oe.y,oe.z)),pe.multiplyQuaternions(oo,pe),o.quaternion.copy(pe)),o.name==="Y"&&(pe.setFromAxisAngle(Oi,Math.atan2(oe.x,oe.z)),pe.multiplyQuaternions(oo,pe),o.quaternion.copy(pe)),o.name==="Z"&&(pe.setFromAxisAngle(Qs,Math.atan2(oe.y,oe.x)),pe.multiplyQuaternions(oo,pe),o.quaternion.copy(pe))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(t)}}class dS extends Rt{constructor(){super(new Us(1e5,1e5,2,2),new Tr({visible:!1,wireframe:!0,side:rn,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),ao.copy(Js).applyQuaternion(e==="local"?this.worldQuaternion:xo),qs.copy(Oi).applyQuaternion(e==="local"?this.worldQuaternion:xo),js.copy(Qs).applyQuaternion(e==="local"?this.worldQuaternion:xo),oe.copy(qs),this.mode){case"translate":case"scale":switch(this.axis){case"X":oe.copy(this.eye).cross(ao),yn.copy(ao).cross(oe);break;case"Y":oe.copy(this.eye).cross(qs),yn.copy(qs).cross(oe);break;case"Z":oe.copy(this.eye).cross(js),yn.copy(js).cross(oe);break;case"XY":yn.copy(js);break;case"YZ":yn.copy(ao);break;case"XZ":oe.copy(js),yn.copy(qs);break;case"XYZ":case"E":yn.set(0,0,0);break}break;case"rotate":default:yn.set(0,0,0)}yn.length()===0?this.quaternion.copy(this.cameraQuaternion):(Nh.lookAt(Ue.set(0,0,0),yn,oe),this.quaternion.setFromRotationMatrix(Nh)),super.updateMatrixWorld(t)}}function Dd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var yo={exports:{}};/* @license
|
||
Papa Parse
|
||
v5.5.3
|
||
https://github.com/mholt/PapaParse
|
||
License: MIT
|
||
*/var pS=yo.exports,Oh;function mS(){return Oh||(Oh=1,(function(n,t){((e,i)=>{n.exports=i()})(pS,function e(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},s,r=!i.document&&!!i.postMessage,o=i.IS_PAPA_WORKER||!1,a={},l=0,c={};function u(b){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(_){var g=F(_);g.chunkSize=parseInt(g.chunkSize),_.step||_.chunk||(g.chunkSize=null),this._handle=new x(g),(this._handle.streamer=this)._config=g}).call(this,b),this.parseChunk=function(_,g){var A=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<A){let k=this._config.newline;k||(O=this._config.quoteChar||'"',k=this._handle.guessLineEndings(_,O)),_=[..._.split(k).slice(A)].join(k)}this.isFirstChunk&&L(this._config.beforeFirstChunk)&&(O=this._config.beforeFirstChunk(_))!==void 0&&(_=O),this.isFirstChunk=!1,this._halted=!1;var A=this._partialLine+_,O=(this._partialLine="",this._handle.parse(A,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(_=O.meta.cursor,A=(this._finished||(this._partialLine=A.substring(_-this._baseIndex),this._baseIndex=_),O&&O.data&&(this._rowCount+=O.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:O,workerId:c.WORKER_ID,finished:A});else if(L(this._config.chunk)&&!g){if(this._config.chunk(O,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=O=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(O.data),this._completeResults.errors=this._completeResults.errors.concat(O.errors),this._completeResults.meta=O.meta),this._completed||!A||!L(this._config.complete)||O&&O.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),A||O&&O.meta.paused||this._nextChunk(),O}this._halted=!0},this._sendError=function(_){L(this._config.error)?this._config.error(_):o&&this._config.error&&i.postMessage({workerId:c.WORKER_ID,error:_,finished:!1})}}function h(b){var _;(b=b||{}).chunkSize||(b.chunkSize=c.RemoteChunkSize),u.call(this,b),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(g){this._input=g,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(_=new XMLHttpRequest,this._config.withCredentials&&(_.withCredentials=this._config.withCredentials),r||(_.onload=D(this._chunkLoaded,this),_.onerror=D(this._chunkError,this)),_.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var g,A=this._config.downloadRequestHeaders;for(g in A)_.setRequestHeader(g,A[g])}var O;this._config.chunkSize&&(O=this._start+this._config.chunkSize-1,_.setRequestHeader("Range","bytes="+this._start+"-"+O));try{_.send(this._config.downloadRequestBody)}catch(k){this._chunkError(k.message)}r&&_.status===0&&this._chunkError()}},this._chunkLoaded=function(){_.readyState===4&&(_.status<200||400<=_.status?this._chunkError():(this._start+=this._config.chunkSize||_.responseText.length,this._finished=!this._config.chunkSize||this._start>=(g=>(g=g.getResponseHeader("Content-Range"))!==null?parseInt(g.substring(g.lastIndexOf("/")+1)):-1)(_),this.parseChunk(_.responseText)))},this._chunkError=function(g){g=_.statusText||g,this._sendError(new Error(g))}}function d(b){(b=b||{}).chunkSize||(b.chunkSize=c.LocalChunkSize),u.call(this,b);var _,g,A=typeof FileReader<"u";this.stream=function(O){this._input=O,g=O.slice||O.webkitSlice||O.mozSlice,A?((_=new FileReader).onload=D(this._chunkLoaded,this),_.onerror=D(this._chunkError,this)):_=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var O=this._input,k=(this._config.chunkSize&&(k=Math.min(this._start+this._config.chunkSize,this._input.size),O=g.call(O,this._start,k)),_.readAsText(O,this._config.encoding));A||this._chunkLoaded({target:{result:k}})},this._chunkLoaded=function(O){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(O.target.result)},this._chunkError=function(){this._sendError(_.error)}}function p(b){var _;u.call(this,b=b||{}),this.stream=function(g){return _=g,this._nextChunk()},this._nextChunk=function(){var g,A;if(!this._finished)return g=this._config.chunkSize,_=g?(A=_.substring(0,g),_.substring(g)):(A=_,""),this._finished=!_,this.parseChunk(A)}}function v(b){u.call(this,b=b||{});var _=[],g=!0,A=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(O){this._input=O,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){A&&_.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),_.length?this.parseChunk(_.shift()):g=!0},this._streamData=D(function(O){try{_.push(typeof O=="string"?O:O.toString(this._config.encoding)),g&&(g=!1,this._checkIsFinished(),this.parseChunk(_.shift()))}catch(k){this._streamError(k)}},this),this._streamError=D(function(O){this._streamCleanUp(),this._sendError(O)},this),this._streamEnd=D(function(){this._streamCleanUp(),A=!0,this._streamData("")},this),this._streamCleanUp=D(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function x(b){var _,g,A,O,k=Math.pow(2,53),J=-k,st=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Q=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,V=this,G=0,it=0,vt=!1,W=!1,rt=[],ct={data:[],errors:[],meta:{}};function $(et){return b.skipEmptyLines==="greedy"?et.join("").trim()==="":et.length===1&&et[0].length===0}function lt(){if(ct&&A&&(ut("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+c.DefaultDelimiter+"'"),A=!1),b.skipEmptyLines&&(ct.data=ct.data.filter(function(T){return!$(T)})),pt()){let T=function(C,S){L(b.transformHeader)&&(C=b.transformHeader(C,S)),rt.push(C)};var yt=T;if(ct)if(Array.isArray(ct.data[0])){for(var et=0;pt()&&et<ct.data.length;et++)ct.data[et].forEach(T);ct.data.splice(0,1)}else ct.data.forEach(T)}function ft(T,C){for(var S=b.header?{}:[],H=0;H<T.length;H++){var U=H,z=T[H],z=((B,tt)=>(j=>(b.dynamicTypingFunction&&b.dynamicTyping[j]===void 0&&(b.dynamicTyping[j]=b.dynamicTypingFunction(j)),(b.dynamicTyping[j]||b.dynamicTyping)===!0))(B)?tt==="true"||tt==="TRUE"||tt!=="false"&&tt!=="FALSE"&&((j=>{if(st.test(j)&&(j=parseFloat(j),J<j&&j<k))return 1})(tt)?parseFloat(tt):Q.test(tt)?new Date(tt):tt===""?null:tt):tt)(U=b.header?H>=rt.length?"__parsed_extra":rt[H]:U,z=b.transform?b.transform(z,U):z);U==="__parsed_extra"?(S[U]=S[U]||[],S[U].push(z)):S[U]=z}return b.header&&(H>rt.length?ut("FieldMismatch","TooManyFields","Too many fields: expected "+rt.length+" fields but parsed "+H,it+C):H<rt.length&&ut("FieldMismatch","TooFewFields","Too few fields: expected "+rt.length+" fields but parsed "+H,it+C)),S}var gt;ct&&(b.header||b.dynamicTyping||b.transform)&&(gt=1,!ct.data.length||Array.isArray(ct.data[0])?(ct.data=ct.data.map(ft),gt=ct.data.length):ct.data=ft(ct.data,0),b.header&&ct.meta&&(ct.meta.fields=rt),it+=gt)}function pt(){return b.header&&rt.length===0}function ut(et,ft,gt,yt){et={type:et,code:ft,message:gt},yt!==void 0&&(et.row=yt),ct.errors.push(et)}L(b.step)&&(O=b.step,b.step=function(et){ct=et,pt()?lt():(lt(),ct.data.length!==0&&(G+=et.data.length,b.preview&&G>b.preview?g.abort():(ct.data=ct.data[0],O(ct,V))))}),this.parse=function(et,ft,gt){var yt=b.quoteChar||'"',yt=(b.newline||(b.newline=this.guessLineEndings(et,yt)),A=!1,b.delimiter?L(b.delimiter)&&(b.delimiter=b.delimiter(et),ct.meta.delimiter=b.delimiter):((yt=((T,C,S,H,U)=>{var z,B,tt,j;U=U||[","," ","|",";",c.RECORD_SEP,c.UNIT_SEP];for(var E=0;E<U.length;E++){for(var y,N=U[E],X=0,nt=0,K=0,xt=(tt=void 0,new f({comments:H,delimiter:N,newline:C,preview:10}).parse(T)),dt=0;dt<xt.data.length;dt++)S&&$(xt.data[dt])?K++:(y=xt.data[dt].length,nt+=y,tt===void 0?tt=y:0<y&&(X+=Math.abs(y-tt),tt=y));0<xt.data.length&&(nt/=xt.data.length-K),(B===void 0||X<=B)&&(j===void 0||j<nt)&&1.99<nt&&(B=X,z=N,j=nt)}return{successful:!!(b.delimiter=z),bestDelimiter:z}})(et,b.newline,b.skipEmptyLines,b.comments,b.delimitersToGuess)).successful?b.delimiter=yt.bestDelimiter:(A=!0,b.delimiter=c.DefaultDelimiter),ct.meta.delimiter=b.delimiter),F(b));return b.preview&&b.header&&yt.preview++,_=et,g=new f(yt),ct=g.parse(_,ft,gt),lt(),vt?{meta:{paused:!0}}:ct||{meta:{paused:!1}}},this.paused=function(){return vt},this.pause=function(){vt=!0,g.abort(),_=L(b.chunk)?"":_.substring(g.getCharIndex())},this.resume=function(){V.streamer._halted?(vt=!1,V.streamer.parseChunk(_,!0)):setTimeout(V.resume,3)},this.aborted=function(){return W},this.abort=function(){W=!0,g.abort(),ct.meta.aborted=!0,L(b.complete)&&b.complete(ct),_=""},this.guessLineEndings=function(T,yt){T=T.substring(0,1048576);var yt=new RegExp(m(yt)+"([^]*?)"+m(yt),"gm"),gt=(T=T.replace(yt,"")).split("\r"),yt=T.split(`
|
||
`),T=1<yt.length&&yt[0].length<gt[0].length;if(gt.length===1||T)return`
|
||
`;for(var C=0,S=0;S<gt.length;S++)gt[S][0]===`
|
||
`&&C++;return C>=gt.length/2?`\r
|
||
`:"\r"}}function m(b){return b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(b){var _=(b=b||{}).delimiter,g=b.newline,A=b.comments,O=b.step,k=b.preview,J=b.fastMode,st=null,Q=!1,V=b.quoteChar==null?'"':b.quoteChar,G=V;if(b.escapeChar!==void 0&&(G=b.escapeChar),(typeof _!="string"||-1<c.BAD_DELIMITERS.indexOf(_))&&(_=","),A===_)throw new Error("Comment character same as delimiter");A===!0?A="#":(typeof A!="string"||-1<c.BAD_DELIMITERS.indexOf(A))&&(A=!1),g!==`
|
||
`&&g!=="\r"&&g!==`\r
|
||
`&&(g=`
|
||
`);var it=0,vt=!1;this.parse=function(W,rt,ct){if(typeof W!="string")throw new Error("Input must be a string");var $=W.length,lt=_.length,pt=g.length,ut=A.length,et=L(O),ft=[],gt=[],yt=[],T=it=0;if(!W)return X();if(J||J!==!1&&W.indexOf(V)===-1){for(var C=W.split(g),S=0;S<C.length;S++){if(yt=C[S],it+=yt.length,S!==C.length-1)it+=g.length;else if(ct)return X();if(!A||yt.substring(0,ut)!==A){if(et){if(ft=[],j(yt.split(_)),nt(),vt)return X()}else j(yt.split(_));if(k&&k<=S)return ft=ft.slice(0,k),X(!0)}}return X()}for(var H=W.indexOf(_,it),U=W.indexOf(g,it),z=new RegExp(m(G)+m(V),"g"),B=W.indexOf(V,it);;)if(W[it]===V)for(B=it,it++;;){if((B=W.indexOf(V,B+1))===-1)return ct||gt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:ft.length,index:it}),y();if(B===$-1)return y(W.substring(it,B).replace(z,V));if(V===G&&W[B+1]===G)B++;else if(V===G||B===0||W[B-1]!==G){H!==-1&&H<B+1&&(H=W.indexOf(_,B+1));var tt=E((U=U!==-1&&U<B+1?W.indexOf(g,B+1):U)===-1?H:Math.min(H,U));if(W.substr(B+1+tt,lt)===_){yt.push(W.substring(it,B).replace(z,V)),W[it=B+1+tt+lt]!==V&&(B=W.indexOf(V,it)),H=W.indexOf(_,it),U=W.indexOf(g,it);break}if(tt=E(U),W.substring(B+1+tt,B+1+tt+pt)===g){if(yt.push(W.substring(it,B).replace(z,V)),N(B+1+tt+pt),H=W.indexOf(_,it),B=W.indexOf(V,it),et&&(nt(),vt))return X();if(k&&ft.length>=k)return X(!0);break}gt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:ft.length,index:it}),B++}}else if(A&&yt.length===0&&W.substring(it,it+ut)===A){if(U===-1)return X();it=U+pt,U=W.indexOf(g,it),H=W.indexOf(_,it)}else if(H!==-1&&(H<U||U===-1))yt.push(W.substring(it,H)),it=H+lt,H=W.indexOf(_,it);else{if(U===-1)break;if(yt.push(W.substring(it,U)),N(U+pt),et&&(nt(),vt))return X();if(k&&ft.length>=k)return X(!0)}return y();function j(K){ft.push(K),T=it}function E(K){var xt=0;return xt=K!==-1&&(K=W.substring(B+1,K))&&K.trim()===""?K.length:xt}function y(K){return ct||(K===void 0&&(K=W.substring(it)),yt.push(K),it=$,j(yt),et&&nt()),X()}function N(K){it=K,j(yt),yt=[],U=W.indexOf(g,it)}function X(K){if(b.header&&!rt&&ft.length&&!Q){var xt=ft[0],dt=Object.create(null),St=new Set(xt);let Ft=!1;for(let mt=0;mt<xt.length;mt++){let Et=xt[mt];if(dt[Et=L(b.transformHeader)?b.transformHeader(Et,mt):Et]){let Dt,Bt=dt[Et];for(;Dt=Et+"_"+Bt,Bt++,St.has(Dt););St.add(Dt),xt[mt]=Dt,dt[Et]++,Ft=!0,(st=st===null?{}:st)[Dt]=Et}else dt[Et]=1,xt[mt]=Et;St.add(Et)}Ft&&console.warn("Duplicate headers found and renamed."),Q=!0}return{data:ft,errors:gt,meta:{delimiter:_,linebreak:g,aborted:vt,truncated:!!K,cursor:T+(rt||0),renamedHeaders:st}}}function nt(){O(X()),ft=[],gt=[]}},this.abort=function(){vt=!0},this.getCharIndex=function(){return it}}function R(b){var _=b.data,g=a[_.workerId],A=!1;if(_.error)g.userError(_.error,_.file);else if(_.results&&_.results.data){var O={abort:function(){A=!0,w(_.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:M,resume:M};if(L(g.userStep)){for(var k=0;k<_.results.data.length&&(g.userStep({data:_.results.data[k],errors:_.results.errors,meta:_.results.meta},O),!A);k++);delete _.results}else L(g.userChunk)&&(g.userChunk(_.results,O,_.file),delete _.results)}_.finished&&!A&&w(_.workerId,_.results)}function w(b,_){var g=a[b];L(g.userComplete)&&g.userComplete(_),g.terminate(),delete a[b]}function M(){throw new Error("Not implemented.")}function F(b){if(typeof b!="object"||b===null)return b;var _,g=Array.isArray(b)?[]:{};for(_ in b)g[_]=F(b[_]);return g}function D(b,_){return function(){b.apply(_,arguments)}}function L(b){return typeof b=="function"}return c.parse=function(b,_){var g=(_=_||{}).dynamicTyping||!1;if(L(g)&&(_.dynamicTypingFunction=g,g={}),_.dynamicTyping=g,_.transform=!!L(_.transform)&&_.transform,!_.worker||!c.WORKERS_SUPPORTED)return g=null,c.NODE_STREAM_INPUT,typeof b=="string"?(b=(A=>A.charCodeAt(0)!==65279?A:A.slice(1))(b),g=new(_.download?h:p)(_)):b.readable===!0&&L(b.read)&&L(b.on)?g=new v(_):(i.File&&b instanceof File||b instanceof Object)&&(g=new d(_)),g.stream(b);(g=(()=>{var A;return!!c.WORKERS_SUPPORTED&&(A=(()=>{var O=i.URL||i.webkitURL||null,k=e.toString();return c.BLOB_URL||(c.BLOB_URL=O.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",k,")();"],{type:"text/javascript"})))})(),(A=new i.Worker(A)).onmessage=R,A.id=l++,a[A.id]=A)})()).userStep=_.step,g.userChunk=_.chunk,g.userComplete=_.complete,g.userError=_.error,_.step=L(_.step),_.chunk=L(_.chunk),_.complete=L(_.complete),_.error=L(_.error),delete _.worker,g.postMessage({input:b,config:_,workerId:g.id})},c.unparse=function(b,_){var g=!1,A=!0,O=",",k=`\r
|
||
`,J='"',st=J+J,Q=!1,V=null,G=!1,it=((()=>{if(typeof _=="object"){if(typeof _.delimiter!="string"||c.BAD_DELIMITERS.filter(function(rt){return _.delimiter.indexOf(rt)!==-1}).length||(O=_.delimiter),typeof _.quotes!="boolean"&&typeof _.quotes!="function"&&!Array.isArray(_.quotes)||(g=_.quotes),typeof _.skipEmptyLines!="boolean"&&typeof _.skipEmptyLines!="string"||(Q=_.skipEmptyLines),typeof _.newline=="string"&&(k=_.newline),typeof _.quoteChar=="string"&&(J=_.quoteChar),typeof _.header=="boolean"&&(A=_.header),Array.isArray(_.columns)){if(_.columns.length===0)throw new Error("Option columns is empty");V=_.columns}_.escapeChar!==void 0&&(st=_.escapeChar+J),_.escapeFormulae instanceof RegExp?G=_.escapeFormulae:typeof _.escapeFormulae=="boolean"&&_.escapeFormulae&&(G=/^[=+\-@\t\r].*$/)}})(),new RegExp(m(J),"g"));if(typeof b=="string"&&(b=JSON.parse(b)),Array.isArray(b)){if(!b.length||Array.isArray(b[0]))return vt(null,b,Q);if(typeof b[0]=="object")return vt(V||Object.keys(b[0]),b,Q)}else if(typeof b=="object")return typeof b.data=="string"&&(b.data=JSON.parse(b.data)),Array.isArray(b.data)&&(b.fields||(b.fields=b.meta&&b.meta.fields||V),b.fields||(b.fields=Array.isArray(b.data[0])?b.fields:typeof b.data[0]=="object"?Object.keys(b.data[0]):[]),Array.isArray(b.data[0])||typeof b.data[0]=="object"||(b.data=[b.data])),vt(b.fields||[],b.data||[],Q);throw new Error("Unable to serialize unrecognized input");function vt(rt,ct,$){var lt="",pt=(typeof rt=="string"&&(rt=JSON.parse(rt)),typeof ct=="string"&&(ct=JSON.parse(ct)),Array.isArray(rt)&&0<rt.length),ut=!Array.isArray(ct[0]);if(pt&&A){for(var et=0;et<rt.length;et++)0<et&&(lt+=O),lt+=W(rt[et],et);0<ct.length&&(lt+=k)}for(var ft=0;ft<ct.length;ft++){var gt=(pt?rt:ct[ft]).length,yt=!1,T=pt?Object.keys(ct[ft]).length===0:ct[ft].length===0;if($&&!pt&&(yt=$==="greedy"?ct[ft].join("").trim()==="":ct[ft].length===1&&ct[ft][0].length===0),$==="greedy"&&pt){for(var C=[],S=0;S<gt;S++){var H=ut?rt[S]:S;C.push(ct[ft][H])}yt=C.join("").trim()===""}if(!yt){for(var U=0;U<gt;U++){0<U&&!T&&(lt+=O);var z=pt&&ut?rt[U]:U;lt+=W(ct[ft][z],U)}ft<ct.length-1&&(!$||0<gt&&!T)&&(lt+=k)}}return lt}function W(rt,ct){var $,lt;return rt==null?"":rt.constructor===Date?JSON.stringify(rt).slice(1,25):(lt=!1,G&&typeof rt=="string"&&G.test(rt)&&(rt="'"+rt,lt=!0),$=rt.toString().replace(it,st),(lt=lt||g===!0||typeof g=="function"&&g(rt,ct)||Array.isArray(g)&&g[ct]||((pt,ut)=>{for(var et=0;et<ut.length;et++)if(-1<pt.indexOf(ut[et]))return!0;return!1})($,c.BAD_DELIMITERS)||-1<$.indexOf(O)||$.charAt(0)===" "||$.charAt($.length-1)===" ")?J+$+J:$)}},c.RECORD_SEP="",c.UNIT_SEP="",c.BYTE_ORDER_MARK="\uFEFF",c.BAD_DELIMITERS=["\r",`
|
||
`,'"',c.BYTE_ORDER_MARK],c.WORKERS_SUPPORTED=!r&&!!i.Worker,c.NODE_STREAM_INPUT=1,c.LocalChunkSize=10485760,c.RemoteChunkSize=5242880,c.DefaultDelimiter=",",c.Parser=f,c.ParserHandle=x,c.NetworkStreamer=h,c.FileStreamer=d,c.StringStreamer=p,c.ReadableStreamStreamer=v,i.jQuery&&((s=i.jQuery).fn.parse=function(b){var _=b.config||{},g=[];return this.each(function(k){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&i.FileReader)||!this.files||this.files.length===0)return!0;for(var J=0;J<this.files.length;J++)g.push({file:this.files[J],inputElem:this,instanceConfig:s.extend({},_)})}),A(),this;function A(){if(g.length===0)L(b.complete)&&b.complete();else{var k,J,st,Q,V=g[0];if(L(b.before)){var G=b.before(V.file,V.inputElem);if(typeof G=="object"){if(G.action==="abort")return k="AbortError",J=V.file,st=V.inputElem,Q=G.reason,void(L(b.error)&&b.error({name:k},J,st,Q));if(G.action==="skip")return void O();typeof G.config=="object"&&(V.instanceConfig=s.extend(V.instanceConfig,G.config))}else if(G==="skip")return void O()}var it=V.instanceConfig.complete;V.instanceConfig.complete=function(vt){L(it)&&it(vt,V.file,V.inputElem),O()},c.parse(V.file,V.instanceConfig)}}function O(){g.splice(0,1),A()}}),o&&(i.onmessage=function(b){b=b.data,c.WORKER_ID===void 0&&b&&(c.WORKER_ID=b.workerId),typeof b.input=="string"?i.postMessage({workerId:c.WORKER_ID,results:c.parse(b.input,b.config),finished:!0}):(i.File&&b.input instanceof File||b.input instanceof Object)&&(b=c.parse(b.input,b.config))&&i.postMessage({workerId:c.WORKER_ID,results:b,finished:!0})}),(h.prototype=Object.create(u.prototype)).constructor=h,(d.prototype=Object.create(u.prototype)).constructor=d,(p.prototype=Object.create(p.prototype)).constructor=p,(v.prototype=Object.create(u.prototype)).constructor=v,c})})(yo)),yo.exports}var _S=mS();const gS=Dd(_S),Lo=new Date,vS=new Date(Lo.getFullYear(),0,0),xS=Lo.getTime()-vS.getTime(),yS=1e3*60*60*24,MS=Math.floor(xS/yS),Mn=ac({currentTime:Lo.getHours()+Lo.getMinutes()/60,isPlaying:!1,speed:1,day:MS,totalSeconds:0}),SS=ac(null),Ic=()=>({state:Mn,selectedBuilding:SS,togglePlay:()=>{Mn.value.isPlaying=!Mn.value.isPlaying},setSpeed:s=>{Mn.value.speed=s},loadBuildingData:(s,r)=>(console.log(`Loading data for ${s} from ${r}`),new Promise((o,a)=>{gS.parse(r,{download:!0,header:!0,dynamicTyping:!0,complete:l=>{o(l.data)},error:l=>{a(l)}})})),updateTime:s=>{Mn.value.isPlaying&&(Mn.value.currentTime+=s*Mn.value.speed,Mn.value.currentTime>=24&&(Mn.value.currentTime=0,Mn.value.day++))}});var Xa={exports:{}},Fh;function ES(){return Fh||(Fh=1,(function(n,t){(function(){var e=Math.PI,i=Math.sin,s=Math.cos,r=Math.tan,o=Math.asin,a=Math.atan2,l=Math.acos,c=e/180,u=1e3*60*60*24,h=2440588,d=2451545;function p(W){return W.valueOf()/u-.5+h}function v(W){return new Date((W+.5-h)*u)}function x(W){return p(W)-d}var m=c*23.4397;function f(W,rt){return a(i(W)*s(m)-r(rt)*i(m),s(W))}function R(W,rt){return o(i(rt)*s(m)+s(rt)*i(m)*i(W))}function w(W,rt,ct){return a(i(W),s(W)*i(rt)-r(ct)*s(rt))}function M(W,rt,ct){return o(i(rt)*i(ct)+s(rt)*s(ct)*s(W))}function F(W,rt){return c*(280.16+360.9856235*W)-rt}function D(W){return W<0&&(W=0),2967e-7/Math.tan(W+.00312536/(W+.08901179))}function L(W){return c*(357.5291+.98560028*W)}function b(W){var rt=c*(1.9148*i(W)+.02*i(2*W)+3e-4*i(3*W)),ct=c*102.9372;return W+rt+ct+e}function _(W){var rt=L(W),ct=b(rt);return{dec:R(ct,0),ra:f(ct,0)}}var g={};g.getPosition=function(W,rt,ct){var $=c*-ct,lt=c*rt,pt=x(W),ut=_(pt),et=F(pt,$)-ut.ra;return{azimuth:w(et,lt,ut.dec),altitude:M(et,lt,ut.dec)}};var A=g.times=[[-.833,"sunrise","sunset"],[-.3,"sunriseEnd","sunsetStart"],[-6,"dawn","dusk"],[-12,"nauticalDawn","nauticalDusk"],[-18,"nightEnd","night"],[6,"goldenHourEnd","goldenHour"]];g.addTime=function(W,rt,ct){A.push([W,rt,ct])};var O=9e-4;function k(W,rt){return Math.round(W-O-rt/(2*e))}function J(W,rt,ct){return O+(W+rt)/(2*e)+ct}function st(W,rt,ct){return d+W+.0053*i(rt)-.0069*i(2*ct)}function Q(W,rt,ct){return l((i(W)-i(rt)*i(ct))/(s(rt)*s(ct)))}function V(W){return-2.076*Math.sqrt(W)/60}function G(W,rt,ct,$,lt,pt,ut){var et=Q(W,ct,$),ft=J(et,rt,lt);return st(ft,pt,ut)}g.getTimes=function(W,rt,ct,$){$=$||0;var lt=c*-ct,pt=c*rt,ut=V($),et=x(W),ft=k(et,lt),gt=J(0,lt,ft),yt=L(gt),T=b(yt),C=R(T,0),S=st(gt,yt,T),H,U,z,B,tt,j,E={solarNoon:v(S),nadir:v(S-.5)};for(H=0,U=A.length;H<U;H+=1)z=A[H],B=(z[0]+ut)*c,tt=G(B,lt,pt,C,ft,yt,T),j=S-(tt-S),E[z[1]]=v(j),E[z[2]]=v(tt);return E};function it(W){var rt=c*(218.316+13.176396*W),ct=c*(134.963+13.064993*W),$=c*(93.272+13.22935*W),lt=rt+c*6.289*i(ct),pt=c*5.128*i($),ut=385001-20905*s(ct);return{ra:f(lt,pt),dec:R(lt,pt),dist:ut}}g.getMoonPosition=function(W,rt,ct){var $=c*-ct,lt=c*rt,pt=x(W),ut=it(pt),et=F(pt,$)-ut.ra,ft=M(et,lt,ut.dec),gt=a(i(et),r(lt)*s(ut.dec)-i(ut.dec)*s(et));return ft=ft+D(ft),{azimuth:w(et,lt,ut.dec),altitude:ft,distance:ut.dist,parallacticAngle:gt}},g.getMoonIllumination=function(W){var rt=x(W||new Date),ct=_(rt),$=it(rt),lt=149598e3,pt=l(i(ct.dec)*i($.dec)+s(ct.dec)*s($.dec)*s(ct.ra-$.ra)),ut=a(lt*i(pt),$.dist-lt*s(pt)),et=a(s(ct.dec)*i(ct.ra-$.ra),i(ct.dec)*s($.dec)-s(ct.dec)*i($.dec)*s(ct.ra-$.ra));return{fraction:(1+s(ut))/2,phase:.5+.5*ut*(et<0?-1:1)/Math.PI,angle:et}};function vt(W,rt){return new Date(W.valueOf()+rt*u/24)}g.getMoonTimes=function(W,rt,ct,$){var lt=new Date(W);$?lt.setUTCHours(0,0,0,0):lt.setHours(0,0,0,0);for(var pt=.133*c,ut=g.getMoonPosition(lt,rt,ct).altitude-pt,et,ft,gt,yt,T,C,S,H,U,z,B,tt,j,E=1;E<=24&&(et=g.getMoonPosition(vt(lt,E),rt,ct).altitude-pt,ft=g.getMoonPosition(vt(lt,E+1),rt,ct).altitude-pt,T=(ut+ft)/2-et,C=(ft-ut)/2,S=-C/(2*T),H=(T*S+C)*S+et,U=C*C-4*T*et,z=0,U>=0&&(j=Math.sqrt(U)/(Math.abs(T)*2),B=S-j,tt=S+j,Math.abs(B)<=1&&z++,Math.abs(tt)<=1&&z++,B<-1&&(B=tt)),z===1?ut<0?gt=E+B:yt=E+B:z===2&&(gt=E+(H<0?tt:B),yt=E+(H<0?B:tt)),!(gt&&yt));E+=2)ut=ft;var y={};return gt&&(y.rise=vt(lt,gt)),yt&&(y.set=vt(lt,yt)),!gt&&!yt&&(y[H>0?"alwaysUp":"alwaysDown"]=!0),y},n.exports=g})()})(Xa)),Xa.exports}var bS=ES();const TS=Dd(bS),wS=.2,AS=Bo({__name:"DigitalTwin",setup(n){const t=ac(null),{selectedBuilding:e,loadBuildingData:i,state:s}=Ic();let r,o,a,l,c,u,h,d;const p=[];let v=!1,x,m,f=!1,R=null,w=null,M=null,F=null,D=0,L=0;const b={house:{geometry:new me(4,6,4),material:new Ys({color:8900331}),description:"Residential House"},factory:{geometry:(()=>{const et=new bd().moveTo(0,0).lineTo(0,6).lineTo(8,6).lineTo(8,8).lineTo(10,8).lineTo(10,0).lineTo(0,0);return new Cc(et,{depth:12,bevelEnabled:!1})})(),material:new Ys({color:11674146}),description:"Manufacturing Plant"},office:{geometry:new me(6,10,6),material:new Ys({color:16777215}),description:"Office Building"},shop:{geometry:new me(8,4,6),material:new Ys({color:14210048}),description:"Retail Shop"}},_=()=>{m=new WM(9485245,.9),r.add(m),x=new GM(16777215),x.position.set(20,30,10),x.castShadow=!0,x.shadow.mapSize.width=2048,x.shadow.mapSize.height=2048,x.shadow.camera.near=.5,x.shadow.camera.far=500,x.shadow.bias=-5e-4,x.shadow.normalBias=.05,x.shadow.camera.left=-100,x.shadow.camera.right=100,x.shadow.camera.top=100,x.shadow.camera.bottom=-100,r.add(x)},g=()=>{const gt=s.value.currentTime,yt=new Date;yt.setHours(Math.floor(gt)),yt.setMinutes(Math.floor(gt%1*60)),yt.setSeconds(0);const T=TS.getPosition(yt,41.17873,-8.60835),C=100,S=T.azimuth,H=T.altitude,U=C*Math.cos(H)*Math.cos(S),z=C*Math.sin(H),B=C*Math.cos(H)*Math.sin(S);x.position.set(U,z,B),x.target.position.set(0,0,0),x.target.updateMatrixWorld()},A={day:new kt(11129853),night:new kt(657955),sunriseSun:new kt(10736127),daySun:new kt(16777129),sunsetSun:new kt(16763941),nightSun:new kt(2236996),dayAmbient:new kt(11129853),nightAmbient:new kt(2236996),tempSun:new kt,tempAmbient:new kt,tempBg:new kt},O=()=>{g();const et=s.value.currentTime;if(et<5||et>=21)x.color.copy(A.nightSun),m.color.copy(A.nightAmbient),x.castShadow=!1,x.intensity=0,r.background=A.night;else if(5<et&&et<=8){const ft=(et-5)/3;A.tempSun.copy(A.nightSun).lerp(A.sunriseSun,ft),x.color.copy(A.tempSun),A.tempAmbient.copy(A.nightAmbient).lerp(A.dayAmbient,ft),m.color.copy(A.tempAmbient),x.castShadow=!0,x.intensity=ft*.5,A.tempBg.copy(A.night).lerp(A.day,ft),r.background=A.tempBg}else if(et<11){const ft=(et-8)/3;A.tempSun.copy(A.sunriseSun).lerp(A.daySun,ft),x.color.copy(A.tempSun),x.castShadow=!0,r.background=A.day}else if(et<16)x.color.copy(A.daySun),x.castShadow=!0,r.background=A.day;else if(et<20){const ft=(et-16)/4;x.intensity=(1-ft)*.5,A.tempSun.copy(A.daySun).lerp(A.sunsetSun,ft),x.color.copy(A.tempSun),r.background=A.day}else if(et<21){const ft=et-20;A.tempSun.copy(A.sunsetSun).lerp(A.nightSun,ft),x.color.copy(A.tempSun),A.tempAmbient.copy(A.dayAmbient).lerp(A.nightAmbient,ft),m.color.copy(A.tempAmbient),A.tempBg.copy(A.day).lerp(A.night,ft),r.background=A.tempBg}},k=()=>{const et=window.innerWidth/window.innerHeight;a=new sn(40,et,1,1e3),o=a,o.position.set(25,45,25),o.lookAt(0,0,0)},J=()=>{if(f&&R&&w&&M&&F){const et=performance.now()/1e3;D=Math.min((et-L)/wS,1),o.position.lerpVectors(R,w,D),c.target.lerpVectors(M,F,D),D>=1&&(f=!1),c.update()}},st=()=>{c&&c.addEventListener("change",()=>{f||(c.target.y=0,o.position.y=Math.max(o.position.y,20),o.position.y=Math.min(o.position.y,45))}),l&&l.domElement&&l.domElement.addEventListener("wheel",et=>{et.preventDefault(),f||(et.deltaY<0&&o.position.y<=35?(R=o.position.clone(),w=o.position.clone().add(new I(2,10,2)),M=c.target.clone(),F=c.target.clone().add(new I(2,0,2)),D=0,L=performance.now()/1e3,f=!0):et.deltaY>0&&o.position.y>=30&&(R=o.position.clone(),w=o.position.clone().add(new I(-2,-10,-2)),M=c.target.clone(),F=c.target.clone().add(new I(-2,0,-2)),D=0,L=performance.now()/1e3,f=!0))},{passive:!1})},Q=(et,ft,gt,yt,T=0)=>{const C=new Rt(et.geometry,et.material);C.position.copy(ft),C.rotation.y=T,et.geometry.type==="BoxGeometry"&&(C.position.y+=et.geometry.parameters.height/2),C.castShadow=!0,C.receiveShadow=!0,C.userData={id:gt,type:et.description||"Generic",...et,csvPath:yt},p.push(C),r.add(C)},V=(et,ft,gt,yt,T,C)=>{const S=b[et];if(!S){console.warn(`Building type ${et} not found`);return}Q(S,ft,gt,yt,C)},G=()=>{const et=new Us(150,150),ft=new Ys({color:9554505,side:rn}),gt=new Rt(et,ft);gt.rotation.x=-Math.PI/2,gt.receiveShadow=!0,r.add(gt)},it=()=>{V("house",new I(-9,0,24),"H01","data/H01.csv"),V("factory",new I(48,0,-49),"H02","data/H02.csv"),V("office",new I(-38,0,-12),"H03","data/H03.csv"),V("shop",new I(-5,0,-5),"H04","data/H04.csv","assets/models/store1.glb",Math.PI/2),V("house",new I(-5,0,40),"H05","data/H05.csv"),V("house",new I(6,0,24),"H06","data/H06.csv"),V("house",new I(-37,0,30),"H07","data/H07.csv"),V("house",new I(-34,0,9),"H08","data/H08.csv","assets/models/store4.glb",-Math.PI/2),V("house",new I(19,0,-20),"H09","data/H09.csv","assets/models/store2.glb",Math.PI/2),V("house",new I(36,0,6),"H10","data/H10.csv"),V("house",new I(34,0,-19),"H11","data/H11.csv","assets/models/store3.glb",Math.PI),V("house",new I(-21,0,-18),"H12","data/H12.csv"),V("house",new I(-5,0,-20),"H13","data/H13.csv"),V("house",new I(-7,0,-48),"H14","data/H14.csv")},vt=()=>{!l||!o||(o.aspect=window.innerWidth/window.innerHeight,o.updateProjectionMatrix(),l.setSize(window.innerWidth,window.innerHeight))};let W;const rt=()=>{const et=new Pc(6,7,4),ft=new Tr({color:16776960,side:rn,transparent:!0,opacity:.8});W=new Rt(et,ft),W.rotation.x=-Math.PI/2,W.rotation.z=Math.PI/4,W.visible=!1,r.add(W)},ct=et=>{if(!et){W.visible=!1;return}W.position.copy(et.position),W.position.y=.5,W.visible=!0},$=()=>{u=new rS(o,l.domElement),u.setMode("translate"),u.showY=!1,u.enabled=!1,u.addEventListener("dragging-changed",et=>{c.enabled=!et.value}),r.add(u),window.addEventListener("keydown",et=>{et.key==="m"&&(v=!v,u.enabled=v,v||u.detach(),console.log("Move Mode:",v?"ON":"OFF"))})},lt=et=>{const ft=l.domElement.getBoundingClientRect();d.x=(et.clientX-ft.left)/ft.width*2-1,d.y=-((et.clientY-ft.top)/ft.height)*2+1,h.setFromCamera(d,o);const gt=h.intersectObjects(p);if(v){if(gt.length>0){const yt=gt[0].object,T=yt.userData.parentGroup||yt;u.attach(T)}else u.detach();return}if(gt.length>0){const yt=gt[0].object,T=yt.userData.parentGroup||yt,C=T.userData,S=T.position.clone();S.project(o);const H=(S.x*.5+.5)*ft.width,U=(-(S.y*.5)+.5)*ft.height;e.value={id:C.id,type:C.type,description:C.description,consumption:C.consumption||"Loading...",generation:C.generation||"Loading...",iot:C.iot||"None",csvPath:C.csvPath,uiX:H,uiY:U},C.csvPath&&i(C.id,C.csvPath).then(z=>{if(e.value&&e.value.id===C.id&&z&&z.length>0){const B=z[0];e.value.consumption=B.Consumption,e.value.generation=B.Generation}}),ct(T)}else e.value=null,ct(null)},pt=()=>{requestAnimationFrame(pt),O(),J(),c&&c.update(),l&&r&&o&&l.render(r,o)},ut=()=>{t.value&&(r=new lM,r.background=new kt(10413049),k(),l=new aM({antialias:!0}),l.setSize(window.innerWidth,window.innerHeight),l.shadowMap.enabled=!0,l.outputColorSpace=Qe,t.value.appendChild(l.domElement),c=new YM(o,l.domElement),c.enableDamping=!0,c.dampingFactor=.05,c.enableRotate=!1,c.enablePan=!0,c.enableZoom=!1,c.mouseButtons={LEFT:Yn.PAN,MIDDLE:Yn.DOLLY,RIGHT:Yn.ROTATE},c.target.set(0,0,0),_(),h=new Cd,d=new Mt,G(),rt(),it(),$(),st(),window.addEventListener("resize",vt),l.domElement.addEventListener("pointerdown",lt),pt())};return vf(()=>{ut()}),uc(()=>{window.removeEventListener("resize",vt),l&&l.dispose()}),(et,ft)=>(Mr(),Vo("div",{ref_key:"canvasContainer",ref:t,class:"canvas-container"},null,512))}}),Uc=(n,t)=>{const e=n.__vccOpts||n;for(const[i,s]of t)e[i]=s;return e},RS=Uc(AS,[["__scopeId","data-v-3dc03414"]]),CS={class:"header"},PS={class:"content"},LS={class:"info-row"},DS={class:"value"},IS={class:"info-row"},US={class:"value"},NS={class:"info-row"},OS={class:"value"},FS={class:"iot-text"},BS=Bo({__name:"BuildingInfoCanvas",setup(n){const{selectedBuilding:t}=Ic(),e=()=>{t.value=null};return(i,s)=>Me(t)?(Mr(),Vo("div",{key:0,class:"building-panel",style:Oo({left:Me(t).uiX+"px",top:Me(t).uiY+"px"})},[ie("div",CS,[ie("h3",null,Vn(Me(t).id)+" - "+Vn(Me(t).description),1),ie("button",{class:"close-btn",onClick:e},"×")]),ie("div",PS,[ie("div",LS,[s[0]||(s[0]=ie("span",{class:"label"},"Type:",-1)),ie("span",DS,Vn(Me(t).type),1)]),s[3]||(s[3]=ie("div",{class:"section-title"},"Energy Status",-1)),ie("div",IS,[s[1]||(s[1]=ie("span",{class:"label"},"Consumption:",-1)),ie("span",US,Vn(Me(t).consumption)+" kWh",1)]),ie("div",NS,[s[2]||(s[2]=ie("span",{class:"label"},"Generation:",-1)),ie("span",OS,Vn(Me(t).generation)+" kWh",1)]),s[4]||(s[4]=ie("div",{class:"section-title"},"IoT Devices",-1)),ie("p",FS,Vn(Me(t).iot||"No active devices"),1),s[5]||(s[5]=ie("div",{class:"actions"},[ie("button",{class:"action-btn"},"Toggle Lights"),ie("button",{class:"action-btn"},"View Charts")],-1))])],4)):Em("",!0)}}),zS=Uc(BS,[["__scopeId","data-v-2da88f20"]]),HS={class:"time-controls"},kS={class:"time-display"},VS={class:"controls"},GS={class:"speed-controls"},WS=Bo({__name:"TimeControls",setup(n){const{state:t,togglePlay:e,setSpeed:i}=Ic(),s=kf(()=>{const r=Math.floor(t.value.currentTime),o=Math.floor((t.value.currentTime-r)*60);return`Day ${t.value.day}, ${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`});return(r,o)=>(Mr(),Vo("div",HS,[ie("div",kS,Vn(s.value),1),ie("div",VS,[ie("button",{onClick:o[0]||(o[0]=(...a)=>Me(e)&&Me(e)(...a)),class:Hi({active:Me(t).isPlaying})},Vn(Me(t).isPlaying?"Pause":"Play"),3),ie("div",GS,[ie("button",{onClick:o[1]||(o[1]=a=>Me(i)(1)),class:Hi({active:Me(t).speed===1})},"1x",2),ie("button",{onClick:o[2]||(o[2]=a=>Me(i)(5)),class:Hi({active:Me(t).speed===5})},"5x",2),ie("button",{onClick:o[3]||(o[3]=a=>Me(i)(20)),class:Hi({active:Me(t).speed===20})},"20x",2)])])]))}}),XS=Uc(WS,[["__scopeId","data-v-fa1ceac6"]]),YS=Bo({__name:"App",setup(n){return(t,e)=>(Mr(),Vo(En,null,[on(RS),on(zS),on(XS)],64))}});i_(YS).mount("#app");
|