@spaceandtimelabs/dapp-mi-space-time 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +5 -0
- package/README.md +125 -0
- package/build/.well-known/branding.png +0 -0
- package/build/.well-known/dreamspace-logo.png +0 -0
- package/build/.well-known/walletconnect.txt +1 -0
- package/build/assets/404Error-4b2b2fdf.png +0 -0
- package/build/assets/404Error-5ffc66a6.webp +0 -0
- package/build/assets/500Error-9363e597.png +0 -0
- package/build/assets/500Error-c2319cd1.webp +0 -0
- package/build/assets/AAVE-4e238f97.svg +1 -0
- package/build/assets/APTOS-2712cfe5.svg +4 -0
- package/build/assets/ARBITRUM-b28daf5d.svg +14 -0
- package/build/assets/AVALANCHE-fdc7f330.svg +1 -0
- package/build/assets/AVAX-416bea54.svg +11 -0
- package/build/assets/AVAX-LOGO-a3ded9c0.svg +3 -0
- package/build/assets/AzureIcon-2676e858.svg +114 -0
- package/build/assets/BETA-ca9bec07.svg +1 -0
- package/build/assets/BITCOIN-90752a97.svg +3 -0
- package/build/assets/BITCOIN-e7d3b866.svg +4 -0
- package/build/assets/BNB-1ebff9f3.svg +1 -0
- package/build/assets/BNB-58094c7c.svg +27 -0
- package/build/assets/BNB-LOGO-418a5027.svg +3 -0
- package/build/assets/Base-35fb5786.svg +3 -0
- package/build/assets/CRON-expression-4eb03f8a.svg +12 -0
- package/build/assets/DB-acdc9545.svg +3 -0
- package/build/assets/DEFAULT-dd63bdfb.svg +1 -0
- package/build/assets/ETHEREUM-dc2fb7da.svg +1 -0
- package/build/assets/ETHERIUM-LOGO-9717d057.svg +3 -0
- package/build/assets/ETHERIUM-f4262ceb.svg +24 -0
- package/build/assets/ErdWrapper-12f6c405.js +1 -0
- package/build/assets/IconApprove-ad418d39.png +0 -0
- package/build/assets/Icontrash-fe45a42b.png +0 -0
- package/build/assets/ListFromContract-c8929c77.svg +331 -0
- package/build/assets/OPTIMISM-88bd2257.svg +14 -0
- package/build/assets/POLYGON-5b2b3c81.svg +1 -0
- package/build/assets/POLYGON-LOGO-d6c0dfd4.svg +3 -0
- package/build/assets/POLYGON-e33df5eb.svg +23 -0
- package/build/assets/Queries-9ad18f9b.css +1 -0
- package/build/assets/Queries-ddfc9128.js +68 -0
- package/build/assets/QueryEditorWrapper-9e28327f.js +1 -0
- package/build/assets/SEI-402190bf.svg +4 -0
- package/build/assets/STELLAR-d7dcd464.svg +1 -0
- package/build/assets/SUI-2190c91d.svg +20 -0
- package/build/assets/SUI-37e65f71.svg +5 -0
- package/build/assets/SUI-LOGO-f4550ecb.svg +5 -0
- package/build/assets/SUSHI-9d884336.svg +1 -0
- package/build/assets/SXT-Icon-7b8625ec.svg +4 -0
- package/build/assets/SXT-Icon-test-673069d6.svg +13 -0
- package/build/assets/TABLE-30f8ffc4.svg +1 -0
- package/build/assets/Tables-Indexed-292ec47a.svg +707 -0
- package/build/assets/UNISWAP-cc9e99cd.svg +1 -0
- package/build/assets/aptos-97620128.svg +3 -0
- package/build/assets/areaChart-f3d18624.svg +231 -0
- package/build/assets/avatar-7033870c.png +0 -0
- package/build/assets/barChart-cc41bac8.svg +375 -0
- package/build/assets/bodyBg-4d49a3ac.svg +87 -0
- package/build/assets/cardBottomCurve-b3827f16.png +0 -0
- package/build/assets/cardTopCurve-d1304bc3.png +0 -0
- package/build/assets/chartsIcon-e5af16b9.svg +3 -0
- package/build/assets/checksign-15ae025b.svg +4 -0
- package/build/assets/columnChart-93cef768.svg +120 -0
- package/build/assets/comingSoonCurve-13c57f74.png +0 -0
- package/build/assets/configureChart-22e4b0a5.webp +0 -0
- package/build/assets/configureChart-fd36f00f.png +0 -0
- package/build/assets/conttract-utility-Arrow-30532cf6.svg +3 -0
- package/build/assets/counterCurve-837cb6d7.svg +322 -0
- package/build/assets/counterIcon-f103bb21.svg +89 -0
- package/build/assets/dashboard-58faa7d0.svg +1 -0
- package/build/assets/dashboardThumbnail-dad77e62.png +0 -0
- package/build/assets/dashboardThumbnailSmall-40555323.webp +0 -0
- package/build/assets/dashboardThumbnailSmall-d43c4194.png +0 -0
- package/build/assets/dashboardlayer-686337a7.svg +9 -0
- package/build/assets/datasetIcon-56778ac5.svg +138 -0
- package/build/assets/divider-blur-906116d8.svg +3 -0
- package/build/assets/divider-sharp-3987ab7b.svg +17 -0
- package/build/assets/dreamspace-icon-logo-3b76534e.svg +32 -0
- package/build/assets/emptyChart-21075008.png +0 -0
- package/build/assets/emptyChart-3c0d422e.webp +0 -0
- package/build/assets/emptyContractEvent-39817557.svg +330 -0
- package/build/assets/emptyCounter-0727eb12.webp +0 -0
- package/build/assets/emptyCounter-7571ba8a.png +0 -0
- package/build/assets/emptyDashboard-a312b238.png +0 -0
- package/build/assets/emptyDashboard-d5ab94c8.webp +0 -0
- package/build/assets/emptyDataset-06bfb00c.png +0 -0
- package/build/assets/emptyDataset-8ead3933.webp +0 -0
- package/build/assets/emptyDatasetCube-905a8b42.webp +0 -0
- package/build/assets/emptyDatasetCube-d6ba08e0.png +0 -0
- package/build/assets/emptyHistory-39807386.png +0 -0
- package/build/assets/emptyHistory-e09c1ac9.webp +0 -0
- package/build/assets/emptyQuery-46e97f26.webp +0 -0
- package/build/assets/emptyQuery-e1b4860a.png +0 -0
- package/build/assets/enter-contract-afee220a.png +0 -0
- package/build/assets/error-18354ce5.webp +0 -0
- package/build/assets/error-f6360f5e.png +0 -0
- package/build/assets/errorIcon-8c449549.webp +0 -0
- package/build/assets/errorIcon-dfd90de6.svg +85 -0
- package/build/assets/ethTest-99b1d2ec.svg +19 -0
- package/build/assets/events-indexing-ad91e970.png +0 -0
- package/build/assets/exploreIcon-862b3a04.svg +4 -0
- package/build/assets/getDataChainIcon-79f7341c.svg +6 -0
- package/build/assets/greenCheckMark-21621017.svg +3 -0
- package/build/assets/heartbeat-d012a4c0.png +0 -0
- package/build/assets/index-0ce80e3c.js +47 -0
- package/build/assets/index-0f09c7eb.js +61 -0
- package/build/assets/index-1ace42bd.js +1 -0
- package/build/assets/index-b81d4b64.js +46101 -0
- package/build/assets/index.worker-33dfcd4d.js +12192 -0
- package/build/assets/info-c44f1c2f.svg +10 -0
- package/build/assets/left-top-wave-9170a13c.png +0 -0
- package/build/assets/lineChart-925fb979.svg +161 -0
- package/build/assets/logo-307f7f8f.svg +9 -0
- package/build/assets/logo-3d-dbfd07f4.png +0 -0
- package/build/assets/logo-full-ce821669.svg +41 -0
- package/build/assets/newDashboardIcon-2dd342c2.svg +6 -0
- package/build/assets/panel-bg-c4c3f71d.svg +1 -0
- package/build/assets/paymentMask-ccd19710.png +0 -0
- package/build/assets/pieChart-e501866c.svg +184 -0
- package/build/assets/pipelineBg-926be18c.png +0 -0
- package/build/assets/piplineFrameBg-4e0a7feb.png +0 -0
- package/build/assets/polygonTest-fb326bee.svg +19 -0
- package/build/assets/queriesIcon-fc16664d.svg +3 -0
- package/build/assets/queryEditor-194f7911.png +0 -0
- package/build/assets/queryEditor-6a295164.webp +0 -0
- package/build/assets/queryEditorIcon-62a95a16.svg +3 -0
- package/build/assets/right-bottom-wave-4ca0d469.png +0 -0
- package/build/assets/scatterChart-a4b3e1a9.svg +345 -0
- package/build/assets/sei-7ac4c215.svg +3 -0
- package/build/assets/select-dropdown-arrow-f34786e3.svg +3 -0
- package/build/assets/sendDataChainIcon-f42a3716.svg +6 -0
- package/build/assets/stackedColumnChart-0393901a.svg +175 -0
- package/build/assets/stepperPopupBg-e5059105.png +0 -0
- package/build/assets/suiTest-f62c396b.svg +21 -0
- package/build/assets/sxtLoader-fad80b96.gif +0 -0
- package/build/assets/sxtLogo-3c3ae808.png +0 -0
- package/build/assets/tableNodata-4a8097c4.webp +0 -0
- package/build/assets/tableNodata-807e046f.svg +275 -0
- package/build/assets/textLoading-9a61e793.gif +0 -0
- package/build/assets/thumbnailImg10-c92e02d4.png +0 -0
- package/build/assets/thumbnailImg5-744efe47.png +0 -0
- package/build/assets/thumbnailImg7-a8b8f67a.png +0 -0
- package/build/assets/validateABI-08fc3283.svg +126 -0
- package/build/assets/vendor-charts-1d8c8804.js +20219 -0
- package/build/assets/vendor-editor-5747258a.js +1624 -0
- package/build/assets/vendor-three-295ae070.js +3017 -0
- package/build/assets/view-219961f6.svg +1 -0
- package/build/assets/warningIcon-4bcaaefb.png +0 -0
- package/build/assets/warningIcon-a99d0605.webp +0 -0
- package/build/assets/waveImg-8001ea53.png +0 -0
- package/build/assets/x-twitter-icon-6a4cd77d.svg +4 -0
- package/build/assets/zksync-d5f2f4a7.svg +3 -0
- package/build/branding.png +0 -0
- package/build/dreamspace-logo.png +0 -0
- package/build/favicon.ico +0 -0
- package/build/favicon.svg +32 -0
- package/build/index.html +80 -0
- package/build/robots.txt +4 -0
- package/package.json +167 -0
|
@@ -0,0 +1,3017 @@
|
|
|
1
|
+
import{r as Te,R as fh,s as bc,o as dv,g as pv,a as dh,_ as Hc}from"./vendor-charts-1d8c8804.js";function mv(r){let e;const t=new Set,n=(f,p)=>{const g=typeof f=="function"?f(e):f;if(g!==e){const d=e;e=p?g:Object.assign({},e,g),t.forEach(m=>m(e,d))}},i=()=>e,s=(f,p=i,g=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let d=p(e);function m(){const x=p(e);if(!g(d,x)){const y=d;f(d=x,y)}}return t.add(m),()=>t.delete(m)},u={setState:n,getState:i,subscribe:(f,p,g)=>p||g?s(f,p,g):(t.add(f),()=>t.delete(f)),destroy:()=>t.clear()};return e=r(n,i,u),u}const gv=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),om=gv?Te.useEffect:Te.useLayoutEffect;function yv(r){const e=typeof r=="function"?mv(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=Te.useReducer(v=>v+1,0),a=e.getState(),l=Te.useRef(a),u=Te.useRef(n),f=Te.useRef(i),p=Te.useRef(!1),g=Te.useRef();g.current===void 0&&(g.current=n(a));let d,m=!1;(l.current!==a||u.current!==n||f.current!==i||p.current)&&(d=n(a),m=!i(g.current,d)),om(()=>{m&&(g.current=d),l.current=a,u.current=n,f.current=i,p.current=!1});const x=Te.useRef(a);om(()=>{const v=()=>{try{const S=e.getState(),T=u.current(S);f.current(g.current,T)||(l.current=S,g.current=T,s())}catch{p.current=!0,s()}},M=e.subscribe(v);return e.getState()!==x.current&&v(),M},[]);const y=m?d:g.current;return Te.useDebugValue(y),y};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}function NA(r,e){if(Object.is(r,e))return!0;if(typeof r!="object"||r===null||typeof e!="object"||e===null)return!1;const t=Object.keys(r);if(t.length!==Object.keys(e).length)return!1;for(let n=0;n<t.length;n++)if(!Object.prototype.hasOwnProperty.call(e,t[n])||!Object.is(r[t[n]],e[t[n]]))return!1;return!0}function xv(r,e,t){return Math.max(e,Math.min(r,t))}const hn={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function am(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function lm(r,e,t,n=.15){return n===0?xv(r,e,t):r<e?-am(e-r,t-e,n)+e:r>t?+am(r-t,t-e,n)+t:r}function vv(r,[e,t],[n,i]){const[[s,a],[l,u]]=r;return[lm(e,s,a,n),lm(t,l,u,i)]}function _v(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function wv(r){var e=_v(r,"string");return typeof e=="symbol"?e:String(e)}function wn(r,e,t){return e=wv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cm(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ft(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cm(Object(t),!0).forEach(function(n){wn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):cm(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const $g={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function um(r){return r?r[0].toUpperCase()+r.slice(1):""}const Mv=["enter","leave"];function Sv(r=!1,e){return r&&!Mv.includes(e)}function bv(r,e="",t=!1){const n=$g[r],i=n&&n[e]||e;return"on"+um(r)+um(i)+(Sv(t,i)?"Capture":"")}const Ev=["gotpointercapture","lostpointercapture"];function Tv(r){let e=r.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const n=Ev.includes(e)?"capturecapture":"capture",i=!!~e.indexOf(n);return i&&(e=e.replace("capture","")),{device:e,capture:i,passive:t}}function Av(r,e=""){const t=$g[r],n=t&&t[e]||e;return r+n}function Gc(r){return"touches"in r}function e0(r){return Gc(r)?"touch":"pointerType"in r?r.pointerType:"mouse"}function Cv(r){return Array.from(r.touches).filter(e=>{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function Rv(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function t0(r){return Gc(r)?Rv(r)[0]:r}function Pv(r){return Cv(r).map(e=>e.identifier)}function ph(r){const e=t0(r);return Gc(r)?e.identifier:e.pointerId}function hm(r){const e=t0(r);return[e.clientX,e.clientY]}const fm=40,dm=800;function Lv(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=fm,t*=fm):n===2&&(e*=dm,t*=dm),[e,t]}function Dv(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s})}return e}function Ic(r,...e){return typeof r=="function"?r(...e):r}function Iv(){}function zv(...r){return r.length===0?Iv:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function pm(r,e){return Object.assign({},e,r||{})}const Nv=32;class Fv{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?Ic(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,Dv(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const L=t._delta.map(Math.abs);hn.addTo(t._distance,L)}this.axisIntent&&this.axisIntent(e);const[a,l]=t._movement,[u,f]=n.threshold,{_step:p,values:g}=t;if(n.hasCustomTransform?(p[0]===!1&&(p[0]=Math.abs(a)>=u&&g[0]),p[1]===!1&&(p[1]=Math.abs(l)>=f&&g[1])):(p[0]===!1&&(p[0]=Math.abs(a)>=u&&Math.sign(a)*u),p[1]===!1&&(p[1]=Math.abs(l)>=f&&Math.sign(l)*f)),t.intentional=p[0]!==!1||p[1]!==!1,!t.intentional)return;const d=[0,0];if(n.hasCustomTransform){const[L,D]=g;d[0]=p[0]!==!1?L-p[0]:0,d[1]=p[1]!==!1?D-p[1]:0}else d[0]=p[0]!==!1?a-p[0]:0,d[1]=p[1]!==!1?l-p[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(d);const m=t.offset,x=t._active&&!t._blocked||t.active;x&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=Ic(n.bounds,t)),this.setup&&this.setup()),t.movement=d,this.computeOffset()));const[y,v]=t.offset,[[M,S],[T,b]]=t._bounds;t.overflow=[y<M?-1:y>S?1:0,v<T?-1:v>b?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const A=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=vv(t._bounds,t.offset,A),t.delta=hn.sub(t.offset,m),this.computeMovement(),x&&(!t.last||s>Nv)){t.delta=hn.sub(t.offset,m);const L=t.delta.map(Math.abs);hn.addTo(t.distance,L),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[L[0]/s,L[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ft(Ft(Ft({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function Ov([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class n0 extends Fv{constructor(...e){super(...e),wn(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=hn.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=hn.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[e0(e)]:n.axisThreshold;t.axis=Ov(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Bv=r=>r,mm=.15,i0={enabled(r=!0){return r},eventOptions(r,e,t){return Ft(Ft({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[mm,mm];case!1:return[0,0];default:return hn.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return hn.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||Bv},threshold(r){return hn.toVector(r,0)}},Uv=0,bo=Ft(Ft({},i0),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=Uv){return r},bounds(r={}){if(typeof r=="function")return s=>bo.bounds(r(s));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),gm={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class kv extends n0{constructor(...e){super(...e),wn(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=bo.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=ph(e),n._pointerActive=!0,this.computeValues(hm(e)),this.computeInitial(),t.preventScrollAxis&&e0(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=ph(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=hm(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=hn.sub(s,t._values),this.computeValues(s)),hn.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=ph(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,a]=t._distance;if(t.tap=s<=n.tapsThreshold&&a<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[l,u]=t._delta,[f,p]=t._movement,[g,d]=n.swipe.velocity,[m,x]=n.swipe.distance,y=n.swipe.duration;if(t.elapsedTime<y){const v=Math.abs(l/t.timeDelta),M=Math.abs(u/t.timeDelta);v>g&&Math.abs(f)>m&&(t.swipe[0]=Math.sign(l)),M>d&&Math.abs(p)>x&&(t.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,Hv(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=gm[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,hn.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in gm&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function Hv(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const Ia=typeof window<"u"&&window.document&&window.document.createElement;function r0(){return Ia&&"ontouchstart"in window}function Gv(){return r0()||Ia&&window.navigator.maxTouchPoints>1}function Vv(){return Ia&&"onpointerdown"in window}function Wv(){return Ia&&"exitPointerLock"in window.document}function qv(){try{return"constructor"in GestureEvent}catch{return!1}}const Zn={isBrowser:Ia,gesture:qv(),touch:r0(),touchscreen:Gv(),pointer:Vv(),pointerLock:Wv()},Xv=250,jv=180,Yv=.5,Jv=50,Zv=250,Kv=10,ym={mouse:0,touch:0,pen:8},Qv=Ft(Ft({},bo),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Zn.pointerLock,Zn.touch&&t?"touch":this.pointerLock?"mouse":Zn.pointer&&!i?"pointer":Zn.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?Xv:void 0,!(!Zn.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const s=hn.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,s},swipe({velocity:r=Yv,distance:e=Jv,duration:t=Zv}={}){return{velocity:this.transform(hn.toVector(r)),distance:this.transform(hn.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return jv;case!1:return 0;default:return r}},axisThreshold(r){return r?Ft(Ft({},ym),r):ym},keyboardDisplacement(r=Kv){return r}});function $v(r){const[e,t]=r.overflow,[n,i]=r._delta,[s,a]=r._direction;(e<0&&n>0&&s<0||e>0&&n<0&&s>0)&&(r._movement[0]=r._movementBound[0]),(t<0&&i>0&&a<0||t>0&&i<0&&a>0)&&(r._movement[1]=r._movementBound[1])}Ft(Ft({},i0),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!Zn.touch&&Zn.gesture)return"gesture";if(Zn.touch&&n)return"touch";if(Zn.touchscreen){if(Zn.pointer)return"pointer";if(Zn.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=a=>{const l=pm(Ic(t,a),{min:-1/0,max:1/0});return[l.min,l.max]},s=a=>{const l=pm(Ic(n,a),{min:-1/0,max:1/0});return[l.min,l.max]};return typeof t!="function"&&typeof n!="function"?[i(),s()]:a=>[i(a),s(a)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",hn.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}});Ft(Ft({},bo),{},{mouseOnly:(r=!0)=>r});class e_ extends n0{constructor(...e){super(...e),wn(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Lv(e),hn.addTo(t._movement,t._delta),$v(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const t_=bo;Ft(Ft({},bo),{},{mouseOnly:(r=!0)=>r});const kf=new Map,$h=new Map;function n_(r){kf.set(r.key,r.engine),$h.set(r.key,r.resolver)}const FA={key:"drag",engine:kv,resolver:Qv},OA={key:"wheel",engine:e_,resolver:t_};function i_(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function r_(r,e){if(r==null)return{};var t=i_(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const s_={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=Zn.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},o_=["target","eventOptions","window","enabled","transform"];function Ec(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=Ec(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function a_(r,e,t={}){const n=r,{target:i,eventOptions:s,window:a,enabled:l,transform:u}=n,f=r_(n,o_);if(t.shared=Ec({target:i,eventOptions:s,window:a,enabled:l,transform:u},s_),e){const p=$h.get(e);t[e]=Ec(Ft({shared:t.shared},f),p)}else for(const p in f){const g=$h.get(p);g&&(t[p]=Ec(Ft({shared:t.shared},f[p]),g))}return t}class s0{constructor(e,t){wn(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,s){const a=this._listeners,l=Av(t,n),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},f=Ft(Ft({},u),s);e.addEventListener(l,i,f);const p=()=>{e.removeEventListener(l,i,f),a.delete(p)};return a.add(p),p}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class l_{constructor(){wn(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class c_{constructor(e){wn(this,"gestures",new Set),wn(this,"_targetEventStore",new s0(this)),wn(this,"gestureEventStores",{}),wn(this,"gestureTimeoutStores",{}),wn(this,"handlers",{}),wn(this,"config",{}),wn(this,"pointerIds",new Set),wn(this,"touchIds",new Set),wn(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),u_(this,e)}setEventIds(e){if(Gc(e))return this.touchIds=new Set(Pv(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=a_(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const a of this.gestures){const l=this.config[a],u=xm(n,l.eventOptions,!!i);if(l.enabled){const f=kf.get(a);new f(this,e,a).bind(u)}}const s=xm(n,t.eventOptions,!!i);for(const a in this.nativeHandlers)s(a,"",l=>this.nativeHandlers[a](Ft(Ft({},this.state.shared),{},{event:l,args:e})),void 0,!0)}for(const s in n)n[s]=zv(...n[s]);if(!i)return n;for(const s in n){const{device:a,capture:l,passive:u}=Tv(s);this._targetEventStore.add(i,a,"",n[s],{capture:l,passive:u})}}}}function Os(r,e){r.gestures.add(e),r.gestureEventStores[e]=new s0(r,e),r.gestureTimeoutStores[e]=new l_}function u_(r,e){e.drag&&Os(r,"drag"),e.wheel&&Os(r,"wheel"),e.scroll&&Os(r,"scroll"),e.move&&Os(r,"move"),e.pinch&&Os(r,"pinch"),e.hover&&Os(r,"hover")}const xm=(r,e,t)=>(n,i,s,a={},l=!1)=>{var u,f;const p=(u=a.capture)!==null&&u!==void 0?u:e.capture,g=(f=a.passive)!==null&&f!==void 0?f:e.passive;let d=l?n:bv(n,i,p);t&&g&&(d+="Passive"),r[d]=r[d]||[],r[d].push(s)},h_=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function f_(r){const e={},t={},n=new Set;for(let i in r)h_.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function Bs(r,e,t,n,i,s){if(!r.has(t)||!kf.has(n))return;const a=t+"Start",l=t+"End",u=f=>{let p;return f.first&&a in e&&e[a](f),t in e&&(p=e[t](f)),f.last&&l in e&&e[l](f),p};i[n]=u,s[n]=s[n]||{}}function d_(r,e){const[t,n,i]=f_(r),s={};return Bs(i,t,"onDrag","drag",s,e),Bs(i,t,"onWheel","wheel",s,e),Bs(i,t,"onScroll","scroll",s,e),Bs(i,t,"onPinch","pinch",s,e),Bs(i,t,"onMove","move",s,e),Bs(i,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:n}}function p_(r,e={},t,n){const i=fh.useMemo(()=>new c_(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),fh.useEffect(i.effect.bind(i)),fh.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function BA(r){return r.forEach(n_),function(t,n){const{handlers:i,nativeHandlers:s,config:a}=d_(t,n||{});return p_(i,a,void 0,s)}}/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2010-2022 Three.js Authors
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/const Vc="139",Wi={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},qi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o0=0,ef=1,a0=2,m_=3,g_=0,Hf=1,Gf=2,ro=3,ls=0,Fn=1,cs=2,Vf=1,y_=2,Yi=0,ts=1,tf=2,nf=3,rf=4,l0=5,Jr=100,c0=101,u0=102,sf=103,of=104,h0=200,f0=201,d0=202,p0=203,Wf=204,qf=205,m0=206,g0=207,y0=208,x0=209,v0=210,_0=0,w0=1,M0=2,zc=3,S0=4,b0=5,E0=6,T0=7,za=0,A0=1,C0=2,hi=0,R0=1,P0=2,L0=3,Xf=4,D0=5,Wc=300,Sr=301,br=302,ma=303,ga=304,Eo=306,ya=1e3,Mn=1001,xa=1002,Zt=1003,Nc=1004,x_=1004,Fc=1005,v_=1005,Gt=1006,jf=1007,__=1007,vs=1008,w_=1008,Er=1009,I0=1010,z0=1011,lo=1012,N0=1013,ha=1014,ji=1015,ns=1016,F0=1017,O0=1018,is=1020,B0=1021,U0=1022,Nn=1023,k0=1024,H0=1025,wr=1026,us=1027,G0=1028,V0=1029,W0=1030,q0=1031,X0=1033,Tc=33776,Ac=33777,Cc=33778,Rc=33779,af=35840,lf=35841,cf=35842,uf=35843,j0=36196,hf=37492,ff=37496,df=37808,pf=37809,mf=37810,gf=37811,yf=37812,xf=37813,vf=37814,_f=37815,wf=37816,Mf=37817,Sf=37818,bf=37819,Ef=37820,Tf=37821,Af=36492,Y0=2200,J0=2201,Z0=2202,va=2300,_a=2301,Pc=2302,Kr=2400,Qr=2401,wa=2402,qc=2500,Yf=2501,K0=0,M_=1,S_=2,Kn=3e3,Tt=3001,Q0=3200,$0=3201,_s=0,ey=1,b_="",Si="srgb",vr="srgb-linear",E_=0,Lc=7680,T_=7681,A_=7682,C_=7683,R_=34055,P_=34056,L_=5386,D_=512,I_=513,z_=514,N_=515,F_=516,O_=517,B_=518,ty=519,co=35044,uo=35048,U_=35040,k_=35045,H_=35049,G_=35041,V_=35046,W_=35050,q_=35042,X_="100",Cf="300 es",Oc=1035;let Rr=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}};const un=[];for(let r=0;r<256;r++)un[r]=(r<16?"0":"")+r.toString(16);let vm=1234567;const rs=Math.PI/180,Ma=180/Math.PI;function On(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(un[r&255]+un[r>>8&255]+un[r>>16&255]+un[r>>24&255]+"-"+un[e&255]+un[e>>8&255]+"-"+un[e>>16&15|64]+un[e>>24&255]+"-"+un[t&63|128]+un[t>>8&255]+"-"+un[t>>16&255]+un[t>>24&255]+un[n&255]+un[n>>8&255]+un[n>>16&255]+un[n>>24&255]).toLowerCase()}function Vt(r,e,t){return Math.max(e,Math.min(t,r))}function Jf(r,e){return(r%e+e)%e}function j_(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Y_(r,e,t){return r!==e?(t-r)/(e-r):0}function fa(r,e,t){return(1-t)*r+t*e}function J_(r,e,t,n){return fa(r,e,1-Math.exp(-t*n))}function Z_(r,e=1){return e-Math.abs(Jf(r,e*2)-e)}function K_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Q_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function $_(r,e){return r+Math.floor(Math.random()*(e-r+1))}function ew(r,e){return r+Math.random()*(e-r)}function tw(r){return r*(.5-Math.random())}function nw(r){r!==void 0&&(vm=r);let e=vm+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function iw(r){return r*rs}function rw(r){return r*Ma}function Rf(r){return(r&r-1)===0&&r!==0}function ny(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Bc(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function sw(r,e,t,n,i){const s=Math.cos,a=Math.sin,l=s(t/2),u=a(t/2),f=s((e+n)/2),p=a((e+n)/2),g=s((e-n)/2),d=a((e-n)/2),m=s((n-e)/2),x=a((n-e)/2);switch(i){case"XYX":r.set(l*p,u*g,u*d,l*f);break;case"YZY":r.set(u*d,l*p,u*g,l*f);break;case"ZXZ":r.set(u*g,u*d,l*p,l*f);break;case"XZX":r.set(l*p,u*x,u*m,l*f);break;case"YXY":r.set(u*m,l*p,u*x,l*f);break;case"ZYZ":r.set(u*x,u*m,l*p,l*f);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ow(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function aw(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var _m=Object.freeze({__proto__:null,DEG2RAD:rs,RAD2DEG:Ma,generateUUID:On,clamp:Vt,euclideanModulo:Jf,mapLinear:j_,inverseLerp:Y_,lerp:fa,damp:J_,pingpong:Z_,smoothstep:K_,smootherstep:Q_,randInt:$_,randFloat:ew,randFloatSpread:tw,seededRandom:nw,degToRad:iw,radToDeg:rw,isPowerOfTwo:Rf,ceilPowerOfTwo:ny,floorPowerOfTwo:Bc,setQuaternionFromProperEuler:sw,normalize:aw,denormalize:ow});class ue{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}ue.prototype.isVector2=!0;class tn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,a,l,u,f){const p=this.elements;return p[0]=e,p[1]=i,p[2]=l,p[3]=t,p[4]=s,p[5]=u,p[6]=n,p[7]=a,p[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],l=n[3],u=n[6],f=n[1],p=n[4],g=n[7],d=n[2],m=n[5],x=n[8],y=i[0],v=i[3],M=i[6],S=i[1],T=i[4],b=i[7],A=i[2],L=i[5],D=i[8];return s[0]=a*y+l*S+u*A,s[3]=a*v+l*T+u*L,s[6]=a*M+l*b+u*D,s[1]=f*y+p*S+g*A,s[4]=f*v+p*T+g*L,s[7]=f*M+p*b+g*D,s[2]=d*y+m*S+x*A,s[5]=d*v+m*T+x*L,s[8]=d*M+m*b+x*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],l=e[5],u=e[6],f=e[7],p=e[8];return t*a*p-t*l*f-n*s*p+n*l*u+i*s*f-i*a*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],l=e[5],u=e[6],f=e[7],p=e[8],g=p*a-l*f,d=l*u-p*s,m=f*s-a*u,x=t*g+n*d+i*m;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/x;return e[0]=g*y,e[1]=(i*f-p*n)*y,e[2]=(l*n-i*a)*y,e[3]=d*y,e[4]=(p*t-i*u)*y,e[5]=(i*s-l*t)*y,e[6]=m*y,e[7]=(n*u-f*t)*y,e[8]=(a*t-n*s)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,l){const u=Math.cos(s),f=Math.sin(s);return this.set(n*u,n*f,-n*(u*a+f*l)+a+e,-i*f,i*u,-i*(-f*a+u*l)+l+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,s=i[0],a=i[3],l=i[6],u=i[1],f=i[4],p=i[7];return i[0]=t*s+n*u,i[3]=t*a+n*f,i[6]=t*l+n*p,i[1]=-n*s+t*u,i[4]=-n*a+t*f,i[7]=-n*l+t*p,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}tn.prototype.isMatrix3=!0;function iy(r){for(let e=r.length-1;e>=0;--e)if(r[e]>65535)return!0;return!1}const lw={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function so(r,e){return new lw[r](e)}function Sa(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function ss(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Dc(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}const mh={[Si]:{[vr]:ss},[vr]:{[Si]:Dc}},Jn={legacyMode:!0,get workingColorSpace(){return vr},set workingColorSpace(r){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(r,e,t){if(this.legacyMode||e===t||!e||!t)return r;if(mh[e]&&mh[e][t]!==void 0){const n=mh[e][t];return r.r=n(r.r),r.g=n(r.g),r.b=n(r.b),r}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)}},ry={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},en={r:0,g:0,b:0},ri={h:0,s:0,l:0},Fl={h:0,s:0,l:0};function gh(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}function Ol(r,e){return e.r=r.r,e.g=r.g,e.b=r.b,e}class Ae{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Si){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Jn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=vr){return this.r=e,this.g=t,this.b=n,Jn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=vr){if(e=Jf(e,1),t=Vt(t,0,1),n=Vt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=gh(a,s,e+1/3),this.g=gh(a,s,e),this.b=gh(a,s,e-1/3)}return Jn.toWorkingColorSpace(this,i),this}setStyle(e,t=Si){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],l=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,Jn.toWorkingColorSpace(this,t),n(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,Jn.toWorkingColorSpace(this,t),n(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l)){const u=parseFloat(s[1])/360,f=parseInt(s[2],10)/100,p=parseInt(s[3],10)/100;return n(s[4]),this.setHSL(u,f,p,t)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,Jn.toWorkingColorSpace(this,t),this;if(a===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,Jn.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Si){const n=ry[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ss(e.r),this.g=ss(e.g),this.b=ss(e.b),this}copyLinearToSRGB(e){return this.r=Dc(e.r),this.g=Dc(e.g),this.b=Dc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Si){return Jn.fromWorkingColorSpace(Ol(this,en),e),Vt(en.r*255,0,255)<<16^Vt(en.g*255,0,255)<<8^Vt(en.b*255,0,255)<<0}getHexString(e=Si){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=vr){Jn.fromWorkingColorSpace(Ol(this,en),t);const n=en.r,i=en.g,s=en.b,a=Math.max(n,i,s),l=Math.min(n,i,s);let u,f;const p=(l+a)/2;if(l===a)u=0,f=0;else{const g=a-l;switch(f=p<=.5?g/(a+l):g/(2-a-l),a){case n:u=(i-s)/g+(i<s?6:0);break;case i:u=(s-n)/g+2;break;case s:u=(n-i)/g+4;break}u/=6}return e.h=u,e.s=f,e.l=p,e}getRGB(e,t=vr){return Jn.fromWorkingColorSpace(Ol(this,en),t),e.r=en.r,e.g=en.g,e.b=en.b,e}getStyle(e=Si){return Jn.fromWorkingColorSpace(Ol(this,en),e),e!==Si?`color(${e} ${en.r} ${en.g} ${en.b})`:`rgb(${en.r*255|0},${en.g*255|0},${en.b*255|0})`}offsetHSL(e,t,n){return this.getHSL(ri),ri.h+=e,ri.s+=t,ri.l+=n,this.setHSL(ri.h,ri.s,ri.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ri),e.getHSL(Fl);const n=fa(ri.h,Fl.h,t),i=fa(ri.s,Fl.s,t),s=fa(ri.l,Fl.l,t);return this.setHSL(n,i,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Ae.NAMES=ry;Ae.prototype.isColor=!0;Ae.prototype.r=1;Ae.prototype.g=1;Ae.prototype.b=1;let Us;class Pr{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Us===void 0&&(Us=Sa("canvas")),Us.width=e.width,Us.height=e.height;const n=Us.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Us}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Sa("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=ss(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(ss(t[n]/255)*255):t[n]=ss(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class $r{constructor(e=null){this.uuid=On(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,l=i.length;a<l;a++)i[a].isDataTexture?s.push(yh(i[a].image)):s.push(yh(i[a]))}else s=yh(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function yh(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?Pr.getDataURL(r):r.data?{data:Array.prototype.slice.call(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}$r.prototype.isSource=!0;let cw=0;class Ut extends Rr{constructor(e=Ut.DEFAULT_IMAGE,t=Ut.DEFAULT_MAPPING,n=Mn,i=Mn,s=Gt,a=vs,l=Nn,u=Er,f=1,p=Kn){super(),Object.defineProperty(this,"id",{value:cw++}),this.uuid=On(),this.name="",this.source=new $r(e),this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=f,this.format=l,this.internalFormat=null,this.type=u,this.offset=new ue(0,0),this.repeat=new ue(1,1),this.center=new ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new tn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=p,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Wc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ya:e.x=e.x-Math.floor(e.x);break;case Mn:e.x=e.x<0?0:1;break;case xa:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ya:e.y=e.y-Math.floor(e.y);break;case Mn:e.y=e.y<0?0:1;break;case xa:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}Ut.DEFAULT_IMAGE=null;Ut.DEFAULT_MAPPING=Wc;Ut.prototype.isTexture=!0;class wt{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const u=e.elements,f=u[0],p=u[4],g=u[8],d=u[1],m=u[5],x=u[9],y=u[2],v=u[6],M=u[10];if(Math.abs(p-d)<.01&&Math.abs(g-y)<.01&&Math.abs(x-v)<.01){if(Math.abs(p+d)<.1&&Math.abs(g+y)<.1&&Math.abs(x+v)<.1&&Math.abs(f+m+M-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const T=(f+1)/2,b=(m+1)/2,A=(M+1)/2,L=(p+d)/4,D=(g+y)/4,N=(x+v)/4;return T>b&&T>A?T<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(T),i=L/n,s=D/n):b>A?b<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(b),n=L/i,s=N/i):A<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(A),n=D/s,i=N/s),this.set(n,i,s,t),this}let S=Math.sqrt((v-x)*(v-x)+(g-y)*(g-y)+(d-p)*(d-p));return Math.abs(S)<.001&&(S=1),this.x=(v-x)/S,this.y=(g-y)/S,this.z=(d-p)/S,this.w=Math.acos((f+m+M-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}wt.prototype.isVector4=!0;class Sn extends Rr{constructor(e,t,n={}){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new wt(0,0,e,t),this.scissorTest=!1,this.viewport=new wt(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new Ut(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Gt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0,this.texture.image=Object.assign({},e.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}Sn.prototype.isWebGLRenderTarget=!0;class To extends Ut{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=Zt,this.minFilter=Zt,this.wrapR=Mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}To.prototype.isDataArrayTexture=!0;class sy extends Sn{constructor(e,t,n){super(e,t),this.depth=n,this.texture=new To(null,e,t,n),this.texture.isRenderTargetTexture=!0}}sy.prototype.isWebGLArrayRenderTarget=!0;class Na extends Ut{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=Zt,this.minFilter=Zt,this.wrapR=Mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}Na.prototype.isData3DTexture=!0;class oy extends Sn{constructor(e,t,n){super(e,t),this.depth=n,this.texture=new Na(null,e,t,n),this.texture.isRenderTargetTexture=!0}}oy.prototype.isWebGL3DRenderTarget=!0;class ay extends Sn{constructor(e,t,n,i={}){super(e,t,i);const s=this.texture;this.texture=[];for(let a=0;a<n;a++)this.texture[a]=s.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.texture.length;i<s;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone();return this}}ay.prototype.isWebGLMultipleRenderTargets=!0;class nn{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,s,a,l){let u=n[i+0],f=n[i+1],p=n[i+2],g=n[i+3];const d=s[a+0],m=s[a+1],x=s[a+2],y=s[a+3];if(l===0){e[t+0]=u,e[t+1]=f,e[t+2]=p,e[t+3]=g;return}if(l===1){e[t+0]=d,e[t+1]=m,e[t+2]=x,e[t+3]=y;return}if(g!==y||u!==d||f!==m||p!==x){let v=1-l;const M=u*d+f*m+p*x+g*y,S=M>=0?1:-1,T=1-M*M;if(T>Number.EPSILON){const A=Math.sqrt(T),L=Math.atan2(A,M*S);v=Math.sin(v*L)/A,l=Math.sin(l*L)/A}const b=l*S;if(u=u*v+d*b,f=f*v+m*b,p=p*v+x*b,g=g*v+y*b,v===1-l){const A=1/Math.sqrt(u*u+f*f+p*p+g*g);u*=A,f*=A,p*=A,g*=A}}e[t]=u,e[t+1]=f,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,s,a){const l=n[i],u=n[i+1],f=n[i+2],p=n[i+3],g=s[a],d=s[a+1],m=s[a+2],x=s[a+3];return e[t]=l*x+p*g+u*m-f*d,e[t+1]=u*x+p*d+f*g-l*m,e[t+2]=f*x+p*m+l*d-u*g,e[t+3]=p*x-l*g-u*d-f*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,s=e._z,a=e._order,l=Math.cos,u=Math.sin,f=l(n/2),p=l(i/2),g=l(s/2),d=u(n/2),m=u(i/2),x=u(s/2);switch(a){case"XYZ":this._x=d*p*g+f*m*x,this._y=f*m*g-d*p*x,this._z=f*p*x+d*m*g,this._w=f*p*g-d*m*x;break;case"YXZ":this._x=d*p*g+f*m*x,this._y=f*m*g-d*p*x,this._z=f*p*x-d*m*g,this._w=f*p*g+d*m*x;break;case"ZXY":this._x=d*p*g-f*m*x,this._y=f*m*g+d*p*x,this._z=f*p*x+d*m*g,this._w=f*p*g-d*m*x;break;case"ZYX":this._x=d*p*g-f*m*x,this._y=f*m*g+d*p*x,this._z=f*p*x-d*m*g,this._w=f*p*g+d*m*x;break;case"YZX":this._x=d*p*g+f*m*x,this._y=f*m*g+d*p*x,this._z=f*p*x-d*m*g,this._w=f*p*g-d*m*x;break;case"XZY":this._x=d*p*g-f*m*x,this._y=f*m*g-d*p*x,this._z=f*p*x+d*m*g,this._w=f*p*g+d*m*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],l=t[5],u=t[9],f=t[2],p=t[6],g=t[10],d=n+l+g;if(d>0){const m=.5/Math.sqrt(d+1);this._w=.25/m,this._x=(p-u)*m,this._y=(s-f)*m,this._z=(a-i)*m}else if(n>l&&n>g){const m=2*Math.sqrt(1+n-l-g);this._w=(p-u)/m,this._x=.25*m,this._y=(i+a)/m,this._z=(s+f)/m}else if(l>g){const m=2*Math.sqrt(1+l-n-g);this._w=(s-f)/m,this._x=(i+a)/m,this._y=.25*m,this._z=(u+p)/m}else{const m=2*Math.sqrt(1+g-n-l);this._w=(a-i)/m,this._x=(s+f)/m,this._y=(u+p)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Vt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,l=t._x,u=t._y,f=t._z,p=t._w;return this._x=n*p+a*l+i*f-s*u,this._y=i*p+a*u+s*l-n*f,this._z=s*p+a*f+n*u-i*l,this._w=a*p-n*l-i*u-s*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let l=a*e._w+n*e._x+i*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const u=1-l*l;if(u<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*n+t*this._x,this._y=m*i+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const f=Math.sqrt(u),p=Math.atan2(f,l),g=Math.sin((1-t)*p)/f,d=Math.sin(t*p)/f;return this._w=a*g+this._w*d,this._x=n*g+this._x*d,this._y=i*g+this._y*d,this._z=s*g+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}nn.prototype.isQuaternion=!0;class R{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(wm.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(wm.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,l=e.z,u=e.w,f=u*t+a*i-l*n,p=u*n+l*t-s*i,g=u*i+s*n-a*t,d=-s*t-a*n-l*i;return this.x=f*u+d*-s+p*-l-g*-a,this.y=p*u+d*-a+g*-s-f*-l,this.z=g*u+d*-l+f*-a-p*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,l=t.y,u=t.z;return this.x=i*u-s*l,this.y=s*a-n*u,this.z=n*l-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return xh.copy(this).projectOnVector(e),this.sub(xh)}reflect(e){return this.sub(xh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Vt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}R.prototype.isVector3=!0;const xh=new R,wm=new nn;class Un{constructor(e=new R(1/0,1/0,1/0),t=new R(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,s=-1/0,a=-1/0,l=-1/0;for(let u=0,f=e.length;u<f;u+=3){const p=e[u],g=e[u+1],d=e[u+2];p<t&&(t=p),g<n&&(n=g),d<i&&(i=d),p>s&&(s=p),g>a&&(a=g),d>l&&(l=d)}return this.min.set(t,n,i),this.max.set(s,a,l),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,a=-1/0,l=-1/0;for(let u=0,f=e.count;u<f;u++){const p=e.getX(u),g=e.getY(u),d=e.getZ(u);p<t&&(t=p),g<n&&(n=g),d<i&&(i=d),p>s&&(s=p),g>a&&(a=g),d>l&&(l=d)}return this.min.set(t,n,i),this.max.set(s,a,l),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=kr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0)if(t&&n.attributes!=null&&n.attributes.position!==void 0){const s=n.attributes.position;for(let a=0,l=s.count;a<l;a++)kr.fromBufferAttribute(s,a).applyMatrix4(e.matrixWorld),this.expandByPoint(kr)}else n.boundingBox===null&&n.computeBoundingBox(),vh.copy(n.boundingBox),vh.applyMatrix4(e.matrixWorld),this.union(vh);const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,kr),kr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ta),Bl.subVectors(this.max,ta),ks.subVectors(e.a,ta),Hs.subVectors(e.b,ta),Gs.subVectors(e.c,ta),hr.subVectors(Hs,ks),fr.subVectors(Gs,Hs),Hr.subVectors(ks,Gs);let t=[0,-hr.z,hr.y,0,-fr.z,fr.y,0,-Hr.z,Hr.y,hr.z,0,-hr.x,fr.z,0,-fr.x,Hr.z,0,-Hr.x,-hr.y,hr.x,0,-fr.y,fr.x,0,-Hr.y,Hr.x,0];return!_h(t,ks,Hs,Gs,Bl)||(t=[1,0,0,0,1,0,0,0,1],!_h(t,ks,Hs,Gs,Bl))?!1:(Ul.crossVectors(hr,fr),t=[Ul.x,Ul.y,Ul.z],_h(t,ks,Hs,Gs,Bl))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return kr.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(kr).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Bi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Bi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Bi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Bi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Bi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Bi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Bi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Bi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Bi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Un.prototype.isBox3=!0;const Bi=[new R,new R,new R,new R,new R,new R,new R,new R],kr=new R,vh=new Un,ks=new R,Hs=new R,Gs=new R,hr=new R,fr=new R,Hr=new R,ta=new R,Bl=new R,Ul=new R,Gr=new R;function _h(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Gr.fromArray(r,s);const l=i.x*Math.abs(Gr.x)+i.y*Math.abs(Gr.y)+i.z*Math.abs(Gr.z),u=e.dot(Gr),f=t.dot(Gr),p=n.dot(Gr);if(Math.max(-Math.max(u,f,p),Math.min(u,f,p))>l)return!1}return!0}const uw=new Un,Mm=new R,kl=new R,wh=new R;class Lr{constructor(e=new R,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):uw.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){wh.subVectors(e,this.center);const t=wh.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(wh.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return this.center.equals(e.center)===!0?kl.set(0,0,1).multiplyScalar(e.radius):kl.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Mm.copy(e.center).add(kl)),this.expandByPoint(Mm.copy(e.center).sub(kl)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ui=new R,Mh=new R,Hl=new R,dr=new R,Sh=new R,Gl=new R,bh=new R;class Qi{constructor(e=new R,t=new R(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ui)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ui.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ui.copy(this.direction).multiplyScalar(t).add(this.origin),Ui.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Mh.copy(e).add(t).multiplyScalar(.5),Hl.copy(t).sub(e).normalize(),dr.copy(this.origin).sub(Mh);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Hl),l=dr.dot(this.direction),u=-dr.dot(Hl),f=dr.lengthSq(),p=Math.abs(1-a*a);let g,d,m,x;if(p>0)if(g=a*u-l,d=a*l-u,x=s*p,g>=0)if(d>=-x)if(d<=x){const y=1/p;g*=y,d*=y,m=g*(g+a*d+2*l)+d*(a*g+d+2*u)+f}else d=s,g=Math.max(0,-(a*d+l)),m=-g*g+d*(d+2*u)+f;else d=-s,g=Math.max(0,-(a*d+l)),m=-g*g+d*(d+2*u)+f;else d<=-x?(g=Math.max(0,-(-a*s+l)),d=g>0?-s:Math.min(Math.max(-s,-u),s),m=-g*g+d*(d+2*u)+f):d<=x?(g=0,d=Math.min(Math.max(-s,-u),s),m=d*(d+2*u)+f):(g=Math.max(0,-(a*s+l)),d=g>0?s:Math.min(Math.max(-s,-u),s),m=-g*g+d*(d+2*u)+f);else d=a>0?-s:s,g=Math.max(0,-(a*d+l)),m=-g*g+d*(d+2*u)+f;return n&&n.copy(this.direction).multiplyScalar(g).add(this.origin),i&&i.copy(Hl).multiplyScalar(d).add(Mh),m}intersectSphere(e,t){Ui.subVectors(e.center,this.origin);const n=Ui.dot(this.direction),i=Ui.dot(Ui)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),l=n-a,u=n+a;return l<0&&u<0?null:l<0?this.at(u,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,l,u;const f=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,d=this.origin;return f>=0?(n=(e.min.x-d.x)*f,i=(e.max.x-d.x)*f):(n=(e.max.x-d.x)*f,i=(e.min.x-d.x)*f),p>=0?(s=(e.min.y-d.y)*p,a=(e.max.y-d.y)*p):(s=(e.max.y-d.y)*p,a=(e.min.y-d.y)*p),n>a||s>i||((s>n||n!==n)&&(n=s),(a<i||i!==i)&&(i=a),g>=0?(l=(e.min.z-d.z)*g,u=(e.max.z-d.z)*g):(l=(e.max.z-d.z)*g,u=(e.min.z-d.z)*g),n>u||l>i)||((l>n||n!==n)&&(n=l),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Ui)!==null}intersectTriangle(e,t,n,i,s){Sh.subVectors(t,e),Gl.subVectors(n,e),bh.crossVectors(Sh,Gl);let a=this.direction.dot(bh),l;if(a>0){if(i)return null;l=1}else if(a<0)l=-1,a=-a;else return null;dr.subVectors(this.origin,e);const u=l*this.direction.dot(Gl.crossVectors(dr,Gl));if(u<0)return null;const f=l*this.direction.dot(Sh.cross(dr));if(f<0||u+f>a)return null;const p=-l*dr.dot(bh);return p<0?null:this.at(p/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Fe{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,s,a,l,u,f,p,g,d,m,x,y,v){const M=this.elements;return M[0]=e,M[4]=t,M[8]=n,M[12]=i,M[1]=s,M[5]=a,M[9]=l,M[13]=u,M[2]=f,M[6]=p,M[10]=g,M[14]=d,M[3]=m,M[7]=x,M[11]=y,M[15]=v,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 Fe().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Vs.setFromMatrixColumn(e,0).length(),s=1/Vs.setFromMatrixColumn(e,1).length(),a=1/Vs.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),l=Math.sin(n),u=Math.cos(i),f=Math.sin(i),p=Math.cos(s),g=Math.sin(s);if(e.order==="XYZ"){const d=a*p,m=a*g,x=l*p,y=l*g;t[0]=u*p,t[4]=-u*g,t[8]=f,t[1]=m+x*f,t[5]=d-y*f,t[9]=-l*u,t[2]=y-d*f,t[6]=x+m*f,t[10]=a*u}else if(e.order==="YXZ"){const d=u*p,m=u*g,x=f*p,y=f*g;t[0]=d+y*l,t[4]=x*l-m,t[8]=a*f,t[1]=a*g,t[5]=a*p,t[9]=-l,t[2]=m*l-x,t[6]=y+d*l,t[10]=a*u}else if(e.order==="ZXY"){const d=u*p,m=u*g,x=f*p,y=f*g;t[0]=d-y*l,t[4]=-a*g,t[8]=x+m*l,t[1]=m+x*l,t[5]=a*p,t[9]=y-d*l,t[2]=-a*f,t[6]=l,t[10]=a*u}else if(e.order==="ZYX"){const d=a*p,m=a*g,x=l*p,y=l*g;t[0]=u*p,t[4]=x*f-m,t[8]=d*f+y,t[1]=u*g,t[5]=y*f+d,t[9]=m*f-x,t[2]=-f,t[6]=l*u,t[10]=a*u}else if(e.order==="YZX"){const d=a*u,m=a*f,x=l*u,y=l*f;t[0]=u*p,t[4]=y-d*g,t[8]=x*g+m,t[1]=g,t[5]=a*p,t[9]=-l*p,t[2]=-f*p,t[6]=m*g+x,t[10]=d-y*g}else if(e.order==="XZY"){const d=a*u,m=a*f,x=l*u,y=l*f;t[0]=u*p,t[4]=-g,t[8]=f*p,t[1]=d*g+y,t[5]=a*p,t[9]=m*g-x,t[2]=x*g-m,t[6]=l*p,t[10]=y*g+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(hw,e,fw)}lookAt(e,t,n){const i=this.elements;return In.subVectors(e,t),In.lengthSq()===0&&(In.z=1),In.normalize(),pr.crossVectors(n,In),pr.lengthSq()===0&&(Math.abs(n.z)===1?In.x+=1e-4:In.z+=1e-4,In.normalize(),pr.crossVectors(n,In)),pr.normalize(),Vl.crossVectors(In,pr),i[0]=pr.x,i[4]=Vl.x,i[8]=In.x,i[1]=pr.y,i[5]=Vl.y,i[9]=In.y,i[2]=pr.z,i[6]=Vl.z,i[10]=In.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],l=n[4],u=n[8],f=n[12],p=n[1],g=n[5],d=n[9],m=n[13],x=n[2],y=n[6],v=n[10],M=n[14],S=n[3],T=n[7],b=n[11],A=n[15],L=i[0],D=i[4],N=i[8],q=i[12],B=i[1],C=i[5],z=i[9],J=i[13],W=i[2],Y=i[6],X=i[10],ee=i[14],V=i[3],re=i[7],K=i[11],pe=i[15];return s[0]=a*L+l*B+u*W+f*V,s[4]=a*D+l*C+u*Y+f*re,s[8]=a*N+l*z+u*X+f*K,s[12]=a*q+l*J+u*ee+f*pe,s[1]=p*L+g*B+d*W+m*V,s[5]=p*D+g*C+d*Y+m*re,s[9]=p*N+g*z+d*X+m*K,s[13]=p*q+g*J+d*ee+m*pe,s[2]=x*L+y*B+v*W+M*V,s[6]=x*D+y*C+v*Y+M*re,s[10]=x*N+y*z+v*X+M*K,s[14]=x*q+y*J+v*ee+M*pe,s[3]=S*L+T*B+b*W+A*V,s[7]=S*D+T*C+b*Y+A*re,s[11]=S*N+T*z+b*X+A*K,s[15]=S*q+T*J+b*ee+A*pe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],l=e[5],u=e[9],f=e[13],p=e[2],g=e[6],d=e[10],m=e[14],x=e[3],y=e[7],v=e[11],M=e[15];return x*(+s*u*g-i*f*g-s*l*d+n*f*d+i*l*m-n*u*m)+y*(+t*u*m-t*f*d+s*a*d-i*a*m+i*f*p-s*u*p)+v*(+t*f*g-t*l*m-s*a*g+n*a*m+s*l*p-n*f*p)+M*(-i*l*p-t*u*g+t*l*d+i*a*g-n*a*d+n*u*p)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],l=e[5],u=e[6],f=e[7],p=e[8],g=e[9],d=e[10],m=e[11],x=e[12],y=e[13],v=e[14],M=e[15],S=g*v*f-y*d*f+y*u*m-l*v*m-g*u*M+l*d*M,T=x*d*f-p*v*f-x*u*m+a*v*m+p*u*M-a*d*M,b=p*y*f-x*g*f+x*l*m-a*y*m-p*l*M+a*g*M,A=x*g*u-p*y*u-x*l*d+a*y*d+p*l*v-a*g*v,L=t*S+n*T+i*b+s*A;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/L;return e[0]=S*D,e[1]=(y*d*s-g*v*s-y*i*m+n*v*m+g*i*M-n*d*M)*D,e[2]=(l*v*s-y*u*s+y*i*f-n*v*f-l*i*M+n*u*M)*D,e[3]=(g*u*s-l*d*s-g*i*f+n*d*f+l*i*m-n*u*m)*D,e[4]=T*D,e[5]=(p*v*s-x*d*s+x*i*m-t*v*m-p*i*M+t*d*M)*D,e[6]=(x*u*s-a*v*s-x*i*f+t*v*f+a*i*M-t*u*M)*D,e[7]=(a*d*s-p*u*s+p*i*f-t*d*f-a*i*m+t*u*m)*D,e[8]=b*D,e[9]=(x*g*s-p*y*s-x*n*m+t*y*m+p*n*M-t*g*M)*D,e[10]=(a*y*s-x*l*s+x*n*f-t*y*f-a*n*M+t*l*M)*D,e[11]=(p*l*s-a*g*s-p*n*f+t*g*f+a*n*m-t*l*m)*D,e[12]=A*D,e[13]=(p*y*i-x*g*i+x*n*d-t*y*d-p*n*v+t*g*v)*D,e[14]=(x*l*i-a*y*i-x*n*u+t*y*u+a*n*v-t*l*v)*D,e[15]=(a*g*i-p*l*i+p*n*u-t*g*u-a*n*d+t*l*d)*D,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,l=e.y,u=e.z,f=s*a,p=s*l;return this.set(f*a+n,f*l-i*u,f*u+i*l,0,f*l+i*u,p*l+n,p*u-i*a,0,f*u-i*l,p*u+i*a,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,l=t._z,u=t._w,f=s+s,p=a+a,g=l+l,d=s*f,m=s*p,x=s*g,y=a*p,v=a*g,M=l*g,S=u*f,T=u*p,b=u*g,A=n.x,L=n.y,D=n.z;return i[0]=(1-(y+M))*A,i[1]=(m+b)*A,i[2]=(x-T)*A,i[3]=0,i[4]=(m-b)*L,i[5]=(1-(d+M))*L,i[6]=(v+S)*L,i[7]=0,i[8]=(x+T)*D,i[9]=(v-S)*D,i[10]=(1-(d+y))*D,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=Vs.set(i[0],i[1],i[2]).length();const a=Vs.set(i[4],i[5],i[6]).length(),l=Vs.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],si.copy(this);const f=1/s,p=1/a,g=1/l;return si.elements[0]*=f,si.elements[1]*=f,si.elements[2]*=f,si.elements[4]*=p,si.elements[5]*=p,si.elements[6]*=p,si.elements[8]*=g,si.elements[9]*=g,si.elements[10]*=g,t.setFromRotationMatrix(si),n.x=s,n.y=a,n.z=l,this}makePerspective(e,t,n,i,s,a){a===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const l=this.elements,u=2*s/(t-e),f=2*s/(n-i),p=(t+e)/(t-e),g=(n+i)/(n-i),d=-(a+s)/(a-s),m=-2*a*s/(a-s);return l[0]=u,l[4]=0,l[8]=p,l[12]=0,l[1]=0,l[5]=f,l[9]=g,l[13]=0,l[2]=0,l[6]=0,l[10]=d,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,a){const l=this.elements,u=1/(t-e),f=1/(n-i),p=1/(a-s),g=(t+e)*u,d=(n+i)*f,m=(a+s)*p;return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-g,l[1]=0,l[5]=2*f,l[9]=0,l[13]=-d,l[2]=0,l[6]=0,l[10]=-2*p,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Fe.prototype.isMatrix4=!0;const Vs=new R,si=new Fe,hw=new R(0,0,0),fw=new R(1,1,1),pr=new R,Vl=new R,In=new R,Sm=new Fe,bm=new nn;class Dr{constructor(e=0,t=0,n=0,i=Dr.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],l=i[8],u=i[1],f=i[5],p=i[9],g=i[2],d=i[6],m=i[10];switch(t){case"XYZ":this._y=Math.asin(Vt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-p,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,f),this._z=0);break;case"YXZ":this._x=Math.asin(-Vt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(l,m),this._z=Math.atan2(u,f)):(this._y=Math.atan2(-g,s),this._z=0);break;case"ZXY":this._x=Math.asin(Vt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-g,m),this._z=Math.atan2(-a,f)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-Vt(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(d,m),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,f));break;case"YZX":this._z=Math.asin(Vt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-p,f),this._y=Math.atan2(-g,s)):(this._x=0,this._y=Math.atan2(l,m));break;case"XZY":this._z=Math.asin(-Vt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,f),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-p,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Sm.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Sm,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return bm.setFromEuler(this),this.setFromQuaternion(bm,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Dr.prototype.isEuler=!0;Dr.DefaultOrder="XYZ";Dr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class os{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let dw=0;const Em=new R,Ws=new nn,ki=new Fe,Wl=new R,na=new R,pw=new R,mw=new nn,Tm=new R(1,0,0),Am=new R(0,1,0),Cm=new R(0,0,1),gw={type:"added"},Rm={type:"removed"};class ht extends Rr{constructor(){super(),Object.defineProperty(this,"id",{value:dw++}),this.uuid=On(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ht.DefaultUp.clone();const e=new R,t=new Dr,n=new nn,i=new R(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Fe},normalMatrix:{value:new tn}}),this.matrix=new Fe,this.matrixWorld=new Fe,this.matrixAutoUpdate=ht.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new os,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ws.setFromAxisAngle(e,t),this.quaternion.multiply(Ws),this}rotateOnWorldAxis(e,t){return Ws.setFromAxisAngle(e,t),this.quaternion.premultiply(Ws),this}rotateX(e){return this.rotateOnAxis(Tm,e)}rotateY(e){return this.rotateOnAxis(Am,e)}rotateZ(e){return this.rotateOnAxis(Cm,e)}translateOnAxis(e,t){return Em.copy(e).applyQuaternion(this.quaternion),this.position.add(Em.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Tm,e)}translateY(e){return this.translateOnAxis(Am,e)}translateZ(e){return this.translateOnAxis(Cm,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(ki.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Wl.copy(e):Wl.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),na.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ki.lookAt(na,Wl,this.up):ki.lookAt(Wl,na,this.up),this.quaternion.setFromRotationMatrix(ki),i&&(ki.extractRotation(i.matrixWorld),Ws.setFromRotationMatrix(ki),this.quaternion.premultiply(Ws.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(gw)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Rm)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(Rm)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),ki.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ki.multiply(e.parent.matrixWorld)),e.applyMatrix4(ki),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(na,e,pw),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(na,mw,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function s(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const u=l.shapes;if(Array.isArray(u))for(let f=0,p=u.length;f<p;f++){const g=u[f];s(e.shapes,g)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let u=0,f=this.material.length;u<f;u++)l.push(s(e.materials,this.material[u]));i.material=l}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let l=0;l<this.children.length;l++)i.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let l=0;l<this.animations.length;l++){const u=this.animations[l];i.animations.push(s(e.animations,u))}}if(t){const l=a(e.geometries),u=a(e.materials),f=a(e.textures),p=a(e.images),g=a(e.shapes),d=a(e.skeletons),m=a(e.animations),x=a(e.nodes);l.length>0&&(n.geometries=l),u.length>0&&(n.materials=u),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),d.length>0&&(n.skeletons=d),m.length>0&&(n.animations=m),x.length>0&&(n.nodes=x)}return n.object=i,n;function a(l){const u=[];for(const f in l){const p=l[f];delete p.metadata,u.push(p)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}ht.DefaultUp=new R(0,1,0);ht.DefaultMatrixAutoUpdate=!0;ht.prototype.isObject3D=!0;const oi=new R,Hi=new R,Eh=new R,Gi=new R,qs=new R,Xs=new R,Pm=new R,Th=new R,Ah=new R,Ch=new R;class Wt{constructor(e=new R,t=new R,n=new R){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),oi.subVectors(e,t),i.cross(oi);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){oi.subVectors(i,t),Hi.subVectors(n,t),Eh.subVectors(e,t);const a=oi.dot(oi),l=oi.dot(Hi),u=oi.dot(Eh),f=Hi.dot(Hi),p=Hi.dot(Eh),g=a*f-l*l;if(g===0)return s.set(-2,-1,-1);const d=1/g,m=(f*u-l*p)*d,x=(a*p-l*u)*d;return s.set(1-m-x,x,m)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Gi),Gi.x>=0&&Gi.y>=0&&Gi.x+Gi.y<=1}static getUV(e,t,n,i,s,a,l,u){return this.getBarycoord(e,t,n,i,Gi),u.set(0,0),u.addScaledVector(s,Gi.x),u.addScaledVector(a,Gi.y),u.addScaledVector(l,Gi.z),u}static isFrontFacing(e,t,n,i){return oi.subVectors(n,t),Hi.subVectors(e,t),oi.cross(Hi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return oi.subVectors(this.c,this.b),Hi.subVectors(this.a,this.b),oi.cross(Hi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Wt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return Wt.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Wt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,l;qs.subVectors(i,n),Xs.subVectors(s,n),Th.subVectors(e,n);const u=qs.dot(Th),f=Xs.dot(Th);if(u<=0&&f<=0)return t.copy(n);Ah.subVectors(e,i);const p=qs.dot(Ah),g=Xs.dot(Ah);if(p>=0&&g<=p)return t.copy(i);const d=u*g-p*f;if(d<=0&&u>=0&&p<=0)return a=u/(u-p),t.copy(n).addScaledVector(qs,a);Ch.subVectors(e,s);const m=qs.dot(Ch),x=Xs.dot(Ch);if(x>=0&&m<=x)return t.copy(s);const y=m*f-u*x;if(y<=0&&f>=0&&x<=0)return l=f/(f-x),t.copy(n).addScaledVector(Xs,l);const v=p*x-m*g;if(v<=0&&g-p>=0&&m-x>=0)return Pm.subVectors(s,i),l=(g-p)/(g-p+(m-x)),t.copy(i).addScaledVector(Pm,l);const M=1/(v+y+d);return a=y*M,l=d*M,t.copy(n).addScaledVector(qs,a).addScaledVector(Xs,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let yw=0;class qt extends Rr{constructor(){super(),Object.defineProperty(this,"id",{value:yw++}),this.uuid=On(),this.name="",this.type="Material",this.fog=!0,this.blending=ts,this.side=ls,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Wf,this.blendDst=qf,this.blendEquation=Jr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=zc,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ty,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Lc,this.stencilZFail=Lc,this.stencilZPass=Lc,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===Vf;continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ts&&(n.blending=this.blending),this.side!==ls&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(s){const a=[];for(const l in s){const u=s[l];delete u.metadata,a.push(u)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}qt.prototype.isMaterial=!0;qt.fromType=function(){return null};class $i extends qt{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new Ae(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.combine=za,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}$i.prototype.isMeshBasicMaterial=!0;const Jt=new R,ql=new ue;class mt{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=co,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new Ae),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this}copyVector2sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new ue),t[n++]=a.x,t[n++]=a.y}return this}copyVector3sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new R),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this}copyVector4sArray(e){const t=this.array;let n=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new wt),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ql.fromBufferAttribute(this,t),ql.applyMatrix3(e),this.setXY(t,ql.x,ql.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.applyMatrix3(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.applyMatrix4(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.applyNormalMatrix(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.transformDirection(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==co&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}mt.prototype.isBufferAttribute=!0;class ly extends mt{constructor(e,t,n){super(new Int8Array(e),t,n)}}class cy extends mt{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class uy extends mt{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class hy extends mt{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Xc extends mt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class fy extends mt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class jc extends mt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class dy extends mt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}dy.prototype.isFloat16BufferAttribute=!0;class Ne extends mt{constructor(e,t,n){super(new Float32Array(e),t,n)}}class py extends mt{constructor(e,t,n){super(new Float64Array(e),t,n)}}let xw=0;const Yn=new Fe,Rh=new ht,js=new R,zn=new Un,ia=new Un,rn=new R;class Ye extends Rr{constructor(){super(),Object.defineProperty(this,"id",{value:xw++}),this.uuid=On(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(iy(e)?jc:Xc)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new tn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Yn.makeRotationFromQuaternion(e),this.applyMatrix4(Yn),this}rotateX(e){return Yn.makeRotationX(e),this.applyMatrix4(Yn),this}rotateY(e){return Yn.makeRotationY(e),this.applyMatrix4(Yn),this}rotateZ(e){return Yn.makeRotationZ(e),this.applyMatrix4(Yn),this}translate(e,t,n){return Yn.makeTranslation(e,t,n),this.applyMatrix4(Yn),this}scale(e,t,n){return Yn.makeScale(e,t,n),this.applyMatrix4(Yn),this}lookAt(e){return Rh.lookAt(e),Rh.updateMatrix(),this.applyMatrix4(Rh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(js).negate(),this.translate(js.x,js.y,js.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ne(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Un);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new R(-1/0,-1/0,-1/0),new R(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];zn.setFromBufferAttribute(s),this.morphTargetsRelative?(rn.addVectors(this.boundingBox.min,zn.min),this.boundingBox.expandByPoint(rn),rn.addVectors(this.boundingBox.max,zn.max),this.boundingBox.expandByPoint(rn)):(this.boundingBox.expandByPoint(zn.min),this.boundingBox.expandByPoint(zn.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 Lr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new R,1/0);return}if(e){const n=this.boundingSphere.center;if(zn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const l=t[s];ia.setFromBufferAttribute(l),this.morphTargetsRelative?(rn.addVectors(zn.min,ia.min),zn.expandByPoint(rn),rn.addVectors(zn.max,ia.max),zn.expandByPoint(rn)):(zn.expandByPoint(ia.min),zn.expandByPoint(ia.max))}zn.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)rn.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(rn));if(t)for(let s=0,a=t.length;s<a;s++){const l=t[s],u=this.morphTargetsRelative;for(let f=0,p=l.count;f<p;f++)rn.fromBufferAttribute(l,f),u&&(js.fromBufferAttribute(e,f),rn.add(js)),i=Math.max(i,n.distanceToSquared(rn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,s=t.normal.array,a=t.uv.array,l=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new mt(new Float32Array(4*l),4));const u=this.getAttribute("tangent").array,f=[],p=[];for(let B=0;B<l;B++)f[B]=new R,p[B]=new R;const g=new R,d=new R,m=new R,x=new ue,y=new ue,v=new ue,M=new R,S=new R;function T(B,C,z){g.fromArray(i,B*3),d.fromArray(i,C*3),m.fromArray(i,z*3),x.fromArray(a,B*2),y.fromArray(a,C*2),v.fromArray(a,z*2),d.sub(g),m.sub(g),y.sub(x),v.sub(x);const J=1/(y.x*v.y-v.x*y.y);isFinite(J)&&(M.copy(d).multiplyScalar(v.y).addScaledVector(m,-y.y).multiplyScalar(J),S.copy(m).multiplyScalar(y.x).addScaledVector(d,-v.x).multiplyScalar(J),f[B].add(M),f[C].add(M),f[z].add(M),p[B].add(S),p[C].add(S),p[z].add(S))}let b=this.groups;b.length===0&&(b=[{start:0,count:n.length}]);for(let B=0,C=b.length;B<C;++B){const z=b[B],J=z.start,W=z.count;for(let Y=J,X=J+W;Y<X;Y+=3)T(n[Y+0],n[Y+1],n[Y+2])}const A=new R,L=new R,D=new R,N=new R;function q(B){D.fromArray(s,B*3),N.copy(D);const C=f[B];A.copy(C),A.sub(D.multiplyScalar(D.dot(C))).normalize(),L.crossVectors(N,C);const J=L.dot(p[B])<0?-1:1;u[B*4]=A.x,u[B*4+1]=A.y,u[B*4+2]=A.z,u[B*4+3]=J}for(let B=0,C=b.length;B<C;++B){const z=b[B],J=z.start,W=z.count;for(let Y=J,X=J+W;Y<X;Y+=3)q(n[Y+0]),q(n[Y+1]),q(n[Y+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new mt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,m=n.count;d<m;d++)n.setXYZ(d,0,0,0);const i=new R,s=new R,a=new R,l=new R,u=new R,f=new R,p=new R,g=new R;if(e)for(let d=0,m=e.count;d<m;d+=3){const x=e.getX(d+0),y=e.getX(d+1),v=e.getX(d+2);i.fromBufferAttribute(t,x),s.fromBufferAttribute(t,y),a.fromBufferAttribute(t,v),p.subVectors(a,s),g.subVectors(i,s),p.cross(g),l.fromBufferAttribute(n,x),u.fromBufferAttribute(n,y),f.fromBufferAttribute(n,v),l.add(p),u.add(p),f.add(p),n.setXYZ(x,l.x,l.y,l.z),n.setXYZ(y,u.x,u.y,u.z),n.setXYZ(v,f.x,f.y,f.z)}else for(let d=0,m=t.count;d<m;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),p.subVectors(a,s),g.subVectors(i,s),p.cross(g),n.setXYZ(d+0,p.x,p.y,p.z),n.setXYZ(d+1,p.x,p.y,p.z),n.setXYZ(d+2,p.x,p.y,p.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(e.attributes[i]===void 0)continue;const a=n[i].array,l=e.attributes[i],u=l.array,f=l.itemSize*t,p=Math.min(u.length,a.length-f);for(let g=0,d=f;g<p;g++,d++)a[d]=u[g]}return this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)rn.fromBufferAttribute(e,t),rn.normalize(),e.setXYZ(t,rn.x,rn.y,rn.z)}toNonIndexed(){function e(l,u){const f=l.array,p=l.itemSize,g=l.normalized,d=new f.constructor(u.length*p);let m=0,x=0;for(let y=0,v=u.length;y<v;y++){l.isInterleavedBufferAttribute?m=u[y]*l.data.stride+l.offset:m=u[y]*p;for(let M=0;M<p;M++)d[x++]=f[m++]}return new mt(d,p,g)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ye,n=this.index.array,i=this.attributes;for(const l in i){const u=i[l],f=e(u,n);t.setAttribute(l,f)}const s=this.morphAttributes;for(const l in s){const u=[],f=s[l];for(let p=0,g=f.length;p<g;p++){const d=f[p],m=e(d,n);u.push(m)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let l=0,u=a.length;l<u;l++){const f=a[l];t.addGroup(f.start,f.count,f.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const f in u)u[f]!==void 0&&(e[f]=u[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const f=n[u];e.data.attributes[u]=f.toJSON(e.data)}const i={};let s=!1;for(const u in this.morphAttributes){const f=this.morphAttributes[u],p=[];for(let g=0,d=f.length;g<d;g++){const m=f[g];p.push(m.toJSON(e.data))}p.length>0&&(i[u]=p,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const f in i){const p=i[f];this.setAttribute(f,p.clone(t))}const s=e.morphAttributes;for(const f in s){const p=[],g=s[f];for(let d=0,m=g.length;d<m;d++)p.push(g[d].clone(t));this.morphAttributes[f]=p}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let f=0,p=a.length;f<p;f++){const g=a[f];this.addGroup(g.start,g.count,g.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}Ye.prototype.isBufferGeometry=!0;const Lm=new Fe,Ys=new Qi,Ph=new Lr,mr=new R,gr=new R,yr=new R,Lh=new R,Dh=new R,Ih=new R,Xl=new R,jl=new R,Yl=new R,Jl=new ue,Zl=new ue,Kl=new ue,zh=new R,Ql=new R;class Kt extends ht{constructor(e=new Ye,t=new $i){super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const l=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),Ph.copy(n.boundingSphere),Ph.applyMatrix4(s),e.ray.intersectsSphere(Ph)===!1)||(Lm.copy(s).invert(),Ys.copy(e.ray).applyMatrix4(Lm),n.boundingBox!==null&&Ys.intersectsBox(n.boundingBox)===!1))return;let a;if(n.isBufferGeometry){const l=n.index,u=n.attributes.position,f=n.morphAttributes.position,p=n.morphTargetsRelative,g=n.attributes.uv,d=n.attributes.uv2,m=n.groups,x=n.drawRange;if(l!==null)if(Array.isArray(i))for(let y=0,v=m.length;y<v;y++){const M=m[y],S=i[M.materialIndex],T=Math.max(M.start,x.start),b=Math.min(l.count,Math.min(M.start+M.count,x.start+x.count));for(let A=T,L=b;A<L;A+=3){const D=l.getX(A),N=l.getX(A+1),q=l.getX(A+2);a=$l(this,S,e,Ys,u,f,p,g,d,D,N,q),a&&(a.faceIndex=Math.floor(A/3),a.face.materialIndex=M.materialIndex,t.push(a))}}else{const y=Math.max(0,x.start),v=Math.min(l.count,x.start+x.count);for(let M=y,S=v;M<S;M+=3){const T=l.getX(M),b=l.getX(M+1),A=l.getX(M+2);a=$l(this,i,e,Ys,u,f,p,g,d,T,b,A),a&&(a.faceIndex=Math.floor(M/3),t.push(a))}}else if(u!==void 0)if(Array.isArray(i))for(let y=0,v=m.length;y<v;y++){const M=m[y],S=i[M.materialIndex],T=Math.max(M.start,x.start),b=Math.min(u.count,Math.min(M.start+M.count,x.start+x.count));for(let A=T,L=b;A<L;A+=3){const D=A,N=A+1,q=A+2;a=$l(this,S,e,Ys,u,f,p,g,d,D,N,q),a&&(a.faceIndex=Math.floor(A/3),a.face.materialIndex=M.materialIndex,t.push(a))}}else{const y=Math.max(0,x.start),v=Math.min(u.count,x.start+x.count);for(let M=y,S=v;M<S;M+=3){const T=M,b=M+1,A=M+2;a=$l(this,i,e,Ys,u,f,p,g,d,T,b,A),a&&(a.faceIndex=Math.floor(M/3),t.push(a))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}Kt.prototype.isMesh=!0;function vw(r,e,t,n,i,s,a,l){let u;if(e.side===Fn?u=n.intersectTriangle(a,s,i,!0,l):u=n.intersectTriangle(i,s,a,e.side!==cs,l),u===null)return null;Ql.copy(l),Ql.applyMatrix4(r.matrixWorld);const f=t.ray.origin.distanceTo(Ql);return f<t.near||f>t.far?null:{distance:f,point:Ql.clone(),object:r}}function $l(r,e,t,n,i,s,a,l,u,f,p,g){mr.fromBufferAttribute(i,f),gr.fromBufferAttribute(i,p),yr.fromBufferAttribute(i,g);const d=r.morphTargetInfluences;if(s&&d){Xl.set(0,0,0),jl.set(0,0,0),Yl.set(0,0,0);for(let x=0,y=s.length;x<y;x++){const v=d[x],M=s[x];v!==0&&(Lh.fromBufferAttribute(M,f),Dh.fromBufferAttribute(M,p),Ih.fromBufferAttribute(M,g),a?(Xl.addScaledVector(Lh,v),jl.addScaledVector(Dh,v),Yl.addScaledVector(Ih,v)):(Xl.addScaledVector(Lh.sub(mr),v),jl.addScaledVector(Dh.sub(gr),v),Yl.addScaledVector(Ih.sub(yr),v)))}mr.add(Xl),gr.add(jl),yr.add(Yl)}r.isSkinnedMesh&&(r.boneTransform(f,mr),r.boneTransform(p,gr),r.boneTransform(g,yr));const m=vw(r,e,t,n,mr,gr,yr,zh);if(m){l&&(Jl.fromBufferAttribute(l,f),Zl.fromBufferAttribute(l,p),Kl.fromBufferAttribute(l,g),m.uv=Wt.getUV(zh,mr,gr,yr,Jl,Zl,Kl,new ue)),u&&(Jl.fromBufferAttribute(u,f),Zl.fromBufferAttribute(u,p),Kl.fromBufferAttribute(u,g),m.uv2=Wt.getUV(zh,mr,gr,yr,Jl,Zl,Kl,new ue));const x={a:f,b:p,c:g,normal:new R,materialIndex:0};Wt.getNormal(mr,gr,yr,x.normal),m.face=x}return m}class Ji extends Ye{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const l=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const u=[],f=[],p=[],g=[];let d=0,m=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1),x("x","z","y",1,1,e,n,t,i,a,2),x("x","z","y",1,-1,e,n,-t,i,a,3),x("x","y","z",1,-1,e,t,n,i,s,4),x("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(u),this.setAttribute("position",new Ne(f,3)),this.setAttribute("normal",new Ne(p,3)),this.setAttribute("uv",new Ne(g,2));function x(y,v,M,S,T,b,A,L,D,N,q){const B=b/D,C=A/N,z=b/2,J=A/2,W=L/2,Y=D+1,X=N+1;let ee=0,V=0;const re=new R;for(let K=0;K<X;K++){const pe=K*C-J;for(let he=0;he<Y;he++){const Ce=he*B-z;re[y]=Ce*S,re[v]=pe*T,re[M]=W,f.push(re.x,re.y,re.z),re[y]=0,re[v]=0,re[M]=L>0?1:-1,p.push(re.x,re.y,re.z),g.push(he/D),g.push(1-K/N),ee+=1}}for(let K=0;K<N;K++)for(let pe=0;pe<D;pe++){const he=d+pe+Y*K,Ce=d+pe+Y*(K+1),Ue=d+(pe+1)+Y*(K+1),Be=d+(pe+1)+Y*K;u.push(he,Ce,Be),u.push(Ce,Ue,Be),V+=6}l.addGroup(m,V,q),m+=V,d+=ee}}static fromJSON(e){return new Ji(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ho(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function mn(r){const e={};for(let t=0;t<r.length;t++){const n=ho(r[t]);for(const i in n)e[i]=n[i]}return e}const my={clone:ho,merge:mn};var _w=`void main() {
|
|
6
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
+
}`,ww=`void main() {
|
|
8
|
+
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
+
}`;class Qn extends qt{constructor(e){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=_w,this.fragmentShader=ww,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ho(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}Qn.prototype.isShaderMaterial=!0;class hs extends ht{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Fe,this.projectionMatrix=new Fe,this.projectionMatrixInverse=new Fe}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}hs.prototype.isCamera=!0;class It extends hs{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ma*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(rs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ma*2*Math.atan(Math.tan(rs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(rs*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const u=a.fullWidth,f=a.fullHeight;s+=a.offsetX*i/u,t-=a.offsetY*n/f,i*=a.width/u,n*=a.height/f}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}It.prototype.isPerspectiveCamera=!0;const Js=90,Zs=1;class Yc extends ht{constructor(e,t,n){if(super(),this.type="CubeCamera",n.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=n;const i=new It(Js,Zs,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new R(1,0,0)),this.add(i);const s=new It(Js,Zs,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new R(-1,0,0)),this.add(s);const a=new It(Js,Zs,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new R(0,1,0)),this.add(a);const l=new It(Js,Zs,e,t);l.layers=this.layers,l.up.set(0,0,-1),l.lookAt(new R(0,-1,0)),this.add(l);const u=new It(Js,Zs,e,t);u.layers=this.layers,u.up.set(0,-1,0),u.lookAt(new R(0,0,1)),this.add(u);const f=new It(Js,Zs,e,t);f.layers=this.layers,f.up.set(0,-1,0),f.lookAt(new R(0,0,-1)),this.add(f)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[i,s,a,l,u,f]=this.children,p=e.getRenderTarget(),g=e.outputEncoding,d=e.toneMapping,m=e.xr.enabled;e.outputEncoding=Kn,e.toneMapping=hi,e.xr.enabled=!1;const x=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,l),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=x,e.setRenderTarget(n,5),e.render(t,f),e.setRenderTarget(p),e.outputEncoding=g,e.toneMapping=d,e.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class Ao extends Ut{constructor(e,t,n,i,s,a,l,u,f,p){e=e!==void 0?e:[],t=t!==void 0?t:Sr,super(e,t,n,i,s,a,l,u,f,p),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}Ao.prototype.isCubeTexture=!0;class Jc extends Sn{constructor(e,t={}){super(e,e,t);const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Ao(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Gt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
10
|
+
|
|
11
|
+
varying vec3 vWorldDirection;
|
|
12
|
+
|
|
13
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
14
|
+
|
|
15
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
void main() {
|
|
20
|
+
|
|
21
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
22
|
+
|
|
23
|
+
#include <begin_vertex>
|
|
24
|
+
#include <project_vertex>
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
`,fragmentShader:`
|
|
28
|
+
|
|
29
|
+
uniform sampler2D tEquirect;
|
|
30
|
+
|
|
31
|
+
varying vec3 vWorldDirection;
|
|
32
|
+
|
|
33
|
+
#include <common>
|
|
34
|
+
|
|
35
|
+
void main() {
|
|
36
|
+
|
|
37
|
+
vec3 direction = normalize( vWorldDirection );
|
|
38
|
+
|
|
39
|
+
vec2 sampleUV = equirectUv( direction );
|
|
40
|
+
|
|
41
|
+
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
`},i=new Ji(5,5,5),s=new Qn({name:"CubemapFromEquirect",uniforms:ho(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Fn,blending:Yi});s.uniforms.tEquirect.value=t;const a=new Kt(i,s),l=t.minFilter;return t.minFilter===vs&&(t.minFilter=Gt),new Yc(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}Jc.prototype.isWebGLCubeRenderTarget=!0;const Nh=new R,Mw=new R,Sw=new tn;class ci{constructor(e=new R(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Nh.subVectors(n,t).cross(Mw.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(Nh),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Sw.getNormalMatrix(e),i=this.coplanarPoint(Nh).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}ci.prototype.isPlane=!0;const Ks=new Lr,ec=new R;class Fa{constructor(e=new ci,t=new ci,n=new ci,i=new ci,s=new ci,a=new ci){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(i),l[4].copy(s),l[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],s=n[1],a=n[2],l=n[3],u=n[4],f=n[5],p=n[6],g=n[7],d=n[8],m=n[9],x=n[10],y=n[11],v=n[12],M=n[13],S=n[14],T=n[15];return t[0].setComponents(l-i,g-u,y-d,T-v).normalize(),t[1].setComponents(l+i,g+u,y+d,T+v).normalize(),t[2].setComponents(l+s,g+f,y+m,T+M).normalize(),t[3].setComponents(l-s,g-f,y-m,T-M).normalize(),t[4].setComponents(l-a,g-p,y-x,T-S).normalize(),t[5].setComponents(l+a,g+p,y+x,T+S).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Ks.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ks)}intersectsSprite(e){return Ks.center.set(0,0,0),Ks.radius=.7071067811865476,Ks.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ks)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(ec.x=i.normal.x>0?e.max.x:e.min.x,ec.y=i.normal.y>0?e.max.y:e.min.y,ec.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ec)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function gy(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function bw(r,e){const t=e.isWebGL2,n=new WeakMap;function i(f,p){const g=f.array,d=f.usage,m=r.createBuffer();r.bindBuffer(p,m),r.bufferData(p,g,d),f.onUploadCallback();let x;if(g instanceof Float32Array)x=5126;else if(g instanceof Uint16Array)if(f.isFloat16BufferAttribute)if(t)x=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else x=5123;else if(g instanceof Int16Array)x=5122;else if(g instanceof Uint32Array)x=5125;else if(g instanceof Int32Array)x=5124;else if(g instanceof Int8Array)x=5120;else if(g instanceof Uint8Array)x=5121;else if(g instanceof Uint8ClampedArray)x=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+g);return{buffer:m,type:x,bytesPerElement:g.BYTES_PER_ELEMENT,version:f.version}}function s(f,p,g){const d=p.array,m=p.updateRange;r.bindBuffer(g,f),m.count===-1?r.bufferSubData(g,0,d):(t?r.bufferSubData(g,m.offset*d.BYTES_PER_ELEMENT,d,m.offset,m.count):r.bufferSubData(g,m.offset*d.BYTES_PER_ELEMENT,d.subarray(m.offset,m.offset+m.count)),m.count=-1)}function a(f){return f.isInterleavedBufferAttribute&&(f=f.data),n.get(f)}function l(f){f.isInterleavedBufferAttribute&&(f=f.data);const p=n.get(f);p&&(r.deleteBuffer(p.buffer),n.delete(f))}function u(f,p){if(f.isGLBufferAttribute){const d=n.get(f);(!d||d.version<f.version)&&n.set(f,{buffer:f.buffer,type:f.type,bytesPerElement:f.elementSize,version:f.version});return}f.isInterleavedBufferAttribute&&(f=f.data);const g=n.get(f);g===void 0?n.set(f,i(f,p)):g.version<f.version&&(s(g.buffer,f,p),g.version=f.version)}return{get:a,remove:l,update:u}}class fs extends Ye{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,l=Math.floor(n),u=Math.floor(i),f=l+1,p=u+1,g=e/l,d=t/u,m=[],x=[],y=[],v=[];for(let M=0;M<p;M++){const S=M*d-a;for(let T=0;T<f;T++){const b=T*g-s;x.push(b,-S,0),y.push(0,0,1),v.push(T/l),v.push(1-M/u)}}for(let M=0;M<u;M++)for(let S=0;S<l;S++){const T=S+f*M,b=S+f*(M+1),A=S+1+f*(M+1),L=S+1+f*M;m.push(T,b,L),m.push(b,A,L)}this.setIndex(m),this.setAttribute("position",new Ne(x,3)),this.setAttribute("normal",new Ne(y,3)),this.setAttribute("uv",new Ne(v,2))}static fromJSON(e){return new fs(e.width,e.height,e.widthSegments,e.heightSegments)}}var Ew=`#ifdef USE_ALPHAMAP
|
|
45
|
+
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
|
46
|
+
#endif`,Tw=`#ifdef USE_ALPHAMAP
|
|
47
|
+
uniform sampler2D alphaMap;
|
|
48
|
+
#endif`,Aw=`#ifdef USE_ALPHATEST
|
|
49
|
+
if ( diffuseColor.a < alphaTest ) discard;
|
|
50
|
+
#endif`,Cw=`#ifdef USE_ALPHATEST
|
|
51
|
+
uniform float alphaTest;
|
|
52
|
+
#endif`,Rw=`#ifdef USE_AOMAP
|
|
53
|
+
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
54
|
+
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
55
|
+
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
56
|
+
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
|
57
|
+
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
58
|
+
#endif
|
|
59
|
+
#endif`,Pw=`#ifdef USE_AOMAP
|
|
60
|
+
uniform sampler2D aoMap;
|
|
61
|
+
uniform float aoMapIntensity;
|
|
62
|
+
#endif`,Lw="vec3 transformed = vec3( position );",Dw=`vec3 objectNormal = vec3( normal );
|
|
63
|
+
#ifdef USE_TANGENT
|
|
64
|
+
vec3 objectTangent = vec3( tangent.xyz );
|
|
65
|
+
#endif`,Iw=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
|
66
|
+
return RECIPROCAL_PI * diffuseColor;
|
|
67
|
+
}
|
|
68
|
+
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
69
|
+
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
70
|
+
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
71
|
+
}
|
|
72
|
+
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
73
|
+
float a2 = pow2( alpha );
|
|
74
|
+
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
75
|
+
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
76
|
+
return 0.5 / max( gv + gl, EPSILON );
|
|
77
|
+
}
|
|
78
|
+
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
79
|
+
float a2 = pow2( alpha );
|
|
80
|
+
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|
81
|
+
return RECIPROCAL_PI * a2 / pow2( denom );
|
|
82
|
+
}
|
|
83
|
+
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
|
|
84
|
+
float alpha = pow2( roughness );
|
|
85
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
86
|
+
float dotNL = saturate( dot( normal, lightDir ) );
|
|
87
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
88
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
89
|
+
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
90
|
+
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
91
|
+
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
92
|
+
float D = D_GGX( alpha, dotNH );
|
|
93
|
+
return F * ( V * D );
|
|
94
|
+
}
|
|
95
|
+
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|
96
|
+
const float LUT_SIZE = 64.0;
|
|
97
|
+
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
98
|
+
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|
99
|
+
float dotNV = saturate( dot( N, V ) );
|
|
100
|
+
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|
101
|
+
uv = uv * LUT_SCALE + LUT_BIAS;
|
|
102
|
+
return uv;
|
|
103
|
+
}
|
|
104
|
+
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|
105
|
+
float l = length( f );
|
|
106
|
+
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|
107
|
+
}
|
|
108
|
+
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|
109
|
+
float x = dot( v1, v2 );
|
|
110
|
+
float y = abs( x );
|
|
111
|
+
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|
112
|
+
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|
113
|
+
float v = a / b;
|
|
114
|
+
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|
115
|
+
return cross( v1, v2 ) * theta_sintheta;
|
|
116
|
+
}
|
|
117
|
+
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|
118
|
+
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|
119
|
+
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|
120
|
+
vec3 lightNormal = cross( v1, v2 );
|
|
121
|
+
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|
122
|
+
vec3 T1, T2;
|
|
123
|
+
T1 = normalize( V - N * dot( V, N ) );
|
|
124
|
+
T2 = - cross( N, T1 );
|
|
125
|
+
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
|
126
|
+
vec3 coords[ 4 ];
|
|
127
|
+
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|
128
|
+
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|
129
|
+
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|
130
|
+
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|
131
|
+
coords[ 0 ] = normalize( coords[ 0 ] );
|
|
132
|
+
coords[ 1 ] = normalize( coords[ 1 ] );
|
|
133
|
+
coords[ 2 ] = normalize( coords[ 2 ] );
|
|
134
|
+
coords[ 3 ] = normalize( coords[ 3 ] );
|
|
135
|
+
vec3 vectorFormFactor = vec3( 0.0 );
|
|
136
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|
137
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|
138
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|
139
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|
140
|
+
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|
141
|
+
return vec3( result );
|
|
142
|
+
}
|
|
143
|
+
float G_BlinnPhong_Implicit( ) {
|
|
144
|
+
return 0.25;
|
|
145
|
+
}
|
|
146
|
+
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
147
|
+
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|
148
|
+
}
|
|
149
|
+
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|
150
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
151
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
152
|
+
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
153
|
+
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|
154
|
+
float G = G_BlinnPhong_Implicit( );
|
|
155
|
+
float D = D_BlinnPhong( shininess, dotNH );
|
|
156
|
+
return F * ( G * D );
|
|
157
|
+
}
|
|
158
|
+
#if defined( USE_SHEEN )
|
|
159
|
+
float D_Charlie( float roughness, float dotNH ) {
|
|
160
|
+
float alpha = pow2( roughness );
|
|
161
|
+
float invAlpha = 1.0 / alpha;
|
|
162
|
+
float cos2h = dotNH * dotNH;
|
|
163
|
+
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
|
164
|
+
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
|
165
|
+
}
|
|
166
|
+
float V_Neubelt( float dotNV, float dotNL ) {
|
|
167
|
+
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
|
168
|
+
}
|
|
169
|
+
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
|
170
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
171
|
+
float dotNL = saturate( dot( normal, lightDir ) );
|
|
172
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
173
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
174
|
+
float D = D_Charlie( sheenRoughness, dotNH );
|
|
175
|
+
float V = V_Neubelt( dotNV, dotNL );
|
|
176
|
+
return sheenColor * ( D * V );
|
|
177
|
+
}
|
|
178
|
+
#endif`,zw=`#ifdef USE_BUMPMAP
|
|
179
|
+
uniform sampler2D bumpMap;
|
|
180
|
+
uniform float bumpScale;
|
|
181
|
+
vec2 dHdxy_fwd() {
|
|
182
|
+
vec2 dSTdx = dFdx( vUv );
|
|
183
|
+
vec2 dSTdy = dFdy( vUv );
|
|
184
|
+
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
|
|
185
|
+
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
|
|
186
|
+
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
|
|
187
|
+
return vec2( dBx, dBy );
|
|
188
|
+
}
|
|
189
|
+
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|
190
|
+
vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
|
|
191
|
+
vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
|
|
192
|
+
vec3 vN = surf_norm;
|
|
193
|
+
vec3 R1 = cross( vSigmaY, vN );
|
|
194
|
+
vec3 R2 = cross( vN, vSigmaX );
|
|
195
|
+
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|
196
|
+
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
197
|
+
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
198
|
+
}
|
|
199
|
+
#endif`,Nw=`#if NUM_CLIPPING_PLANES > 0
|
|
200
|
+
vec4 plane;
|
|
201
|
+
#pragma unroll_loop_start
|
|
202
|
+
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
203
|
+
plane = clippingPlanes[ i ];
|
|
204
|
+
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
205
|
+
}
|
|
206
|
+
#pragma unroll_loop_end
|
|
207
|
+
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
208
|
+
bool clipped = true;
|
|
209
|
+
#pragma unroll_loop_start
|
|
210
|
+
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
211
|
+
plane = clippingPlanes[ i ];
|
|
212
|
+
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
213
|
+
}
|
|
214
|
+
#pragma unroll_loop_end
|
|
215
|
+
if ( clipped ) discard;
|
|
216
|
+
#endif
|
|
217
|
+
#endif`,Fw=`#if NUM_CLIPPING_PLANES > 0
|
|
218
|
+
varying vec3 vClipPosition;
|
|
219
|
+
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
220
|
+
#endif`,Ow=`#if NUM_CLIPPING_PLANES > 0
|
|
221
|
+
varying vec3 vClipPosition;
|
|
222
|
+
#endif`,Bw=`#if NUM_CLIPPING_PLANES > 0
|
|
223
|
+
vClipPosition = - mvPosition.xyz;
|
|
224
|
+
#endif`,Uw=`#if defined( USE_COLOR_ALPHA )
|
|
225
|
+
diffuseColor *= vColor;
|
|
226
|
+
#elif defined( USE_COLOR )
|
|
227
|
+
diffuseColor.rgb *= vColor;
|
|
228
|
+
#endif`,kw=`#if defined( USE_COLOR_ALPHA )
|
|
229
|
+
varying vec4 vColor;
|
|
230
|
+
#elif defined( USE_COLOR )
|
|
231
|
+
varying vec3 vColor;
|
|
232
|
+
#endif`,Hw=`#if defined( USE_COLOR_ALPHA )
|
|
233
|
+
varying vec4 vColor;
|
|
234
|
+
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
235
|
+
varying vec3 vColor;
|
|
236
|
+
#endif`,Gw=`#if defined( USE_COLOR_ALPHA )
|
|
237
|
+
vColor = vec4( 1.0 );
|
|
238
|
+
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
239
|
+
vColor = vec3( 1.0 );
|
|
240
|
+
#endif
|
|
241
|
+
#ifdef USE_COLOR
|
|
242
|
+
vColor *= color;
|
|
243
|
+
#endif
|
|
244
|
+
#ifdef USE_INSTANCING_COLOR
|
|
245
|
+
vColor.xyz *= instanceColor.xyz;
|
|
246
|
+
#endif`,Vw=`#define PI 3.141592653589793
|
|
247
|
+
#define PI2 6.283185307179586
|
|
248
|
+
#define PI_HALF 1.5707963267948966
|
|
249
|
+
#define RECIPROCAL_PI 0.3183098861837907
|
|
250
|
+
#define RECIPROCAL_PI2 0.15915494309189535
|
|
251
|
+
#define EPSILON 1e-6
|
|
252
|
+
#ifndef saturate
|
|
253
|
+
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
254
|
+
#endif
|
|
255
|
+
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
|
256
|
+
float pow2( const in float x ) { return x*x; }
|
|
257
|
+
float pow3( const in float x ) { return x*x*x; }
|
|
258
|
+
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|
259
|
+
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|
260
|
+
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
|
|
261
|
+
highp float rand( const in vec2 uv ) {
|
|
262
|
+
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|
263
|
+
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|
264
|
+
return fract( sin( sn ) * c );
|
|
265
|
+
}
|
|
266
|
+
#ifdef HIGH_PRECISION
|
|
267
|
+
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|
268
|
+
#else
|
|
269
|
+
float precisionSafeLength( vec3 v ) {
|
|
270
|
+
float maxComponent = max3( abs( v ) );
|
|
271
|
+
return length( v / maxComponent ) * maxComponent;
|
|
272
|
+
}
|
|
273
|
+
#endif
|
|
274
|
+
struct IncidentLight {
|
|
275
|
+
vec3 color;
|
|
276
|
+
vec3 direction;
|
|
277
|
+
bool visible;
|
|
278
|
+
};
|
|
279
|
+
struct ReflectedLight {
|
|
280
|
+
vec3 directDiffuse;
|
|
281
|
+
vec3 directSpecular;
|
|
282
|
+
vec3 indirectDiffuse;
|
|
283
|
+
vec3 indirectSpecular;
|
|
284
|
+
};
|
|
285
|
+
struct GeometricContext {
|
|
286
|
+
vec3 position;
|
|
287
|
+
vec3 normal;
|
|
288
|
+
vec3 viewDir;
|
|
289
|
+
#ifdef USE_CLEARCOAT
|
|
290
|
+
vec3 clearcoatNormal;
|
|
291
|
+
#endif
|
|
292
|
+
};
|
|
293
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
294
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
295
|
+
}
|
|
296
|
+
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|
297
|
+
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|
298
|
+
}
|
|
299
|
+
mat3 transposeMat3( const in mat3 m ) {
|
|
300
|
+
mat3 tmp;
|
|
301
|
+
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
|
302
|
+
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
|
303
|
+
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
|
304
|
+
return tmp;
|
|
305
|
+
}
|
|
306
|
+
float linearToRelativeLuminance( const in vec3 color ) {
|
|
307
|
+
vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
|
|
308
|
+
return dot( weights, color.rgb );
|
|
309
|
+
}
|
|
310
|
+
bool isPerspectiveMatrix( mat4 m ) {
|
|
311
|
+
return m[ 2 ][ 3 ] == - 1.0;
|
|
312
|
+
}
|
|
313
|
+
vec2 equirectUv( in vec3 dir ) {
|
|
314
|
+
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|
315
|
+
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|
316
|
+
return vec2( u, v );
|
|
317
|
+
}`,Ww=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
318
|
+
#define cubeUV_minMipLevel 4.0
|
|
319
|
+
#define cubeUV_minTileSize 16.0
|
|
320
|
+
float getFace( vec3 direction ) {
|
|
321
|
+
vec3 absDirection = abs( direction );
|
|
322
|
+
float face = - 1.0;
|
|
323
|
+
if ( absDirection.x > absDirection.z ) {
|
|
324
|
+
if ( absDirection.x > absDirection.y )
|
|
325
|
+
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|
326
|
+
else
|
|
327
|
+
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
328
|
+
} else {
|
|
329
|
+
if ( absDirection.z > absDirection.y )
|
|
330
|
+
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|
331
|
+
else
|
|
332
|
+
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
333
|
+
}
|
|
334
|
+
return face;
|
|
335
|
+
}
|
|
336
|
+
vec2 getUV( vec3 direction, float face ) {
|
|
337
|
+
vec2 uv;
|
|
338
|
+
if ( face == 0.0 ) {
|
|
339
|
+
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|
340
|
+
} else if ( face == 1.0 ) {
|
|
341
|
+
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|
342
|
+
} else if ( face == 2.0 ) {
|
|
343
|
+
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|
344
|
+
} else if ( face == 3.0 ) {
|
|
345
|
+
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|
346
|
+
} else if ( face == 4.0 ) {
|
|
347
|
+
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|
348
|
+
} else {
|
|
349
|
+
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|
350
|
+
}
|
|
351
|
+
return 0.5 * ( uv + 1.0 );
|
|
352
|
+
}
|
|
353
|
+
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|
354
|
+
float face = getFace( direction );
|
|
355
|
+
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|
356
|
+
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|
357
|
+
float faceSize = exp2( mipInt );
|
|
358
|
+
vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;
|
|
359
|
+
if ( face > 2.0 ) {
|
|
360
|
+
uv.y += faceSize;
|
|
361
|
+
face -= 3.0;
|
|
362
|
+
}
|
|
363
|
+
uv.x += face * faceSize;
|
|
364
|
+
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
|
365
|
+
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
|
366
|
+
uv.x *= CUBEUV_TEXEL_WIDTH;
|
|
367
|
+
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
|
368
|
+
#ifdef texture2DGradEXT
|
|
369
|
+
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
|
370
|
+
#else
|
|
371
|
+
return texture2D( envMap, uv ).rgb;
|
|
372
|
+
#endif
|
|
373
|
+
}
|
|
374
|
+
#define r0 1.0
|
|
375
|
+
#define v0 0.339
|
|
376
|
+
#define m0 - 2.0
|
|
377
|
+
#define r1 0.8
|
|
378
|
+
#define v1 0.276
|
|
379
|
+
#define m1 - 1.0
|
|
380
|
+
#define r4 0.4
|
|
381
|
+
#define v4 0.046
|
|
382
|
+
#define m4 2.0
|
|
383
|
+
#define r5 0.305
|
|
384
|
+
#define v5 0.016
|
|
385
|
+
#define m5 3.0
|
|
386
|
+
#define r6 0.21
|
|
387
|
+
#define v6 0.0038
|
|
388
|
+
#define m6 4.0
|
|
389
|
+
float roughnessToMip( float roughness ) {
|
|
390
|
+
float mip = 0.0;
|
|
391
|
+
if ( roughness >= r1 ) {
|
|
392
|
+
mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
|
|
393
|
+
} else if ( roughness >= r4 ) {
|
|
394
|
+
mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
|
|
395
|
+
} else if ( roughness >= r5 ) {
|
|
396
|
+
mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
|
|
397
|
+
} else if ( roughness >= r6 ) {
|
|
398
|
+
mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
|
|
399
|
+
} else {
|
|
400
|
+
mip = - 2.0 * log2( 1.16 * roughness ); }
|
|
401
|
+
return mip;
|
|
402
|
+
}
|
|
403
|
+
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
|
404
|
+
float mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );
|
|
405
|
+
float mipF = fract( mip );
|
|
406
|
+
float mipInt = floor( mip );
|
|
407
|
+
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
|
408
|
+
if ( mipF == 0.0 ) {
|
|
409
|
+
return vec4( color0, 1.0 );
|
|
410
|
+
} else {
|
|
411
|
+
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
|
412
|
+
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
#endif`,qw=`vec3 transformedNormal = objectNormal;
|
|
416
|
+
#ifdef USE_INSTANCING
|
|
417
|
+
mat3 m = mat3( instanceMatrix );
|
|
418
|
+
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
|
|
419
|
+
transformedNormal = m * transformedNormal;
|
|
420
|
+
#endif
|
|
421
|
+
transformedNormal = normalMatrix * transformedNormal;
|
|
422
|
+
#ifdef FLIP_SIDED
|
|
423
|
+
transformedNormal = - transformedNormal;
|
|
424
|
+
#endif
|
|
425
|
+
#ifdef USE_TANGENT
|
|
426
|
+
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
427
|
+
#ifdef FLIP_SIDED
|
|
428
|
+
transformedTangent = - transformedTangent;
|
|
429
|
+
#endif
|
|
430
|
+
#endif`,Xw=`#ifdef USE_DISPLACEMENTMAP
|
|
431
|
+
uniform sampler2D displacementMap;
|
|
432
|
+
uniform float displacementScale;
|
|
433
|
+
uniform float displacementBias;
|
|
434
|
+
#endif`,jw=`#ifdef USE_DISPLACEMENTMAP
|
|
435
|
+
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
|
|
436
|
+
#endif`,Yw=`#ifdef USE_EMISSIVEMAP
|
|
437
|
+
vec4 emissiveColor = texture2D( emissiveMap, vUv );
|
|
438
|
+
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
439
|
+
#endif`,Jw=`#ifdef USE_EMISSIVEMAP
|
|
440
|
+
uniform sampler2D emissiveMap;
|
|
441
|
+
#endif`,Zw="gl_FragColor = linearToOutputTexel( gl_FragColor );",Kw=`vec4 LinearToLinear( in vec4 value ) {
|
|
442
|
+
return value;
|
|
443
|
+
}
|
|
444
|
+
vec4 LinearTosRGB( in vec4 value ) {
|
|
445
|
+
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 );
|
|
446
|
+
}`,Qw=`#ifdef USE_ENVMAP
|
|
447
|
+
#ifdef ENV_WORLDPOS
|
|
448
|
+
vec3 cameraToFrag;
|
|
449
|
+
if ( isOrthographic ) {
|
|
450
|
+
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
451
|
+
} else {
|
|
452
|
+
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|
453
|
+
}
|
|
454
|
+
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
455
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
456
|
+
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|
457
|
+
#else
|
|
458
|
+
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|
459
|
+
#endif
|
|
460
|
+
#else
|
|
461
|
+
vec3 reflectVec = vReflect;
|
|
462
|
+
#endif
|
|
463
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
464
|
+
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|
465
|
+
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
466
|
+
vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
|
|
467
|
+
#else
|
|
468
|
+
vec4 envColor = vec4( 0.0 );
|
|
469
|
+
#endif
|
|
470
|
+
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
471
|
+
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
472
|
+
#elif defined( ENVMAP_BLENDING_MIX )
|
|
473
|
+
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
474
|
+
#elif defined( ENVMAP_BLENDING_ADD )
|
|
475
|
+
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
476
|
+
#endif
|
|
477
|
+
#endif`,$w=`#ifdef USE_ENVMAP
|
|
478
|
+
uniform float envMapIntensity;
|
|
479
|
+
uniform float flipEnvMap;
|
|
480
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
481
|
+
uniform samplerCube envMap;
|
|
482
|
+
#else
|
|
483
|
+
uniform sampler2D envMap;
|
|
484
|
+
#endif
|
|
485
|
+
|
|
486
|
+
#endif`,eM=`#ifdef USE_ENVMAP
|
|
487
|
+
uniform float reflectivity;
|
|
488
|
+
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
|
|
489
|
+
#define ENV_WORLDPOS
|
|
490
|
+
#endif
|
|
491
|
+
#ifdef ENV_WORLDPOS
|
|
492
|
+
varying vec3 vWorldPosition;
|
|
493
|
+
uniform float refractionRatio;
|
|
494
|
+
#else
|
|
495
|
+
varying vec3 vReflect;
|
|
496
|
+
#endif
|
|
497
|
+
#endif`,tM=`#ifdef USE_ENVMAP
|
|
498
|
+
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
|
|
499
|
+
#define ENV_WORLDPOS
|
|
500
|
+
#endif
|
|
501
|
+
#ifdef ENV_WORLDPOS
|
|
502
|
+
|
|
503
|
+
varying vec3 vWorldPosition;
|
|
504
|
+
#else
|
|
505
|
+
varying vec3 vReflect;
|
|
506
|
+
uniform float refractionRatio;
|
|
507
|
+
#endif
|
|
508
|
+
#endif`,nM=`#ifdef USE_ENVMAP
|
|
509
|
+
#ifdef ENV_WORLDPOS
|
|
510
|
+
vWorldPosition = worldPosition.xyz;
|
|
511
|
+
#else
|
|
512
|
+
vec3 cameraToVertex;
|
|
513
|
+
if ( isOrthographic ) {
|
|
514
|
+
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
515
|
+
} else {
|
|
516
|
+
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|
517
|
+
}
|
|
518
|
+
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
519
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
520
|
+
vReflect = reflect( cameraToVertex, worldNormal );
|
|
521
|
+
#else
|
|
522
|
+
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
523
|
+
#endif
|
|
524
|
+
#endif
|
|
525
|
+
#endif`,iM=`#ifdef USE_FOG
|
|
526
|
+
vFogDepth = - mvPosition.z;
|
|
527
|
+
#endif`,rM=`#ifdef USE_FOG
|
|
528
|
+
varying float vFogDepth;
|
|
529
|
+
#endif`,sM=`#ifdef USE_FOG
|
|
530
|
+
#ifdef FOG_EXP2
|
|
531
|
+
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
532
|
+
#else
|
|
533
|
+
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
534
|
+
#endif
|
|
535
|
+
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
536
|
+
#endif`,oM=`#ifdef USE_FOG
|
|
537
|
+
uniform vec3 fogColor;
|
|
538
|
+
varying float vFogDepth;
|
|
539
|
+
#ifdef FOG_EXP2
|
|
540
|
+
uniform float fogDensity;
|
|
541
|
+
#else
|
|
542
|
+
uniform float fogNear;
|
|
543
|
+
uniform float fogFar;
|
|
544
|
+
#endif
|
|
545
|
+
#endif`,aM=`#ifdef USE_GRADIENTMAP
|
|
546
|
+
uniform sampler2D gradientMap;
|
|
547
|
+
#endif
|
|
548
|
+
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
549
|
+
float dotNL = dot( normal, lightDirection );
|
|
550
|
+
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|
551
|
+
#ifdef USE_GRADIENTMAP
|
|
552
|
+
return vec3( texture2D( gradientMap, coord ).r );
|
|
553
|
+
#else
|
|
554
|
+
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
|
|
555
|
+
#endif
|
|
556
|
+
}`,lM=`#ifdef USE_LIGHTMAP
|
|
557
|
+
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
|
558
|
+
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
559
|
+
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
|
560
|
+
#endif`,cM=`#ifdef USE_LIGHTMAP
|
|
561
|
+
uniform sampler2D lightMap;
|
|
562
|
+
uniform float lightMapIntensity;
|
|
563
|
+
#endif`,uM=`vec3 diffuse = vec3( 1.0 );
|
|
564
|
+
GeometricContext geometry;
|
|
565
|
+
geometry.position = mvPosition.xyz;
|
|
566
|
+
geometry.normal = normalize( transformedNormal );
|
|
567
|
+
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
|
|
568
|
+
GeometricContext backGeometry;
|
|
569
|
+
backGeometry.position = geometry.position;
|
|
570
|
+
backGeometry.normal = -geometry.normal;
|
|
571
|
+
backGeometry.viewDir = geometry.viewDir;
|
|
572
|
+
vLightFront = vec3( 0.0 );
|
|
573
|
+
vIndirectFront = vec3( 0.0 );
|
|
574
|
+
#ifdef DOUBLE_SIDED
|
|
575
|
+
vLightBack = vec3( 0.0 );
|
|
576
|
+
vIndirectBack = vec3( 0.0 );
|
|
577
|
+
#endif
|
|
578
|
+
IncidentLight directLight;
|
|
579
|
+
float dotNL;
|
|
580
|
+
vec3 directLightColor_Diffuse;
|
|
581
|
+
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
|
|
582
|
+
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
583
|
+
#ifdef DOUBLE_SIDED
|
|
584
|
+
vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
|
|
585
|
+
vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
|
|
586
|
+
#endif
|
|
587
|
+
#if NUM_POINT_LIGHTS > 0
|
|
588
|
+
#pragma unroll_loop_start
|
|
589
|
+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
590
|
+
getPointLightInfo( pointLights[ i ], geometry, directLight );
|
|
591
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
592
|
+
directLightColor_Diffuse = directLight.color;
|
|
593
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
594
|
+
#ifdef DOUBLE_SIDED
|
|
595
|
+
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
596
|
+
#endif
|
|
597
|
+
}
|
|
598
|
+
#pragma unroll_loop_end
|
|
599
|
+
#endif
|
|
600
|
+
#if NUM_SPOT_LIGHTS > 0
|
|
601
|
+
#pragma unroll_loop_start
|
|
602
|
+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
603
|
+
getSpotLightInfo( spotLights[ i ], geometry, directLight );
|
|
604
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
605
|
+
directLightColor_Diffuse = directLight.color;
|
|
606
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
607
|
+
#ifdef DOUBLE_SIDED
|
|
608
|
+
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
609
|
+
#endif
|
|
610
|
+
}
|
|
611
|
+
#pragma unroll_loop_end
|
|
612
|
+
#endif
|
|
613
|
+
#if NUM_DIR_LIGHTS > 0
|
|
614
|
+
#pragma unroll_loop_start
|
|
615
|
+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
616
|
+
getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
|
|
617
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
618
|
+
directLightColor_Diffuse = directLight.color;
|
|
619
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
620
|
+
#ifdef DOUBLE_SIDED
|
|
621
|
+
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
622
|
+
#endif
|
|
623
|
+
}
|
|
624
|
+
#pragma unroll_loop_end
|
|
625
|
+
#endif
|
|
626
|
+
#if NUM_HEMI_LIGHTS > 0
|
|
627
|
+
#pragma unroll_loop_start
|
|
628
|
+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
629
|
+
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
|
630
|
+
#ifdef DOUBLE_SIDED
|
|
631
|
+
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
|
|
632
|
+
#endif
|
|
633
|
+
}
|
|
634
|
+
#pragma unroll_loop_end
|
|
635
|
+
#endif`,hM=`uniform bool receiveShadow;
|
|
636
|
+
uniform vec3 ambientLightColor;
|
|
637
|
+
uniform vec3 lightProbe[ 9 ];
|
|
638
|
+
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
639
|
+
float x = normal.x, y = normal.y, z = normal.z;
|
|
640
|
+
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
641
|
+
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
642
|
+
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
643
|
+
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
644
|
+
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
645
|
+
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
646
|
+
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
647
|
+
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
648
|
+
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
649
|
+
return result;
|
|
650
|
+
}
|
|
651
|
+
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|
652
|
+
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
653
|
+
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
654
|
+
return irradiance;
|
|
655
|
+
}
|
|
656
|
+
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|
657
|
+
vec3 irradiance = ambientLightColor;
|
|
658
|
+
return irradiance;
|
|
659
|
+
}
|
|
660
|
+
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|
661
|
+
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
|
|
662
|
+
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|
663
|
+
if ( cutoffDistance > 0.0 ) {
|
|
664
|
+
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|
665
|
+
}
|
|
666
|
+
return distanceFalloff;
|
|
667
|
+
#else
|
|
668
|
+
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
|
|
669
|
+
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
|
|
670
|
+
}
|
|
671
|
+
return 1.0;
|
|
672
|
+
#endif
|
|
673
|
+
}
|
|
674
|
+
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
|
675
|
+
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
|
676
|
+
}
|
|
677
|
+
#if NUM_DIR_LIGHTS > 0
|
|
678
|
+
struct DirectionalLight {
|
|
679
|
+
vec3 direction;
|
|
680
|
+
vec3 color;
|
|
681
|
+
};
|
|
682
|
+
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|
683
|
+
void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
684
|
+
light.color = directionalLight.color;
|
|
685
|
+
light.direction = directionalLight.direction;
|
|
686
|
+
light.visible = true;
|
|
687
|
+
}
|
|
688
|
+
#endif
|
|
689
|
+
#if NUM_POINT_LIGHTS > 0
|
|
690
|
+
struct PointLight {
|
|
691
|
+
vec3 position;
|
|
692
|
+
vec3 color;
|
|
693
|
+
float distance;
|
|
694
|
+
float decay;
|
|
695
|
+
};
|
|
696
|
+
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|
697
|
+
void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
698
|
+
vec3 lVector = pointLight.position - geometry.position;
|
|
699
|
+
light.direction = normalize( lVector );
|
|
700
|
+
float lightDistance = length( lVector );
|
|
701
|
+
light.color = pointLight.color;
|
|
702
|
+
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
|
703
|
+
light.visible = ( light.color != vec3( 0.0 ) );
|
|
704
|
+
}
|
|
705
|
+
#endif
|
|
706
|
+
#if NUM_SPOT_LIGHTS > 0
|
|
707
|
+
struct SpotLight {
|
|
708
|
+
vec3 position;
|
|
709
|
+
vec3 direction;
|
|
710
|
+
vec3 color;
|
|
711
|
+
float distance;
|
|
712
|
+
float decay;
|
|
713
|
+
float coneCos;
|
|
714
|
+
float penumbraCos;
|
|
715
|
+
};
|
|
716
|
+
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|
717
|
+
void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
718
|
+
vec3 lVector = spotLight.position - geometry.position;
|
|
719
|
+
light.direction = normalize( lVector );
|
|
720
|
+
float angleCos = dot( light.direction, spotLight.direction );
|
|
721
|
+
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|
722
|
+
if ( spotAttenuation > 0.0 ) {
|
|
723
|
+
float lightDistance = length( lVector );
|
|
724
|
+
light.color = spotLight.color * spotAttenuation;
|
|
725
|
+
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
|
726
|
+
light.visible = ( light.color != vec3( 0.0 ) );
|
|
727
|
+
} else {
|
|
728
|
+
light.color = vec3( 0.0 );
|
|
729
|
+
light.visible = false;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
#endif
|
|
733
|
+
#if NUM_RECT_AREA_LIGHTS > 0
|
|
734
|
+
struct RectAreaLight {
|
|
735
|
+
vec3 color;
|
|
736
|
+
vec3 position;
|
|
737
|
+
vec3 halfWidth;
|
|
738
|
+
vec3 halfHeight;
|
|
739
|
+
};
|
|
740
|
+
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|
741
|
+
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|
742
|
+
#endif
|
|
743
|
+
#if NUM_HEMI_LIGHTS > 0
|
|
744
|
+
struct HemisphereLight {
|
|
745
|
+
vec3 direction;
|
|
746
|
+
vec3 skyColor;
|
|
747
|
+
vec3 groundColor;
|
|
748
|
+
};
|
|
749
|
+
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|
750
|
+
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
|
751
|
+
float dotNL = dot( normal, hemiLight.direction );
|
|
752
|
+
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|
753
|
+
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
754
|
+
return irradiance;
|
|
755
|
+
}
|
|
756
|
+
#endif`,fM=`#if defined( USE_ENVMAP )
|
|
757
|
+
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
758
|
+
#if defined( ENVMAP_TYPE_CUBE_UV )
|
|
759
|
+
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
760
|
+
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
|
|
761
|
+
return PI * envMapColor.rgb * envMapIntensity;
|
|
762
|
+
#else
|
|
763
|
+
return vec3( 0.0 );
|
|
764
|
+
#endif
|
|
765
|
+
}
|
|
766
|
+
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
|
767
|
+
#if defined( ENVMAP_TYPE_CUBE_UV )
|
|
768
|
+
vec3 reflectVec = reflect( - viewDir, normal );
|
|
769
|
+
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
|
770
|
+
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|
771
|
+
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
|
|
772
|
+
return envMapColor.rgb * envMapIntensity;
|
|
773
|
+
#else
|
|
774
|
+
return vec3( 0.0 );
|
|
775
|
+
#endif
|
|
776
|
+
}
|
|
777
|
+
#endif`,dM=`ToonMaterial material;
|
|
778
|
+
material.diffuseColor = diffuseColor.rgb;`,pM=`varying vec3 vViewPosition;
|
|
779
|
+
struct ToonMaterial {
|
|
780
|
+
vec3 diffuseColor;
|
|
781
|
+
};
|
|
782
|
+
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
783
|
+
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
|
|
784
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
785
|
+
}
|
|
786
|
+
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
787
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
788
|
+
}
|
|
789
|
+
#define RE_Direct RE_Direct_Toon
|
|
790
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
|
|
791
|
+
#define Material_LightProbeLOD( material ) (0)`,mM=`BlinnPhongMaterial material;
|
|
792
|
+
material.diffuseColor = diffuseColor.rgb;
|
|
793
|
+
material.specularColor = specular;
|
|
794
|
+
material.specularShininess = shininess;
|
|
795
|
+
material.specularStrength = specularStrength;`,gM=`varying vec3 vViewPosition;
|
|
796
|
+
struct BlinnPhongMaterial {
|
|
797
|
+
vec3 diffuseColor;
|
|
798
|
+
vec3 specularColor;
|
|
799
|
+
float specularShininess;
|
|
800
|
+
float specularStrength;
|
|
801
|
+
};
|
|
802
|
+
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
803
|
+
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
804
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
805
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
806
|
+
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
807
|
+
}
|
|
808
|
+
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
809
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
810
|
+
}
|
|
811
|
+
#define RE_Direct RE_Direct_BlinnPhong
|
|
812
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
|
|
813
|
+
#define Material_LightProbeLOD( material ) (0)`,yM=`PhysicalMaterial material;
|
|
814
|
+
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
815
|
+
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
|
|
816
|
+
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
817
|
+
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
|
818
|
+
material.roughness = min( material.roughness, 1.0 );
|
|
819
|
+
#ifdef IOR
|
|
820
|
+
#ifdef SPECULAR
|
|
821
|
+
float specularIntensityFactor = specularIntensity;
|
|
822
|
+
vec3 specularColorFactor = specularColor;
|
|
823
|
+
#ifdef USE_SPECULARINTENSITYMAP
|
|
824
|
+
specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
|
|
825
|
+
#endif
|
|
826
|
+
#ifdef USE_SPECULARCOLORMAP
|
|
827
|
+
specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
|
|
828
|
+
#endif
|
|
829
|
+
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
|
830
|
+
#else
|
|
831
|
+
float specularIntensityFactor = 1.0;
|
|
832
|
+
vec3 specularColorFactor = vec3( 1.0 );
|
|
833
|
+
material.specularF90 = 1.0;
|
|
834
|
+
#endif
|
|
835
|
+
material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
|
836
|
+
#else
|
|
837
|
+
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
|
|
838
|
+
material.specularF90 = 1.0;
|
|
839
|
+
#endif
|
|
840
|
+
#ifdef USE_CLEARCOAT
|
|
841
|
+
material.clearcoat = clearcoat;
|
|
842
|
+
material.clearcoatRoughness = clearcoatRoughness;
|
|
843
|
+
material.clearcoatF0 = vec3( 0.04 );
|
|
844
|
+
material.clearcoatF90 = 1.0;
|
|
845
|
+
#ifdef USE_CLEARCOATMAP
|
|
846
|
+
material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
|
|
847
|
+
#endif
|
|
848
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
849
|
+
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
|
|
850
|
+
#endif
|
|
851
|
+
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|
852
|
+
material.clearcoatRoughness += geometryRoughness;
|
|
853
|
+
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|
854
|
+
#endif
|
|
855
|
+
#ifdef USE_SHEEN
|
|
856
|
+
material.sheenColor = sheenColor;
|
|
857
|
+
#ifdef USE_SHEENCOLORMAP
|
|
858
|
+
material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
|
|
859
|
+
#endif
|
|
860
|
+
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
|
861
|
+
#ifdef USE_SHEENROUGHNESSMAP
|
|
862
|
+
material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
|
|
863
|
+
#endif
|
|
864
|
+
#endif`,xM=`struct PhysicalMaterial {
|
|
865
|
+
vec3 diffuseColor;
|
|
866
|
+
float roughness;
|
|
867
|
+
vec3 specularColor;
|
|
868
|
+
float specularF90;
|
|
869
|
+
#ifdef USE_CLEARCOAT
|
|
870
|
+
float clearcoat;
|
|
871
|
+
float clearcoatRoughness;
|
|
872
|
+
vec3 clearcoatF0;
|
|
873
|
+
float clearcoatF90;
|
|
874
|
+
#endif
|
|
875
|
+
#ifdef USE_SHEEN
|
|
876
|
+
vec3 sheenColor;
|
|
877
|
+
float sheenRoughness;
|
|
878
|
+
#endif
|
|
879
|
+
};
|
|
880
|
+
vec3 clearcoatSpecular = vec3( 0.0 );
|
|
881
|
+
vec3 sheenSpecular = vec3( 0.0 );
|
|
882
|
+
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {
|
|
883
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
884
|
+
float r2 = roughness * roughness;
|
|
885
|
+
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
|
|
886
|
+
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
|
|
887
|
+
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
|
|
888
|
+
return saturate( DG * RECIPROCAL_PI );
|
|
889
|
+
}
|
|
890
|
+
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|
891
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
892
|
+
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
|
893
|
+
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
|
894
|
+
vec4 r = roughness * c0 + c1;
|
|
895
|
+
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
|
896
|
+
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
|
|
897
|
+
return fab;
|
|
898
|
+
}
|
|
899
|
+
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
|
900
|
+
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|
901
|
+
return specularColor * fab.x + specularF90 * fab.y;
|
|
902
|
+
}
|
|
903
|
+
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 ) {
|
|
904
|
+
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|
905
|
+
vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;
|
|
906
|
+
float Ess = fab.x + fab.y;
|
|
907
|
+
float Ems = 1.0 - Ess;
|
|
908
|
+
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|
909
|
+
singleScatter += FssEss;
|
|
910
|
+
multiScatter += Fms * Ems;
|
|
911
|
+
}
|
|
912
|
+
#if NUM_RECT_AREA_LIGHTS > 0
|
|
913
|
+
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
914
|
+
vec3 normal = geometry.normal;
|
|
915
|
+
vec3 viewDir = geometry.viewDir;
|
|
916
|
+
vec3 position = geometry.position;
|
|
917
|
+
vec3 lightPos = rectAreaLight.position;
|
|
918
|
+
vec3 halfWidth = rectAreaLight.halfWidth;
|
|
919
|
+
vec3 halfHeight = rectAreaLight.halfHeight;
|
|
920
|
+
vec3 lightColor = rectAreaLight.color;
|
|
921
|
+
float roughness = material.roughness;
|
|
922
|
+
vec3 rectCoords[ 4 ];
|
|
923
|
+
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|
924
|
+
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|
925
|
+
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|
926
|
+
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|
927
|
+
vec4 t1 = texture2D( ltc_1, uv );
|
|
928
|
+
vec4 t2 = texture2D( ltc_2, uv );
|
|
929
|
+
mat3 mInv = mat3(
|
|
930
|
+
vec3( t1.x, 0, t1.y ),
|
|
931
|
+
vec3( 0, 1, 0 ),
|
|
932
|
+
vec3( t1.z, 0, t1.w )
|
|
933
|
+
);
|
|
934
|
+
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
|
935
|
+
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
936
|
+
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
937
|
+
}
|
|
938
|
+
#endif
|
|
939
|
+
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
940
|
+
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
941
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
942
|
+
#ifdef USE_CLEARCOAT
|
|
943
|
+
float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
|
|
944
|
+
vec3 ccIrradiance = dotNLcc * directLight.color;
|
|
945
|
+
clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
946
|
+
#endif
|
|
947
|
+
#ifdef USE_SHEEN
|
|
948
|
+
sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
|
|
949
|
+
#endif
|
|
950
|
+
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
|
|
951
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
952
|
+
}
|
|
953
|
+
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
954
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
955
|
+
}
|
|
956
|
+
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
|
957
|
+
#ifdef USE_CLEARCOAT
|
|
958
|
+
clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
959
|
+
#endif
|
|
960
|
+
#ifdef USE_SHEEN
|
|
961
|
+
sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
|
|
962
|
+
#endif
|
|
963
|
+
vec3 singleScattering = vec3( 0.0 );
|
|
964
|
+
vec3 multiScattering = vec3( 0.0 );
|
|
965
|
+
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|
966
|
+
computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
|
|
967
|
+
vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
|
|
968
|
+
reflectedLight.indirectSpecular += radiance * singleScattering;
|
|
969
|
+
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|
970
|
+
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
|
971
|
+
}
|
|
972
|
+
#define RE_Direct RE_Direct_Physical
|
|
973
|
+
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|
974
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|
975
|
+
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
976
|
+
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
977
|
+
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
978
|
+
}`,vM=`
|
|
979
|
+
GeometricContext geometry;
|
|
980
|
+
geometry.position = - vViewPosition;
|
|
981
|
+
geometry.normal = normal;
|
|
982
|
+
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
983
|
+
#ifdef USE_CLEARCOAT
|
|
984
|
+
geometry.clearcoatNormal = clearcoatNormal;
|
|
985
|
+
#endif
|
|
986
|
+
IncidentLight directLight;
|
|
987
|
+
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
988
|
+
PointLight pointLight;
|
|
989
|
+
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
990
|
+
PointLightShadow pointLightShadow;
|
|
991
|
+
#endif
|
|
992
|
+
#pragma unroll_loop_start
|
|
993
|
+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
994
|
+
pointLight = pointLights[ i ];
|
|
995
|
+
getPointLightInfo( pointLight, geometry, directLight );
|
|
996
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
|
997
|
+
pointLightShadow = pointLightShadows[ i ];
|
|
998
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
999
|
+
#endif
|
|
1000
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1001
|
+
}
|
|
1002
|
+
#pragma unroll_loop_end
|
|
1003
|
+
#endif
|
|
1004
|
+
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1005
|
+
SpotLight spotLight;
|
|
1006
|
+
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1007
|
+
SpotLightShadow spotLightShadow;
|
|
1008
|
+
#endif
|
|
1009
|
+
#pragma unroll_loop_start
|
|
1010
|
+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
1011
|
+
spotLight = spotLights[ i ];
|
|
1012
|
+
getSpotLightInfo( spotLight, geometry, directLight );
|
|
1013
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1014
|
+
spotLightShadow = spotLightShadows[ i ];
|
|
1015
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
1016
|
+
#endif
|
|
1017
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1018
|
+
}
|
|
1019
|
+
#pragma unroll_loop_end
|
|
1020
|
+
#endif
|
|
1021
|
+
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1022
|
+
DirectionalLight directionalLight;
|
|
1023
|
+
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
1024
|
+
DirectionalLightShadow directionalLightShadow;
|
|
1025
|
+
#endif
|
|
1026
|
+
#pragma unroll_loop_start
|
|
1027
|
+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
1028
|
+
directionalLight = directionalLights[ i ];
|
|
1029
|
+
getDirectionalLightInfo( directionalLight, geometry, directLight );
|
|
1030
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
1031
|
+
directionalLightShadow = directionalLightShadows[ i ];
|
|
1032
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1033
|
+
#endif
|
|
1034
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1035
|
+
}
|
|
1036
|
+
#pragma unroll_loop_end
|
|
1037
|
+
#endif
|
|
1038
|
+
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|
1039
|
+
RectAreaLight rectAreaLight;
|
|
1040
|
+
#pragma unroll_loop_start
|
|
1041
|
+
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
1042
|
+
rectAreaLight = rectAreaLights[ i ];
|
|
1043
|
+
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
|
|
1044
|
+
}
|
|
1045
|
+
#pragma unroll_loop_end
|
|
1046
|
+
#endif
|
|
1047
|
+
#if defined( RE_IndirectDiffuse )
|
|
1048
|
+
vec3 iblIrradiance = vec3( 0.0 );
|
|
1049
|
+
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
1050
|
+
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
1051
|
+
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
1052
|
+
#pragma unroll_loop_start
|
|
1053
|
+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
1054
|
+
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
|
1055
|
+
}
|
|
1056
|
+
#pragma unroll_loop_end
|
|
1057
|
+
#endif
|
|
1058
|
+
#endif
|
|
1059
|
+
#if defined( RE_IndirectSpecular )
|
|
1060
|
+
vec3 radiance = vec3( 0.0 );
|
|
1061
|
+
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1062
|
+
#endif`,_M=`#if defined( RE_IndirectDiffuse )
|
|
1063
|
+
#ifdef USE_LIGHTMAP
|
|
1064
|
+
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
|
1065
|
+
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
1066
|
+
irradiance += lightMapIrradiance;
|
|
1067
|
+
#endif
|
|
1068
|
+
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
1069
|
+
iblIrradiance += getIBLIrradiance( geometry.normal );
|
|
1070
|
+
#endif
|
|
1071
|
+
#endif
|
|
1072
|
+
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
1073
|
+
radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
|
|
1074
|
+
#ifdef USE_CLEARCOAT
|
|
1075
|
+
clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
|
|
1076
|
+
#endif
|
|
1077
|
+
#endif`,wM=`#if defined( RE_IndirectDiffuse )
|
|
1078
|
+
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
|
|
1079
|
+
#endif
|
|
1080
|
+
#if defined( RE_IndirectSpecular )
|
|
1081
|
+
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
|
|
1082
|
+
#endif`,MM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
1083
|
+
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1084
|
+
#endif`,SM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
1085
|
+
uniform float logDepthBufFC;
|
|
1086
|
+
varying float vFragDepth;
|
|
1087
|
+
varying float vIsPerspective;
|
|
1088
|
+
#endif`,bM=`#ifdef USE_LOGDEPTHBUF
|
|
1089
|
+
#ifdef USE_LOGDEPTHBUF_EXT
|
|
1090
|
+
varying float vFragDepth;
|
|
1091
|
+
varying float vIsPerspective;
|
|
1092
|
+
#else
|
|
1093
|
+
uniform float logDepthBufFC;
|
|
1094
|
+
#endif
|
|
1095
|
+
#endif`,EM=`#ifdef USE_LOGDEPTHBUF
|
|
1096
|
+
#ifdef USE_LOGDEPTHBUF_EXT
|
|
1097
|
+
vFragDepth = 1.0 + gl_Position.w;
|
|
1098
|
+
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1099
|
+
#else
|
|
1100
|
+
if ( isPerspectiveMatrix( projectionMatrix ) ) {
|
|
1101
|
+
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
|
|
1102
|
+
gl_Position.z *= gl_Position.w;
|
|
1103
|
+
}
|
|
1104
|
+
#endif
|
|
1105
|
+
#endif`,TM=`#ifdef USE_MAP
|
|
1106
|
+
vec4 sampledDiffuseColor = texture2D( map, vUv );
|
|
1107
|
+
#ifdef DECODE_VIDEO_TEXTURE
|
|
1108
|
+
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
|
1109
|
+
#endif
|
|
1110
|
+
diffuseColor *= sampledDiffuseColor;
|
|
1111
|
+
#endif`,AM=`#ifdef USE_MAP
|
|
1112
|
+
uniform sampler2D map;
|
|
1113
|
+
#endif`,CM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1114
|
+
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|
1115
|
+
#endif
|
|
1116
|
+
#ifdef USE_MAP
|
|
1117
|
+
diffuseColor *= texture2D( map, uv );
|
|
1118
|
+
#endif
|
|
1119
|
+
#ifdef USE_ALPHAMAP
|
|
1120
|
+
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1121
|
+
#endif`,RM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1122
|
+
uniform mat3 uvTransform;
|
|
1123
|
+
#endif
|
|
1124
|
+
#ifdef USE_MAP
|
|
1125
|
+
uniform sampler2D map;
|
|
1126
|
+
#endif
|
|
1127
|
+
#ifdef USE_ALPHAMAP
|
|
1128
|
+
uniform sampler2D alphaMap;
|
|
1129
|
+
#endif`,PM=`float metalnessFactor = metalness;
|
|
1130
|
+
#ifdef USE_METALNESSMAP
|
|
1131
|
+
vec4 texelMetalness = texture2D( metalnessMap, vUv );
|
|
1132
|
+
metalnessFactor *= texelMetalness.b;
|
|
1133
|
+
#endif`,LM=`#ifdef USE_METALNESSMAP
|
|
1134
|
+
uniform sampler2D metalnessMap;
|
|
1135
|
+
#endif`,DM=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
|
|
1136
|
+
vColor *= morphTargetBaseInfluence;
|
|
1137
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1138
|
+
#if defined( USE_COLOR_ALPHA )
|
|
1139
|
+
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
|
1140
|
+
#elif defined( USE_COLOR )
|
|
1141
|
+
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1142
|
+
#endif
|
|
1143
|
+
}
|
|
1144
|
+
#endif`,IM=`#ifdef USE_MORPHNORMALS
|
|
1145
|
+
objectNormal *= morphTargetBaseInfluence;
|
|
1146
|
+
#ifdef MORPHTARGETS_TEXTURE
|
|
1147
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1148
|
+
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1149
|
+
}
|
|
1150
|
+
#else
|
|
1151
|
+
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
|
|
1152
|
+
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
|
|
1153
|
+
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
1154
|
+
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
1155
|
+
#endif
|
|
1156
|
+
#endif`,zM=`#ifdef USE_MORPHTARGETS
|
|
1157
|
+
uniform float morphTargetBaseInfluence;
|
|
1158
|
+
#ifdef MORPHTARGETS_TEXTURE
|
|
1159
|
+
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1160
|
+
uniform sampler2DArray morphTargetsTexture;
|
|
1161
|
+
uniform ivec2 morphTargetsTextureSize;
|
|
1162
|
+
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
|
|
1163
|
+
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
|
|
1164
|
+
int y = texelIndex / morphTargetsTextureSize.x;
|
|
1165
|
+
int x = texelIndex - y * morphTargetsTextureSize.x;
|
|
1166
|
+
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1167
|
+
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1168
|
+
}
|
|
1169
|
+
#else
|
|
1170
|
+
#ifndef USE_MORPHNORMALS
|
|
1171
|
+
uniform float morphTargetInfluences[ 8 ];
|
|
1172
|
+
#else
|
|
1173
|
+
uniform float morphTargetInfluences[ 4 ];
|
|
1174
|
+
#endif
|
|
1175
|
+
#endif
|
|
1176
|
+
#endif`,NM=`#ifdef USE_MORPHTARGETS
|
|
1177
|
+
transformed *= morphTargetBaseInfluence;
|
|
1178
|
+
#ifdef MORPHTARGETS_TEXTURE
|
|
1179
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1180
|
+
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1181
|
+
}
|
|
1182
|
+
#else
|
|
1183
|
+
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
|
|
1184
|
+
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
|
|
1185
|
+
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
|
|
1186
|
+
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
|
|
1187
|
+
#ifndef USE_MORPHNORMALS
|
|
1188
|
+
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
|
|
1189
|
+
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
|
|
1190
|
+
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
|
|
1191
|
+
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
1192
|
+
#endif
|
|
1193
|
+
#endif
|
|
1194
|
+
#endif`,FM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1195
|
+
#ifdef FLAT_SHADED
|
|
1196
|
+
vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
|
|
1197
|
+
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
|
|
1198
|
+
vec3 normal = normalize( cross( fdx, fdy ) );
|
|
1199
|
+
#else
|
|
1200
|
+
vec3 normal = normalize( vNormal );
|
|
1201
|
+
#ifdef DOUBLE_SIDED
|
|
1202
|
+
normal = normal * faceDirection;
|
|
1203
|
+
#endif
|
|
1204
|
+
#ifdef USE_TANGENT
|
|
1205
|
+
vec3 tangent = normalize( vTangent );
|
|
1206
|
+
vec3 bitangent = normalize( vBitangent );
|
|
1207
|
+
#ifdef DOUBLE_SIDED
|
|
1208
|
+
tangent = tangent * faceDirection;
|
|
1209
|
+
bitangent = bitangent * faceDirection;
|
|
1210
|
+
#endif
|
|
1211
|
+
#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
|
|
1212
|
+
mat3 vTBN = mat3( tangent, bitangent, normal );
|
|
1213
|
+
#endif
|
|
1214
|
+
#endif
|
|
1215
|
+
#endif
|
|
1216
|
+
vec3 geometryNormal = normal;`,OM=`#ifdef OBJECTSPACE_NORMALMAP
|
|
1217
|
+
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1218
|
+
#ifdef FLIP_SIDED
|
|
1219
|
+
normal = - normal;
|
|
1220
|
+
#endif
|
|
1221
|
+
#ifdef DOUBLE_SIDED
|
|
1222
|
+
normal = normal * faceDirection;
|
|
1223
|
+
#endif
|
|
1224
|
+
normal = normalize( normalMatrix * normal );
|
|
1225
|
+
#elif defined( TANGENTSPACE_NORMALMAP )
|
|
1226
|
+
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1227
|
+
mapN.xy *= normalScale;
|
|
1228
|
+
#ifdef USE_TANGENT
|
|
1229
|
+
normal = normalize( vTBN * mapN );
|
|
1230
|
+
#else
|
|
1231
|
+
normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
|
|
1232
|
+
#endif
|
|
1233
|
+
#elif defined( USE_BUMPMAP )
|
|
1234
|
+
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1235
|
+
#endif`,BM=`#ifndef FLAT_SHADED
|
|
1236
|
+
varying vec3 vNormal;
|
|
1237
|
+
#ifdef USE_TANGENT
|
|
1238
|
+
varying vec3 vTangent;
|
|
1239
|
+
varying vec3 vBitangent;
|
|
1240
|
+
#endif
|
|
1241
|
+
#endif`,UM=`#ifndef FLAT_SHADED
|
|
1242
|
+
varying vec3 vNormal;
|
|
1243
|
+
#ifdef USE_TANGENT
|
|
1244
|
+
varying vec3 vTangent;
|
|
1245
|
+
varying vec3 vBitangent;
|
|
1246
|
+
#endif
|
|
1247
|
+
#endif`,kM=`#ifndef FLAT_SHADED
|
|
1248
|
+
vNormal = normalize( transformedNormal );
|
|
1249
|
+
#ifdef USE_TANGENT
|
|
1250
|
+
vTangent = normalize( transformedTangent );
|
|
1251
|
+
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1252
|
+
#endif
|
|
1253
|
+
#endif`,HM=`#ifdef USE_NORMALMAP
|
|
1254
|
+
uniform sampler2D normalMap;
|
|
1255
|
+
uniform vec2 normalScale;
|
|
1256
|
+
#endif
|
|
1257
|
+
#ifdef OBJECTSPACE_NORMALMAP
|
|
1258
|
+
uniform mat3 normalMatrix;
|
|
1259
|
+
#endif
|
|
1260
|
+
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
|
|
1261
|
+
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
|
|
1262
|
+
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
|
|
1263
|
+
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
|
|
1264
|
+
vec2 st0 = dFdx( vUv.st );
|
|
1265
|
+
vec2 st1 = dFdy( vUv.st );
|
|
1266
|
+
vec3 N = surf_norm;
|
|
1267
|
+
vec3 q1perp = cross( q1, N );
|
|
1268
|
+
vec3 q0perp = cross( N, q0 );
|
|
1269
|
+
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|
1270
|
+
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|
1271
|
+
float det = max( dot( T, T ), dot( B, B ) );
|
|
1272
|
+
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
|
|
1273
|
+
return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
|
|
1274
|
+
}
|
|
1275
|
+
#endif`,GM=`#ifdef USE_CLEARCOAT
|
|
1276
|
+
vec3 clearcoatNormal = geometryNormal;
|
|
1277
|
+
#endif`,VM=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1278
|
+
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1279
|
+
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1280
|
+
#ifdef USE_TANGENT
|
|
1281
|
+
clearcoatNormal = normalize( vTBN * clearcoatMapN );
|
|
1282
|
+
#else
|
|
1283
|
+
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
|
|
1284
|
+
#endif
|
|
1285
|
+
#endif`,WM=`#ifdef USE_CLEARCOATMAP
|
|
1286
|
+
uniform sampler2D clearcoatMap;
|
|
1287
|
+
#endif
|
|
1288
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1289
|
+
uniform sampler2D clearcoatRoughnessMap;
|
|
1290
|
+
#endif
|
|
1291
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1292
|
+
uniform sampler2D clearcoatNormalMap;
|
|
1293
|
+
uniform vec2 clearcoatNormalScale;
|
|
1294
|
+
#endif`,qM=`#ifdef OPAQUE
|
|
1295
|
+
diffuseColor.a = 1.0;
|
|
1296
|
+
#endif
|
|
1297
|
+
#ifdef USE_TRANSMISSION
|
|
1298
|
+
diffuseColor.a *= transmissionAlpha + 0.1;
|
|
1299
|
+
#endif
|
|
1300
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,XM=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1301
|
+
return normalize( normal ) * 0.5 + 0.5;
|
|
1302
|
+
}
|
|
1303
|
+
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
1304
|
+
return 2.0 * rgb.xyz - 1.0;
|
|
1305
|
+
}
|
|
1306
|
+
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
|
1307
|
+
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
|
|
1308
|
+
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
|
1309
|
+
const float ShiftRight8 = 1. / 256.;
|
|
1310
|
+
vec4 packDepthToRGBA( const in float v ) {
|
|
1311
|
+
vec4 r = vec4( fract( v * PackFactors ), v );
|
|
1312
|
+
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
|
|
1313
|
+
}
|
|
1314
|
+
float unpackRGBAToDepth( const in vec4 v ) {
|
|
1315
|
+
return dot( v, UnpackFactors );
|
|
1316
|
+
}
|
|
1317
|
+
vec4 pack2HalfToRGBA( vec2 v ) {
|
|
1318
|
+
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
|
1319
|
+
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
|
1320
|
+
}
|
|
1321
|
+
vec2 unpackRGBATo2Half( vec4 v ) {
|
|
1322
|
+
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
1323
|
+
}
|
|
1324
|
+
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1325
|
+
return ( viewZ + near ) / ( near - far );
|
|
1326
|
+
}
|
|
1327
|
+
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
|
|
1328
|
+
return linearClipZ * ( near - far ) - near;
|
|
1329
|
+
}
|
|
1330
|
+
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1331
|
+
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
|
1332
|
+
}
|
|
1333
|
+
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
|
|
1334
|
+
return ( near * far ) / ( ( far - near ) * invClipZ - far );
|
|
1335
|
+
}`,jM=`#ifdef PREMULTIPLIED_ALPHA
|
|
1336
|
+
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1337
|
+
#endif`,YM=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1338
|
+
#ifdef USE_INSTANCING
|
|
1339
|
+
mvPosition = instanceMatrix * mvPosition;
|
|
1340
|
+
#endif
|
|
1341
|
+
mvPosition = modelViewMatrix * mvPosition;
|
|
1342
|
+
gl_Position = projectionMatrix * mvPosition;`,JM=`#ifdef DITHERING
|
|
1343
|
+
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1344
|
+
#endif`,ZM=`#ifdef DITHERING
|
|
1345
|
+
vec3 dithering( vec3 color ) {
|
|
1346
|
+
float grid_position = rand( gl_FragCoord.xy );
|
|
1347
|
+
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1348
|
+
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1349
|
+
return color + dither_shift_RGB;
|
|
1350
|
+
}
|
|
1351
|
+
#endif`,KM=`float roughnessFactor = roughness;
|
|
1352
|
+
#ifdef USE_ROUGHNESSMAP
|
|
1353
|
+
vec4 texelRoughness = texture2D( roughnessMap, vUv );
|
|
1354
|
+
roughnessFactor *= texelRoughness.g;
|
|
1355
|
+
#endif`,QM=`#ifdef USE_ROUGHNESSMAP
|
|
1356
|
+
uniform sampler2D roughnessMap;
|
|
1357
|
+
#endif`,$M=`#ifdef USE_SHADOWMAP
|
|
1358
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1359
|
+
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1360
|
+
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1361
|
+
struct DirectionalLightShadow {
|
|
1362
|
+
float shadowBias;
|
|
1363
|
+
float shadowNormalBias;
|
|
1364
|
+
float shadowRadius;
|
|
1365
|
+
vec2 shadowMapSize;
|
|
1366
|
+
};
|
|
1367
|
+
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1368
|
+
#endif
|
|
1369
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1370
|
+
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1371
|
+
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1372
|
+
struct SpotLightShadow {
|
|
1373
|
+
float shadowBias;
|
|
1374
|
+
float shadowNormalBias;
|
|
1375
|
+
float shadowRadius;
|
|
1376
|
+
vec2 shadowMapSize;
|
|
1377
|
+
};
|
|
1378
|
+
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1379
|
+
#endif
|
|
1380
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1381
|
+
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1382
|
+
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1383
|
+
struct PointLightShadow {
|
|
1384
|
+
float shadowBias;
|
|
1385
|
+
float shadowNormalBias;
|
|
1386
|
+
float shadowRadius;
|
|
1387
|
+
vec2 shadowMapSize;
|
|
1388
|
+
float shadowCameraNear;
|
|
1389
|
+
float shadowCameraFar;
|
|
1390
|
+
};
|
|
1391
|
+
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1392
|
+
#endif
|
|
1393
|
+
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|
1394
|
+
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
|
1395
|
+
}
|
|
1396
|
+
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
|
1397
|
+
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
|
1398
|
+
}
|
|
1399
|
+
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
|
1400
|
+
float occlusion = 1.0;
|
|
1401
|
+
vec2 distribution = texture2DDistribution( shadow, uv );
|
|
1402
|
+
float hard_shadow = step( compare , distribution.x );
|
|
1403
|
+
if (hard_shadow != 1.0 ) {
|
|
1404
|
+
float distance = compare - distribution.x ;
|
|
1405
|
+
float variance = max( 0.00000, distribution.y * distribution.y );
|
|
1406
|
+
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 );
|
|
1407
|
+
}
|
|
1408
|
+
return occlusion;
|
|
1409
|
+
}
|
|
1410
|
+
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1411
|
+
float shadow = 1.0;
|
|
1412
|
+
shadowCoord.xyz /= shadowCoord.w;
|
|
1413
|
+
shadowCoord.z += shadowBias;
|
|
1414
|
+
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
|
|
1415
|
+
bool inFrustum = all( inFrustumVec );
|
|
1416
|
+
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
|
|
1417
|
+
bool frustumTest = all( frustumTestVec );
|
|
1418
|
+
if ( frustumTest ) {
|
|
1419
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1420
|
+
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1421
|
+
float dx0 = - texelSize.x * shadowRadius;
|
|
1422
|
+
float dy0 = - texelSize.y * shadowRadius;
|
|
1423
|
+
float dx1 = + texelSize.x * shadowRadius;
|
|
1424
|
+
float dy1 = + texelSize.y * shadowRadius;
|
|
1425
|
+
float dx2 = dx0 / 2.0;
|
|
1426
|
+
float dy2 = dy0 / 2.0;
|
|
1427
|
+
float dx3 = dx1 / 2.0;
|
|
1428
|
+
float dy3 = dy1 / 2.0;
|
|
1429
|
+
shadow = (
|
|
1430
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
|
1431
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
|
1432
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
|
1433
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
|
1434
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
|
1435
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
|
1436
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
|
1437
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
|
1438
|
+
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
|
1439
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
|
1440
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
|
1441
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
|
1442
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
|
1443
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
|
1444
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
|
1445
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
|
1446
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
|
1447
|
+
) * ( 1.0 / 17.0 );
|
|
1448
|
+
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
|
1449
|
+
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1450
|
+
float dx = texelSize.x;
|
|
1451
|
+
float dy = texelSize.y;
|
|
1452
|
+
vec2 uv = shadowCoord.xy;
|
|
1453
|
+
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
|
1454
|
+
uv -= f * texelSize;
|
|
1455
|
+
shadow = (
|
|
1456
|
+
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
|
1457
|
+
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
|
1458
|
+
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
|
1459
|
+
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
|
1460
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
|
1461
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
|
1462
|
+
f.x ) +
|
|
1463
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
|
1464
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
|
1465
|
+
f.x ) +
|
|
1466
|
+
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
|
1467
|
+
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
|
1468
|
+
f.y ) +
|
|
1469
|
+
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
|
1470
|
+
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
|
1471
|
+
f.y ) +
|
|
1472
|
+
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
|
1473
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
|
1474
|
+
f.x ),
|
|
1475
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
|
1476
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
|
1477
|
+
f.x ),
|
|
1478
|
+
f.y )
|
|
1479
|
+
) * ( 1.0 / 9.0 );
|
|
1480
|
+
#elif defined( SHADOWMAP_TYPE_VSM )
|
|
1481
|
+
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1482
|
+
#else
|
|
1483
|
+
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1484
|
+
#endif
|
|
1485
|
+
}
|
|
1486
|
+
return shadow;
|
|
1487
|
+
}
|
|
1488
|
+
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
|
1489
|
+
vec3 absV = abs( v );
|
|
1490
|
+
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
|
1491
|
+
absV *= scaleToCube;
|
|
1492
|
+
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
|
1493
|
+
vec2 planar = v.xy;
|
|
1494
|
+
float almostATexel = 1.5 * texelSizeY;
|
|
1495
|
+
float almostOne = 1.0 - almostATexel;
|
|
1496
|
+
if ( absV.z >= almostOne ) {
|
|
1497
|
+
if ( v.z > 0.0 )
|
|
1498
|
+
planar.x = 4.0 - v.x;
|
|
1499
|
+
} else if ( absV.x >= almostOne ) {
|
|
1500
|
+
float signX = sign( v.x );
|
|
1501
|
+
planar.x = v.z * signX + 2.0 * signX;
|
|
1502
|
+
} else if ( absV.y >= almostOne ) {
|
|
1503
|
+
float signY = sign( v.y );
|
|
1504
|
+
planar.x = v.x + 2.0 * signY + 2.0;
|
|
1505
|
+
planar.y = v.z * signY - 2.0;
|
|
1506
|
+
}
|
|
1507
|
+
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
|
1508
|
+
}
|
|
1509
|
+
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
1510
|
+
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
|
1511
|
+
vec3 lightToPosition = shadowCoord.xyz;
|
|
1512
|
+
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
|
1513
|
+
vec3 bd3D = normalize( lightToPosition );
|
|
1514
|
+
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
|
1515
|
+
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
|
1516
|
+
return (
|
|
1517
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
|
1518
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
|
1519
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
|
1520
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
|
1521
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
|
1522
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
|
1523
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
|
1524
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
|
1525
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
|
1526
|
+
) * ( 1.0 / 9.0 );
|
|
1527
|
+
#else
|
|
1528
|
+
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
|
1529
|
+
#endif
|
|
1530
|
+
}
|
|
1531
|
+
#endif`,eS=`#ifdef USE_SHADOWMAP
|
|
1532
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1533
|
+
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1534
|
+
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1535
|
+
struct DirectionalLightShadow {
|
|
1536
|
+
float shadowBias;
|
|
1537
|
+
float shadowNormalBias;
|
|
1538
|
+
float shadowRadius;
|
|
1539
|
+
vec2 shadowMapSize;
|
|
1540
|
+
};
|
|
1541
|
+
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1542
|
+
#endif
|
|
1543
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1544
|
+
uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1545
|
+
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1546
|
+
struct SpotLightShadow {
|
|
1547
|
+
float shadowBias;
|
|
1548
|
+
float shadowNormalBias;
|
|
1549
|
+
float shadowRadius;
|
|
1550
|
+
vec2 shadowMapSize;
|
|
1551
|
+
};
|
|
1552
|
+
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1553
|
+
#endif
|
|
1554
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1555
|
+
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1556
|
+
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1557
|
+
struct PointLightShadow {
|
|
1558
|
+
float shadowBias;
|
|
1559
|
+
float shadowNormalBias;
|
|
1560
|
+
float shadowRadius;
|
|
1561
|
+
vec2 shadowMapSize;
|
|
1562
|
+
float shadowCameraNear;
|
|
1563
|
+
float shadowCameraFar;
|
|
1564
|
+
};
|
|
1565
|
+
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1566
|
+
#endif
|
|
1567
|
+
#endif`,tS=`#ifdef USE_SHADOWMAP
|
|
1568
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
|
|
1569
|
+
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1570
|
+
vec4 shadowWorldPosition;
|
|
1571
|
+
#endif
|
|
1572
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1573
|
+
#pragma unroll_loop_start
|
|
1574
|
+
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1575
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|
1576
|
+
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|
1577
|
+
}
|
|
1578
|
+
#pragma unroll_loop_end
|
|
1579
|
+
#endif
|
|
1580
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1581
|
+
#pragma unroll_loop_start
|
|
1582
|
+
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1583
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
|
|
1584
|
+
vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
|
|
1585
|
+
}
|
|
1586
|
+
#pragma unroll_loop_end
|
|
1587
|
+
#endif
|
|
1588
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1589
|
+
#pragma unroll_loop_start
|
|
1590
|
+
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1591
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|
1592
|
+
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|
1593
|
+
}
|
|
1594
|
+
#pragma unroll_loop_end
|
|
1595
|
+
#endif
|
|
1596
|
+
#endif`,nS=`float getShadowMask() {
|
|
1597
|
+
float shadow = 1.0;
|
|
1598
|
+
#ifdef USE_SHADOWMAP
|
|
1599
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1600
|
+
DirectionalLightShadow directionalLight;
|
|
1601
|
+
#pragma unroll_loop_start
|
|
1602
|
+
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1603
|
+
directionalLight = directionalLightShadows[ i ];
|
|
1604
|
+
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1605
|
+
}
|
|
1606
|
+
#pragma unroll_loop_end
|
|
1607
|
+
#endif
|
|
1608
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1609
|
+
SpotLightShadow spotLight;
|
|
1610
|
+
#pragma unroll_loop_start
|
|
1611
|
+
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1612
|
+
spotLight = spotLightShadows[ i ];
|
|
1613
|
+
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
1614
|
+
}
|
|
1615
|
+
#pragma unroll_loop_end
|
|
1616
|
+
#endif
|
|
1617
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1618
|
+
PointLightShadow pointLight;
|
|
1619
|
+
#pragma unroll_loop_start
|
|
1620
|
+
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1621
|
+
pointLight = pointLightShadows[ i ];
|
|
1622
|
+
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
1623
|
+
}
|
|
1624
|
+
#pragma unroll_loop_end
|
|
1625
|
+
#endif
|
|
1626
|
+
#endif
|
|
1627
|
+
return shadow;
|
|
1628
|
+
}`,iS=`#ifdef USE_SKINNING
|
|
1629
|
+
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1630
|
+
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1631
|
+
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1632
|
+
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1633
|
+
#endif`,rS=`#ifdef USE_SKINNING
|
|
1634
|
+
uniform mat4 bindMatrix;
|
|
1635
|
+
uniform mat4 bindMatrixInverse;
|
|
1636
|
+
#ifdef BONE_TEXTURE
|
|
1637
|
+
uniform highp sampler2D boneTexture;
|
|
1638
|
+
uniform int boneTextureSize;
|
|
1639
|
+
mat4 getBoneMatrix( const in float i ) {
|
|
1640
|
+
float j = i * 4.0;
|
|
1641
|
+
float x = mod( j, float( boneTextureSize ) );
|
|
1642
|
+
float y = floor( j / float( boneTextureSize ) );
|
|
1643
|
+
float dx = 1.0 / float( boneTextureSize );
|
|
1644
|
+
float dy = 1.0 / float( boneTextureSize );
|
|
1645
|
+
y = dy * ( y + 0.5 );
|
|
1646
|
+
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
|
|
1647
|
+
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
|
|
1648
|
+
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
|
|
1649
|
+
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
|
|
1650
|
+
mat4 bone = mat4( v1, v2, v3, v4 );
|
|
1651
|
+
return bone;
|
|
1652
|
+
}
|
|
1653
|
+
#else
|
|
1654
|
+
uniform mat4 boneMatrices[ MAX_BONES ];
|
|
1655
|
+
mat4 getBoneMatrix( const in float i ) {
|
|
1656
|
+
mat4 bone = boneMatrices[ int(i) ];
|
|
1657
|
+
return bone;
|
|
1658
|
+
}
|
|
1659
|
+
#endif
|
|
1660
|
+
#endif`,sS=`#ifdef USE_SKINNING
|
|
1661
|
+
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
1662
|
+
vec4 skinned = vec4( 0.0 );
|
|
1663
|
+
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
1664
|
+
skinned += boneMatY * skinVertex * skinWeight.y;
|
|
1665
|
+
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
1666
|
+
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
1667
|
+
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
1668
|
+
#endif`,oS=`#ifdef USE_SKINNING
|
|
1669
|
+
mat4 skinMatrix = mat4( 0.0 );
|
|
1670
|
+
skinMatrix += skinWeight.x * boneMatX;
|
|
1671
|
+
skinMatrix += skinWeight.y * boneMatY;
|
|
1672
|
+
skinMatrix += skinWeight.z * boneMatZ;
|
|
1673
|
+
skinMatrix += skinWeight.w * boneMatW;
|
|
1674
|
+
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|
1675
|
+
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|
1676
|
+
#ifdef USE_TANGENT
|
|
1677
|
+
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
1678
|
+
#endif
|
|
1679
|
+
#endif`,aS=`float specularStrength;
|
|
1680
|
+
#ifdef USE_SPECULARMAP
|
|
1681
|
+
vec4 texelSpecular = texture2D( specularMap, vUv );
|
|
1682
|
+
specularStrength = texelSpecular.r;
|
|
1683
|
+
#else
|
|
1684
|
+
specularStrength = 1.0;
|
|
1685
|
+
#endif`,lS=`#ifdef USE_SPECULARMAP
|
|
1686
|
+
uniform sampler2D specularMap;
|
|
1687
|
+
#endif`,cS=`#if defined( TONE_MAPPING )
|
|
1688
|
+
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
1689
|
+
#endif`,uS=`#ifndef saturate
|
|
1690
|
+
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
1691
|
+
#endif
|
|
1692
|
+
uniform float toneMappingExposure;
|
|
1693
|
+
vec3 LinearToneMapping( vec3 color ) {
|
|
1694
|
+
return toneMappingExposure * color;
|
|
1695
|
+
}
|
|
1696
|
+
vec3 ReinhardToneMapping( vec3 color ) {
|
|
1697
|
+
color *= toneMappingExposure;
|
|
1698
|
+
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|
1699
|
+
}
|
|
1700
|
+
vec3 OptimizedCineonToneMapping( vec3 color ) {
|
|
1701
|
+
color *= toneMappingExposure;
|
|
1702
|
+
color = max( vec3( 0.0 ), color - 0.004 );
|
|
1703
|
+
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|
1704
|
+
}
|
|
1705
|
+
vec3 RRTAndODTFit( vec3 v ) {
|
|
1706
|
+
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
|
1707
|
+
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
|
1708
|
+
return a / b;
|
|
1709
|
+
}
|
|
1710
|
+
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|
1711
|
+
const mat3 ACESInputMat = mat3(
|
|
1712
|
+
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
|
1713
|
+
vec3( 0.04823, 0.01566, 0.83777 )
|
|
1714
|
+
);
|
|
1715
|
+
const mat3 ACESOutputMat = mat3(
|
|
1716
|
+
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
|
1717
|
+
vec3( -0.07367, -0.00605, 1.07602 )
|
|
1718
|
+
);
|
|
1719
|
+
color *= toneMappingExposure / 0.6;
|
|
1720
|
+
color = ACESInputMat * color;
|
|
1721
|
+
color = RRTAndODTFit( color );
|
|
1722
|
+
color = ACESOutputMat * color;
|
|
1723
|
+
return saturate( color );
|
|
1724
|
+
}
|
|
1725
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,hS=`#ifdef USE_TRANSMISSION
|
|
1726
|
+
float transmissionAlpha = 1.0;
|
|
1727
|
+
float transmissionFactor = transmission;
|
|
1728
|
+
float thicknessFactor = thickness;
|
|
1729
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
1730
|
+
transmissionFactor *= texture2D( transmissionMap, vUv ).r;
|
|
1731
|
+
#endif
|
|
1732
|
+
#ifdef USE_THICKNESSMAP
|
|
1733
|
+
thicknessFactor *= texture2D( thicknessMap, vUv ).g;
|
|
1734
|
+
#endif
|
|
1735
|
+
vec3 pos = vWorldPosition;
|
|
1736
|
+
vec3 v = normalize( cameraPosition - pos );
|
|
1737
|
+
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
|
1738
|
+
vec4 transmission = getIBLVolumeRefraction(
|
|
1739
|
+
n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,
|
|
1740
|
+
pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
|
|
1741
|
+
attenuationColor, attenuationDistance );
|
|
1742
|
+
totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );
|
|
1743
|
+
transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );
|
|
1744
|
+
#endif`,fS=`#ifdef USE_TRANSMISSION
|
|
1745
|
+
uniform float transmission;
|
|
1746
|
+
uniform float thickness;
|
|
1747
|
+
uniform float attenuationDistance;
|
|
1748
|
+
uniform vec3 attenuationColor;
|
|
1749
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
1750
|
+
uniform sampler2D transmissionMap;
|
|
1751
|
+
#endif
|
|
1752
|
+
#ifdef USE_THICKNESSMAP
|
|
1753
|
+
uniform sampler2D thicknessMap;
|
|
1754
|
+
#endif
|
|
1755
|
+
uniform vec2 transmissionSamplerSize;
|
|
1756
|
+
uniform sampler2D transmissionSamplerMap;
|
|
1757
|
+
uniform mat4 modelMatrix;
|
|
1758
|
+
uniform mat4 projectionMatrix;
|
|
1759
|
+
varying vec3 vWorldPosition;
|
|
1760
|
+
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
|
1761
|
+
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|
1762
|
+
vec3 modelScale;
|
|
1763
|
+
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|
1764
|
+
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|
1765
|
+
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|
1766
|
+
return normalize( refractionVector ) * thickness * modelScale;
|
|
1767
|
+
}
|
|
1768
|
+
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
|
1769
|
+
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|
1770
|
+
}
|
|
1771
|
+
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
|
1772
|
+
float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|
1773
|
+
#ifdef texture2DLodEXT
|
|
1774
|
+
return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
|
|
1775
|
+
#else
|
|
1776
|
+
return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
|
|
1777
|
+
#endif
|
|
1778
|
+
}
|
|
1779
|
+
vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
1780
|
+
if ( attenuationDistance == 0.0 ) {
|
|
1781
|
+
return radiance;
|
|
1782
|
+
} else {
|
|
1783
|
+
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|
1784
|
+
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
|
1788
|
+
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
|
1789
|
+
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
|
|
1790
|
+
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
1791
|
+
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|
1792
|
+
vec3 refractedRayExit = position + transmissionRay;
|
|
1793
|
+
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
1794
|
+
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
1795
|
+
refractionCoords += 1.0;
|
|
1796
|
+
refractionCoords /= 2.0;
|
|
1797
|
+
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
|
1798
|
+
vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
|
|
1799
|
+
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
|
1800
|
+
return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
|
|
1801
|
+
}
|
|
1802
|
+
#endif`,dS=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
|
|
1803
|
+
varying vec2 vUv;
|
|
1804
|
+
#endif`,pS=`#ifdef USE_UV
|
|
1805
|
+
#ifdef UVS_VERTEX_ONLY
|
|
1806
|
+
vec2 vUv;
|
|
1807
|
+
#else
|
|
1808
|
+
varying vec2 vUv;
|
|
1809
|
+
#endif
|
|
1810
|
+
uniform mat3 uvTransform;
|
|
1811
|
+
#endif`,mS=`#ifdef USE_UV
|
|
1812
|
+
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
1813
|
+
#endif`,gS=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1814
|
+
varying vec2 vUv2;
|
|
1815
|
+
#endif`,yS=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1816
|
+
attribute vec2 uv2;
|
|
1817
|
+
varying vec2 vUv2;
|
|
1818
|
+
uniform mat3 uv2Transform;
|
|
1819
|
+
#endif`,xS=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1820
|
+
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
|
|
1821
|
+
#endif`,vS=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )
|
|
1822
|
+
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
1823
|
+
#ifdef USE_INSTANCING
|
|
1824
|
+
worldPosition = instanceMatrix * worldPosition;
|
|
1825
|
+
#endif
|
|
1826
|
+
worldPosition = modelMatrix * worldPosition;
|
|
1827
|
+
#endif`;const _S=`varying vec2 vUv;
|
|
1828
|
+
uniform mat3 uvTransform;
|
|
1829
|
+
void main() {
|
|
1830
|
+
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
1831
|
+
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
1832
|
+
}`,wS=`uniform sampler2D t2D;
|
|
1833
|
+
varying vec2 vUv;
|
|
1834
|
+
void main() {
|
|
1835
|
+
gl_FragColor = texture2D( t2D, vUv );
|
|
1836
|
+
#ifdef DECODE_VIDEO_TEXTURE
|
|
1837
|
+
gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );
|
|
1838
|
+
#endif
|
|
1839
|
+
#include <tonemapping_fragment>
|
|
1840
|
+
#include <encodings_fragment>
|
|
1841
|
+
}`,MS=`varying vec3 vWorldDirection;
|
|
1842
|
+
#include <common>
|
|
1843
|
+
void main() {
|
|
1844
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
1845
|
+
#include <begin_vertex>
|
|
1846
|
+
#include <project_vertex>
|
|
1847
|
+
gl_Position.z = gl_Position.w;
|
|
1848
|
+
}`,SS=`#include <envmap_common_pars_fragment>
|
|
1849
|
+
uniform float opacity;
|
|
1850
|
+
varying vec3 vWorldDirection;
|
|
1851
|
+
#include <cube_uv_reflection_fragment>
|
|
1852
|
+
void main() {
|
|
1853
|
+
vec3 vReflect = vWorldDirection;
|
|
1854
|
+
#include <envmap_fragment>
|
|
1855
|
+
gl_FragColor = envColor;
|
|
1856
|
+
gl_FragColor.a *= opacity;
|
|
1857
|
+
#include <tonemapping_fragment>
|
|
1858
|
+
#include <encodings_fragment>
|
|
1859
|
+
}`,bS=`#include <common>
|
|
1860
|
+
#include <uv_pars_vertex>
|
|
1861
|
+
#include <displacementmap_pars_vertex>
|
|
1862
|
+
#include <morphtarget_pars_vertex>
|
|
1863
|
+
#include <skinning_pars_vertex>
|
|
1864
|
+
#include <logdepthbuf_pars_vertex>
|
|
1865
|
+
#include <clipping_planes_pars_vertex>
|
|
1866
|
+
varying vec2 vHighPrecisionZW;
|
|
1867
|
+
void main() {
|
|
1868
|
+
#include <uv_vertex>
|
|
1869
|
+
#include <skinbase_vertex>
|
|
1870
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
1871
|
+
#include <beginnormal_vertex>
|
|
1872
|
+
#include <morphnormal_vertex>
|
|
1873
|
+
#include <skinnormal_vertex>
|
|
1874
|
+
#endif
|
|
1875
|
+
#include <begin_vertex>
|
|
1876
|
+
#include <morphtarget_vertex>
|
|
1877
|
+
#include <skinning_vertex>
|
|
1878
|
+
#include <displacementmap_vertex>
|
|
1879
|
+
#include <project_vertex>
|
|
1880
|
+
#include <logdepthbuf_vertex>
|
|
1881
|
+
#include <clipping_planes_vertex>
|
|
1882
|
+
vHighPrecisionZW = gl_Position.zw;
|
|
1883
|
+
}`,ES=`#if DEPTH_PACKING == 3200
|
|
1884
|
+
uniform float opacity;
|
|
1885
|
+
#endif
|
|
1886
|
+
#include <common>
|
|
1887
|
+
#include <packing>
|
|
1888
|
+
#include <uv_pars_fragment>
|
|
1889
|
+
#include <map_pars_fragment>
|
|
1890
|
+
#include <alphamap_pars_fragment>
|
|
1891
|
+
#include <alphatest_pars_fragment>
|
|
1892
|
+
#include <logdepthbuf_pars_fragment>
|
|
1893
|
+
#include <clipping_planes_pars_fragment>
|
|
1894
|
+
varying vec2 vHighPrecisionZW;
|
|
1895
|
+
void main() {
|
|
1896
|
+
#include <clipping_planes_fragment>
|
|
1897
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
1898
|
+
#if DEPTH_PACKING == 3200
|
|
1899
|
+
diffuseColor.a = opacity;
|
|
1900
|
+
#endif
|
|
1901
|
+
#include <map_fragment>
|
|
1902
|
+
#include <alphamap_fragment>
|
|
1903
|
+
#include <alphatest_fragment>
|
|
1904
|
+
#include <logdepthbuf_fragment>
|
|
1905
|
+
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
|
1906
|
+
#if DEPTH_PACKING == 3200
|
|
1907
|
+
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|
1908
|
+
#elif DEPTH_PACKING == 3201
|
|
1909
|
+
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
1910
|
+
#endif
|
|
1911
|
+
}`,TS=`#define DISTANCE
|
|
1912
|
+
varying vec3 vWorldPosition;
|
|
1913
|
+
#include <common>
|
|
1914
|
+
#include <uv_pars_vertex>
|
|
1915
|
+
#include <displacementmap_pars_vertex>
|
|
1916
|
+
#include <morphtarget_pars_vertex>
|
|
1917
|
+
#include <skinning_pars_vertex>
|
|
1918
|
+
#include <clipping_planes_pars_vertex>
|
|
1919
|
+
void main() {
|
|
1920
|
+
#include <uv_vertex>
|
|
1921
|
+
#include <skinbase_vertex>
|
|
1922
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
1923
|
+
#include <beginnormal_vertex>
|
|
1924
|
+
#include <morphnormal_vertex>
|
|
1925
|
+
#include <skinnormal_vertex>
|
|
1926
|
+
#endif
|
|
1927
|
+
#include <begin_vertex>
|
|
1928
|
+
#include <morphtarget_vertex>
|
|
1929
|
+
#include <skinning_vertex>
|
|
1930
|
+
#include <displacementmap_vertex>
|
|
1931
|
+
#include <project_vertex>
|
|
1932
|
+
#include <worldpos_vertex>
|
|
1933
|
+
#include <clipping_planes_vertex>
|
|
1934
|
+
vWorldPosition = worldPosition.xyz;
|
|
1935
|
+
}`,AS=`#define DISTANCE
|
|
1936
|
+
uniform vec3 referencePosition;
|
|
1937
|
+
uniform float nearDistance;
|
|
1938
|
+
uniform float farDistance;
|
|
1939
|
+
varying vec3 vWorldPosition;
|
|
1940
|
+
#include <common>
|
|
1941
|
+
#include <packing>
|
|
1942
|
+
#include <uv_pars_fragment>
|
|
1943
|
+
#include <map_pars_fragment>
|
|
1944
|
+
#include <alphamap_pars_fragment>
|
|
1945
|
+
#include <alphatest_pars_fragment>
|
|
1946
|
+
#include <clipping_planes_pars_fragment>
|
|
1947
|
+
void main () {
|
|
1948
|
+
#include <clipping_planes_fragment>
|
|
1949
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
1950
|
+
#include <map_fragment>
|
|
1951
|
+
#include <alphamap_fragment>
|
|
1952
|
+
#include <alphatest_fragment>
|
|
1953
|
+
float dist = length( vWorldPosition - referencePosition );
|
|
1954
|
+
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
1955
|
+
dist = saturate( dist );
|
|
1956
|
+
gl_FragColor = packDepthToRGBA( dist );
|
|
1957
|
+
}`,CS=`varying vec3 vWorldDirection;
|
|
1958
|
+
#include <common>
|
|
1959
|
+
void main() {
|
|
1960
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
1961
|
+
#include <begin_vertex>
|
|
1962
|
+
#include <project_vertex>
|
|
1963
|
+
}`,RS=`uniform sampler2D tEquirect;
|
|
1964
|
+
varying vec3 vWorldDirection;
|
|
1965
|
+
#include <common>
|
|
1966
|
+
void main() {
|
|
1967
|
+
vec3 direction = normalize( vWorldDirection );
|
|
1968
|
+
vec2 sampleUV = equirectUv( direction );
|
|
1969
|
+
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
1970
|
+
#include <tonemapping_fragment>
|
|
1971
|
+
#include <encodings_fragment>
|
|
1972
|
+
}`,PS=`uniform float scale;
|
|
1973
|
+
attribute float lineDistance;
|
|
1974
|
+
varying float vLineDistance;
|
|
1975
|
+
#include <common>
|
|
1976
|
+
#include <color_pars_vertex>
|
|
1977
|
+
#include <fog_pars_vertex>
|
|
1978
|
+
#include <morphtarget_pars_vertex>
|
|
1979
|
+
#include <logdepthbuf_pars_vertex>
|
|
1980
|
+
#include <clipping_planes_pars_vertex>
|
|
1981
|
+
void main() {
|
|
1982
|
+
vLineDistance = scale * lineDistance;
|
|
1983
|
+
#include <color_vertex>
|
|
1984
|
+
#include <morphcolor_vertex>
|
|
1985
|
+
#include <begin_vertex>
|
|
1986
|
+
#include <morphtarget_vertex>
|
|
1987
|
+
#include <project_vertex>
|
|
1988
|
+
#include <logdepthbuf_vertex>
|
|
1989
|
+
#include <clipping_planes_vertex>
|
|
1990
|
+
#include <fog_vertex>
|
|
1991
|
+
}`,LS=`uniform vec3 diffuse;
|
|
1992
|
+
uniform float opacity;
|
|
1993
|
+
uniform float dashSize;
|
|
1994
|
+
uniform float totalSize;
|
|
1995
|
+
varying float vLineDistance;
|
|
1996
|
+
#include <common>
|
|
1997
|
+
#include <color_pars_fragment>
|
|
1998
|
+
#include <fog_pars_fragment>
|
|
1999
|
+
#include <logdepthbuf_pars_fragment>
|
|
2000
|
+
#include <clipping_planes_pars_fragment>
|
|
2001
|
+
void main() {
|
|
2002
|
+
#include <clipping_planes_fragment>
|
|
2003
|
+
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
2004
|
+
discard;
|
|
2005
|
+
}
|
|
2006
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
2007
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2008
|
+
#include <logdepthbuf_fragment>
|
|
2009
|
+
#include <color_fragment>
|
|
2010
|
+
outgoingLight = diffuseColor.rgb;
|
|
2011
|
+
#include <output_fragment>
|
|
2012
|
+
#include <tonemapping_fragment>
|
|
2013
|
+
#include <encodings_fragment>
|
|
2014
|
+
#include <fog_fragment>
|
|
2015
|
+
#include <premultiplied_alpha_fragment>
|
|
2016
|
+
}`,DS=`#include <common>
|
|
2017
|
+
#include <uv_pars_vertex>
|
|
2018
|
+
#include <uv2_pars_vertex>
|
|
2019
|
+
#include <envmap_pars_vertex>
|
|
2020
|
+
#include <color_pars_vertex>
|
|
2021
|
+
#include <fog_pars_vertex>
|
|
2022
|
+
#include <morphtarget_pars_vertex>
|
|
2023
|
+
#include <skinning_pars_vertex>
|
|
2024
|
+
#include <logdepthbuf_pars_vertex>
|
|
2025
|
+
#include <clipping_planes_pars_vertex>
|
|
2026
|
+
void main() {
|
|
2027
|
+
#include <uv_vertex>
|
|
2028
|
+
#include <uv2_vertex>
|
|
2029
|
+
#include <color_vertex>
|
|
2030
|
+
#include <morphcolor_vertex>
|
|
2031
|
+
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
|
2032
|
+
#include <beginnormal_vertex>
|
|
2033
|
+
#include <morphnormal_vertex>
|
|
2034
|
+
#include <skinbase_vertex>
|
|
2035
|
+
#include <skinnormal_vertex>
|
|
2036
|
+
#include <defaultnormal_vertex>
|
|
2037
|
+
#endif
|
|
2038
|
+
#include <begin_vertex>
|
|
2039
|
+
#include <morphtarget_vertex>
|
|
2040
|
+
#include <skinning_vertex>
|
|
2041
|
+
#include <project_vertex>
|
|
2042
|
+
#include <logdepthbuf_vertex>
|
|
2043
|
+
#include <clipping_planes_vertex>
|
|
2044
|
+
#include <worldpos_vertex>
|
|
2045
|
+
#include <envmap_vertex>
|
|
2046
|
+
#include <fog_vertex>
|
|
2047
|
+
}`,IS=`uniform vec3 diffuse;
|
|
2048
|
+
uniform float opacity;
|
|
2049
|
+
#ifndef FLAT_SHADED
|
|
2050
|
+
varying vec3 vNormal;
|
|
2051
|
+
#endif
|
|
2052
|
+
#include <common>
|
|
2053
|
+
#include <dithering_pars_fragment>
|
|
2054
|
+
#include <color_pars_fragment>
|
|
2055
|
+
#include <uv_pars_fragment>
|
|
2056
|
+
#include <uv2_pars_fragment>
|
|
2057
|
+
#include <map_pars_fragment>
|
|
2058
|
+
#include <alphamap_pars_fragment>
|
|
2059
|
+
#include <alphatest_pars_fragment>
|
|
2060
|
+
#include <aomap_pars_fragment>
|
|
2061
|
+
#include <lightmap_pars_fragment>
|
|
2062
|
+
#include <envmap_common_pars_fragment>
|
|
2063
|
+
#include <envmap_pars_fragment>
|
|
2064
|
+
#include <cube_uv_reflection_fragment>
|
|
2065
|
+
#include <fog_pars_fragment>
|
|
2066
|
+
#include <specularmap_pars_fragment>
|
|
2067
|
+
#include <logdepthbuf_pars_fragment>
|
|
2068
|
+
#include <clipping_planes_pars_fragment>
|
|
2069
|
+
void main() {
|
|
2070
|
+
#include <clipping_planes_fragment>
|
|
2071
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2072
|
+
#include <logdepthbuf_fragment>
|
|
2073
|
+
#include <map_fragment>
|
|
2074
|
+
#include <color_fragment>
|
|
2075
|
+
#include <alphamap_fragment>
|
|
2076
|
+
#include <alphatest_fragment>
|
|
2077
|
+
#include <specularmap_fragment>
|
|
2078
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2079
|
+
#ifdef USE_LIGHTMAP
|
|
2080
|
+
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
|
2081
|
+
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
|
|
2082
|
+
#else
|
|
2083
|
+
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|
2084
|
+
#endif
|
|
2085
|
+
#include <aomap_fragment>
|
|
2086
|
+
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|
2087
|
+
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|
2088
|
+
#include <envmap_fragment>
|
|
2089
|
+
#include <output_fragment>
|
|
2090
|
+
#include <tonemapping_fragment>
|
|
2091
|
+
#include <encodings_fragment>
|
|
2092
|
+
#include <fog_fragment>
|
|
2093
|
+
#include <premultiplied_alpha_fragment>
|
|
2094
|
+
#include <dithering_fragment>
|
|
2095
|
+
}`,zS=`#define LAMBERT
|
|
2096
|
+
varying vec3 vLightFront;
|
|
2097
|
+
varying vec3 vIndirectFront;
|
|
2098
|
+
#ifdef DOUBLE_SIDED
|
|
2099
|
+
varying vec3 vLightBack;
|
|
2100
|
+
varying vec3 vIndirectBack;
|
|
2101
|
+
#endif
|
|
2102
|
+
#include <common>
|
|
2103
|
+
#include <uv_pars_vertex>
|
|
2104
|
+
#include <uv2_pars_vertex>
|
|
2105
|
+
#include <envmap_pars_vertex>
|
|
2106
|
+
#include <bsdfs>
|
|
2107
|
+
#include <lights_pars_begin>
|
|
2108
|
+
#include <color_pars_vertex>
|
|
2109
|
+
#include <fog_pars_vertex>
|
|
2110
|
+
#include <morphtarget_pars_vertex>
|
|
2111
|
+
#include <skinning_pars_vertex>
|
|
2112
|
+
#include <shadowmap_pars_vertex>
|
|
2113
|
+
#include <logdepthbuf_pars_vertex>
|
|
2114
|
+
#include <clipping_planes_pars_vertex>
|
|
2115
|
+
void main() {
|
|
2116
|
+
#include <uv_vertex>
|
|
2117
|
+
#include <uv2_vertex>
|
|
2118
|
+
#include <color_vertex>
|
|
2119
|
+
#include <morphcolor_vertex>
|
|
2120
|
+
#include <beginnormal_vertex>
|
|
2121
|
+
#include <morphnormal_vertex>
|
|
2122
|
+
#include <skinbase_vertex>
|
|
2123
|
+
#include <skinnormal_vertex>
|
|
2124
|
+
#include <defaultnormal_vertex>
|
|
2125
|
+
#include <begin_vertex>
|
|
2126
|
+
#include <morphtarget_vertex>
|
|
2127
|
+
#include <skinning_vertex>
|
|
2128
|
+
#include <project_vertex>
|
|
2129
|
+
#include <logdepthbuf_vertex>
|
|
2130
|
+
#include <clipping_planes_vertex>
|
|
2131
|
+
#include <worldpos_vertex>
|
|
2132
|
+
#include <envmap_vertex>
|
|
2133
|
+
#include <lights_lambert_vertex>
|
|
2134
|
+
#include <shadowmap_vertex>
|
|
2135
|
+
#include <fog_vertex>
|
|
2136
|
+
}`,NS=`uniform vec3 diffuse;
|
|
2137
|
+
uniform vec3 emissive;
|
|
2138
|
+
uniform float opacity;
|
|
2139
|
+
varying vec3 vLightFront;
|
|
2140
|
+
varying vec3 vIndirectFront;
|
|
2141
|
+
#ifdef DOUBLE_SIDED
|
|
2142
|
+
varying vec3 vLightBack;
|
|
2143
|
+
varying vec3 vIndirectBack;
|
|
2144
|
+
#endif
|
|
2145
|
+
#include <common>
|
|
2146
|
+
#include <packing>
|
|
2147
|
+
#include <dithering_pars_fragment>
|
|
2148
|
+
#include <color_pars_fragment>
|
|
2149
|
+
#include <uv_pars_fragment>
|
|
2150
|
+
#include <uv2_pars_fragment>
|
|
2151
|
+
#include <map_pars_fragment>
|
|
2152
|
+
#include <alphamap_pars_fragment>
|
|
2153
|
+
#include <alphatest_pars_fragment>
|
|
2154
|
+
#include <aomap_pars_fragment>
|
|
2155
|
+
#include <lightmap_pars_fragment>
|
|
2156
|
+
#include <emissivemap_pars_fragment>
|
|
2157
|
+
#include <envmap_common_pars_fragment>
|
|
2158
|
+
#include <envmap_pars_fragment>
|
|
2159
|
+
#include <cube_uv_reflection_fragment>
|
|
2160
|
+
#include <bsdfs>
|
|
2161
|
+
#include <lights_pars_begin>
|
|
2162
|
+
#include <fog_pars_fragment>
|
|
2163
|
+
#include <shadowmap_pars_fragment>
|
|
2164
|
+
#include <shadowmask_pars_fragment>
|
|
2165
|
+
#include <specularmap_pars_fragment>
|
|
2166
|
+
#include <logdepthbuf_pars_fragment>
|
|
2167
|
+
#include <clipping_planes_pars_fragment>
|
|
2168
|
+
void main() {
|
|
2169
|
+
#include <clipping_planes_fragment>
|
|
2170
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2171
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2172
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2173
|
+
#include <logdepthbuf_fragment>
|
|
2174
|
+
#include <map_fragment>
|
|
2175
|
+
#include <color_fragment>
|
|
2176
|
+
#include <alphamap_fragment>
|
|
2177
|
+
#include <alphatest_fragment>
|
|
2178
|
+
#include <specularmap_fragment>
|
|
2179
|
+
#include <emissivemap_fragment>
|
|
2180
|
+
#ifdef DOUBLE_SIDED
|
|
2181
|
+
reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
|
|
2182
|
+
#else
|
|
2183
|
+
reflectedLight.indirectDiffuse += vIndirectFront;
|
|
2184
|
+
#endif
|
|
2185
|
+
#include <lightmap_fragment>
|
|
2186
|
+
reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );
|
|
2187
|
+
#ifdef DOUBLE_SIDED
|
|
2188
|
+
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
|
|
2189
|
+
#else
|
|
2190
|
+
reflectedLight.directDiffuse = vLightFront;
|
|
2191
|
+
#endif
|
|
2192
|
+
reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();
|
|
2193
|
+
#include <aomap_fragment>
|
|
2194
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2195
|
+
#include <envmap_fragment>
|
|
2196
|
+
#include <output_fragment>
|
|
2197
|
+
#include <tonemapping_fragment>
|
|
2198
|
+
#include <encodings_fragment>
|
|
2199
|
+
#include <fog_fragment>
|
|
2200
|
+
#include <premultiplied_alpha_fragment>
|
|
2201
|
+
#include <dithering_fragment>
|
|
2202
|
+
}`,FS=`#define MATCAP
|
|
2203
|
+
varying vec3 vViewPosition;
|
|
2204
|
+
#include <common>
|
|
2205
|
+
#include <uv_pars_vertex>
|
|
2206
|
+
#include <color_pars_vertex>
|
|
2207
|
+
#include <displacementmap_pars_vertex>
|
|
2208
|
+
#include <fog_pars_vertex>
|
|
2209
|
+
#include <normal_pars_vertex>
|
|
2210
|
+
#include <morphtarget_pars_vertex>
|
|
2211
|
+
#include <skinning_pars_vertex>
|
|
2212
|
+
#include <logdepthbuf_pars_vertex>
|
|
2213
|
+
#include <clipping_planes_pars_vertex>
|
|
2214
|
+
void main() {
|
|
2215
|
+
#include <uv_vertex>
|
|
2216
|
+
#include <color_vertex>
|
|
2217
|
+
#include <morphcolor_vertex>
|
|
2218
|
+
#include <beginnormal_vertex>
|
|
2219
|
+
#include <morphnormal_vertex>
|
|
2220
|
+
#include <skinbase_vertex>
|
|
2221
|
+
#include <skinnormal_vertex>
|
|
2222
|
+
#include <defaultnormal_vertex>
|
|
2223
|
+
#include <normal_vertex>
|
|
2224
|
+
#include <begin_vertex>
|
|
2225
|
+
#include <morphtarget_vertex>
|
|
2226
|
+
#include <skinning_vertex>
|
|
2227
|
+
#include <displacementmap_vertex>
|
|
2228
|
+
#include <project_vertex>
|
|
2229
|
+
#include <logdepthbuf_vertex>
|
|
2230
|
+
#include <clipping_planes_vertex>
|
|
2231
|
+
#include <fog_vertex>
|
|
2232
|
+
vViewPosition = - mvPosition.xyz;
|
|
2233
|
+
}`,OS=`#define MATCAP
|
|
2234
|
+
uniform vec3 diffuse;
|
|
2235
|
+
uniform float opacity;
|
|
2236
|
+
uniform sampler2D matcap;
|
|
2237
|
+
varying vec3 vViewPosition;
|
|
2238
|
+
#include <common>
|
|
2239
|
+
#include <dithering_pars_fragment>
|
|
2240
|
+
#include <color_pars_fragment>
|
|
2241
|
+
#include <uv_pars_fragment>
|
|
2242
|
+
#include <map_pars_fragment>
|
|
2243
|
+
#include <alphamap_pars_fragment>
|
|
2244
|
+
#include <alphatest_pars_fragment>
|
|
2245
|
+
#include <fog_pars_fragment>
|
|
2246
|
+
#include <normal_pars_fragment>
|
|
2247
|
+
#include <bumpmap_pars_fragment>
|
|
2248
|
+
#include <normalmap_pars_fragment>
|
|
2249
|
+
#include <logdepthbuf_pars_fragment>
|
|
2250
|
+
#include <clipping_planes_pars_fragment>
|
|
2251
|
+
void main() {
|
|
2252
|
+
#include <clipping_planes_fragment>
|
|
2253
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2254
|
+
#include <logdepthbuf_fragment>
|
|
2255
|
+
#include <map_fragment>
|
|
2256
|
+
#include <color_fragment>
|
|
2257
|
+
#include <alphamap_fragment>
|
|
2258
|
+
#include <alphatest_fragment>
|
|
2259
|
+
#include <normal_fragment_begin>
|
|
2260
|
+
#include <normal_fragment_maps>
|
|
2261
|
+
vec3 viewDir = normalize( vViewPosition );
|
|
2262
|
+
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
2263
|
+
vec3 y = cross( viewDir, x );
|
|
2264
|
+
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|
2265
|
+
#ifdef USE_MATCAP
|
|
2266
|
+
vec4 matcapColor = texture2D( matcap, uv );
|
|
2267
|
+
#else
|
|
2268
|
+
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
|
2269
|
+
#endif
|
|
2270
|
+
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|
2271
|
+
#include <output_fragment>
|
|
2272
|
+
#include <tonemapping_fragment>
|
|
2273
|
+
#include <encodings_fragment>
|
|
2274
|
+
#include <fog_fragment>
|
|
2275
|
+
#include <premultiplied_alpha_fragment>
|
|
2276
|
+
#include <dithering_fragment>
|
|
2277
|
+
}`,BS=`#define NORMAL
|
|
2278
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2279
|
+
varying vec3 vViewPosition;
|
|
2280
|
+
#endif
|
|
2281
|
+
#include <common>
|
|
2282
|
+
#include <uv_pars_vertex>
|
|
2283
|
+
#include <displacementmap_pars_vertex>
|
|
2284
|
+
#include <normal_pars_vertex>
|
|
2285
|
+
#include <morphtarget_pars_vertex>
|
|
2286
|
+
#include <skinning_pars_vertex>
|
|
2287
|
+
#include <logdepthbuf_pars_vertex>
|
|
2288
|
+
#include <clipping_planes_pars_vertex>
|
|
2289
|
+
void main() {
|
|
2290
|
+
#include <uv_vertex>
|
|
2291
|
+
#include <beginnormal_vertex>
|
|
2292
|
+
#include <morphnormal_vertex>
|
|
2293
|
+
#include <skinbase_vertex>
|
|
2294
|
+
#include <skinnormal_vertex>
|
|
2295
|
+
#include <defaultnormal_vertex>
|
|
2296
|
+
#include <normal_vertex>
|
|
2297
|
+
#include <begin_vertex>
|
|
2298
|
+
#include <morphtarget_vertex>
|
|
2299
|
+
#include <skinning_vertex>
|
|
2300
|
+
#include <displacementmap_vertex>
|
|
2301
|
+
#include <project_vertex>
|
|
2302
|
+
#include <logdepthbuf_vertex>
|
|
2303
|
+
#include <clipping_planes_vertex>
|
|
2304
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2305
|
+
vViewPosition = - mvPosition.xyz;
|
|
2306
|
+
#endif
|
|
2307
|
+
}`,US=`#define NORMAL
|
|
2308
|
+
uniform float opacity;
|
|
2309
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2310
|
+
varying vec3 vViewPosition;
|
|
2311
|
+
#endif
|
|
2312
|
+
#include <packing>
|
|
2313
|
+
#include <uv_pars_fragment>
|
|
2314
|
+
#include <normal_pars_fragment>
|
|
2315
|
+
#include <bumpmap_pars_fragment>
|
|
2316
|
+
#include <normalmap_pars_fragment>
|
|
2317
|
+
#include <logdepthbuf_pars_fragment>
|
|
2318
|
+
#include <clipping_planes_pars_fragment>
|
|
2319
|
+
void main() {
|
|
2320
|
+
#include <clipping_planes_fragment>
|
|
2321
|
+
#include <logdepthbuf_fragment>
|
|
2322
|
+
#include <normal_fragment_begin>
|
|
2323
|
+
#include <normal_fragment_maps>
|
|
2324
|
+
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
|
|
2325
|
+
#ifdef OPAQUE
|
|
2326
|
+
gl_FragColor.a = 1.0;
|
|
2327
|
+
#endif
|
|
2328
|
+
}`,kS=`#define PHONG
|
|
2329
|
+
varying vec3 vViewPosition;
|
|
2330
|
+
#include <common>
|
|
2331
|
+
#include <uv_pars_vertex>
|
|
2332
|
+
#include <uv2_pars_vertex>
|
|
2333
|
+
#include <displacementmap_pars_vertex>
|
|
2334
|
+
#include <envmap_pars_vertex>
|
|
2335
|
+
#include <color_pars_vertex>
|
|
2336
|
+
#include <fog_pars_vertex>
|
|
2337
|
+
#include <normal_pars_vertex>
|
|
2338
|
+
#include <morphtarget_pars_vertex>
|
|
2339
|
+
#include <skinning_pars_vertex>
|
|
2340
|
+
#include <shadowmap_pars_vertex>
|
|
2341
|
+
#include <logdepthbuf_pars_vertex>
|
|
2342
|
+
#include <clipping_planes_pars_vertex>
|
|
2343
|
+
void main() {
|
|
2344
|
+
#include <uv_vertex>
|
|
2345
|
+
#include <uv2_vertex>
|
|
2346
|
+
#include <color_vertex>
|
|
2347
|
+
#include <morphcolor_vertex>
|
|
2348
|
+
#include <beginnormal_vertex>
|
|
2349
|
+
#include <morphnormal_vertex>
|
|
2350
|
+
#include <skinbase_vertex>
|
|
2351
|
+
#include <skinnormal_vertex>
|
|
2352
|
+
#include <defaultnormal_vertex>
|
|
2353
|
+
#include <normal_vertex>
|
|
2354
|
+
#include <begin_vertex>
|
|
2355
|
+
#include <morphtarget_vertex>
|
|
2356
|
+
#include <skinning_vertex>
|
|
2357
|
+
#include <displacementmap_vertex>
|
|
2358
|
+
#include <project_vertex>
|
|
2359
|
+
#include <logdepthbuf_vertex>
|
|
2360
|
+
#include <clipping_planes_vertex>
|
|
2361
|
+
vViewPosition = - mvPosition.xyz;
|
|
2362
|
+
#include <worldpos_vertex>
|
|
2363
|
+
#include <envmap_vertex>
|
|
2364
|
+
#include <shadowmap_vertex>
|
|
2365
|
+
#include <fog_vertex>
|
|
2366
|
+
}`,HS=`#define PHONG
|
|
2367
|
+
uniform vec3 diffuse;
|
|
2368
|
+
uniform vec3 emissive;
|
|
2369
|
+
uniform vec3 specular;
|
|
2370
|
+
uniform float shininess;
|
|
2371
|
+
uniform float opacity;
|
|
2372
|
+
#include <common>
|
|
2373
|
+
#include <packing>
|
|
2374
|
+
#include <dithering_pars_fragment>
|
|
2375
|
+
#include <color_pars_fragment>
|
|
2376
|
+
#include <uv_pars_fragment>
|
|
2377
|
+
#include <uv2_pars_fragment>
|
|
2378
|
+
#include <map_pars_fragment>
|
|
2379
|
+
#include <alphamap_pars_fragment>
|
|
2380
|
+
#include <alphatest_pars_fragment>
|
|
2381
|
+
#include <aomap_pars_fragment>
|
|
2382
|
+
#include <lightmap_pars_fragment>
|
|
2383
|
+
#include <emissivemap_pars_fragment>
|
|
2384
|
+
#include <envmap_common_pars_fragment>
|
|
2385
|
+
#include <envmap_pars_fragment>
|
|
2386
|
+
#include <cube_uv_reflection_fragment>
|
|
2387
|
+
#include <fog_pars_fragment>
|
|
2388
|
+
#include <bsdfs>
|
|
2389
|
+
#include <lights_pars_begin>
|
|
2390
|
+
#include <normal_pars_fragment>
|
|
2391
|
+
#include <lights_phong_pars_fragment>
|
|
2392
|
+
#include <shadowmap_pars_fragment>
|
|
2393
|
+
#include <bumpmap_pars_fragment>
|
|
2394
|
+
#include <normalmap_pars_fragment>
|
|
2395
|
+
#include <specularmap_pars_fragment>
|
|
2396
|
+
#include <logdepthbuf_pars_fragment>
|
|
2397
|
+
#include <clipping_planes_pars_fragment>
|
|
2398
|
+
void main() {
|
|
2399
|
+
#include <clipping_planes_fragment>
|
|
2400
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2401
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2402
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2403
|
+
#include <logdepthbuf_fragment>
|
|
2404
|
+
#include <map_fragment>
|
|
2405
|
+
#include <color_fragment>
|
|
2406
|
+
#include <alphamap_fragment>
|
|
2407
|
+
#include <alphatest_fragment>
|
|
2408
|
+
#include <specularmap_fragment>
|
|
2409
|
+
#include <normal_fragment_begin>
|
|
2410
|
+
#include <normal_fragment_maps>
|
|
2411
|
+
#include <emissivemap_fragment>
|
|
2412
|
+
#include <lights_phong_fragment>
|
|
2413
|
+
#include <lights_fragment_begin>
|
|
2414
|
+
#include <lights_fragment_maps>
|
|
2415
|
+
#include <lights_fragment_end>
|
|
2416
|
+
#include <aomap_fragment>
|
|
2417
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
2418
|
+
#include <envmap_fragment>
|
|
2419
|
+
#include <output_fragment>
|
|
2420
|
+
#include <tonemapping_fragment>
|
|
2421
|
+
#include <encodings_fragment>
|
|
2422
|
+
#include <fog_fragment>
|
|
2423
|
+
#include <premultiplied_alpha_fragment>
|
|
2424
|
+
#include <dithering_fragment>
|
|
2425
|
+
}`,GS=`#define STANDARD
|
|
2426
|
+
varying vec3 vViewPosition;
|
|
2427
|
+
#ifdef USE_TRANSMISSION
|
|
2428
|
+
varying vec3 vWorldPosition;
|
|
2429
|
+
#endif
|
|
2430
|
+
#include <common>
|
|
2431
|
+
#include <uv_pars_vertex>
|
|
2432
|
+
#include <uv2_pars_vertex>
|
|
2433
|
+
#include <displacementmap_pars_vertex>
|
|
2434
|
+
#include <color_pars_vertex>
|
|
2435
|
+
#include <fog_pars_vertex>
|
|
2436
|
+
#include <normal_pars_vertex>
|
|
2437
|
+
#include <morphtarget_pars_vertex>
|
|
2438
|
+
#include <skinning_pars_vertex>
|
|
2439
|
+
#include <shadowmap_pars_vertex>
|
|
2440
|
+
#include <logdepthbuf_pars_vertex>
|
|
2441
|
+
#include <clipping_planes_pars_vertex>
|
|
2442
|
+
void main() {
|
|
2443
|
+
#include <uv_vertex>
|
|
2444
|
+
#include <uv2_vertex>
|
|
2445
|
+
#include <color_vertex>
|
|
2446
|
+
#include <morphcolor_vertex>
|
|
2447
|
+
#include <beginnormal_vertex>
|
|
2448
|
+
#include <morphnormal_vertex>
|
|
2449
|
+
#include <skinbase_vertex>
|
|
2450
|
+
#include <skinnormal_vertex>
|
|
2451
|
+
#include <defaultnormal_vertex>
|
|
2452
|
+
#include <normal_vertex>
|
|
2453
|
+
#include <begin_vertex>
|
|
2454
|
+
#include <morphtarget_vertex>
|
|
2455
|
+
#include <skinning_vertex>
|
|
2456
|
+
#include <displacementmap_vertex>
|
|
2457
|
+
#include <project_vertex>
|
|
2458
|
+
#include <logdepthbuf_vertex>
|
|
2459
|
+
#include <clipping_planes_vertex>
|
|
2460
|
+
vViewPosition = - mvPosition.xyz;
|
|
2461
|
+
#include <worldpos_vertex>
|
|
2462
|
+
#include <shadowmap_vertex>
|
|
2463
|
+
#include <fog_vertex>
|
|
2464
|
+
#ifdef USE_TRANSMISSION
|
|
2465
|
+
vWorldPosition = worldPosition.xyz;
|
|
2466
|
+
#endif
|
|
2467
|
+
}`,VS=`#define STANDARD
|
|
2468
|
+
#ifdef PHYSICAL
|
|
2469
|
+
#define IOR
|
|
2470
|
+
#define SPECULAR
|
|
2471
|
+
#endif
|
|
2472
|
+
uniform vec3 diffuse;
|
|
2473
|
+
uniform vec3 emissive;
|
|
2474
|
+
uniform float roughness;
|
|
2475
|
+
uniform float metalness;
|
|
2476
|
+
uniform float opacity;
|
|
2477
|
+
#ifdef IOR
|
|
2478
|
+
uniform float ior;
|
|
2479
|
+
#endif
|
|
2480
|
+
#ifdef SPECULAR
|
|
2481
|
+
uniform float specularIntensity;
|
|
2482
|
+
uniform vec3 specularColor;
|
|
2483
|
+
#ifdef USE_SPECULARINTENSITYMAP
|
|
2484
|
+
uniform sampler2D specularIntensityMap;
|
|
2485
|
+
#endif
|
|
2486
|
+
#ifdef USE_SPECULARCOLORMAP
|
|
2487
|
+
uniform sampler2D specularColorMap;
|
|
2488
|
+
#endif
|
|
2489
|
+
#endif
|
|
2490
|
+
#ifdef USE_CLEARCOAT
|
|
2491
|
+
uniform float clearcoat;
|
|
2492
|
+
uniform float clearcoatRoughness;
|
|
2493
|
+
#endif
|
|
2494
|
+
#ifdef USE_SHEEN
|
|
2495
|
+
uniform vec3 sheenColor;
|
|
2496
|
+
uniform float sheenRoughness;
|
|
2497
|
+
#ifdef USE_SHEENCOLORMAP
|
|
2498
|
+
uniform sampler2D sheenColorMap;
|
|
2499
|
+
#endif
|
|
2500
|
+
#ifdef USE_SHEENROUGHNESSMAP
|
|
2501
|
+
uniform sampler2D sheenRoughnessMap;
|
|
2502
|
+
#endif
|
|
2503
|
+
#endif
|
|
2504
|
+
varying vec3 vViewPosition;
|
|
2505
|
+
#include <common>
|
|
2506
|
+
#include <packing>
|
|
2507
|
+
#include <dithering_pars_fragment>
|
|
2508
|
+
#include <color_pars_fragment>
|
|
2509
|
+
#include <uv_pars_fragment>
|
|
2510
|
+
#include <uv2_pars_fragment>
|
|
2511
|
+
#include <map_pars_fragment>
|
|
2512
|
+
#include <alphamap_pars_fragment>
|
|
2513
|
+
#include <alphatest_pars_fragment>
|
|
2514
|
+
#include <aomap_pars_fragment>
|
|
2515
|
+
#include <lightmap_pars_fragment>
|
|
2516
|
+
#include <emissivemap_pars_fragment>
|
|
2517
|
+
#include <bsdfs>
|
|
2518
|
+
#include <cube_uv_reflection_fragment>
|
|
2519
|
+
#include <envmap_common_pars_fragment>
|
|
2520
|
+
#include <envmap_physical_pars_fragment>
|
|
2521
|
+
#include <fog_pars_fragment>
|
|
2522
|
+
#include <lights_pars_begin>
|
|
2523
|
+
#include <normal_pars_fragment>
|
|
2524
|
+
#include <lights_physical_pars_fragment>
|
|
2525
|
+
#include <transmission_pars_fragment>
|
|
2526
|
+
#include <shadowmap_pars_fragment>
|
|
2527
|
+
#include <bumpmap_pars_fragment>
|
|
2528
|
+
#include <normalmap_pars_fragment>
|
|
2529
|
+
#include <clearcoat_pars_fragment>
|
|
2530
|
+
#include <roughnessmap_pars_fragment>
|
|
2531
|
+
#include <metalnessmap_pars_fragment>
|
|
2532
|
+
#include <logdepthbuf_pars_fragment>
|
|
2533
|
+
#include <clipping_planes_pars_fragment>
|
|
2534
|
+
void main() {
|
|
2535
|
+
#include <clipping_planes_fragment>
|
|
2536
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2537
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2538
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2539
|
+
#include <logdepthbuf_fragment>
|
|
2540
|
+
#include <map_fragment>
|
|
2541
|
+
#include <color_fragment>
|
|
2542
|
+
#include <alphamap_fragment>
|
|
2543
|
+
#include <alphatest_fragment>
|
|
2544
|
+
#include <roughnessmap_fragment>
|
|
2545
|
+
#include <metalnessmap_fragment>
|
|
2546
|
+
#include <normal_fragment_begin>
|
|
2547
|
+
#include <normal_fragment_maps>
|
|
2548
|
+
#include <clearcoat_normal_fragment_begin>
|
|
2549
|
+
#include <clearcoat_normal_fragment_maps>
|
|
2550
|
+
#include <emissivemap_fragment>
|
|
2551
|
+
#include <lights_physical_fragment>
|
|
2552
|
+
#include <lights_fragment_begin>
|
|
2553
|
+
#include <lights_fragment_maps>
|
|
2554
|
+
#include <lights_fragment_end>
|
|
2555
|
+
#include <aomap_fragment>
|
|
2556
|
+
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
|
2557
|
+
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
|
2558
|
+
#include <transmission_fragment>
|
|
2559
|
+
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
|
2560
|
+
#ifdef USE_SHEEN
|
|
2561
|
+
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
|
2562
|
+
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
|
|
2563
|
+
#endif
|
|
2564
|
+
#ifdef USE_CLEARCOAT
|
|
2565
|
+
float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
|
|
2566
|
+
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
|
2567
|
+
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
|
|
2568
|
+
#endif
|
|
2569
|
+
#include <output_fragment>
|
|
2570
|
+
#include <tonemapping_fragment>
|
|
2571
|
+
#include <encodings_fragment>
|
|
2572
|
+
#include <fog_fragment>
|
|
2573
|
+
#include <premultiplied_alpha_fragment>
|
|
2574
|
+
#include <dithering_fragment>
|
|
2575
|
+
}`,WS=`#define TOON
|
|
2576
|
+
varying vec3 vViewPosition;
|
|
2577
|
+
#include <common>
|
|
2578
|
+
#include <uv_pars_vertex>
|
|
2579
|
+
#include <uv2_pars_vertex>
|
|
2580
|
+
#include <displacementmap_pars_vertex>
|
|
2581
|
+
#include <color_pars_vertex>
|
|
2582
|
+
#include <fog_pars_vertex>
|
|
2583
|
+
#include <normal_pars_vertex>
|
|
2584
|
+
#include <morphtarget_pars_vertex>
|
|
2585
|
+
#include <skinning_pars_vertex>
|
|
2586
|
+
#include <shadowmap_pars_vertex>
|
|
2587
|
+
#include <logdepthbuf_pars_vertex>
|
|
2588
|
+
#include <clipping_planes_pars_vertex>
|
|
2589
|
+
void main() {
|
|
2590
|
+
#include <uv_vertex>
|
|
2591
|
+
#include <uv2_vertex>
|
|
2592
|
+
#include <color_vertex>
|
|
2593
|
+
#include <morphcolor_vertex>
|
|
2594
|
+
#include <beginnormal_vertex>
|
|
2595
|
+
#include <morphnormal_vertex>
|
|
2596
|
+
#include <skinbase_vertex>
|
|
2597
|
+
#include <skinnormal_vertex>
|
|
2598
|
+
#include <defaultnormal_vertex>
|
|
2599
|
+
#include <normal_vertex>
|
|
2600
|
+
#include <begin_vertex>
|
|
2601
|
+
#include <morphtarget_vertex>
|
|
2602
|
+
#include <skinning_vertex>
|
|
2603
|
+
#include <displacementmap_vertex>
|
|
2604
|
+
#include <project_vertex>
|
|
2605
|
+
#include <logdepthbuf_vertex>
|
|
2606
|
+
#include <clipping_planes_vertex>
|
|
2607
|
+
vViewPosition = - mvPosition.xyz;
|
|
2608
|
+
#include <worldpos_vertex>
|
|
2609
|
+
#include <shadowmap_vertex>
|
|
2610
|
+
#include <fog_vertex>
|
|
2611
|
+
}`,qS=`#define TOON
|
|
2612
|
+
uniform vec3 diffuse;
|
|
2613
|
+
uniform vec3 emissive;
|
|
2614
|
+
uniform float opacity;
|
|
2615
|
+
#include <common>
|
|
2616
|
+
#include <packing>
|
|
2617
|
+
#include <dithering_pars_fragment>
|
|
2618
|
+
#include <color_pars_fragment>
|
|
2619
|
+
#include <uv_pars_fragment>
|
|
2620
|
+
#include <uv2_pars_fragment>
|
|
2621
|
+
#include <map_pars_fragment>
|
|
2622
|
+
#include <alphamap_pars_fragment>
|
|
2623
|
+
#include <alphatest_pars_fragment>
|
|
2624
|
+
#include <aomap_pars_fragment>
|
|
2625
|
+
#include <lightmap_pars_fragment>
|
|
2626
|
+
#include <emissivemap_pars_fragment>
|
|
2627
|
+
#include <gradientmap_pars_fragment>
|
|
2628
|
+
#include <fog_pars_fragment>
|
|
2629
|
+
#include <bsdfs>
|
|
2630
|
+
#include <lights_pars_begin>
|
|
2631
|
+
#include <normal_pars_fragment>
|
|
2632
|
+
#include <lights_toon_pars_fragment>
|
|
2633
|
+
#include <shadowmap_pars_fragment>
|
|
2634
|
+
#include <bumpmap_pars_fragment>
|
|
2635
|
+
#include <normalmap_pars_fragment>
|
|
2636
|
+
#include <logdepthbuf_pars_fragment>
|
|
2637
|
+
#include <clipping_planes_pars_fragment>
|
|
2638
|
+
void main() {
|
|
2639
|
+
#include <clipping_planes_fragment>
|
|
2640
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2641
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2642
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2643
|
+
#include <logdepthbuf_fragment>
|
|
2644
|
+
#include <map_fragment>
|
|
2645
|
+
#include <color_fragment>
|
|
2646
|
+
#include <alphamap_fragment>
|
|
2647
|
+
#include <alphatest_fragment>
|
|
2648
|
+
#include <normal_fragment_begin>
|
|
2649
|
+
#include <normal_fragment_maps>
|
|
2650
|
+
#include <emissivemap_fragment>
|
|
2651
|
+
#include <lights_toon_fragment>
|
|
2652
|
+
#include <lights_fragment_begin>
|
|
2653
|
+
#include <lights_fragment_maps>
|
|
2654
|
+
#include <lights_fragment_end>
|
|
2655
|
+
#include <aomap_fragment>
|
|
2656
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2657
|
+
#include <output_fragment>
|
|
2658
|
+
#include <tonemapping_fragment>
|
|
2659
|
+
#include <encodings_fragment>
|
|
2660
|
+
#include <fog_fragment>
|
|
2661
|
+
#include <premultiplied_alpha_fragment>
|
|
2662
|
+
#include <dithering_fragment>
|
|
2663
|
+
}`,XS=`uniform float size;
|
|
2664
|
+
uniform float scale;
|
|
2665
|
+
#include <common>
|
|
2666
|
+
#include <color_pars_vertex>
|
|
2667
|
+
#include <fog_pars_vertex>
|
|
2668
|
+
#include <morphtarget_pars_vertex>
|
|
2669
|
+
#include <logdepthbuf_pars_vertex>
|
|
2670
|
+
#include <clipping_planes_pars_vertex>
|
|
2671
|
+
void main() {
|
|
2672
|
+
#include <color_vertex>
|
|
2673
|
+
#include <morphcolor_vertex>
|
|
2674
|
+
#include <begin_vertex>
|
|
2675
|
+
#include <morphtarget_vertex>
|
|
2676
|
+
#include <project_vertex>
|
|
2677
|
+
gl_PointSize = size;
|
|
2678
|
+
#ifdef USE_SIZEATTENUATION
|
|
2679
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
2680
|
+
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|
2681
|
+
#endif
|
|
2682
|
+
#include <logdepthbuf_vertex>
|
|
2683
|
+
#include <clipping_planes_vertex>
|
|
2684
|
+
#include <worldpos_vertex>
|
|
2685
|
+
#include <fog_vertex>
|
|
2686
|
+
}`,jS=`uniform vec3 diffuse;
|
|
2687
|
+
uniform float opacity;
|
|
2688
|
+
#include <common>
|
|
2689
|
+
#include <color_pars_fragment>
|
|
2690
|
+
#include <map_particle_pars_fragment>
|
|
2691
|
+
#include <alphatest_pars_fragment>
|
|
2692
|
+
#include <fog_pars_fragment>
|
|
2693
|
+
#include <logdepthbuf_pars_fragment>
|
|
2694
|
+
#include <clipping_planes_pars_fragment>
|
|
2695
|
+
void main() {
|
|
2696
|
+
#include <clipping_planes_fragment>
|
|
2697
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
2698
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2699
|
+
#include <logdepthbuf_fragment>
|
|
2700
|
+
#include <map_particle_fragment>
|
|
2701
|
+
#include <color_fragment>
|
|
2702
|
+
#include <alphatest_fragment>
|
|
2703
|
+
outgoingLight = diffuseColor.rgb;
|
|
2704
|
+
#include <output_fragment>
|
|
2705
|
+
#include <tonemapping_fragment>
|
|
2706
|
+
#include <encodings_fragment>
|
|
2707
|
+
#include <fog_fragment>
|
|
2708
|
+
#include <premultiplied_alpha_fragment>
|
|
2709
|
+
}`,YS=`#include <common>
|
|
2710
|
+
#include <fog_pars_vertex>
|
|
2711
|
+
#include <morphtarget_pars_vertex>
|
|
2712
|
+
#include <skinning_pars_vertex>
|
|
2713
|
+
#include <shadowmap_pars_vertex>
|
|
2714
|
+
void main() {
|
|
2715
|
+
#include <beginnormal_vertex>
|
|
2716
|
+
#include <morphnormal_vertex>
|
|
2717
|
+
#include <skinbase_vertex>
|
|
2718
|
+
#include <skinnormal_vertex>
|
|
2719
|
+
#include <defaultnormal_vertex>
|
|
2720
|
+
#include <begin_vertex>
|
|
2721
|
+
#include <morphtarget_vertex>
|
|
2722
|
+
#include <skinning_vertex>
|
|
2723
|
+
#include <project_vertex>
|
|
2724
|
+
#include <worldpos_vertex>
|
|
2725
|
+
#include <shadowmap_vertex>
|
|
2726
|
+
#include <fog_vertex>
|
|
2727
|
+
}`,JS=`uniform vec3 color;
|
|
2728
|
+
uniform float opacity;
|
|
2729
|
+
#include <common>
|
|
2730
|
+
#include <packing>
|
|
2731
|
+
#include <fog_pars_fragment>
|
|
2732
|
+
#include <bsdfs>
|
|
2733
|
+
#include <lights_pars_begin>
|
|
2734
|
+
#include <shadowmap_pars_fragment>
|
|
2735
|
+
#include <shadowmask_pars_fragment>
|
|
2736
|
+
void main() {
|
|
2737
|
+
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|
2738
|
+
#include <tonemapping_fragment>
|
|
2739
|
+
#include <encodings_fragment>
|
|
2740
|
+
#include <fog_fragment>
|
|
2741
|
+
}`,ZS=`uniform float rotation;
|
|
2742
|
+
uniform vec2 center;
|
|
2743
|
+
#include <common>
|
|
2744
|
+
#include <uv_pars_vertex>
|
|
2745
|
+
#include <fog_pars_vertex>
|
|
2746
|
+
#include <logdepthbuf_pars_vertex>
|
|
2747
|
+
#include <clipping_planes_pars_vertex>
|
|
2748
|
+
void main() {
|
|
2749
|
+
#include <uv_vertex>
|
|
2750
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2751
|
+
vec2 scale;
|
|
2752
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
2753
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
2754
|
+
#ifndef USE_SIZEATTENUATION
|
|
2755
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
2756
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
2757
|
+
#endif
|
|
2758
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
2759
|
+
vec2 rotatedPosition;
|
|
2760
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
2761
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
2762
|
+
mvPosition.xy += rotatedPosition;
|
|
2763
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
2764
|
+
#include <logdepthbuf_vertex>
|
|
2765
|
+
#include <clipping_planes_vertex>
|
|
2766
|
+
#include <fog_vertex>
|
|
2767
|
+
}`,KS=`uniform vec3 diffuse;
|
|
2768
|
+
uniform float opacity;
|
|
2769
|
+
#include <common>
|
|
2770
|
+
#include <uv_pars_fragment>
|
|
2771
|
+
#include <map_pars_fragment>
|
|
2772
|
+
#include <alphamap_pars_fragment>
|
|
2773
|
+
#include <alphatest_pars_fragment>
|
|
2774
|
+
#include <fog_pars_fragment>
|
|
2775
|
+
#include <logdepthbuf_pars_fragment>
|
|
2776
|
+
#include <clipping_planes_pars_fragment>
|
|
2777
|
+
void main() {
|
|
2778
|
+
#include <clipping_planes_fragment>
|
|
2779
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
2780
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2781
|
+
#include <logdepthbuf_fragment>
|
|
2782
|
+
#include <map_fragment>
|
|
2783
|
+
#include <alphamap_fragment>
|
|
2784
|
+
#include <alphatest_fragment>
|
|
2785
|
+
outgoingLight = diffuseColor.rgb;
|
|
2786
|
+
#include <output_fragment>
|
|
2787
|
+
#include <tonemapping_fragment>
|
|
2788
|
+
#include <encodings_fragment>
|
|
2789
|
+
#include <fog_fragment>
|
|
2790
|
+
}`,ct={alphamap_fragment:Ew,alphamap_pars_fragment:Tw,alphatest_fragment:Aw,alphatest_pars_fragment:Cw,aomap_fragment:Rw,aomap_pars_fragment:Pw,begin_vertex:Lw,beginnormal_vertex:Dw,bsdfs:Iw,bumpmap_pars_fragment:zw,clipping_planes_fragment:Nw,clipping_planes_pars_fragment:Fw,clipping_planes_pars_vertex:Ow,clipping_planes_vertex:Bw,color_fragment:Uw,color_pars_fragment:kw,color_pars_vertex:Hw,color_vertex:Gw,common:Vw,cube_uv_reflection_fragment:Ww,defaultnormal_vertex:qw,displacementmap_pars_vertex:Xw,displacementmap_vertex:jw,emissivemap_fragment:Yw,emissivemap_pars_fragment:Jw,encodings_fragment:Zw,encodings_pars_fragment:Kw,envmap_fragment:Qw,envmap_common_pars_fragment:$w,envmap_pars_fragment:eM,envmap_pars_vertex:tM,envmap_physical_pars_fragment:fM,envmap_vertex:nM,fog_vertex:iM,fog_pars_vertex:rM,fog_fragment:sM,fog_pars_fragment:oM,gradientmap_pars_fragment:aM,lightmap_fragment:lM,lightmap_pars_fragment:cM,lights_lambert_vertex:uM,lights_pars_begin:hM,lights_toon_fragment:dM,lights_toon_pars_fragment:pM,lights_phong_fragment:mM,lights_phong_pars_fragment:gM,lights_physical_fragment:yM,lights_physical_pars_fragment:xM,lights_fragment_begin:vM,lights_fragment_maps:_M,lights_fragment_end:wM,logdepthbuf_fragment:MM,logdepthbuf_pars_fragment:SM,logdepthbuf_pars_vertex:bM,logdepthbuf_vertex:EM,map_fragment:TM,map_pars_fragment:AM,map_particle_fragment:CM,map_particle_pars_fragment:RM,metalnessmap_fragment:PM,metalnessmap_pars_fragment:LM,morphcolor_vertex:DM,morphnormal_vertex:IM,morphtarget_pars_vertex:zM,morphtarget_vertex:NM,normal_fragment_begin:FM,normal_fragment_maps:OM,normal_pars_fragment:BM,normal_pars_vertex:UM,normal_vertex:kM,normalmap_pars_fragment:HM,clearcoat_normal_fragment_begin:GM,clearcoat_normal_fragment_maps:VM,clearcoat_pars_fragment:WM,output_fragment:qM,packing:XM,premultiplied_alpha_fragment:jM,project_vertex:YM,dithering_fragment:JM,dithering_pars_fragment:ZM,roughnessmap_fragment:KM,roughnessmap_pars_fragment:QM,shadowmap_pars_fragment:$M,shadowmap_pars_vertex:eS,shadowmap_vertex:tS,shadowmask_pars_fragment:nS,skinbase_vertex:iS,skinning_pars_vertex:rS,skinning_vertex:sS,skinnormal_vertex:oS,specularmap_fragment:aS,specularmap_pars_fragment:lS,tonemapping_fragment:cS,tonemapping_pars_fragment:uS,transmission_fragment:hS,transmission_pars_fragment:fS,uv_pars_fragment:dS,uv_pars_vertex:pS,uv_vertex:mS,uv2_pars_fragment:gS,uv2_pars_vertex:yS,uv2_vertex:xS,worldpos_vertex:vS,background_vert:_S,background_frag:wS,cube_vert:MS,cube_frag:SS,depth_vert:bS,depth_frag:ES,distanceRGBA_vert:TS,distanceRGBA_frag:AS,equirect_vert:CS,equirect_frag:RS,linedashed_vert:PS,linedashed_frag:LS,meshbasic_vert:DS,meshbasic_frag:IS,meshlambert_vert:zS,meshlambert_frag:NS,meshmatcap_vert:FS,meshmatcap_frag:OS,meshnormal_vert:BS,meshnormal_frag:US,meshphong_vert:kS,meshphong_frag:HS,meshphysical_vert:GS,meshphysical_frag:VS,meshtoon_vert:WS,meshtoon_frag:qS,points_vert:XS,points_frag:jS,shadow_vert:YS,shadow_frag:JS,sprite_vert:ZS,sprite_frag:KS},Se={common:{diffuse:{value:new Ae(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new tn},uv2Transform:{value:new tn},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ae(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ae(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new tn}},sprite:{diffuse:{value:new Ae(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new tn}}},ui={basic:{uniforms:mn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.fog]),vertexShader:ct.meshbasic_vert,fragmentShader:ct.meshbasic_frag},lambert:{uniforms:mn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.fog,Se.lights,{emissive:{value:new Ae(0)}}]),vertexShader:ct.meshlambert_vert,fragmentShader:ct.meshlambert_frag},phong:{uniforms:mn([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new Ae(0)},specular:{value:new Ae(1118481)},shininess:{value:30}}]),vertexShader:ct.meshphong_vert,fragmentShader:ct.meshphong_frag},standard:{uniforms:mn([Se.common,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.roughnessmap,Se.metalnessmap,Se.fog,Se.lights,{emissive:{value:new Ae(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ct.meshphysical_vert,fragmentShader:ct.meshphysical_frag},toon:{uniforms:mn([Se.common,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.gradientmap,Se.fog,Se.lights,{emissive:{value:new Ae(0)}}]),vertexShader:ct.meshtoon_vert,fragmentShader:ct.meshtoon_frag},matcap:{uniforms:mn([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,{matcap:{value:null}}]),vertexShader:ct.meshmatcap_vert,fragmentShader:ct.meshmatcap_frag},points:{uniforms:mn([Se.points,Se.fog]),vertexShader:ct.points_vert,fragmentShader:ct.points_frag},dashed:{uniforms:mn([Se.common,Se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ct.linedashed_vert,fragmentShader:ct.linedashed_frag},depth:{uniforms:mn([Se.common,Se.displacementmap]),vertexShader:ct.depth_vert,fragmentShader:ct.depth_frag},normal:{uniforms:mn([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,{opacity:{value:1}}]),vertexShader:ct.meshnormal_vert,fragmentShader:ct.meshnormal_frag},sprite:{uniforms:mn([Se.sprite,Se.fog]),vertexShader:ct.sprite_vert,fragmentShader:ct.sprite_frag},background:{uniforms:{uvTransform:{value:new tn},t2D:{value:null}},vertexShader:ct.background_vert,fragmentShader:ct.background_frag},cube:{uniforms:mn([Se.envmap,{opacity:{value:1}}]),vertexShader:ct.cube_vert,fragmentShader:ct.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ct.equirect_vert,fragmentShader:ct.equirect_frag},distanceRGBA:{uniforms:mn([Se.common,Se.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ct.distanceRGBA_vert,fragmentShader:ct.distanceRGBA_frag},shadow:{uniforms:mn([Se.lights,Se.fog,{color:{value:new Ae(0)},opacity:{value:1}}]),vertexShader:ct.shadow_vert,fragmentShader:ct.shadow_frag}};ui.physical={uniforms:mn([ui.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new ue(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Ae(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Ae(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Ae(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ct.meshphysical_vert,fragmentShader:ct.meshphysical_frag};function QS(r,e,t,n,i,s){const a=new Ae(0);let l=i===!0?0:1,u,f,p=null,g=0,d=null;function m(y,v){let M=!1,S=v.isScene===!0?v.background:null;S&&S.isTexture&&(S=e.get(S));const T=r.xr,b=T.getSession&&T.getSession();b&&b.environmentBlendMode==="additive"&&(S=null),S===null?x(a,l):S&&S.isColor&&(x(S,1),M=!0),(r.autoClear||M)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),S&&(S.isCubeTexture||S.mapping===Eo)?(f===void 0&&(f=new Kt(new Ji(1,1,1),new Qn({name:"BackgroundCubeMaterial",uniforms:ho(ui.cube.uniforms),vertexShader:ui.cube.vertexShader,fragmentShader:ui.cube.fragmentShader,side:Fn,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(A,L,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(f)),f.material.uniforms.envMap.value=S,f.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,(p!==S||g!==S.version||d!==r.toneMapping)&&(f.material.needsUpdate=!0,p=S,g=S.version,d=r.toneMapping),y.unshift(f,f.geometry,f.material,0,0,null)):S&&S.isTexture&&(u===void 0&&(u=new Kt(new fs(2,2),new Qn({name:"BackgroundMaterial",uniforms:ho(ui.background.uniforms),vertexShader:ui.background.vertexShader,fragmentShader:ui.background.fragmentShader,side:ls,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(u)),u.material.uniforms.t2D.value=S,S.matrixAutoUpdate===!0&&S.updateMatrix(),u.material.uniforms.uvTransform.value.copy(S.matrix),(p!==S||g!==S.version||d!==r.toneMapping)&&(u.material.needsUpdate=!0,p=S,g=S.version,d=r.toneMapping),y.unshift(u,u.geometry,u.material,0,0,null))}function x(y,v){t.buffers.color.setClear(y.r,y.g,y.b,v,s)}return{getClearColor:function(){return a},setClearColor:function(y,v=1){a.set(y),l=v,x(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,x(a,l)},render:m}}function $S(r,e,t,n){const i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||s!==null,l={},u=v(null);let f=u,p=!1;function g(W,Y,X,ee,V){let re=!1;if(a){const K=y(ee,X,Y);f!==K&&(f=K,m(f.object)),re=M(ee,V),re&&S(ee,V)}else{const K=Y.wireframe===!0;(f.geometry!==ee.id||f.program!==X.id||f.wireframe!==K)&&(f.geometry=ee.id,f.program=X.id,f.wireframe=K,re=!0)}W.isInstancedMesh===!0&&(re=!0),V!==null&&t.update(V,34963),(re||p)&&(p=!1,N(W,Y,X,ee),V!==null&&r.bindBuffer(34963,t.get(V).buffer))}function d(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function m(W){return n.isWebGL2?r.bindVertexArray(W):s.bindVertexArrayOES(W)}function x(W){return n.isWebGL2?r.deleteVertexArray(W):s.deleteVertexArrayOES(W)}function y(W,Y,X){const ee=X.wireframe===!0;let V=l[W.id];V===void 0&&(V={},l[W.id]=V);let re=V[Y.id];re===void 0&&(re={},V[Y.id]=re);let K=re[ee];return K===void 0&&(K=v(d()),re[ee]=K),K}function v(W){const Y=[],X=[],ee=[];for(let V=0;V<i;V++)Y[V]=0,X[V]=0,ee[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:Y,enabledAttributes:X,attributeDivisors:ee,object:W,attributes:{},index:null}}function M(W,Y){const X=f.attributes,ee=W.attributes;let V=0;for(const re in ee){const K=X[re],pe=ee[re];if(K===void 0||K.attribute!==pe||K.data!==pe.data)return!0;V++}return f.attributesNum!==V||f.index!==Y}function S(W,Y){const X={},ee=W.attributes;let V=0;for(const re in ee){const K=ee[re],pe={};pe.attribute=K,K.data&&(pe.data=K.data),X[re]=pe,V++}f.attributes=X,f.attributesNum=V,f.index=Y}function T(){const W=f.newAttributes;for(let Y=0,X=W.length;Y<X;Y++)W[Y]=0}function b(W){A(W,0)}function A(W,Y){const X=f.newAttributes,ee=f.enabledAttributes,V=f.attributeDivisors;X[W]=1,ee[W]===0&&(r.enableVertexAttribArray(W),ee[W]=1),V[W]!==Y&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](W,Y),V[W]=Y)}function L(){const W=f.newAttributes,Y=f.enabledAttributes;for(let X=0,ee=Y.length;X<ee;X++)Y[X]!==W[X]&&(r.disableVertexAttribArray(X),Y[X]=0)}function D(W,Y,X,ee,V,re){n.isWebGL2===!0&&(X===5124||X===5125)?r.vertexAttribIPointer(W,Y,X,V,re):r.vertexAttribPointer(W,Y,X,ee,V,re)}function N(W,Y,X,ee){if(n.isWebGL2===!1&&(W.isInstancedMesh||ee.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;T();const V=ee.attributes,re=X.getAttributes(),K=Y.defaultAttributeValues;for(const pe in re){const he=re[pe];if(he.location>=0){let Ce=V[pe];if(Ce===void 0&&(pe==="instanceMatrix"&&W.instanceMatrix&&(Ce=W.instanceMatrix),pe==="instanceColor"&&W.instanceColor&&(Ce=W.instanceColor)),Ce!==void 0){const Ue=Ce.normalized,Be=Ce.itemSize,oe=t.get(Ce);if(oe===void 0)continue;const ot=oe.buffer,qe=oe.type,je=oe.bytesPerElement;if(Ce.isInterleavedBufferAttribute){const xe=Ce.data,tt=xe.stride,ae=Ce.offset;if(xe.isInstancedInterleavedBuffer){for(let ce=0;ce<he.locationSize;ce++)A(he.location+ce,xe.meshPerAttribute);W.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=xe.meshPerAttribute*xe.count)}else for(let ce=0;ce<he.locationSize;ce++)b(he.location+ce);r.bindBuffer(34962,ot);for(let ce=0;ce<he.locationSize;ce++)D(he.location+ce,Be/he.locationSize,qe,Ue,tt*je,(ae+Be/he.locationSize*ce)*je)}else{if(Ce.isInstancedBufferAttribute){for(let xe=0;xe<he.locationSize;xe++)A(he.location+xe,Ce.meshPerAttribute);W.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=Ce.meshPerAttribute*Ce.count)}else for(let xe=0;xe<he.locationSize;xe++)b(he.location+xe);r.bindBuffer(34962,ot);for(let xe=0;xe<he.locationSize;xe++)D(he.location+xe,Be/he.locationSize,qe,Ue,Be*je,Be/he.locationSize*xe*je)}}else if(K!==void 0){const Ue=K[pe];if(Ue!==void 0)switch(Ue.length){case 2:r.vertexAttrib2fv(he.location,Ue);break;case 3:r.vertexAttrib3fv(he.location,Ue);break;case 4:r.vertexAttrib4fv(he.location,Ue);break;default:r.vertexAttrib1fv(he.location,Ue)}}}}L()}function q(){z();for(const W in l){const Y=l[W];for(const X in Y){const ee=Y[X];for(const V in ee)x(ee[V].object),delete ee[V];delete Y[X]}delete l[W]}}function B(W){if(l[W.id]===void 0)return;const Y=l[W.id];for(const X in Y){const ee=Y[X];for(const V in ee)x(ee[V].object),delete ee[V];delete Y[X]}delete l[W.id]}function C(W){for(const Y in l){const X=l[Y];if(X[W.id]===void 0)continue;const ee=X[W.id];for(const V in ee)x(ee[V].object),delete ee[V];delete X[W.id]}}function z(){J(),p=!0,f!==u&&(f=u,m(f.object))}function J(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:g,reset:z,resetDefaultState:J,dispose:q,releaseStatesOfGeometry:B,releaseStatesOfProgram:C,initAttributes:T,enableAttribute:b,disableUnusedAttributes:L}}function e1(r,e,t,n){const i=n.isWebGL2;let s;function a(f){s=f}function l(f,p){r.drawArrays(s,f,p),t.update(p,s,1)}function u(f,p,g){if(g===0)return;let d,m;if(i)d=r,m="drawArraysInstanced";else if(d=e.get("ANGLE_instanced_arrays"),m="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[m](s,f,p,g),t.update(p,s,g)}this.setMode=a,this.render=l,this.renderInstances=u}function t1(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const D=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(D){if(D==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";D="mediump"}return D==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&r instanceof WebGL2ComputeRenderingContext;let l=t.precision!==void 0?t.precision:"highp";const u=s(l);u!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",u,"instead."),l=u);const f=a||e.has("WEBGL_draw_buffers"),p=t.logarithmicDepthBuffer===!0,g=r.getParameter(34930),d=r.getParameter(35660),m=r.getParameter(3379),x=r.getParameter(34076),y=r.getParameter(34921),v=r.getParameter(36347),M=r.getParameter(36348),S=r.getParameter(36349),T=d>0,b=a||e.has("OES_texture_float"),A=T&&b,L=a?r.getParameter(36183):0;return{isWebGL2:a,drawBuffers:f,getMaxAnisotropy:i,getMaxPrecision:s,precision:l,logarithmicDepthBuffer:p,maxTextures:g,maxVertexTextures:d,maxTextureSize:m,maxCubemapSize:x,maxAttributes:y,maxVertexUniforms:v,maxVaryings:M,maxFragmentUniforms:S,vertexTextures:T,floatFragmentTextures:b,floatVertexTextures:A,maxSamples:L}}function n1(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new ci,l=new tn,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(g,d,m){const x=g.length!==0||d||n!==0||i;return i=d,t=p(g,m,0),n=g.length,x},this.beginShadows=function(){s=!0,p(null)},this.endShadows=function(){s=!1,f()},this.setState=function(g,d,m){const x=g.clippingPlanes,y=g.clipIntersection,v=g.clipShadows,M=r.get(g);if(!i||x===null||x.length===0||s&&!v)s?p(null):f();else{const S=s?0:n,T=S*4;let b=M.clippingState||null;u.value=b,b=p(x,d,T,m);for(let A=0;A!==T;++A)b[A]=t[A];M.clippingState=b,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=S}};function f(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,d,m,x){const y=g!==null?g.length:0;let v=null;if(y!==0){if(v=u.value,x!==!0||v===null){const M=m+y*4,S=d.matrixWorldInverse;l.getNormalMatrix(S),(v===null||v.length<M)&&(v=new Float32Array(M));for(let T=0,b=m;T!==y;++T,b+=4)a.copy(g[T]).applyMatrix4(S,l),a.normal.toArray(v,b),v[b+3]=a.constant}u.value=v,u.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,v}}function i1(r){let e=new WeakMap;function t(a,l){return l===ma?a.mapping=Sr:l===ga&&(a.mapping=br),a}function n(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const l=a.mapping;if(l===ma||l===ga)if(e.has(a)){const u=e.get(a).texture;return t(u,a.mapping)}else{const u=a.image;if(u&&u.height>0){const f=new Jc(u.height/2);return f.fromEquirectangularTexture(r,a),e.set(a,f),a.addEventListener("dispose",i),t(f.texture,a.mapping)}else return null}}return a}function i(a){const l=a.target;l.removeEventListener("dispose",i);const u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class fi extends hs{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,l=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const f=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=f*this.view.offsetX,a=s+f*this.view.width,l-=p*this.view.offsetY,u=l-p*this.view.height}this.projectionMatrix.makeOrthographic(s,a,l,u,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}fi.prototype.isOrthographicCamera=!0;const oo=4,Dm=[.125,.215,.35,.446,.526,.582],Zr=20,Fh=new fi,Im=new Ae;let Oh=null;const Yr=(1+Math.sqrt(5))/2,Qs=1/Yr,zm=[new R(1,1,1),new R(-1,1,1),new R(1,1,-1),new R(-1,1,-1),new R(0,Yr,Qs),new R(0,Yr,-Qs),new R(Qs,0,Yr),new R(-Qs,0,Yr),new R(Yr,Qs,0),new R(-Yr,Qs,0)];class Pf{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Oh=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Om(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Fm(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Oh),e.scissorTest=!1,tc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Sr||e.mapping===br?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Oh=this._renderer.getRenderTarget();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize-32,n={magFilter:Gt,minFilter:Gt,generateMipmaps:!1,type:ns,format:Nn,encoding:Kn,depthBuffer:!1},i=Nm(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Nm(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=r1(s)),this._blurMaterial=s1(s,e,t)}return i}_compileMaterial(e){const t=new Kt(this._lodPlanes[0],e);this._renderer.compile(t,Fh)}_sceneToCubeUV(e,t,n,i){const l=new It(90,1,t,n),u=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],p=this._renderer,g=p.autoClear,d=p.toneMapping;p.getClearColor(Im),p.toneMapping=hi,p.autoClear=!1;const m=new $i({name:"PMREM.Background",side:Fn,depthWrite:!1,depthTest:!1}),x=new Kt(new Ji,m);let y=!1;const v=e.background;v?v.isColor&&(m.color.copy(v),e.background=null,y=!0):(m.color.copy(Im),y=!0);for(let M=0;M<6;M++){const S=M%3;S===0?(l.up.set(0,u[M],0),l.lookAt(f[M],0,0)):S===1?(l.up.set(0,0,u[M]),l.lookAt(0,f[M],0)):(l.up.set(0,u[M],0),l.lookAt(0,0,f[M]));const T=this._cubeSize;tc(i,S*T,M>2?T:0,T,T),p.setRenderTarget(i),y&&p.render(x,l),p.render(e,l)}x.geometry.dispose(),x.material.dispose(),p.toneMapping=d,p.autoClear=g,e.background=v}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Sr||e.mapping===br;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Om()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Fm());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new Kt(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const u=this._cubeSize;tc(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,Fh)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const s=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=zm[(i-1)%zm.length];this._blur(e,i-1,i,s,a)}t.autoClear=n}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,l){const u=this._renderer,f=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const p=3,g=new Kt(this._lodPlanes[i],f),d=f.uniforms,m=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*Zr-1),y=s/x,v=isFinite(s)?1+Math.floor(p*y):Zr;v>Zr&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Zr}`);const M=[];let S=0;for(let D=0;D<Zr;++D){const N=D/y,q=Math.exp(-N*N/2);M.push(q),D===0?S+=q:D<v&&(S+=2*q)}for(let D=0;D<M.length;D++)M[D]=M[D]/S;d.envMap.value=e.texture,d.samples.value=v,d.weights.value=M,d.latitudinal.value=a==="latitudinal",l&&(d.poleAxis.value=l);const{_lodMax:T}=this;d.dTheta.value=x,d.mipInt.value=T-n;const b=this._sizeLods[i],A=3*b*(i>T-oo?i-T+oo:0),L=4*(this._cubeSize-b);tc(t,A,L,3*b,2*b),u.setRenderTarget(t),u.render(g,Fh)}}function r1(r){const e=[],t=[],n=[];let i=r;const s=r-oo+1+Dm.length;for(let a=0;a<s;a++){const l=Math.pow(2,i);t.push(l);let u=1/l;a>r-oo?u=Dm[a-r+oo-1]:a===0&&(u=0),n.push(u);const f=1/(l-1),p=-f/2,g=1+f/2,d=[p,p,g,p,g,g,p,p,g,g,p,g],m=6,x=6,y=3,v=2,M=1,S=new Float32Array(y*x*m),T=new Float32Array(v*x*m),b=new Float32Array(M*x*m);for(let L=0;L<m;L++){const D=L%3*2/3-1,N=L>2?0:-1,q=[D,N,0,D+2/3,N,0,D+2/3,N+1,0,D,N,0,D+2/3,N+1,0,D,N+1,0];S.set(q,y*x*L),T.set(d,v*x*L);const B=[L,L,L,L,L,L];b.set(B,M*x*L)}const A=new Ye;A.setAttribute("position",new mt(S,y)),A.setAttribute("uv",new mt(T,v)),A.setAttribute("faceIndex",new mt(b,M)),e.push(A),i>oo&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Nm(r,e,t){const n=new Sn(r,e,t);return n.texture.mapping=Eo,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function tc(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function s1(r,e,t){const n=new Float32Array(Zr),i=new R(0,1,0);return new Qn({name:"SphericalGaussianBlur",defines:{n:Zr,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Zf(),fragmentShader:`
|
|
2791
|
+
|
|
2792
|
+
precision mediump float;
|
|
2793
|
+
precision mediump int;
|
|
2794
|
+
|
|
2795
|
+
varying vec3 vOutputDirection;
|
|
2796
|
+
|
|
2797
|
+
uniform sampler2D envMap;
|
|
2798
|
+
uniform int samples;
|
|
2799
|
+
uniform float weights[ n ];
|
|
2800
|
+
uniform bool latitudinal;
|
|
2801
|
+
uniform float dTheta;
|
|
2802
|
+
uniform float mipInt;
|
|
2803
|
+
uniform vec3 poleAxis;
|
|
2804
|
+
|
|
2805
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
2806
|
+
#include <cube_uv_reflection_fragment>
|
|
2807
|
+
|
|
2808
|
+
vec3 getSample( float theta, vec3 axis ) {
|
|
2809
|
+
|
|
2810
|
+
float cosTheta = cos( theta );
|
|
2811
|
+
// Rodrigues' axis-angle rotation
|
|
2812
|
+
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
2813
|
+
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
2814
|
+
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
2815
|
+
|
|
2816
|
+
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
2817
|
+
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
void main() {
|
|
2821
|
+
|
|
2822
|
+
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
2823
|
+
|
|
2824
|
+
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
2825
|
+
|
|
2826
|
+
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
2827
|
+
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
axis = normalize( axis );
|
|
2831
|
+
|
|
2832
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2833
|
+
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
2834
|
+
|
|
2835
|
+
for ( int i = 1; i < n; i++ ) {
|
|
2836
|
+
|
|
2837
|
+
if ( i >= samples ) {
|
|
2838
|
+
|
|
2839
|
+
break;
|
|
2840
|
+
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
float theta = dTheta * float( i );
|
|
2844
|
+
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
2845
|
+
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
2846
|
+
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
}
|
|
2850
|
+
`,blending:Yi,depthTest:!1,depthWrite:!1})}function Fm(){return new Qn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Zf(),fragmentShader:`
|
|
2851
|
+
|
|
2852
|
+
precision mediump float;
|
|
2853
|
+
precision mediump int;
|
|
2854
|
+
|
|
2855
|
+
varying vec3 vOutputDirection;
|
|
2856
|
+
|
|
2857
|
+
uniform sampler2D envMap;
|
|
2858
|
+
|
|
2859
|
+
#include <common>
|
|
2860
|
+
|
|
2861
|
+
void main() {
|
|
2862
|
+
|
|
2863
|
+
vec3 outputDirection = normalize( vOutputDirection );
|
|
2864
|
+
vec2 uv = equirectUv( outputDirection );
|
|
2865
|
+
|
|
2866
|
+
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
2867
|
+
|
|
2868
|
+
}
|
|
2869
|
+
`,blending:Yi,depthTest:!1,depthWrite:!1})}function Om(){return new Qn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Zf(),fragmentShader:`
|
|
2870
|
+
|
|
2871
|
+
precision mediump float;
|
|
2872
|
+
precision mediump int;
|
|
2873
|
+
|
|
2874
|
+
uniform float flipEnvMap;
|
|
2875
|
+
|
|
2876
|
+
varying vec3 vOutputDirection;
|
|
2877
|
+
|
|
2878
|
+
uniform samplerCube envMap;
|
|
2879
|
+
|
|
2880
|
+
void main() {
|
|
2881
|
+
|
|
2882
|
+
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
2883
|
+
|
|
2884
|
+
}
|
|
2885
|
+
`,blending:Yi,depthTest:!1,depthWrite:!1})}function Zf(){return`
|
|
2886
|
+
|
|
2887
|
+
precision mediump float;
|
|
2888
|
+
precision mediump int;
|
|
2889
|
+
|
|
2890
|
+
attribute float faceIndex;
|
|
2891
|
+
|
|
2892
|
+
varying vec3 vOutputDirection;
|
|
2893
|
+
|
|
2894
|
+
// RH coordinate system; PMREM face-indexing convention
|
|
2895
|
+
vec3 getDirection( vec2 uv, float face ) {
|
|
2896
|
+
|
|
2897
|
+
uv = 2.0 * uv - 1.0;
|
|
2898
|
+
|
|
2899
|
+
vec3 direction = vec3( uv, 1.0 );
|
|
2900
|
+
|
|
2901
|
+
if ( face == 0.0 ) {
|
|
2902
|
+
|
|
2903
|
+
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
2904
|
+
|
|
2905
|
+
} else if ( face == 1.0 ) {
|
|
2906
|
+
|
|
2907
|
+
direction = direction.xzy;
|
|
2908
|
+
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
2909
|
+
|
|
2910
|
+
} else if ( face == 2.0 ) {
|
|
2911
|
+
|
|
2912
|
+
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
2913
|
+
|
|
2914
|
+
} else if ( face == 3.0 ) {
|
|
2915
|
+
|
|
2916
|
+
direction = direction.zyx;
|
|
2917
|
+
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
2918
|
+
|
|
2919
|
+
} else if ( face == 4.0 ) {
|
|
2920
|
+
|
|
2921
|
+
direction = direction.xzy;
|
|
2922
|
+
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
2923
|
+
|
|
2924
|
+
} else if ( face == 5.0 ) {
|
|
2925
|
+
|
|
2926
|
+
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
2927
|
+
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
return direction;
|
|
2931
|
+
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
void main() {
|
|
2935
|
+
|
|
2936
|
+
vOutputDirection = getDirection( uv, faceIndex );
|
|
2937
|
+
gl_Position = vec4( position, 1.0 );
|
|
2938
|
+
|
|
2939
|
+
}
|
|
2940
|
+
`}function o1(r){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const u=l.mapping,f=u===ma||u===ga,p=u===Sr||u===br;if(f||p)if(l.isRenderTargetTexture&&l.needsPMREMUpdate===!0){l.needsPMREMUpdate=!1;let g=e.get(l);return t===null&&(t=new Pf(r)),g=f?t.fromEquirectangular(l,g):t.fromCubemap(l,g),e.set(l,g),g.texture}else{if(e.has(l))return e.get(l).texture;{const g=l.image;if(f&&g&&g.height>0||p&&g&&i(g)){t===null&&(t=new Pf(r));const d=f?t.fromEquirectangular(l):t.fromCubemap(l);return e.set(l,d),l.addEventListener("dispose",s),d.texture}else return null}}}return l}function i(l){let u=0;const f=6;for(let p=0;p<f;p++)l[p]!==void 0&&u++;return u===f}function s(l){const u=l.target;u.removeEventListener("dispose",s);const f=e.get(u);f!==void 0&&(e.delete(u),f.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function a1(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function l1(r,e,t,n){const i={},s=new WeakMap;function a(g){const d=g.target;d.index!==null&&e.remove(d.index);for(const x in d.attributes)e.remove(d.attributes[x]);d.removeEventListener("dispose",a),delete i[d.id];const m=s.get(d);m&&(e.remove(m),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function l(g,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function u(g){const d=g.attributes;for(const x in d)e.update(d[x],34962);const m=g.morphAttributes;for(const x in m){const y=m[x];for(let v=0,M=y.length;v<M;v++)e.update(y[v],34962)}}function f(g){const d=[],m=g.index,x=g.attributes.position;let y=0;if(m!==null){const S=m.array;y=m.version;for(let T=0,b=S.length;T<b;T+=3){const A=S[T+0],L=S[T+1],D=S[T+2];d.push(A,L,L,D,D,A)}}else{const S=x.array;y=x.version;for(let T=0,b=S.length/3-1;T<b;T+=3){const A=T+0,L=T+1,D=T+2;d.push(A,L,L,D,D,A)}}const v=new(iy(d)?jc:Xc)(d,1);v.version=y;const M=s.get(g);M&&e.remove(M),s.set(g,v)}function p(g){const d=s.get(g);if(d){const m=g.index;m!==null&&d.version<m.version&&f(g)}else f(g);return s.get(g)}return{get:l,update:u,getWireframeAttribute:p}}function c1(r,e,t,n){const i=n.isWebGL2;let s;function a(d){s=d}let l,u;function f(d){l=d.type,u=d.bytesPerElement}function p(d,m){r.drawElements(s,m,l,d*u),t.update(m,s,1)}function g(d,m,x){if(x===0)return;let y,v;if(i)y=r,v="drawElementsInstanced";else if(y=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[v](s,m,l,d*u,x),t.update(m,s,x)}this.setMode=a,this.setIndex=f,this.render=p,this.renderInstances=g}function u1(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,l){switch(t.calls++,a){case 4:t.triangles+=l*(s/3);break;case 1:t.lines+=l*(s/2);break;case 3:t.lines+=l*(s-1);break;case 2:t.lines+=l*s;break;case 0:t.points+=l*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function h1(r,e){return r[0]-e[0]}function f1(r,e){return Math.abs(e[1])-Math.abs(r[1])}function Bh(r,e){let t=1;const n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?t=127:n instanceof Int16Array?t=32767:n instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),r.divideScalar(t)}function d1(r,e,t){const n={},i=new Float32Array(8),s=new WeakMap,a=new wt,l=[];for(let f=0;f<8;f++)l[f]=[f,0];function u(f,p,g,d){const m=f.morphTargetInfluences;if(e.isWebGL2===!0){const x=p.morphAttributes.position||p.morphAttributes.normal||p.morphAttributes.color,y=x!==void 0?x.length:0;let v=s.get(p);if(v===void 0||v.count!==y){let Y=function(){J.dispose(),s.delete(p),p.removeEventListener("dispose",Y)};v!==void 0&&v.texture.dispose();const T=p.morphAttributes.position!==void 0,b=p.morphAttributes.normal!==void 0,A=p.morphAttributes.color!==void 0,L=p.morphAttributes.position||[],D=p.morphAttributes.normal||[],N=p.morphAttributes.color||[];let q=0;T===!0&&(q=1),b===!0&&(q=2),A===!0&&(q=3);let B=p.attributes.position.count*q,C=1;B>e.maxTextureSize&&(C=Math.ceil(B/e.maxTextureSize),B=e.maxTextureSize);const z=new Float32Array(B*C*4*y),J=new To(z,B,C,y);J.type=ji,J.needsUpdate=!0;const W=q*4;for(let X=0;X<y;X++){const ee=L[X],V=D[X],re=N[X],K=B*C*4*X;for(let pe=0;pe<ee.count;pe++){const he=pe*W;T===!0&&(a.fromBufferAttribute(ee,pe),ee.normalized===!0&&Bh(a,ee),z[K+he+0]=a.x,z[K+he+1]=a.y,z[K+he+2]=a.z,z[K+he+3]=0),b===!0&&(a.fromBufferAttribute(V,pe),V.normalized===!0&&Bh(a,V),z[K+he+4]=a.x,z[K+he+5]=a.y,z[K+he+6]=a.z,z[K+he+7]=0),A===!0&&(a.fromBufferAttribute(re,pe),re.normalized===!0&&Bh(a,re),z[K+he+8]=a.x,z[K+he+9]=a.y,z[K+he+10]=a.z,z[K+he+11]=re.itemSize===4?a.w:1)}}v={count:y,texture:J,size:new ue(B,C)},s.set(p,v),p.addEventListener("dispose",Y)}let M=0;for(let T=0;T<m.length;T++)M+=m[T];const S=p.morphTargetsRelative?1:1-M;d.getUniforms().setValue(r,"morphTargetBaseInfluence",S),d.getUniforms().setValue(r,"morphTargetInfluences",m),d.getUniforms().setValue(r,"morphTargetsTexture",v.texture,t),d.getUniforms().setValue(r,"morphTargetsTextureSize",v.size)}else{const x=m===void 0?0:m.length;let y=n[p.id];if(y===void 0||y.length!==x){y=[];for(let b=0;b<x;b++)y[b]=[b,0];n[p.id]=y}for(let b=0;b<x;b++){const A=y[b];A[0]=b,A[1]=m[b]}y.sort(f1);for(let b=0;b<8;b++)b<x&&y[b][1]?(l[b][0]=y[b][0],l[b][1]=y[b][1]):(l[b][0]=Number.MAX_SAFE_INTEGER,l[b][1]=0);l.sort(h1);const v=p.morphAttributes.position,M=p.morphAttributes.normal;let S=0;for(let b=0;b<8;b++){const A=l[b],L=A[0],D=A[1];L!==Number.MAX_SAFE_INTEGER&&D?(v&&p.getAttribute("morphTarget"+b)!==v[L]&&p.setAttribute("morphTarget"+b,v[L]),M&&p.getAttribute("morphNormal"+b)!==M[L]&&p.setAttribute("morphNormal"+b,M[L]),i[b]=D,S+=D):(v&&p.hasAttribute("morphTarget"+b)===!0&&p.deleteAttribute("morphTarget"+b),M&&p.hasAttribute("morphNormal"+b)===!0&&p.deleteAttribute("morphNormal"+b),i[b]=0)}const T=p.morphTargetsRelative?1:1-S;d.getUniforms().setValue(r,"morphTargetBaseInfluence",T),d.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:u}}function p1(r,e,t,n){let i=new WeakMap;function s(u){const f=n.render.frame,p=u.geometry,g=e.get(u,p);return i.get(g)!==f&&(e.update(g),i.set(g,f)),u.isInstancedMesh&&(u.hasEventListener("dispose",l)===!1&&u.addEventListener("dispose",l),t.update(u.instanceMatrix,34962),u.instanceColor!==null&&t.update(u.instanceColor,34962)),g}function a(){i=new WeakMap}function l(u){const f=u.target;f.removeEventListener("dispose",l),t.remove(f.instanceMatrix),f.instanceColor!==null&&t.remove(f.instanceColor)}return{update:s,dispose:a}}const yy=new Ut,xy=new To,vy=new Na,_y=new Ao,Bm=[],Um=[],km=new Float32Array(16),Hm=new Float32Array(9),Gm=new Float32Array(4);function Co(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=Bm[i];if(s===void 0&&(s=new Float32Array(i),Bm[i]=s),e!==0){n.toArray(s,0);for(let a=1,l=0;a!==e;++a)l+=t,r[a].toArray(s,l)}return s}function bn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function gn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Zc(r,e){let t=Um[e];t===void 0&&(t=new Int32Array(e),Um[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function m1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function g1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(bn(t,e))return;r.uniform2fv(this.addr,e),gn(t,e)}}function y1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(bn(t,e))return;r.uniform3fv(this.addr,e),gn(t,e)}}function x1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(bn(t,e))return;r.uniform4fv(this.addr,e),gn(t,e)}}function v1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(bn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),gn(t,e)}else{if(bn(t,n))return;Gm.set(n),r.uniformMatrix2fv(this.addr,!1,Gm),gn(t,n)}}function _1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(bn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),gn(t,e)}else{if(bn(t,n))return;Hm.set(n),r.uniformMatrix3fv(this.addr,!1,Hm),gn(t,n)}}function w1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(bn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),gn(t,e)}else{if(bn(t,n))return;km.set(n),r.uniformMatrix4fv(this.addr,!1,km),gn(t,n)}}function M1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function S1(r,e){const t=this.cache;bn(t,e)||(r.uniform2iv(this.addr,e),gn(t,e))}function b1(r,e){const t=this.cache;bn(t,e)||(r.uniform3iv(this.addr,e),gn(t,e))}function E1(r,e){const t=this.cache;bn(t,e)||(r.uniform4iv(this.addr,e),gn(t,e))}function T1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function A1(r,e){const t=this.cache;bn(t,e)||(r.uniform2uiv(this.addr,e),gn(t,e))}function C1(r,e){const t=this.cache;bn(t,e)||(r.uniform3uiv(this.addr,e),gn(t,e))}function R1(r,e){const t=this.cache;bn(t,e)||(r.uniform4uiv(this.addr,e),gn(t,e))}function P1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2D(e||yy,i)}function L1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||vy,i)}function D1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||_y,i)}function I1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||xy,i)}function z1(r){switch(r){case 5126:return m1;case 35664:return g1;case 35665:return y1;case 35666:return x1;case 35674:return v1;case 35675:return _1;case 35676:return w1;case 5124:case 35670:return M1;case 35667:case 35671:return S1;case 35668:case 35672:return b1;case 35669:case 35673:return E1;case 5125:return T1;case 36294:return A1;case 36295:return C1;case 36296:return R1;case 35678:case 36198:case 36298:case 36306:case 35682:return P1;case 35679:case 36299:case 36307:return L1;case 35680:case 36300:case 36308:case 36293:return D1;case 36289:case 36303:case 36311:case 36292:return I1}}function N1(r,e){r.uniform1fv(this.addr,e)}function F1(r,e){const t=Co(e,this.size,2);r.uniform2fv(this.addr,t)}function O1(r,e){const t=Co(e,this.size,3);r.uniform3fv(this.addr,t)}function B1(r,e){const t=Co(e,this.size,4);r.uniform4fv(this.addr,t)}function U1(r,e){const t=Co(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function k1(r,e){const t=Co(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function H1(r,e){const t=Co(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function G1(r,e){r.uniform1iv(this.addr,e)}function V1(r,e){r.uniform2iv(this.addr,e)}function W1(r,e){r.uniform3iv(this.addr,e)}function q1(r,e){r.uniform4iv(this.addr,e)}function X1(r,e){r.uniform1uiv(this.addr,e)}function j1(r,e){r.uniform2uiv(this.addr,e)}function Y1(r,e){r.uniform3uiv(this.addr,e)}function J1(r,e){r.uniform4uiv(this.addr,e)}function Z1(r,e,t){const n=e.length,i=Zc(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.setTexture2D(e[s]||yy,i[s])}function K1(r,e,t){const n=e.length,i=Zc(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.setTexture3D(e[s]||vy,i[s])}function Q1(r,e,t){const n=e.length,i=Zc(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.setTextureCube(e[s]||_y,i[s])}function $1(r,e,t){const n=e.length,i=Zc(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.setTexture2DArray(e[s]||xy,i[s])}function eb(r){switch(r){case 5126:return N1;case 35664:return F1;case 35665:return O1;case 35666:return B1;case 35674:return U1;case 35675:return k1;case 35676:return H1;case 5124:case 35670:return G1;case 35667:case 35671:return V1;case 35668:case 35672:return W1;case 35669:case 35673:return q1;case 5125:return X1;case 36294:return j1;case 36295:return Y1;case 36296:return J1;case 35678:case 36198:case 36298:case 36306:case 35682:return Z1;case 35679:case 36299:case 36307:return K1;case 35680:case 36300:case 36308:case 36293:return Q1;case 36289:case 36303:case 36311:case 36292:return $1}}function tb(r,e,t){this.id=r,this.addr=t,this.cache=[],this.setValue=z1(e.type)}function wy(r,e,t){this.id=r,this.addr=t,this.cache=[],this.size=e.size,this.setValue=eb(e.type)}wy.prototype.updateCache=function(r){const e=this.cache;r instanceof Float32Array&&e.length!==r.length&&(this.cache=new Float32Array(r.length)),gn(e,r)};function My(r){this.id=r,this.seq=[],this.map={}}My.prototype.setValue=function(r,e,t){const n=this.seq;for(let i=0,s=n.length;i!==s;++i){const a=n[i];a.setValue(r,e[a.id],t)}};const Uh=/(\w+)(\])?(\[|\.)?/g;function Vm(r,e){r.seq.push(e),r.map[e.id]=e}function nb(r,e,t){const n=r.name,i=n.length;for(Uh.lastIndex=0;;){const s=Uh.exec(n),a=Uh.lastIndex;let l=s[1];const u=s[2]==="]",f=s[3];if(u&&(l=l|0),f===void 0||f==="["&&a+2===i){Vm(t,f===void 0?new tb(l,r,e):new wy(l,r,e));break}else{let g=t.map[l];g===void 0&&(g=new My(l),Vm(t,g)),t=g}}}function Mr(r,e){this.seq=[],this.map={};const t=r.getProgramParameter(e,35718);for(let n=0;n<t;++n){const i=r.getActiveUniform(e,n),s=r.getUniformLocation(e,i.name);nb(i,s,this)}}Mr.prototype.setValue=function(r,e,t,n){const i=this.map[e];i!==void 0&&i.setValue(r,t,n)};Mr.prototype.setOptional=function(r,e,t){const n=e[t];n!==void 0&&this.setValue(r,t,n)};Mr.upload=function(r,e,t,n){for(let i=0,s=e.length;i!==s;++i){const a=e[i],l=t[a.id];l.needsUpdate!==!1&&a.setValue(r,l.value,n)}};Mr.seqWithValue=function(r,e){const t=[];for(let n=0,i=r.length;n!==i;++n){const s=r[n];s.id in e&&t.push(s)}return t};function Wm(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}let ib=0;function rb(r,e){const t=r.split(`
|
|
2941
|
+
`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++)n.push(a+1+": "+t[a]);return n.join(`
|
|
2942
|
+
`)}function sb(r){switch(r){case Kn:return["Linear","( value )"];case Tt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}function qm(r,e,t){const n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=parseInt(/ERROR: 0:(\d+)/.exec(i)[1]);return t.toUpperCase()+`
|
|
2943
|
+
|
|
2944
|
+
`+i+`
|
|
2945
|
+
|
|
2946
|
+
`+rb(r.getShaderSource(e),s)}function ob(r,e){const t=sb(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function ab(r,e){let t;switch(e){case R0:t="Linear";break;case P0:t="Reinhard";break;case L0:t="OptimizedCineon";break;case Xf:t="ACESFilmic";break;case D0:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function lb(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.tangentSpaceNormalMap||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ua).join(`
|
|
2947
|
+
`)}function cb(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
2948
|
+
`)}function ub(r,e){const t={},n=r.getProgramParameter(e,35721);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let l=1;s.type===35674&&(l=2),s.type===35675&&(l=3),s.type===35676&&(l=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:l}}return t}function ua(r){return r!==""}function Xm(r,e){return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function jm(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const hb=/^[ \t]*#include +<([\w\d./]+)>/gm;function Lf(r){return r.replace(hb,fb)}function fb(r,e){const t=ct[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Lf(t)}const db=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,pb=/#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 Ym(r){return r.replace(pb,Sy).replace(db,mb)}function mb(r,e,t,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Sy(r,e,t,n)}function Sy(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Jm(r){let e="precision "+r.precision+` float;
|
|
2949
|
+
precision `+r.precision+" int;";return r.precision==="highp"?e+=`
|
|
2950
|
+
#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
|
|
2951
|
+
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
|
|
2952
|
+
#define LOW_PRECISION`),e}function gb(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Hf?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===Gf?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===ro&&(e="SHADOWMAP_TYPE_VSM"),e}function yb(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Sr:case br:e="ENVMAP_TYPE_CUBE";break;case Eo:e="ENVMAP_TYPE_CUBE_UV";break}return e}function xb(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case br:e="ENVMAP_MODE_REFRACTION";break}return e}function vb(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case za:e="ENVMAP_BLENDING_MULTIPLY";break;case A0:e="ENVMAP_BLENDING_MIX";break;case C0:e="ENVMAP_BLENDING_ADD";break}return e}function _b(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e/32+1)+3,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function wb(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,l=t.fragmentShader;const u=gb(t),f=yb(t),p=xb(t),g=vb(t),d=_b(t),m=t.isWebGL2?"":lb(t),x=cb(s),y=i.createProgram();let v,M,S=t.glslVersion?"#version "+t.glslVersion+`
|
|
2953
|
+
`:"";t.isRawShaderMaterial?(v=[x].filter(ua).join(`
|
|
2954
|
+
`),v.length>0&&(v+=`
|
|
2955
|
+
`),M=[m,x].filter(ua).join(`
|
|
2956
|
+
`),M.length>0&&(M+=`
|
|
2957
|
+
`)):(v=[Jm(t),"#define SHADER_NAME "+t.shaderName,x,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
2958
|
+
`].filter(ua).join(`
|
|
2959
|
+
`),M=[m,Jm(t),"#define SHADER_NAME "+t.shaderName,x,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==hi?"#define TONE_MAPPING":"",t.toneMapping!==hi?ct.tonemapping_pars_fragment:"",t.toneMapping!==hi?ab("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ct.encodings_pars_fragment,ob("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
2960
|
+
`].filter(ua).join(`
|
|
2961
|
+
`)),a=Lf(a),a=Xm(a,t),a=jm(a,t),l=Lf(l),l=Xm(l,t),l=jm(l,t),a=Ym(a),l=Ym(l),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(S=`#version 300 es
|
|
2962
|
+
`,v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
2963
|
+
`)+`
|
|
2964
|
+
`+v,M=["#define varying in",t.glslVersion===Cf?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Cf?"":"#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(`
|
|
2965
|
+
`)+`
|
|
2966
|
+
`+M);const T=S+v+a,b=S+M+l,A=Wm(i,35633,T),L=Wm(i,35632,b);if(i.attachShader(y,A),i.attachShader(y,L),t.index0AttributeName!==void 0?i.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y),r.debug.checkShaderErrors){const q=i.getProgramInfoLog(y).trim(),B=i.getShaderInfoLog(A).trim(),C=i.getShaderInfoLog(L).trim();let z=!0,J=!0;if(i.getProgramParameter(y,35714)===!1){z=!1;const W=qm(i,A,"vertex"),Y=qm(i,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(y,35715)+`
|
|
2967
|
+
|
|
2968
|
+
Program Info Log: `+q+`
|
|
2969
|
+
`+W+`
|
|
2970
|
+
`+Y)}else q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",q):(B===""||C==="")&&(J=!1);J&&(this.diagnostics={runnable:z,programLog:q,vertexShader:{log:B,prefix:v},fragmentShader:{log:C,prefix:M}})}i.deleteShader(A),i.deleteShader(L);let D;this.getUniforms=function(){return D===void 0&&(D=new Mr(i,y)),D};let N;return this.getAttributes=function(){return N===void 0&&(N=ub(i,y)),N},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(y),this.program=void 0},this.name=t.shaderName,this.id=ib++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=A,this.fragmentShader=L,this}let Mb=0;class Sb{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){const t=this.shaderCache;if(t.has(e)===!1){const n=new bb(e);t.set(e,n)}return t.get(e)}}class bb{constructor(e){this.id=Mb++,this.code=e,this.usedTimes=0}}function Eb(r,e,t,n,i,s,a){const l=new os,u=new Sb,f=[],p=i.isWebGL2,g=i.logarithmicDepthBuffer,d=i.floatVertexTextures,m=i.maxVertexUniforms,x=i.vertexTextures;let y=i.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 M(C){const J=C.skeleton.bones;if(d)return 1024;{const Y=Math.floor((m-20)/4),X=Math.min(Y,J.length);return X<J.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+J.length+" bones. This GPU supports "+X+"."),0):X}}function S(C,z,J,W,Y){const X=W.fog,ee=Y.geometry,V=C.isMeshStandardMaterial?W.environment:null,re=(C.isMeshStandardMaterial?t:e).get(C.envMap||V),K=re&&re.mapping===Eo?re.image.height:null,pe=v[C.type],he=Y.isSkinnedMesh?M(Y):0;C.precision!==null&&(y=i.getMaxPrecision(C.precision),y!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",y,"instead."));const Ce=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,Ue=Ce!==void 0?Ce.length:0;let Be=0;ee.morphAttributes.position!==void 0&&(Be=1),ee.morphAttributes.normal!==void 0&&(Be=2),ee.morphAttributes.color!==void 0&&(Be=3);let oe,ot,qe,je;if(pe){const me=ui[pe];oe=me.vertexShader,ot=me.fragmentShader}else oe=C.vertexShader,ot=C.fragmentShader,u.update(C),qe=u.getVertexShaderID(C),je=u.getFragmentShaderID(C);const xe=r.getRenderTarget(),tt=C.alphaTest>0,ae=C.clearcoat>0;return{isWebGL2:p,shaderID:pe,shaderName:C.type,vertexShader:oe,fragmentShader:ot,defines:C.defines,customVertexShaderID:qe,customFragmentShaderID:je,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:y,instancing:Y.isInstancedMesh===!0,instancingColor:Y.isInstancedMesh===!0&&Y.instanceColor!==null,supportsVertexTextures:x,outputEncoding:xe===null?r.outputEncoding:xe.isXRRenderTarget===!0?xe.texture.encoding:Kn,map:!!C.map,matcap:!!C.matcap,envMap:!!re,envMapMode:re&&re.mapping,envMapCubeUVHeight:K,lightMap:!!C.lightMap,aoMap:!!C.aoMap,emissiveMap:!!C.emissiveMap,bumpMap:!!C.bumpMap,normalMap:!!C.normalMap,objectSpaceNormalMap:C.normalMapType===ey,tangentSpaceNormalMap:C.normalMapType===_s,decodeVideoTexture:!!C.map&&C.map.isVideoTexture===!0&&C.map.encoding===Tt,clearcoat:ae,clearcoatMap:ae&&!!C.clearcoatMap,clearcoatRoughnessMap:ae&&!!C.clearcoatRoughnessMap,clearcoatNormalMap:ae&&!!C.clearcoatNormalMap,displacementMap:!!C.displacementMap,roughnessMap:!!C.roughnessMap,metalnessMap:!!C.metalnessMap,specularMap:!!C.specularMap,specularIntensityMap:!!C.specularIntensityMap,specularColorMap:!!C.specularColorMap,opaque:C.transparent===!1&&C.blending===ts,alphaMap:!!C.alphaMap,alphaTest:tt,gradientMap:!!C.gradientMap,sheen:C.sheen>0,sheenColorMap:!!C.sheenColorMap,sheenRoughnessMap:!!C.sheenRoughnessMap,transmission:C.transmission>0,transmissionMap:!!C.transmissionMap,thicknessMap:!!C.thicknessMap,combine:C.combine,vertexTangents:!!C.normalMap&&!!ee.attributes.tangent,vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,vertexUvs:!!C.map||!!C.bumpMap||!!C.normalMap||!!C.specularMap||!!C.alphaMap||!!C.emissiveMap||!!C.roughnessMap||!!C.metalnessMap||!!C.clearcoatMap||!!C.clearcoatRoughnessMap||!!C.clearcoatNormalMap||!!C.displacementMap||!!C.transmissionMap||!!C.thicknessMap||!!C.specularIntensityMap||!!C.specularColorMap||!!C.sheenColorMap||!!C.sheenRoughnessMap,uvsVertexOnly:!(C.map||C.bumpMap||C.normalMap||C.specularMap||C.alphaMap||C.emissiveMap||C.roughnessMap||C.metalnessMap||C.clearcoatNormalMap||C.transmission>0||C.transmissionMap||C.thicknessMap||C.specularIntensityMap||C.specularColorMap||C.sheen>0||C.sheenColorMap||C.sheenRoughnessMap)&&!!C.displacementMap,fog:!!X,useFog:C.fog,fogExp2:X&&X.isFogExp2,flatShading:!!C.flatShading,sizeAttenuation:C.sizeAttenuation,logarithmicDepthBuffer:g,skinning:Y.isSkinnedMesh===!0&&he>0,maxBones:he,useVertexTexture:d,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:Ue,morphTextureStride:Be,numDirLights:z.directional.length,numPointLights:z.point.length,numSpotLights:z.spot.length,numRectAreaLights:z.rectArea.length,numHemiLights:z.hemi.length,numDirLightShadows:z.directionalShadowMap.length,numPointLightShadows:z.pointShadowMap.length,numSpotLightShadows:z.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:C.dithering,shadowMapEnabled:r.shadowMap.enabled&&J.length>0,shadowMapType:r.shadowMap.type,toneMapping:C.toneMapped?r.toneMapping:hi,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===cs,flipSided:C.side===Fn,depthPacking:C.depthPacking!==void 0?C.depthPacking:!1,index0AttributeName:C.index0AttributeName,extensionDerivatives:C.extensions&&C.extensions.derivatives,extensionFragDepth:C.extensions&&C.extensions.fragDepth,extensionDrawBuffers:C.extensions&&C.extensions.drawBuffers,extensionShaderTextureLOD:C.extensions&&C.extensions.shaderTextureLOD,rendererExtensionFragDepth:p||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:p||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:p||n.has("EXT_shader_texture_lod"),customProgramCacheKey:C.customProgramCacheKey()}}function T(C){const z=[];if(C.shaderID?z.push(C.shaderID):(z.push(C.customVertexShaderID),z.push(C.customFragmentShaderID)),C.defines!==void 0)for(const J in C.defines)z.push(J),z.push(C.defines[J]);return C.isRawShaderMaterial===!1&&(b(z,C),A(z,C),z.push(r.outputEncoding)),z.push(C.customProgramCacheKey),z.join()}function b(C,z){C.push(z.precision),C.push(z.outputEncoding),C.push(z.envMapMode),C.push(z.envMapCubeUVHeight),C.push(z.combine),C.push(z.vertexUvs),C.push(z.fogExp2),C.push(z.sizeAttenuation),C.push(z.maxBones),C.push(z.morphTargetsCount),C.push(z.morphAttributeCount),C.push(z.numDirLights),C.push(z.numPointLights),C.push(z.numSpotLights),C.push(z.numHemiLights),C.push(z.numRectAreaLights),C.push(z.numDirLightShadows),C.push(z.numPointLightShadows),C.push(z.numSpotLightShadows),C.push(z.shadowMapType),C.push(z.toneMapping),C.push(z.numClippingPlanes),C.push(z.numClipIntersection)}function A(C,z){l.disableAll(),z.isWebGL2&&l.enable(0),z.supportsVertexTextures&&l.enable(1),z.instancing&&l.enable(2),z.instancingColor&&l.enable(3),z.map&&l.enable(4),z.matcap&&l.enable(5),z.envMap&&l.enable(6),z.lightMap&&l.enable(7),z.aoMap&&l.enable(8),z.emissiveMap&&l.enable(9),z.bumpMap&&l.enable(10),z.normalMap&&l.enable(11),z.objectSpaceNormalMap&&l.enable(12),z.tangentSpaceNormalMap&&l.enable(13),z.clearcoat&&l.enable(14),z.clearcoatMap&&l.enable(15),z.clearcoatRoughnessMap&&l.enable(16),z.clearcoatNormalMap&&l.enable(17),z.displacementMap&&l.enable(18),z.specularMap&&l.enable(19),z.roughnessMap&&l.enable(20),z.metalnessMap&&l.enable(21),z.gradientMap&&l.enable(22),z.alphaMap&&l.enable(23),z.alphaTest&&l.enable(24),z.vertexColors&&l.enable(25),z.vertexAlphas&&l.enable(26),z.vertexUvs&&l.enable(27),z.vertexTangents&&l.enable(28),z.uvsVertexOnly&&l.enable(29),z.fog&&l.enable(30),C.push(l.mask),l.disableAll(),z.useFog&&l.enable(0),z.flatShading&&l.enable(1),z.logarithmicDepthBuffer&&l.enable(2),z.skinning&&l.enable(3),z.useVertexTexture&&l.enable(4),z.morphTargets&&l.enable(5),z.morphNormals&&l.enable(6),z.morphColors&&l.enable(7),z.premultipliedAlpha&&l.enable(8),z.shadowMapEnabled&&l.enable(9),z.physicallyCorrectLights&&l.enable(10),z.doubleSided&&l.enable(11),z.flipSided&&l.enable(12),z.depthPacking&&l.enable(13),z.dithering&&l.enable(14),z.specularIntensityMap&&l.enable(15),z.specularColorMap&&l.enable(16),z.transmission&&l.enable(17),z.transmissionMap&&l.enable(18),z.thicknessMap&&l.enable(19),z.sheen&&l.enable(20),z.sheenColorMap&&l.enable(21),z.sheenRoughnessMap&&l.enable(22),z.decodeVideoTexture&&l.enable(23),z.opaque&&l.enable(24),C.push(l.mask)}function L(C){const z=v[C.type];let J;if(z){const W=ui[z];J=my.clone(W.uniforms)}else J=C.uniforms;return J}function D(C,z){let J;for(let W=0,Y=f.length;W<Y;W++){const X=f[W];if(X.cacheKey===z){J=X,++J.usedTimes;break}}return J===void 0&&(J=new wb(r,z,C,s),f.push(J)),J}function N(C){if(--C.usedTimes===0){const z=f.indexOf(C);f[z]=f[f.length-1],f.pop(),C.destroy()}}function q(C){u.remove(C)}function B(){u.dispose()}return{getParameters:S,getProgramCacheKey:T,getUniforms:L,acquireProgram:D,releaseProgram:N,releaseShaderCache:q,programs:f,dispose:B}}function Tb(){let r=new WeakMap;function e(s){let a=r.get(s);return a===void 0&&(a={},r.set(s,a)),a}function t(s){r.delete(s)}function n(s,a,l){r.get(s)[a]=l}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function Ab(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Zm(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Km(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(g,d,m,x,y,v){let M=r[e];return M===void 0?(M={id:g.id,object:g,geometry:d,material:m,groupOrder:x,renderOrder:g.renderOrder,z:y,group:v},r[e]=M):(M.id=g.id,M.object=g,M.geometry=d,M.material=m,M.groupOrder=x,M.renderOrder=g.renderOrder,M.z=y,M.group=v),e++,M}function l(g,d,m,x,y,v){const M=a(g,d,m,x,y,v);m.transmission>0?n.push(M):m.transparent===!0?i.push(M):t.push(M)}function u(g,d,m,x,y,v){const M=a(g,d,m,x,y,v);m.transmission>0?n.unshift(M):m.transparent===!0?i.unshift(M):t.unshift(M)}function f(g,d){t.length>1&&t.sort(g||Ab),n.length>1&&n.sort(d||Zm),i.length>1&&i.sort(d||Zm)}function p(){for(let g=e,d=r.length;g<d;g++){const m=r[g];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:l,unshift:u,finish:p,sort:f}}function Cb(){let r=new WeakMap;function e(n,i){let s;return r.has(n)===!1?(s=new Km,r.set(n,[s])):i>=r.get(n).length?(s=new Km,r.get(n).push(s)):s=r.get(n)[i],s}function t(){r=new WeakMap}return{get:e,dispose:t}}function Rb(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new R,color:new Ae};break;case"SpotLight":t={position:new R,direction:new R,color:new Ae,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new Ae,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new Ae,groundColor:new Ae};break;case"RectAreaLight":t={color:new Ae,position:new R,halfWidth:new R,halfHeight:new R};break}return r[e.id]=t,t}}}function Pb(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Lb=0;function Db(r,e){return(e.castShadow?1:0)-(r.castShadow?1:0)}function Ib(r,e){const t=new Rb,n=Pb(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let p=0;p<9;p++)i.probe.push(new R);const s=new R,a=new Fe,l=new Fe;function u(p,g){let d=0,m=0,x=0;for(let q=0;q<9;q++)i.probe[q].set(0,0,0);let y=0,v=0,M=0,S=0,T=0,b=0,A=0,L=0;p.sort(Db);const D=g!==!0?Math.PI:1;for(let q=0,B=p.length;q<B;q++){const C=p[q],z=C.color,J=C.intensity,W=C.distance,Y=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)d+=z.r*J*D,m+=z.g*J*D,x+=z.b*J*D;else if(C.isLightProbe)for(let X=0;X<9;X++)i.probe[X].addScaledVector(C.sh.coefficients[X],J);else if(C.isDirectionalLight){const X=t.get(C);if(X.color.copy(C.color).multiplyScalar(C.intensity*D),C.castShadow){const ee=C.shadow,V=n.get(C);V.shadowBias=ee.bias,V.shadowNormalBias=ee.normalBias,V.shadowRadius=ee.radius,V.shadowMapSize=ee.mapSize,i.directionalShadow[y]=V,i.directionalShadowMap[y]=Y,i.directionalShadowMatrix[y]=C.shadow.matrix,b++}i.directional[y]=X,y++}else if(C.isSpotLight){const X=t.get(C);if(X.position.setFromMatrixPosition(C.matrixWorld),X.color.copy(z).multiplyScalar(J*D),X.distance=W,X.coneCos=Math.cos(C.angle),X.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),X.decay=C.decay,C.castShadow){const ee=C.shadow,V=n.get(C);V.shadowBias=ee.bias,V.shadowNormalBias=ee.normalBias,V.shadowRadius=ee.radius,V.shadowMapSize=ee.mapSize,i.spotShadow[M]=V,i.spotShadowMap[M]=Y,i.spotShadowMatrix[M]=C.shadow.matrix,L++}i.spot[M]=X,M++}else if(C.isRectAreaLight){const X=t.get(C);X.color.copy(z).multiplyScalar(J),X.halfWidth.set(C.width*.5,0,0),X.halfHeight.set(0,C.height*.5,0),i.rectArea[S]=X,S++}else if(C.isPointLight){const X=t.get(C);if(X.color.copy(C.color).multiplyScalar(C.intensity*D),X.distance=C.distance,X.decay=C.decay,C.castShadow){const ee=C.shadow,V=n.get(C);V.shadowBias=ee.bias,V.shadowNormalBias=ee.normalBias,V.shadowRadius=ee.radius,V.shadowMapSize=ee.mapSize,V.shadowCameraNear=ee.camera.near,V.shadowCameraFar=ee.camera.far,i.pointShadow[v]=V,i.pointShadowMap[v]=Y,i.pointShadowMatrix[v]=C.shadow.matrix,A++}i.point[v]=X,v++}else if(C.isHemisphereLight){const X=t.get(C);X.skyColor.copy(C.color).multiplyScalar(J*D),X.groundColor.copy(C.groundColor).multiplyScalar(J*D),i.hemi[T]=X,T++}}S>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Se.LTC_FLOAT_1,i.rectAreaLTC2=Se.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Se.LTC_HALF_1,i.rectAreaLTC2=Se.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=d,i.ambient[1]=m,i.ambient[2]=x;const N=i.hash;(N.directionalLength!==y||N.pointLength!==v||N.spotLength!==M||N.rectAreaLength!==S||N.hemiLength!==T||N.numDirectionalShadows!==b||N.numPointShadows!==A||N.numSpotShadows!==L)&&(i.directional.length=y,i.spot.length=M,i.rectArea.length=S,i.point.length=v,i.hemi.length=T,i.directionalShadow.length=b,i.directionalShadowMap.length=b,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=L,i.spotShadowMap.length=L,i.directionalShadowMatrix.length=b,i.pointShadowMatrix.length=A,i.spotShadowMatrix.length=L,N.directionalLength=y,N.pointLength=v,N.spotLength=M,N.rectAreaLength=S,N.hemiLength=T,N.numDirectionalShadows=b,N.numPointShadows=A,N.numSpotShadows=L,i.version=Lb++)}function f(p,g){let d=0,m=0,x=0,y=0,v=0;const M=g.matrixWorldInverse;for(let S=0,T=p.length;S<T;S++){const b=p[S];if(b.isDirectionalLight){const A=i.directional[d];A.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),A.direction.sub(s),A.direction.transformDirection(M),d++}else if(b.isSpotLight){const A=i.spot[x];A.position.setFromMatrixPosition(b.matrixWorld),A.position.applyMatrix4(M),A.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),A.direction.sub(s),A.direction.transformDirection(M),x++}else if(b.isRectAreaLight){const A=i.rectArea[y];A.position.setFromMatrixPosition(b.matrixWorld),A.position.applyMatrix4(M),l.identity(),a.copy(b.matrixWorld),a.premultiply(M),l.extractRotation(a),A.halfWidth.set(b.width*.5,0,0),A.halfHeight.set(0,b.height*.5,0),A.halfWidth.applyMatrix4(l),A.halfHeight.applyMatrix4(l),y++}else if(b.isPointLight){const A=i.point[m];A.position.setFromMatrixPosition(b.matrixWorld),A.position.applyMatrix4(M),m++}else if(b.isHemisphereLight){const A=i.hemi[v];A.direction.setFromMatrixPosition(b.matrixWorld),A.direction.transformDirection(M),A.direction.normalize(),v++}}}return{setup:u,setupView:f,state:i}}function Qm(r,e){const t=new Ib(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function a(g){n.push(g)}function l(g){i.push(g)}function u(g){t.setup(n,g)}function f(g){t.setupView(n,g)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:u,setupLightsView:f,pushLight:a,pushShadow:l}}function zb(r,e){let t=new WeakMap;function n(s,a=0){let l;return t.has(s)===!1?(l=new Qm(r,e),t.set(s,[l])):a>=t.get(s).length?(l=new Qm(r,e),t.get(s).push(l)):l=t.get(s)[a],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class Kc extends qt{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=Q0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}Kc.prototype.isMeshDepthMaterial=!0;class Qc extends qt{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new R,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}Qc.prototype.isMeshDistanceMaterial=!0;const Nb=`void main() {
|
|
2971
|
+
gl_Position = vec4( position, 1.0 );
|
|
2972
|
+
}`,Fb=`uniform sampler2D shadow_pass;
|
|
2973
|
+
uniform vec2 resolution;
|
|
2974
|
+
uniform float radius;
|
|
2975
|
+
#include <packing>
|
|
2976
|
+
void main() {
|
|
2977
|
+
const float samples = float( VSM_SAMPLES );
|
|
2978
|
+
float mean = 0.0;
|
|
2979
|
+
float squared_mean = 0.0;
|
|
2980
|
+
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
|
2981
|
+
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
|
2982
|
+
for ( float i = 0.0; i < samples; i ++ ) {
|
|
2983
|
+
float uvOffset = uvStart + i * uvStride;
|
|
2984
|
+
#ifdef HORIZONTAL_PASS
|
|
2985
|
+
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
|
|
2986
|
+
mean += distribution.x;
|
|
2987
|
+
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|
2988
|
+
#else
|
|
2989
|
+
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
|
|
2990
|
+
mean += depth;
|
|
2991
|
+
squared_mean += depth * depth;
|
|
2992
|
+
#endif
|
|
2993
|
+
}
|
|
2994
|
+
mean = mean / samples;
|
|
2995
|
+
squared_mean = squared_mean / samples;
|
|
2996
|
+
float std_dev = sqrt( squared_mean - mean * mean );
|
|
2997
|
+
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
2998
|
+
}`;function by(r,e,t){let n=new Fa;const i=new ue,s=new ue,a=new wt,l=new Kc({depthPacking:$0}),u=new Qc,f={},p=t.maxTextureSize,g={0:Fn,1:ls,2:cs},d=new Qn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:Nb,fragmentShader:Fb}),m=d.clone();m.defines.HORIZONTAL_PASS=1;const x=new Ye;x.setAttribute("position",new mt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Kt(x,d),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Hf,this.render=function(b,A,L){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||b.length===0)return;const D=r.getRenderTarget(),N=r.getActiveCubeFace(),q=r.getActiveMipmapLevel(),B=r.state;B.setBlending(Yi),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);for(let C=0,z=b.length;C<z;C++){const J=b[C],W=J.shadow;if(W===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(W.autoUpdate===!1&&W.needsUpdate===!1)continue;i.copy(W.mapSize);const Y=W.getFrameExtents();if(i.multiply(Y),s.copy(W.mapSize),(i.x>p||i.y>p)&&(i.x>p&&(s.x=Math.floor(p/Y.x),i.x=s.x*Y.x,W.mapSize.x=s.x),i.y>p&&(s.y=Math.floor(p/Y.y),i.y=s.y*Y.y,W.mapSize.y=s.y)),W.map===null&&!W.isPointLightShadow&&this.type===ro&&(W.map=new Sn(i.x,i.y),W.map.texture.name=J.name+".shadowMap",W.mapPass=new Sn(i.x,i.y),W.camera.updateProjectionMatrix()),W.map===null){const ee={minFilter:Zt,magFilter:Zt,format:Nn};W.map=new Sn(i.x,i.y,ee),W.map.texture.name=J.name+".shadowMap",W.camera.updateProjectionMatrix()}r.setRenderTarget(W.map),r.clear();const X=W.getViewportCount();for(let ee=0;ee<X;ee++){const V=W.getViewport(ee);a.set(s.x*V.x,s.y*V.y,s.x*V.z,s.y*V.w),B.viewport(a),W.updateMatrices(J,ee),n=W.getFrustum(),T(A,L,W.camera,J,this.type)}!W.isPointLightShadow&&this.type===ro&&M(W,L),W.needsUpdate=!1}v.needsUpdate=!1,r.setRenderTarget(D,N,q)};function M(b,A){const L=e.update(y);d.defines.VSM_SAMPLES!==b.blurSamples&&(d.defines.VSM_SAMPLES=b.blurSamples,m.defines.VSM_SAMPLES=b.blurSamples,d.needsUpdate=!0,m.needsUpdate=!0),d.uniforms.shadow_pass.value=b.map.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,r.setRenderTarget(b.mapPass),r.clear(),r.renderBufferDirect(A,null,L,d,y,null),m.uniforms.shadow_pass.value=b.mapPass.texture,m.uniforms.resolution.value=b.mapSize,m.uniforms.radius.value=b.radius,r.setRenderTarget(b.map),r.clear(),r.renderBufferDirect(A,null,L,m,y,null)}function S(b,A,L,D,N,q){let B=null;const C=L.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0?B=C:B=L.isPointLight===!0?u:l,r.localClippingEnabled&&A.clipShadows===!0&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0){const z=B.uuid,J=A.uuid;let W=f[z];W===void 0&&(W={},f[z]=W);let Y=W[J];Y===void 0&&(Y=B.clone(),W[J]=Y),B=Y}return B.visible=A.visible,B.wireframe=A.wireframe,q===ro?B.side=A.shadowSide!==null?A.shadowSide:A.side:B.side=A.shadowSide!==null?A.shadowSide:g[A.side],B.alphaMap=A.alphaMap,B.alphaTest=A.alphaTest,B.clipShadows=A.clipShadows,B.clippingPlanes=A.clippingPlanes,B.clipIntersection=A.clipIntersection,B.displacementMap=A.displacementMap,B.displacementScale=A.displacementScale,B.displacementBias=A.displacementBias,B.wireframeLinewidth=A.wireframeLinewidth,B.linewidth=A.linewidth,L.isPointLight===!0&&B.isMeshDistanceMaterial===!0&&(B.referencePosition.setFromMatrixPosition(L.matrixWorld),B.nearDistance=D,B.farDistance=N),B}function T(b,A,L,D,N){if(b.visible===!1)return;if(b.layers.test(A.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&N===ro)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,b.matrixWorld);const C=e.update(b),z=b.material;if(Array.isArray(z)){const J=C.groups;for(let W=0,Y=J.length;W<Y;W++){const X=J[W],ee=z[X.materialIndex];if(ee&&ee.visible){const V=S(b,ee,D,L.near,L.far,N);r.renderBufferDirect(L,null,C,V,b,X)}}}else if(z.visible){const J=S(b,z,D,L.near,L.far,N);r.renderBufferDirect(L,null,C,J,b,null)}}const B=b.children;for(let C=0,z=B.length;C<z;C++)T(B[C],A,L,D,N)}}function Ob(r,e,t){const n=t.isWebGL2;function i(){let k=!1;const we=new wt;let _e=null;const U=new wt(0,0,0,0);return{setMask:function(Q){_e!==Q&&!k&&(r.colorMask(Q,Q,Q,Q),_e=Q)},setLocked:function(Q){k=Q},setClear:function(Q,ye,de,Ie,ut){ut===!0&&(Q*=Ie,ye*=Ie,de*=Ie),we.set(Q,ye,de,Ie),U.equals(we)===!1&&(r.clearColor(Q,ye,de,Ie),U.copy(we))},reset:function(){k=!1,_e=null,U.set(-1,0,0,0)}}}function s(){let k=!1,we=null,_e=null,U=null;return{setTest:function(Q){Q?Be(2929):oe(2929)},setMask:function(Q){we!==Q&&!k&&(r.depthMask(Q),we=Q)},setFunc:function(Q){if(_e!==Q){if(Q)switch(Q){case _0:r.depthFunc(512);break;case w0:r.depthFunc(519);break;case M0:r.depthFunc(513);break;case zc:r.depthFunc(515);break;case S0:r.depthFunc(514);break;case b0:r.depthFunc(518);break;case E0:r.depthFunc(516);break;case T0:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);_e=Q}},setLocked:function(Q){k=Q},setClear:function(Q){U!==Q&&(r.clearDepth(Q),U=Q)},reset:function(){k=!1,we=null,_e=null,U=null}}}function a(){let k=!1,we=null,_e=null,U=null,Q=null,ye=null,de=null,Ie=null,ut=null;return{setTest:function(Qe){k||(Qe?Be(2960):oe(2960))},setMask:function(Qe){we!==Qe&&!k&&(r.stencilMask(Qe),we=Qe)},setFunc:function(Qe,Ln,yn){(_e!==Qe||U!==Ln||Q!==yn)&&(r.stencilFunc(Qe,Ln,yn),_e=Qe,U=Ln,Q=yn)},setOp:function(Qe,Ln,yn){(ye!==Qe||de!==Ln||Ie!==yn)&&(r.stencilOp(Qe,Ln,yn),ye=Qe,de=Ln,Ie=yn)},setLocked:function(Qe){k=Qe},setClear:function(Qe){ut!==Qe&&(r.clearStencil(Qe),ut=Qe)},reset:function(){k=!1,we=null,_e=null,U=null,Q=null,ye=null,de=null,Ie=null,ut=null}}}const l=new i,u=new s,f=new a;let p={},g={},d=new WeakMap,m=[],x=null,y=!1,v=null,M=null,S=null,T=null,b=null,A=null,L=null,D=!1,N=null,q=null,B=null,C=null,z=null;const J=r.getParameter(35661);let W=!1,Y=0;const X=r.getParameter(7938);X.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(X)[1]),W=Y>=1):X.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),W=Y>=2);let ee=null,V={};const re=r.getParameter(3088),K=r.getParameter(2978),pe=new wt().fromArray(re),he=new wt().fromArray(K);function Ce(k,we,_e){const U=new Uint8Array(4),Q=r.createTexture();r.bindTexture(k,Q),r.texParameteri(k,10241,9728),r.texParameteri(k,10240,9728);for(let ye=0;ye<_e;ye++)r.texImage2D(we+ye,0,6408,1,1,0,6408,5121,U);return Q}const Ue={};Ue[3553]=Ce(3553,3553,1),Ue[34067]=Ce(34067,34069,6),l.setClear(0,0,0,1),u.setClear(1),f.setClear(0),Be(2929),u.setFunc(zc),me(!1),Le(ef),Be(2884),ae(Yi);function Be(k){p[k]!==!0&&(r.enable(k),p[k]=!0)}function oe(k){p[k]!==!1&&(r.disable(k),p[k]=!1)}function ot(k,we){return g[k]!==we?(r.bindFramebuffer(k,we),g[k]=we,n&&(k===36009&&(g[36160]=we),k===36160&&(g[36009]=we)),!0):!1}function qe(k,we){let _e=m,U=!1;if(k)if(_e=d.get(we),_e===void 0&&(_e=[],d.set(we,_e)),k.isWebGLMultipleRenderTargets){const Q=k.texture;if(_e.length!==Q.length||_e[0]!==36064){for(let ye=0,de=Q.length;ye<de;ye++)_e[ye]=36064+ye;_e.length=Q.length,U=!0}}else _e[0]!==36064&&(_e[0]=36064,U=!0);else _e[0]!==1029&&(_e[0]=1029,U=!0);U&&(t.isWebGL2?r.drawBuffers(_e):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(_e))}function je(k){return x!==k?(r.useProgram(k),x=k,!0):!1}const xe={[Jr]:32774,[c0]:32778,[u0]:32779};if(n)xe[sf]=32775,xe[of]=32776;else{const k=e.get("EXT_blend_minmax");k!==null&&(xe[sf]=k.MIN_EXT,xe[of]=k.MAX_EXT)}const tt={[h0]:0,[f0]:1,[d0]:768,[Wf]:770,[v0]:776,[y0]:774,[m0]:772,[p0]:769,[qf]:771,[x0]:775,[g0]:773};function ae(k,we,_e,U,Q,ye,de,Ie){if(k===Yi){y===!0&&(oe(3042),y=!1);return}if(y===!1&&(Be(3042),y=!0),k!==l0){if(k!==v||Ie!==D){if((M!==Jr||b!==Jr)&&(r.blendEquation(32774),M=Jr,b=Jr),Ie)switch(k){case ts:r.blendFuncSeparate(1,771,1,771);break;case tf:r.blendFunc(1,1);break;case nf:r.blendFuncSeparate(0,769,0,1);break;case rf:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}else switch(k){case ts:r.blendFuncSeparate(770,771,1,771);break;case tf:r.blendFunc(770,1);break;case nf:r.blendFuncSeparate(0,769,0,1);break;case rf:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}S=null,T=null,A=null,L=null,v=k,D=Ie}return}Q=Q||we,ye=ye||_e,de=de||U,(we!==M||Q!==b)&&(r.blendEquationSeparate(xe[we],xe[Q]),M=we,b=Q),(_e!==S||U!==T||ye!==A||de!==L)&&(r.blendFuncSeparate(tt[_e],tt[U],tt[ye],tt[de]),S=_e,T=U,A=ye,L=de),v=k,D=null}function ce(k,we){k.side===cs?oe(2884):Be(2884);let _e=k.side===Fn;we&&(_e=!_e),me(_e),k.blending===ts&&k.transparent===!1?ae(Yi):ae(k.blending,k.blendEquation,k.blendSrc,k.blendDst,k.blendEquationAlpha,k.blendSrcAlpha,k.blendDstAlpha,k.premultipliedAlpha),u.setFunc(k.depthFunc),u.setTest(k.depthTest),u.setMask(k.depthWrite),l.setMask(k.colorWrite);const U=k.stencilWrite;f.setTest(U),U&&(f.setMask(k.stencilWriteMask),f.setFunc(k.stencilFunc,k.stencilRef,k.stencilFuncMask),f.setOp(k.stencilFail,k.stencilZFail,k.stencilZPass)),Ze(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),k.alphaToCoverage===!0?Be(32926):oe(32926)}function me(k){N!==k&&(k?r.frontFace(2304):r.frontFace(2305),N=k)}function Le(k){k!==o0?(Be(2884),k!==q&&(k===ef?r.cullFace(1029):k===a0?r.cullFace(1028):r.cullFace(1032))):oe(2884),q=k}function ve(k){k!==B&&(W&&r.lineWidth(k),B=k)}function Ze(k,we,_e){k?(Be(32823),(C!==we||z!==_e)&&(r.polygonOffset(we,_e),C=we,z=_e)):oe(32823)}function Ve(k){k?Be(3089):oe(3089)}function Oe(k){k===void 0&&(k=33984+J-1),ee!==k&&(r.activeTexture(k),ee=k)}function St(k,we){ee===null&&Oe();let _e=V[ee];_e===void 0&&(_e={type:void 0,texture:void 0},V[ee]=_e),(_e.type!==k||_e.texture!==we)&&(r.bindTexture(k,we||Ue[k]),_e.type=k,_e.texture=we)}function vt(){const k=V[ee];k!==void 0&&k.type!==void 0&&(r.bindTexture(k.type,null),k.type=void 0,k.texture=void 0)}function O(){try{r.compressedTexImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function P(){try{r.texSubImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function te(){try{r.texSubImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ge(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function be(){try{r.texStorage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Ee(){try{r.texStorage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ke(){try{r.texImage2D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function le(){try{r.texImage3D.apply(r,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function et(k){pe.equals(k)===!1&&(r.scissor(k.x,k.y,k.z,k.w),pe.copy(k))}function nt(k){he.equals(k)===!1&&(r.viewport(k.x,k.y,k.z,k.w),he.copy(k))}function ze(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),p={},ee=null,V={},g={},d=new WeakMap,m=[],x=null,y=!1,v=null,M=null,S=null,T=null,b=null,A=null,L=null,D=!1,N=null,q=null,B=null,C=null,z=null,pe.set(0,0,r.canvas.width,r.canvas.height),he.set(0,0,r.canvas.width,r.canvas.height),l.reset(),u.reset(),f.reset()}return{buffers:{color:l,depth:u,stencil:f},enable:Be,disable:oe,bindFramebuffer:ot,drawBuffers:qe,useProgram:je,setBlending:ae,setMaterial:ce,setFlipSided:me,setCullFace:Le,setLineWidth:ve,setPolygonOffset:Ze,setScissorTest:Ve,activeTexture:Oe,bindTexture:St,unbindTexture:vt,compressedTexImage2D:O,texImage2D:ke,texImage3D:le,texStorage2D:be,texStorage3D:Ee,texSubImage2D:P,texSubImage3D:te,compressedTexSubImage2D:ge,scissor:et,viewport:nt,reset:ze}}function Bb(r,e,t,n,i,s,a){const l=i.isWebGL2,u=i.maxTextures,f=i.maxCubemapSize,p=i.maxTextureSize,g=i.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,m=/OculusBrowser/g.test(navigator.userAgent),x=new WeakMap;let y;const v=new WeakMap;let M=!1;try{M=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(O,P){return M?new OffscreenCanvas(O,P):Sa("canvas")}function T(O,P,te,ge){let be=1;if((O.width>ge||O.height>ge)&&(be=ge/Math.max(O.width,O.height)),be<1||P===!0)if(typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&O instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&O instanceof ImageBitmap){const Ee=P?Bc:Math.floor,ke=Ee(be*O.width),le=Ee(be*O.height);y===void 0&&(y=S(ke,le));const et=te?S(ke,le):y;return et.width=ke,et.height=le,et.getContext("2d").drawImage(O,0,0,ke,le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+O.width+"x"+O.height+") to ("+ke+"x"+le+")."),et}else return"data"in O&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+O.width+"x"+O.height+")."),O;return O}function b(O){return Rf(O.width)&&Rf(O.height)}function A(O){return l?!1:O.wrapS!==Mn||O.wrapT!==Mn||O.minFilter!==Zt&&O.minFilter!==Gt}function L(O,P){return O.generateMipmaps&&P&&O.minFilter!==Zt&&O.minFilter!==Gt}function D(O){r.generateMipmap(O)}function N(O,P,te,ge,be=!1){if(l===!1)return P;if(O!==null){if(r[O]!==void 0)return r[O];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let Ee=P;return P===6403&&(te===5126&&(Ee=33326),te===5131&&(Ee=33325),te===5121&&(Ee=33321)),P===33319&&(te===5126&&(Ee=33328),te===5131&&(Ee=33327),te===5121&&(Ee=33323)),P===6408&&(te===5126&&(Ee=34836),te===5131&&(Ee=34842),te===5121&&(Ee=ge===Tt&&be===!1?35907:32856),te===32819&&(Ee=32854),te===32820&&(Ee=32855)),(Ee===33325||Ee===33326||Ee===33327||Ee===33328||Ee===34842||Ee===34836)&&e.get("EXT_color_buffer_float"),Ee}function q(O,P,te){return L(O,te)===!0||O.isFramebufferTexture&&O.minFilter!==Zt&&O.minFilter!==Gt?Math.log2(Math.max(P.width,P.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?P.mipmaps.length:1}function B(O){return O===Zt||O===Nc||O===Fc?9728:9729}function C(O){const P=O.target;P.removeEventListener("dispose",C),J(P),P.isVideoTexture&&x.delete(P)}function z(O){const P=O.target;P.removeEventListener("dispose",z),Y(P)}function J(O){const P=n.get(O);if(P.__webglInit===void 0)return;const te=O.source,ge=v.get(te);if(ge){const be=ge[P.__cacheKey];be.usedTimes--,be.usedTimes===0&&W(O),Object.keys(ge).length===0&&v.delete(te)}n.remove(O)}function W(O){const P=n.get(O);r.deleteTexture(P.__webglTexture);const te=O.source,ge=v.get(te);delete ge[P.__cacheKey],a.memory.textures--}function Y(O){const P=O.texture,te=n.get(O),ge=n.get(P);if(ge.__webglTexture!==void 0&&(r.deleteTexture(ge.__webglTexture),a.memory.textures--),O.depthTexture&&O.depthTexture.dispose(),O.isWebGLCubeRenderTarget)for(let be=0;be<6;be++)r.deleteFramebuffer(te.__webglFramebuffer[be]),te.__webglDepthbuffer&&r.deleteRenderbuffer(te.__webglDepthbuffer[be]);else r.deleteFramebuffer(te.__webglFramebuffer),te.__webglDepthbuffer&&r.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&r.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer&&r.deleteRenderbuffer(te.__webglColorRenderbuffer),te.__webglDepthRenderbuffer&&r.deleteRenderbuffer(te.__webglDepthRenderbuffer);if(O.isWebGLMultipleRenderTargets)for(let be=0,Ee=P.length;be<Ee;be++){const ke=n.get(P[be]);ke.__webglTexture&&(r.deleteTexture(ke.__webglTexture),a.memory.textures--),n.remove(P[be])}n.remove(P),n.remove(O)}let X=0;function ee(){X=0}function V(){const O=X;return O>=u&&console.warn("THREE.WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+u),X+=1,O}function re(O){const P=[];return P.push(O.wrapS),P.push(O.wrapT),P.push(O.magFilter),P.push(O.minFilter),P.push(O.anisotropy),P.push(O.internalFormat),P.push(O.format),P.push(O.type),P.push(O.generateMipmaps),P.push(O.premultiplyAlpha),P.push(O.flipY),P.push(O.unpackAlignment),P.push(O.encoding),P.join()}function K(O,P){const te=n.get(O);if(O.isVideoTexture&&St(O),O.isRenderTargetTexture===!1&&O.version>0&&te.__version!==O.version){const ge=O.image;if(ge===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ge.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{qe(te,O,P);return}}t.activeTexture(33984+P),t.bindTexture(3553,te.__webglTexture)}function pe(O,P){const te=n.get(O);if(O.version>0&&te.__version!==O.version){qe(te,O,P);return}t.activeTexture(33984+P),t.bindTexture(35866,te.__webglTexture)}function he(O,P){const te=n.get(O);if(O.version>0&&te.__version!==O.version){qe(te,O,P);return}t.activeTexture(33984+P),t.bindTexture(32879,te.__webglTexture)}function Ce(O,P){const te=n.get(O);if(O.version>0&&te.__version!==O.version){je(te,O,P);return}t.activeTexture(33984+P),t.bindTexture(34067,te.__webglTexture)}const Ue={[ya]:10497,[Mn]:33071,[xa]:33648},Be={[Zt]:9728,[Nc]:9984,[Fc]:9986,[Gt]:9729,[jf]:9985,[vs]:9987};function oe(O,P,te){if(te?(r.texParameteri(O,10242,Ue[P.wrapS]),r.texParameteri(O,10243,Ue[P.wrapT]),(O===32879||O===35866)&&r.texParameteri(O,32882,Ue[P.wrapR]),r.texParameteri(O,10240,Be[P.magFilter]),r.texParameteri(O,10241,Be[P.minFilter])):(r.texParameteri(O,10242,33071),r.texParameteri(O,10243,33071),(O===32879||O===35866)&&r.texParameteri(O,32882,33071),(P.wrapS!==Mn||P.wrapT!==Mn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(O,10240,B(P.magFilter)),r.texParameteri(O,10241,B(P.minFilter)),P.minFilter!==Zt&&P.minFilter!==Gt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ge=e.get("EXT_texture_filter_anisotropic");if(P.type===ji&&e.has("OES_texture_float_linear")===!1||l===!1&&P.type===ns&&e.has("OES_texture_half_float_linear")===!1)return;(P.anisotropy>1||n.get(P).__currentAnisotropy)&&(r.texParameterf(O,ge.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(P.anisotropy,i.getMaxAnisotropy())),n.get(P).__currentAnisotropy=P.anisotropy)}}function ot(O,P){let te=!1;O.__webglInit===void 0&&(O.__webglInit=!0,P.addEventListener("dispose",C));const ge=P.source;let be=v.get(ge);be===void 0&&(be={},v.set(ge,be));const Ee=re(P);if(Ee!==O.__cacheKey){be[Ee]===void 0&&(be[Ee]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,te=!0),be[Ee].usedTimes++;const ke=be[O.__cacheKey];ke!==void 0&&(be[O.__cacheKey].usedTimes--,ke.usedTimes===0&&W(P)),O.__cacheKey=Ee,O.__webglTexture=be[Ee].texture}return te}function qe(O,P,te){let ge=3553;P.isDataArrayTexture&&(ge=35866),P.isData3DTexture&&(ge=32879);const be=ot(O,P),Ee=P.source;if(t.activeTexture(33984+te),t.bindTexture(ge,O.__webglTexture),Ee.version!==Ee.__currentVersion||be===!0){r.pixelStorei(37440,P.flipY),r.pixelStorei(37441,P.premultiplyAlpha),r.pixelStorei(3317,P.unpackAlignment),r.pixelStorei(37443,0);const ke=A(P)&&b(P.image)===!1;let le=T(P.image,ke,!1,p);le=vt(P,le);const et=b(le)||l,nt=s.convert(P.format,P.encoding);let ze=s.convert(P.type),k=N(P.internalFormat,nt,ze,P.encoding,P.isVideoTexture);oe(ge,P,et);let we;const _e=P.mipmaps,U=l&&P.isVideoTexture!==!0,Q=O.__version===void 0,ye=q(P,le,et);if(P.isDepthTexture)k=6402,l?P.type===ji?k=36012:P.type===ha?k=33190:P.type===is?k=35056:k=33189:P.type===ji&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),P.format===wr&&k===6402&&P.type!==lo&&P.type!==ha&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),P.type=lo,ze=s.convert(P.type)),P.format===us&&k===6402&&(k=34041,P.type!==is&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),P.type=is,ze=s.convert(P.type))),U&&Q?t.texStorage2D(3553,1,k,le.width,le.height):t.texImage2D(3553,0,k,le.width,le.height,0,nt,ze,null);else if(P.isDataTexture)if(_e.length>0&&et){U&&Q&&t.texStorage2D(3553,ye,k,_e[0].width,_e[0].height);for(let de=0,Ie=_e.length;de<Ie;de++)we=_e[de],U?t.texSubImage2D(3553,de,0,0,we.width,we.height,nt,ze,we.data):t.texImage2D(3553,de,k,we.width,we.height,0,nt,ze,we.data);P.generateMipmaps=!1}else U?(Q&&t.texStorage2D(3553,ye,k,le.width,le.height),t.texSubImage2D(3553,0,0,0,le.width,le.height,nt,ze,le.data)):t.texImage2D(3553,0,k,le.width,le.height,0,nt,ze,le.data);else if(P.isCompressedTexture){U&&Q&&t.texStorage2D(3553,ye,k,_e[0].width,_e[0].height);for(let de=0,Ie=_e.length;de<Ie;de++)we=_e[de],P.format!==Nn?nt!==null?U?t.compressedTexSubImage2D(3553,de,0,0,we.width,we.height,nt,we.data):t.compressedTexImage2D(3553,de,k,we.width,we.height,0,we.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):U?t.texSubImage2D(3553,de,0,0,we.width,we.height,nt,ze,we.data):t.texImage2D(3553,de,k,we.width,we.height,0,nt,ze,we.data)}else if(P.isDataArrayTexture)U?(Q&&t.texStorage3D(35866,ye,k,le.width,le.height,le.depth),t.texSubImage3D(35866,0,0,0,0,le.width,le.height,le.depth,nt,ze,le.data)):t.texImage3D(35866,0,k,le.width,le.height,le.depth,0,nt,ze,le.data);else if(P.isData3DTexture)U?(Q&&t.texStorage3D(32879,ye,k,le.width,le.height,le.depth),t.texSubImage3D(32879,0,0,0,0,le.width,le.height,le.depth,nt,ze,le.data)):t.texImage3D(32879,0,k,le.width,le.height,le.depth,0,nt,ze,le.data);else if(P.isFramebufferTexture)U&&Q?t.texStorage2D(3553,ye,k,le.width,le.height):t.texImage2D(3553,0,k,le.width,le.height,0,nt,ze,null);else if(_e.length>0&&et){U&&Q&&t.texStorage2D(3553,ye,k,_e[0].width,_e[0].height);for(let de=0,Ie=_e.length;de<Ie;de++)we=_e[de],U?t.texSubImage2D(3553,de,0,0,nt,ze,we):t.texImage2D(3553,de,k,nt,ze,we);P.generateMipmaps=!1}else U?(Q&&t.texStorage2D(3553,ye,k,le.width,le.height),t.texSubImage2D(3553,0,0,0,nt,ze,le)):t.texImage2D(3553,0,k,nt,ze,le);L(P,et)&&D(ge),Ee.__currentVersion=Ee.version,P.onUpdate&&P.onUpdate(P)}O.__version=P.version}function je(O,P,te){if(P.image.length!==6)return;const ge=ot(O,P),be=P.source;if(t.activeTexture(33984+te),t.bindTexture(34067,O.__webglTexture),be.version!==be.__currentVersion||ge===!0){r.pixelStorei(37440,P.flipY),r.pixelStorei(37441,P.premultiplyAlpha),r.pixelStorei(3317,P.unpackAlignment),r.pixelStorei(37443,0);const Ee=P.isCompressedTexture||P.image[0].isCompressedTexture,ke=P.image[0]&&P.image[0].isDataTexture,le=[];for(let de=0;de<6;de++)!Ee&&!ke?le[de]=T(P.image[de],!1,!0,f):le[de]=ke?P.image[de].image:P.image[de],le[de]=vt(P,le[de]);const et=le[0],nt=b(et)||l,ze=s.convert(P.format,P.encoding),k=s.convert(P.type),we=N(P.internalFormat,ze,k,P.encoding),_e=l&&P.isVideoTexture!==!0,U=O.__version===void 0;let Q=q(P,et,nt);oe(34067,P,nt);let ye;if(Ee){_e&&U&&t.texStorage2D(34067,Q,we,et.width,et.height);for(let de=0;de<6;de++){ye=le[de].mipmaps;for(let Ie=0;Ie<ye.length;Ie++){const ut=ye[Ie];P.format!==Nn?ze!==null?_e?t.compressedTexSubImage2D(34069+de,Ie,0,0,ut.width,ut.height,ze,ut.data):t.compressedTexImage2D(34069+de,Ie,we,ut.width,ut.height,0,ut.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):_e?t.texSubImage2D(34069+de,Ie,0,0,ut.width,ut.height,ze,k,ut.data):t.texImage2D(34069+de,Ie,we,ut.width,ut.height,0,ze,k,ut.data)}}}else{ye=P.mipmaps,_e&&U&&(ye.length>0&&Q++,t.texStorage2D(34067,Q,we,le[0].width,le[0].height));for(let de=0;de<6;de++)if(ke){_e?t.texSubImage2D(34069+de,0,0,0,le[de].width,le[de].height,ze,k,le[de].data):t.texImage2D(34069+de,0,we,le[de].width,le[de].height,0,ze,k,le[de].data);for(let Ie=0;Ie<ye.length;Ie++){const Qe=ye[Ie].image[de].image;_e?t.texSubImage2D(34069+de,Ie+1,0,0,Qe.width,Qe.height,ze,k,Qe.data):t.texImage2D(34069+de,Ie+1,we,Qe.width,Qe.height,0,ze,k,Qe.data)}}else{_e?t.texSubImage2D(34069+de,0,0,0,ze,k,le[de]):t.texImage2D(34069+de,0,we,ze,k,le[de]);for(let Ie=0;Ie<ye.length;Ie++){const ut=ye[Ie];_e?t.texSubImage2D(34069+de,Ie+1,0,0,ze,k,ut.image[de]):t.texImage2D(34069+de,Ie+1,we,ze,k,ut.image[de])}}}L(P,nt)&&D(34067),be.__currentVersion=be.version,P.onUpdate&&P.onUpdate(P)}O.__version=P.version}function xe(O,P,te,ge,be){const Ee=s.convert(te.format,te.encoding),ke=s.convert(te.type),le=N(te.internalFormat,Ee,ke,te.encoding);n.get(P).__hasExternalTextures||(be===32879||be===35866?t.texImage3D(be,0,le,P.width,P.height,P.depth,0,Ee,ke,null):t.texImage2D(be,0,le,P.width,P.height,0,Ee,ke,null)),t.bindFramebuffer(36160,O),Oe(P)?d.framebufferTexture2DMultisampleEXT(36160,ge,be,n.get(te).__webglTexture,0,Ve(P)):r.framebufferTexture2D(36160,ge,be,n.get(te).__webglTexture,0),t.bindFramebuffer(36160,null)}function tt(O,P,te){if(r.bindRenderbuffer(36161,O),P.depthBuffer&&!P.stencilBuffer){let ge=33189;if(te||Oe(P)){const be=P.depthTexture;be&&be.isDepthTexture&&(be.type===ji?ge=36012:be.type===ha&&(ge=33190));const Ee=Ve(P);Oe(P)?d.renderbufferStorageMultisampleEXT(36161,Ee,ge,P.width,P.height):r.renderbufferStorageMultisample(36161,Ee,ge,P.width,P.height)}else r.renderbufferStorage(36161,ge,P.width,P.height);r.framebufferRenderbuffer(36160,36096,36161,O)}else if(P.depthBuffer&&P.stencilBuffer){const ge=Ve(P);te&&Oe(P)===!1?r.renderbufferStorageMultisample(36161,ge,35056,P.width,P.height):Oe(P)?d.renderbufferStorageMultisampleEXT(36161,ge,35056,P.width,P.height):r.renderbufferStorage(36161,34041,P.width,P.height),r.framebufferRenderbuffer(36160,33306,36161,O)}else{const ge=P.isWebGLMultipleRenderTargets===!0?P.texture[0]:P.texture,be=s.convert(ge.format,ge.encoding),Ee=s.convert(ge.type),ke=N(ge.internalFormat,be,Ee,ge.encoding),le=Ve(P);te&&Oe(P)===!1?r.renderbufferStorageMultisample(36161,le,ke,P.width,P.height):Oe(P)?d.renderbufferStorageMultisampleEXT(36161,le,ke,P.width,P.height):r.renderbufferStorage(36161,ke,P.width,P.height)}r.bindRenderbuffer(36161,null)}function ae(O,P){if(P&&P.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,O),!(P.depthTexture&&P.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(P.depthTexture).__webglTexture||P.depthTexture.image.width!==P.width||P.depthTexture.image.height!==P.height)&&(P.depthTexture.image.width=P.width,P.depthTexture.image.height=P.height,P.depthTexture.needsUpdate=!0),K(P.depthTexture,0);const ge=n.get(P.depthTexture).__webglTexture,be=Ve(P);if(P.depthTexture.format===wr)Oe(P)?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,ge,0,be):r.framebufferTexture2D(36160,36096,3553,ge,0);else if(P.depthTexture.format===us)Oe(P)?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,ge,0,be):r.framebufferTexture2D(36160,33306,3553,ge,0);else throw new Error("Unknown depthTexture format")}function ce(O){const P=n.get(O),te=O.isWebGLCubeRenderTarget===!0;if(O.depthTexture&&!P.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");ae(P.__webglFramebuffer,O)}else if(te){P.__webglDepthbuffer=[];for(let ge=0;ge<6;ge++)t.bindFramebuffer(36160,P.__webglFramebuffer[ge]),P.__webglDepthbuffer[ge]=r.createRenderbuffer(),tt(P.__webglDepthbuffer[ge],O,!1)}else t.bindFramebuffer(36160,P.__webglFramebuffer),P.__webglDepthbuffer=r.createRenderbuffer(),tt(P.__webglDepthbuffer,O,!1);t.bindFramebuffer(36160,null)}function me(O,P,te){const ge=n.get(O);P!==void 0&&xe(ge.__webglFramebuffer,O,O.texture,36064,3553),te!==void 0&&ce(O)}function Le(O){const P=O.texture,te=n.get(O),ge=n.get(P);O.addEventListener("dispose",z),O.isWebGLMultipleRenderTargets!==!0&&(ge.__webglTexture===void 0&&(ge.__webglTexture=r.createTexture()),ge.__version=P.version,a.memory.textures++);const be=O.isWebGLCubeRenderTarget===!0,Ee=O.isWebGLMultipleRenderTargets===!0,ke=b(O)||l;if(be){te.__webglFramebuffer=[];for(let le=0;le<6;le++)te.__webglFramebuffer[le]=r.createFramebuffer()}else if(te.__webglFramebuffer=r.createFramebuffer(),Ee)if(i.drawBuffers){const le=O.texture;for(let et=0,nt=le.length;et<nt;et++){const ze=n.get(le[et]);ze.__webglTexture===void 0&&(ze.__webglTexture=r.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(l&&O.samples>0&&Oe(O)===!1){te.__webglMultisampledFramebuffer=r.createFramebuffer(),te.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,te.__webglColorRenderbuffer);const le=s.convert(P.format,P.encoding),et=s.convert(P.type),nt=N(P.internalFormat,le,et,P.encoding),ze=Ve(O);r.renderbufferStorageMultisample(36161,ze,nt,O.width,O.height),t.bindFramebuffer(36160,te.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,te.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),O.depthBuffer&&(te.__webglDepthRenderbuffer=r.createRenderbuffer(),tt(te.__webglDepthRenderbuffer,O,!0)),t.bindFramebuffer(36160,null)}if(be){t.bindTexture(34067,ge.__webglTexture),oe(34067,P,ke);for(let le=0;le<6;le++)xe(te.__webglFramebuffer[le],O,P,36064,34069+le);L(P,ke)&&D(34067),t.unbindTexture()}else if(Ee){const le=O.texture;for(let et=0,nt=le.length;et<nt;et++){const ze=le[et],k=n.get(ze);t.bindTexture(3553,k.__webglTexture),oe(3553,ze,ke),xe(te.__webglFramebuffer,O,ze,36064+et,3553),L(ze,ke)&&D(3553)}t.unbindTexture()}else{let le=3553;(O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(l?le=O.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(le,ge.__webglTexture),oe(le,P,ke),xe(te.__webglFramebuffer,O,P,36064,le),L(P,ke)&&D(le),t.unbindTexture()}O.depthBuffer&&ce(O)}function ve(O){const P=b(O)||l,te=O.isWebGLMultipleRenderTargets===!0?O.texture:[O.texture];for(let ge=0,be=te.length;ge<be;ge++){const Ee=te[ge];if(L(Ee,P)){const ke=O.isWebGLCubeRenderTarget?34067:3553,le=n.get(Ee).__webglTexture;t.bindTexture(ke,le),D(ke),t.unbindTexture()}}}function Ze(O){if(l&&O.samples>0&&Oe(O)===!1){const P=O.width,te=O.height;let ge=16384;const be=[36064],Ee=O.stencilBuffer?33306:36096;O.depthBuffer&&be.push(Ee);const ke=n.get(O),le=ke.__ignoreDepthValues!==void 0?ke.__ignoreDepthValues:!1;le===!1&&(O.depthBuffer&&(ge|=256),O.stencilBuffer&&(ge|=1024)),t.bindFramebuffer(36008,ke.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,ke.__webglFramebuffer),le===!0&&(r.invalidateFramebuffer(36008,[Ee]),r.invalidateFramebuffer(36009,[Ee])),r.blitFramebuffer(0,0,P,te,0,0,P,te,ge,9728),m&&r.invalidateFramebuffer(36008,be),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,ke.__webglMultisampledFramebuffer)}}function Ve(O){return Math.min(g,O.samples)}function Oe(O){const P=n.get(O);return l&&O.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&P.__useRenderToTexture!==!1}function St(O){const P=a.render.frame;x.get(O)!==P&&(x.set(O,P),O.update())}function vt(O,P){const te=O.encoding,ge=O.format,be=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||O.format===Oc||te!==Kn&&(te===Tt?l===!1?e.has("EXT_sRGB")===!0&&ge===Nn?(O.format=Oc,O.minFilter=Gt,O.generateMipmaps=!1):P=Pr.sRGBToLinear(P):(ge!==Nn||be!==Er)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",te)),P}this.allocateTextureUnit=V,this.resetTextureUnits=ee,this.setTexture2D=K,this.setTexture2DArray=pe,this.setTexture3D=he,this.setTextureCube=Ce,this.rebindTextures=me,this.setupRenderTarget=Le,this.updateRenderTargetMipmap=ve,this.updateMultisampleRenderTarget=Ze,this.setupDepthRenderbuffer=ce,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=Oe}function Ey(r,e,t){const n=t.isWebGL2;function i(s,a=null){let l;if(s===Er)return 5121;if(s===F0)return 32819;if(s===O0)return 32820;if(s===I0)return 5120;if(s===z0)return 5122;if(s===lo)return 5123;if(s===N0)return 5124;if(s===ha)return 5125;if(s===ji)return 5126;if(s===ns)return n?5131:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(s===B0)return 6406;if(s===Nn)return 6408;if(s===k0)return 6409;if(s===H0)return 6410;if(s===wr)return 6402;if(s===us)return 34041;if(s===G0)return 6403;if(s===U0)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===Oc)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(s===V0)return 36244;if(s===W0)return 33319;if(s===q0)return 33320;if(s===X0)return 36249;if(s===Tc||s===Ac||s===Cc||s===Rc)if(a===Tt)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(s===Tc)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Ac)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Cc)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Rc)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(s===Tc)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Ac)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Cc)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Rc)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===af||s===lf||s===cf||s===uf)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(s===af)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===lf)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===cf)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===uf)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===j0)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===hf||s===ff)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(s===hf)return a===Tt?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(s===ff)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===df||s===pf||s===mf||s===gf||s===yf||s===xf||s===vf||s===_f||s===wf||s===Mf||s===Sf||s===bf||s===Ef||s===Tf)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(s===df)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===pf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===mf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===gf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===yf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===xf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===vf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===_f)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===wf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Mf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Sf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===bf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Ef)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Tf)return a===Tt?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Af)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(s===Af)return a===Tt?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===is)return n?34042:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}class Kf extends It{constructor(e=[]){super(),this.cameras=e}}Kf.prototype.isArrayCamera=!0;class es extends ht{constructor(){super(),this.type="Group"}}es.prototype.isGroup=!0;const Ub={type:"move"};class kh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new es,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 es,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new es,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const l=this._targetRay,u=this._grip,f=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(l!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(l.matrix.fromArray(i.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),i.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(i.linearVelocity)):l.hasLinearVelocity=!1,i.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(i.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(Ub))),f&&e.hand){a=!0;for(const y of e.hand.values()){const v=t.getJointPose(y,n);if(f.joints[y.jointName]===void 0){const S=new es;S.matrixAutoUpdate=!1,S.visible=!1,f.joints[y.jointName]=S,f.add(S)}const M=f.joints[y.jointName];v!==null&&(M.matrix.fromArray(v.transform.matrix),M.matrix.decompose(M.position,M.rotation,M.scale),M.jointRadius=v.radius),M.visible=v!==null}const p=f.joints["index-finger-tip"],g=f.joints["thumb-tip"],d=p.position.distanceTo(g.position),m=.02,x=.005;f.inputState.pinching&&d>m+x?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&d<=m-x&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));return l!==null&&(l.visible=i!==null),u!==null&&(u.visible=s!==null),f!==null&&(f.visible=a!==null),this}}class Qf extends Ut{constructor(e,t,n,i,s,a,l,u,f,p){if(p=p!==void 0?p:wr,p!==wr&&p!==us)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&p===wr&&(n=lo),n===void 0&&p===us&&(n=is),super(null,i,s,a,l,u,p,n,f),this.image={width:e,height:t},this.magFilter=l!==void 0?l:Zt,this.minFilter=u!==void 0?u:Zt,this.flipY=!1,this.generateMipmaps=!1}}Qf.prototype.isDepthTexture=!0;class kb extends Rr{constructor(e,t){super();const n=this;let i=null,s=1,a=null,l="local-floor",u=null,f=null,p=null,g=null,d=null;const m=t.getContextAttributes();let x=null,y=null;const v=[],M=new Map,S=new It;S.layers.enable(1),S.viewport=new wt;const T=new It;T.layers.enable(2),T.viewport=new wt;const b=[S,T],A=new Kf;A.layers.enable(1),A.layers.enable(2);let L=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let re=v[V];return re===void 0&&(re=new kh,v[V]=re),re.getTargetRaySpace()},this.getControllerGrip=function(V){let re=v[V];return re===void 0&&(re=new kh,v[V]=re),re.getGripSpace()},this.getHand=function(V){let re=v[V];return re===void 0&&(re=new kh,v[V]=re),re.getHandSpace()};function N(V){const re=M.get(V.inputSource);re&&re.dispatchEvent({type:V.type,data:V.inputSource})}function q(){M.forEach(function(V,re){V.disconnect(re)}),M.clear(),L=null,D=null,e.setRenderTarget(x),g=null,p=null,f=null,i=null,y=null,ee.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){s=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){l=V,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getBaseLayer=function(){return p!==null?p:g},this.getBinding=function(){return f},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(V){if(i=V,i!==null){if(x=e.getRenderTarget(),i.addEventListener("select",N),i.addEventListener("selectstart",N),i.addEventListener("selectend",N),i.addEventListener("squeeze",N),i.addEventListener("squeezestart",N),i.addEventListener("squeezeend",N),i.addEventListener("end",q),i.addEventListener("inputsourceschange",B),m.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const re={antialias:i.renderState.layers===void 0?m.antialias:!0,alpha:m.alpha,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(i,t,re),i.updateRenderState({baseLayer:g}),y=new Sn(g.framebufferWidth,g.framebufferHeight,{format:Nn,type:Er,encoding:e.outputEncoding})}else{let re=null,K=null,pe=null;m.depth&&(pe=m.stencil?35056:33190,re=m.stencil?us:wr,K=m.stencil?is:lo);const he={colorFormat:e.outputEncoding===Tt?35907:32856,depthFormat:pe,scaleFactor:s};f=new XRWebGLBinding(i,t),p=f.createProjectionLayer(he),i.updateRenderState({layers:[p]}),y=new Sn(p.textureWidth,p.textureHeight,{format:Nn,type:Er,depthTexture:new Qf(p.textureWidth,p.textureHeight,K,void 0,void 0,void 0,void 0,void 0,void 0,re),stencilBuffer:m.stencil,encoding:e.outputEncoding,samples:m.antialias?4:0});const Ce=e.properties.get(y);Ce.__ignoreDepthValues=p.ignoreDepthValues}y.isXRRenderTarget=!0,this.setFoveation(1),a=await i.requestReferenceSpace(l),ee.setContext(i),ee.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function B(V){const re=i.inputSources;for(let K=0;K<v.length;K++)M.set(re[K],v[K]);for(let K=0;K<V.removed.length;K++){const pe=V.removed[K],he=M.get(pe);he&&(he.dispatchEvent({type:"disconnected",data:pe}),M.delete(pe))}for(let K=0;K<V.added.length;K++){const pe=V.added[K],he=M.get(pe);he&&he.dispatchEvent({type:"connected",data:pe})}}const C=new R,z=new R;function J(V,re,K){C.setFromMatrixPosition(re.matrixWorld),z.setFromMatrixPosition(K.matrixWorld);const pe=C.distanceTo(z),he=re.projectionMatrix.elements,Ce=K.projectionMatrix.elements,Ue=he[14]/(he[10]-1),Be=he[14]/(he[10]+1),oe=(he[9]+1)/he[5],ot=(he[9]-1)/he[5],qe=(he[8]-1)/he[0],je=(Ce[8]+1)/Ce[0],xe=Ue*qe,tt=Ue*je,ae=pe/(-qe+je),ce=ae*-qe;re.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(ce),V.translateZ(ae),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const me=Ue+ae,Le=Be+ae,ve=xe-ce,Ze=tt+(pe-ce),Ve=oe*Be/Le*me,Oe=ot*Be/Le*me;V.projectionMatrix.makePerspective(ve,Ze,Ve,Oe,me,Le)}function W(V,re){re===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(re.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(i===null)return;A.near=T.near=S.near=V.near,A.far=T.far=S.far=V.far,(L!==A.near||D!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),L=A.near,D=A.far);const re=V.parent,K=A.cameras;W(A,re);for(let he=0;he<K.length;he++)W(K[he],re);A.matrixWorld.decompose(A.position,A.quaternion,A.scale),V.position.copy(A.position),V.quaternion.copy(A.quaternion),V.scale.copy(A.scale),V.matrix.copy(A.matrix),V.matrixWorld.copy(A.matrixWorld);const pe=V.children;for(let he=0,Ce=pe.length;he<Ce;he++)pe[he].updateMatrixWorld(!0);K.length===2?J(A,S,T):A.projectionMatrix.copy(S.projectionMatrix)},this.getCamera=function(){return A},this.getFoveation=function(){if(p!==null)return p.fixedFoveation;if(g!==null)return g.fixedFoveation},this.setFoveation=function(V){p!==null&&(p.fixedFoveation=V),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=V)};let Y=null;function X(V,re){if(u=re.getViewerPose(a),d=re,u!==null){const pe=u.views;g!==null&&(e.setRenderTargetFramebuffer(y,g.framebuffer),e.setRenderTarget(y));let he=!1;pe.length!==A.cameras.length&&(A.cameras.length=0,he=!0);for(let Ce=0;Ce<pe.length;Ce++){const Ue=pe[Ce];let Be=null;if(g!==null)Be=g.getViewport(Ue);else{const ot=f.getViewSubImage(p,Ue);Be=ot.viewport,Ce===0&&(e.setRenderTargetTextures(y,ot.colorTexture,p.ignoreDepthValues?void 0:ot.depthStencilTexture),e.setRenderTarget(y))}const oe=b[Ce];oe.matrix.fromArray(Ue.transform.matrix),oe.projectionMatrix.fromArray(Ue.projectionMatrix),oe.viewport.set(Be.x,Be.y,Be.width,Be.height),Ce===0&&A.matrix.copy(oe.matrix),he===!0&&A.cameras.push(oe)}}const K=i.inputSources;for(let pe=0;pe<v.length;pe++){const he=v[pe],Ce=K[pe];he.update(Ce,re,a)}Y&&Y(V,re),d=null}const ee=new gy;ee.setAnimationLoop(X),this.setAnimationLoop=function(V){Y=V},this.dispose=function(){}}}function Hb(r,e){function t(y,v){y.fogColor.value.copy(v.color),v.isFog?(y.fogNear.value=v.near,y.fogFar.value=v.far):v.isFogExp2&&(y.fogDensity.value=v.density)}function n(y,v,M,S,T){v.isMeshBasicMaterial||v.isMeshLambertMaterial?i(y,v):v.isMeshToonMaterial?(i(y,v),p(y,v)):v.isMeshPhongMaterial?(i(y,v),f(y,v)):v.isMeshStandardMaterial?(i(y,v),g(y,v),v.isMeshPhysicalMaterial&&d(y,v,T)):v.isMeshMatcapMaterial?(i(y,v),m(y,v)):v.isMeshDepthMaterial?i(y,v):v.isMeshDistanceMaterial?(i(y,v),x(y,v)):v.isMeshNormalMaterial?i(y,v):v.isLineBasicMaterial?(s(y,v),v.isLineDashedMaterial&&a(y,v)):v.isPointsMaterial?l(y,v,M,S):v.isSpriteMaterial?u(y,v):v.isShadowMaterial?(y.color.value.copy(v.color),y.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function i(y,v){y.opacity.value=v.opacity,v.color&&y.diffuse.value.copy(v.color),v.emissive&&y.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(y.map.value=v.map),v.alphaMap&&(y.alphaMap.value=v.alphaMap),v.bumpMap&&(y.bumpMap.value=v.bumpMap,y.bumpScale.value=v.bumpScale,v.side===Fn&&(y.bumpScale.value*=-1)),v.displacementMap&&(y.displacementMap.value=v.displacementMap,y.displacementScale.value=v.displacementScale,y.displacementBias.value=v.displacementBias),v.emissiveMap&&(y.emissiveMap.value=v.emissiveMap),v.normalMap&&(y.normalMap.value=v.normalMap,y.normalScale.value.copy(v.normalScale),v.side===Fn&&y.normalScale.value.negate()),v.specularMap&&(y.specularMap.value=v.specularMap),v.alphaTest>0&&(y.alphaTest.value=v.alphaTest);const M=e.get(v).envMap;if(M&&(y.envMap.value=M,y.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=v.reflectivity,y.ior.value=v.ior,y.refractionRatio.value=v.refractionRatio),v.lightMap){y.lightMap.value=v.lightMap;const b=r.physicallyCorrectLights!==!0?Math.PI:1;y.lightMapIntensity.value=v.lightMapIntensity*b}v.aoMap&&(y.aoMap.value=v.aoMap,y.aoMapIntensity.value=v.aoMapIntensity);let S;v.map?S=v.map:v.specularMap?S=v.specularMap:v.displacementMap?S=v.displacementMap:v.normalMap?S=v.normalMap:v.bumpMap?S=v.bumpMap:v.roughnessMap?S=v.roughnessMap:v.metalnessMap?S=v.metalnessMap:v.alphaMap?S=v.alphaMap:v.emissiveMap?S=v.emissiveMap:v.clearcoatMap?S=v.clearcoatMap:v.clearcoatNormalMap?S=v.clearcoatNormalMap:v.clearcoatRoughnessMap?S=v.clearcoatRoughnessMap:v.specularIntensityMap?S=v.specularIntensityMap:v.specularColorMap?S=v.specularColorMap:v.transmissionMap?S=v.transmissionMap:v.thicknessMap?S=v.thicknessMap:v.sheenColorMap?S=v.sheenColorMap:v.sheenRoughnessMap&&(S=v.sheenRoughnessMap),S!==void 0&&(S.isWebGLRenderTarget&&(S=S.texture),S.matrixAutoUpdate===!0&&S.updateMatrix(),y.uvTransform.value.copy(S.matrix));let T;v.aoMap?T=v.aoMap:v.lightMap&&(T=v.lightMap),T!==void 0&&(T.isWebGLRenderTarget&&(T=T.texture),T.matrixAutoUpdate===!0&&T.updateMatrix(),y.uv2Transform.value.copy(T.matrix))}function s(y,v){y.diffuse.value.copy(v.color),y.opacity.value=v.opacity}function a(y,v){y.dashSize.value=v.dashSize,y.totalSize.value=v.dashSize+v.gapSize,y.scale.value=v.scale}function l(y,v,M,S){y.diffuse.value.copy(v.color),y.opacity.value=v.opacity,y.size.value=v.size*M,y.scale.value=S*.5,v.map&&(y.map.value=v.map),v.alphaMap&&(y.alphaMap.value=v.alphaMap),v.alphaTest>0&&(y.alphaTest.value=v.alphaTest);let T;v.map?T=v.map:v.alphaMap&&(T=v.alphaMap),T!==void 0&&(T.matrixAutoUpdate===!0&&T.updateMatrix(),y.uvTransform.value.copy(T.matrix))}function u(y,v){y.diffuse.value.copy(v.color),y.opacity.value=v.opacity,y.rotation.value=v.rotation,v.map&&(y.map.value=v.map),v.alphaMap&&(y.alphaMap.value=v.alphaMap),v.alphaTest>0&&(y.alphaTest.value=v.alphaTest);let M;v.map?M=v.map:v.alphaMap&&(M=v.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),y.uvTransform.value.copy(M.matrix))}function f(y,v){y.specular.value.copy(v.specular),y.shininess.value=Math.max(v.shininess,1e-4)}function p(y,v){v.gradientMap&&(y.gradientMap.value=v.gradientMap)}function g(y,v){y.roughness.value=v.roughness,y.metalness.value=v.metalness,v.roughnessMap&&(y.roughnessMap.value=v.roughnessMap),v.metalnessMap&&(y.metalnessMap.value=v.metalnessMap),e.get(v).envMap&&(y.envMapIntensity.value=v.envMapIntensity)}function d(y,v,M){y.ior.value=v.ior,v.sheen>0&&(y.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),y.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(y.sheenColorMap.value=v.sheenColorMap),v.sheenRoughnessMap&&(y.sheenRoughnessMap.value=v.sheenRoughnessMap)),v.clearcoat>0&&(y.clearcoat.value=v.clearcoat,y.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(y.clearcoatMap.value=v.clearcoatMap),v.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap),v.clearcoatNormalMap&&(y.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),y.clearcoatNormalMap.value=v.clearcoatNormalMap,v.side===Fn&&y.clearcoatNormalScale.value.negate())),v.transmission>0&&(y.transmission.value=v.transmission,y.transmissionSamplerMap.value=M.texture,y.transmissionSamplerSize.value.set(M.width,M.height),v.transmissionMap&&(y.transmissionMap.value=v.transmissionMap),y.thickness.value=v.thickness,v.thicknessMap&&(y.thicknessMap.value=v.thicknessMap),y.attenuationDistance.value=v.attenuationDistance,y.attenuationColor.value.copy(v.attenuationColor)),y.specularIntensity.value=v.specularIntensity,y.specularColor.value.copy(v.specularColor),v.specularIntensityMap&&(y.specularIntensityMap.value=v.specularIntensityMap),v.specularColorMap&&(y.specularColorMap.value=v.specularColorMap)}function m(y,v){v.matcap&&(y.matcap.value=v.matcap)}function x(y,v){y.referencePosition.value.copy(v.referencePosition),y.nearDistance.value=v.nearDistance,y.farDistance.value=v.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function Gb(){const r=Sa("canvas");return r.style.display="block",r}function Mt(r={}){const e=r.canvas!==void 0?r.canvas:Gb(),t=r.context!==void 0?r.context:null,n=r.depth!==void 0?r.depth:!0,i=r.stencil!==void 0?r.stencil:!0,s=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,u=r.powerPreference!==void 0?r.powerPreference:"default",f=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1;let p;r.context!==void 0?p=t.getContextAttributes().alpha:p=r.alpha!==void 0?r.alpha:!1;let g=null,d=null;const m=[],x=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Kn,this.physicallyCorrectLights=!1,this.toneMapping=hi,this.toneMappingExposure=1;const y=this;let v=!1,M=0,S=0,T=null,b=-1,A=null;const L=new wt,D=new wt;let N=null,q=e.width,B=e.height,C=1,z=null,J=null;const W=new wt(0,0,q,B),Y=new wt(0,0,q,B);let X=!1;const ee=new Fa;let V=!1,re=!1,K=null;const pe=new Fe,he=new ue,Ce=new R,Ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return T===null?C:1}let oe=t;function ot(I,Z){for(let ne=0;ne<I.length;ne++){const $=I[ne],fe=e.getContext($,Z);if(fe!==null)return fe}return null}try{const I={alpha:!0,depth:n,stencil:i,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Vc}`),e.addEventListener("webglcontextlost",k,!1),e.addEventListener("webglcontextrestored",we,!1),oe===null){const Z=["webgl2","webgl","experimental-webgl"];if(y.isWebGL1Renderer===!0&&Z.shift(),oe=ot(Z,I),oe===null)throw ot(Z)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}oe.getShaderPrecisionFormat===void 0&&(oe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let qe,je,xe,tt,ae,ce,me,Le,ve,Ze,Ve,Oe,St,vt,O,P,te,ge,be,Ee,ke,le,et;function nt(){qe=new a1(oe),je=new t1(oe,qe,r),qe.init(je),le=new Ey(oe,qe,je),xe=new Ob(oe,qe,je),tt=new u1,ae=new Tb,ce=new Bb(oe,qe,xe,ae,je,le,tt),me=new i1(y),Le=new o1(y),ve=new bw(oe,je),et=new $S(oe,qe,ve,je),Ze=new l1(oe,ve,tt,et),Ve=new p1(oe,Ze,ve,tt),be=new d1(oe,je,ce),P=new n1(ae),Oe=new Eb(y,me,Le,qe,je,et,P),St=new Hb(y,ae),vt=new Cb,O=new zb(qe,je),ge=new QS(y,me,xe,Ve,p,a),te=new by(y,Ve,je),Ee=new e1(oe,qe,tt,je),ke=new c1(oe,qe,tt,je),tt.programs=Oe.programs,y.capabilities=je,y.extensions=qe,y.properties=ae,y.renderLists=vt,y.shadowMap=te,y.state=xe,y.info=tt}nt();const ze=new kb(y,oe);this.xr=ze,this.getContext=function(){return oe},this.getContextAttributes=function(){return oe.getContextAttributes()},this.forceContextLoss=function(){const I=qe.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=qe.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(I){I!==void 0&&(C=I,this.setSize(q,B,!1))},this.getSize=function(I){return I.set(q,B)},this.setSize=function(I,Z,ne){if(ze.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=I,B=Z,e.width=Math.floor(I*C),e.height=Math.floor(Z*C),ne!==!1&&(e.style.width=I+"px",e.style.height=Z+"px"),this.setViewport(0,0,I,Z)},this.getDrawingBufferSize=function(I){return I.set(q*C,B*C).floor()},this.setDrawingBufferSize=function(I,Z,ne){q=I,B=Z,C=ne,e.width=Math.floor(I*ne),e.height=Math.floor(Z*ne),this.setViewport(0,0,I,Z)},this.getCurrentViewport=function(I){return I.copy(L)},this.getViewport=function(I){return I.copy(W)},this.setViewport=function(I,Z,ne,$){I.isVector4?W.set(I.x,I.y,I.z,I.w):W.set(I,Z,ne,$),xe.viewport(L.copy(W).multiplyScalar(C).floor())},this.getScissor=function(I){return I.copy(Y)},this.setScissor=function(I,Z,ne,$){I.isVector4?Y.set(I.x,I.y,I.z,I.w):Y.set(I,Z,ne,$),xe.scissor(D.copy(Y).multiplyScalar(C).floor())},this.getScissorTest=function(){return X},this.setScissorTest=function(I){xe.setScissorTest(X=I)},this.setOpaqueSort=function(I){z=I},this.setTransparentSort=function(I){J=I},this.getClearColor=function(I){return I.copy(ge.getClearColor())},this.setClearColor=function(){ge.setClearColor.apply(ge,arguments)},this.getClearAlpha=function(){return ge.getClearAlpha()},this.setClearAlpha=function(){ge.setClearAlpha.apply(ge,arguments)},this.clear=function(I=!0,Z=!0,ne=!0){let $=0;I&&($|=16384),Z&&($|=256),ne&&($|=1024),oe.clear($)},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",k,!1),e.removeEventListener("webglcontextrestored",we,!1),vt.dispose(),O.dispose(),ae.dispose(),me.dispose(),Le.dispose(),Ve.dispose(),et.dispose(),Oe.dispose(),ze.dispose(),ze.removeEventListener("sessionstart",Ie),ze.removeEventListener("sessionend",ut),K&&(K.dispose(),K=null),Qe.stop()};function k(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function we(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const I=tt.autoReset,Z=te.enabled,ne=te.autoUpdate,$=te.needsUpdate,fe=te.type;nt(),tt.autoReset=I,te.enabled=Z,te.autoUpdate=ne,te.needsUpdate=$,te.type=fe}function _e(I){const Z=I.target;Z.removeEventListener("dispose",_e),U(Z)}function U(I){Q(I),ae.remove(I)}function Q(I){const Z=ae.get(I).programs;Z!==void 0&&(Z.forEach(function(ne){Oe.releaseProgram(ne)}),I.isShaderMaterial&&Oe.releaseShaderCache(I))}this.renderBufferDirect=function(I,Z,ne,$,fe,Je){Z===null&&(Z=Ue);const it=fe.isMesh&&fe.matrixWorld.determinant()<0,at=Ri(I,Z,ne,$,fe);xe.setMaterial($,it);let st=ne.index;const yt=ne.attributes.position;if(st===null){if(yt===void 0||yt.count===0)return}else if(st.count===0)return;let dt=1;$.wireframe===!0&&(st=Ze.getWireframeAttribute(ne),dt=2),et.setup(fe,$,at,ne,st);let ft,bt=Ee;st!==null&&(ft=ve.get(st),bt=ke,bt.setIndex(ft));const $n=st!==null?st.count:yt.count,ei=ne.drawRange.start*dt,yi=ne.drawRange.count*dt,on=Je!==null?Je.start*dt:0,lt=Je!==null?Je.count*dt:1/0,xt=Math.max(ei,on),rt=Math.min($n,ei+yi,on+lt)-1,Qt=Math.max(0,rt-xt+1);if(Qt!==0){if(fe.isMesh)$.wireframe===!0?(xe.setLineWidth($.wireframeLinewidth*Be()),bt.setMode(1)):bt.setMode(4);else if(fe.isLine){let Pt=$.linewidth;Pt===void 0&&(Pt=1),xe.setLineWidth(Pt*Be()),fe.isLineSegments?bt.setMode(1):fe.isLineLoop?bt.setMode(2):bt.setMode(3)}else fe.isPoints?bt.setMode(0):fe.isSprite&&bt.setMode(4);if(fe.isInstancedMesh)bt.renderInstances(xt,Qt,fe.count);else if(ne.isInstancedBufferGeometry){const Pt=Math.min(ne.instanceCount,ne._maxInstanceCount);bt.renderInstances(xt,Qt,Pt)}else bt.render(xt,Qt)}},this.compile=function(I,Z){d=O.get(I),d.init(),x.push(d),I.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Z.layers)&&(d.pushLight(ne),ne.castShadow&&d.pushShadow(ne))}),d.setupLights(y.physicallyCorrectLights),I.traverse(function(ne){const $=ne.material;if($)if(Array.isArray($))for(let fe=0;fe<$.length;fe++){const Je=$[fe];kn(Je,I,ne)}else kn($,I,ne)}),x.pop(),d=null};let ye=null;function de(I){ye&&ye(I)}function Ie(){Qe.stop()}function ut(){Qe.start()}const Qe=new gy;Qe.setAnimationLoop(de),typeof self<"u"&&Qe.setContext(self),this.setAnimationLoop=function(I){ye=I,ze.setAnimationLoop(I),I===null?Qe.stop():Qe.start()},ze.addEventListener("sessionstart",Ie),ze.addEventListener("sessionend",ut),this.render=function(I,Z){if(Z!==void 0&&Z.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;I.autoUpdate===!0&&I.updateMatrixWorld(),Z.parent===null&&Z.updateMatrixWorld(),ze.enabled===!0&&ze.isPresenting===!0&&(ze.cameraAutoUpdate===!0&&ze.updateCamera(Z),Z=ze.getCamera()),I.isScene===!0&&I.onBeforeRender(y,I,Z,T),d=O.get(I,x.length),d.init(),x.push(d),pe.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),ee.setFromProjectionMatrix(pe),re=this.localClippingEnabled,V=P.init(this.clippingPlanes,re,Z),g=vt.get(I,m.length),g.init(),m.push(g),Ln(I,Z,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(z,J),V===!0&&P.beginShadows();const ne=d.state.shadowsArray;if(te.render(ne,I,Z),V===!0&&P.endShadows(),this.info.autoReset===!0&&this.info.reset(),ge.render(g,I),d.setupLights(y.physicallyCorrectLights),Z.isArrayCamera){const $=Z.cameras;for(let fe=0,Je=$.length;fe<Je;fe++){const it=$[fe];yn(g,I,it,it.viewport)}}else yn(g,I,Z);T!==null&&(ce.updateMultisampleRenderTarget(T),ce.updateRenderTargetMipmap(T)),I.isScene===!0&&I.onAfterRender(y,I,Z),et.resetDefaultState(),b=-1,A=null,x.pop(),x.length>0?d=x[x.length-1]:d=null,m.pop(),m.length>0?g=m[m.length-1]:g=null};function Ln(I,Z,ne,$){if(I.visible===!1)return;if(I.layers.test(Z.layers)){if(I.isGroup)ne=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(Z);else if(I.isLight)d.pushLight(I),I.castShadow&&d.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||ee.intersectsSprite(I)){$&&Ce.setFromMatrixPosition(I.matrixWorld).applyMatrix4(pe);const it=Ve.update(I),at=I.material;at.visible&&g.push(I,it,at,ne,Ce.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(I.isSkinnedMesh&&I.skeleton.frame!==tt.render.frame&&(I.skeleton.update(),I.skeleton.frame=tt.render.frame),!I.frustumCulled||ee.intersectsObject(I))){$&&Ce.setFromMatrixPosition(I.matrixWorld).applyMatrix4(pe);const it=Ve.update(I),at=I.material;if(Array.isArray(at)){const st=it.groups;for(let yt=0,dt=st.length;yt<dt;yt++){const ft=st[yt],bt=at[ft.materialIndex];bt&&bt.visible&&g.push(I,it,bt,ne,Ce.z,ft)}}else at.visible&&g.push(I,it,at,ne,Ce.z,null)}}const Je=I.children;for(let it=0,at=Je.length;it<at;it++)Ln(Je[it],Z,ne,$)}function yn(I,Z,ne,$){const fe=I.opaque,Je=I.transmissive,it=I.transparent;d.setupLightsView(ne),Je.length>0&&xn(fe,Z,ne),$&&xe.viewport(L.copy($)),fe.length>0&&fn(fe,Z,ne),Je.length>0&&fn(Je,Z,ne),it.length>0&&fn(it,Z,ne),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1)}function xn(I,Z,ne){const $=je.isWebGL2;K===null&&(K=new Sn(1,1,{generateMipmaps:!0,type:le.convert(ns)!==null?ns:Er,minFilter:vs,samples:$&&s===!0?4:0})),y.getDrawingBufferSize(he),$?K.setSize(he.x,he.y):K.setSize(Bc(he.x),Bc(he.y));const fe=y.getRenderTarget();y.setRenderTarget(K),y.clear();const Je=y.toneMapping;y.toneMapping=hi,fn(I,Z,ne),y.toneMapping=Je,ce.updateMultisampleRenderTarget(K),ce.updateRenderTargetMipmap(K),y.setRenderTarget(fe)}function fn(I,Z,ne){const $=Z.isScene===!0?Z.overrideMaterial:null;for(let fe=0,Je=I.length;fe<Je;fe++){const it=I[fe],at=it.object,st=it.geometry,yt=$===null?it.material:$,dt=it.group;at.layers.test(ne.layers)&&mi(at,Z,ne,st,yt,dt)}}function mi(I,Z,ne,$,fe,Je){I.onBeforeRender(y,Z,ne,$,fe,Je),I.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),fe.onBeforeRender(y,Z,ne,$,I,Je),fe.transparent===!0&&fe.side===cs?(fe.side=Fn,fe.needsUpdate=!0,y.renderBufferDirect(ne,Z,$,fe,I,Je),fe.side=ls,fe.needsUpdate=!0,y.renderBufferDirect(ne,Z,$,fe,I,Je),fe.side=cs):y.renderBufferDirect(ne,Z,$,fe,I,Je),I.onAfterRender(y,Z,ne,$,fe,Je)}function kn(I,Z,ne){Z.isScene!==!0&&(Z=Ue);const $=ae.get(I),fe=d.state.lights,Je=d.state.shadowsArray,it=fe.state.version,at=Oe.getParameters(I,fe.state,Je,Z,ne),st=Oe.getProgramCacheKey(at);let yt=$.programs;$.environment=I.isMeshStandardMaterial?Z.environment:null,$.fog=Z.fog,$.envMap=(I.isMeshStandardMaterial?Le:me).get(I.envMap||$.environment),yt===void 0&&(I.addEventListener("dispose",_e),yt=new Map,$.programs=yt);let dt=yt.get(st);if(dt!==void 0){if($.currentProgram===dt&&$.lightsStateVersion===it)return gi(I,at),dt}else at.uniforms=Oe.getUniforms(I),I.onBuild(ne,at,y),I.onBeforeCompile(at,y),dt=Oe.acquireProgram(at,st),yt.set(st,dt),$.uniforms=at.uniforms;const ft=$.uniforms;(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(ft.clippingPlanes=P.uniform),gi(I,at),$.needsLights=Xa(I),$.lightsStateVersion=it,$.needsLights&&(ft.ambientLightColor.value=fe.state.ambient,ft.lightProbe.value=fe.state.probe,ft.directionalLights.value=fe.state.directional,ft.directionalLightShadows.value=fe.state.directionalShadow,ft.spotLights.value=fe.state.spot,ft.spotLightShadows.value=fe.state.spotShadow,ft.rectAreaLights.value=fe.state.rectArea,ft.ltc_1.value=fe.state.rectAreaLTC1,ft.ltc_2.value=fe.state.rectAreaLTC2,ft.pointLights.value=fe.state.point,ft.pointLightShadows.value=fe.state.pointShadow,ft.hemisphereLights.value=fe.state.hemi,ft.directionalShadowMap.value=fe.state.directionalShadowMap,ft.directionalShadowMatrix.value=fe.state.directionalShadowMatrix,ft.spotShadowMap.value=fe.state.spotShadowMap,ft.spotShadowMatrix.value=fe.state.spotShadowMatrix,ft.pointShadowMap.value=fe.state.pointShadowMap,ft.pointShadowMatrix.value=fe.state.pointShadowMatrix);const bt=dt.getUniforms(),$n=Mr.seqWithValue(bt.seq,ft);return $.currentProgram=dt,$.uniformsList=$n,dt}function gi(I,Z){const ne=ae.get(I);ne.outputEncoding=Z.outputEncoding,ne.instancing=Z.instancing,ne.skinning=Z.skinning,ne.morphTargets=Z.morphTargets,ne.morphNormals=Z.morphNormals,ne.morphColors=Z.morphColors,ne.morphTargetsCount=Z.morphTargetsCount,ne.numClippingPlanes=Z.numClippingPlanes,ne.numIntersection=Z.numClipIntersection,ne.vertexAlphas=Z.vertexAlphas,ne.vertexTangents=Z.vertexTangents,ne.toneMapping=Z.toneMapping}function Ri(I,Z,ne,$,fe){Z.isScene!==!0&&(Z=Ue),ce.resetTextureUnits();const Je=Z.fog,it=$.isMeshStandardMaterial?Z.environment:null,at=T===null?y.outputEncoding:T.isXRRenderTarget===!0?T.texture.encoding:Kn,st=($.isMeshStandardMaterial?Le:me).get($.envMap||it),yt=$.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,dt=!!$.normalMap&&!!ne.attributes.tangent,ft=!!ne.morphAttributes.position,bt=!!ne.morphAttributes.normal,$n=!!ne.morphAttributes.color,ei=$.toneMapped?y.toneMapping:hi,yi=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,on=yi!==void 0?yi.length:0,lt=ae.get($),xt=d.state.lights;if(V===!0&&(re===!0||I!==A)){const Tn=I===A&&$.id===b;P.setState($,I,Tn)}let rt=!1;$.version===lt.__version?(lt.needsLights&<.lightsStateVersion!==xt.state.version||lt.outputEncoding!==at||fe.isInstancedMesh&<.instancing===!1||!fe.isInstancedMesh&<.instancing===!0||fe.isSkinnedMesh&<.skinning===!1||!fe.isSkinnedMesh&<.skinning===!0||lt.envMap!==st||$.fog&<.fog!==Je||lt.numClippingPlanes!==void 0&&(lt.numClippingPlanes!==P.numPlanes||lt.numIntersection!==P.numIntersection)||lt.vertexAlphas!==yt||lt.vertexTangents!==dt||lt.morphTargets!==ft||lt.morphNormals!==bt||lt.morphColors!==$n||lt.toneMapping!==ei||je.isWebGL2===!0&<.morphTargetsCount!==on)&&(rt=!0):(rt=!0,lt.__version=$.version);let Qt=lt.currentProgram;rt===!0&&(Qt=kn($,Z,fe));let Pt=!1,Xt=!1,ti=!1;const zt=Qt.getUniforms(),jt=lt.uniforms;if(xe.useProgram(Qt.program)&&(Pt=!0,Xt=!0,ti=!0),$.id!==b&&(b=$.id,Xt=!0),Pt||A!==I){if(zt.setValue(oe,"projectionMatrix",I.projectionMatrix),je.logarithmicDepthBuffer&&zt.setValue(oe,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),A!==I&&(A=I,Xt=!0,ti=!0),$.isShaderMaterial||$.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshStandardMaterial||$.envMap){const Tn=zt.map.cameraPosition;Tn!==void 0&&Tn.setValue(oe,Ce.setFromMatrixPosition(I.matrixWorld))}($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial)&&zt.setValue(oe,"isOrthographic",I.isOrthographicCamera===!0),($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial||$.isShadowMaterial||fe.isSkinnedMesh)&&zt.setValue(oe,"viewMatrix",I.matrixWorldInverse)}if(fe.isSkinnedMesh){zt.setOptional(oe,fe,"bindMatrix"),zt.setOptional(oe,fe,"bindMatrixInverse");const Tn=fe.skeleton;Tn&&(je.floatVertexTextures?(Tn.boneTexture===null&&Tn.computeBoneTexture(),zt.setValue(oe,"boneTexture",Tn.boneTexture,ce),zt.setValue(oe,"boneTextureSize",Tn.boneTextureSize)):zt.setOptional(oe,Tn,"boneMatrices"))}const er=ne.morphAttributes;return(er.position!==void 0||er.normal!==void 0||er.color!==void 0&&je.isWebGL2===!0)&&be.update(fe,ne,$,Qt),(Xt||lt.receiveShadow!==fe.receiveShadow)&&(lt.receiveShadow=fe.receiveShadow,zt.setValue(oe,"receiveShadow",fe.receiveShadow)),Xt&&(zt.setValue(oe,"toneMappingExposure",y.toneMappingExposure),lt.needsLights&&qa(jt,ti),Je&&$.fog&&St.refreshFogUniforms(jt,Je),St.refreshMaterialUniforms(jt,$,C,B,K),Mr.upload(oe,lt.uniformsList,jt,ce)),$.isShaderMaterial&&$.uniformsNeedUpdate===!0&&(Mr.upload(oe,lt.uniformsList,jt,ce),$.uniformsNeedUpdate=!1),$.isSpriteMaterial&&zt.setValue(oe,"center",fe.center),zt.setValue(oe,"modelViewMatrix",fe.modelViewMatrix),zt.setValue(oe,"normalMatrix",fe.normalMatrix),zt.setValue(oe,"modelMatrix",fe.matrixWorld),Qt}function qa(I,Z){I.ambientLightColor.needsUpdate=Z,I.lightProbe.needsUpdate=Z,I.directionalLights.needsUpdate=Z,I.directionalLightShadows.needsUpdate=Z,I.pointLights.needsUpdate=Z,I.pointLightShadows.needsUpdate=Z,I.spotLights.needsUpdate=Z,I.spotLightShadows.needsUpdate=Z,I.rectAreaLights.needsUpdate=Z,I.hemisphereLights.needsUpdate=Z}function Xa(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(I,Z,ne){ae.get(I.texture).__webglTexture=Z,ae.get(I.depthTexture).__webglTexture=ne;const $=ae.get(I);$.__hasExternalTextures=!0,$.__hasExternalTextures&&($.__autoAllocateDepthBuffer=ne===void 0,$.__autoAllocateDepthBuffer||qe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),$.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(I,Z){const ne=ae.get(I);ne.__webglFramebuffer=Z,ne.__useDefaultFramebuffer=Z===void 0},this.setRenderTarget=function(I,Z=0,ne=0){T=I,M=Z,S=ne;let $=!0;if(I){const st=ae.get(I);st.__useDefaultFramebuffer!==void 0?(xe.bindFramebuffer(36160,null),$=!1):st.__webglFramebuffer===void 0?ce.setupRenderTarget(I):st.__hasExternalTextures&&ce.rebindTextures(I,ae.get(I.texture).__webglTexture,ae.get(I.depthTexture).__webglTexture)}let fe=null,Je=!1,it=!1;if(I){const st=I.texture;(st.isData3DTexture||st.isDataArrayTexture)&&(it=!0);const yt=ae.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(fe=yt[Z],Je=!0):je.isWebGL2&&I.samples>0&&ce.useMultisampledRTT(I)===!1?fe=ae.get(I).__webglMultisampledFramebuffer:fe=yt,L.copy(I.viewport),D.copy(I.scissor),N=I.scissorTest}else L.copy(W).multiplyScalar(C).floor(),D.copy(Y).multiplyScalar(C).floor(),N=X;if(xe.bindFramebuffer(36160,fe)&&je.drawBuffers&&$&&xe.drawBuffers(I,fe),xe.viewport(L),xe.scissor(D),xe.setScissorTest(N),Je){const st=ae.get(I.texture);oe.framebufferTexture2D(36160,36064,34069+Z,st.__webglTexture,ne)}else if(it){const st=ae.get(I.texture),yt=Z||0;oe.framebufferTextureLayer(36160,36064,st.__webglTexture,ne||0,yt)}b=-1},this.readRenderTargetPixels=function(I,Z,ne,$,fe,Je,it){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let at=ae.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&it!==void 0&&(at=at[it]),at){xe.bindFramebuffer(36160,at);try{const st=I.texture,yt=st.format,dt=st.type;if(yt!==Nn&&le.convert(yt)!==oe.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ft=dt===ns&&(qe.has("EXT_color_buffer_half_float")||je.isWebGL2&&qe.has("EXT_color_buffer_float"));if(dt!==Er&&le.convert(dt)!==oe.getParameter(35738)&&!(dt===ji&&(je.isWebGL2||qe.has("OES_texture_float")||qe.has("WEBGL_color_buffer_float")))&&!ft){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Z>=0&&Z<=I.width-$&&ne>=0&&ne<=I.height-fe&&oe.readPixels(Z,ne,$,fe,le.convert(yt),le.convert(dt),Je)}finally{const st=T!==null?ae.get(T).__webglFramebuffer:null;xe.bindFramebuffer(36160,st)}}},this.copyFramebufferToTexture=function(I,Z,ne=0){if(Z.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}const $=Math.pow(2,-ne),fe=Math.floor(Z.image.width*$),Je=Math.floor(Z.image.height*$);ce.setTexture2D(Z,0),oe.copyTexSubImage2D(3553,ne,0,0,I.x,I.y,fe,Je),xe.unbindTexture()},this.copyTextureToTexture=function(I,Z,ne,$=0){const fe=Z.image.width,Je=Z.image.height,it=le.convert(ne.format),at=le.convert(ne.type);ce.setTexture2D(ne,0),oe.pixelStorei(37440,ne.flipY),oe.pixelStorei(37441,ne.premultiplyAlpha),oe.pixelStorei(3317,ne.unpackAlignment),Z.isDataTexture?oe.texSubImage2D(3553,$,I.x,I.y,fe,Je,it,at,Z.image.data):Z.isCompressedTexture?oe.compressedTexSubImage2D(3553,$,I.x,I.y,Z.mipmaps[0].width,Z.mipmaps[0].height,it,Z.mipmaps[0].data):oe.texSubImage2D(3553,$,I.x,I.y,it,at,Z.image),$===0&&ne.generateMipmaps&&oe.generateMipmap(3553),xe.unbindTexture()},this.copyTextureToTexture3D=function(I,Z,ne,$,fe=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Je=I.max.x-I.min.x+1,it=I.max.y-I.min.y+1,at=I.max.z-I.min.z+1,st=le.convert($.format),yt=le.convert($.type);let dt;if($.isData3DTexture)ce.setTexture3D($,0),dt=32879;else if($.isDataArrayTexture)ce.setTexture2DArray($,0),dt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}oe.pixelStorei(37440,$.flipY),oe.pixelStorei(37441,$.premultiplyAlpha),oe.pixelStorei(3317,$.unpackAlignment);const ft=oe.getParameter(3314),bt=oe.getParameter(32878),$n=oe.getParameter(3316),ei=oe.getParameter(3315),yi=oe.getParameter(32877),on=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;oe.pixelStorei(3314,on.width),oe.pixelStorei(32878,on.height),oe.pixelStorei(3316,I.min.x),oe.pixelStorei(3315,I.min.y),oe.pixelStorei(32877,I.min.z),ne.isDataTexture||ne.isData3DTexture?oe.texSubImage3D(dt,fe,Z.x,Z.y,Z.z,Je,it,at,st,yt,on.data):ne.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),oe.compressedTexSubImage3D(dt,fe,Z.x,Z.y,Z.z,Je,it,at,st,on.data)):oe.texSubImage3D(dt,fe,Z.x,Z.y,Z.z,Je,it,at,st,yt,on),oe.pixelStorei(3314,ft),oe.pixelStorei(32878,bt),oe.pixelStorei(3316,$n),oe.pixelStorei(3315,ei),oe.pixelStorei(32877,yi),fe===0&&$.generateMipmaps&&oe.generateMipmap(dt),xe.unbindTexture()},this.initTexture=function(I){ce.setTexture2D(I,0),xe.unbindTexture()},this.resetState=function(){M=0,S=0,T=null,xe.reset(),et.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Mt.prototype.isWebGLRenderer=!0;class Ty extends Mt{}Ty.prototype.isWebGL1Renderer=!0;class Oa{constructor(e,t=25e-5){this.name="",this.color=new Ae(e),this.density=t}clone(){return new Oa(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Oa.prototype.isFogExp2=!0;class Ba{constructor(e,t=1,n=1e3){this.name="",this.color=new Ae(e),this.near=t,this.far=n}clone(){return new Ba(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Ba.prototype.isFog=!0;class Ua extends ht{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}Ua.prototype.isScene=!0;class ws{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=co,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=On()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=On()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=On()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}ws.prototype.isInterleavedBuffer=!0;const _n=new R;class Tr{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)_n.fromBufferAttribute(this,t),_n.applyMatrix4(e),this.setXYZ(t,_n.x,_n.y,_n.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)_n.fromBufferAttribute(this,t),_n.applyNormalMatrix(e),this.setXYZ(t,_n.x,_n.y,_n.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)_n.fromBufferAttribute(this,t),_n.transformDirection(e),this.setXYZ(t,_n.x,_n.y,_n.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new mt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Tr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}Tr.prototype.isInterleavedBufferAttribute=!0;class $c extends qt{constructor(e){super(),this.type="SpriteMaterial",this.color=new Ae(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}$c.prototype.isSpriteMaterial=!0;let $s;const ra=new R,eo=new R,to=new R,no=new ue,sa=new ue,Ay=new Fe,nc=new R,oa=new R,ic=new R,$m=new ue,Hh=new ue,eg=new ue;class eu extends ht{constructor(e){if(super(),this.type="Sprite",$s===void 0){$s=new Ye;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new ws(t,5);$s.setIndex([0,1,2,0,2,3]),$s.setAttribute("position",new Tr(n,3,0,!1)),$s.setAttribute("uv",new Tr(n,2,3,!1))}this.geometry=$s,this.material=e!==void 0?e:new $c,this.center=new ue(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),eo.setFromMatrixScale(this.matrixWorld),Ay.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),to.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&eo.multiplyScalar(-to.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;rc(nc.set(-.5,-.5,0),to,a,eo,i,s),rc(oa.set(.5,-.5,0),to,a,eo,i,s),rc(ic.set(.5,.5,0),to,a,eo,i,s),$m.set(0,0),Hh.set(1,0),eg.set(1,1);let l=e.ray.intersectTriangle(nc,oa,ic,!1,ra);if(l===null&&(rc(oa.set(-.5,.5,0),to,a,eo,i,s),Hh.set(0,1),l=e.ray.intersectTriangle(nc,ic,oa,!1,ra),l===null))return;const u=e.ray.origin.distanceTo(ra);u<e.near||u>e.far||t.push({distance:u,point:ra.clone(),uv:Wt.getUV(ra,nc,oa,ic,$m,Hh,eg,new ue),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}eu.prototype.isSprite=!0;function rc(r,e,t,n,i,s){no.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(sa.x=s*no.x-i*no.y,sa.y=i*no.x+s*no.y):sa.copy(no),r.copy(e),r.x+=sa.x,r.y+=sa.y,r.applyMatrix4(Ay)}const sc=new R,tg=new R;class Cy extends ht{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){sc.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(sc);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){sc.setFromMatrixPosition(e.matrixWorld),tg.setFromMatrixPosition(this.matrixWorld);const n=sc.distanceTo(tg)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}const ng=new R,ig=new wt,rg=new wt,Vb=new R,sg=new Fe;class tu extends Kt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new wt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,i=this.geometry;ig.fromBufferAttribute(i.attributes.skinIndex,e),rg.fromBufferAttribute(i.attributes.skinWeight,e),ng.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=rg.getComponent(s);if(a!==0){const l=ig.getComponent(s);sg.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),t.addScaledVector(Vb.copy(ng).applyMatrix4(sg),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}tu.prototype.isSkinnedMesh=!0;class nu extends ht{constructor(){super(),this.type="Bone"}}nu.prototype.isBone=!0;class as extends Ut{constructor(e=null,t=1,n=1,i,s,a,l,u,f=Zt,p=Zt,g,d){super(null,a,l,u,f,p,i,s,g,d),this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}as.prototype.isDataTexture=!0;const og=new Fe,Wb=new Fe;class iu{constructor(e=[],t=[]){this.uuid=On(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Fe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const l=e[s]?e[s].matrixWorld:Wb;og.multiplyMatrices(l,t[s]),og.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new iu(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=ny(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new as(t,e,e,Nn,ji);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new nu),this.bones.push(a),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const l=n[i];e.boneInverses.push(l.toArray())}return e}}class ds extends mt{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,n),this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}ds.prototype.isInstancedBufferAttribute=!0;const ag=new Fe,lg=new Fe,oc=[],aa=new Kt;class $f extends Kt{constructor(e,t,n){super(e,t),this.instanceMatrix=new ds(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(aa.geometry=this.geometry,aa.material=this.material,aa.material!==void 0)for(let s=0;s<i;s++){this.getMatrixAt(s,ag),lg.multiplyMatrices(n,ag),aa.matrixWorld=lg,aa.raycast(e,oc);for(let a=0,l=oc.length;a<l;a++){const u=oc[a];u.instanceId=s,u.object=this,t.push(u)}oc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new ds(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}$f.prototype.isInstancedMesh=!0;class sn extends qt{constructor(e){super(),this.type="LineBasicMaterial",this.color=new Ae(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}sn.prototype.isLineBasicMaterial=!0;const cg=new R,ug=new R,hg=new Fe,Gh=new Qi,ac=new Lr;class Zi extends ht{constructor(e=new Ye,t=new sn){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)cg.fromBufferAttribute(t,i-1),ug.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=cg.distanceTo(ug);e.setAttribute("lineDistance",new Ne(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ac.copy(n.boundingSphere),ac.applyMatrix4(i),ac.radius+=s,e.ray.intersectsSphere(ac)===!1)return;hg.copy(i).invert(),Gh.copy(e.ray).applyMatrix4(hg);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,f=new R,p=new R,g=new R,d=new R,m=this.isLineSegments?2:1;if(n.isBufferGeometry){const x=n.index,v=n.attributes.position;if(x!==null){const M=Math.max(0,a.start),S=Math.min(x.count,a.start+a.count);for(let T=M,b=S-1;T<b;T+=m){const A=x.getX(T),L=x.getX(T+1);if(f.fromBufferAttribute(v,A),p.fromBufferAttribute(v,L),Gh.distanceSqToSegment(f,p,d,g)>u)continue;d.applyMatrix4(this.matrixWorld);const N=e.ray.origin.distanceTo(d);N<e.near||N>e.far||t.push({distance:N,point:g.clone().applyMatrix4(this.matrixWorld),index:T,face:null,faceIndex:null,object:this})}}else{const M=Math.max(0,a.start),S=Math.min(v.count,a.start+a.count);for(let T=M,b=S-1;T<b;T+=m){if(f.fromBufferAttribute(v,T),p.fromBufferAttribute(v,T+1),Gh.distanceSqToSegment(f,p,d,g)>u)continue;d.applyMatrix4(this.matrixWorld);const L=e.ray.origin.distanceTo(d);L<e.near||L>e.far||t.push({distance:L,point:g.clone().applyMatrix4(this.matrixWorld),index:T,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const l=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Zi.prototype.isLine=!0;const fg=new R,dg=new R;class Pn extends Zi{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)fg.fromBufferAttribute(t,i),dg.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+fg.distanceTo(dg);e.setAttribute("lineDistance",new Ne(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Pn.prototype.isLineSegments=!0;class ed extends Zi{constructor(e,t){super(e,t),this.type="LineLoop"}}ed.prototype.isLineLoop=!0;class Ms extends qt{constructor(e){super(),this.type="PointsMaterial",this.color=new Ae(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}}Ms.prototype.isPointsMaterial=!0;const pg=new Fe,Df=new Qi,lc=new Lr,cc=new R;class ka extends ht{constructor(e=new Ye,t=new Ms){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),lc.copy(n.boundingSphere),lc.applyMatrix4(i),lc.radius+=s,e.ray.intersectsSphere(lc)===!1)return;pg.copy(i).invert(),Df.copy(e.ray).applyMatrix4(pg);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l;if(n.isBufferGeometry){const f=n.index,g=n.attributes.position;if(f!==null){const d=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count);for(let x=d,y=m;x<y;x++){const v=f.getX(x);cc.fromBufferAttribute(g,v),mg(cc,v,u,i,e,t,this)}}else{const d=Math.max(0,a.start),m=Math.min(g.count,a.start+a.count);for(let x=d,y=m;x<y;x++)cc.fromBufferAttribute(g,x),mg(cc,x,u,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const l=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}ka.prototype.isPoints=!0;function mg(r,e,t,n,i,s,a){const l=Df.distanceSqToPoint(r);if(l<t){const u=new R;Df.closestPointToPoint(r,u),u.applyMatrix4(n);const f=i.ray.origin.distanceTo(u);if(f<i.near||f>i.far)return;s.push({distance:f,distanceToRay:Math.sqrt(l),point:u,index:e,face:null,object:a})}}class Ry extends Ut{constructor(e,t,n,i,s,a,l,u,f){super(e,t,n,i,s,a,l,u,f),this.minFilter=a!==void 0?a:Gt,this.magFilter=s!==void 0?s:Gt,this.generateMipmaps=!1;const p=this;function g(){p.needsUpdate=!0,e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(g)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Ry.prototype.isVideoTexture=!0;class Py extends Ut{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=Zt,this.minFilter=Zt,this.generateMipmaps=!1,this.needsUpdate=!0}}Py.prototype.isFramebufferTexture=!0;class td extends Ut{constructor(e,t,n,i,s,a,l,u,f,p,g,d){super(null,a,l,u,f,p,i,s,g,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}td.prototype.isCompressedTexture=!0;class Ly extends Ut{constructor(e,t,n,i,s,a,l,u,f){super(e,t,n,i,s,a,l,u,f),this.needsUpdate=!0}}Ly.prototype.isCanvasTexture=!0;class Bn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let l=0,u=s-1,f;for(;l<=u;)if(i=Math.floor(l+(u-l)/2),f=n[i]-a,f<0)l=i+1;else if(f>0)u=i-1;else{u=i;break}if(i=u,n[i]===a)return i/(s-1);const p=n[i],d=n[i+1]-p,m=(a-p)/d;return(i+m)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),l=this.getPoint(s),u=t||(a.isVector2?new ue:new R);return u.copy(l).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new R,i=[],s=[],a=[],l=new R,u=new Fe;for(let m=0;m<=e;m++){const x=m/e;i[m]=this.getTangentAt(x,new R)}s[0]=new R,a[0]=new R;let f=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),d=Math.abs(i[0].z);p<=f&&(f=p,n.set(1,0,0)),g<=f&&(f=g,n.set(0,1,0)),d<=f&&n.set(0,0,1),l.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],l),a[0].crossVectors(i[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),a[m]=a[m-1].clone(),l.crossVectors(i[m-1],i[m]),l.length()>Number.EPSILON){l.normalize();const x=Math.acos(Vt(i[m-1].dot(i[m]),-1,1));s[m].applyMatrix4(u.makeRotationAxis(l,x))}a[m].crossVectors(i[m],s[m])}if(t===!0){let m=Math.acos(Vt(s[0].dot(s[e]),-1,1));m/=e,i[0].dot(l.crossVectors(s[0],s[e]))>0&&(m=-m);for(let x=1;x<=e;x++)s[x].applyMatrix4(u.makeRotationAxis(i[x],m*x)),a[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Ha extends Bn{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,l=!1,u=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=l,this.aRotation=u}getPoint(e,t){const n=t||new ue,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const l=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(l),f=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){const p=Math.cos(this.aRotation),g=Math.sin(this.aRotation),d=u-this.aX,m=f-this.aY;u=d*p-m*g+this.aX,f=d*g+m*p+this.aY}return n.set(u,f)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}Ha.prototype.isEllipseCurve=!0;class nd extends Ha{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.type="ArcCurve"}}nd.prototype.isArcCurve=!0;function id(){let r=0,e=0,t=0,n=0;function i(s,a,l,u){r=s,e=l,t=-3*s+3*a-2*l-u,n=2*s-2*a+l+u}return{initCatmullRom:function(s,a,l,u,f){i(a,l,f*(l-s),f*(u-a))},initNonuniformCatmullRom:function(s,a,l,u,f,p,g){let d=(a-s)/f-(l-s)/(f+p)+(l-a)/p,m=(l-a)/p-(u-a)/(p+g)+(u-l)/g;d*=p,m*=p,i(a,l,d,m)},calc:function(s){const a=s*s,l=a*s;return r+e*s+t*a+n*l}}}const uc=new R,Vh=new id,Wh=new id,qh=new id;class rd extends Bn{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new R){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let l=Math.floor(a),u=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/s)+1)*s:u===0&&l===s-1&&(l=s-2,u=1);let f,p;this.closed||l>0?f=i[(l-1)%s]:(uc.subVectors(i[0],i[1]).add(i[0]),f=uc);const g=i[l%s],d=i[(l+1)%s];if(this.closed||l+2<s?p=i[(l+2)%s]:(uc.subVectors(i[s-1],i[s-2]).add(i[s-1]),p=uc),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let x=Math.pow(f.distanceToSquared(g),m),y=Math.pow(g.distanceToSquared(d),m),v=Math.pow(d.distanceToSquared(p),m);y<1e-4&&(y=1),x<1e-4&&(x=y),v<1e-4&&(v=y),Vh.initNonuniformCatmullRom(f.x,g.x,d.x,p.x,x,y,v),Wh.initNonuniformCatmullRom(f.y,g.y,d.y,p.y,x,y,v),qh.initNonuniformCatmullRom(f.z,g.z,d.z,p.z,x,y,v)}else this.curveType==="catmullrom"&&(Vh.initCatmullRom(f.x,g.x,d.x,p.x,this.tension),Wh.initCatmullRom(f.y,g.y,d.y,p.y,this.tension),qh.initCatmullRom(f.z,g.z,d.z,p.z,this.tension));return n.set(Vh.calc(u),Wh.calc(u),qh.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new R().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}rd.prototype.isCatmullRomCurve3=!0;function gg(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,l=r*r,u=r*l;return(2*t-2*n+s+a)*u+(-3*t+3*n-2*s-a)*l+s*r+t}function qb(r,e){const t=1-r;return t*t*e}function Xb(r,e){return 2*(1-r)*r*e}function jb(r,e){return r*r*e}function da(r,e,t,n){return qb(r,e)+Xb(r,t)+jb(r,n)}function Yb(r,e){const t=1-r;return t*t*t*e}function Jb(r,e){const t=1-r;return 3*t*t*r*e}function Zb(r,e){return 3*(1-r)*r*r*e}function Kb(r,e){return r*r*r*e}function pa(r,e,t,n,i){return Yb(r,e)+Jb(r,t)+Zb(r,n)+Kb(r,i)}class ru extends Bn{constructor(e=new ue,t=new ue,n=new ue,i=new ue){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ue){const n=t,i=this.v0,s=this.v1,a=this.v2,l=this.v3;return n.set(pa(e,i.x,s.x,a.x,l.x),pa(e,i.y,s.y,a.y,l.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}ru.prototype.isCubicBezierCurve=!0;class sd extends Bn{constructor(e=new R,t=new R,n=new R,i=new R){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new R){const n=t,i=this.v0,s=this.v1,a=this.v2,l=this.v3;return n.set(pa(e,i.x,s.x,a.x,l.x),pa(e,i.y,s.y,a.y,l.y),pa(e,i.z,s.z,a.z,l.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}sd.prototype.isCubicBezierCurve3=!0;class Ga extends Bn{constructor(e=new ue,t=new ue){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new ue;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Ga.prototype.isLineCurve=!0;class Dy extends Bn{constructor(e=new R,t=new R){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new R){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class su extends Bn{constructor(e=new ue,t=new ue,n=new ue){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ue){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(da(e,i.x,s.x,a.x),da(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}su.prototype.isQuadraticBezierCurve=!0;class ou extends Bn{constructor(e=new R,t=new R,n=new R){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new R){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(da(e,i.x,s.x,a.x),da(e,i.y,s.y,a.y),da(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}ou.prototype.isQuadraticBezierCurve3=!0;class au extends Bn{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),l=s-a,u=i[a===0?a:a-1],f=i[a],p=i[a>i.length-2?i.length-1:a+1],g=i[a>i.length-3?i.length-1:a+2];return n.set(gg(l,u.x,f.x,p.x,g.x),gg(l,u.y,f.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new ue().fromArray(i))}return this}}au.prototype.isSplineCurve=!0;var od=Object.freeze({__proto__:null,ArcCurve:nd,CatmullRomCurve3:rd,CubicBezierCurve:ru,CubicBezierCurve3:sd,EllipseCurve:Ha,LineCurve:Ga,LineCurve3:Dy,QuadraticBezierCurve:su,QuadraticBezierCurve3:ou,SplineCurve:au});class Iy extends Bn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Ga(t,e))}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,l=this.curves[s],u=l.getLength(),f=u===0?0:1-a/u;return l.getPointAt(f,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],l=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,u=a.getPoints(l);for(let f=0;f<u.length;f++){const p=u[f];n&&n.equals(p)||(t.push(p),n=p)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new od[i.type]().fromJSON(i))}return this}}class fo extends Iy{constructor(e){super(),this.type="Path",this.currentPoint=new ue,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Ga(this.currentPoint.clone(),new ue(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new su(this.currentPoint.clone(),new ue(e,t),new ue(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const l=new ru(this.currentPoint.clone(),new ue(e,t),new ue(n,i),new ue(s,a));return this.curves.push(l),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new au(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+l,t+u,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,l,u){const f=this.currentPoint.x,p=this.currentPoint.y;return this.absellipse(e+f,t+p,n,i,s,a,l,u),this}absellipse(e,t,n,i,s,a,l,u){const f=new Ha(e,t,n,i,s,a,l,u);if(this.curves.length>0){const g=f.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(f);const p=f.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ps extends Ye{constructor(e=[new ue(0,.5),new ue(.5,0),new ue(0,-.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Vt(i,0,Math.PI*2);const s=[],a=[],l=[],u=[],f=[],p=1/t,g=new R,d=new ue,m=new R,x=new R,y=new R;let v=0,M=0;for(let S=0;S<=e.length-1;S++)switch(S){case 0:v=e[S+1].x-e[S].x,M=e[S+1].y-e[S].y,m.x=M*1,m.y=-v,m.z=M*0,y.copy(m),m.normalize(),u.push(m.x,m.y,m.z);break;case e.length-1:u.push(y.x,y.y,y.z);break;default:v=e[S+1].x-e[S].x,M=e[S+1].y-e[S].y,m.x=M*1,m.y=-v,m.z=M*0,x.copy(m),m.x+=y.x,m.y+=y.y,m.z+=y.z,m.normalize(),u.push(m.x,m.y,m.z),y.copy(x)}for(let S=0;S<=t;S++){const T=n+S*p*i,b=Math.sin(T),A=Math.cos(T);for(let L=0;L<=e.length-1;L++){g.x=e[L].x*b,g.y=e[L].y,g.z=e[L].x*A,a.push(g.x,g.y,g.z),d.x=S/t,d.y=L/(e.length-1),l.push(d.x,d.y);const D=u[3*L+0]*b,N=u[3*L+1],q=u[3*L+0]*A;f.push(D,N,q)}}for(let S=0;S<t;S++)for(let T=0;T<e.length-1;T++){const b=T+S*e.length,A=b,L=b+e.length,D=b+e.length+1,N=b+1;s.push(A,L,N),s.push(D,N,L)}this.setIndex(s),this.setAttribute("position",new Ne(a,3)),this.setAttribute("uv",new Ne(l,2)),this.setAttribute("normal",new Ne(f,3))}static fromJSON(e){return new ps(e.points,e.segments,e.phiStart,e.phiLength)}}class po extends ps{constructor(e=1,t=1,n=4,i=8){const s=new fo;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new po(e.radius,e.length,e.capSegments,e.radialSegments)}}class mo extends Ye{constructor(e=1,t=8,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],a=[],l=[],u=[],f=new R,p=new ue;a.push(0,0,0),l.push(0,0,1),u.push(.5,.5);for(let g=0,d=3;g<=t;g++,d+=3){const m=n+g/t*i;f.x=e*Math.cos(m),f.y=e*Math.sin(m),a.push(f.x,f.y,f.z),l.push(0,0,1),p.x=(a[d]/e+1)/2,p.y=(a[d+1]/e+1)/2,u.push(p.x,p.y)}for(let g=1;g<=t;g++)s.push(g,g+1,0);this.setIndex(s),this.setAttribute("position",new Ne(a,3)),this.setAttribute("normal",new Ne(l,3)),this.setAttribute("uv",new Ne(u,2))}static fromJSON(e){return new mo(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ar extends Ye{constructor(e=1,t=1,n=1,i=8,s=1,a=!1,l=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:l,thetaLength:u};const f=this;i=Math.floor(i),s=Math.floor(s);const p=[],g=[],d=[],m=[];let x=0;const y=[],v=n/2;let M=0;S(),a===!1&&(e>0&&T(!0),t>0&&T(!1)),this.setIndex(p),this.setAttribute("position",new Ne(g,3)),this.setAttribute("normal",new Ne(d,3)),this.setAttribute("uv",new Ne(m,2));function S(){const b=new R,A=new R;let L=0;const D=(t-e)/n;for(let N=0;N<=s;N++){const q=[],B=N/s,C=B*(t-e)+e;for(let z=0;z<=i;z++){const J=z/i,W=J*u+l,Y=Math.sin(W),X=Math.cos(W);A.x=C*Y,A.y=-B*n+v,A.z=C*X,g.push(A.x,A.y,A.z),b.set(Y,D,X).normalize(),d.push(b.x,b.y,b.z),m.push(J,1-B),q.push(x++)}y.push(q)}for(let N=0;N<i;N++)for(let q=0;q<s;q++){const B=y[q][N],C=y[q+1][N],z=y[q+1][N+1],J=y[q][N+1];p.push(B,C,J),p.push(C,z,J),L+=6}f.addGroup(M,L,0),M+=L}function T(b){const A=x,L=new ue,D=new R;let N=0;const q=b===!0?e:t,B=b===!0?1:-1;for(let z=1;z<=i;z++)g.push(0,v*B,0),d.push(0,B,0),m.push(.5,.5),x++;const C=x;for(let z=0;z<=i;z++){const W=z/i*u+l,Y=Math.cos(W),X=Math.sin(W);D.x=q*X,D.y=v*B,D.z=q*Y,g.push(D.x,D.y,D.z),d.push(0,B,0),L.x=Y*.5+.5,L.y=X*.5*B+.5,m.push(L.x,L.y),x++}for(let z=0;z<i;z++){const J=A+z,W=C+z;b===!0?p.push(W,W+1,J):p.push(W+1,W,J),N+=3}f.addGroup(M,N,b===!0?1:2),M+=N}}static fromJSON(e){return new Ar(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class go extends Ar{constructor(e=1,t=1,n=8,i=1,s=!1,a=0,l=Math.PI*2){super(0,e,t,n,i,s,a,l),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:l}}static fromJSON(e){return new go(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ti extends Ye{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],a=[];l(i),f(n),p(),this.setAttribute("position",new Ne(s,3)),this.setAttribute("normal",new Ne(s.slice(),3)),this.setAttribute("uv",new Ne(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function l(S){const T=new R,b=new R,A=new R;for(let L=0;L<t.length;L+=3)m(t[L+0],T),m(t[L+1],b),m(t[L+2],A),u(T,b,A,S)}function u(S,T,b,A){const L=A+1,D=[];for(let N=0;N<=L;N++){D[N]=[];const q=S.clone().lerp(b,N/L),B=T.clone().lerp(b,N/L),C=L-N;for(let z=0;z<=C;z++)z===0&&N===L?D[N][z]=q:D[N][z]=q.clone().lerp(B,z/C)}for(let N=0;N<L;N++)for(let q=0;q<2*(L-N)-1;q++){const B=Math.floor(q/2);q%2===0?(d(D[N][B+1]),d(D[N+1][B]),d(D[N][B])):(d(D[N][B+1]),d(D[N+1][B+1]),d(D[N+1][B]))}}function f(S){const T=new R;for(let b=0;b<s.length;b+=3)T.x=s[b+0],T.y=s[b+1],T.z=s[b+2],T.normalize().multiplyScalar(S),s[b+0]=T.x,s[b+1]=T.y,s[b+2]=T.z}function p(){const S=new R;for(let T=0;T<s.length;T+=3){S.x=s[T+0],S.y=s[T+1],S.z=s[T+2];const b=v(S)/2/Math.PI+.5,A=M(S)/Math.PI+.5;a.push(b,1-A)}x(),g()}function g(){for(let S=0;S<a.length;S+=6){const T=a[S+0],b=a[S+2],A=a[S+4],L=Math.max(T,b,A),D=Math.min(T,b,A);L>.9&&D<.1&&(T<.2&&(a[S+0]+=1),b<.2&&(a[S+2]+=1),A<.2&&(a[S+4]+=1))}}function d(S){s.push(S.x,S.y,S.z)}function m(S,T){const b=S*3;T.x=e[b+0],T.y=e[b+1],T.z=e[b+2]}function x(){const S=new R,T=new R,b=new R,A=new R,L=new ue,D=new ue,N=new ue;for(let q=0,B=0;q<s.length;q+=9,B+=6){S.set(s[q+0],s[q+1],s[q+2]),T.set(s[q+3],s[q+4],s[q+5]),b.set(s[q+6],s[q+7],s[q+8]),L.set(a[B+0],a[B+1]),D.set(a[B+2],a[B+3]),N.set(a[B+4],a[B+5]),A.copy(S).add(T).add(b).divideScalar(3);const C=v(A);y(L,B+0,S,C),y(D,B+2,T,C),y(N,B+4,b,C)}}function y(S,T,b,A){A<0&&S.x===1&&(a[T]=S.x-1),b.x===0&&b.z===0&&(a[T]=A/2/Math.PI+.5)}function v(S){return Math.atan2(S.z,-S.x)}function M(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}static fromJSON(e){return new Ti(e.vertices,e.indices,e.radius,e.details)}}class yo extends Ti{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new yo(e.radius,e.detail)}}const hc=new R,fc=new R,Xh=new R,dc=new Wt;class lu extends Ye{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(rs*t),a=e.getIndex(),l=e.getAttribute("position"),u=a?a.count:l.count,f=[0,0,0],p=["a","b","c"],g=new Array(3),d={},m=[];for(let x=0;x<u;x+=3){a?(f[0]=a.getX(x),f[1]=a.getX(x+1),f[2]=a.getX(x+2)):(f[0]=x,f[1]=x+1,f[2]=x+2);const{a:y,b:v,c:M}=dc;if(y.fromBufferAttribute(l,f[0]),v.fromBufferAttribute(l,f[1]),M.fromBufferAttribute(l,f[2]),dc.getNormal(Xh),g[0]=`${Math.round(y.x*i)},${Math.round(y.y*i)},${Math.round(y.z*i)}`,g[1]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.z*i)}`,g[2]=`${Math.round(M.x*i)},${Math.round(M.y*i)},${Math.round(M.z*i)}`,!(g[0]===g[1]||g[1]===g[2]||g[2]===g[0]))for(let S=0;S<3;S++){const T=(S+1)%3,b=g[S],A=g[T],L=dc[p[S]],D=dc[p[T]],N=`${b}_${A}`,q=`${A}_${b}`;q in d&&d[q]?(Xh.dot(d[q].normal)<=s&&(m.push(L.x,L.y,L.z),m.push(D.x,D.y,D.z)),d[q]=null):N in d||(d[N]={index0:f[S],index1:f[T],normal:Xh.clone()})}}for(const x in d)if(d[x]){const{index0:y,index1:v}=d[x];hc.fromBufferAttribute(l,y),fc.fromBufferAttribute(l,v),m.push(hc.x,hc.y,hc.z),m.push(fc.x,fc.y,fc.z)}this.setAttribute("position",new Ne(m,3))}}}class bi extends fo{constructor(e){super(e),this.uuid=On(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new fo().fromJSON(i))}return this}}const Qb={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=zy(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let l,u,f,p,g,d,m;if(n&&(s=iE(r,e,s,t)),r.length>80*t){l=f=r[0],u=p=r[1];for(let x=t;x<i;x+=t)g=r[x],d=r[x+1],g<l&&(l=g),d<u&&(u=d),g>f&&(f=g),d>p&&(p=d);m=Math.max(f-l,p-u),m=m!==0?1/m:0}return ba(s,a,t,l,u,m),a}};function zy(r,e,t,n,i){let s,a;if(i===pE(r,e,t,n)>0)for(s=e;s<t;s+=n)a=yg(s,r[s],r[s+1],a);else for(s=t-n;s>=e;s-=n)a=yg(s,r[s],r[s+1],a);return a&&cu(a,a.next)&&(Ta(a),a=a.next),a}function Cr(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(cu(t,t.next)||Nt(t.prev,t,t.next)===0)){if(Ta(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ba(r,e,t,n,i,s,a){if(!r)return;!a&&s&&lE(r,n,i,s);let l=r,u,f;for(;r.prev!==r.next;){if(u=r.prev,f=r.next,s?eE(r,n,i,s):$b(r)){e.push(u.i/t),e.push(r.i/t),e.push(f.i/t),Ta(r),r=f.next,l=f.next;continue}if(r=f,r===l){a?a===1?(r=tE(Cr(r),e,t),ba(r,e,t,n,i,s,2)):a===2&&nE(r,e,t,n,i,s):ba(Cr(r),e,t,n,i,s,1);break}}}function $b(r){const e=r.prev,t=r,n=r.next;if(Nt(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(ao(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&Nt(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function eE(r,e,t,n){const i=r.prev,s=r,a=r.next;if(Nt(i,s,a)>=0)return!1;const l=i.x<s.x?i.x<a.x?i.x:a.x:s.x<a.x?s.x:a.x,u=i.y<s.y?i.y<a.y?i.y:a.y:s.y<a.y?s.y:a.y,f=i.x>s.x?i.x>a.x?i.x:a.x:s.x>a.x?s.x:a.x,p=i.y>s.y?i.y>a.y?i.y:a.y:s.y>a.y?s.y:a.y,g=If(l,u,e,t,n),d=If(f,p,e,t,n);let m=r.prevZ,x=r.nextZ;for(;m&&m.z>=g&&x&&x.z<=d;){if(m!==r.prev&&m!==r.next&&ao(i.x,i.y,s.x,s.y,a.x,a.y,m.x,m.y)&&Nt(m.prev,m,m.next)>=0||(m=m.prevZ,x!==r.prev&&x!==r.next&&ao(i.x,i.y,s.x,s.y,a.x,a.y,x.x,x.y)&&Nt(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;m&&m.z>=g;){if(m!==r.prev&&m!==r.next&&ao(i.x,i.y,s.x,s.y,a.x,a.y,m.x,m.y)&&Nt(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;x&&x.z<=d;){if(x!==r.prev&&x!==r.next&&ao(i.x,i.y,s.x,s.y,a.x,a.y,x.x,x.y)&&Nt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function tE(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!cu(i,s)&&Ny(i,n,n.next,s)&&Ea(i,s)&&Ea(s,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(s.i/t),Ta(n),Ta(n.next),n=r=s),n=n.next}while(n!==r);return Cr(n)}function nE(r,e,t,n,i,s){let a=r;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&hE(a,l)){let u=Fy(a,l);a=Cr(a,a.next),u=Cr(u,u.next),ba(a,e,t,n,i,s),ba(u,e,t,n,i,s);return}l=l.next}a=a.next}while(a!==r)}function iE(r,e,t,n){const i=[];let s,a,l,u,f;for(s=0,a=e.length;s<a;s++)l=e[s]*n,u=s<a-1?e[s+1]*n:r.length,f=zy(r,l,u,n,!1),f===f.next&&(f.steiner=!0),i.push(uE(f));for(i.sort(rE),s=0;s<i.length;s++)sE(i[s],t),t=Cr(t,t.next);return t}function rE(r,e){return r.x-e.x}function sE(r,e){if(e=oE(r,e),e){const t=Fy(e,r);Cr(e,e.next),Cr(t,t.next)}}function oE(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,a;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const d=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s){if(s=d,d===n){if(i===t.y)return t;if(i===t.next.y)return t.next}a=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!a)return null;if(n===s)return a;const l=a,u=a.x,f=a.y;let p=1/0,g;t=a;do n>=t.x&&t.x>=u&&n!==t.x&&ao(i<f?n:s,i,u,f,i<f?s:n,i,t.x,t.y)&&(g=Math.abs(i-t.y)/(n-t.x),Ea(t,r)&&(g<p||g===p&&(t.x>a.x||t.x===a.x&&aE(a,t)))&&(a=t,p=g)),t=t.next;while(t!==l);return a}function aE(r,e){return Nt(r.prev,r,e.prev)<0&&Nt(e.next,r,r.next)<0}function lE(r,e,t,n){let i=r;do i.z===null&&(i.z=If(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,cE(i)}function cE(r){let e,t,n,i,s,a,l,u,f=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,l=0,e=0;e<f&&(l++,n=n.nextZ,!!n);e++);for(u=f;l>0||u>0&&n;)l!==0&&(u===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,l--):(i=n,n=n.nextZ,u--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,f*=2}while(a>1);return r}function If(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function uE(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function ao(r,e,t,n,i,s,a,l){return(i-a)*(e-l)-(r-a)*(s-l)>=0&&(r-a)*(n-l)-(t-a)*(e-l)>=0&&(t-a)*(s-l)-(i-a)*(n-l)>=0}function hE(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!fE(r,e)&&(Ea(r,e)&&Ea(e,r)&&dE(r,e)&&(Nt(r.prev,r,e.prev)||Nt(r,e.prev,e))||cu(r,e)&&Nt(r.prev,r,r.next)>0&&Nt(e.prev,e,e.next)>0)}function Nt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function cu(r,e){return r.x===e.x&&r.y===e.y}function Ny(r,e,t,n){const i=mc(Nt(r,e,t)),s=mc(Nt(r,e,n)),a=mc(Nt(t,n,r)),l=mc(Nt(t,n,e));return!!(i!==s&&a!==l||i===0&&pc(r,t,e)||s===0&&pc(r,n,e)||a===0&&pc(t,r,n)||l===0&&pc(t,e,n))}function pc(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function mc(r){return r>0?1:r<0?-1:0}function fE(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Ny(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ea(r,e){return Nt(r.prev,r,r.next)<0?Nt(r,e,r.next)>=0&&Nt(r,r.prev,e)>=0:Nt(r,e,r.prev)<0||Nt(r,r.next,e)<0}function dE(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Fy(r,e){const t=new zf(r.i,r.x,r.y),n=new zf(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function yg(r,e,t,n){const i=new zf(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ta(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function zf(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pE(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class Ei{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return Ei.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];xg(e),vg(n,e);let a=e.length;t.forEach(xg);for(let u=0;u<t.length;u++)i.push(a),a+=t[u].length,vg(n,t[u]);const l=Qb.triangulate(n,i);for(let u=0;u<l.length;u+=3)s.push(l.slice(u,u+3));return s}}function xg(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function vg(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Ai extends Ye{constructor(e=new bi([new ue(.5,.5),new ue(-.5,.5),new ue(-.5,-.5),new ue(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let l=0,u=e.length;l<u;l++){const f=e[l];a(f)}this.setAttribute("position",new Ne(i,3)),this.setAttribute("uv",new Ne(s,2)),this.computeVertexNormals();function a(l){const u=[],f=t.curveSegments!==void 0?t.curveSegments:12,p=t.steps!==void 0?t.steps:1;let g=t.depth!==void 0?t.depth:1,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,x=t.bevelSize!==void 0?t.bevelSize:m-.1,y=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const M=t.extrudePath,S=t.UVGenerator!==void 0?t.UVGenerator:mE;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),g=t.amount);let T,b=!1,A,L,D,N;M&&(T=M.getSpacedPoints(p),b=!0,d=!1,A=M.computeFrenetFrames(p,!1),L=new R,D=new R,N=new R),d||(v=0,m=0,x=0,y=0);const q=l.extractPoints(f);let B=q.shape;const C=q.holes;if(!Ei.isClockWise(B)){B=B.reverse();for(let ae=0,ce=C.length;ae<ce;ae++){const me=C[ae];Ei.isClockWise(me)&&(C[ae]=me.reverse())}}const J=Ei.triangulateShape(B,C),W=B;for(let ae=0,ce=C.length;ae<ce;ae++){const me=C[ae];B=B.concat(me)}function Y(ae,ce,me){return ce||console.error("THREE.ExtrudeGeometry: vec does not exist"),ce.clone().multiplyScalar(me).add(ae)}const X=B.length,ee=J.length;function V(ae,ce,me){let Le,ve,Ze;const Ve=ae.x-ce.x,Oe=ae.y-ce.y,St=me.x-ae.x,vt=me.y-ae.y,O=Ve*Ve+Oe*Oe,P=Ve*vt-Oe*St;if(Math.abs(P)>Number.EPSILON){const te=Math.sqrt(O),ge=Math.sqrt(St*St+vt*vt),be=ce.x-Oe/te,Ee=ce.y+Ve/te,ke=me.x-vt/ge,le=me.y+St/ge,et=((ke-be)*vt-(le-Ee)*St)/(Ve*vt-Oe*St);Le=be+Ve*et-ae.x,ve=Ee+Oe*et-ae.y;const nt=Le*Le+ve*ve;if(nt<=2)return new ue(Le,ve);Ze=Math.sqrt(nt/2)}else{let te=!1;Ve>Number.EPSILON?St>Number.EPSILON&&(te=!0):Ve<-Number.EPSILON?St<-Number.EPSILON&&(te=!0):Math.sign(Oe)===Math.sign(vt)&&(te=!0),te?(Le=-Oe,ve=Ve,Ze=Math.sqrt(O)):(Le=Ve,ve=Oe,Ze=Math.sqrt(O/2))}return new ue(Le/Ze,ve/Ze)}const re=[];for(let ae=0,ce=W.length,me=ce-1,Le=ae+1;ae<ce;ae++,me++,Le++)me===ce&&(me=0),Le===ce&&(Le=0),re[ae]=V(W[ae],W[me],W[Le]);const K=[];let pe,he=re.concat();for(let ae=0,ce=C.length;ae<ce;ae++){const me=C[ae];pe=[];for(let Le=0,ve=me.length,Ze=ve-1,Ve=Le+1;Le<ve;Le++,Ze++,Ve++)Ze===ve&&(Ze=0),Ve===ve&&(Ve=0),pe[Le]=V(me[Le],me[Ze],me[Ve]);K.push(pe),he=he.concat(pe)}for(let ae=0;ae<v;ae++){const ce=ae/v,me=m*Math.cos(ce*Math.PI/2),Le=x*Math.sin(ce*Math.PI/2)+y;for(let ve=0,Ze=W.length;ve<Ze;ve++){const Ve=Y(W[ve],re[ve],Le);ot(Ve.x,Ve.y,-me)}for(let ve=0,Ze=C.length;ve<Ze;ve++){const Ve=C[ve];pe=K[ve];for(let Oe=0,St=Ve.length;Oe<St;Oe++){const vt=Y(Ve[Oe],pe[Oe],Le);ot(vt.x,vt.y,-me)}}}const Ce=x+y;for(let ae=0;ae<X;ae++){const ce=d?Y(B[ae],he[ae],Ce):B[ae];b?(D.copy(A.normals[0]).multiplyScalar(ce.x),L.copy(A.binormals[0]).multiplyScalar(ce.y),N.copy(T[0]).add(D).add(L),ot(N.x,N.y,N.z)):ot(ce.x,ce.y,0)}for(let ae=1;ae<=p;ae++)for(let ce=0;ce<X;ce++){const me=d?Y(B[ce],he[ce],Ce):B[ce];b?(D.copy(A.normals[ae]).multiplyScalar(me.x),L.copy(A.binormals[ae]).multiplyScalar(me.y),N.copy(T[ae]).add(D).add(L),ot(N.x,N.y,N.z)):ot(me.x,me.y,g/p*ae)}for(let ae=v-1;ae>=0;ae--){const ce=ae/v,me=m*Math.cos(ce*Math.PI/2),Le=x*Math.sin(ce*Math.PI/2)+y;for(let ve=0,Ze=W.length;ve<Ze;ve++){const Ve=Y(W[ve],re[ve],Le);ot(Ve.x,Ve.y,g+me)}for(let ve=0,Ze=C.length;ve<Ze;ve++){const Ve=C[ve];pe=K[ve];for(let Oe=0,St=Ve.length;Oe<St;Oe++){const vt=Y(Ve[Oe],pe[Oe],Le);b?ot(vt.x,vt.y+T[p-1].y,T[p-1].x+me):ot(vt.x,vt.y,g+me)}}}Ue(),Be();function Ue(){const ae=i.length/3;if(d){let ce=0,me=X*ce;for(let Le=0;Le<ee;Le++){const ve=J[Le];qe(ve[2]+me,ve[1]+me,ve[0]+me)}ce=p+v*2,me=X*ce;for(let Le=0;Le<ee;Le++){const ve=J[Le];qe(ve[0]+me,ve[1]+me,ve[2]+me)}}else{for(let ce=0;ce<ee;ce++){const me=J[ce];qe(me[2],me[1],me[0])}for(let ce=0;ce<ee;ce++){const me=J[ce];qe(me[0]+X*p,me[1]+X*p,me[2]+X*p)}}n.addGroup(ae,i.length/3-ae,0)}function Be(){const ae=i.length/3;let ce=0;oe(W,ce),ce+=W.length;for(let me=0,Le=C.length;me<Le;me++){const ve=C[me];oe(ve,ce),ce+=ve.length}n.addGroup(ae,i.length/3-ae,1)}function oe(ae,ce){let me=ae.length;for(;--me>=0;){const Le=me;let ve=me-1;ve<0&&(ve=ae.length-1);for(let Ze=0,Ve=p+v*2;Ze<Ve;Ze++){const Oe=X*Ze,St=X*(Ze+1),vt=ce+Le+Oe,O=ce+ve+Oe,P=ce+ve+St,te=ce+Le+St;je(vt,O,P,te)}}}function ot(ae,ce,me){u.push(ae),u.push(ce),u.push(me)}function qe(ae,ce,me){xe(ae),xe(ce),xe(me);const Le=i.length/3,ve=S.generateTopUV(n,i,Le-3,Le-2,Le-1);tt(ve[0]),tt(ve[1]),tt(ve[2])}function je(ae,ce,me,Le){xe(ae),xe(ce),xe(Le),xe(ce),xe(me),xe(Le);const ve=i.length/3,Ze=S.generateSideWallUV(n,i,ve-6,ve-3,ve-2,ve-1);tt(Ze[0]),tt(Ze[1]),tt(Ze[3]),tt(Ze[1]),tt(Ze[2]),tt(Ze[3])}function xe(ae){i.push(u[ae*3+0]),i.push(u[ae*3+1]),i.push(u[ae*3+2])}function tt(ae){s.push(ae.x),s.push(ae.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return gE(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const l=t[e.shapes[s]];n.push(l)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new od[i.type]().fromJSON(i)),new Ai(n,e.options)}}const mE={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],l=e[n*3],u=e[n*3+1],f=e[i*3],p=e[i*3+1];return[new ue(s,a),new ue(l,u),new ue(f,p)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],l=e[t*3+1],u=e[t*3+2],f=e[n*3],p=e[n*3+1],g=e[n*3+2],d=e[i*3],m=e[i*3+1],x=e[i*3+2],y=e[s*3],v=e[s*3+1],M=e[s*3+2];return Math.abs(l-p)<Math.abs(a-f)?[new ue(a,1-u),new ue(f,1-g),new ue(d,1-x),new ue(y,1-M)]:[new ue(l,1-u),new ue(p,1-g),new ue(m,1-x),new ue(v,1-M)]}};function gE(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class xo extends Ti{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new xo(e.radius,e.detail)}}class ms extends Ti{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ms(e.radius,e.detail)}}class vo extends Ye{constructor(e=.5,t=1,n=8,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const l=[],u=[],f=[],p=[];let g=e;const d=(t-e)/i,m=new R,x=new ue;for(let y=0;y<=i;y++){for(let v=0;v<=n;v++){const M=s+v/n*a;m.x=g*Math.cos(M),m.y=g*Math.sin(M),u.push(m.x,m.y,m.z),f.push(0,0,1),x.x=(m.x/t+1)/2,x.y=(m.y/t+1)/2,p.push(x.x,x.y)}g+=d}for(let y=0;y<i;y++){const v=y*(n+1);for(let M=0;M<n;M++){const S=M+v,T=S,b=S+n+1,A=S+n+2,L=S+1;l.push(T,b,L),l.push(b,A,L)}}this.setIndex(l),this.setAttribute("position",new Ne(u,3)),this.setAttribute("normal",new Ne(f,3)),this.setAttribute("uv",new Ne(p,2))}static fromJSON(e){return new vo(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class gs extends Ye{constructor(e=new bi([new ue(0,.5),new ue(-.5,-.5),new ue(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let l=0,u=0;if(Array.isArray(e)===!1)f(e);else for(let p=0;p<e.length;p++)f(e[p]),this.addGroup(l,u,p),l+=u,u=0;this.setIndex(n),this.setAttribute("position",new Ne(i,3)),this.setAttribute("normal",new Ne(s,3)),this.setAttribute("uv",new Ne(a,2));function f(p){const g=i.length/3,d=p.extractPoints(t);let m=d.shape;const x=d.holes;Ei.isClockWise(m)===!1&&(m=m.reverse());for(let v=0,M=x.length;v<M;v++){const S=x[v];Ei.isClockWise(S)===!0&&(x[v]=S.reverse())}const y=Ei.triangulateShape(m,x);for(let v=0,M=x.length;v<M;v++){const S=x[v];m=m.concat(S)}for(let v=0,M=m.length;v<M;v++){const S=m[v];i.push(S.x,S.y,0),s.push(0,0,1),a.push(S.x,S.y)}for(let v=0,M=y.length;v<M;v++){const S=y[v],T=S[0]+g,b=S[1]+g,A=S[2]+g;n.push(T,b,A),u+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return yE(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new gs(n,e.curveSegments)}}function yE(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class ys extends Ye{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:l},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(a+l,Math.PI);let f=0;const p=[],g=new R,d=new R,m=[],x=[],y=[],v=[];for(let M=0;M<=n;M++){const S=[],T=M/n;let b=0;M==0&&a==0?b=.5/t:M==n&&u==Math.PI&&(b=-.5/t);for(let A=0;A<=t;A++){const L=A/t;g.x=-e*Math.cos(i+L*s)*Math.sin(a+T*l),g.y=e*Math.cos(a+T*l),g.z=e*Math.sin(i+L*s)*Math.sin(a+T*l),x.push(g.x,g.y,g.z),d.copy(g).normalize(),y.push(d.x,d.y,d.z),v.push(L+b,1-T),S.push(f++)}p.push(S)}for(let M=0;M<n;M++)for(let S=0;S<t;S++){const T=p[M][S+1],b=p[M][S],A=p[M+1][S],L=p[M+1][S+1];(M!==0||a>0)&&m.push(T,b,L),(M!==n-1||u<Math.PI)&&m.push(b,A,L)}this.setIndex(m),this.setAttribute("position",new Ne(x,3)),this.setAttribute("normal",new Ne(y,3)),this.setAttribute("uv",new Ne(v,2))}static fromJSON(e){return new ys(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class _o extends Ti{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new _o(e.radius,e.detail)}}class wo extends Ye{constructor(e=1,t=.4,n=8,i=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],l=[],u=[],f=[],p=new R,g=new R,d=new R;for(let m=0;m<=n;m++)for(let x=0;x<=i;x++){const y=x/i*s,v=m/n*Math.PI*2;g.x=(e+t*Math.cos(v))*Math.cos(y),g.y=(e+t*Math.cos(v))*Math.sin(y),g.z=t*Math.sin(v),l.push(g.x,g.y,g.z),p.x=e*Math.cos(y),p.y=e*Math.sin(y),d.subVectors(g,p).normalize(),u.push(d.x,d.y,d.z),f.push(x/i),f.push(m/n)}for(let m=1;m<=n;m++)for(let x=1;x<=i;x++){const y=(i+1)*m+x-1,v=(i+1)*(m-1)+x-1,M=(i+1)*(m-1)+x,S=(i+1)*m+x;a.push(y,v,S),a.push(v,M,S)}this.setIndex(a),this.setAttribute("position",new Ne(l,3)),this.setAttribute("normal",new Ne(u,3)),this.setAttribute("uv",new Ne(f,2))}static fromJSON(e){return new wo(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Mo extends Ye{constructor(e=1,t=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const l=[],u=[],f=[],p=[],g=new R,d=new R,m=new R,x=new R,y=new R,v=new R,M=new R;for(let T=0;T<=n;++T){const b=T/n*s*Math.PI*2;S(b,s,a,e,m),S(b+.01,s,a,e,x),v.subVectors(x,m),M.addVectors(x,m),y.crossVectors(v,M),M.crossVectors(y,v),y.normalize(),M.normalize();for(let A=0;A<=i;++A){const L=A/i*Math.PI*2,D=-t*Math.cos(L),N=t*Math.sin(L);g.x=m.x+(D*M.x+N*y.x),g.y=m.y+(D*M.y+N*y.y),g.z=m.z+(D*M.z+N*y.z),u.push(g.x,g.y,g.z),d.subVectors(g,m).normalize(),f.push(d.x,d.y,d.z),p.push(T/n),p.push(A/i)}}for(let T=1;T<=n;T++)for(let b=1;b<=i;b++){const A=(i+1)*(T-1)+(b-1),L=(i+1)*T+(b-1),D=(i+1)*T+b,N=(i+1)*(T-1)+b;l.push(A,L,N),l.push(L,D,N)}this.setIndex(l),this.setAttribute("position",new Ne(u,3)),this.setAttribute("normal",new Ne(f,3)),this.setAttribute("uv",new Ne(p,2));function S(T,b,A,L,D){const N=Math.cos(T),q=Math.sin(T),B=A/b*T,C=Math.cos(B);D.x=L*(2+C)*.5*N,D.y=L*(2+C)*q*.5,D.z=L*Math.sin(B)*.5}}static fromJSON(e){return new Mo(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class So extends Ye{constructor(e=new ou(new R(-1,-1,0),new R(-1,1,0),new R(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const l=new R,u=new R,f=new ue;let p=new R;const g=[],d=[],m=[],x=[];y(),this.setIndex(x),this.setAttribute("position",new Ne(g,3)),this.setAttribute("normal",new Ne(d,3)),this.setAttribute("uv",new Ne(m,2));function y(){for(let T=0;T<t;T++)v(T);v(s===!1?t:0),S(),M()}function v(T){p=e.getPointAt(T/t,p);const b=a.normals[T],A=a.binormals[T];for(let L=0;L<=i;L++){const D=L/i*Math.PI*2,N=Math.sin(D),q=-Math.cos(D);u.x=q*b.x+N*A.x,u.y=q*b.y+N*A.y,u.z=q*b.z+N*A.z,u.normalize(),d.push(u.x,u.y,u.z),l.x=p.x+n*u.x,l.y=p.y+n*u.y,l.z=p.z+n*u.z,g.push(l.x,l.y,l.z)}}function M(){for(let T=1;T<=t;T++)for(let b=1;b<=i;b++){const A=(i+1)*(T-1)+(b-1),L=(i+1)*T+(b-1),D=(i+1)*T+b,N=(i+1)*(T-1)+b;x.push(A,L,N),x.push(L,D,N)}}function S(){for(let T=0;T<=t;T++)for(let b=0;b<=i;b++)f.x=T/t,f.y=b/i,m.push(f.x,f.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new So(new od[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class ad extends Ye{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new R,s=new R;if(e.index!==null){const a=e.attributes.position,l=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:l.count,materialIndex:0}]);for(let f=0,p=u.length;f<p;++f){const g=u[f],d=g.start,m=g.count;for(let x=d,y=d+m;x<y;x+=3)for(let v=0;v<3;v++){const M=l.getX(x+v),S=l.getX(x+(v+1)%3);i.fromBufferAttribute(a,M),s.fromBufferAttribute(a,S),_g(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let l=0,u=a.count/3;l<u;l++)for(let f=0;f<3;f++){const p=3*l+f,g=3*l+(f+1)%3;i.fromBufferAttribute(a,p),s.fromBufferAttribute(a,g),_g(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ne(t,3))}}}function _g(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var wg=Object.freeze({__proto__:null,BoxGeometry:Ji,BoxBufferGeometry:Ji,CapsuleGeometry:po,CapsuleBufferGeometry:po,CircleGeometry:mo,CircleBufferGeometry:mo,ConeGeometry:go,ConeBufferGeometry:go,CylinderGeometry:Ar,CylinderBufferGeometry:Ar,DodecahedronGeometry:yo,DodecahedronBufferGeometry:yo,EdgesGeometry:lu,ExtrudeGeometry:Ai,ExtrudeBufferGeometry:Ai,IcosahedronGeometry:xo,IcosahedronBufferGeometry:xo,LatheGeometry:ps,LatheBufferGeometry:ps,OctahedronGeometry:ms,OctahedronBufferGeometry:ms,PlaneGeometry:fs,PlaneBufferGeometry:fs,PolyhedronGeometry:Ti,PolyhedronBufferGeometry:Ti,RingGeometry:vo,RingBufferGeometry:vo,ShapeGeometry:gs,ShapeBufferGeometry:gs,SphereGeometry:ys,SphereBufferGeometry:ys,TetrahedronGeometry:_o,TetrahedronBufferGeometry:_o,TorusGeometry:wo,TorusBufferGeometry:wo,TorusKnotGeometry:Mo,TorusKnotBufferGeometry:Mo,TubeGeometry:So,TubeBufferGeometry:So,WireframeGeometry:ad});class ld extends qt{constructor(e){super(),this.type="ShadowMaterial",this.color=new Ae(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}ld.prototype.isShadowMaterial=!0;class cd extends Qn{constructor(e){super(e),this.type="RawShaderMaterial"}}cd.prototype.isRawShaderMaterial=!0;class uu extends qt{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ae(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_s,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}uu.prototype.isMeshStandardMaterial=!0;class ud extends uu{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Vt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new Ae(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Ae(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ae(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}ud.prototype.isMeshPhysicalMaterial=!0;class hd extends qt{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new Ae(16777215),this.specular=new Ae(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_s,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=za,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}hd.prototype.isMeshPhongMaterial=!0;class fd extends qt{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ae(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_s,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}fd.prototype.isMeshToonMaterial=!0;class dd extends qt{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_s,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}dd.prototype.isMeshNormalMaterial=!0;class pd extends qt{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new Ae(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ae(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=za,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}pd.prototype.isMeshLambertMaterial=!0;class md extends qt{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ae(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_s,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}}md.prototype.isMeshMatcapMaterial=!0;class gd extends sn{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}gd.prototype.isLineDashedMaterial=!0;const xE={ShadowMaterial:ld,SpriteMaterial:$c,RawShaderMaterial:cd,ShaderMaterial:Qn,PointsMaterial:Ms,MeshPhysicalMaterial:ud,MeshStandardMaterial:uu,MeshPhongMaterial:hd,MeshToonMaterial:fd,MeshNormalMaterial:dd,MeshLambertMaterial:pd,MeshDepthMaterial:Kc,MeshDistanceMaterial:Qc,MeshBasicMaterial:$i,MeshMatcapMaterial:md,LineDashedMaterial:gd,LineBasicMaterial:sn,Material:qt};qt.fromType=function(r){return new xE[r]};const Lt={arraySlice:function(r,e,t){return Lt.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const l=t[s]*e;for(let u=0;u!==e;++u)i[a++]=r[l+u]}return i},flattenJSON:function(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)},subclip:function(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let u=0;u<s.tracks.length;++u){const f=s.tracks[u],p=f.getValueSize(),g=[],d=[];for(let m=0;m<f.times.length;++m){const x=f.times[m]*i;if(!(x<t||x>=n)){g.push(f.times[m]);for(let y=0;y<p;++y)d.push(f.values[m*p+y])}}g.length!==0&&(f.times=Lt.convertArray(g,f.times.constructor),f.values=Lt.convertArray(d,f.values.constructor),a.push(f))}s.tracks=a;let l=1/0;for(let u=0;u<s.tracks.length;++u)l>s.tracks[u].times[0]&&(l=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*l);return s.resetDuration(),s},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const l=t.tracks[a],u=l.ValueTypeName;if(u==="bool"||u==="string")continue;const f=r.tracks.find(function(M){return M.name===l.name&&M.ValueTypeName===u});if(f===void 0)continue;let p=0;const g=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);let d=0;const m=f.getValueSize();f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=m/3);const x=l.times.length-1;let y;if(s<=l.times[0]){const M=p,S=g-p;y=Lt.arraySlice(l.values,M,S)}else if(s>=l.times[x]){const M=x*g+p,S=M+g-p;y=Lt.arraySlice(l.values,M,S)}else{const M=l.createInterpolant(),S=p,T=g-p;M.evaluate(s),y=Lt.arraySlice(M.resultBuffer,S,T)}u==="quaternion"&&new nn().fromArray(y).normalize().conjugate().toArray(y);const v=f.times.length;for(let M=0;M<v;++M){const S=M*m+d;if(u==="quaternion")nn.multiplyQuaternionsFlat(f.values,S,y,0,f.values,S);else{const T=m-d*2;for(let b=0;b<T;++b)f.values[S+b]-=y[b]}}}return r.blendMode=Yf,r}};class Ki{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let l=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,s)}if(n===l)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const l=t[1];e<l&&(n=2,s=l);for(let u=n-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===u)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const l=n+a>>>1;e<t[l]?a=l:n=l+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,s,e)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Ki.prototype.beforeStart_=Ki.prototype.copySampleValue_;Ki.prototype.afterEnd_=Ki.prototype.copySampleValue_;class Oy extends Ki{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Kr,endingEnd:Kr}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,l=i[s],u=i[a];if(l===void 0)switch(this.getSettings_().endingStart){case Qr:s=e,l=2*t-n;break;case wa:s=i.length-2,l=t+i[s]-i[s+1];break;default:s=e,l=n}if(u===void 0)switch(this.getSettings_().endingEnd){case Qr:a=e,u=2*n-t;break;case wa:a=1,u=n+i[1]-i[0];break;default:a=e-1,u=t}const f=(n-t)*.5,p=this.valueSize;this._weightPrev=f/(t-l),this._weightNext=f/(u-n),this._offsetPrev=s*p,this._offsetNext=a*p}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,u=e*l,f=u-l,p=this._offsetPrev,g=this._offsetNext,d=this._weightPrev,m=this._weightNext,x=(n-t)/(i-t),y=x*x,v=y*x,M=-d*v+2*d*y-d*x,S=(1+d)*v+(-1.5-2*d)*y+(-.5+d)*x+1,T=(-1-m)*v+(1.5+m)*y+.5*x,b=m*v-m*y;for(let A=0;A!==l;++A)s[A]=M*a[p+A]+S*a[f+A]+T*a[u+A]+b*a[g+A];return s}}class yd extends Ki{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,u=e*l,f=u-l,p=(n-t)/(i-t),g=1-p;for(let d=0;d!==l;++d)s[d]=a[f+d]*g+a[u+d]*p;return s}}class By extends Ki{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class pi{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Lt.convertArray(t,this.TimeBufferType),this.values=Lt.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Lt.convertArray(e.times,Array),values:Lt.convertArray(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new By(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new yd(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Oy(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case va:t=this.InterpolantFactoryMethodDiscrete;break;case _a:t=this.InterpolantFactoryMethodLinear;break;case Pc:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return va;case this.InterpolantFactoryMethodLinear:return _a;case this.InterpolantFactoryMethodSmooth:return Pc}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const l=this.getValueSize();this.times=Lt.arraySlice(n,s,a),this.values=Lt.arraySlice(this.values,s*l,a*l)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==s;l++){const u=n[l];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,u),e=!1;break}if(a!==null&&a>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,u,a),e=!1;break}a=u}if(i!==void 0&&Lt.isTypedArray(i))for(let l=0,u=i.length;l!==u;++l){const f=i[l];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,f),e=!1;break}}return e}optimize(){const e=Lt.arraySlice(this.times),t=Lt.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Pc,s=e.length-1;let a=1;for(let l=1;l<s;++l){let u=!1;const f=e[l],p=e[l+1];if(f!==p&&(l!==1||f!==e[0]))if(i)u=!0;else{const g=l*n,d=g-n,m=g+n;for(let x=0;x!==n;++x){const y=t[g+x];if(y!==t[d+x]||y!==t[m+x]){u=!0;break}}}if(u){if(l!==a){e[a]=e[l];const g=l*n,d=a*n;for(let m=0;m!==n;++m)t[d+m]=t[g+m]}++a}}if(s>0){e[a]=e[s];for(let l=s*n,u=a*n,f=0;f!==n;++f)t[u+f]=t[l+f];++a}return a!==e.length?(this.times=Lt.arraySlice(e,0,a),this.values=Lt.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this}clone(){const e=Lt.arraySlice(this.times,0),t=Lt.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}pi.prototype.TimeBufferType=Float32Array;pi.prototype.ValueBufferType=Float32Array;pi.prototype.DefaultInterpolation=_a;class Ss extends pi{}Ss.prototype.ValueTypeName="bool";Ss.prototype.ValueBufferType=Array;Ss.prototype.DefaultInterpolation=va;Ss.prototype.InterpolantFactoryMethodLinear=void 0;Ss.prototype.InterpolantFactoryMethodSmooth=void 0;class xd extends pi{}xd.prototype.ValueTypeName="color";class Aa extends pi{}Aa.prototype.ValueTypeName="number";class Uy extends Ki{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,u=(n-t)/(i-t);let f=e*l;for(let p=f+l;f!==p;f+=4)nn.slerpFlat(s,0,a,f-l,a,f,u);return s}}class Ro extends pi{InterpolantFactoryMethodLinear(e){return new Uy(this.times,this.values,this.getValueSize(),e)}}Ro.prototype.ValueTypeName="quaternion";Ro.prototype.DefaultInterpolation=_a;Ro.prototype.InterpolantFactoryMethodSmooth=void 0;class bs extends pi{}bs.prototype.ValueTypeName="string";bs.prototype.ValueBufferType=Array;bs.prototype.DefaultInterpolation=va;bs.prototype.InterpolantFactoryMethodLinear=void 0;bs.prototype.InterpolantFactoryMethodSmooth=void 0;class Ca extends pi{}Ca.prototype.ValueTypeName="vector";class Ra{constructor(e,t=-1,n,i=qc){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=On(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,l=n.length;a!==l;++a)t.push(_E(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(pi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let l=0;l<s;l++){let u=[],f=[];u.push((l+s-1)%s,l,(l+1)%s),f.push(0,1,0);const p=Lt.getKeyframeOrder(u);u=Lt.sortedArray(u,1,p),f=Lt.sortedArray(f,1,p),!i&&u[0]===0&&(u.push(s),f.push(f[0])),a.push(new Aa(".morphTargetInfluences["+t[l].name+"]",u,f).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let l=0,u=e.length;l<u;l++){const f=e[l],p=f.name.match(s);if(p&&p.length>1){const g=p[1];let d=i[g];d||(i[g]=d=[]),d.push(f)}}const a=[];for(const l in i)a.push(this.CreateFromMorphTargetSequence(l,i[l],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(g,d,m,x,y){if(m.length!==0){const v=[],M=[];Lt.flattenJSON(m,v,M,x),v.length!==0&&y.push(new g(d,v,M))}},i=[],s=e.name||"default",a=e.fps||30,l=e.blendMode;let u=e.length||-1;const f=e.hierarchy||[];for(let g=0;g<f.length;g++){const d=f[g].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const m={};let x;for(x=0;x<d.length;x++)if(d[x].morphTargets)for(let y=0;y<d[x].morphTargets.length;y++)m[d[x].morphTargets[y]]=-1;for(const y in m){const v=[],M=[];for(let S=0;S!==d[x].morphTargets.length;++S){const T=d[x];v.push(T.time),M.push(T.morphTarget===y?1:0)}i.push(new Aa(".morphTargetInfluence["+y+"]",v,M))}u=m.length*a}else{const m=".bones["+t[g].name+"]";n(Ca,m+".position",d,"pos",i),n(Ro,m+".quaternion",d,"rot",i),n(Ca,m+".scale",d,"scl",i)}}return i.length===0?null:new this(s,u,i,l)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function vE(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Aa;case"vector":case"vector2":case"vector3":case"vector4":return Ca;case"color":return xd;case"quaternion":return Ro;case"bool":case"boolean":return Ss;case"string":return bs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function _E(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=vE(r.type);if(r.times===void 0){const t=[],n=[];Lt.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const xs={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class vd{constructor(e,t,n){const i=this;let s=!1,a=0,l=0,u;const f=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(p){l++,s===!1&&i.onStart!==void 0&&i.onStart(p,a,l),s=!0},this.itemEnd=function(p){a++,i.onProgress!==void 0&&i.onProgress(p,a,l),a===l&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(p){i.onError!==void 0&&i.onError(p)},this.resolveURL=function(p){return u?u(p):p},this.setURLModifier=function(p){return u=p,this},this.addHandler=function(p,g){return f.push(p,g),this},this.removeHandler=function(p){const g=f.indexOf(p);return g!==-1&&f.splice(g,2),this},this.getHandler=function(p){for(let g=0,d=f.length;g<d;g+=2){const m=f[g],x=f[g+1];if(m.global&&(m.lastIndex=0),m.test(p))return x}return null}}}const ky=new vd;class En{constructor(e){this.manager=e!==void 0?e:ky,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const Vi={};class Ci extends En{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=xs.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Vi[e]!==void 0){Vi[e].push({onLoad:t,onProgress:n,onError:i});return}Vi[e]=[],Vi[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,u=this.responseType;fetch(a).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const p=Vi[e],g=f.body.getReader(),d=f.headers.get("Content-Length"),m=d?parseInt(d):0,x=m!==0;let y=0;const v=new ReadableStream({start(M){S();function S(){g.read().then(({done:T,value:b})=>{if(T)M.close();else{y+=b.byteLength;const A=new ProgressEvent("progress",{lengthComputable:x,loaded:y,total:m});for(let L=0,D=p.length;L<D;L++){const N=p[L];N.onProgress&&N.onProgress(A)}M.enqueue(b),S()}})}}});return new Response(v)}else throw Error(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`)}).then(f=>{switch(u){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(p=>new DOMParser().parseFromString(p,l));case"json":return f.json();default:if(l===void 0)return f.text();{const g=/charset="?([^;"\s]*)"?/i.exec(l),d=g&&g[1]?g[1].toLowerCase():void 0,m=new TextDecoder(d);return f.arrayBuffer().then(x=>m.decode(x))}}}).then(f=>{xs.add(e,f);const p=Vi[e];delete Vi[e];for(let g=0,d=p.length;g<d;g++){const m=p[g];m.onLoad&&m.onLoad(f)}}).catch(f=>{const p=Vi[e];if(p===void 0)throw this.manager.itemError(e),f;delete Vi[e];for(let g=0,d=p.length;g<d;g++){const m=p[g];m.onError&&m.onError(f)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class wE extends En{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Ci(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Ra.parse(e[n]);t.push(i)}return t}}class ME extends En{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],l=new td,u=new Ci(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(s.withCredentials);let f=0;function p(g){u.load(e[g],function(d){const m=s.parse(d,!0);a[g]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},f+=1,f===6&&(m.mipmapCount===1&&(l.minFilter=Gt),l.image=a,l.format=m.format,l.needsUpdate=!0,t&&t(l))},n,i)}if(Array.isArray(e))for(let g=0,d=e.length;g<d;++g)p(g);else u.load(e,function(g){const d=s.parse(g,!0);if(d.isCubemap){const m=d.mipmaps.length/d.mipmapCount;for(let x=0;x<m;x++){a[x]={mipmaps:[]};for(let y=0;y<d.mipmapCount;y++)a[x].mipmaps.push(d.mipmaps[x*d.mipmapCount+y]),a[x].format=d.format,a[x].width=d.width,a[x].height=d.height}l.image=a}else l.image.width=d.width,l.image.height=d.height,l.mipmaps=d.mipmaps;d.mipmapCount===1&&(l.minFilter=Gt),l.format=d.format,l.needsUpdate=!0,t&&t(l)},n,i);return l}}class Pa extends En{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=xs.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const l=Sa("img");function u(){p(),xs.add(e,this),t&&t(this),s.manager.itemEnd(e)}function f(g){p(),i&&i(g),s.manager.itemError(e),s.manager.itemEnd(e)}function p(){l.removeEventListener("load",u,!1),l.removeEventListener("error",f,!1)}return l.addEventListener("load",u,!1),l.addEventListener("error",f,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),s.manager.itemStart(e),l.src=e,l}}class Hy extends En{constructor(e){super(e)}load(e,t,n,i){const s=new Ao,a=new Pa(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let l=0;function u(f){a.load(e[f],function(p){s.images[f]=p,l++,l===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let f=0;f<e.length;++f)u(f);return s}}class Gy extends En{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new as,l=new Ci(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(s.withCredentials),l.load(e,function(u){const f=s.parse(u);f&&(f.image!==void 0?a.image=f.image:f.data!==void 0&&(a.image.width=f.width,a.image.height=f.height,a.image.data=f.data),a.wrapS=f.wrapS!==void 0?f.wrapS:Mn,a.wrapT=f.wrapT!==void 0?f.wrapT:Mn,a.magFilter=f.magFilter!==void 0?f.magFilter:Gt,a.minFilter=f.minFilter!==void 0?f.minFilter:Gt,a.anisotropy=f.anisotropy!==void 0?f.anisotropy:1,f.encoding!==void 0&&(a.encoding=f.encoding),f.flipY!==void 0&&(a.flipY=f.flipY),f.format!==void 0&&(a.format=f.format),f.type!==void 0&&(a.type=f.type),f.mipmaps!==void 0&&(a.mipmaps=f.mipmaps,a.minFilter=vs),f.mipmapCount===1&&(a.minFilter=Gt),f.generateMipmaps!==void 0&&(a.generateMipmaps=f.generateMipmaps),a.needsUpdate=!0,t&&t(a,f))},n,i),a}}class Vy extends En{constructor(e){super(e)}load(e,t,n,i){const s=new Ut,a=new Pa(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(l){s.image=l,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class di extends ht{constructor(e,t=1){super(),this.type="Light",this.color=new Ae(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}di.prototype.isLight=!0;class _d extends di{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.groundColor=new Ae(t)}copy(e){return di.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}_d.prototype.isHemisphereLight=!0;const Mg=new Fe,Sg=new R,bg=new R;class wd{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ue(512,512),this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Fa,this._frameExtents=new ue(1,1),this._viewportCount=1,this._viewports=[new wt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Sg.setFromMatrixPosition(e.matrixWorld),t.position.copy(Sg),bg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(bg),t.updateMatrixWorld(),Mg.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Mg),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Wy extends wd{constructor(){super(new It(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=Ma*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}Wy.prototype.isSpotLightShadow=!0;class Md extends di{constructor(e,t,n=0,i=Math.PI/3,s=0,a=1){super(e,t),this.type="SpotLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.shadow=new Wy}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Md.prototype.isSpotLight=!0;const Eg=new Fe,la=new R,jh=new R;class qy extends wd{constructor(){super(new It(90,1,.5,500)),this._frameExtents=new ue(4,2),this._viewportCount=6,this._viewports=[new wt(2,1,1,1),new wt(0,1,1,1),new wt(3,1,1,1),new wt(1,1,1,1),new wt(3,0,1,1),new wt(1,0,1,1)],this._cubeDirections=[new R(1,0,0),new R(-1,0,0),new R(0,0,1),new R(0,0,-1),new R(0,1,0),new R(0,-1,0)],this._cubeUps=[new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,0,1),new R(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),la.setFromMatrixPosition(e.matrixWorld),n.position.copy(la),jh.copy(n.position),jh.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(jh),n.updateMatrixWorld(),i.makeTranslation(-la.x,-la.y,-la.z),Eg.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Eg)}}qy.prototype.isPointLightShadow=!0;class Sd extends di{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new qy}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Sd.prototype.isPointLight=!0;class Xy extends wd{constructor(){super(new fi(-5,5,5,-5,.5,500))}}Xy.prototype.isDirectionalLightShadow=!0;class bd extends di{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,this.shadow=new Xy}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}bd.prototype.isDirectionalLight=!0;class Ed extends di{constructor(e,t){super(e,t),this.type="AmbientLight"}}Ed.prototype.isAmbientLight=!0;class Td extends di{constructor(e,t,n=10,i=10){super(e,t),this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}Td.prototype.isRectAreaLight=!0;class Ad{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new R)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}Ad.prototype.isSphericalHarmonics3=!0;class Va extends di{constructor(e=new Ad,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}Va.prototype.isLightProbe=!0;class jy extends En{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new Ci(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=qt.fromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new Ae().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new Ae().setHex(a.value);break;case"v2":i.uniforms[s].value=new ue().fromArray(a.value);break;case"v3":i.uniforms[s].value=new R().fromArray(a.value);break;case"v4":i.uniforms[s].value=new wt().fromArray(a.value);break;case"m3":i.uniforms[s].value=new tn().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Fe().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new ue().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class Uc{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Cd extends Ye{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}Cd.prototype.isInstancedBufferGeometry=!0;class Yy extends En{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Ci(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(m,x){if(t[x]!==void 0)return t[x];const v=m.interleavedBuffers[x],M=s(m,v.buffer),S=so(v.type,M),T=new ws(S,v.stride);return T.uuid=v.uuid,t[x]=T,T}function s(m,x){if(n[x]!==void 0)return n[x];const v=m.arrayBuffers[x],M=new Uint32Array(v).buffer;return n[x]=M,M}const a=e.isInstancedBufferGeometry?new Cd:new Ye,l=e.data.index;if(l!==void 0){const m=so(l.type,l.array);a.setIndex(new mt(m,1))}const u=e.data.attributes;for(const m in u){const x=u[m];let y;if(x.isInterleavedBufferAttribute){const v=i(e.data,x.data);y=new Tr(v,x.itemSize,x.offset,x.normalized)}else{const v=so(x.type,x.array),M=x.isInstancedBufferAttribute?ds:mt;y=new M(v,x.itemSize,x.normalized)}x.name!==void 0&&(y.name=x.name),x.usage!==void 0&&y.setUsage(x.usage),x.updateRange!==void 0&&(y.updateRange.offset=x.updateRange.offset,y.updateRange.count=x.updateRange.count),a.setAttribute(m,y)}const f=e.data.morphAttributes;if(f)for(const m in f){const x=f[m],y=[];for(let v=0,M=x.length;v<M;v++){const S=x[v];let T;if(S.isInterleavedBufferAttribute){const b=i(e.data,S.data);T=new Tr(b,S.itemSize,S.offset,S.normalized)}else{const b=so(S.type,S.array);T=new mt(b,S.itemSize,S.normalized)}S.name!==void 0&&(T.name=S.name),y.push(T)}a.morphAttributes[m]=y}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const g=e.data.groups||e.data.drawcalls||e.data.offsets;if(g!==void 0)for(let m=0,x=g.length;m!==x;++m){const y=g[m];a.addGroup(y.start,y.count,y.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const m=new R;d.center!==void 0&&m.fromArray(d.center),a.boundingSphere=new Lr(m,d.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class SE extends En{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?Uc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const l=new Ci(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(u){let f=null;try{f=JSON.parse(u)}catch(g){i!==void 0&&i(g),console.error("THREE:ObjectLoader: Can't parse "+e+".",g.message);return}const p=f.metadata;if(p===void 0||p.type===void 0||p.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(f,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?Uc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Ci(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),l=JSON.parse(a),u=l.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(l)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(f)}),l=this.parseTextures(e.textures,a),u=this.parseMaterials(e.materials,l),f=this.parseObject(e.object,s,u,l,n),p=this.parseSkeletons(e.skeletons,f);if(this.bindSkeletons(f,p),t!==void 0){let g=!1;for(const d in a)if(a[d]instanceof HTMLImageElement){g=!0;break}g===!1&&t(f)}return f}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),l=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,i,l,a,t),f=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,f),u}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new bi().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const l=new iu().fromJSON(e[s],i);n[l.uuid]=l}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Yy;for(let s=0,a=e.length;s<a;s++){let l;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":l=i.parse(u);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:u.type in wg?l=wg[u.type].fromJSON(u,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${u.type}"`)}l.uuid=u.uuid,u.name!==void 0&&(l.name=u.name),l.isBufferGeometry===!0&&u.userData!==void 0&&(l.userData=u.userData),n[u.uuid]=l}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new jy;s.setTextures(t);for(let a=0,l=e.length;a<l;a++){const u=e[a];if(u.type==="MultiMaterial"){const f=[];for(let p=0;p<u.materials.length;p++){const g=u.materials[p];n[g.uuid]===void 0&&(n[g.uuid]=s.parse(g)),f.push(n[g.uuid])}i[u.uuid]=f}else n[u.uuid]===void 0&&(n[u.uuid]=s.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=Ra.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function a(u){return n.manager.itemStart(u),s.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function l(u){if(typeof u=="string"){const f=u,p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(f)?f:n.resourcePath+f;return a(p)}else return u.data?{data:so(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new vd(t);s=new Pa(u),s.setCrossOrigin(this.crossOrigin);for(let f=0,p=e.length;f<p;f++){const g=e[f],d=g.url;if(Array.isArray(d)){const m=[];for(let x=0,y=d.length;x<y;x++){const v=d[x],M=l(v);M!==null&&(M instanceof HTMLImageElement?m.push(M):m.push(new as(M.data,M.width,M.height)))}i[g.uuid]=new $r(m)}else{const m=l(g.url);i[g.uuid]=new $r(m)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(a){if(typeof a=="string"){const l=a,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:t.resourcePath+l;return await i.loadAsync(u)}else return a.data?{data:so(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new Pa(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,l=e.length;a<l;a++){const u=e[a],f=u.url;if(Array.isArray(f)){const p=[];for(let g=0,d=f.length;g<d;g++){const m=f[g],x=await s(m);x!==null&&(x instanceof HTMLImageElement?p.push(x):p.push(new as(x.data,x.width,x.height)))}n[u.uuid]=new $r(p)}else{const p=await s(u.url);n[u.uuid]=new $r(p)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const l=e[s];l.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',l.uuid),t[l.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",l.image);const u=t[l.image],f=u.data;let p;Array.isArray(f)?(p=new Ao,f.length===6&&(p.needsUpdate=!0)):(f&&f.data?p=new as:p=new Ut,f&&(p.needsUpdate=!0)),p.source=u,p.uuid=l.uuid,l.name!==void 0&&(p.name=l.name),l.mapping!==void 0&&(p.mapping=n(l.mapping,bE)),l.offset!==void 0&&p.offset.fromArray(l.offset),l.repeat!==void 0&&p.repeat.fromArray(l.repeat),l.center!==void 0&&p.center.fromArray(l.center),l.rotation!==void 0&&(p.rotation=l.rotation),l.wrap!==void 0&&(p.wrapS=n(l.wrap[0],Tg),p.wrapT=n(l.wrap[1],Tg)),l.format!==void 0&&(p.format=l.format),l.type!==void 0&&(p.type=l.type),l.encoding!==void 0&&(p.encoding=l.encoding),l.minFilter!==void 0&&(p.minFilter=n(l.minFilter,Ag)),l.magFilter!==void 0&&(p.magFilter=n(l.magFilter,Ag)),l.anisotropy!==void 0&&(p.anisotropy=l.anisotropy),l.flipY!==void 0&&(p.flipY=l.flipY),l.premultiplyAlpha!==void 0&&(p.premultiplyAlpha=l.premultiplyAlpha),l.unpackAlignment!==void 0&&(p.unpackAlignment=l.unpackAlignment),l.userData!==void 0&&(p.userData=l.userData),i[l.uuid]=p}return i}parseObject(e,t,n,i,s){let a;function l(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function u(d){if(d!==void 0){if(Array.isArray(d)){const m=[];for(let x=0,y=d.length;x<y;x++){const v=d[x];n[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),m.push(n[v])}return m}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function f(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let p,g;switch(e.type){case"Scene":a=new Ua,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new Ae(e.background):a.background=f(e.background)),e.environment!==void 0&&(a.environment=f(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new Ba(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Oa(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":a=new It(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new fi(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Ed(e.color,e.intensity);break;case"DirectionalLight":a=new bd(e.color,e.intensity);break;case"PointLight":a=new Sd(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new Td(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Md(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new _d(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new Va().fromJSON(e);break;case"SkinnedMesh":p=l(e.geometry),g=u(e.material),a=new tu(p,g),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":p=l(e.geometry),g=u(e.material),a=new Kt(p,g);break;case"InstancedMesh":p=l(e.geometry),g=u(e.material);const d=e.count,m=e.instanceMatrix,x=e.instanceColor;a=new $f(p,g,d),a.instanceMatrix=new ds(new Float32Array(m.array),16),x!==void 0&&(a.instanceColor=new ds(new Float32Array(x.array),x.itemSize));break;case"LOD":a=new Cy;break;case"Line":a=new Zi(l(e.geometry),u(e.material));break;case"LineLoop":a=new ed(l(e.geometry),u(e.material));break;case"LineSegments":a=new Pn(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new ka(l(e.geometry),u(e.material));break;case"Sprite":a=new eu(u(e.material));break;case"Group":a=new es;break;case"Bone":a=new nu;break;default:a=new ht}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let m=0;m<d.length;m++)a.add(this.parseObject(d[m],t,n,i,s))}if(e.animations!==void 0){const d=e.animations;for(let m=0;m<d.length;m++){const x=d[m];a.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const d=e.levels;for(let m=0;m<d.length;m++){const x=d[m],y=a.getObjectByProperty("uuid",x.object);y!==void 0&&a.addLevel(y,x.distance)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}const bE={UVMapping:Wc,CubeReflectionMapping:Sr,CubeRefractionMapping:br,EquirectangularReflectionMapping:ma,EquirectangularRefractionMapping:ga,CubeUVReflectionMapping:Eo},Tg={RepeatWrapping:ya,ClampToEdgeWrapping:Mn,MirroredRepeatWrapping:xa},Ag={NearestFilter:Zt,NearestMipmapNearestFilter:Nc,NearestMipmapLinearFilter:Fc,LinearFilter:Gt,LinearMipmapNearestFilter:jf,LinearMipmapLinearFilter:vs};class Jy extends En{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=xs.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,fetch(e,l).then(function(u){return u.blob()}).then(function(u){return createImageBitmap(u,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(u){xs.add(e,u),t&&t(u),s.manager.itemEnd(e)}).catch(function(u){i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}Jy.prototype.isImageBitmapLoader=!0;let gc;const Rd={getContext:function(){return gc===void 0&&(gc=new(window.AudioContext||window.webkitAudioContext)),gc},setContext:function(r){gc=r}};class Zy extends En{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Ci(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const u=l.slice(0);Rd.getContext().decodeAudioData(u,function(p){t(p)})}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}}class Ky extends Va{constructor(e,t,n=1){super(void 0,n);const i=new Ae().set(e),s=new Ae().set(t),a=new R(i.r,i.g,i.b),l=new R(s.r,s.g,s.b),u=Math.sqrt(Math.PI),f=u*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(l).multiplyScalar(u),this.sh.coefficients[1].copy(a).sub(l).multiplyScalar(f)}}Ky.prototype.isHemisphereLightProbe=!0;class Qy extends Va{constructor(e,t=1){super(void 0,t);const n=new Ae().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}Qy.prototype.isAmbientLightProbe=!0;const Cg=new Fe,Rg=new Fe,Vr=new Fe;class EE{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new It,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new It,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Vr.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(rs*t.fov*.5)/t.zoom;let l,u;Rg.elements[12]=-i,Cg.elements[12]=i,l=-a*t.aspect+s,u=a*t.aspect+s,Vr.elements[0]=2*t.near/(u-l),Vr.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(Vr),l=-a*t.aspect-s,u=a*t.aspect-s,Vr.elements[0]=2*t.near/(u-l),Vr.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(Vr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Rg),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Cg)}}class Pd{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Pg(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Pg();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Pg(){return(typeof performance>"u"?Date:performance).now()}const Wr=new R,Lg=new nn,TE=new R,qr=new R;class AE extends ht{constructor(){super(),this.type="AudioListener",this.context=Rd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Pd}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Wr,Lg,TE),qr.set(0,0,-1).applyQuaternion(Lg),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Wr.x,i),t.positionY.linearRampToValueAtTime(Wr.y,i),t.positionZ.linearRampToValueAtTime(Wr.z,i),t.forwardX.linearRampToValueAtTime(qr.x,i),t.forwardY.linearRampToValueAtTime(qr.y,i),t.forwardZ.linearRampToValueAtTime(qr.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Wr.x,Wr.y,Wr.z),t.setOrientation(qr.x,qr.y,qr.z,n.x,n.y,n.z)}}class Ld extends ht{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const Xr=new R,Dg=new nn,CE=new R,jr=new R;class RE extends Ld{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Xr,Dg,CE),jr.set(0,0,1).applyQuaternion(Dg);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Xr.x,n),t.positionY.linearRampToValueAtTime(Xr.y,n),t.positionZ.linearRampToValueAtTime(Xr.z,n),t.orientationX.linearRampToValueAtTime(jr.x,n),t.orientationY.linearRampToValueAtTime(jr.y,n),t.orientationZ.linearRampToValueAtTime(jr.z,n)}else t.setPosition(Xr.x,Xr.y,Xr.z),t.setOrientation(jr.x,jr.y,jr.z)}}class $y{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class ex{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let l=0;l!==i;++l)n[s+l]=n[l];a=t}else{a+=t;const l=t/a;this._mixBufferRegion(n,s,0,l,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,l=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,f=t+t;u!==f;++u)if(n[u]!==n[u+t]){l.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){nn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;nn.multiplyQuaternionsFlat(e,a,e,t,e,n),nn.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let l=0;l!==s;++l){const u=t+l;e[u]=e[u]*a+e[n+l]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]+e[n+a]*i}}}const Dd="\\[\\]\\.:\\/",PE=new RegExp("["+Dd+"]","g"),Id="[^"+Dd+"]",LE="[^"+Dd.replace("\\.","")+"]",DE=/((?:WC+[\/:])*)/.source.replace("WC",Id),IE=/(WCOD+)?/.source.replace("WCOD",LE),zE=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Id),NE=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Id),FE=new RegExp("^"+DE+IE+zE+NE+"$"),OE=["material","materials","bones"];class BE{constructor(e,t,n){const i=n||gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class gt{constructor(e,t,n){this.path=t,this.parsedPath=n||gt.parseTrackName(t),this.node=gt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new gt.Composite(e,t,n):new gt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(PE,"")}static parseTrackName(e){const t=FE.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);OE.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const l=s[a];if(l.name===t||l.uuid===t)return l;const u=n(l.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=gt.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let f=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let p=0;p<e.length;p++)if(e[p].name===f){f=p;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(f!==void 0){if(e[f]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[f]}}const a=e[i];if(a===void 0){const f=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+f+"."+i+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}u=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(u=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}gt.Composite=BE;gt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};gt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};gt.prototype.GetterByBindingType=[gt.prototype._getValue_direct,gt.prototype._getValue_array,gt.prototype._getValue_arrayElement,gt.prototype._getValue_toArray];gt.prototype.SetterByBindingTypeAndVersioning=[[gt.prototype._setValue_direct,gt.prototype._setValue_direct_setNeedsUpdate,gt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[gt.prototype._setValue_array,gt.prototype._setValue_array_setNeedsUpdate,gt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[gt.prototype._setValue_arrayElement,gt.prototype._setValue_arrayElement_setNeedsUpdate,gt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[gt.prototype._setValue_fromArray,gt.prototype._setValue_fromArray_setNeedsUpdate,gt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class tx{constructor(){this.uuid=On(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let l,u=e.length,f=this.nCachedObjects_;for(let p=0,g=arguments.length;p!==g;++p){const d=arguments[p],m=d.uuid;let x=t[m];if(x===void 0){x=u++,t[m]=x,e.push(d);for(let y=0,v=a;y!==v;++y)s[y].push(new gt(d,n[y],i[y]))}else if(x<f){l=e[x];const y=--f,v=e[y];t[v.uuid]=x,e[x]=v,t[m]=y,e[y]=d;for(let M=0,S=a;M!==S;++M){const T=s[M],b=T[y];let A=T[x];T[x]=b,A===void 0&&(A=new gt(d,n[M],i[M])),T[y]=A}}else e[x]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=f}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,l=arguments.length;a!==l;++a){const u=arguments[a],f=u.uuid,p=t[f];if(p!==void 0&&p>=s){const g=s++,d=e[g];t[d.uuid]=p,e[p]=d,t[f]=g,e[g]=u;for(let m=0,x=i;m!==x;++m){const y=n[m],v=y[g],M=y[p];y[p]=v,y[g]=M}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let l=0,u=arguments.length;l!==u;++l){const f=arguments[l],p=f.uuid,g=t[p];if(g!==void 0)if(delete t[p],g<s){const d=--s,m=e[d],x=--a,y=e[x];t[m.uuid]=g,e[g]=m,t[y.uuid]=d,e[d]=y,e.pop();for(let v=0,M=i;v!==M;++v){const S=n[v],T=S[d],b=S[x];S[g]=T,S[d]=b,S.pop()}}else{const d=--a,m=e[d];d>0&&(t[m.uuid]=g),e[g]=m,e.pop();for(let x=0,y=i;x!==y;++x){const v=n[x];v[g]=v[d],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,l=this._parsedPaths,u=this._objects,f=u.length,p=this.nCachedObjects_,g=new Array(f);i=s.length,n[e]=i,a.push(e),l.push(t),s.push(g);for(let d=p,m=u.length;d!==m;++d){const x=u[d];g[d]=new gt(x,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,l=a.length-1,u=a[l],f=e[l];t[f]=n,a[n]=u,a.pop(),s[n]=s[l],s.pop(),i[n]=i[l],i.pop()}}}tx.prototype.isAnimationObjectGroup=!0;class UE{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,l=new Array(a),u={endingStart:Kr,endingEnd:Kr};for(let f=0;f!==a;++f){const p=s[f].createInterpolant(null);l[f]=p,p.settings=u}this._interpolantSettings=u,this._interpolants=l,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=J0,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,a=s/i,l=i/s;e.warp(1,a,t),this.warp(l,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=i._lendControlInterpolant(),this._timeScaleInterpolant=l);const u=l.parameterPositions,f=l.sampleValues;return u[0]=s,u[1]=s+n,f[0]=e/a,f[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const u=(e-s)*n;if(u<0||n===0)return;this._startTime=null,t=n*u}t*=this._updateTimeScale(e);const a=this._updateTime(t),l=this._updateWeight(e);if(l>0){const u=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case Yf:for(let p=0,g=u.length;p!==g;++p)u[p].evaluate(a),f[p].accumulateAdditive(l);break;case qc:default:for(let p=0,g=u.length;p!==g;++p)u[p].evaluate(a),f[p].accumulate(i,l)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===Z0;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===Y0){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const l=Math.floor(i/t);i-=t*l,s+=Math.abs(l);const u=this.repetitions-s;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const f=e<0;this._setEndings(f,!f,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Qr,i.endingEnd=Qr):(e?i.endingStart=this.zeroSlopeAtStart?Qr:Kr:i.endingStart=wa,t?i.endingEnd=this.zeroSlopeAtEnd?Qr:Kr:i.endingEnd=wa)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const l=a.parameterPositions,u=a.sampleValues;return l[0]=s,u[0]=t,l[1]=s+e,u[1]=n,this}}class nx extends Rr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,l=e._interpolants,u=n.uuid,f=this._bindingsByRootAndName;let p=f[u];p===void 0&&(p={},f[u]=p);for(let g=0;g!==s;++g){const d=i[g],m=d.name;let x=p[m];if(x!==void 0)++x.referenceCount,a[g]=x;else{if(x=a[g],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,u,m));continue}const y=t&&t._propertyBindings[g].binding.parsedPath;x=new ex(gt.create(n,m,y),d.ValueTypeName,d.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,u,m),a[g]=x}l[g].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const l=a.knownActions;e._byClipCacheIndex=l.length,l.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,l=a[s],u=l.knownActions,f=u[u.length-1],p=e._byClipCacheIndex;f._byClipCacheIndex=p,u[p]=f,u.pop(),e._byClipCacheIndex=null;const g=l.actionByRoot,d=(e._localRoot||this._root).uuid;delete g[d],u.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,l=a[i],u=t[t.length-1],f=e._cacheIndex;u._cacheIndex=f,t[f]=u,t.pop(),delete l[s],Object.keys(l).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new yd(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?Ra.findByName(i,e):e;const l=a!==null?a.uuid:e,u=this._actionsByClip[l];let f=null;if(n===void 0&&(a!==null?n=a.blendMode:n=qc),u!==void 0){const g=u.actionByRoot[s];if(g!==void 0&&g.blendMode===n)return g;f=u.knownActions[0],a===null&&(a=f._clip)}if(a===null)return null;const p=new UE(this,a,t,n);return this._bindAction(p,f),this._addInactiveAction(p,l,s),p}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?Ra.findByName(n,e):e,a=s?s.uuid:e,l=this._actionsByClip[a];return l!==void 0&&l.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let f=0;f!==n;++f)t[f]._update(i,e,s,a);const l=this._bindings,u=this._nActiveBindings;for(let f=0;f!==u;++f)l[f].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let l=0,u=a.length;l!==u;++l){const f=a[l];this._deactivateAction(f);const p=f._cacheIndex,g=t[t.length-1];f._cacheIndex=null,f._byClipCacheIndex=null,g._cacheIndex=p,t[p]=g,t.pop(),this._removeInactiveBindingsForAction(f)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const l=n[a].actionByRoot,u=l[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const l=s[a];l.restoreOriginalState(),this._removeInactiveBinding(l)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}nx.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class hu{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new hu(this.value.clone===void 0?this.value:this.value.clone())}}class ix extends ws{constructor(e,t,n=1){super(e,t),this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}ix.prototype.isInstancedInterleavedBuffer=!0;class rx{constructor(e,t,n,i,s){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}rx.prototype.isGLBufferAttribute=!0;class sx{constructor(e,t,n=0,i=1/0){this.ray=new Qi(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new os,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return Nf(e,this,n,t),n.sort(Ig),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Nf(e[i],this,n,t);return n.sort(Ig),n}}function Ig(r,e){return r.distance-e.distance}function Nf(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,a=i.length;s<a;s++)Nf(i[s],e,t,!0)}}class Ff{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Vt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class kE{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const zg=new ue;class Po{constructor(e=new ue(1/0,1/0),t=new ue(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=zg.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return zg.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Po.prototype.isBox2=!0;const Ng=new R,yc=new R;class ox{constructor(e=new R,t=new R){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Ng.subVectors(e,this.start),yc.subVectors(this.end,this.start);const n=yc.dot(yc);let s=yc.dot(Ng)/n;return t&&(s=Vt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Fg=new R;class HE extends ht{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new Ye,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,l=1,u=32;a<u;a++,l++){const f=a/u*Math.PI*2,p=l/u*Math.PI*2;i.push(Math.cos(f),Math.sin(f),1,Math.cos(p),Math.sin(p),1)}n.setAttribute("position",new Ne(i,3));const s=new sn({fog:!1,toneMapped:!1});this.cone=new Pn(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Fg.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Fg),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const xr=new R,xc=new Fe,Yh=new Fe;class ax extends Pn{constructor(e){const t=lx(e),n=new Ye,i=[],s=[],a=new Ae(0,0,1),l=new Ae(0,1,0);for(let f=0;f<t.length;f++){const p=t[f];p.parent&&p.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(a.r,a.g,a.b),s.push(l.r,l.g,l.b))}n.setAttribute("position",new Ne(i,3)),n.setAttribute("color",new Ne(s,3));const u=new sn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,u),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Yh.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const l=t[s];l.parent&&l.parent.isBone&&(xc.multiplyMatrices(Yh,l.matrixWorld),xr.setFromMatrixPosition(xc),i.setXYZ(a,xr.x,xr.y,xr.z),xc.multiplyMatrices(Yh,l.parent.matrixWorld),xr.setFromMatrixPosition(xc),i.setXYZ(a+1,xr.x,xr.y,xr.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function lx(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,lx(r.children[t]));return e}class GE extends Kt{constructor(e,t,n){const i=new ys(t,4,2),s=new $i({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const VE=new R,Og=new Ae,Bg=new Ae;class WE extends ht{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new ms(t);i.rotateY(Math.PI*.5),this.material=new $i({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new mt(a,3)),this.add(new Kt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Og.copy(this.light.color),Bg.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?Og:Bg;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}e.lookAt(VE.setFromMatrixPosition(this.light.matrixWorld).negate())}}class cx extends Pn{constructor(e=10,t=10,n=4473924,i=8947848){n=new Ae(n),i=new Ae(i);const s=t/2,a=e/t,l=e/2,u=[],f=[];for(let d=0,m=0,x=-l;d<=t;d++,x+=a){u.push(-l,0,x,l,0,x),u.push(x,0,-l,x,0,l);const y=d===s?n:i;y.toArray(f,m),m+=3,y.toArray(f,m),m+=3,y.toArray(f,m),m+=3,y.toArray(f,m),m+=3}const p=new Ye;p.setAttribute("position",new Ne(u,3)),p.setAttribute("color",new Ne(f,3));const g=new sn({vertexColors:!0,toneMapped:!1});super(p,g),this.type="GridHelper"}}class qE extends Pn{constructor(e=10,t=16,n=8,i=64,s=4473924,a=8947848){s=new Ae(s),a=new Ae(a);const l=[],u=[];for(let g=0;g<=t;g++){const d=g/t*(Math.PI*2),m=Math.sin(d)*e,x=Math.cos(d)*e;l.push(0,0,0),l.push(m,0,x);const y=g&1?s:a;u.push(y.r,y.g,y.b),u.push(y.r,y.g,y.b)}for(let g=0;g<=n;g++){const d=g&1?s:a,m=e-e/n*g;for(let x=0;x<i;x++){let y=x/i*(Math.PI*2),v=Math.sin(y)*m,M=Math.cos(y)*m;l.push(v,0,M),u.push(d.r,d.g,d.b),y=(x+1)/i*(Math.PI*2),v=Math.sin(y)*m,M=Math.cos(y)*m,l.push(v,0,M),u.push(d.r,d.g,d.b)}}const f=new Ye;f.setAttribute("position",new Ne(l,3)),f.setAttribute("color",new Ne(u,3));const p=new sn({vertexColors:!0,toneMapped:!1});super(f,p),this.type="PolarGridHelper"}}const Ug=new R,vc=new R,kg=new R;class XE extends ht{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new Ye;i.setAttribute("position",new Ne([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new sn({fog:!1,toneMapped:!1});this.lightPlane=new Zi(i,s),this.add(this.lightPlane),i=new Ye,i.setAttribute("position",new Ne([0,0,0,0,0,1],3)),this.targetLine=new Zi(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){Ug.setFromMatrixPosition(this.light.matrixWorld),vc.setFromMatrixPosition(this.light.target.matrixWorld),kg.subVectors(vc,Ug),this.lightPlane.lookAt(vc),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(vc),this.targetLine.scale.z=kg.length()}}const _c=new R,Bt=new hs;class jE extends Pn{constructor(e){const t=new Ye,n=new sn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={},l=new Ae(16755200),u=new Ae(16711680),f=new Ae(43775),p=new Ae(16777215),g=new Ae(3355443);d("n1","n2",l),d("n2","n4",l),d("n4","n3",l),d("n3","n1",l),d("f1","f2",l),d("f2","f4",l),d("f4","f3",l),d("f3","f1",l),d("n1","f1",l),d("n2","f2",l),d("n3","f3",l),d("n4","f4",l),d("p","n1",u),d("p","n2",u),d("p","n3",u),d("p","n4",u),d("u1","u2",f),d("u2","u3",f),d("u3","u1",f),d("c","t",p),d("p","c",g),d("cn1","cn2",g),d("cn3","cn4",g),d("cf1","cf2",g),d("cf3","cf4",g);function d(x,y,v){m(x,v),m(y,v)}function m(x,y){i.push(0,0,0),s.push(y.r,y.g,y.b),a[x]===void 0&&(a[x]=[]),a[x].push(i.length/3-1)}t.setAttribute("position",new Ne(i,3)),t.setAttribute("color",new Ne(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Bt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Ht("c",t,e,Bt,0,0,-1),Ht("t",t,e,Bt,0,0,1),Ht("n1",t,e,Bt,-n,-i,-1),Ht("n2",t,e,Bt,n,-i,-1),Ht("n3",t,e,Bt,-n,i,-1),Ht("n4",t,e,Bt,n,i,-1),Ht("f1",t,e,Bt,-n,-i,1),Ht("f2",t,e,Bt,n,-i,1),Ht("f3",t,e,Bt,-n,i,1),Ht("f4",t,e,Bt,n,i,1),Ht("u1",t,e,Bt,n*.7,i*1.1,-1),Ht("u2",t,e,Bt,-n*.7,i*1.1,-1),Ht("u3",t,e,Bt,0,i*2,-1),Ht("cf1",t,e,Bt,-n,0,1),Ht("cf2",t,e,Bt,n,0,1),Ht("cf3",t,e,Bt,0,-i,1),Ht("cf4",t,e,Bt,0,i,1),Ht("cn1",t,e,Bt,-n,0,-1),Ht("cn2",t,e,Bt,n,0,-1),Ht("cn3",t,e,Bt,0,-i,-1),Ht("cn4",t,e,Bt,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ht(r,e,t,n,i,s,a){_c.set(i,s,a).unproject(n);const l=e[r];if(l!==void 0){const u=t.getAttribute("position");for(let f=0,p=l.length;f<p;f++)u.setXYZ(l[f],_c.x,_c.y,_c.z)}}const wc=new Un;class ux extends Pn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new Ye;s.setIndex(new mt(n,1)),s.setAttribute("position",new mt(i,3)),super(s,new sn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&wc.setFromObject(this.object),wc.isEmpty())return;const t=wc.min,n=wc.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return Pn.prototype.copy.call(this,e),this.object=e.object,this}}class YE extends Pn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ye;s.setIndex(new mt(n,1)),s.setAttribute("position",new Ne(i,3)),super(s,new sn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class JE extends Zi{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],a=new Ye;a.setAttribute("position",new Ne(s,3)),a.computeBoundingSphere(),super(a,new sn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const l=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],u=new Ye;u.setAttribute("position",new Ne(l,3)),u.computeBoundingSphere(),this.add(new Kt(u,new $i({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?Fn:ls,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}const Hg=new R;let Mc,Jh;class ZE extends ht{constructor(e=new R(0,0,1),t=new R(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",Mc===void 0&&(Mc=new Ye,Mc.setAttribute("position",new Ne([0,0,0,0,1,0],3)),Jh=new Ar(0,.5,1,5,1),Jh.translate(0,-.5,0)),this.position.copy(t),this.line=new Zi(Mc,new sn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Kt(Jh,new $i({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Hg.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Hg,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class hx extends Pn{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Ye;i.setAttribute("position",new Ne(t,3)),i.setAttribute("color",new Ne(n,3));const s=new sn({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new Ae,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class KE{constructor(){this.type="ShapePath",this.color=new Ae,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new fo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(S){const T=[];for(let b=0,A=S.length;b<A;b++){const L=S[b],D=new bi;D.curves=L.curves,T.push(D)}return T}function i(S,T){const b=T.length;let A=!1;for(let L=b-1,D=0;D<b;L=D++){let N=T[L],q=T[D],B=q.x-N.x,C=q.y-N.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(N=T[D],B=-B,q=T[L],C=-C),S.y<N.y||S.y>q.y)continue;if(S.y===N.y){if(S.x===N.x)return!0}else{const z=C*(S.x-N.x)-B*(S.y-N.y);if(z===0)return!0;if(z<0)continue;A=!A}}else{if(S.y!==N.y)continue;if(q.x<=S.x&&S.x<=N.x||N.x<=S.x&&S.x<=q.x)return!0}}return A}const s=Ei.isClockWise,a=this.subPaths;if(a.length===0)return[];if(t===!0)return n(a);let l,u,f;const p=[];if(a.length===1)return u=a[0],f=new bi,f.curves=u.curves,p.push(f),p;let g=!s(a[0].getPoints());g=e?!g:g;const d=[],m=[];let x=[],y=0,v;m[y]=void 0,x[y]=[];for(let S=0,T=a.length;S<T;S++)u=a[S],v=u.getPoints(),l=s(v),l=e?!l:l,l?(!g&&m[y]&&y++,m[y]={s:new bi,p:v},m[y].s.curves=u.curves,g&&y++,x[y]=[]):x[y].push({h:u,p:v[0]});if(!m[0])return n(a);if(m.length>1){let S=!1,T=0;for(let b=0,A=m.length;b<A;b++)d[b]=[];for(let b=0,A=m.length;b<A;b++){const L=x[b];for(let D=0;D<L.length;D++){const N=L[D];let q=!0;for(let B=0;B<m.length;B++)i(N.p,m[B].p)&&(b!==B&&T++,q?(q=!1,d[B].push(N)):S=!0);q&&d[b].push(N)}}T>0&&S===!1&&(x=d)}let M;for(let S=0,T=m.length;S<T;S++){f=m[S].s,p.push(f),M=x[S];for(let b=0,A=M.length;b<A;b++)f.holes.push(M[b].h)}return p}}class QE{static toHalfFloat(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Vt(e,-65504,65504),Gg[0]=e;const t=Vg[0],n=t>>23&511;return ai[n]+((t&8388607)>>li[n])}static fromHalfFloat(e){const t=e>>10;return Vg[0]=zd[dx[t]+(e&1023)]+Lo[t],Gg[0]}}const fx=new ArrayBuffer(4),Gg=new Float32Array(fx),Vg=new Uint32Array(fx),ai=new Uint32Array(512),li=new Uint32Array(512);for(let r=0;r<256;++r){const e=r-127;e<-27?(ai[r]=0,ai[r|256]=32768,li[r]=24,li[r|256]=24):e<-14?(ai[r]=1024>>-e-14,ai[r|256]=1024>>-e-14|32768,li[r]=-e-1,li[r|256]=-e-1):e<=15?(ai[r]=e+15<<10,ai[r|256]=e+15<<10|32768,li[r]=13,li[r|256]=13):e<128?(ai[r]=31744,ai[r|256]=64512,li[r]=24,li[r|256]=24):(ai[r]=31744,ai[r|256]=64512,li[r]=13,li[r|256]=13)}const zd=new Uint32Array(2048),Lo=new Uint32Array(64),dx=new Uint32Array(64);for(let r=1;r<1024;++r){let e=r<<13,t=0;for(;!(e&8388608);)e<<=1,t-=8388608;e&=-8388609,t+=947912704,zd[r]=e|t}for(let r=1024;r<2048;++r)zd[r]=939524096+(r-1024<<13);for(let r=1;r<31;++r)Lo[r]=r<<23;Lo[31]=1199570944;Lo[32]=2147483648;for(let r=33;r<63;++r)Lo[r]=2147483648+(r-32<<23);Lo[63]=3347054592;for(let r=1;r<64;++r)r!==32&&(dx[r]=1024);const $E=0,eT=1,tT=0,nT=1,iT=2;function rT(r){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),r}function sT(r=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),r.isMultiMaterial=!0,r.materials=r,r.clone=function(){return r.slice()},r}class oT extends ka{constructor(e,t){console.warn("THREE.PointCloud has been renamed to THREE.Points."),super(e,t)}}class aT extends eu{constructor(e){console.warn("THREE.Particle has been renamed to THREE.Sprite."),super(e)}}class lT extends ka{constructor(e,t){console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),super(e,t)}}class cT extends Ms{constructor(e){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class uT extends Ms{constructor(e){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class hT extends Ms{constructor(e){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),super(e)}}class fT extends R{constructor(e,t,n){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),super(e,t,n)}}class dT extends mt{constructor(e,t){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),super(e,t),this.setUsage(uo)}}class pT extends ly{constructor(e,t){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),super(e,t)}}class mT extends cy{constructor(e,t){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),super(e,t)}}class gT extends uy{constructor(e,t){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),super(e,t)}}class yT extends hy{constructor(e,t){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),super(e,t)}}class xT extends Xc{constructor(e,t){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),super(e,t)}}class vT extends fy{constructor(e,t){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),super(e,t)}}class _T extends jc{constructor(e,t){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),super(e,t)}}class wT extends Ne{constructor(e,t){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),super(e,t)}}class MT extends py{constructor(e,t){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),super(e,t)}}Bn.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(Bn.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};fo.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};class ST extends hx{constructor(e){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),super(e)}}class bT extends ux{constructor(e,t){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),super(e,t)}}class ET extends Pn{constructor(e,t){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),super(new lu(e.geometry),new sn({color:t!==void 0?t:16777215}))}}cx.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};ax.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};class TT extends Pn{constructor(e,t){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),super(new ad(e.geometry),new sn({color:t!==void 0?t:16777215}))}}En.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Uc.extractUrlBase(r)};En.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};class AT extends Ci{constructor(e){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),super(e)}}class CT extends Gy{constructor(e){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),super(e)}}Po.prototype.center=function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)};Po.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Po.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Po.prototype.size=function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)};Un.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)};Un.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Un.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Un.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};Un.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)};Dr.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")};Lr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Fa.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)};ox.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)};tn.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};tn.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};tn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};tn.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};tn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};tn.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};Fe.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)};Fe.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};Fe.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new R().setFromMatrixColumn(this,3)};Fe.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)};Fe.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Fe.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Fe.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Fe.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Fe.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)};Fe.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Fe.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Fe.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Fe.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Fe.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Fe.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Fe.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Fe.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Fe.prototype.makeFrustum=function(r,e,t,n,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,s)};Fe.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};ci.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)};nn.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)};nn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};Qi.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Qi.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)};Qi.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};Wt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Wt.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)};Wt.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)};Wt.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)};Wt.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)};Wt.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Wt.getBarycoord(r,e,t,n,i)};Wt.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Wt.getNormal(r,e,t,n)};bi.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)};bi.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ai(this,r)};bi.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new gs(this,r)};ue.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};ue.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};ue.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};R.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};R.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};R.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)};R.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)};R.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)};R.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)};R.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};R.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};R.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};wt.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};wt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};ht.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)};ht.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};ht.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)};ht.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};ht.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(ht.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Kt.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(Kt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),K0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});tu.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};It.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)};Object.defineProperties(di.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}});Object.defineProperties(mt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===uo},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(uo)}}});mt.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?uo:co),this};mt.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},mt.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ye.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)};Ye.prototype.addAttribute=function(r,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(r,new mt(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)};Ye.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)};Ye.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Ye.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Ye.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)};Ye.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(Ye.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});ws.prototype.setDynamic=function(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?uo:co),this};ws.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ai.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Ai.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Ai.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};Ua.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};hu.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(qt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Ae}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===Vf}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}});Object.defineProperties(Qn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}});Mt.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)};Mt.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)};Mt.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Mt.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Mt.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Mt.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Mt.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Mt.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Mt.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Mt.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Mt.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Mt.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Mt.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Mt.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Mt.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)};Mt.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Mt.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Mt.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Mt.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Mt.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Mt.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Mt.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Mt.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Mt.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Mt.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Mt.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?Tt:Kn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});Object.defineProperties(by.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});class RT extends Jc{constructor(e,t,n){console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),super(e,n)}}Object.defineProperties(Sn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}});Ld.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new Zy().load(r,function(n){e.setBuffer(n)}),this};$y.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Yc.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)};Yc.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)};Pr.crossOrigin=void 0;Pr.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new Vy;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s};Pr.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new Hy;i.setCrossOrigin(this.crossOrigin);const s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s};Pr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Pr.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};function PT(){console.error("THREE.CanvasRenderer has been removed")}function LT(){console.error("THREE.JSONLoader has been removed.")}const DT={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function IT(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}class zT extends Ye{constructor(){console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),super()}}class NT extends Ye{constructor(){console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),super()}}function FT(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function OT(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function BT(){console.error("THREE.ImmediateRenderObject has been removed.")}class UT extends Sn{constructor(e,t,n){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,n),this.samples=4}}class kT extends To{constructor(e,t,n,i){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,n,i)}}class HT extends Na{constructor(e,t,n,i){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vc}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vc);const GT=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Xf,AddEquation:Jr,AddOperation:C0,AdditiveAnimationBlendMode:Yf,AdditiveBlending:tf,AlphaFormat:B0,AlwaysDepth:w0,AlwaysStencilFunc:ty,AmbientLight:Ed,AmbientLightProbe:Qy,AnimationClip:Ra,AnimationLoader:wE,AnimationMixer:nx,AnimationObjectGroup:tx,AnimationUtils:Lt,ArcCurve:nd,ArrayCamera:Kf,ArrowHelper:ZE,Audio:Ld,AudioAnalyser:$y,AudioContext:Rd,AudioListener:AE,AudioLoader:Zy,AxesHelper:hx,AxisHelper:ST,BackSide:Fn,BasicDepthPacking:Q0,BasicShadowMap:g_,BinaryTextureLoader:CT,Bone:nu,BooleanKeyframeTrack:Ss,BoundingBoxHelper:bT,Box2:Po,Box3:Un,Box3Helper:YE,BoxBufferGeometry:Ji,BoxGeometry:Ji,BoxHelper:ux,BufferAttribute:mt,BufferGeometry:Ye,BufferGeometryLoader:Yy,ByteType:I0,Cache:xs,Camera:hs,CameraHelper:jE,CanvasRenderer:PT,CanvasTexture:Ly,CapsuleBufferGeometry:po,CapsuleGeometry:po,CatmullRomCurve3:rd,CineonToneMapping:L0,CircleBufferGeometry:mo,CircleGeometry:mo,ClampToEdgeWrapping:Mn,Clock:Pd,Color:Ae,ColorKeyframeTrack:xd,ColorManagement:Jn,CompressedTexture:td,CompressedTextureLoader:ME,ConeBufferGeometry:go,ConeGeometry:go,CubeCamera:Yc,CubeReflectionMapping:Sr,CubeRefractionMapping:br,CubeTexture:Ao,CubeTextureLoader:Hy,CubeUVReflectionMapping:Eo,CubicBezierCurve:ru,CubicBezierCurve3:sd,CubicInterpolant:Oy,CullFaceBack:ef,CullFaceFront:a0,CullFaceFrontBack:m_,CullFaceNone:o0,Curve:Bn,CurvePath:Iy,CustomBlending:l0,CustomToneMapping:D0,CylinderBufferGeometry:Ar,CylinderGeometry:Ar,Cylindrical:kE,Data3DTexture:Na,DataArrayTexture:To,DataTexture:as,DataTexture2DArray:kT,DataTexture3D:HT,DataTextureLoader:Gy,DataUtils:QE,DecrementStencilOp:C_,DecrementWrapStencilOp:P_,DefaultLoadingManager:ky,DepthFormat:wr,DepthStencilFormat:us,DepthTexture:Qf,DirectionalLight:bd,DirectionalLightHelper:XE,DiscreteInterpolant:By,DodecahedronBufferGeometry:yo,DodecahedronGeometry:yo,DoubleSide:cs,DstAlphaFactor:m0,DstColorFactor:y0,DynamicBufferAttribute:dT,DynamicCopyUsage:W_,DynamicDrawUsage:uo,DynamicReadUsage:H_,EdgesGeometry:lu,EdgesHelper:ET,EllipseCurve:Ha,EqualDepth:S0,EqualStencilFunc:z_,EquirectangularReflectionMapping:ma,EquirectangularRefractionMapping:ga,Euler:Dr,EventDispatcher:Rr,ExtrudeBufferGeometry:Ai,ExtrudeGeometry:Ai,FaceColors:nT,FileLoader:Ci,FlatShading:Vf,Float16BufferAttribute:dy,Float32Attribute:wT,Float32BufferAttribute:Ne,Float64Attribute:MT,Float64BufferAttribute:py,FloatType:ji,Fog:Ba,FogExp2:Oa,Font:OT,FontLoader:FT,FramebufferTexture:Py,FrontSide:ls,Frustum:Fa,GLBufferAttribute:rx,GLSL1:X_,GLSL3:Cf,GreaterDepth:E0,GreaterEqualDepth:b0,GreaterEqualStencilFunc:B_,GreaterStencilFunc:F_,GridHelper:cx,Group:es,HalfFloatType:ns,HemisphereLight:_d,HemisphereLightHelper:WE,HemisphereLightProbe:Ky,IcosahedronBufferGeometry:xo,IcosahedronGeometry:xo,ImageBitmapLoader:Jy,ImageLoader:Pa,ImageUtils:Pr,ImmediateRenderObject:BT,IncrementStencilOp:A_,IncrementWrapStencilOp:R_,InstancedBufferAttribute:ds,InstancedBufferGeometry:Cd,InstancedInterleavedBuffer:ix,InstancedMesh:$f,Int16Attribute:yT,Int16BufferAttribute:hy,Int32Attribute:vT,Int32BufferAttribute:fy,Int8Attribute:pT,Int8BufferAttribute:ly,IntType:N0,InterleavedBuffer:ws,InterleavedBufferAttribute:Tr,Interpolant:Ki,InterpolateDiscrete:va,InterpolateLinear:_a,InterpolateSmooth:Pc,InvertStencilOp:L_,JSONLoader:LT,KeepStencilOp:Lc,KeyframeTrack:pi,LOD:Cy,LatheBufferGeometry:ps,LatheGeometry:ps,Layers:os,LensFlare:IT,LessDepth:M0,LessEqualDepth:zc,LessEqualStencilFunc:N_,LessStencilFunc:I_,Light:di,LightProbe:Va,Line:Zi,Line3:ox,LineBasicMaterial:sn,LineCurve:Ga,LineCurve3:Dy,LineDashedMaterial:gd,LineLoop:ed,LinePieces:eT,LineSegments:Pn,LineStrip:$E,LinearEncoding:Kn,LinearFilter:Gt,LinearInterpolant:yd,LinearMipMapLinearFilter:w_,LinearMipMapNearestFilter:__,LinearMipmapLinearFilter:vs,LinearMipmapNearestFilter:jf,LinearSRGBColorSpace:vr,LinearToneMapping:R0,Loader:En,LoaderUtils:Uc,LoadingManager:vd,LoopOnce:Y0,LoopPingPong:Z0,LoopRepeat:J0,LuminanceAlphaFormat:H0,LuminanceFormat:k0,MOUSE:Wi,Material:qt,MaterialLoader:jy,Math:_m,MathUtils:_m,Matrix3:tn,Matrix4:Fe,MaxEquation:of,Mesh:Kt,MeshBasicMaterial:$i,MeshDepthMaterial:Kc,MeshDistanceMaterial:Qc,MeshFaceMaterial:rT,MeshLambertMaterial:pd,MeshMatcapMaterial:md,MeshNormalMaterial:dd,MeshPhongMaterial:hd,MeshPhysicalMaterial:ud,MeshStandardMaterial:uu,MeshToonMaterial:fd,MinEquation:sf,MirroredRepeatWrapping:xa,MixOperation:A0,MultiMaterial:sT,MultiplyBlending:rf,MultiplyOperation:za,NearestFilter:Zt,NearestMipMapLinearFilter:v_,NearestMipMapNearestFilter:x_,NearestMipmapLinearFilter:Fc,NearestMipmapNearestFilter:Nc,NeverDepth:_0,NeverStencilFunc:D_,NoBlending:Yi,NoColorSpace:b_,NoColors:tT,NoToneMapping:hi,NormalAnimationBlendMode:qc,NormalBlending:ts,NotEqualDepth:T0,NotEqualStencilFunc:O_,NumberKeyframeTrack:Aa,Object3D:ht,ObjectLoader:SE,ObjectSpaceNormalMap:ey,OctahedronBufferGeometry:ms,OctahedronGeometry:ms,OneFactor:f0,OneMinusDstAlphaFactor:g0,OneMinusDstColorFactor:x0,OneMinusSrcAlphaFactor:qf,OneMinusSrcColorFactor:p0,OrthographicCamera:fi,PCFShadowMap:Hf,PCFSoftShadowMap:Gf,PMREMGenerator:Pf,ParametricGeometry:zT,Particle:aT,ParticleBasicMaterial:uT,ParticleSystem:lT,ParticleSystemMaterial:hT,Path:fo,PerspectiveCamera:It,Plane:ci,PlaneBufferGeometry:fs,PlaneGeometry:fs,PlaneHelper:JE,PointCloud:oT,PointCloudMaterial:cT,PointLight:Sd,PointLightHelper:GE,Points:ka,PointsMaterial:Ms,PolarGridHelper:qE,PolyhedronBufferGeometry:Ti,PolyhedronGeometry:Ti,PositionalAudio:RE,PropertyBinding:gt,PropertyMixer:ex,QuadraticBezierCurve:su,QuadraticBezierCurve3:ou,Quaternion:nn,QuaternionKeyframeTrack:Ro,QuaternionLinearInterpolant:Uy,REVISION:Vc,RGBADepthPacking:$0,RGBAFormat:Nn,RGBAIntegerFormat:X0,RGBA_ASTC_10x10_Format:bf,RGBA_ASTC_10x5_Format:wf,RGBA_ASTC_10x6_Format:Mf,RGBA_ASTC_10x8_Format:Sf,RGBA_ASTC_12x10_Format:Ef,RGBA_ASTC_12x12_Format:Tf,RGBA_ASTC_4x4_Format:df,RGBA_ASTC_5x4_Format:pf,RGBA_ASTC_5x5_Format:mf,RGBA_ASTC_6x5_Format:gf,RGBA_ASTC_6x6_Format:yf,RGBA_ASTC_8x5_Format:xf,RGBA_ASTC_8x6_Format:vf,RGBA_ASTC_8x8_Format:_f,RGBA_BPTC_Format:Af,RGBA_ETC2_EAC_Format:ff,RGBA_PVRTC_2BPPV1_Format:uf,RGBA_PVRTC_4BPPV1_Format:cf,RGBA_S3TC_DXT1_Format:Ac,RGBA_S3TC_DXT3_Format:Cc,RGBA_S3TC_DXT5_Format:Rc,RGBFormat:U0,RGB_ETC1_Format:j0,RGB_ETC2_Format:hf,RGB_PVRTC_2BPPV1_Format:lf,RGB_PVRTC_4BPPV1_Format:af,RGB_S3TC_DXT1_Format:Tc,RGFormat:W0,RGIntegerFormat:q0,RawShaderMaterial:cd,Ray:Qi,Raycaster:sx,RectAreaLight:Td,RedFormat:G0,RedIntegerFormat:V0,ReinhardToneMapping:P0,RepeatWrapping:ya,ReplaceStencilOp:T_,ReverseSubtractEquation:u0,RingBufferGeometry:vo,RingGeometry:vo,SRGBColorSpace:Si,Scene:Ua,SceneUtils:DT,ShaderChunk:ct,ShaderLib:ui,ShaderMaterial:Qn,ShadowMaterial:ld,Shape:bi,ShapeBufferGeometry:gs,ShapeGeometry:gs,ShapePath:KE,ShapeUtils:Ei,ShortType:z0,Skeleton:iu,SkeletonHelper:ax,SkinnedMesh:tu,SmoothShading:y_,Source:$r,Sphere:Lr,SphereBufferGeometry:ys,SphereGeometry:ys,Spherical:Ff,SphericalHarmonics3:Ad,SplineCurve:au,SpotLight:Md,SpotLightHelper:HE,Sprite:eu,SpriteMaterial:$c,SrcAlphaFactor:Wf,SrcAlphaSaturateFactor:v0,SrcColorFactor:d0,StaticCopyUsage:V_,StaticDrawUsage:co,StaticReadUsage:k_,StereoCamera:EE,StreamCopyUsage:q_,StreamDrawUsage:U_,StreamReadUsage:G_,StringKeyframeTrack:bs,SubtractEquation:c0,SubtractiveBlending:nf,TOUCH:qi,TangentSpaceNormalMap:_s,TetrahedronBufferGeometry:_o,TetrahedronGeometry:_o,TextGeometry:NT,Texture:Ut,TextureLoader:Vy,TorusBufferGeometry:wo,TorusGeometry:wo,TorusKnotBufferGeometry:Mo,TorusKnotGeometry:Mo,Triangle:Wt,TriangleFanDrawMode:S_,TriangleStripDrawMode:M_,TrianglesDrawMode:K0,TubeBufferGeometry:So,TubeGeometry:So,UVMapping:Wc,Uint16Attribute:xT,Uint16BufferAttribute:Xc,Uint32Attribute:_T,Uint32BufferAttribute:jc,Uint8Attribute:mT,Uint8BufferAttribute:cy,Uint8ClampedAttribute:gT,Uint8ClampedBufferAttribute:uy,Uniform:hu,UniformsLib:Se,UniformsUtils:my,UnsignedByteType:Er,UnsignedInt248Type:is,UnsignedIntType:ha,UnsignedShort4444Type:F0,UnsignedShort5551Type:O0,UnsignedShortType:lo,VSMShadowMap:ro,Vector2:ue,Vector3:R,Vector4:wt,VectorKeyframeTrack:Ca,Vertex:fT,VertexColors:iT,VideoTexture:Ry,WebGL1Renderer:Ty,WebGL3DRenderTarget:oy,WebGLArrayRenderTarget:sy,WebGLCubeRenderTarget:Jc,WebGLMultipleRenderTargets:ay,WebGLMultisampleRenderTarget:UT,WebGLRenderTarget:Sn,WebGLRenderTargetCube:RT,WebGLRenderer:Mt,WebGLUtils:Ey,WireframeGeometry:ad,WireframeHelper:TT,WrapAroundEnding:wa,XHRLoader:AT,ZeroCurvatureEnding:Kr,ZeroFactor:h0,ZeroSlopeEnding:Qr,ZeroStencilOp:E_,_SRGBAFormat:Oc,sRGBEncoding:Tt},Symbol.toStringTag,{value:"Module"}));var px={exports:{}},Nd={exports:{}};/** @license React v0.26.2
|
|
2999
|
+
* react-reconciler.production.min.js
|
|
3000
|
+
*
|
|
3001
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3002
|
+
*
|
|
3003
|
+
* This source code is licensed under the MIT license found in the
|
|
3004
|
+
* LICENSE file in the root directory of this source tree.
|
|
3005
|
+
*/Nd.exports;(function(r){r.exports=function(t){var n={},i=dv,s=Te,a=bc;function l(o){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+o,h=1;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h]);return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var u=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,f=60103,p=60106,g=60107,d=60108,m=60114,x=60109,y=60110,v=60112,M=60113,S=60120,T=60115,b=60116,A=60121,L=60129,D=60130,N=60131;if(typeof Symbol=="function"&&Symbol.for){var q=Symbol.for;f=q("react.element"),p=q("react.portal"),g=q("react.fragment"),d=q("react.strict_mode"),m=q("react.profiler"),x=q("react.provider"),y=q("react.context"),v=q("react.forward_ref"),M=q("react.suspense"),S=q("react.suspense_list"),T=q("react.memo"),b=q("react.lazy"),A=q("react.block"),q("react.scope"),L=q("react.debug_trace_mode"),D=q("react.offscreen"),N=q("react.legacy_hidden")}var B=typeof Symbol=="function"&&Symbol.iterator;function C(o){return o===null||typeof o!="object"?null:(o=B&&o[B]||o["@@iterator"],typeof o=="function"?o:null)}function z(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case g:return"Fragment";case p:return"Portal";case m:return"Profiler";case d:return"StrictMode";case M:return"Suspense";case S:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case y:return(o.displayName||"Context")+".Consumer";case x:return(o._context.displayName||"Context")+".Provider";case v:var c=o.render;return c=c.displayName||c.name||"",o.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case T:return z(o.type);case A:return z(o._render);case b:c=o._payload,o=o._init;try{return z(o(c))}catch{}}return null}function J(o){var c=o,h=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,c.flags&1026&&(h=c.return),o=c.return;while(o)}return c.tag===3?h:null}function W(o){if(J(o)!==o)throw Error(l(188))}function Y(o){var c=o.alternate;if(!c){if(c=J(o),c===null)throw Error(l(188));return c!==o?null:o}for(var h=o,_=c;;){var w=h.return;if(w===null)break;var E=w.alternate;if(E===null){if(_=w.return,_!==null){h=_;continue}break}if(w.child===E.child){for(E=w.child;E;){if(E===h)return W(w),o;if(E===_)return W(w),c;E=E.sibling}throw Error(l(188))}if(h.return!==_.return)h=w,_=E;else{for(var F=!1,H=w.child;H;){if(H===h){F=!0,h=w,_=E;break}if(H===_){F=!0,_=w,h=E;break}H=H.sibling}if(!F){for(H=E.child;H;){if(H===h){F=!0,h=E,_=w;break}if(H===_){F=!0,_=E,h=w;break}H=H.sibling}if(!F)throw Error(l(189))}}if(h.alternate!==_)throw Error(l(190))}if(h.tag!==3)throw Error(l(188));return h.stateNode.current===h?o:c}function X(o){if(o=Y(o),!o)return null;for(var c=o;;){if(c.tag===5||c.tag===6)return c;if(c.child)c.child.return=c,c=c.child;else{if(c===o)break;for(;!c.sibling;){if(!c.return||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}}return null}function ee(o){if(o=Y(o),!o)return null;for(var c=o;;){if(c.tag===5||c.tag===6)return c;if(c.child&&c.tag!==4)c.child.return=c,c=c.child;else{if(c===o)break;for(;!c.sibling;){if(!c.return||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}}return null}function V(o,c){for(var h=o.alternate;c!==null;){if(c===o||c===h)return!0;c=c.return}return!1}var re=t.getPublicInstance,K=t.getRootHostContext,pe=t.getChildHostContext,he=t.prepareForCommit,Ce=t.resetAfterCommit,Ue=t.createInstance,Be=t.appendInitialChild,oe=t.finalizeInitialChildren,ot=t.prepareUpdate,qe=t.shouldSetTextContent,je=t.createTextInstance,xe=t.scheduleTimeout,tt=t.cancelTimeout,ae=t.noTimeout,ce=t.isPrimaryRenderer,me=t.supportsMutation,Le=t.supportsPersistence,ve=t.supportsHydration,Ze=t.getInstanceFromNode,Ve=t.makeOpaqueHydratingObject,Oe=t.makeClientId,St=t.beforeActiveInstanceBlur,vt=t.afterActiveInstanceBlur,O=t.preparePortalMount,P=t.supportsTestSelectors,te=t.findFiberRoot,ge=t.getBoundingRect,be=t.getTextContent,Ee=t.isHiddenSubtree,ke=t.matchAccessibilityRole,le=t.setFocusIfFocusable,et=t.setupIntersectionObserver,nt=t.appendChild,ze=t.appendChildToContainer,k=t.commitTextUpdate,we=t.commitMount,_e=t.commitUpdate,U=t.insertBefore,Q=t.insertInContainerBefore,ye=t.removeChild,de=t.removeChildFromContainer,Ie=t.resetTextContent,ut=t.hideInstance,Qe=t.hideTextInstance,Ln=t.unhideInstance,yn=t.unhideTextInstance,xn=t.clearContainer,fn=t.cloneInstance,mi=t.createContainerChildSet,kn=t.appendChildToContainerChildSet,gi=t.finalizeContainerChildren,Ri=t.replaceContainerChildren,qa=t.cloneHiddenInstance,Xa=t.cloneHiddenTextInstance,I=t.canHydrateInstance,Z=t.canHydrateTextInstance,ne=t.isSuspenseInstancePending,$=t.isSuspenseInstanceFallback,fe=t.getNextHydratableSibling,Je=t.getFirstHydratableChild,it=t.hydrateInstance,at=t.hydrateTextInstance,st=t.getNextHydratableInstanceAfterSuspenseInstance,yt=t.commitHydratedContainer,dt=t.commitHydratedSuspenseInstance,ft;function bt(o){if(ft===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);ft=c&&c[1]||""}return`
|
|
3006
|
+
`+ft+o}var $n=!1;function ei(o,c){if(!o||$n)return"";$n=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(ie){var _=ie}Reflect.construct(o,[],c)}else{try{c.call()}catch(ie){_=ie}o.call(c.prototype)}else{try{throw Error()}catch(ie){_=ie}o()}}catch(ie){if(ie&&_&&typeof ie.stack=="string"){for(var w=ie.stack.split(`
|
|
3007
|
+
`),E=_.stack.split(`
|
|
3008
|
+
`),F=w.length-1,H=E.length-1;1<=F&&0<=H&&w[F]!==E[H];)H--;for(;1<=F&&0<=H;F--,H--)if(w[F]!==E[H]){if(F!==1||H!==1)do if(F--,H--,0>H||w[F]!==E[H])return`
|
|
3009
|
+
`+w[F].replace(" at new "," at ");while(1<=F&&0<=H);break}}}finally{$n=!1,Error.prepareStackTrace=h}return(o=o?o.displayName||o.name:"")?bt(o):""}var yi=[],on=-1;function lt(o){return{current:o}}function xt(o){0>on||(o.current=yi[on],yi[on]=null,on--)}function rt(o,c){on++,yi[on]=o.current,o.current=c}var Qt={},Pt=lt(Qt),Xt=lt(!1),ti=Qt;function zt(o,c){var h=o.type.contextTypes;if(!h)return Qt;var _=o.stateNode;if(_&&_.__reactInternalMemoizedUnmaskedChildContext===c)return _.__reactInternalMemoizedMaskedChildContext;var w={},E;for(E in h)w[E]=c[E];return _&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=c,o.__reactInternalMemoizedMaskedChildContext=w),w}function jt(o){return o=o.childContextTypes,o!=null}function er(){xt(Xt),xt(Pt)}function Tn(o,c,h){if(Pt.current!==Qt)throw Error(l(168));rt(Pt,c),rt(Xt,h)}function Od(o,c,h){var _=o.stateNode;if(o=c.childContextTypes,typeof _.getChildContext!="function")return h;_=_.getChildContext();for(var w in _)if(!(w in o))throw Error(l(108,z(c)||"Unknown",w));return i({},h,_)}function ja(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Qt,ti=Pt.current,rt(Pt,o),rt(Xt,Xt.current),!0}function Bd(o,c,h){var _=o.stateNode;if(!_)throw Error(l(169));h?(o=Od(o,c,ti),_.__reactInternalMemoizedMergedChildContext=o,xt(Xt),xt(Pt),rt(Pt,o)):xt(Xt),rt(Xt,h)}var fu=null,Ir=null,bx=a.unstable_now;bx();var Ya=0,Ct=8;function zr(o){if(1&o)return Ct=15,1;if(2&o)return Ct=14,2;if(4&o)return Ct=13,4;var c=24&o;return c!==0?(Ct=12,c):o&32?(Ct=11,32):(c=192&o,c!==0?(Ct=10,c):o&256?(Ct=9,256):(c=3584&o,c!==0?(Ct=8,c):o&4096?(Ct=7,4096):(c=4186112&o,c!==0?(Ct=6,c):(c=62914560&o,c!==0?(Ct=5,c):o&67108864?(Ct=4,67108864):o&134217728?(Ct=3,134217728):(c=805306368&o,c!==0?(Ct=2,c):1073741824&o?(Ct=1,1073741824):(Ct=8,o))))))}function Ex(o){switch(o){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function Tx(o){switch(o){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(l(358,o))}}function Do(o,c){var h=o.pendingLanes;if(h===0)return Ct=0;var _=0,w=0,E=o.expiredLanes,F=o.suspendedLanes,H=o.pingedLanes;if(E!==0)_=E,w=Ct=15;else if(E=h&134217727,E!==0){var ie=E&~F;ie!==0?(_=zr(ie),w=Ct):(H&=E,H!==0&&(_=zr(H),w=Ct))}else E=h&~F,E!==0?(_=zr(E),w=Ct):H!==0&&(_=zr(H),w=Ct);if(_===0)return 0;if(_=31-tr(_),_=h&((0>_?0:1<<_)<<1)-1,c!==0&&c!==_&&!(c&F)){if(zr(c),w<=Ct)return c;Ct=w}if(c=o.entangledLanes,c!==0)for(o=o.entanglements,c&=_;0<c;)h=31-tr(c),w=1<<h,_|=o[h],c&=~w;return _}function Ud(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Ja(o,c){switch(o){case 15:return 1;case 14:return 2;case 12:return o=Es(24&~c),o===0?Ja(10,c):o;case 10:return o=Es(192&~c),o===0?Ja(8,c):o;case 8:return o=Es(3584&~c),o===0&&(o=Es(4186112&~c),o===0&&(o=512)),o;case 2:return c=Es(805306368&~c),c===0&&(c=268435456),c}throw Error(l(358,o))}function Es(o){return o&-o}function du(o){for(var c=[],h=0;31>h;h++)c.push(o);return c}function Za(o,c,h){o.pendingLanes|=c;var _=c-1;o.suspendedLanes&=_,o.pingedLanes&=_,o=o.eventTimes,c=31-tr(c),o[c]=h}var tr=Math.clz32?Math.clz32:Rx,Ax=Math.log,Cx=Math.LN2;function Rx(o){return o===0?32:31-(Ax(o)/Cx|0)|0}var Px=a.unstable_runWithPriority,pu=a.unstable_scheduleCallback,mu=a.unstable_cancelCallback,Lx=a.unstable_shouldYield,kd=a.unstable_requestPaint,gu=a.unstable_now,Dx=a.unstable_getCurrentPriorityLevel,Ka=a.unstable_ImmediatePriority,Hd=a.unstable_UserBlockingPriority,Gd=a.unstable_NormalPriority,Vd=a.unstable_LowPriority,Wd=a.unstable_IdlePriority,yu={},Ix=kd!==void 0?kd:function(){},Pi=null,Qa=null,xu=!1,qd=gu(),an=1e4>qd?gu:function(){return gu()-qd};function Ts(){switch(Dx()){case Ka:return 99;case Hd:return 98;case Gd:return 97;case Vd:return 96;case Wd:return 95;default:throw Error(l(332))}}function Xd(o){switch(o){case 99:return Ka;case 98:return Hd;case 97:return Gd;case 96:return Vd;case 95:return Wd;default:throw Error(l(332))}}function Li(o,c){return o=Xd(o),Px(o,c)}function Io(o,c,h){return o=Xd(o),pu(o,c,h)}function Hn(){if(Qa!==null){var o=Qa;Qa=null,mu(o)}jd()}function jd(){if(!xu&&Pi!==null){xu=!0;var o=0;try{var c=Pi;Li(99,function(){for(;o<c.length;o++){var h=c[o];do h=h(!0);while(h!==null)}}),Pi=null}catch(h){throw Pi!==null&&(Pi=Pi.slice(o+1)),pu(Ka,Hn),h}finally{xu=!1}}}var zx=u.ReactCurrentBatchConfig;function Nx(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var Gn=typeof Object.is=="function"?Object.is:Nx,Fx=Object.prototype.hasOwnProperty;function $a(o,c){if(Gn(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var h=Object.keys(o),_=Object.keys(c);if(h.length!==_.length)return!1;for(_=0;_<h.length;_++)if(!Fx.call(c,h[_])||!Gn(o[h[_]],c[h[_]]))return!1;return!0}function Ox(o){switch(o.tag){case 5:return bt(o.type);case 16:return bt("Lazy");case 13:return bt("Suspense");case 19:return bt("SuspenseList");case 0:case 2:case 15:return o=ei(o.type,!1),o;case 11:return o=ei(o.type.render,!1),o;case 22:return o=ei(o.type._render,!1),o;case 1:return o=ei(o.type,!0),o;default:return""}}function ni(o,c){if(o&&o.defaultProps){c=i({},c),o=o.defaultProps;for(var h in o)c[h]===void 0&&(c[h]=o[h]);return c}return c}var el=lt(null),tl=null,As=null,nl=null;function vu(){nl=As=tl=null}function Yd(o,c){o=o.type._context,ce?(rt(el,o._currentValue),o._currentValue=c):(rt(el,o._currentValue2),o._currentValue2=c)}function _u(o){var c=el.current;xt(el),o=o.type._context,ce?o._currentValue=c:o._currentValue2=c}function Jd(o,c){for(;o!==null;){var h=o.alternate;if((o.childLanes&c)===c){if(h===null||(h.childLanes&c)===c)break;h.childLanes|=c}else o.childLanes|=c,h!==null&&(h.childLanes|=c);o=o.return}}function Cs(o,c){tl=o,nl=As=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&c&&(ii=!0),o.firstContext=null)}function Vn(o,c){if(nl!==o&&c!==!1&&c!==0)if((typeof c!="number"||c===1073741823)&&(nl=o,c=1073741823),c={context:o,observedBits:c,next:null},As===null){if(tl===null)throw Error(l(308));As=c,tl.dependencies={lanes:0,firstContext:c,responders:null}}else As=As.next=c;return ce?o._currentValue:o._currentValue2}var nr=!1;function wu(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function Zd(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function ir(o,c){return{eventTime:o,lane:c,tag:0,payload:null,callback:null,next:null}}function rr(o,c){if(o=o.updateQueue,o!==null){o=o.shared;var h=o.pending;h===null?c.next=c:(c.next=h.next,h.next=c),o.pending=c}}function Kd(o,c){var h=o.updateQueue,_=o.alternate;if(_!==null&&(_=_.updateQueue,h===_)){var w=null,E=null;if(h=h.firstBaseUpdate,h!==null){do{var F={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};E===null?w=E=F:E=E.next=F,h=h.next}while(h!==null);E===null?w=E=c:E=E.next=c}else w=E=c;h={baseState:_.baseState,firstBaseUpdate:w,lastBaseUpdate:E,shared:_.shared,effects:_.effects},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=c:o.next=c,h.lastBaseUpdate=c}function zo(o,c,h,_){var w=o.updateQueue;nr=!1;var E=w.firstBaseUpdate,F=w.lastBaseUpdate,H=w.shared.pending;if(H!==null){w.shared.pending=null;var ie=H,Me=ie.next;ie.next=null,F===null?E=Me:F.next=Me,F=ie;var He=o.alternate;if(He!==null){He=He.updateQueue;var Ke=He.lastBaseUpdate;Ke!==F&&(Ke===null?He.firstBaseUpdate=Me:Ke.next=Me,He.lastBaseUpdate=ie)}}if(E!==null){Ke=w.baseState,F=0,He=Me=ie=null;do{H=E.lane;var Pe=E.eventTime;if((_&H)===H){He!==null&&(He=He.next={eventTime:Pe,lane:0,tag:E.tag,payload:E.payload,callback:E.callback,next:null});e:{var Et=o,Dt=E;switch(H=c,Pe=h,Dt.tag){case 1:if(Et=Dt.payload,typeof Et=="function"){Ke=Et.call(Pe,Ke,H);break e}Ke=Et;break e;case 3:Et.flags=Et.flags&-4097|64;case 0:if(Et=Dt.payload,H=typeof Et=="function"?Et.call(Pe,Ke,H):Et,H==null)break e;Ke=i({},Ke,H);break e;case 2:nr=!0}}E.callback!==null&&(o.flags|=32,H=w.effects,H===null?w.effects=[E]:H.push(E))}else Pe={eventTime:Pe,lane:H,tag:E.tag,payload:E.payload,callback:E.callback,next:null},He===null?(Me=He=Pe,ie=Ke):He=He.next=Pe,F|=H;if(E=E.next,E===null){if(H=w.shared.pending,H===null)break;E=H.next,H.next=null,w.lastBaseUpdate=H,w.shared.pending=null}}while(1);He===null&&(ie=Ke),w.baseState=ie,w.firstBaseUpdate=Me,w.lastBaseUpdate=He,Yo|=F,o.lanes=F,o.memoizedState=Ke}}function Qd(o,c,h){if(o=c.effects,c.effects=null,o!==null)for(c=0;c<o.length;c++){var _=o[c],w=_.callback;if(w!==null){if(_.callback=null,_=h,typeof w!="function")throw Error(l(191,w));w.call(_)}}}var $d=new s.Component().refs;function il(o,c,h,_){c=o.memoizedState,h=h(_,c),h=h==null?c:i({},c,h),o.memoizedState=h,o.lanes===0&&(o.updateQueue.baseState=h)}var rl={isMounted:function(o){return(o=o._reactInternals)?J(o)===o:!1},enqueueSetState:function(o,c,h){o=o._reactInternals;var _=Rn(),w=ar(o),E=ir(_,w);E.payload=c,h!=null&&(E.callback=h),rr(o,E),Fi(o,w,_)},enqueueReplaceState:function(o,c,h){o=o._reactInternals;var _=Rn(),w=ar(o),E=ir(_,w);E.tag=1,E.payload=c,h!=null&&(E.callback=h),rr(o,E),Fi(o,w,_)},enqueueForceUpdate:function(o,c){o=o._reactInternals;var h=Rn(),_=ar(o),w=ir(h,_);w.tag=2,c!=null&&(w.callback=c),rr(o,w),Fi(o,_,h)}};function ep(o,c,h,_,w,E,F){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(_,E,F):c.prototype&&c.prototype.isPureReactComponent?!$a(h,_)||!$a(w,E):!0}function tp(o,c,h){var _=!1,w=Qt,E=c.contextType;return typeof E=="object"&&E!==null?E=Vn(E):(w=jt(c)?ti:Pt.current,_=c.contextTypes,E=(_=_!=null)?zt(o,w):Qt),c=new c(h,E),o.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=rl,o.stateNode=c,c._reactInternals=o,_&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=w,o.__reactInternalMemoizedMaskedChildContext=E),c}function np(o,c,h,_){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(h,_),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(h,_),c.state!==o&&rl.enqueueReplaceState(c,c.state,null)}function Mu(o,c,h,_){var w=o.stateNode;w.props=h,w.state=o.memoizedState,w.refs=$d,wu(o);var E=c.contextType;typeof E=="object"&&E!==null?w.context=Vn(E):(E=jt(c)?ti:Pt.current,w.context=zt(o,E)),zo(o,h,w,_),w.state=o.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(il(o,c,E,h),w.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(c=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),c!==w.state&&rl.enqueueReplaceState(w,w.state,null),zo(o,h,w,_),w.state=o.memoizedState),typeof w.componentDidMount=="function"&&(o.flags|=4)}var sl=Array.isArray;function No(o,c,h){if(o=h.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(h._owner){if(h=h._owner,h){if(h.tag!==1)throw Error(l(309));var _=h.stateNode}if(!_)throw Error(l(147,o));var w=""+o;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===w?c.ref:(c=function(E){var F=_.refs;F===$d&&(F=_.refs={}),E===null?delete F[w]:F[w]=E},c._stringRef=w,c)}if(typeof o!="string")throw Error(l(284));if(!h._owner)throw Error(l(290,o))}return o}function ol(o,c){if(o.type!=="textarea")throw Error(l(31,Object.prototype.toString.call(c)==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":c))}function ip(o){function c(j,G){if(o){var se=j.lastEffect;se!==null?(se.nextEffect=G,j.lastEffect=G):j.firstEffect=j.lastEffect=G,G.nextEffect=null,G.flags=8}}function h(j,G){if(!o)return null;for(;G!==null;)c(j,G),G=G.sibling;return null}function _(j,G){for(j=new Map;G!==null;)G.key!==null?j.set(G.key,G):j.set(G.index,G),G=G.sibling;return j}function w(j,G){return j=cr(j,G),j.index=0,j.sibling=null,j}function E(j,G,se){return j.index=se,o?(se=j.alternate,se!==null?(se=se.index,se<G?(j.flags=2,G):se):(j.flags=2,G)):G}function F(j){return o&&j.alternate===null&&(j.flags=2),j}function H(j,G,se,Re){return G===null||G.tag!==6?(G=uh(se,j.mode,Re),G.return=j,G):(G=w(G,se),G.return=j,G)}function ie(j,G,se,Re){return G!==null&&G.elementType===se.type?(Re=w(G,se.props),Re.ref=No(j,G,se),Re.return=j,Re):(Re=zl(se.type,se.key,se.props,null,j.mode,Re),Re.ref=No(j,G,se),Re.return=j,Re)}function Me(j,G,se,Re){return G===null||G.tag!==4||G.stateNode.containerInfo!==se.containerInfo||G.stateNode.implementation!==se.implementation?(G=hh(se,j.mode,Re),G.return=j,G):(G=w(G,se.children||[]),G.return=j,G)}function He(j,G,se,Re,Ge){return G===null||G.tag!==7?(G=Fs(se,j.mode,Re,Ge),G.return=j,G):(G=w(G,se),G.return=j,G)}function Ke(j,G,se){if(typeof G=="string"||typeof G=="number")return G=uh(""+G,j.mode,se),G.return=j,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case f:return se=zl(G.type,G.key,G.props,null,j.mode,se),se.ref=No(j,null,G),se.return=j,se;case p:return G=hh(G,j.mode,se),G.return=j,G}if(sl(G)||C(G))return G=Fs(G,j.mode,se,null),G.return=j,G;ol(j,G)}return null}function Pe(j,G,se,Re){var Ge=G!==null?G.key:null;if(typeof se=="string"||typeof se=="number")return Ge!==null?null:H(j,G,""+se,Re);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case f:return se.key===Ge?se.type===g?He(j,G,se.props.children,Re,Ge):ie(j,G,se,Re):null;case p:return se.key===Ge?Me(j,G,se,Re):null}if(sl(se)||C(se))return Ge!==null?null:He(j,G,se,Re,null);ol(j,se)}return null}function Et(j,G,se,Re,Ge){if(typeof Re=="string"||typeof Re=="number")return j=j.get(se)||null,H(G,j,""+Re,Ge);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case f:return j=j.get(Re.key===null?se:Re.key)||null,Re.type===g?He(G,j,Re.props.children,Ge,Re.key):ie(G,j,Re,Ge);case p:return j=j.get(Re.key===null?se:Re.key)||null,Me(G,j,Re,Ge)}if(sl(Re)||C(Re))return j=j.get(se)||null,He(G,j,Re,Ge,null);ol(G,Re)}return null}function Dt(j,G,se,Re){for(var Ge=null,Rt=null,$e=G,_t=G=0,Yt=null;$e!==null&&_t<se.length;_t++){$e.index>_t?(Yt=$e,$e=null):Yt=$e.sibling;var pt=Pe(j,$e,se[_t],Re);if(pt===null){$e===null&&($e=Yt);break}o&&$e&&pt.alternate===null&&c(j,$e),G=E(pt,G,_t),Rt===null?Ge=pt:Rt.sibling=pt,Rt=pt,$e=Yt}if(_t===se.length)return h(j,$e),Ge;if($e===null){for(;_t<se.length;_t++)$e=Ke(j,se[_t],Re),$e!==null&&(G=E($e,G,_t),Rt===null?Ge=$e:Rt.sibling=$e,Rt=$e);return Ge}for($e=_(j,$e);_t<se.length;_t++)Yt=Et($e,j,_t,se[_t],Re),Yt!==null&&(o&&Yt.alternate!==null&&$e.delete(Yt.key===null?_t:Yt.key),G=E(Yt,G,_t),Rt===null?Ge=Yt:Rt.sibling=Yt,Rt=Yt);return o&&$e.forEach(function(ur){return c(j,ur)}),Ge}function jn(j,G,se,Re){var Ge=C(se);if(typeof Ge!="function")throw Error(l(150));if(se=Ge.call(se),se==null)throw Error(l(151));for(var Rt=Ge=null,$e=G,_t=G=0,Yt=null,pt=se.next();$e!==null&&!pt.done;_t++,pt=se.next()){$e.index>_t?(Yt=$e,$e=null):Yt=$e.sibling;var ur=Pe(j,$e,pt.value,Re);if(ur===null){$e===null&&($e=Yt);break}o&&$e&&ur.alternate===null&&c(j,$e),G=E(ur,G,_t),Rt===null?Ge=ur:Rt.sibling=ur,Rt=ur,$e=Yt}if(pt.done)return h(j,$e),Ge;if($e===null){for(;!pt.done;_t++,pt=se.next())pt=Ke(j,pt.value,Re),pt!==null&&(G=E(pt,G,_t),Rt===null?Ge=pt:Rt.sibling=pt,Rt=pt);return Ge}for($e=_(j,$e);!pt.done;_t++,pt=se.next())pt=Et($e,j,_t,pt.value,Re),pt!==null&&(o&&pt.alternate!==null&&$e.delete(pt.key===null?_t:pt.key),G=E(pt,G,_t),Rt===null?Ge=pt:Rt.sibling=pt,Rt=pt);return o&&$e.forEach(function(fv){return c(j,fv)}),Ge}return function(j,G,se,Re){var Ge=typeof se=="object"&&se!==null&&se.type===g&&se.key===null;Ge&&(se=se.props.children);var Rt=typeof se=="object"&&se!==null;if(Rt)switch(se.$$typeof){case f:e:{for(Rt=se.key,Ge=G;Ge!==null;){if(Ge.key===Rt){switch(Ge.tag){case 7:if(se.type===g){h(j,Ge.sibling),G=w(Ge,se.props.children),G.return=j,j=G;break e}break;default:if(Ge.elementType===se.type){h(j,Ge.sibling),G=w(Ge,se.props),G.ref=No(j,Ge,se),G.return=j,j=G;break e}}h(j,Ge);break}else c(j,Ge);Ge=Ge.sibling}se.type===g?(G=Fs(se.props.children,j.mode,Re,se.key),G.return=j,j=G):(Re=zl(se.type,se.key,se.props,null,j.mode,Re),Re.ref=No(j,G,se),Re.return=j,j=Re)}return F(j);case p:e:{for(Ge=se.key;G!==null;){if(G.key===Ge)if(G.tag===4&&G.stateNode.containerInfo===se.containerInfo&&G.stateNode.implementation===se.implementation){h(j,G.sibling),G=w(G,se.children||[]),G.return=j,j=G;break e}else{h(j,G);break}else c(j,G);G=G.sibling}G=hh(se,j.mode,Re),G.return=j,j=G}return F(j)}if(typeof se=="string"||typeof se=="number")return se=""+se,G!==null&&G.tag===6?(h(j,G.sibling),G=w(G,se),G.return=j,j=G):(h(j,G),G=uh(se,j.mode,Re),G.return=j,j=G),F(j);if(sl(se))return Dt(j,G,se,Re);if(C(se))return jn(j,G,se,Re);if(Rt&&ol(j,se),typeof se>"u"&&!Ge)switch(j.tag){case 1:case 22:case 0:case 11:case 15:throw Error(l(152,z(j.type)||"Component"))}return h(j,G)}}var al=ip(!0),rp=ip(!1),Fo={},Wn=lt(Fo),Oo=lt(Fo),Rs=lt(Fo);function xi(o){if(o===Fo)throw Error(l(174));return o}function Su(o,c){rt(Rs,c),rt(Oo,o),rt(Wn,Fo),o=K(c),xt(Wn),rt(Wn,o)}function Ps(){xt(Wn),xt(Oo),xt(Rs)}function sp(o){var c=xi(Rs.current),h=xi(Wn.current);c=pe(h,o.type,c),h!==c&&(rt(Oo,o),rt(Wn,c))}function bu(o){Oo.current===o&&(xt(Wn),xt(Oo))}var Ot=lt(0);function ll(o){for(var c=o;c!==null;){if(c.tag===13){var h=c.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||ne(h)||$(h)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if(c.flags&64)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Di=null,Nr=null,vi=!1;function op(o,c){var h=Xn(5,null,null,0);h.elementType="DELETED",h.type="DELETED",h.stateNode=c,h.return=o,h.flags=8,o.lastEffect!==null?(o.lastEffect.nextEffect=h,o.lastEffect=h):o.firstEffect=o.lastEffect=h}function ap(o,c){switch(o.tag){case 5:return c=I(c,o.type,o.pendingProps),c!==null?(o.stateNode=c,!0):!1;case 6:return c=Z(c,o.pendingProps),c!==null?(o.stateNode=c,!0):!1;case 13:return!1;default:return!1}}function Eu(o){if(vi){var c=Nr;if(c){var h=c;if(!ap(o,c)){if(c=fe(h),!c||!ap(o,c)){o.flags=o.flags&-1025|2,vi=!1,Di=o;return}op(Di,h)}Di=o,Nr=Je(c)}else o.flags=o.flags&-1025|2,vi=!1,Di=o}}function lp(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;Di=o}function cl(o){if(!ve||o!==Di)return!1;if(!vi)return lp(o),vi=!0,!1;var c=o.type;if(o.tag!==5||c!=="head"&&c!=="body"&&!qe(c,o.memoizedProps))for(c=Nr;c;)op(o,c),c=fe(c);if(lp(o),o.tag===13){if(!ve)throw Error(l(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));Nr=st(o)}else Nr=Di?fe(o.stateNode):null;return!0}function Tu(){ve&&(Nr=Di=null,vi=!1)}var Ls=[];function Au(){for(var o=0;o<Ls.length;o++){var c=Ls[o];ce?c._workInProgressVersionPrimary=null:c._workInProgressVersionSecondary=null}Ls.length=0}var Bo=u.ReactCurrentDispatcher,qn=u.ReactCurrentBatchConfig,Uo=0,kt=null,dn=null,ln=null,ul=!1,ko=!1;function An(){throw Error(l(321))}function Cu(o,c){if(c===null)return!1;for(var h=0;h<c.length&&h<o.length;h++)if(!Gn(o[h],c[h]))return!1;return!0}function Ru(o,c,h,_,w,E){if(Uo=E,kt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Bo.current=o===null||o.memoizedState===null?Ux:kx,o=h(_,w),ko){E=0;do{if(ko=!1,!(25>E))throw Error(l(301));E+=1,ln=dn=null,c.updateQueue=null,Bo.current=Hx,o=h(_,w)}while(ko)}if(Bo.current=pl,c=dn!==null&&dn.next!==null,Uo=0,ln=dn=kt=null,ul=!1,c)throw Error(l(300));return o}function Fr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?kt.memoizedState=ln=o:ln=ln.next=o,ln}function Or(){if(dn===null){var o=kt.alternate;o=o!==null?o.memoizedState:null}else o=dn.next;var c=ln===null?kt.memoizedState:ln.next;if(c!==null)ln=c,dn=o;else{if(o===null)throw Error(l(310));dn=o,o={memoizedState:dn.memoizedState,baseState:dn.baseState,baseQueue:dn.baseQueue,queue:dn.queue,next:null},ln===null?kt.memoizedState=ln=o:ln=ln.next=o}return ln}function _i(o,c){return typeof c=="function"?c(o):c}function Ho(o){var c=Or(),h=c.queue;if(h===null)throw Error(l(311));h.lastRenderedReducer=o;var _=dn,w=_.baseQueue,E=h.pending;if(E!==null){if(w!==null){var F=w.next;w.next=E.next,E.next=F}_.baseQueue=w=E,h.pending=null}if(w!==null){w=w.next,_=_.baseState;var H=F=E=null,ie=w;do{var Me=ie.lane;if((Uo&Me)===Me)H!==null&&(H=H.next={lane:0,action:ie.action,eagerReducer:ie.eagerReducer,eagerState:ie.eagerState,next:null}),_=ie.eagerReducer===o?ie.eagerState:o(_,ie.action);else{var He={lane:Me,action:ie.action,eagerReducer:ie.eagerReducer,eagerState:ie.eagerState,next:null};H===null?(F=H=He,E=_):H=H.next=He,kt.lanes|=Me,Yo|=Me}ie=ie.next}while(ie!==null&&ie!==w);H===null?E=_:H.next=F,Gn(_,c.memoizedState)||(ii=!0),c.memoizedState=_,c.baseState=E,c.baseQueue=H,h.lastRenderedState=_}return[c.memoizedState,h.dispatch]}function Go(o){var c=Or(),h=c.queue;if(h===null)throw Error(l(311));h.lastRenderedReducer=o;var _=h.dispatch,w=h.pending,E=c.memoizedState;if(w!==null){h.pending=null;var F=w=w.next;do E=o(E,F.action),F=F.next;while(F!==w);Gn(E,c.memoizedState)||(ii=!0),c.memoizedState=E,c.baseQueue===null&&(c.baseState=E),h.lastRenderedState=E}return[E,_]}function cp(o,c,h){var _=c._getVersion;_=_(c._source);var w=ce?c._workInProgressVersionPrimary:c._workInProgressVersionSecondary;if(w!==null?o=w===_:(o=o.mutableReadLanes,(o=(Uo&o)===o)&&(ce?c._workInProgressVersionPrimary=_:c._workInProgressVersionSecondary=_,Ls.push(c))),o)return h(c._source);throw Ls.push(c),Error(l(350))}function up(o,c,h,_){var w=vn;if(w===null)throw Error(l(349));var E=c._getVersion,F=E(c._source),H=Bo.current,ie=H.useState(function(){return cp(w,c,h)}),Me=ie[1],He=ie[0];ie=ln;var Ke=o.memoizedState,Pe=Ke.refs,Et=Pe.getSnapshot,Dt=Ke.source;Ke=Ke.subscribe;var jn=kt;return o.memoizedState={refs:Pe,source:c,subscribe:_},H.useEffect(function(){Pe.getSnapshot=h,Pe.setSnapshot=Me;var j=E(c._source);if(!Gn(F,j)){j=h(c._source),Gn(He,j)||(Me(j),j=ar(jn),w.mutableReadLanes|=j&w.pendingLanes),j=w.mutableReadLanes,w.entangledLanes|=j;for(var G=w.entanglements,se=j;0<se;){var Re=31-tr(se),Ge=1<<Re;G[Re]|=j,se&=~Ge}}},[h,c,_]),H.useEffect(function(){return _(c._source,function(){var j=Pe.getSnapshot,G=Pe.setSnapshot;try{G(j(c._source));var se=ar(jn);w.mutableReadLanes|=se&w.pendingLanes}catch(Re){G(function(){throw Re})}})},[c,_]),Gn(Et,h)&&Gn(Dt,c)&&Gn(Ke,_)||(o={pending:null,dispatch:null,lastRenderedReducer:_i,lastRenderedState:He},o.dispatch=Me=Iu.bind(null,kt,o),ie.queue=o,ie.baseQueue=null,He=cp(w,c,h),ie.memoizedState=ie.baseState=He),He}function hp(o,c,h){var _=Or();return up(_,o,c,h)}function Vo(o){var c=Fr();return typeof o=="function"&&(o=o()),c.memoizedState=c.baseState=o,o=c.queue={pending:null,dispatch:null,lastRenderedReducer:_i,lastRenderedState:o},o=o.dispatch=Iu.bind(null,kt,o),[c.memoizedState,o]}function hl(o,c,h,_){return o={tag:o,create:c,destroy:h,deps:_,next:null},c=kt.updateQueue,c===null?(c={lastEffect:null},kt.updateQueue=c,c.lastEffect=o.next=o):(h=c.lastEffect,h===null?c.lastEffect=o.next=o:(_=h.next,h.next=o,o.next=_,c.lastEffect=o)),o}function fp(o){var c=Fr();return o={current:o},c.memoizedState=o}function fl(){return Or().memoizedState}function Pu(o,c,h,_){var w=Fr();kt.flags|=o,w.memoizedState=hl(1|c,h,void 0,_===void 0?null:_)}function Lu(o,c,h,_){var w=Or();_=_===void 0?null:_;var E=void 0;if(dn!==null){var F=dn.memoizedState;if(E=F.destroy,_!==null&&Cu(_,F.deps)){hl(c,h,E,_);return}}kt.flags|=o,w.memoizedState=hl(1|c,h,E,_)}function dp(o,c){return Pu(516,4,o,c)}function dl(o,c){return Lu(516,4,o,c)}function pp(o,c){return Lu(4,2,o,c)}function mp(o,c){if(typeof c=="function")return o=o(),c(o),function(){c(null)};if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function gp(o,c,h){return h=h!=null?h.concat([o]):null,Lu(4,2,mp.bind(null,c,o),h)}function Du(){}function yp(o,c){var h=Or();c=c===void 0?null:c;var _=h.memoizedState;return _!==null&&c!==null&&Cu(c,_[1])?_[0]:(h.memoizedState=[o,c],o)}function xp(o,c){var h=Or();c=c===void 0?null:c;var _=h.memoizedState;return _!==null&&c!==null&&Cu(c,_[1])?_[0]:(o=o(),h.memoizedState=[o,c],o)}function Bx(o,c){var h=Ts();Li(98>h?98:h,function(){o(!0)}),Li(97<h?97:h,function(){var _=qn.transition;qn.transition=1;try{o(!1),c()}finally{qn.transition=_}})}function Iu(o,c,h){var _=Rn(),w=ar(o),E={lane:w,action:h,eagerReducer:null,eagerState:null,next:null},F=c.pending;if(F===null?E.next=E:(E.next=F.next,F.next=E),c.pending=E,F=o.alternate,o===kt||F!==null&&F===kt)ko=ul=!0;else{if(o.lanes===0&&(F===null||F.lanes===0)&&(F=c.lastRenderedReducer,F!==null))try{var H=c.lastRenderedState,ie=F(H,h);if(E.eagerReducer=F,E.eagerState=ie,Gn(ie,H))return}catch{}finally{}Fi(o,w,_)}}var pl={readContext:Vn,useCallback:An,useContext:An,useEffect:An,useImperativeHandle:An,useLayoutEffect:An,useMemo:An,useReducer:An,useRef:An,useState:An,useDebugValue:An,useDeferredValue:An,useTransition:An,useMutableSource:An,useOpaqueIdentifier:An,unstable_isNewReconciler:!1},Ux={readContext:Vn,useCallback:function(o,c){return Fr().memoizedState=[o,c===void 0?null:c],o},useContext:Vn,useEffect:dp,useImperativeHandle:function(o,c,h){return h=h!=null?h.concat([o]):null,Pu(4,2,mp.bind(null,c,o),h)},useLayoutEffect:function(o,c){return Pu(4,2,o,c)},useMemo:function(o,c){var h=Fr();return c=c===void 0?null:c,o=o(),h.memoizedState=[o,c],o},useReducer:function(o,c,h){var _=Fr();return c=h!==void 0?h(c):c,_.memoizedState=_.baseState=c,o=_.queue={pending:null,dispatch:null,lastRenderedReducer:o,lastRenderedState:c},o=o.dispatch=Iu.bind(null,kt,o),[_.memoizedState,o]},useRef:fp,useState:Vo,useDebugValue:Du,useDeferredValue:function(o){var c=Vo(o),h=c[0],_=c[1];return dp(function(){var w=qn.transition;qn.transition=1;try{_(o)}finally{qn.transition=w}},[o]),h},useTransition:function(){var o=Vo(!1),c=o[0];return o=Bx.bind(null,o[1]),fp(o),[o,c]},useMutableSource:function(o,c,h){var _=Fr();return _.memoizedState={refs:{getSnapshot:c,setSnapshot:null},source:o,subscribe:h},up(_,o,c,h)},useOpaqueIdentifier:function(){if(vi){var o=!1,c=Ve(function(){throw o||(o=!0,h(Oe())),Error(l(355))}),h=Vo(c)[1];return!(kt.mode&2)&&(kt.flags|=516,hl(5,function(){h(Oe())},void 0,null)),c}return c=Oe(),Vo(c),c},unstable_isNewReconciler:!1},kx={readContext:Vn,useCallback:yp,useContext:Vn,useEffect:dl,useImperativeHandle:gp,useLayoutEffect:pp,useMemo:xp,useReducer:Ho,useRef:fl,useState:function(){return Ho(_i)},useDebugValue:Du,useDeferredValue:function(o){var c=Ho(_i),h=c[0],_=c[1];return dl(function(){var w=qn.transition;qn.transition=1;try{_(o)}finally{qn.transition=w}},[o]),h},useTransition:function(){var o=Ho(_i)[0];return[fl().current,o]},useMutableSource:hp,useOpaqueIdentifier:function(){return Ho(_i)[0]},unstable_isNewReconciler:!1},Hx={readContext:Vn,useCallback:yp,useContext:Vn,useEffect:dl,useImperativeHandle:gp,useLayoutEffect:pp,useMemo:xp,useReducer:Go,useRef:fl,useState:function(){return Go(_i)},useDebugValue:Du,useDeferredValue:function(o){var c=Go(_i),h=c[0],_=c[1];return dl(function(){var w=qn.transition;qn.transition=1;try{_(o)}finally{qn.transition=w}},[o]),h},useTransition:function(){var o=Go(_i)[0];return[fl().current,o]},useMutableSource:hp,useOpaqueIdentifier:function(){return Go(_i)[0]},unstable_isNewReconciler:!1},Gx=u.ReactCurrentOwner,ii=!1;function Cn(o,c,h,_){c.child=o===null?rp(c,null,h,_):al(c,o.child,h,_)}function vp(o,c,h,_,w){h=h.render;var E=c.ref;return Cs(c,w),_=Ru(o,c,h,_,E,w),o!==null&&!ii?(c.updateQueue=o.updateQueue,c.flags&=-517,o.lanes&=~w,Ii(o,c,w)):(c.flags|=1,Cn(o,c,_,w),c.child)}function _p(o,c,h,_,w,E){if(o===null){var F=h.type;return typeof F=="function"&&!lh(F)&&F.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(c.tag=15,c.type=F,wp(o,c,F,_,w,E)):(o=zl(h.type,null,_,c,c.mode,E),o.ref=c.ref,o.return=c,c.child=o)}return F=o.child,!(w&E)&&(w=F.memoizedProps,h=h.compare,h=h!==null?h:$a,h(w,_)&&o.ref===c.ref)?Ii(o,c,E):(c.flags|=1,o=cr(F,_),o.ref=c.ref,o.return=c,c.child=o)}function wp(o,c,h,_,w,E){if(o!==null&&$a(o.memoizedProps,_)&&o.ref===c.ref)if(ii=!1,(E&w)!==0)o.flags&16384&&(ii=!0);else return c.lanes=o.lanes,Ii(o,c,E);return Nu(o,c,h,_,E)}function zu(o,c,h){var _=c.pendingProps,w=_.children,E=o!==null?o.memoizedState:null;if(_.mode==="hidden"||_.mode==="unstable-defer-without-hiding")if(!(c.mode&4))c.memoizedState={baseLanes:0},Ll(c,h);else if(h&1073741824)c.memoizedState={baseLanes:0},Ll(c,E!==null?E.baseLanes:h);else return o=E!==null?E.baseLanes|h:h,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:o},Ll(c,o),null;else E!==null?(_=E.baseLanes|h,c.memoizedState=null):_=h,Ll(c,_);return Cn(o,c,w,h),c.child}function Mp(o,c){var h=c.ref;(o===null&&h!==null||o!==null&&o.ref!==h)&&(c.flags|=128)}function Nu(o,c,h,_,w){var E=jt(h)?ti:Pt.current;return E=zt(c,E),Cs(c,w),h=Ru(o,c,h,_,E,w),o!==null&&!ii?(c.updateQueue=o.updateQueue,c.flags&=-517,o.lanes&=~w,Ii(o,c,w)):(c.flags|=1,Cn(o,c,h,w),c.child)}function Sp(o,c,h,_,w){if(jt(h)){var E=!0;ja(c)}else E=!1;if(Cs(c,w),c.stateNode===null)o!==null&&(o.alternate=null,c.alternate=null,c.flags|=2),tp(c,h,_),Mu(c,h,_,w),_=!0;else if(o===null){var F=c.stateNode,H=c.memoizedProps;F.props=H;var ie=F.context,Me=h.contextType;typeof Me=="object"&&Me!==null?Me=Vn(Me):(Me=jt(h)?ti:Pt.current,Me=zt(c,Me));var He=h.getDerivedStateFromProps,Ke=typeof He=="function"||typeof F.getSnapshotBeforeUpdate=="function";Ke||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(H!==_||ie!==Me)&&np(c,F,_,Me),nr=!1;var Pe=c.memoizedState;F.state=Pe,zo(c,_,F,w),ie=c.memoizedState,H!==_||Pe!==ie||Xt.current||nr?(typeof He=="function"&&(il(c,h,He,_),ie=c.memoizedState),(H=nr||ep(c,h,H,_,Pe,ie,Me))?(Ke||typeof F.UNSAFE_componentWillMount!="function"&&typeof F.componentWillMount!="function"||(typeof F.componentWillMount=="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount=="function"&&F.UNSAFE_componentWillMount()),typeof F.componentDidMount=="function"&&(c.flags|=4)):(typeof F.componentDidMount=="function"&&(c.flags|=4),c.memoizedProps=_,c.memoizedState=ie),F.props=_,F.state=ie,F.context=Me,_=H):(typeof F.componentDidMount=="function"&&(c.flags|=4),_=!1)}else{F=c.stateNode,Zd(o,c),H=c.memoizedProps,Me=c.type===c.elementType?H:ni(c.type,H),F.props=Me,Ke=c.pendingProps,Pe=F.context,ie=h.contextType,typeof ie=="object"&&ie!==null?ie=Vn(ie):(ie=jt(h)?ti:Pt.current,ie=zt(c,ie));var Et=h.getDerivedStateFromProps;(He=typeof Et=="function"||typeof F.getSnapshotBeforeUpdate=="function")||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(H!==Ke||Pe!==ie)&&np(c,F,_,ie),nr=!1,Pe=c.memoizedState,F.state=Pe,zo(c,_,F,w);var Dt=c.memoizedState;H!==Ke||Pe!==Dt||Xt.current||nr?(typeof Et=="function"&&(il(c,h,Et,_),Dt=c.memoizedState),(Me=nr||ep(c,h,Me,_,Pe,Dt,ie))?(He||typeof F.UNSAFE_componentWillUpdate!="function"&&typeof F.componentWillUpdate!="function"||(typeof F.componentWillUpdate=="function"&&F.componentWillUpdate(_,Dt,ie),typeof F.UNSAFE_componentWillUpdate=="function"&&F.UNSAFE_componentWillUpdate(_,Dt,ie)),typeof F.componentDidUpdate=="function"&&(c.flags|=4),typeof F.getSnapshotBeforeUpdate=="function"&&(c.flags|=256)):(typeof F.componentDidUpdate!="function"||H===o.memoizedProps&&Pe===o.memoizedState||(c.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||H===o.memoizedProps&&Pe===o.memoizedState||(c.flags|=256),c.memoizedProps=_,c.memoizedState=Dt),F.props=_,F.state=Dt,F.context=ie,_=Me):(typeof F.componentDidUpdate!="function"||H===o.memoizedProps&&Pe===o.memoizedState||(c.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||H===o.memoizedProps&&Pe===o.memoizedState||(c.flags|=256),_=!1)}return Fu(o,c,h,_,E,w)}function Fu(o,c,h,_,w,E){Mp(o,c);var F=(c.flags&64)!==0;if(!_&&!F)return w&&Bd(c,h,!1),Ii(o,c,E);_=c.stateNode,Gx.current=c;var H=F&&typeof h.getDerivedStateFromError!="function"?null:_.render();return c.flags|=1,o!==null&&F?(c.child=al(c,o.child,null,E),c.child=al(c,null,H,E)):Cn(o,c,H,E),c.memoizedState=_.state,w&&Bd(c,h,!0),c.child}function bp(o){var c=o.stateNode;c.pendingContext?Tn(o,c.pendingContext,c.pendingContext!==c.context):c.context&&Tn(o,c.context,!1),Su(o,c.containerInfo)}var ml={dehydrated:null,retryLane:0};function Ep(o,c,h){var _=c.pendingProps,w=Ot.current,E=!1,F;return(F=(c.flags&64)!==0)||(F=o!==null&&o.memoizedState===null?!1:(w&2)!==0),F?(E=!0,c.flags&=-65):o!==null&&o.memoizedState===null||_.fallback===void 0||_.unstable_avoidThisFallback===!0||(w|=1),rt(Ot,w&1),o===null?(_.fallback!==void 0&&Eu(c),o=_.children,w=_.fallback,E?(o=Tp(c,o,w,h),c.child.memoizedState={baseLanes:h},c.memoizedState=ml,o):typeof _.unstable_expectedLoadTime=="number"?(o=Tp(c,o,w,h),c.child.memoizedState={baseLanes:h},c.memoizedState=ml,c.lanes=33554432,o):(h=ch({mode:"visible",children:o},c.mode,h,null),h.return=c,c.child=h)):o.memoizedState!==null?E?(_=Cp(o,c,_.children,_.fallback,h),E=c.child,w=o.child.memoizedState,E.memoizedState=w===null?{baseLanes:h}:{baseLanes:w.baseLanes|h},E.childLanes=o.childLanes&~h,c.memoizedState=ml,_):(h=Ap(o,c,_.children,h),c.memoizedState=null,h):E?(_=Cp(o,c,_.children,_.fallback,h),E=c.child,w=o.child.memoizedState,E.memoizedState=w===null?{baseLanes:h}:{baseLanes:w.baseLanes|h},E.childLanes=o.childLanes&~h,c.memoizedState=ml,_):(h=Ap(o,c,_.children,h),c.memoizedState=null,h)}function Tp(o,c,h,_){var w=o.mode,E=o.child;return c={mode:"hidden",children:c},!(w&2)&&E!==null?(E.childLanes=0,E.pendingProps=c):E=ch(c,w,0,null),h=Fs(h,w,_,null),E.return=o,h.return=o,E.sibling=h,o.child=E,h}function Ap(o,c,h,_){var w=o.child;return o=w.sibling,h=cr(w,{mode:"visible",children:h}),!(c.mode&2)&&(h.lanes=_),h.return=c,h.sibling=null,o!==null&&(o.nextEffect=null,o.flags=8,c.firstEffect=c.lastEffect=o),c.child=h}function Cp(o,c,h,_,w){var E=c.mode,F=o.child;o=F.sibling;var H={mode:"hidden",children:h};return!(E&2)&&c.child!==F?(h=c.child,h.childLanes=0,h.pendingProps=H,F=h.lastEffect,F!==null?(c.firstEffect=h.firstEffect,c.lastEffect=F,F.nextEffect=null):c.firstEffect=c.lastEffect=null):h=cr(F,H),o!==null?_=cr(o,_):(_=Fs(_,E,w,null),_.flags|=2),_.return=c,h.return=c,h.sibling=_,c.child=h,_}function Rp(o,c){o.lanes|=c;var h=o.alternate;h!==null&&(h.lanes|=c),Jd(o.return,c)}function Ou(o,c,h,_,w,E){var F=o.memoizedState;F===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:_,tail:h,tailMode:w,lastEffect:E}:(F.isBackwards=c,F.rendering=null,F.renderingStartTime=0,F.last=_,F.tail=h,F.tailMode=w,F.lastEffect=E)}function Pp(o,c,h){var _=c.pendingProps,w=_.revealOrder,E=_.tail;if(Cn(o,c,_.children,h),_=Ot.current,_&2)_=_&1|2,c.flags|=64;else{if(o!==null&&o.flags&64)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Rp(o,h);else if(o.tag===19)Rp(o,h);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}_&=1}if(rt(Ot,_),!(c.mode&2))c.memoizedState=null;else switch(w){case"forwards":for(h=c.child,w=null;h!==null;)o=h.alternate,o!==null&&ll(o)===null&&(w=h),h=h.sibling;h=w,h===null?(w=c.child,c.child=null):(w=h.sibling,h.sibling=null),Ou(c,!1,w,h,E,c.lastEffect);break;case"backwards":for(h=null,w=c.child,c.child=null;w!==null;){if(o=w.alternate,o!==null&&ll(o)===null){c.child=w;break}o=w.sibling,w.sibling=h,h=w,w=o}Ou(c,!0,h,null,E,c.lastEffect);break;case"together":Ou(c,!1,null,null,void 0,c.lastEffect);break;default:c.memoizedState=null}return c.child}function Ii(o,c,h){if(o!==null&&(c.dependencies=o.dependencies),Yo|=c.lanes,h&c.childLanes){if(o!==null&&c.child!==o.child)throw Error(l(153));if(c.child!==null){for(o=c.child,h=cr(o,o.pendingProps),c.child=h,h.return=c;o.sibling!==null;)o=o.sibling,h=h.sibling=cr(o,o.pendingProps),h.return=c;h.sibling=null}return c.child}return null}function wi(o){o.flags|=4}var Wo,qo,gl,yl;if(me)Wo=function(o,c){for(var h=c.child;h!==null;){if(h.tag===5||h.tag===6)Be(o,h.stateNode);else if(h.tag!==4&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return;h=h.return}h.sibling.return=h.return,h=h.sibling}},qo=function(){},gl=function(o,c,h,_,w){if(o=o.memoizedProps,o!==_){var E=c.stateNode,F=xi(Wn.current);h=ot(E,h,o,_,w,F),(c.updateQueue=h)&&wi(c)}},yl=function(o,c,h,_){h!==_&&wi(c)};else if(Le){Wo=function(o,c,h,_){for(var w=c.child;w!==null;){if(w.tag===5){var E=w.stateNode;h&&_&&(E=qa(E,w.type,w.memoizedProps,w)),Be(o,E)}else if(w.tag===6)E=w.stateNode,h&&_&&(E=Xa(E,w.memoizedProps,w)),Be(o,E);else if(w.tag!==4){if(w.tag===13&&w.flags&4&&(E=w.memoizedState!==null)){var F=w.child;if(F!==null&&(F.child!==null&&(F.child.return=F,Wo(o,F,!0,E)),E=F.sibling,E!==null)){E.return=w,w=E;continue}}if(w.child!==null){w.child.return=w,w=w.child;continue}}if(w===c)break;for(;w.sibling===null;){if(w.return===null||w.return===c)return;w=w.return}w.sibling.return=w.return,w=w.sibling}};var Lp=function(o,c,h,_){for(var w=c.child;w!==null;){if(w.tag===5){var E=w.stateNode;h&&_&&(E=qa(E,w.type,w.memoizedProps,w)),kn(o,E)}else if(w.tag===6)E=w.stateNode,h&&_&&(E=Xa(E,w.memoizedProps,w)),kn(o,E);else if(w.tag!==4){if(w.tag===13&&w.flags&4&&(E=w.memoizedState!==null)){var F=w.child;if(F!==null&&(F.child!==null&&(F.child.return=F,Lp(o,F,!0,E)),E=F.sibling,E!==null)){E.return=w,w=E;continue}}if(w.child!==null){w.child.return=w,w=w.child;continue}}if(w===c)break;for(;w.sibling===null;){if(w.return===null||w.return===c)return;w=w.return}w.sibling.return=w.return,w=w.sibling}};qo=function(o){var c=o.stateNode;if(o.firstEffect!==null){var h=c.containerInfo,_=mi(h);Lp(_,o,!1,!1),c.pendingChildren=_,wi(o),gi(h,_)}},gl=function(o,c,h,_,w){var E=o.stateNode,F=o.memoizedProps;if((o=c.firstEffect===null)&&F===_)c.stateNode=E;else{var H=c.stateNode,ie=xi(Wn.current),Me=null;F!==_&&(Me=ot(H,h,F,_,w,ie)),o&&Me===null?c.stateNode=E:(E=fn(E,Me,h,F,_,c,o,H),oe(E,h,_,w,ie)&&wi(c),c.stateNode=E,o?wi(c):Wo(E,c,!1,!1))}},yl=function(o,c,h,_){h!==_?(o=xi(Rs.current),h=xi(Wn.current),c.stateNode=je(_,o,h,c),wi(c)):c.stateNode=o.stateNode}}else qo=function(){},gl=function(){},yl=function(){};function Xo(o,c){if(!vi)switch(o.tailMode){case"hidden":c=o.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?o.tail=null:h.sibling=null;break;case"collapsed":h=o.tail;for(var _=null;h!==null;)h.alternate!==null&&(_=h),h=h.sibling;_===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:_.sibling=null}}function Vx(o,c,h){var _=c.pendingProps;switch(c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return jt(c.type)&&er(),null;case 3:return Ps(),xt(Xt),xt(Pt),Au(),_=c.stateNode,_.pendingContext&&(_.context=_.pendingContext,_.pendingContext=null),(o===null||o.child===null)&&(cl(c)?wi(c):_.hydrate||(c.flags|=256)),qo(c),null;case 5:bu(c);var w=xi(Rs.current);if(h=c.type,o!==null&&c.stateNode!=null)gl(o,c,h,_,w),o.ref!==c.ref&&(c.flags|=128);else{if(!_){if(c.stateNode===null)throw Error(l(166));return null}if(o=xi(Wn.current),cl(c)){if(!ve)throw Error(l(175));o=it(c.stateNode,c.type,c.memoizedProps,w,o,c),c.updateQueue=o,o!==null&&wi(c)}else{var E=Ue(h,_,w,o,c);Wo(E,c,!1,!1),c.stateNode=E,oe(E,h,_,w,o)&&wi(c)}c.ref!==null&&(c.flags|=128)}return null;case 6:if(o&&c.stateNode!=null)yl(o,c,o.memoizedProps,_);else{if(typeof _!="string"&&c.stateNode===null)throw Error(l(166));if(o=xi(Rs.current),w=xi(Wn.current),cl(c)){if(!ve)throw Error(l(176));at(c.stateNode,c.memoizedProps,c)&&wi(c)}else c.stateNode=je(_,o,w,c)}return null;case 13:return xt(Ot),_=c.memoizedState,c.flags&64?(c.lanes=h,c):(_=_!==null,w=!1,o===null?c.memoizedProps.fallback!==void 0&&cl(c):w=o.memoizedState!==null,_&&!w&&c.mode&2&&(o===null&&c.memoizedProps.unstable_avoidThisFallback!==!0||Ot.current&1?cn===0&&(cn=3):((cn===0||cn===3)&&(cn=4),vn===null||!(Yo&134217727)&&!(Is&134217727)||zs(vn,pn))),Le&&_&&(c.flags|=4),me&&(_||w)&&(c.flags|=4),null);case 4:return Ps(),qo(c),o===null&&O(c.stateNode.containerInfo),null;case 10:return _u(c),null;case 17:return jt(c.type)&&er(),null;case 19:if(xt(Ot),_=c.memoizedState,_===null)return null;if(w=(c.flags&64)!==0,E=_.rendering,E===null)if(w)Xo(_,!1);else{if(cn!==0||o!==null&&o.flags&64)for(o=c.child;o!==null;){if(E=ll(o),E!==null){for(c.flags|=64,Xo(_,!1),o=E.updateQueue,o!==null&&(c.updateQueue=o,c.flags|=4),_.lastEffect===null&&(c.firstEffect=null),c.lastEffect=_.lastEffect,o=h,_=c.child;_!==null;)w=_,h=o,w.flags&=2,w.nextEffect=null,w.firstEffect=null,w.lastEffect=null,E=w.alternate,E===null?(w.childLanes=0,w.lanes=h,w.child=null,w.memoizedProps=null,w.memoizedState=null,w.updateQueue=null,w.dependencies=null,w.stateNode=null):(w.childLanes=E.childLanes,w.lanes=E.lanes,w.child=E.child,w.memoizedProps=E.memoizedProps,w.memoizedState=E.memoizedState,w.updateQueue=E.updateQueue,w.type=E.type,h=E.dependencies,w.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),_=_.sibling;return rt(Ot,Ot.current&1|2),c.child}o=o.sibling}_.tail!==null&&an()>$u&&(c.flags|=64,w=!0,Xo(_,!1),c.lanes=33554432)}else{if(!w)if(o=ll(E),o!==null){if(c.flags|=64,w=!0,o=o.updateQueue,o!==null&&(c.updateQueue=o,c.flags|=4),Xo(_,!0),_.tail===null&&_.tailMode==="hidden"&&!E.alternate&&!vi)return c=c.lastEffect=_.lastEffect,c!==null&&(c.nextEffect=null),null}else 2*an()-_.renderingStartTime>$u&&h!==1073741824&&(c.flags|=64,w=!0,Xo(_,!1),c.lanes=33554432);_.isBackwards?(E.sibling=c.child,c.child=E):(o=_.last,o!==null?o.sibling=E:c.child=E,_.last=E)}return _.tail!==null?(o=_.tail,_.rendering=o,_.tail=o.sibling,_.lastEffect=c.lastEffect,_.renderingStartTime=an(),o.sibling=null,c=Ot.current,rt(Ot,w?c&1|2:c&1),o):null;case 23:case 24:return sh(),o!==null&&o.memoizedState!==null!=(c.memoizedState!==null)&&_.mode!=="unstable-defer-without-hiding"&&(c.flags|=4),null}throw Error(l(156,c.tag))}function Wx(o){switch(o.tag){case 1:jt(o.type)&&er();var c=o.flags;return c&4096?(o.flags=c&-4097|64,o):null;case 3:if(Ps(),xt(Xt),xt(Pt),Au(),c=o.flags,c&64)throw Error(l(285));return o.flags=c&-4097|64,o;case 5:return bu(o),null;case 13:return xt(Ot),c=o.flags,c&4096?(o.flags=c&-4097|64,o):null;case 19:return xt(Ot),null;case 4:return Ps(),null;case 10:return _u(o),null;case 23:case 24:return sh(),null;default:return null}}function Bu(o,c){try{var h="",_=c;do h+=Ox(_),_=_.return;while(_);var w=h}catch(E){w=`
|
|
3010
|
+
Error generating stack: `+E.message+`
|
|
3011
|
+
`+E.stack}return{value:o,source:c,stack:w}}function Uu(o,c){try{console.error(c.value)}catch(h){setTimeout(function(){throw h})}}var qx=typeof WeakMap=="function"?WeakMap:Map;function Dp(o,c,h){h=ir(-1,h),h.tag=3,h.payload={element:null};var _=c.value;return h.callback=function(){Al||(Al=!0,eh=_),Uu(o,c)},h}function Ip(o,c,h){h=ir(-1,h),h.tag=3;var _=o.type.getDerivedStateFromError;if(typeof _=="function"){var w=c.value;h.payload=function(){return Uu(o,c),_(w)}}var E=o.stateNode;return E!==null&&typeof E.componentDidCatch=="function"&&(h.callback=function(){typeof _!="function"&&(Mi===null?Mi=new Set([this]):Mi.add(this),Uu(o,c));var F=c.stack;this.componentDidCatch(c.value,{componentStack:F!==null?F:""})}),h}var Xx=typeof WeakSet=="function"?WeakSet:Set;function zp(o){var c=o.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(h){lr(o,h)}else c.current=null}function jx(o,c){switch(c.tag){case 0:case 11:case 15:case 22:return;case 1:if(c.flags&256&&o!==null){var h=o.memoizedProps,_=o.memoizedState;o=c.stateNode,c=o.getSnapshotBeforeUpdate(c.elementType===c.type?h:ni(c.type,h),_),o.__reactInternalSnapshotBeforeUpdate=c}return;case 3:me&&c.flags&256&&xn(c.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(l(163))}function Np(o,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&o)===o){var _=h.destroy;h.destroy=void 0,_!==void 0&&_()}h=h.next}while(h!==c)}}function Yx(o,c,h){switch(h.tag){case 0:case 11:case 15:case 22:if(c=h.updateQueue,c=c!==null?c.lastEffect:null,c!==null){o=c=c.next;do{if((o.tag&3)===3){var _=o.create;o.destroy=_()}o=o.next}while(o!==c)}if(c=h.updateQueue,c=c!==null?c.lastEffect:null,c!==null){o=c=c.next;do{var w=o;_=w.next,w=w.tag,w&4&&w&1&&(Qp(h,o),iv(h,o)),o=_}while(o!==c)}return;case 1:o=h.stateNode,h.flags&4&&(c===null?o.componentDidMount():(_=h.elementType===h.type?c.memoizedProps:ni(h.type,c.memoizedProps),o.componentDidUpdate(_,c.memoizedState,o.__reactInternalSnapshotBeforeUpdate))),c=h.updateQueue,c!==null&&Qd(h,c,o);return;case 3:if(c=h.updateQueue,c!==null){if(o=null,h.child!==null)switch(h.child.tag){case 5:o=re(h.child.stateNode);break;case 1:o=h.child.stateNode}Qd(h,c,o)}return;case 5:o=h.stateNode,c===null&&h.flags&4&&we(o,h.type,h.memoizedProps,h);return;case 6:return;case 4:return;case 12:return;case 13:ve&&h.memoizedState===null&&(h=h.alternate,h!==null&&(h=h.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&dt(h))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(l(163))}function Fp(o,c){if(me)for(var h=o;;){if(h.tag===5){var _=h.stateNode;c?ut(_):Ln(h.stateNode,h.memoizedProps)}else if(h.tag===6)_=h.stateNode,c?Qe(_):yn(_,h.memoizedProps);else if((h.tag!==23&&h.tag!==24||h.memoizedState===null||h===o)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===o)break;for(;h.sibling===null;){if(h.return===null||h.return===o)return;h=h.return}h.sibling.return=h.return,h=h.sibling}}function Op(o,c){if(Ir&&typeof Ir.onCommitFiberUnmount=="function")try{Ir.onCommitFiberUnmount(fu,c)}catch{}switch(c.tag){case 0:case 11:case 14:case 15:case 22:if(o=c.updateQueue,o!==null&&(o=o.lastEffect,o!==null)){var h=o=o.next;do{var _=h,w=_.destroy;if(_=_.tag,w!==void 0)if(_&4)Qp(c,h);else{_=c;try{w()}catch(E){lr(_,E)}}h=h.next}while(h!==o)}break;case 1:if(zp(c),o=c.stateNode,typeof o.componentWillUnmount=="function")try{o.props=c.memoizedProps,o.state=c.memoizedState,o.componentWillUnmount()}catch(E){lr(c,E)}break;case 5:zp(c);break;case 4:me?Gp(o,c):Le&&Le&&(c=c.stateNode.containerInfo,o=mi(c),Ri(c,o))}}function Bp(o,c){for(var h=c;;)if(Op(o,h),h.child===null||me&&h.tag===4){if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return;h=h.return}h.sibling.return=h.return,h=h.sibling}else h.child.return=h,h=h.child}function Up(o){o.alternate=null,o.child=null,o.dependencies=null,o.firstEffect=null,o.lastEffect=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.return=null,o.updateQueue=null}function kp(o){return o.tag===5||o.tag===3||o.tag===4}function Hp(o){if(me){e:{for(var c=o.return;c!==null;){if(kp(c))break e;c=c.return}throw Error(l(160))}var h=c;switch(c=h.stateNode,h.tag){case 5:var _=!1;break;case 3:c=c.containerInfo,_=!0;break;case 4:c=c.containerInfo,_=!0;break;default:throw Error(l(161))}h.flags&16&&(Ie(c),h.flags&=-17);e:t:for(h=o;;){for(;h.sibling===null;){if(h.return===null||kp(h.return)){h=null;break e}h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.flags&2||h.child===null||h.tag===4)continue t;h.child.return=h,h=h.child}if(!(h.flags&2)){h=h.stateNode;break e}}_?ku(o,h,c):Hu(o,h,c)}}function ku(o,c,h){var _=o.tag,w=_===5||_===6;if(w)o=w?o.stateNode:o.stateNode.instance,c?Q(h,o,c):ze(h,o);else if(_!==4&&(o=o.child,o!==null))for(ku(o,c,h),o=o.sibling;o!==null;)ku(o,c,h),o=o.sibling}function Hu(o,c,h){var _=o.tag,w=_===5||_===6;if(w)o=w?o.stateNode:o.stateNode.instance,c?U(h,o,c):nt(h,o);else if(_!==4&&(o=o.child,o!==null))for(Hu(o,c,h),o=o.sibling;o!==null;)Hu(o,c,h),o=o.sibling}function Gp(o,c){for(var h=c,_=!1,w,E;;){if(!_){_=h.return;e:for(;;){if(_===null)throw Error(l(160));switch(w=_.stateNode,_.tag){case 5:E=!1;break e;case 3:w=w.containerInfo,E=!0;break e;case 4:w=w.containerInfo,E=!0;break e}_=_.return}_=!0}if(h.tag===5||h.tag===6)Bp(o,h),E?de(w,h.stateNode):ye(w,h.stateNode);else if(h.tag===4){if(h.child!==null){w=h.stateNode.containerInfo,E=!0,h.child.return=h,h=h.child;continue}}else if(Op(o,h),h.child!==null){h.child.return=h,h=h.child;continue}if(h===c)break;for(;h.sibling===null;){if(h.return===null||h.return===c)return;h=h.return,h.tag===4&&(_=!1)}h.sibling.return=h.return,h=h.sibling}}function Gu(o,c){if(me){switch(c.tag){case 0:case 11:case 14:case 15:case 22:Np(3,c);return;case 1:return;case 5:var h=c.stateNode;if(h!=null){var _=c.memoizedProps;o=o!==null?o.memoizedProps:_;var w=c.type,E=c.updateQueue;c.updateQueue=null,E!==null&&_e(h,E,w,o,_,c)}return;case 6:if(c.stateNode===null)throw Error(l(162));h=c.memoizedProps,k(c.stateNode,o!==null?o.memoizedProps:h,h);return;case 3:ve&&(c=c.stateNode,c.hydrate&&(c.hydrate=!1,yt(c.containerInfo)));return;case 12:return;case 13:Vp(c),xl(c);return;case 19:xl(c);return;case 17:return;case 23:case 24:Fp(c,c.memoizedState!==null);return}throw Error(l(163))}switch(c.tag){case 0:case 11:case 14:case 15:case 22:Np(3,c);return;case 12:return;case 13:Vp(c),xl(c);return;case 19:xl(c);return;case 3:ve&&(h=c.stateNode,h.hydrate&&(h.hydrate=!1,yt(h.containerInfo)));break;case 23:case 24:return}e:if(Le){switch(c.tag){case 1:case 5:case 6:case 20:break e;case 3:case 4:c=c.stateNode,Ri(c.containerInfo,c.pendingChildren);break e}throw Error(l(163))}}function Vp(o){o.memoizedState!==null&&(Qu=an(),me&&Fp(o.child,!0))}function xl(o){var c=o.updateQueue;if(c!==null){o.updateQueue=null;var h=o.stateNode;h===null&&(h=o.stateNode=new Xx),c.forEach(function(_){var w=ov.bind(null,o,_);h.has(_)||(h.add(_),_.then(w,w))})}}function Jx(o,c){return o!==null&&(o=o.memoizedState,o===null||o.dehydrated!==null)?(c=c.memoizedState,c!==null&&c.dehydrated===null):!1}var vl=0,_l=1,wl=2,Ml=3,Sl=4;if(typeof Symbol=="function"&&Symbol.for){var jo=Symbol.for;vl=jo("selector.component"),_l=jo("selector.has_pseudo_class"),wl=jo("selector.role"),Ml=jo("selector.test_id"),Sl=jo("selector.text")}function Vu(o){var c=Ze(o);if(c!=null){if(typeof c.memoizedProps["data-testname"]!="string")throw Error(l(364));return c}if(o=te(o),o===null)throw Error(l(362));return o.stateNode.current}function Wu(o,c){switch(c.$$typeof){case vl:if(o.type===c.value)return!0;break;case _l:e:{c=c.value,o=[o,0];for(var h=0;h<o.length;){var _=o[h++],w=o[h++],E=c[w];if(_.tag!==5||!Ee(_)){for(;E!=null&&Wu(_,E);)w++,E=c[w];if(w===c.length){c=!0;break e}else for(_=_.child;_!==null;)o.push(_,w),_=_.sibling}}c=!1}return c;case wl:if(o.tag===5&&ke(o.stateNode,c.value))return!0;break;case Sl:if((o.tag===5||o.tag===6)&&(o=be(o),o!==null&&0<=o.indexOf(c.value)))return!0;break;case Ml:if(o.tag===5&&(o=o.memoizedProps["data-testname"],typeof o=="string"&&o.toLowerCase()===c.value.toLowerCase()))return!0;break;default:throw Error(l(365,c))}return!1}function qu(o){switch(o.$$typeof){case vl:return"<"+(z(o.value)||"Unknown")+">";case _l:return":has("+(qu(o)||"")+")";case wl:return'[role="'+o.value+'"]';case Sl:return'"'+o.value+'"';case Ml:return'[data-testname="'+o.value+'"]';default:throw Error(l(365,o))}}function Wp(o,c){var h=[];o=[o,0];for(var _=0;_<o.length;){var w=o[_++],E=o[_++],F=c[E];if(w.tag!==5||!Ee(w)){for(;F!=null&&Wu(w,F);)E++,F=c[E];if(E===c.length)h.push(w);else for(w=w.child;w!==null;)o.push(w,E),w=w.sibling}}return h}function Xu(o,c){if(!P)throw Error(l(363));o=Vu(o),o=Wp(o,c),c=[],o=Array.from(o);for(var h=0;h<o.length;){var _=o[h++];if(_.tag===5)Ee(_)||c.push(_.stateNode);else for(_=_.child;_!==null;)o.push(_),_=_.sibling}return c}var bl=null;function Zx(o){if(bl===null)try{var c=("require"+Math.random()).slice(0,7);bl=(r&&r[c]).call(r,"timers").setImmediate}catch{bl=function(_){var w=new MessageChannel;w.port1.onmessage=_,w.port2.postMessage(void 0)}}return bl(o)}var Kx=Math.ceil,El=u.ReactCurrentDispatcher,ju=u.ReactCurrentOwner,Yu=u.IsSomeRendererActing,Xe=0,vn=null,$t=null,pn=0,Br=0,Ju=lt(0),cn=0,Tl=null,Ds=0,Yo=0,Is=0,Zu=0,Ku=null,Qu=0,$u=1/0;function sr(){$u=an()+500}var De=null,Al=!1,eh=null,Mi=null,or=!1,Jo=null,Zo=90,th=[],nh=[],zi=null,Ko=0,ih=null,Cl=-1,Ni=0,Rl=0,Qo=null,$o=!1;function Rn(){return Xe&48?an():Cl!==-1?Cl:Cl=an()}function ar(o){if(o=o.mode,!(o&2))return 1;if(!(o&4))return Ts()===99?1:2;if(Ni===0&&(Ni=Ds),zx.transition!==0){Rl!==0&&(Rl=Ku!==null?Ku.pendingLanes:0),o=Ni;var c=4186112&~Rl;return c&=-c,c===0&&(o=4186112&~o,c=o&-o,c===0&&(c=8192)),c}return o=Ts(),Xe&4&&o===98?o=Ja(12,Ni):(o=Ex(o),o=Ja(o,Ni)),o}function Fi(o,c,h){if(50<Ko)throw Ko=0,ih=null,Error(l(185));if(o=Pl(o,c),o===null)return null;Za(o,c,h),o===vn&&(Is|=c,cn===4&&zs(o,pn));var _=Ts();c===1?Xe&8&&!(Xe&48)?rh(o):(Dn(o,h),Xe===0&&(sr(),Hn())):(!(Xe&4)||_!==98&&_!==99||(zi===null?zi=new Set([o]):zi.add(o)),Dn(o,h)),Ku=o}function Pl(o,c){o.lanes|=c;var h=o.alternate;for(h!==null&&(h.lanes|=c),h=o,o=o.return;o!==null;)o.childLanes|=c,h=o.alternate,h!==null&&(h.childLanes|=c),h=o,o=o.return;return h.tag===3?h.stateNode:null}function Dn(o,c){for(var h=o.callbackNode,_=o.suspendedLanes,w=o.pingedLanes,E=o.expirationTimes,F=o.pendingLanes;0<F;){var H=31-tr(F),ie=1<<H,Me=E[H];if(Me===-1){if(!(ie&_)||ie&w){Me=c,zr(ie);var He=Ct;E[H]=10<=He?Me+250:6<=He?Me+5e3:-1}}else Me<=c&&(o.expiredLanes|=ie);F&=~ie}if(_=Do(o,o===vn?pn:0),c=Ct,_===0)h!==null&&(h!==yu&&mu(h),o.callbackNode=null,o.callbackPriority=0);else{if(h!==null){if(o.callbackPriority===c)return;h!==yu&&mu(h)}c===15?(h=rh.bind(null,o),Pi===null?(Pi=[h],Qa=pu(Ka,jd)):Pi.push(h),h=yu):c===14?h=Io(99,rh.bind(null,o)):(h=Tx(c),h=Io(h,qp.bind(null,o))),o.callbackPriority=c,o.callbackNode=h}}function qp(o){if(Cl=-1,Rl=Ni=0,Xe&48)throw Error(l(327));var c=o.callbackNode;if(Oi()&&o.callbackNode!==c)return null;var h=Do(o,o===vn?pn:0);if(h===0)return null;var _=h,w=Xe;Xe|=16;var E=Jp();(vn!==o||pn!==_)&&(sr(),Ns(o,_));do try{ev();break}catch(H){Yp(o,H)}while(1);if(vu(),El.current=E,Xe=w,$t!==null?_=0:(vn=null,pn=0,_=cn),Ds&Is)Ns(o,0);else if(_!==0){if(_===2&&(Xe|=64,o.hydrate&&(o.hydrate=!1,xn(o.containerInfo)),h=Ud(o),h!==0&&(_=ea(o,h))),_===1)throw c=Tl,Ns(o,0),zs(o,h),Dn(o,an()),c;switch(o.finishedWork=o.current.alternate,o.finishedLanes=h,_){case 0:case 1:throw Error(l(345));case 2:Ur(o);break;case 3:if(zs(o,h),(h&62914560)===h&&(_=Qu+500-an(),10<_)){if(Do(o,0)!==0)break;if(w=o.suspendedLanes,(w&h)!==h){Rn(),o.pingedLanes|=o.suspendedLanes&w;break}o.timeoutHandle=xe(Ur.bind(null,o),_);break}Ur(o);break;case 4:if(zs(o,h),(h&4186112)===h)break;for(_=o.eventTimes,w=-1;0<h;){var F=31-tr(h);E=1<<F,F=_[F],F>w&&(w=F),h&=~E}if(h=w,h=an()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*Kx(h/1960))-h,10<h){o.timeoutHandle=xe(Ur.bind(null,o),h);break}Ur(o);break;case 5:Ur(o);break;default:throw Error(l(329))}}return Dn(o,an()),o.callbackNode===c?qp.bind(null,o):null}function zs(o,c){for(c&=~Zu,c&=~Is,o.suspendedLanes|=c,o.pingedLanes&=~c,o=o.expirationTimes;0<c;){var h=31-tr(c),_=1<<h;o[h]=-1,c&=~_}}function rh(o){if(Xe&48)throw Error(l(327));if(Oi(),o===vn&&o.expiredLanes&pn){var c=pn,h=ea(o,c);Ds&Is&&(c=Do(o,c),h=ea(o,c))}else c=Do(o,0),h=ea(o,c);if(o.tag!==0&&h===2&&(Xe|=64,o.hydrate&&(o.hydrate=!1,xn(o.containerInfo)),c=Ud(o),c!==0&&(h=ea(o,c))),h===1)throw h=Tl,Ns(o,0),zs(o,c),Dn(o,an()),h;return o.finishedWork=o.current.alternate,o.finishedLanes=c,Ur(o),Dn(o,an()),null}function Qx(){if(zi!==null){var o=zi;zi=null,o.forEach(function(c){c.expiredLanes|=24&c.pendingLanes,Dn(c,an())})}Hn()}function Xp(o,c){var h=Xe;Xe|=1;try{return o(c)}finally{Xe=h,Xe===0&&(sr(),Hn())}}function jp(o,c){var h=Xe;if(h&48)return o(c);Xe|=1;try{if(o)return Li(99,o.bind(null,c))}finally{Xe=h,Hn()}}function Ll(o,c){rt(Ju,Br),Br|=c,Ds|=c}function sh(){Br=Ju.current,xt(Ju)}function Ns(o,c){o.finishedWork=null,o.finishedLanes=0;var h=o.timeoutHandle;if(h!==ae&&(o.timeoutHandle=ae,tt(h)),$t!==null)for(h=$t.return;h!==null;){var _=h;switch(_.tag){case 1:_=_.type.childContextTypes,_!=null&&er();break;case 3:Ps(),xt(Xt),xt(Pt),Au();break;case 5:bu(_);break;case 4:Ps();break;case 13:xt(Ot);break;case 19:xt(Ot);break;case 10:_u(_);break;case 23:case 24:sh()}h=h.return}vn=o,$t=cr(o.current,null),pn=Br=Ds=c,cn=0,Tl=null,Zu=Is=Yo=0}function Yp(o,c){do{var h=$t;try{if(vu(),Bo.current=pl,ul){for(var _=kt.memoizedState;_!==null;){var w=_.queue;w!==null&&(w.pending=null),_=_.next}ul=!1}if(Uo=0,ln=dn=kt=null,ko=!1,ju.current=null,h===null||h.return===null){cn=1,Tl=c,$t=null;break}e:{var E=o,F=h.return,H=h,ie=c;if(c=pn,H.flags|=2048,H.firstEffect=H.lastEffect=null,ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var Me=ie;if(!(H.mode&2)){var He=H.alternate;He?(H.updateQueue=He.updateQueue,H.memoizedState=He.memoizedState,H.lanes=He.lanes):(H.updateQueue=null,H.memoizedState=null)}var Ke=(Ot.current&1)!==0,Pe=F;do{var Et;if(Et=Pe.tag===13){var Dt=Pe.memoizedState;if(Dt!==null)Et=Dt.dehydrated!==null;else{var jn=Pe.memoizedProps;Et=jn.fallback===void 0?!1:jn.unstable_avoidThisFallback!==!0?!0:!Ke}}if(Et){var j=Pe.updateQueue;if(j===null){var G=new Set;G.add(Me),Pe.updateQueue=G}else j.add(Me);if(!(Pe.mode&2)){if(Pe.flags|=64,H.flags|=16384,H.flags&=-2981,H.tag===1)if(H.alternate===null)H.tag=17;else{var se=ir(-1,1);se.tag=2,rr(H,se)}H.lanes|=1;break e}ie=void 0,H=c;var Re=E.pingCache;if(Re===null?(Re=E.pingCache=new qx,ie=new Set,Re.set(Me,ie)):(ie=Re.get(Me),ie===void 0&&(ie=new Set,Re.set(Me,ie))),!ie.has(H)){ie.add(H);var Ge=sv.bind(null,E,Me,H);Me.then(Ge,Ge)}Pe.flags|=4096,Pe.lanes=c;break e}Pe=Pe.return}while(Pe!==null);ie=Error((z(H.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
|
|
3012
|
+
|
|
3013
|
+
Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`)}cn!==5&&(cn=2),ie=Bu(ie,H),Pe=F;do{switch(Pe.tag){case 3:E=ie,Pe.flags|=4096,c&=-c,Pe.lanes|=c;var Rt=Dp(Pe,E,c);Kd(Pe,Rt);break e;case 1:E=ie;var $e=Pe.type,_t=Pe.stateNode;if(!(Pe.flags&64)&&(typeof $e.getDerivedStateFromError=="function"||_t!==null&&typeof _t.componentDidCatch=="function"&&(Mi===null||!Mi.has(_t)))){Pe.flags|=4096,c&=-c,Pe.lanes|=c;var Yt=Ip(Pe,E,c);Kd(Pe,Yt);break e}}Pe=Pe.return}while(Pe!==null)}Kp(h)}catch(pt){c=pt,$t===h&&h!==null&&($t=h=h.return);continue}break}while(1)}function Jp(){var o=El.current;return El.current=pl,o===null?pl:o}function ea(o,c){var h=Xe;Xe|=16;var _=Jp();vn===o&&pn===c||Ns(o,c);do try{$x();break}catch(w){Yp(o,w)}while(1);if(vu(),Xe=h,El.current=_,$t!==null)throw Error(l(261));return vn=null,pn=0,cn}function $x(){for(;$t!==null;)Zp($t)}function ev(){for(;$t!==null&&!Lx();)Zp($t)}function Zp(o){var c=em(o.alternate,o,Br);o.memoizedProps=o.pendingProps,c===null?Kp(o):$t=c,ju.current=null}function Kp(o){var c=o;do{var h=c.alternate;if(o=c.return,c.flags&2048){if(h=Wx(c),h!==null){h.flags&=2047,$t=h;return}o!==null&&(o.firstEffect=o.lastEffect=null,o.flags|=2048)}else{if(h=Vx(h,c,Br),h!==null){$t=h;return}if(h=c,h.tag!==24&&h.tag!==23||h.memoizedState===null||Br&1073741824||!(h.mode&4)){for(var _=0,w=h.child;w!==null;)_|=w.lanes|w.childLanes,w=w.sibling;h.childLanes=_}o!==null&&!(o.flags&2048)&&(o.firstEffect===null&&(o.firstEffect=c.firstEffect),c.lastEffect!==null&&(o.lastEffect!==null&&(o.lastEffect.nextEffect=c.firstEffect),o.lastEffect=c.lastEffect),1<c.flags&&(o.lastEffect!==null?o.lastEffect.nextEffect=c:o.firstEffect=c,o.lastEffect=c))}if(c=c.sibling,c!==null){$t=c;return}$t=c=o}while(c!==null);cn===0&&(cn=5)}function Ur(o){var c=Ts();return Li(99,tv.bind(null,o,c)),null}function tv(o,c){do Oi();while(Jo!==null);if(Xe&48)throw Error(l(327));var h=o.finishedWork;if(h===null)return null;if(o.finishedWork=null,o.finishedLanes=0,h===o.current)throw Error(l(177));o.callbackNode=null;var _=h.lanes|h.childLanes,w=_,E=o.pendingLanes&~w;o.pendingLanes=w,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=w,o.mutableReadLanes&=w,o.entangledLanes&=w,w=o.entanglements;for(var F=o.eventTimes,H=o.expirationTimes;0<E;){var ie=31-tr(E),Me=1<<ie;w[ie]=0,F[ie]=-1,H[ie]=-1,E&=~Me}if(zi!==null&&!(_&24)&&zi.has(o)&&zi.delete(o),o===vn&&($t=vn=null,pn=0),1<h.flags?h.lastEffect!==null?(h.lastEffect.nextEffect=h,_=h.firstEffect):_=h:_=h.firstEffect,_!==null){w=Xe,Xe|=32,ju.current=null,Qo=he(o.containerInfo),$o=!1,De=_;do try{nv()}catch(G){if(De===null)throw Error(l(330));lr(De,G),De=De.nextEffect}while(De!==null);Qo=null,De=_;do try{for(F=o;De!==null;){var He=De.flags;if(He&16&&me&&Ie(De.stateNode),He&128){var Ke=De.alternate;if(Ke!==null){var Pe=Ke.ref;Pe!==null&&(typeof Pe=="function"?Pe(null):Pe.current=null)}}switch(He&1038){case 2:Hp(De),De.flags&=-3;break;case 6:Hp(De),De.flags&=-3,Gu(De.alternate,De);break;case 1024:De.flags&=-1025;break;case 1028:De.flags&=-1025,Gu(De.alternate,De);break;case 4:Gu(De.alternate,De);break;case 8:H=F,E=De,me?Gp(H,E):Bp(H,E);var Et=E.alternate;Up(E),Et!==null&&Up(Et)}De=De.nextEffect}}catch(G){if(De===null)throw Error(l(330));lr(De,G),De=De.nextEffect}while(De!==null);$o&&vt(),Ce(o.containerInfo),o.current=h,De=_;do try{for(He=o;De!==null;){var Dt=De.flags;if(Dt&36&&Yx(He,De.alternate,De),Dt&128){Ke=void 0;var jn=De.ref;if(jn!==null){var j=De.stateNode;switch(De.tag){case 5:Ke=re(j);break;default:Ke=j}typeof jn=="function"?jn(Ke):jn.current=Ke}}De=De.nextEffect}}catch(G){if(De===null)throw Error(l(330));lr(De,G),De=De.nextEffect}while(De!==null);De=null,Ix(),Xe=w}else o.current=h;if(or)or=!1,Jo=o,Zo=c;else for(De=_;De!==null;)c=De.nextEffect,De.nextEffect=null,De.flags&8&&(Dt=De,Dt.sibling=null,Dt.stateNode=null),De=c;if(_=o.pendingLanes,_===0&&(Mi=null),_===1?o===ih?Ko++:(Ko=0,ih=o):Ko=0,h=h.stateNode,Ir&&typeof Ir.onCommitFiberRoot=="function")try{Ir.onCommitFiberRoot(fu,h,void 0,(h.current.flags&64)===64)}catch{}if(Dn(o,an()),Al)throw Al=!1,o=eh,eh=null,o;return Xe&8||Hn(),null}function nv(){for(;De!==null;){var o=De.alternate;$o||Qo===null||(De.flags&8?V(De,Qo)&&($o=!0,St()):De.tag===13&&Jx(o,De)&&V(De,Qo)&&($o=!0,St()));var c=De.flags;c&256&&jx(o,De),!(c&512)||or||(or=!0,Io(97,function(){return Oi(),null})),De=De.nextEffect}}function Oi(){if(Zo!==90){var o=97<Zo?97:Zo;return Zo=90,Li(o,rv)}return!1}function iv(o,c){th.push(c,o),or||(or=!0,Io(97,function(){return Oi(),null}))}function Qp(o,c){nh.push(c,o),or||(or=!0,Io(97,function(){return Oi(),null}))}function rv(){if(Jo===null)return!1;var o=Jo;if(Jo=null,Xe&48)throw Error(l(331));var c=Xe;Xe|=32;var h=nh;nh=[];for(var _=0;_<h.length;_+=2){var w=h[_],E=h[_+1],F=w.destroy;if(w.destroy=void 0,typeof F=="function")try{F()}catch(ie){if(E===null)throw Error(l(330));lr(E,ie)}}for(h=th,th=[],_=0;_<h.length;_+=2){w=h[_],E=h[_+1];try{var H=w.create;w.destroy=H()}catch(ie){if(E===null)throw Error(l(330));lr(E,ie)}}for(H=o.current.firstEffect;H!==null;)o=H.nextEffect,H.nextEffect=null,H.flags&8&&(H.sibling=null,H.stateNode=null),H=o;return Xe=c,Hn(),!0}function $p(o,c,h){c=Bu(h,c),c=Dp(o,c,1),rr(o,c),c=Rn(),o=Pl(o,1),o!==null&&(Za(o,1,c),Dn(o,c))}function lr(o,c){if(o.tag===3)$p(o,o,c);else for(var h=o.return;h!==null;){if(h.tag===3){$p(h,o,c);break}else if(h.tag===1){var _=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof _.componentDidCatch=="function"&&(Mi===null||!Mi.has(_))){o=Bu(c,o);var w=Ip(h,o,1);if(rr(h,w),w=Rn(),h=Pl(h,1),h!==null)Za(h,1,w),Dn(h,w);else if(typeof _.componentDidCatch=="function"&&(Mi===null||!Mi.has(_)))try{_.componentDidCatch(c,o)}catch{}break}}h=h.return}}function sv(o,c,h){var _=o.pingCache;_!==null&&_.delete(c),c=Rn(),o.pingedLanes|=o.suspendedLanes&h,vn===o&&(pn&h)===h&&(cn===4||cn===3&&(pn&62914560)===pn&&500>an()-Qu?Ns(o,0):Zu|=h),Dn(o,c)}function ov(o,c){var h=o.stateNode;h!==null&&h.delete(c),c=0,c===0&&(c=o.mode,c&2?c&4?(Ni===0&&(Ni=Ds),c=Es(62914560&~Ni),c===0&&(c=4194304)):c=Ts()===99?1:2:c=1),h=Rn(),o=Pl(o,c),o!==null&&(Za(o,c,h),Dn(o,h))}var em;em=function(o,c,h){var _=c.lanes;if(o!==null)if(o.memoizedProps!==c.pendingProps||Xt.current)ii=!0;else if(h&_)ii=!!(o.flags&16384);else{switch(ii=!1,c.tag){case 3:bp(c),Tu();break;case 5:sp(c);break;case 1:jt(c.type)&&ja(c);break;case 4:Su(c,c.stateNode.containerInfo);break;case 10:Yd(c,c.memoizedProps.value);break;case 13:if(c.memoizedState!==null)return h&c.child.childLanes?Ep(o,c,h):(rt(Ot,Ot.current&1),c=Ii(o,c,h),c!==null?c.sibling:null);rt(Ot,Ot.current&1);break;case 19:if(_=(h&c.childLanes)!==0,o.flags&64){if(_)return Pp(o,c,h);c.flags|=64}var w=c.memoizedState;if(w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),rt(Ot,Ot.current),_)break;return null;case 23:case 24:return c.lanes=0,zu(o,c,h)}return Ii(o,c,h)}else ii=!1;switch(c.lanes=0,c.tag){case 2:if(_=c.type,o!==null&&(o.alternate=null,c.alternate=null,c.flags|=2),o=c.pendingProps,w=zt(c,Pt.current),Cs(c,h),w=Ru(null,c,_,o,w,h),c.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0){if(c.tag=1,c.memoizedState=null,c.updateQueue=null,jt(_)){var E=!0;ja(c)}else E=!1;c.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,wu(c);var F=_.getDerivedStateFromProps;typeof F=="function"&&il(c,_,F,o),w.updater=rl,c.stateNode=w,w._reactInternals=c,Mu(c,_,o,h),c=Fu(null,c,_,!0,E,h)}else c.tag=0,Cn(null,c,w,h),c=c.child;return c;case 16:w=c.elementType;e:{switch(o!==null&&(o.alternate=null,c.alternate=null,c.flags|=2),o=c.pendingProps,E=w._init,w=E(w._payload),c.type=w,E=c.tag=lv(w),o=ni(w,o),E){case 0:c=Nu(null,c,w,o,h);break e;case 1:c=Sp(null,c,w,o,h);break e;case 11:c=vp(null,c,w,o,h);break e;case 14:c=_p(null,c,w,ni(w.type,o),_,h);break e}throw Error(l(306,w,""))}return c;case 0:return _=c.type,w=c.pendingProps,w=c.elementType===_?w:ni(_,w),Nu(o,c,_,w,h);case 1:return _=c.type,w=c.pendingProps,w=c.elementType===_?w:ni(_,w),Sp(o,c,_,w,h);case 3:if(bp(c),_=c.updateQueue,o===null||_===null)throw Error(l(282));if(_=c.pendingProps,w=c.memoizedState,w=w!==null?w.element:null,Zd(o,c),zo(c,_,null,h),_=c.memoizedState.element,_===w)Tu(),c=Ii(o,c,h);else{if(w=c.stateNode,(E=w.hydrate)&&(ve?(Nr=Je(c.stateNode.containerInfo),Di=c,E=vi=!0):E=!1),E){if(ve&&(o=w.mutableSourceEagerHydrationData,o!=null))for(w=0;w<o.length;w+=2)E=o[w],F=o[w+1],ce?E._workInProgressVersionPrimary=F:E._workInProgressVersionSecondary=F,Ls.push(E);for(h=rp(c,null,_,h),c.child=h;h;)h.flags=h.flags&-3|1024,h=h.sibling}else Cn(o,c,_,h),Tu();c=c.child}return c;case 5:return sp(c),o===null&&Eu(c),_=c.type,w=c.pendingProps,E=o!==null?o.memoizedProps:null,F=w.children,qe(_,w)?F=null:E!==null&&qe(_,E)&&(c.flags|=16),Mp(o,c),Cn(o,c,F,h),c.child;case 6:return o===null&&Eu(c),null;case 13:return Ep(o,c,h);case 4:return Su(c,c.stateNode.containerInfo),_=c.pendingProps,o===null?c.child=al(c,null,_,h):Cn(o,c,_,h),c.child;case 11:return _=c.type,w=c.pendingProps,w=c.elementType===_?w:ni(_,w),vp(o,c,_,w,h);case 7:return Cn(o,c,c.pendingProps,h),c.child;case 8:return Cn(o,c,c.pendingProps.children,h),c.child;case 12:return Cn(o,c,c.pendingProps.children,h),c.child;case 10:e:{if(_=c.type._context,w=c.pendingProps,F=c.memoizedProps,E=w.value,Yd(c,E),F!==null){var H=F.value;if(E=Gn(H,E)?0:(typeof _._calculateChangedBits=="function"?_._calculateChangedBits(H,E):1073741823)|0,E===0){if(F.children===w.children&&!Xt.current){c=Ii(o,c,h);break e}}else for(H=c.child,H!==null&&(H.return=c);H!==null;){var ie=H.dependencies;if(ie!==null){F=H.child;for(var Me=ie.firstContext;Me!==null;){if(Me.context===_&&Me.observedBits&E){H.tag===1&&(Me=ir(-1,h&-h),Me.tag=2,rr(H,Me)),H.lanes|=h,Me=H.alternate,Me!==null&&(Me.lanes|=h),Jd(H.return,h),ie.lanes|=h;break}Me=Me.next}}else F=H.tag===10&&H.type===c.type?null:H.child;if(F!==null)F.return=H;else for(F=H;F!==null;){if(F===c){F=null;break}if(H=F.sibling,H!==null){H.return=F.return,F=H;break}F=F.return}H=F}}Cn(o,c,w.children,h),c=c.child}return c;case 9:return w=c.type,E=c.pendingProps,_=E.children,Cs(c,h),w=Vn(w,E.unstable_observedBits),_=_(w),c.flags|=1,Cn(o,c,_,h),c.child;case 14:return w=c.type,E=ni(w,c.pendingProps),E=ni(w.type,E),_p(o,c,w,E,_,h);case 15:return wp(o,c,c.type,c.pendingProps,_,h);case 17:return _=c.type,w=c.pendingProps,w=c.elementType===_?w:ni(_,w),o!==null&&(o.alternate=null,c.alternate=null,c.flags|=2),c.tag=1,jt(_)?(o=!0,ja(c)):o=!1,Cs(c,h),tp(c,_,w),Mu(c,_,w,h),Fu(null,c,_,!0,o,h);case 19:return Pp(o,c,h);case 23:return zu(o,c,h);case 24:return zu(o,c,h)}throw Error(l(156,c.tag))};var Dl={current:!1},oh=a.unstable_flushAllWithoutAsserting,tm=typeof oh=="function";function ah(){if(oh!==void 0)return oh();for(var o=!1;Oi();)o=!0;return o}function nm(o){try{ah(),Zx(function(){ah()?nm(o):o()})}catch(c){o(c)}}var Il=0,im=!1;function av(o,c,h,_){this.tag=o,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=_,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function Xn(o,c,h,_){return new av(o,c,h,_)}function lh(o){return o=o.prototype,!(!o||!o.isReactComponent)}function lv(o){if(typeof o=="function")return lh(o)?1:0;if(o!=null){if(o=o.$$typeof,o===v)return 11;if(o===T)return 14}return 2}function cr(o,c){var h=o.alternate;return h===null?(h=Xn(o.tag,c,o.key,o.mode),h.elementType=o.elementType,h.type=o.type,h.stateNode=o.stateNode,h.alternate=o,o.alternate=h):(h.pendingProps=c,h.type=o.type,h.flags=0,h.nextEffect=null,h.firstEffect=null,h.lastEffect=null),h.childLanes=o.childLanes,h.lanes=o.lanes,h.child=o.child,h.memoizedProps=o.memoizedProps,h.memoizedState=o.memoizedState,h.updateQueue=o.updateQueue,c=o.dependencies,h.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},h.sibling=o.sibling,h.index=o.index,h.ref=o.ref,h}function zl(o,c,h,_,w,E){var F=2;if(_=o,typeof o=="function")lh(o)&&(F=1);else if(typeof o=="string")F=5;else e:switch(o){case g:return Fs(h.children,w,E,c);case L:F=8,w|=16;break;case d:F=8,w|=1;break;case m:return o=Xn(12,h,c,w|8),o.elementType=m,o.type=m,o.lanes=E,o;case M:return o=Xn(13,h,c,w),o.type=M,o.elementType=M,o.lanes=E,o;case S:return o=Xn(19,h,c,w),o.elementType=S,o.lanes=E,o;case D:return ch(h,w,E,c);case N:return o=Xn(24,h,c,w),o.elementType=N,o.lanes=E,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case x:F=10;break e;case y:F=9;break e;case v:F=11;break e;case T:F=14;break e;case b:F=16,_=null;break e;case A:F=22;break e}throw Error(l(130,o==null?o:typeof o,""))}return c=Xn(F,h,c,w),c.elementType=o,c.type=_,c.lanes=E,c}function Fs(o,c,h,_){return o=Xn(7,o,_,c),o.lanes=h,o}function ch(o,c,h,_){return o=Xn(23,o,_,c),o.elementType=D,o.lanes=h,o}function uh(o,c,h){return o=Xn(6,o,null,c),o.lanes=h,o}function hh(o,c,h){return c=Xn(4,o.children!==null?o.children:[],o.key,c),c.lanes=h,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}function cv(o,c,h){this.tag=c,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ae,this.pendingContext=this.context=null,this.hydrate=h,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=du(0),this.expirationTimes=du(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=du(0),ve&&(this.mutableSourceEagerHydrationData=null)}function rm(o){var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(l(188)):Error(l(268,Object.keys(o)));return o=X(c),o===null?null:o.stateNode}function sm(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var h=o.retryLane;o.retryLane=h!==0&&h<c?h:c}}function Nl(o,c){sm(o,c),(o=o.alternate)&&sm(o,c)}function uv(o){return o=X(o),o===null?null:o.stateNode}function hv(){return null}return n.IsThisRendererActing=Dl,n.act=function(o){function c(){Il--,Yu.current=h,Dl.current=_}im===!1&&(im=!0,console.error("act(...) is not supported in production builds of React, and might not behave as expected.")),Il++;var h=Yu.current,_=Dl.current;Yu.current=!0,Dl.current=!0;try{var w=Xp(o)}catch(E){throw c(),E}if(w!==null&&typeof w=="object"&&typeof w.then=="function")return{then:function(E,F){w.then(function(){1<Il||tm===!0&&h===!0?(c(),E()):nm(function(H){c(),H?F(H):E()})},function(H){c(),F(H)})}};try{Il!==1||tm!==!1&&h!==!1||ah(),c()}catch(E){throw c(),E}return{then:function(E){E()}}},n.attemptContinuousHydration=function(o){if(o.tag===13){var c=Rn();Fi(o,67108864,c),Nl(o,67108864)}},n.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13){var c=Rn(),h=ar(o);Fi(o,h,c),Nl(o,h)}},n.attemptSynchronousHydration=function(o){switch(o.tag){case 3:var c=o.stateNode;if(c.hydrate){var h=zr(c.pendingLanes);c.expiredLanes|=h&c.pendingLanes,Dn(c,an()),!(Xe&48)&&(sr(),Hn())}break;case 13:var _=Rn();jp(function(){return Fi(o,1,_)}),Nl(o,4)}},n.attemptUserBlockingHydration=function(o){if(o.tag===13){var c=Rn();Fi(o,4,c),Nl(o,4)}},n.batchedEventUpdates=function(o,c){var h=Xe;Xe|=2;try{return o(c)}finally{Xe=h,Xe===0&&(sr(),Hn())}},n.batchedUpdates=Xp,n.createComponentSelector=function(o){return{$$typeof:vl,value:o}},n.createContainer=function(o,c,h){return o=new cv(o,c,h),c=Xn(3,null,null,c===2?7:c===1?3:0),o.current=c,c.stateNode=o,wu(c),o},n.createHasPsuedoClassSelector=function(o){return{$$typeof:_l,value:o}},n.createPortal=function(o,c,h){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:p,key:_==null?null:""+_,children:o,containerInfo:c,implementation:h}},n.createRoleSelector=function(o){return{$$typeof:wl,value:o}},n.createTestNameSelector=function(o){return{$$typeof:Ml,value:o}},n.createTextSelector=function(o){return{$$typeof:Sl,value:o}},n.deferredUpdates=function(o){return Li(97,o)},n.discreteUpdates=function(o,c,h,_,w){var E=Xe;Xe|=4;try{return Li(98,o.bind(null,c,h,_,w))}finally{Xe=E,Xe===0&&(sr(),Hn())}},n.findAllNodes=Xu,n.findBoundingRects=function(o,c){if(!P)throw Error(l(363));c=Xu(o,c),o=[];for(var h=0;h<c.length;h++)o.push(ge(c[h]));for(c=o.length-1;0<c;c--){h=o[c];for(var _=h.x,w=_+h.width,E=h.y,F=E+h.height,H=c-1;0<=H;H--)if(c!==H){var ie=o[H],Me=ie.x,He=Me+ie.width,Ke=ie.y,Pe=Ke+ie.height;if(_>=Me&&E>=Ke&&w<=He&&F<=Pe){o.splice(c,1);break}else if(_!==Me||h.width!==ie.width||Pe<E||Ke>F){if(!(E!==Ke||h.height!==ie.height||He<_||Me>w)){Me>_&&(ie.width+=Me-_,ie.x=_),He<w&&(ie.width=w-Me),o.splice(c,1);break}}else{Ke>E&&(ie.height+=Ke-E,ie.y=E),Pe<F&&(ie.height=F-Ke),o.splice(c,1);break}}}return o},n.findHostInstance=rm,n.findHostInstanceWithNoPortals=function(o){return o=ee(o),o===null?null:o.tag===20?o.stateNode.instance:o.stateNode},n.findHostInstanceWithWarning=function(o){return rm(o)},n.flushControlled=function(o){var c=Xe;Xe|=1;try{Li(99,o)}finally{Xe=c,Xe===0&&(sr(),Hn())}},n.flushDiscreteUpdates=function(){!(Xe&49)&&(Qx(),Oi())},n.flushPassiveEffects=Oi,n.flushSync=jp,n.focusWithin=function(o,c){if(!P)throw Error(l(363));for(o=Vu(o),c=Wp(o,c),c=Array.from(c),o=0;o<c.length;){var h=c[o++];if(!Ee(h)){if(h.tag===5&&le(h.stateNode))return!0;for(h=h.child;h!==null;)c.push(h),h=h.sibling}}return!1},n.getCurrentUpdateLanePriority=function(){return Ya},n.getFindAllNodesFailureDescription=function(o,c){if(!P)throw Error(l(363));var h=0,_=[];o=[Vu(o),0];for(var w=0;w<o.length;){var E=o[w++],F=o[w++],H=c[F];if((E.tag!==5||!Ee(E))&&(Wu(E,H)&&(_.push(qu(H)),F++,F>h&&(h=F)),F<c.length))for(E=E.child;E!==null;)o.push(E,F),E=E.sibling}if(h<c.length){for(o=[];h<c.length;h++)o.push(qu(c[h]));return`findAllNodes was able to match part of the selector:
|
|
3014
|
+
`+(_.join(" > ")+`
|
|
3015
|
+
|
|
3016
|
+
No matching component was found for:
|
|
3017
|
+
`)+o.join(" > ")}return null},n.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return re(o.child.stateNode);default:return o.child.stateNode}},n.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:uv,findFiberByHostInstance:o.findFiberByHostInstance||hv,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!c.isDisabled&&c.supportsFiber)try{fu=c.inject(o),Ir=c}catch{}o=!0}return o},n.observeVisibleRects=function(o,c,h,_){if(!P)throw Error(l(363));o=Xu(o,c);var w=et(o,h,_).disconnect;return{disconnect:function(){w()}}},n.registerMutableSourceForHydration=function(o,c){var h=c._getVersion;h=h(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,h]:o.mutableSourceEagerHydrationData.push(c,h)},n.runWithPriority=function(o,c){var h=Ya;try{return Ya=o,c()}finally{Ya=h}},n.shouldSuspend=function(){return!1},n.unbatchedUpdates=function(o,c){var h=Xe;Xe&=-2,Xe|=8;try{return o(c)}finally{Xe=h,Xe===0&&(sr(),Hn())}},n.updateContainer=function(o,c,h,_){var w=c.current,E=Rn(),F=ar(w);e:if(h){h=h._reactInternals;t:{if(J(h)!==h||h.tag!==1)throw Error(l(170));var H=h;do{switch(H.tag){case 3:H=H.stateNode.context;break t;case 1:if(jt(H.type)){H=H.stateNode.__reactInternalMemoizedMergedChildContext;break t}}H=H.return}while(H!==null);throw Error(l(171))}if(h.tag===1){var ie=h.type;if(jt(ie)){h=Od(h,ie,H);break e}}h=H}else h=Qt;return c.context===null?c.context=h:c.pendingContext=h,c=ir(E,F),c.payload={element:o},_=_===void 0?null:_,_!==null&&(c.callback=_),rr(w,c),Fi(w,F,E),F},n}})(Nd);var VT=Nd.exports;px.exports=VT;var WT=px.exports;const qT=pv(WT);function XT(r){return function(e){r.forEach(function(t){typeof t=="function"?t(e):t!=null&&(t.current=e)})}}function Wg(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function jT({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=Te.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=Te.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),u=r?typeof r=="number"?r:r.scroll:null,f=r?typeof r=="number"?r:r.resize:null,p=Te.useRef(!1);Te.useEffect(()=>(p.current=!0,()=>void(p.current=!1)));const[g,d,m]=Te.useMemo(()=>{const M=()=>{if(!l.current.element)return;const{left:S,top:T,width:b,height:A,bottom:L,right:D,x:N,y:q}=l.current.element.getBoundingClientRect(),B={left:S,top:T,width:b,height:A,bottom:L,right:D,x:N,y:q};l.current.element instanceof HTMLElement&&n&&(B.height=l.current.element.offsetHeight,B.width=l.current.element.offsetWidth),Object.freeze(B),p.current&&!KT(l.current.lastBounds,B)&&a(l.current.lastBounds=B)};return[M,f?Wg(M,f):M,u?Wg(M,u):M]},[a,n,u,f]);function x(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(M=>M.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null),l.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",l.current.orientationHandler))}function y(){l.current.element&&(l.current.resizeObserver=new i(m),l.current.resizeObserver.observe(l.current.element),e&&l.current.scrollContainers&&l.current.scrollContainers.forEach(M=>M.addEventListener("scroll",m,{capture:!0,passive:!0})),l.current.orientationHandler=()=>{m()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",l.current.orientationHandler))}const v=M=>{!M||M===l.current.element||(x(),l.current.element=M,l.current.scrollContainers=mx(M),y())};return JT(m,!!e),YT(d),Te.useEffect(()=>{x(),y()},[e,m,d]),Te.useEffect(()=>x,[]),[v,s,g]}function YT(r){Te.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[r])}function JT(r,e){Te.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[r,e])}function mx(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(s=>s==="auto"||s==="scroll")&&e.push(r),[...e,...mx(r.parentElement)]}const ZT=["x","y","top","bottom","left","right","width","height"],KT=(r,e)=>ZT.every(t=>r[t]===e[t]),At={obj:r=>r===Object(r)&&!At.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e){if(typeof r!=typeof e||!!r!=!!e)return!1;if(At.str(r)||At.num(r)||At.obj(r))return r===e;if(At.arr(r)&&r==e)return!0;let t;for(t in r)if(!(t in e))return!1;for(t in e)if(r[t]!==e[t])return!1;return At.und(t)?r===e:!0}};function Zh(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function gx(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function QT(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{gx(t.capturedMap,e,n,i)})}function $T(r){const e=new R;function t(g){var d,m,x,y;const v=r.getState(),{raycaster:M,mouse:S,camera:T,size:b}=v,A=M.computeOffsets==null?void 0:M.computeOffsets(g,v),L=(d=A==null?void 0:A.offsetX)!=null?d:g.offsetX,D=(m=A==null?void 0:A.offsetY)!=null?m:g.offsetY,N=(x=A==null?void 0:A.width)!=null?x:b.width,q=(y=A==null?void 0:A.height)!=null?y:b.height;S.set(L/N*2-1,-(D/q)*2+1),M.setFromCamera(S,T)}function n(g){const{internal:d}=r.getState(),m=g.offsetX-d.initialClick[0],x=g.offsetY-d.initialClick[1];return Math.round(Math.sqrt(m*m+x*x))}function i(g){return g.filter(d=>["Move","Over","Enter","Out","Leave"].some(m=>{var x;return(x=d.__r3f)==null?void 0:x.handlers["onPointer"+m]}))}function s(g){const d=r.getState(),{raycaster:m,internal:x}=d;if(!m.enabled)return[];const y=new Set,v=[],M=g?g(x.interaction):x.interaction;let S=m.intersectObjects(M,!0).filter(b=>{const A=Zh(b);return y.has(A)?!1:(y.add(A),!0)});m.filter&&(S=m.filter(S,d));for(const b of S){let A=b.object;for(;A;){var T;(T=A.__r3f)!=null&&T.eventCount&&v.push({...b,eventObject:A}),A=A.parent}}return v}function a(g,d){const{internal:m}=r.getState();if("pointerId"in d&&m.capturedMap.has(d.pointerId))for(let x of m.capturedMap.get(d.pointerId).values())g.push(x.intersection);return g}function l(g,d,m,x){const{raycaster:y,mouse:v,camera:M,internal:S}=r.getState();if(g.length){const T=e.set(v.x,v.y,0).unproject(M),b={stopped:!1};for(const A of g){const L=C=>{var z,J;return(z=(J=S.capturedMap.get(C))==null?void 0:J.has(A.eventObject))!=null?z:!1},D=C=>{const z={intersection:A,target:d.target};S.capturedMap.has(C)?S.capturedMap.get(C).set(A.eventObject,z):S.capturedMap.set(C,new Map([[A.eventObject,z]])),d.target.setPointerCapture(C)},N=C=>{const z=S.capturedMap.get(C);z&&gx(S.capturedMap,A.eventObject,z,C)};let q={};for(let C in d){let z=d[C];typeof z!="function"&&(q[C]=z)}let B={...A,...q,spaceX:v.x,spaceY:v.y,intersections:g,stopped:b.stopped,delta:m,unprojectedPoint:T,ray:y.ray,camera:M,stopPropagation:()=>{const C="pointerId"in d&&S.capturedMap.get(d.pointerId);if((!C||C.has(A.eventObject))&&(B.stopped=b.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(z=>z.eventObject===A.eventObject))){const z=g.slice(0,g.indexOf(A));u([...z,A])}},target:{hasPointerCapture:L,setPointerCapture:D,releasePointerCapture:N},currentTarget:{hasPointerCapture:L,setPointerCapture:D,releasePointerCapture:N},sourceEvent:d,nativeEvent:d};if(x(B),b.stopped===!0)break}}return g}function u(g){const{internal:d}=r.getState();Array.from(d.hovered.values()).forEach(m=>{if(!g.length||!g.find(x=>x.object===m.object&&x.index===m.index&&x.instanceId===m.instanceId)){const y=m.eventObject.__r3f,v=y==null?void 0:y.handlers;if(d.hovered.delete(Zh(m)),y!=null&&y.eventCount){const M={...m,intersections:g||[]};v.onPointerOut==null||v.onPointerOut(M),v.onPointerLeave==null||v.onPointerLeave(M)}}})}const f=g=>{switch(g){case"onPointerLeave":case"onPointerCancel":return()=>u([]);case"onLostPointerCapture":return d=>{const{internal:m}=r.getState();"pointerId"in d&&!m.capturedMap.has(d.pointerId)&&(m.capturedMap.delete(d.pointerId),u([]))}}return d=>{const{onPointerMissed:m,internal:x}=r.getState();t(d),x.lastEvent.current=d;const y=g==="onPointerMove",v=g==="onClick"||g==="onContextMenu"||g==="onDoubleClick",S=a(s(y?i:void 0),d),T=v?n(d):0;g==="onPointerDown"&&(x.initialClick=[d.offsetX,d.offsetY],x.initialHits=S.map(b=>b.eventObject)),v&&!S.length&&T<=2&&(p(d,x.interaction),m&&m(d)),y&&u(S),l(S,d,T,b=>{const A=b.eventObject,L=A.__r3f,D=L==null?void 0:L.handlers;if(L!=null&&L.eventCount)if(y){if(D.onPointerOver||D.onPointerEnter||D.onPointerOut||D.onPointerLeave){const N=Zh(b),q=x.hovered.get(N);q?q.stopped&&b.stopPropagation():(x.hovered.set(N,b),D.onPointerOver==null||D.onPointerOver(b),D.onPointerEnter==null||D.onPointerEnter(b))}D.onPointerMove==null||D.onPointerMove(b)}else{const N=D[g];N?(!v||x.initialHits.includes(A))&&(p(d,x.interaction.filter(q=>!x.initialHits.includes(q))),N(b)):v&&x.initialHits.includes(A)&&p(d,x.interaction.filter(q=>!x.initialHits.includes(q)))}})}};function p(g,d){d.forEach(m=>{var x;return(x=m.__r3f)==null||x.handlers.onPointerMissed==null?void 0:x.handlers.onPointerMissed(g)})}return{handlePointer:f}}const eA=r=>r&&!!r.memoized&&!!r.changes,kc=r=>r&&!!r.getState,Kh=(r,e)=>{var t,n;return{root:kc(r)?r:(t=(n=r.__r3f)==null?void 0:n.root)!=null?t:e.__r3f.root,container:kc(r)?r.getState().scene:r}},qg="__default",tA={};let nA={};function iA(r,e){return!!(At.arr(r)&&At.equ(r,e)||r===e)}function io(r,e){const t=r;return(e!=null&&e.primitive||!t.__r3f)&&(t.__r3f={root:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e}),r}function rA(r){function e(d,{children:m,key:x,ref:y,...v},{children:M,key:S,ref:T,...b}={},A=!1){var L;const D=(L=d==null?void 0:d.__r3f)!=null?L:{},N=Object.entries(v),q=[];if(A){const C=Object.keys(b);for(let z=0;z<C.length;z++)v.hasOwnProperty(C[z])||N.unshift([C[z],qg+"remove"])}N.forEach(([C,z])=>{var J;if((J=d.__r3f)!=null&&J.primitive&&C==="object"||iA(z,b[C]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(C))return q.push([C,z,!0,[]]);let W=[];C.includes("-")&&(W=C.split("-")),q.push([C,z,!1,W])});const B={...v};return D.memoizedProps&&D.memoizedProps.args&&(B.args=D.memoizedProps.args),D.memoizedProps&&D.memoizedProps.attach&&(B.attach=D.memoizedProps.attach),{accumulative:A,memoized:B,changes:q}}function t(d,m){var x,y,v;const M=(x=d==null?void 0:d.__r3f)!=null?x:{},S=M.root,T=(y=S==null||S.getState==null?void 0:S.getState())!=null?y:{},{memoized:b,changes:A}=eA(m)?m:e(d,m),L=M.eventCount;if(d.__r3f&&(d.__r3f.memoizedProps=b),A.forEach(([D,N,q,B])=>{var C;let z=d,J=z[D];if(B.length&&(J=B.reduce((Y,X)=>Y[X],d),!(J&&J.set))){const[Y,...X]=B.reverse();z=X.reverse().reduce((ee,V)=>ee[V],d),D=Y}if(N===qg+"remove")if(J&&J.constructor)N=new J.constructor(b.args);else if(z.constructor){const Y=new z.constructor(z.__r3f.memoizedProps.args);N=Y[J],Y.dispose&&Y.dispose()}else N=0;const W=(T==null||(C=T.gl)==null?void 0:C.outputEncoding)===Kn;if(q)N?M.handlers[D]=N:delete M.handlers[D],M.eventCount=Object.keys(M.handlers).length;else if(J&&J.set&&(J.copy||J instanceof os)){if(Array.isArray(N))J.fromArray?J.fromArray(N):J.set(...N);else if(J.copy&&N&&N.constructor&&J.constructor.name===N.constructor.name)J.copy(N);else if(N!==void 0){const Y=J instanceof Ae;!Y&&J.setScalar?J.setScalar(N):J instanceof os&&N instanceof os?J.mask=N.mask:J.set(N),!W&&Y&&J.convertSRGBToLinear()}}else z[D]=N,!W&&z[D]instanceof Ut&&(z[D].encoding=Tt);n(d)}),M.parent&&T.internal&&d.raycast&&L!==M.eventCount){const D=T.internal.interaction.indexOf(d);D>-1&&T.internal.interaction.splice(D,1),M.eventCount&&T.internal.interaction.push(d)}return A.length&&(v=d.__r3f)!=null&&v.parent&&i(d),d}function n(d){var m,x;const y=(m=d.__r3f)==null||(x=m.root)==null||x.getState==null?void 0:x.getState();y&&y.internal.frames===0&&y.invalidate()}function i(d){d.onUpdate==null||d.onUpdate(d)}function s(d,{args:m=[],...x},y,v,M){let S=`${d[0].toUpperCase()}${d.slice(1)}`,T;if(!kc(y)&&M){const b=A=>A.return?b(A.return):A.stateNode&&A.stateNode.containerInfo;y=b(M)}if(!y||!kc(y))throw`No valid root for ${S}!`;if(d==="primitive"){if(x.object===void 0)throw"Primitives without 'object' are invalid!";const b=x.object;T=io(b,{root:y,primitive:!0})}else{const b=nA[S]||GT[S];if(!b)throw`${S} is not part of the THREE namespace! Did you forget to extend? See: https://github.com/pmndrs/react-three-fiber/blob/master/markdown/api.md#using-3rd-party-objects-declaratively`;if(!Array.isArray(m))throw"The args prop must be an array!";T=io(new b(...m),{root:y,memoizedProps:{args:m.length===0?null:m}})}return"attachFns"in x||(S.endsWith("Geometry")?x={attach:"geometry",...x}:S.endsWith("Material")&&(x={attach:"material",...x})),t(T,x),T}function a(d,m){let x=!1;if(m){if(m.attachArray)At.arr(d[m.attachArray])||(d[m.attachArray]=[]),d[m.attachArray].push(m);else if(m.attachObject)At.obj(d[m.attachObject[0]])||(d[m.attachObject[0]]={}),d[m.attachObject[0]][m.attachObject[1]]=m;else if(m.attach&&!At.fun(m.attach))d[m.attach]=m;else if(At.arr(m.attachFns)){const[y]=m.attachFns;At.str(y)&&At.fun(d[y])?d[y](m):At.fun(y)&&y(m,d)}else m.isObject3D&&d.isObject3D&&(d.add(m),x=!0);x||d.__r3f.objects.push(m),m.__r3f||io(m,{}),m.__r3f.parent=d,i(m),n(m)}}function l(d,m,x){let y=!1;if(m){if(m.attachArray){let v=d[m.attachArray];At.arr(v)||(d[m.attachArray]=[],v=d[m.attachArray]),v.splice(v.indexOf(x),0,m)}else{if(m.attachObject||m.attach&&!At.fun(m.attach))return a(d,m);if(m.isObject3D&&d.isObject3D){m.parent=d,m.dispatchEvent({type:"added"});const v=d.children.filter(S=>S!==m),M=v.indexOf(x);d.children=[...v.slice(0,M),m,...v.slice(M)],y=!0}}y||d.__r3f.objects.push(m),m.__r3f||io(m,{}),m.__r3f.parent=d,i(m),n(m)}}function u(d,m,x=!1){d&&[...d].forEach(y=>f(m,y,x))}function f(d,m,x){if(m){var y,v;if(m.__r3f&&(m.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(A=>A!==m)),m.attachArray)d[m.attachArray]=d[m.attachArray].filter(A=>A!==m);else if(m.attachObject)delete d[m.attachObject[0]][m.attachObject[1]];else if(m.attach&&!At.fun(m.attach)&&d[m.attach]===m)d[m.attach]=null;else if(At.arr(m.attachFns)){const[,A]=m.attachFns;At.str(A)&&At.fun(d[A])?d[A](m):At.fun(A)&&A(m,d)}else if(m.isObject3D&&d.isObject3D){var M;d.remove(m),(M=m.__r3f)!=null&&M.root&&QT(m.__r3f.root,m)}const T=(v=m.__r3f)==null?void 0:v.primitive,b=x===void 0?m.dispose!==null&&!T:x;if(!T){var S;u((S=m.__r3f)==null?void 0:S.objects,m,b),u(m.children,m,b)}m.__r3f&&(delete m.__r3f.root,delete m.__r3f.objects,delete m.__r3f.handlers,delete m.__r3f.memoizedProps,T||delete m.__r3f),b&&m.dispose&&m.type!=="Scene"&&bc.unstable_runWithPriority(bc.unstable_IdlePriority,()=>{try{m.dispose()}catch{}}),n(d)}}function p(d,m,x,y){var v;const M=(v=d.__r3f)==null?void 0:v.parent;if(!M)return;const S=s(m,x,d.__r3f.root);m!=="primitive"&&d.children&&(d.children.forEach(T=>a(S,T)),d.children=[]),d.__r3f.objects.forEach(T=>a(S,T)),d.__r3f.objects=[],f(M,d),a(M,S),S.raycast&&S.__r3f.eventCount&&S.__r3f.root.getState().internal.interaction.push(S),[y,y.alternate].forEach(T=>{T!==null&&(T.stateNode=S,T.ref&&(typeof T.ref=="function"?T.ref(S):T.ref.current=S))})}return{reconciler:qT({now:bc.unstable_now,createInstance:s,removeChild:f,appendChild:a,appendInitialChild:a,insertBefore:l,warnsIfNotActing:!0,supportsMutation:!0,isPrimaryRenderer:!1,scheduleTimeout:At.fun(setTimeout)?setTimeout:void 0,cancelTimeout:At.fun(clearTimeout)?clearTimeout:void 0,setTimeout:At.fun(setTimeout)?setTimeout:void 0,clearTimeout:At.fun(clearTimeout)?clearTimeout:void 0,noTimeout:-1,appendChildToContainer:(d,m)=>{const{container:x,root:y}=Kh(d,m);x.__r3f.root=y,a(x,m)},removeChildFromContainer:(d,m)=>f(Kh(d,m).container,m),insertInContainerBefore:(d,m,x)=>l(Kh(d,m).container,m,x),prepareUpdate(d,m,x,y){if(d.__r3f.primitive&&y.object&&y.object!==d)return[!0];{const{args:v=[],children:M,...S}=y,{args:T=[],children:b,...A}=x;if(!Array.isArray(v))throw"The args prop must be an array!";if(v.some((D,N)=>D!==T[N]))return[!0];const L=e(d,S,A,!0);if(L.changes.length)return[!1,L];if(d.attach&&typeof d.attach!="function"){const N=d.__r3f.parent;N&&N[d.attach]!==d&&a(N,d)}return null}},commitUpdate(d,[m,x],y,v,M,S){m?p(d,y,M,S):t(d,x)},hideInstance(d){d.isObject3D&&(d.visible=!1,n(d))},unhideInstance(d,m){(d.isObject3D&&m.visible==null||m.visible)&&(d.visible=!0,n(d))},hideTextInstance(){throw new Error("Text is not allowed in the R3F tree.")},getPublicInstance(d){return d},getRootHostContext(d){return tA},getChildHostContext(d){return d},createTextInstance(){},finalizeInitialChildren(d){var m;return!!((m=d==null?void 0:d.__r3f)!=null?m:{}).handlers},commitMount(d){var m;const x=(m=d==null?void 0:d.__r3f)!=null?m:{};d.raycast&&x.handlers&&x.eventCount&&d.__r3f.root.getState().internal.interaction.push(d)},shouldDeprioritizeSubtree(){return!1},prepareForCommit(){return null},preparePortalMount(d){io(d)},resetAfterCommit(){},shouldSetTextContent(){return!1},clearContainer(){return!1}}),applyProps:t}}const sA=r=>!!(r!=null&&r.render),Xg=r=>r&&r.isOrthographicCamera;function Of(r){return Array.isArray(r)?Math.min(Math.max(r[0],window.devicePixelRatio),r[1]):r}const yx=Te.createContext(null),oA=(r,e,t,n)=>{const{gl:i,size:s,shadows:a=!1,linear:l=!1,flat:u=!1,vr:f=!1,orthographic:p=!1,frameloop:g="always",dpr:d=1,performance:m,clock:x=new Pd,raycaster:y,camera:v,onPointerMissed:M}=n;a&&(i.shadowMap.enabled=!0,typeof a=="object"?Object.assign(i.shadowMap,a):i.shadowMap.type=Gf),l&&(i.outputEncoding=Kn),u&&(i.toneMapping=hi),g==="never"&&(x.stop(),x.elapsedTime=0);const S=yv((L,D)=>{const N=new sx,{params:q,...B}=y||{};r(N,{enabled:!0,...B,params:{...N.params,...q}});const C=v instanceof hs,z=C?v:p?new fi(0,0,0,0,.1,1e3):new It(75,0,.1,1e3);C||(z.position.z=5,v&&r(z,v),v!=null&&v.rotation||z.lookAt(0,0,0));const J=Of(d),W=new R,Y=new R,X=new R;function ee(K=D().camera,pe=Y,he=D().size){const{width:Ce,height:Ue}=he,Be=Ce/Ue;pe instanceof R?X.copy(pe):X.set(...pe);const oe=K.getWorldPosition(W).distanceTo(X);if(Xg(K))return{width:Ce/K.zoom,height:Ue/K.zoom,factor:1,distance:oe,aspect:Be};{const ot=K.fov*Math.PI/180,qe=2*Math.tan(ot/2)*oe,je=qe*(Ce/Ue);return{width:je,height:qe,factor:Ce/je,distance:oe,aspect:Be}}}let V;const re=K=>L(pe=>({performance:{...pe.performance,current:K}}));return{gl:i,set:L,get:D,invalidate:()=>e(D()),advance:(K,pe)=>t(K,pe,D()),linear:l,flat:u,scene:io(new Ua),camera:z,controls:null,raycaster:N,clock:x,mouse:new ue,vr:f,frameloop:g,onPointerMissed:M,performance:{current:1,min:.5,max:1,debounce:200,...m,regress:()=>{const K=D();V&&clearTimeout(V),K.performance.current!==K.performance.min&&re(K.performance.min),V=setTimeout(()=>re(D().performance.max),K.performance.debounce)}},size:{width:0,height:0},viewport:{initialDpr:J,dpr:J,width:0,height:0,aspect:0,distance:0,factor:0,getCurrentViewport:ee},setSize:(K,pe)=>{const he={width:K,height:pe};L(Ce=>({size:he,viewport:{...Ce.viewport,...ee(z,Y,he)}}))},setDpr:K=>L(pe=>({viewport:{...pe.viewport,dpr:Of(K)}})),setFrameloop:(K="always")=>L(()=>({frameloop:K})),events:{connected:!1},internal:{active:!1,priority:0,frames:0,lastProps:n,lastEvent:Te.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(K,pe=0)=>(L(({internal:he})=>({internal:{...he,priority:he.priority+(pe>0?1:0),subscribers:[...he.subscribers,{ref:K,priority:pe}].sort((Ce,Ue)=>Ce.priority-Ue.priority)}})),()=>{L(({internal:he})=>({internal:{...he,priority:he.priority-(pe>0?1:0),subscribers:he.subscribers.filter(Ce=>Ce.ref!==K)}}))})}}}),T=S.getState();let b=T.size,A=T.viewport.dpr;return S.subscribe(()=>{const{camera:L,size:D,viewport:N,internal:q}=S.getState();(D!==b||N.dpr!==A)&&(!L.manual&&!(q.lastProps.camera instanceof hs)&&(Xg(L)?(L.left=D.width/-2,L.right=D.width/2,L.top=D.height/2,L.bottom=D.height/-2):L.aspect=D.width/D.height,L.updateProjectionMatrix(),L.updateMatrixWorld()),i.setPixelRatio(N.dpr),i.setSize(D.width,D.height),b=D,A=N.dpr)}),s&&T.setSize(s.width,s.height),S.subscribe(L=>e(L)),S};let _r,jg=[],Yg=[],aA=[];function ca(r,e){for(_r=0;_r<r.length;_r++)r[_r](e)}function Qh(r,e){let t=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(t=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),_r=0;_r<e.internal.subscribers.length;_r++)e.internal.subscribers[_r].ref.current(e,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function lA(r){let e=!1,t;function n(a){if(e=!0,t=0,ca(jg,a),r.forEach(l=>{const u=l.store.getState();u.internal.active&&(u.frameloop==="always"||u.internal.frames>0)&&(t+=Qh(a,u))}),ca(Yg,a),t>0)return requestAnimationFrame(n);ca(aA,a),e=!1}function i(a){if(!a)return r.forEach(l=>i(l.store.getState()));a.vr||!a.internal.active||a.frameloop==="never"||(a.internal.frames=Math.min(60,a.internal.frames+1),e||(e=!0,requestAnimationFrame(n)))}function s(a,l=!0,u){l&&ca(jg,a),u?Qh(a,u):r.forEach(f=>Qh(a,f.store.getState())),l&&ca(Yg,a)}return{loop:n,invalidate:i,advance:s}}function cA(r){const{handlePointer:e}=$T(r),t={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};return{connected:!1,handlers:Object.keys(t).reduce((n,i)=>({...n,[i]:e(i)}),{}),connect:n=>{var i;const{set:s,events:a}=r.getState();a.disconnect==null||a.disconnect(),s(l=>({events:{...l.events,connected:n}})),Object.entries((i=a==null?void 0:a.handlers)!=null?i:[]).forEach(([l,u])=>{const[f,p]=t[l];n.addEventListener(f,u,{passive:p})})},disconnect:()=>{const{set:n,events:i}=r.getState();if(i.connected){var s;Object.entries((s=i.handlers)!=null?s:[]).forEach(([a,l])=>{if(i&&i.connected instanceof HTMLElement){const[u]=t[a];i.connected.removeEventListener(u,l)}}),n(a=>({events:{...a.events,connected:!1}}))}}}}const Bf=typeof window<"u"?Te.useLayoutEffect:Te.useEffect;function uA({set:r}){return Bf(()=>(r(new Promise(()=>null)),()=>r(!1)),[]),null}class xx extends Te.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}xx.getDerivedStateFromError=()=>({error:!0});const kA=Te.forwardRef(function({children:e,fallback:t,tabIndex:n,resize:i,id:s,style:a,className:l,events:u,...f},p){const g=hA(f.onPointerMissed),[d,{width:m,height:x}]=jT({scroll:!0,debounce:{scroll:50,resize:0},...i}),y=Te.useRef(null),[v,M]=Te.useState(!1),[S,T]=Te.useState(!1);if(v)throw v;if(S)throw S;return Bf(()=>{m>0&&x>0&&pA(Te.createElement(xx,{set:T},Te.createElement(Te.Suspense,{fallback:Te.createElement(uA,{set:M})},e)),y.current,{...f,size:{width:m,height:x},onPointerMissed:g,events:u||cA})},[m,x,e,g]),Bf(()=>{const b=y.current;return()=>Mx(b)},[]),Te.createElement("div",{ref:d,id:s,className:l,tabIndex:n,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",...a}},Te.createElement("canvas",{ref:XT([y,p]),style:{display:"block"}},t))});function vx(){const r=Te.useContext(yx);if(!r)throw"R3F hooks can only be used within the Canvas component!";return r}function Xi(r=t=>t,e){return vx()(r,e)}function _x(r,e=0){const t=vx().getState().internal.subscribe,n=Te.useRef(r);return Te.useLayoutEffect(()=>void(n.current=r),[r]),Te.useLayoutEffect(()=>t(n,e),[e,t]),null}function hA(r){const e=Te.useRef(r);return Te.useLayoutEffect(()=>void(e.current=r),[r]),(...t)=>e.current==null?void 0:e.current(...t)}const La=new Map,Jg=["legacy","blocking","concurrent"],{invalidate:fA,advance:Zg}=lA(La),{reconciler:Da,applyProps:wx}=rA(),dA=(r,e)=>{const t=typeof r=="function"?r(e):r;if(sA(t))return t;const n=new Mt({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r});return n.outputEncoding=Tt,n.toneMapping=Xf,r&&wx(n,r),n};function pA(r,e,{gl:t,size:n,mode:i=Jg[1],events:s,onCreated:a,...l}={}){var u;if(!n){var f,p,g,d;n={width:(f=(p=e.parentElement)==null?void 0:p.clientWidth)!=null?f:0,height:(g=(d=e.parentElement)==null?void 0:d.clientHeight)!=null?g:0}}let m=La.get(e),x=m==null?void 0:m.fiber,y=m==null?void 0:m.store,v=(u=y)==null?void 0:u.getState();if(x&&v&&(l.dpr!==void 0&&!At.equ(v.viewport.dpr,Of(l.dpr))&&v.setDpr(l.dpr),(v.size.width!==n.width||v.size.height!==n.height)&&v.setSize(n.width,n.height),v.frameloop!==l.frameloop&&v.setFrameloop(l.frameloop),l.linear!==v.internal.lastProps.linear&&(Mx(e),x=void 0)),!x){const M=dA(t,e);l.vr&&(M.xr.enabled=!0,M.setAnimationLoop(T=>Zg(T,!0))),y=oA(wx,fA,Zg,{gl:M,size:n,...l});const S=y.getState();x=Da.createContainer(y,Jg.indexOf(i),!1,null),La.set(e,{fiber:x,store:y}),s&&S.set({events:s(y)})}if(y&&x)return Da.updateContainer(Te.createElement(mA,{store:y,element:r,onCreated:a,target:e}),x,null,()=>{}),y;throw"Error creating root!"}function mA({store:r,element:e,onCreated:t,target:n}){return Te.useEffect(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),i.events.connect==null||i.events.connect(n),t&&t(i)},[]),Te.createElement(yx.Provider,{value:r},e)}function Mx(r,e){const t=La.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Da.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{var s,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(l=i.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),gA(i),La.delete(r),e&&e(r)},500)})}}function gA(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}Da.act;Da.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:"17.0.2"});const Wa=new R,Fd=new R,yA=new R;function xA(r,e,t){const n=Wa.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,s=t.height/2;return[n.x*i+i,-(n.y*s)+s]}function vA(r,e){const t=Wa.setFromMatrixPosition(r.matrixWorld),n=Fd.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),s=e.getWorldDirection(yA);return i.angleTo(s)>Math.PI/2}function _A(r,e,t,n){const i=Wa.setFromMatrixPosition(r.matrixWorld),s=i.clone();s.project(e),t.setFromCamera(s,e);const a=t.intersectObjects(n,!0);if(a.length){const l=a[0].distance;return i.distanceTo(t.ray.origin)<l}return!0}function wA(r,e){if(e instanceof fi)return e.zoom;if(e instanceof It){const t=Wa.setFromMatrixPosition(r.matrixWorld),n=Fd.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,s=t.distanceTo(n);return 1/(2*Math.tan(i/2)*s)}else return 1}function MA(r,e,t){if(e instanceof It||e instanceof fi){const n=Wa.setFromMatrixPosition(r.matrixWorld),i=Fd.setFromMatrixPosition(e.matrixWorld),s=n.distanceTo(i),a=(t[1]-t[0])/(e.far-e.near),l=t[1]-a*e.far;return Math.round(a*s+l)}}const Uf=r=>Math.abs(r)<1e-10?0:r;function Sx(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=Uf(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const SA=(r=>e=>Sx(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),bA=(r=>(e,t)=>Sx(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]),HA=Te.forwardRef(({children:r,eps:e=.001,style:t,className:n,prepend:i,center:s,fullscreen:a,portal:l,distanceFactor:u,sprite:f=!1,transform:p=!1,occlude:g,onOcclude:d,zIndexRange:m=[16777271,0],calculatePosition:x=xA,as:y="div",wrapperClass:v,pointerEvents:M="auto",...S},T)=>{var b;const A=Xi(({gl:K})=>K),L=Xi(({camera:K})=>K),D=Xi(({scene:K})=>K),N=Xi(({size:K})=>K),q=Xi(({raycaster:K})=>K),[B]=Te.useState(()=>document.createElement(y)),C=Te.useRef(null),z=Te.useRef(0),J=Te.useRef([0,0]),W=Te.useRef(null),Y=Te.useRef(null),X=(b=l==null?void 0:l.current)!==null&&b!==void 0?b:A.domElement.parentNode;Te.useEffect(()=>{if(C.current){if(D.updateMatrixWorld(),p)B.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const K=x(C.current,L,N);B.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${K[0]}px,${K[1]}px,0);transform-origin:0 0;`}return X&&(i?X.prepend(B):X.appendChild(B)),()=>{X&&X.removeChild(B),dh.unmountComponentAtNode(B)}}},[X,p]),Te.useLayoutEffect(()=>{v&&(B.className=v)},[v]);const ee=Te.useMemo(()=>p?{position:"absolute",top:0,left:0,width:N.width,height:N.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...a&&{top:-N.height/2,left:-N.width/2,width:N.width,height:N.height},...t},[t,s,a,N,p]),V=Te.useMemo(()=>({position:"absolute",pointerEvents:M}),[M]);Te.useLayoutEffect(()=>{p?dh.render(Te.createElement("div",{ref:W,style:ee},Te.createElement("div",{ref:Y,style:V},Te.createElement("div",{ref:T,className:n,style:t,children:r}))),B):dh.render(Te.createElement("div",{ref:T,style:ee,className:n,children:r}),B)});const re=Te.useRef(!0);return _x(()=>{if(C.current){L.updateMatrixWorld(),C.current.updateWorldMatrix(!0,!1);const K=p?J.current:x(C.current,L,N);if(p||Math.abs(z.current-L.zoom)>e||Math.abs(J.current[0]-K[0])>e||Math.abs(J.current[1]-K[1])>e){const pe=vA(C.current,L);let he=!1;typeof g=="boolean"?g===!0&&(he=[D]):Array.isArray(g)&&(he=g.map(Ue=>Ue.current));const Ce=re.current;if(he){const Ue=_A(C.current,L,q,he);re.current=Ue&&!pe}else re.current=!pe;if(Ce!==re.current&&(d?d(!re.current):B.style.display=re.current?"block":"none"),B.style.zIndex=`${MA(C.current,L,m)}`,p){const[Ue,Be]=[N.width/2,N.height/2],oe=L.projectionMatrix.elements[5]*Be,{isOrthographicCamera:ot,top:qe,left:je,bottom:xe,right:tt}=L,ae=SA(L.matrixWorldInverse),ce=ot?`scale(${oe})translate(${Uf(-(tt+je)/2)}px,${Uf((qe+xe)/2)}px)`:`translateZ(${oe}px)`;let me=C.current.matrixWorld;f&&(me=L.matrixWorldInverse.clone().transpose().copyPosition(me).scale(C.current.scale),me.elements[3]=me.elements[7]=me.elements[11]=0,me.elements[15]=1),B.style.width=N.width+"px",B.style.height=N.height+"px",B.style.perspective=ot?"":`${oe}px`,W.current&&Y.current&&(W.current.style.transform=`${ce}${ae}translate(${Ue}px,${Be}px)`,Y.current.style.transform=bA(me,1/((u||10)/400)))}else{const Ue=u===void 0?1:wA(C.current,L)*u;B.style.transform=`translate3d(${K[0]}px,${K[1]}px,0) scale(${Ue})`}J.current=K,z.current=L.zoom}}}),Te.createElement("group",Hc({},S,{ref:C}))});var EA=Object.defineProperty,TA=(r,e,t)=>e in r?EA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,AA=(r,e,t)=>(TA(r,typeof e!="symbol"?e+"":e,t),t);class CA{constructor(){AA(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}var RA=Object.defineProperty,PA=(r,e,t)=>e in r?RA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,We=(r,e,t)=>(PA(r,typeof e!="symbol"?e+"":e,t),t);const Sc=new Qi,Kg=new ci,LA=Math.cos(70*(Math.PI/180)),Qg=(r,e)=>(r%e+e)%e;class DA extends CA{constructor(e,t){super(),We(this,"object"),We(this,"domElement"),We(this,"enabled",!0),We(this,"target",new R),We(this,"minDistance",0),We(this,"maxDistance",1/0),We(this,"minZoom",0),We(this,"maxZoom",1/0),We(this,"minPolarAngle",0),We(this,"maxPolarAngle",Math.PI),We(this,"minAzimuthAngle",-1/0),We(this,"maxAzimuthAngle",1/0),We(this,"enableDamping",!1),We(this,"dampingFactor",.05),We(this,"enableZoom",!0),We(this,"zoomSpeed",1),We(this,"enableRotate",!0),We(this,"rotateSpeed",1),We(this,"enablePan",!0),We(this,"panSpeed",1),We(this,"screenSpacePanning",!0),We(this,"keyPanSpeed",7),We(this,"zoomToCursor",!1),We(this,"autoRotate",!1),We(this,"autoRotateSpeed",2),We(this,"reverseOrbit",!1),We(this,"reverseHorizontalOrbit",!1),We(this,"reverseVerticalOrbit",!1),We(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),We(this,"mouseButtons",{LEFT:Wi.ROTATE,MIDDLE:Wi.DOLLY,RIGHT:Wi.PAN}),We(this,"touches",{ONE:qi.ROTATE,TWO:qi.DOLLY_PAN}),We(this,"target0"),We(this,"position0"),We(this,"zoom0"),We(this,"_domElementKeyEvents",null),We(this,"getPolarAngle"),We(this,"getAzimuthalAngle"),We(this,"setPolarAngle"),We(this,"setAzimuthalAngle"),We(this,"getDistance"),We(this,"getZoomScale"),We(this,"listenToKeyEvents"),We(this,"stopListenToKeyEvents"),We(this,"saveState"),We(this,"reset"),We(this,"update"),We(this,"connect"),We(this,"dispose"),We(this,"dollyIn"),We(this,"dollyOut"),We(this,"getScale"),We(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=U=>{let Q=Qg(U,2*Math.PI),ye=p.phi;ye<0&&(ye+=2*Math.PI),Q<0&&(Q+=2*Math.PI);let de=Math.abs(Q-ye);2*Math.PI-de<de&&(Q<ye?Q+=2*Math.PI:ye+=2*Math.PI),g.phi=Q-ye,n.update()},this.setAzimuthalAngle=U=>{let Q=Qg(U,2*Math.PI),ye=p.theta;ye<0&&(ye+=2*Math.PI),Q<0&&(Q+=2*Math.PI);let de=Math.abs(Q-ye);2*Math.PI-de<de&&(Q<ye?Q+=2*Math.PI:ye+=2*Math.PI),g.theta=Q-ye,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=U=>{U.addEventListener("keydown",ke),this._domElementKeyEvents=U},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ke),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),u=l.NONE},this.update=(()=>{const U=new R,Q=new R(0,1,0),ye=new nn().setFromUnitVectors(e.up,Q),de=ye.clone().invert(),Ie=new R,ut=new nn,Qe=2*Math.PI;return function(){const yn=n.object.position;ye.setFromUnitVectors(e.up,Q),de.copy(ye).invert(),U.copy(yn).sub(n.target),U.applyQuaternion(ye),p.setFromVector3(U),n.autoRotate&&u===l.NONE&&W(z()),n.enableDamping?(p.theta+=g.theta*n.dampingFactor,p.phi+=g.phi*n.dampingFactor):(p.theta+=g.theta,p.phi+=g.phi);let xn=n.minAzimuthAngle,fn=n.maxAzimuthAngle;isFinite(xn)&&isFinite(fn)&&(xn<-Math.PI?xn+=Qe:xn>Math.PI&&(xn-=Qe),fn<-Math.PI?fn+=Qe:fn>Math.PI&&(fn-=Qe),xn<=fn?p.theta=Math.max(xn,Math.min(fn,p.theta)):p.theta=p.theta>(xn+fn)/2?Math.max(xn,p.theta):Math.min(fn,p.theta)),p.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,p.phi)),p.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(m,n.dampingFactor):n.target.add(m),n.zoomToCursor&&q||n.object.isOrthographicCamera?p.radius=Ce(p.radius):p.radius=Ce(p.radius*d),U.setFromSpherical(p),U.applyQuaternion(de),yn.copy(n.target).add(U),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(g.theta*=1-n.dampingFactor,g.phi*=1-n.dampingFactor,m.multiplyScalar(1-n.dampingFactor)):(g.set(0,0,0),m.set(0,0,0));let mi=!1;if(n.zoomToCursor&&q){let kn=null;if(n.object instanceof It&&n.object.isPerspectiveCamera){const gi=U.length();kn=Ce(gi*d);const Ri=gi-kn;n.object.position.addScaledVector(D,Ri),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const gi=new R(N.x,N.y,0);gi.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/d)),n.object.updateProjectionMatrix(),mi=!0;const Ri=new R(N.x,N.y,0);Ri.unproject(n.object),n.object.position.sub(Ri).add(gi),n.object.updateMatrixWorld(),kn=U.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;kn!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(kn).add(n.object.position):(Sc.origin.copy(n.object.position),Sc.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Sc.direction))<LA?e.lookAt(n.target):(Kg.setFromNormalAndCoplanarPoint(n.object.up,n.target),Sc.intersectPlane(Kg,n.target))))}else n.object instanceof fi&&n.object.isOrthographicCamera&&(mi=d!==1,mi&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/d)),n.object.updateProjectionMatrix()));return d=1,q=!1,mi||Ie.distanceToSquared(n.object.position)>f||8*(1-ut.dot(n.object.quaternion))>f?(n.dispatchEvent(i),Ie.copy(n.object.position),ut.copy(n.object.quaternion),mi=!1,!0):!1}})(),this.connect=U=>{n.domElement=U,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",nt),n.domElement.addEventListener("pointerdown",O),n.domElement.addEventListener("pointercancel",te),n.domElement.addEventListener("wheel",Ee)},this.dispose=()=>{var U,Q,ye,de,Ie,ut;n.domElement&&(n.domElement.style.touchAction="auto"),(U=n.domElement)==null||U.removeEventListener("contextmenu",nt),(Q=n.domElement)==null||Q.removeEventListener("pointerdown",O),(ye=n.domElement)==null||ye.removeEventListener("pointercancel",te),(de=n.domElement)==null||de.removeEventListener("wheel",Ee),(Ie=n.domElement)==null||Ie.ownerDocument.removeEventListener("pointermove",P),(ut=n.domElement)==null||ut.ownerDocument.removeEventListener("pointerup",te),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",ke)};const n=this,i={type:"change"},s={type:"start"},a={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=l.NONE;const f=1e-6,p=new Ff,g=new Ff;let d=1;const m=new R,x=new ue,y=new ue,v=new ue,M=new ue,S=new ue,T=new ue,b=new ue,A=new ue,L=new ue,D=new R,N=new ue;let q=!1;const B=[],C={};function z(){return 2*Math.PI/60/60*n.autoRotateSpeed}function J(){return Math.pow(.95,n.zoomSpeed)}function W(U){n.reverseOrbit||n.reverseHorizontalOrbit?g.theta+=U:g.theta-=U}function Y(U){n.reverseOrbit||n.reverseVerticalOrbit?g.phi+=U:g.phi-=U}const X=(()=>{const U=new R;return function(ye,de){U.setFromMatrixColumn(de,0),U.multiplyScalar(-ye),m.add(U)}})(),ee=(()=>{const U=new R;return function(ye,de){n.screenSpacePanning===!0?U.setFromMatrixColumn(de,1):(U.setFromMatrixColumn(de,0),U.crossVectors(n.object.up,U)),U.multiplyScalar(ye),m.add(U)}})(),V=(()=>{const U=new R;return function(ye,de){const Ie=n.domElement;if(Ie&&n.object instanceof It&&n.object.isPerspectiveCamera){const ut=n.object.position;U.copy(ut).sub(n.target);let Qe=U.length();Qe*=Math.tan(n.object.fov/2*Math.PI/180),X(2*ye*Qe/Ie.clientHeight,n.object.matrix),ee(2*de*Qe/Ie.clientHeight,n.object.matrix)}else Ie&&n.object instanceof fi&&n.object.isOrthographicCamera?(X(ye*(n.object.right-n.object.left)/n.object.zoom/Ie.clientWidth,n.object.matrix),ee(de*(n.object.top-n.object.bottom)/n.object.zoom/Ie.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function re(U){n.object instanceof It&&n.object.isPerspectiveCamera||n.object instanceof fi&&n.object.isOrthographicCamera?d=U:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function K(U){re(d/U)}function pe(U){re(d*U)}function he(U){if(!n.zoomToCursor||!n.domElement)return;q=!0;const Q=n.domElement.getBoundingClientRect(),ye=U.clientX-Q.left,de=U.clientY-Q.top,Ie=Q.width,ut=Q.height;N.x=ye/Ie*2-1,N.y=-(de/ut)*2+1,D.set(N.x,N.y,1).unproject(n.object).sub(n.object.position).normalize()}function Ce(U){return Math.max(n.minDistance,Math.min(n.maxDistance,U))}function Ue(U){x.set(U.clientX,U.clientY)}function Be(U){he(U),b.set(U.clientX,U.clientY)}function oe(U){M.set(U.clientX,U.clientY)}function ot(U){y.set(U.clientX,U.clientY),v.subVectors(y,x).multiplyScalar(n.rotateSpeed);const Q=n.domElement;Q&&(W(2*Math.PI*v.x/Q.clientHeight),Y(2*Math.PI*v.y/Q.clientHeight)),x.copy(y),n.update()}function qe(U){A.set(U.clientX,U.clientY),L.subVectors(A,b),L.y>0?K(J()):L.y<0&&pe(J()),b.copy(A),n.update()}function je(U){S.set(U.clientX,U.clientY),T.subVectors(S,M).multiplyScalar(n.panSpeed),V(T.x,T.y),M.copy(S),n.update()}function xe(U){he(U),U.deltaY<0?pe(J()):U.deltaY>0&&K(J()),n.update()}function tt(U){let Q=!1;switch(U.code){case n.keys.UP:V(0,n.keyPanSpeed),Q=!0;break;case n.keys.BOTTOM:V(0,-n.keyPanSpeed),Q=!0;break;case n.keys.LEFT:V(n.keyPanSpeed,0),Q=!0;break;case n.keys.RIGHT:V(-n.keyPanSpeed,0),Q=!0;break}Q&&(U.preventDefault(),n.update())}function ae(){if(B.length==1)x.set(B[0].pageX,B[0].pageY);else{const U=.5*(B[0].pageX+B[1].pageX),Q=.5*(B[0].pageY+B[1].pageY);x.set(U,Q)}}function ce(){if(B.length==1)M.set(B[0].pageX,B[0].pageY);else{const U=.5*(B[0].pageX+B[1].pageX),Q=.5*(B[0].pageY+B[1].pageY);M.set(U,Q)}}function me(){const U=B[0].pageX-B[1].pageX,Q=B[0].pageY-B[1].pageY,ye=Math.sqrt(U*U+Q*Q);b.set(0,ye)}function Le(){n.enableZoom&&me(),n.enablePan&&ce()}function ve(){n.enableZoom&&me(),n.enableRotate&&ae()}function Ze(U){if(B.length==1)y.set(U.pageX,U.pageY);else{const ye=_e(U),de=.5*(U.pageX+ye.x),Ie=.5*(U.pageY+ye.y);y.set(de,Ie)}v.subVectors(y,x).multiplyScalar(n.rotateSpeed);const Q=n.domElement;Q&&(W(2*Math.PI*v.x/Q.clientHeight),Y(2*Math.PI*v.y/Q.clientHeight)),x.copy(y)}function Ve(U){if(B.length==1)S.set(U.pageX,U.pageY);else{const Q=_e(U),ye=.5*(U.pageX+Q.x),de=.5*(U.pageY+Q.y);S.set(ye,de)}T.subVectors(S,M).multiplyScalar(n.panSpeed),V(T.x,T.y),M.copy(S)}function Oe(U){const Q=_e(U),ye=U.pageX-Q.x,de=U.pageY-Q.y,Ie=Math.sqrt(ye*ye+de*de);A.set(0,Ie),L.set(0,Math.pow(A.y/b.y,n.zoomSpeed)),K(L.y),b.copy(A)}function St(U){n.enableZoom&&Oe(U),n.enablePan&&Ve(U)}function vt(U){n.enableZoom&&Oe(U),n.enableRotate&&Ze(U)}function O(U){var Q,ye;n.enabled!==!1&&(B.length===0&&((Q=n.domElement)==null||Q.ownerDocument.addEventListener("pointermove",P),(ye=n.domElement)==null||ye.ownerDocument.addEventListener("pointerup",te)),ze(U),U.pointerType==="touch"?le(U):ge(U))}function P(U){n.enabled!==!1&&(U.pointerType==="touch"?et(U):be(U))}function te(U){var Q,ye,de;k(U),B.length===0&&((Q=n.domElement)==null||Q.releasePointerCapture(U.pointerId),(ye=n.domElement)==null||ye.ownerDocument.removeEventListener("pointermove",P),(de=n.domElement)==null||de.ownerDocument.removeEventListener("pointerup",te)),n.dispatchEvent(a),u=l.NONE}function ge(U){let Q;switch(U.button){case 0:Q=n.mouseButtons.LEFT;break;case 1:Q=n.mouseButtons.MIDDLE;break;case 2:Q=n.mouseButtons.RIGHT;break;default:Q=-1}switch(Q){case Wi.DOLLY:if(n.enableZoom===!1)return;Be(U),u=l.DOLLY;break;case Wi.ROTATE:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enablePan===!1)return;oe(U),u=l.PAN}else{if(n.enableRotate===!1)return;Ue(U),u=l.ROTATE}break;case Wi.PAN:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enableRotate===!1)return;Ue(U),u=l.ROTATE}else{if(n.enablePan===!1)return;oe(U),u=l.PAN}break;default:u=l.NONE}u!==l.NONE&&n.dispatchEvent(s)}function be(U){if(n.enabled!==!1)switch(u){case l.ROTATE:if(n.enableRotate===!1)return;ot(U);break;case l.DOLLY:if(n.enableZoom===!1)return;qe(U);break;case l.PAN:if(n.enablePan===!1)return;je(U);break}}function Ee(U){n.enabled===!1||n.enableZoom===!1||u!==l.NONE&&u!==l.ROTATE||(U.preventDefault(),n.dispatchEvent(s),xe(U),n.dispatchEvent(a))}function ke(U){n.enabled===!1||n.enablePan===!1||tt(U)}function le(U){switch(we(U),B.length){case 1:switch(n.touches.ONE){case qi.ROTATE:if(n.enableRotate===!1)return;ae(),u=l.TOUCH_ROTATE;break;case qi.PAN:if(n.enablePan===!1)return;ce(),u=l.TOUCH_PAN;break;default:u=l.NONE}break;case 2:switch(n.touches.TWO){case qi.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Le(),u=l.TOUCH_DOLLY_PAN;break;case qi.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ve(),u=l.TOUCH_DOLLY_ROTATE;break;default:u=l.NONE}break;default:u=l.NONE}u!==l.NONE&&n.dispatchEvent(s)}function et(U){switch(we(U),u){case l.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ze(U),n.update();break;case l.TOUCH_PAN:if(n.enablePan===!1)return;Ve(U),n.update();break;case l.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;St(U),n.update();break;case l.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;vt(U),n.update();break;default:u=l.NONE}}function nt(U){n.enabled!==!1&&U.preventDefault()}function ze(U){B.push(U)}function k(U){delete C[U.pointerId];for(let Q=0;Q<B.length;Q++)if(B[Q].pointerId==U.pointerId){B.splice(Q,1);return}}function we(U){let Q=C[U.pointerId];Q===void 0&&(Q=new ue,C[U.pointerId]=Q),Q.set(U.pageX,U.pageY)}function _e(U){const Q=U.pointerId===B[0].pointerId?B[1]:B[0];return C[Q.pointerId]}this.dollyIn=(U=J())=>{pe(U),n.update()},this.dollyOut=(U=J())=>{K(U),n.update()},this.getScale=()=>d,this.setScale=U=>{re(U),n.update()},this.getZoomScale=()=>J(),t!==void 0&&this.connect(t),this.update()}}let IA=class extends DA{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=Wi.PAN,this.mouseButtons.RIGHT=Wi.ROTATE,this.touches.ONE=qi.PAN,this.touches.TWO=qi.DOLLY_ROTATE}};function VA({stops:r,colors:e,size:t=1024,...n}){const i=Xi(a=>a.gl),s=Te.useMemo(()=>{const a=document.createElement("canvas"),l=a.getContext("2d");a.width=16,a.height=t;const u=l.createLinearGradient(0,0,0,t);let f=r.length;for(;f--;)u.addColorStop(r[f],e[f]);l.fillStyle=u,l.fillRect(0,0,16,t);const p=new Ut(a);return p.needsUpdate=!0,p},[r]);return Te.useEffect(()=>()=>void s.dispose(),[s]),Te.createElement("primitive",Hc({object:s,attach:"map",encoding:i.outputEncoding},n))}function WA({userData:r,children:e,geometry:t,threshold:n=15,color:i="black",...s}){const a=Te.useRef(null);return Te.useLayoutEffect(()=>{const l=a.current.parent;if(l){const u=t||l.geometry;(u!==a.current.userData.currentGeom||n!==a.current.userData.currentThreshold)&&(a.current.userData.currentGeom=u,a.current.userData.currentThreshold=n,a.current.geometry=new lu(u,n))}}),Te.createElement("lineSegments",Hc({ref:a,raycast:()=>null},s),e||Te.createElement("lineBasicMaterial",{color:i}))}const qA=Te.forwardRef((r={enableDamping:!0},e)=>{const{camera:t,onChange:n,onStart:i,onEnd:s,...a}=r,l=Xi(({invalidate:d})=>d),u=Xi(({camera:d})=>d),f=Xi(({gl:d})=>d.domElement),p=t||u,g=Te.useMemo(()=>new IA(p),[p]);return Te.useEffect(()=>{g.connect(f);const d=m=>{l(),n&&n(m)};return g.addEventListener("change",d),i&&g.addEventListener("start",i),s&&g.addEventListener("end",s),()=>{g.dispose(),g.removeEventListener("change",d),i&&g.removeEventListener("start",i),s&&g.removeEventListener("end",s)}},[n,i,s,g,l,f]),_x(()=>g.update()),Te.createElement("primitive",Hc({ref:e,dispose:void 0,object:g,enableDamping:!0},a))});export{kA as C,WA as E,VA as G,HA as H,qA as M,BA as a,_x as b,yv as c,FA as d,NA as s,Xi as u,OA as w};
|